tarsk 0.5.34 → 0.5.35

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 (82) hide show
  1. package/README.md +2 -0
  2. package/dist/index.js +1283 -789
  3. package/dist/public/assets/account-view-k5jIArY-.js +1 -0
  4. package/dist/public/assets/api-OCjPhv01.js +1 -0
  5. package/dist/public/assets/browser-tab-C9kJT-C5.js +1 -0
  6. package/dist/public/assets/commit-dialog-8Ce6d3H8.js +1 -0
  7. package/dist/public/assets/context-menu-CMsWrzLD.js +1 -0
  8. package/dist/public/assets/create-repo-dialog-CVUtteNS.js +1 -0
  9. package/dist/public/assets/{dialogs-config-Ct6i8Iij.js → dialogs-config-B4TDFSrS.js} +14 -14
  10. package/dist/public/assets/diff-view-DGfmGlB_.js +3 -0
  11. package/dist/public/assets/explorer-tab-view-CCXVTkVu.js +2 -0
  12. package/dist/public/assets/explorer-tree-uXbr6cCI.js +1 -0
  13. package/dist/public/assets/explorer-view-CupxzDId.js +1 -0
  14. package/dist/public/assets/git-history-dialog-BCGOZ6ua.js +1 -0
  15. package/dist/public/assets/git-ops-button-BV9X3fo-.js +2 -0
  16. package/dist/public/assets/history-view-Ds_0e_bx.js +7 -0
  17. package/dist/public/assets/index-C0lTt0ZK.css +1 -0
  18. package/dist/public/assets/index-DOsSr4dl.js +65 -0
  19. package/dist/public/assets/mcp-server-card-DrUUKNXv.js +1 -0
  20. package/dist/public/assets/merged-pr-dialog-DqWSFdCH.js +1 -0
  21. package/dist/public/assets/onboarding-DfL8a0LZ.js +1 -0
  22. package/dist/public/assets/project-settings-view-Cd_l3Lfy.js +1 -0
  23. package/dist/public/assets/providers-list-view-VXhgM3vp.js +1 -0
  24. package/dist/public/assets/pull-request-dialog-DZXTHHuh.js +1 -0
  25. package/dist/public/assets/pull-with-changes-dialog-CYQrwzcw.js +1 -0
  26. package/dist/public/assets/push-before-pr-dialog-D-ZnRpJi.js +1 -0
  27. package/dist/public/assets/radio-group-c0sU992r.js +1 -0
  28. package/dist/public/assets/react-vendor-unlDVFpU.js +16 -0
  29. package/dist/public/assets/settings-general-view-DI-lvP0L.js +1 -0
  30. package/dist/public/assets/settings-instructions-view-kUG32_dT.js +1 -0
  31. package/dist/public/assets/settings-list-CUbZrggr.js +1 -0
  32. package/dist/public/assets/settings-mcp-servers-view-DmxUO42I.js +5 -0
  33. package/dist/public/assets/{settings-models-skeleton-CN2JkqZh.js → settings-models-skeleton-B_56ozbA.js} +1 -1
  34. package/dist/public/assets/settings-models-view-ms828HDa.js +1 -0
  35. package/dist/public/assets/settings-rules-view-Xx0ymfnQ.js +8 -0
  36. package/dist/public/assets/settings-skills-view-DvPPdsi_.js +2 -0
  37. package/dist/public/assets/settings-slash-commands-view-BULIAW2o.js +1 -0
  38. package/dist/public/assets/settings-subagents-view-B7FcLaZT.js +2 -0
  39. package/dist/public/assets/{settings-system-prompt-view-BNM_15ry.js → settings-system-prompt-view-66zf0gRc.js} +1 -1
  40. package/dist/public/assets/settings-view-B4CMq7it.js +2 -0
  41. package/dist/public/assets/skeleton-BvSNJL9q.js +1 -0
  42. package/dist/public/assets/{terminal-panel-Ds1tCgQA.js → terminal-panel-Bm5ECpK_.js} +2 -2
  43. package/dist/public/assets/{ui-components-Di-9yNr4.js → ui-components-BZYnvMGc.js} +1 -1
  44. package/dist/public/assets/{utils-DDDR42pW.js → utils-umVhs9to.js} +1 -1
  45. package/dist/public/index.html +7 -7
  46. package/package.json +1 -1
  47. package/dist/public/assets/account-view-Ds03urJE.js +0 -1
  48. package/dist/public/assets/api-BHfaVqlR.js +0 -1
  49. package/dist/public/assets/browser-tab-Qs8cnQkf.js +0 -1
  50. package/dist/public/assets/commit-dialog-D4suPxEe.js +0 -1
  51. package/dist/public/assets/context-menu-S8y0c1Fx.js +0 -1
  52. package/dist/public/assets/create-repo-dialog-DPKIg1mY.js +0 -1
  53. package/dist/public/assets/diff-view-rKDEnBLg.js +0 -3
  54. package/dist/public/assets/explorer-tab-view-JbLbPVAn.js +0 -2
  55. package/dist/public/assets/explorer-tree-Dq44yA1j.js +0 -1
  56. package/dist/public/assets/explorer-view-BMrlX2hb.js +0 -1
  57. package/dist/public/assets/git-history-dialog-CDwIqSZQ.js +0 -1
  58. package/dist/public/assets/git-ops-button-B6rEla5u.js +0 -2
  59. package/dist/public/assets/history-view-CFot099O.js +0 -7
  60. package/dist/public/assets/index-6DhhjIBL.js +0 -65
  61. package/dist/public/assets/index-sEZ3wJXu.css +0 -1
  62. package/dist/public/assets/mcp-server-card-DQY1RUPX.js +0 -1
  63. package/dist/public/assets/merged-pr-dialog-H_fuSmiF.js +0 -1
  64. package/dist/public/assets/onboarding-DHCR18iU.js +0 -1
  65. package/dist/public/assets/project-settings-view-CiefnK73.js +0 -1
  66. package/dist/public/assets/providers-list-view-DVopskGo.js +0 -1
  67. package/dist/public/assets/pull-request-dialog-Csql6eob.js +0 -1
  68. package/dist/public/assets/pull-with-changes-dialog-DN0kE6os.js +0 -1
  69. package/dist/public/assets/push-before-pr-dialog-IhdlLvWt.js +0 -1
  70. package/dist/public/assets/radio-group-BaKkAEZR.js +0 -1
  71. package/dist/public/assets/react-vendor-CjZZeCRj.js +0 -16
  72. package/dist/public/assets/settings-general-view-BMTxN35t.js +0 -1
  73. package/dist/public/assets/settings-instructions-view-DULFg6dU.js +0 -1
  74. package/dist/public/assets/settings-list-Bdeuh4bJ.js +0 -1
  75. package/dist/public/assets/settings-mcp-servers-view-CRCtWjP2.js +0 -5
  76. package/dist/public/assets/settings-models-view-DosllhVB.js +0 -1
  77. package/dist/public/assets/settings-rules-view-BVWuGrnB.js +0 -8
  78. package/dist/public/assets/settings-skills-view-DYtcAu9-.js +0 -2
  79. package/dist/public/assets/settings-slash-commands-view-DFyL1W2n.js +0 -1
  80. package/dist/public/assets/settings-subagents-view-aCbK95Sk.js +0 -2
  81. package/dist/public/assets/settings-view-D5GE_CYR.js +0 -2
  82. package/dist/public/assets/skeleton-pSKdmWyJ.js +0 -1
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Jn as t,Ti as n,br as r,fo as i,ii as a,mo as o,n as s,ni as c,nr as l,q as u,r as d,ta as ee,vi as f,yn as p}from"./dialogs-config-B4TDFSrS.js";import{a as m,i as h,o as g,r as _}from"./react-vendor-unlDVFpU.js";import{D as te,E as ne,S as re,b as v}from"./history-view-Ds_0e_bx.js";import{t as ie}from"./index-DOsSr4dl.js";var ae=i(),y=e(o(),1),b=n(),oe=y.forwardRef((e,t)=>{let n=(0,ae.c)(11),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 o;n[3]===r?o=n[4]:(o=a(`relative flex w-full touch-none select-none items-center`,r),n[3]=r,n[4]=o);let s,c;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,b.jsx)(g,{className:`relative h-2 w-full grow overflow-hidden rounded-full bg-secondary`,children:(0,b.jsx)(_,{className:`absolute h-full bg-primary`})}),c=(0,b.jsx)(m,{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]=c):(s=n[5],c=n[6]);let l;return n[7]!==i||n[8]!==t||n[9]!==o?(l=(0,b.jsxs)(h,{ref:t,className:o,...i,children:[s,c]}),n[7]=i,n[8]=t,n[9]=o,n[10]=l):l=n[10],l});oe.displayName=h.displayName;var x=50;function se(){let[e,t]=(0,y.useState)(x),[n,r]=(0,y.useState)(x.toString()),[i,a]=(0,y.useState)(!0),[o,s]=(0,y.useState)(!1);(0,y.useEffect)(()=>{let e=!1;async function n(){try{let n=await u();e||(t(n.maximumTurnCount),r(n.maximumTurnCount.toString()))}catch(e){console.error(`Failed to load maximum turn count:`,e)}finally{e||a(!1)}}return n(),()=>{e=!0}},[]);function c(e){r(e)}async function l(e){s(!0);try{let n=await p({maximumTurnCount:e});t(n.maximumTurnCount),r(n.maximumTurnCount.toString())}catch(e){throw console.error(`Failed to update maximum turn count:`,e),e}finally{s(!1)}}function d(){r(e.toString())}return{defaultMaximumTurnCount:x,draftMaximumTurnCount:n,isLoading:i,isSaving:o,maximumTurnCount:e,resetDraftMaximumTurnCount:d,setDraftMaximumTurnCount:c,updateMaximumTurnCount:l}}var ce=`local`;function le(){let[e,t]=(0,y.useState)(ce),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)([]),[o,s]=(0,y.useState)(!0),[c,l]=(0,y.useState)(!1);(0,y.useEffect)(()=>{let e=!1;async function n(){try{let n=await u();e||(t(n.serverBindMode),r(n.serverBindMode),a(n.networkAddresses))}catch(e){console.error(`Failed to load server bind mode:`,e)}finally{e||s(!1)}}return n(),()=>{e=!0}},[]);async function d(e){l(!0);try{let n=await p({serverBindMode:e});t(n.serverBindMode),a(n.networkAddresses)}catch(e){throw console.error(`Failed to update server bind mode:`,e),e}finally{l(!1)}}return{defaultServerBindMode:ce,hasServerBindModeChanged:n!==null&&e!==n,isLoading:o,isSaving:c,networkAddresses:i,serverBindMode:e,updateServerBindMode:d}}var ue=`default`;function de(){let e=(0,ae.c)(3),[t,n]=(0,y.useState)(fe),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=e=>{n(e),l(e)},e[0]=r):r=e[0];let i=r,a;return e[1]===t?a=e[2]:(a={voiceModel:t,updateVoiceModel:i,defaultVoiceModel:ue},e[1]=t,e[2]=a),a}function fe(){return t(ue)}var pe=[{value:`default`,label:`Standard`},{value:`tiny`,label:`Tiny`}],me=[{value:`local`,label:`Local`},{value:`network`,label:`Network`}],he=[`462`,`8100`].includes(typeof document<`u`?document.location.port:``)?`462`:`641`,ge=600;function _e(e){let t=(0,ae.c)(94),{onboardingResetSignal:n}=e,i=n===void 0?0:n,[o,l]=(0,y.useState)(!1),{scale:u,updateScale:d,resetScale:p,min:m,max:h,default:g}=ie(),{defaultMaximumTurnCount:_,draftMaximumTurnCount:x,isLoading:ce,isSaving:ue,resetDraftMaximumTurnCount:fe,setDraftMaximumTurnCount:_e,updateMaximumTurnCount:xe}=se(),{voiceModel:Se,updateVoiceModel:Ce}=de(),{hasServerBindModeChanged:we,isLoading:Te,isSaving:Ee,networkAddresses:S,serverBindMode:C,updateServerBindMode:De}=le(),w,T;t[0]===i?(w=t[1],T=t[2]):(w=()=>{if(i===0)return;l(!0);let e=setTimeout(()=>{l(!1)},ge);return()=>{clearTimeout(e)}},T=[i],t[0]=i,t[1]=w,t[2]=T),(0,y.useEffect)(w,T);let E;t[3]===_e?E=t[4]:(E=function(e){_e(e.target.value)},t[3]=_e,t[4]=E);let Oe=E,D;t[5]!==_||t[6]!==x||t[7]!==fe||t[8]!==xe?(D=async function(){let e=Number.parseInt(x,10),t=Number.isFinite(e)&&e>0?e:_;try{await xe(t)}catch{fe()}},t[5]=_,t[6]=x,t[7]=fe,t[8]=xe,t[9]=D):D=t[9];let ke=D,Ae;t[10]===d?Ae=t[11]:(Ae=function(e){e.length>0&&d(e[0])},t[10]=d,t[11]=Ae);let je=Ae,Me=o&&`animate-headline-reset`,O;t[12]===Me?O=t[13]:(O=a(Me),t[12]=Me,t[13]=O);let k;t[14]===O?k=t[15]:(k=(0,b.jsx)(re,{title:`General`,description:`Customize the appearance and behavior of Tarsk.`,titleClassName:O}),t[14]=O,t[15]=k);let Ne,Pe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,b.jsx)(ee,{className:`h-3.5 w-3.5`}),Pe=(0,b.jsx)(`span`,{className:`sr-only`,children:`Reset font size to default`}),t[16]=Ne,t[17]=Pe):(Ne=t[16],Pe=t[17]);let A;t[18]===p?A=t[19]:(A=(0,b.jsxs)(c,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:p,children:[Ne,Pe]}),t[18]=p,t[19]=A);let j;t[20]===u?j=t[21]:(j=(0,b.jsxs)(`span`,{className:`${f.mono} tabular-nums w-12 text-right`,children:[u,`%`]}),t[20]=u,t[21]=j);let M;t[22]!==A||t[23]!==j?(M=(0,b.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[A,j]}),t[22]=A,t[23]=j,t[24]=M):M=t[24];let N;t[25]===m?N=t[26]:(N=(0,b.jsxs)(`span`,{className:`${f.bodyMuted} w-8 text-right`,children:[m,`%`]}),t[25]=m,t[26]=N);let P;t[27]===u?P=t[28]:(P=[u],t[27]=u,t[28]=P);let F;t[29]!==je||t[30]!==h||t[31]!==m||t[32]!==P?(F=(0,b.jsx)(oe,{value:P,min:m,max:h,step:5,onValueChange:je,"aria-label":`Font size`}),t[29]=je,t[30]=h,t[31]=m,t[32]=P,t[33]=F):F=t[33];let I;t[34]===h?I=t[35]:(I=(0,b.jsxs)(`span`,{className:`${f.bodyMuted} w-9`,children:[h,`%`]}),t[34]=h,t[35]=I);let L;t[36]!==N||t[37]!==F||t[38]!==I?(L=(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[N,F,I]}),t[36]=N,t[37]=F,t[38]=I,t[39]=L):L=t[39];let R;t[40]!==g||t[41]!==u?(R=u!==g&&(0,b.jsxs)(`p`,{className:`${f.bodyMuted} mt-2`,children:[`Font size has been changed from the default (`,g,`%).`]}),t[40]=g,t[41]=u,t[42]=R):R=t[42];let z;t[43]!==M||t[44]!==L||t[45]!==R?(z=(0,b.jsxs)(v,{title:`Font Size`,description:`Adjust the text size across the entire application.`,action:M,children:[L,R]}),t[43]=M,t[44]=L,t[45]=R,t[46]=z):z=t[46];let B;t[47]===ke?B=t[48]:(B=()=>{ke()},t[47]=ke,t[48]=B);let Fe=ce||ue,V;t[49]!==x||t[50]!==Oe||t[51]!==B||t[52]!==Fe?(V=(0,b.jsx)(r,{type:`number`,min:1,step:1,value:x,onChange:Oe,onBlur:B,disabled:Fe,"aria-label":`Maximum turn count`,className:`w-28 text-right font-mono tabular-nums flex-shrink-0`}),t[49]=x,t[50]=Oe,t[51]=B,t[52]=Fe,t[53]=V):V=t[53];let H;t[54]===_?H=t[55]:(H=(0,b.jsxs)(`p`,{className:f.bodyMuted,children:[`Default: `,_,` turns.`]}),t[54]=_,t[55]=H);let U;t[56]!==V||t[57]!==H?(U=(0,b.jsx)(v,{title:`Maximum Turn Count`,description:`Set how many turns a long-running agent chat can take before Tarsk asks whether to continue.`,action:V,children:H}),t[56]=V,t[57]=H,t[58]=U):U=t[58];let W;t[59]===Ce?W=t[60]:(W=e=>{(e==="default"||e===`tiny`)&&Ce(e)},t[59]=Ce,t[60]=W);let G;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(G=pe.map(be),t[61]=G):G=t[61];let K;t[62]!==W||t[63]!==Se?(K=(0,b.jsx)(v,{title:`Voice Model`,description:`Choose which voice-to-text model Tarsk downloads and caches for speech input.`,children:(0,b.jsx)(s,{type:`single`,value:Se,onValueChange:W,"aria-label":`Voice model`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:G})}),t[62]=W,t[63]=Se,t[64]=K):K=t[64];let Ie=C===`network`?`Tarsk accepts connections from other devices on your network such as the Tarsk mobile app.`:`Tarsk only accepts connections from this computer at http://localhost:${he}.`,Le=Te||Ee,q;t[65]===De?q=t[66]:(q=e=>{(e===`local`||e===`network`)&&De(e)},t[65]=De,t[66]=q);let Re;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Re=me.map(ye),t[67]=Re):Re=t[67];let J;t[68]!==C||t[69]!==Le||t[70]!==q?(J=(0,b.jsx)(s,{type:`single`,value:C,disabled:Le,onValueChange:q,"aria-label":`Server bind mode`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:Re}),t[68]=C,t[69]=Le,t[70]=q,t[71]=J):J=t[71];let Y;t[72]!==S||t[73]!==C?(Y=C===`network`&&S.length>0&&(0,b.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[(0,b.jsx)(`p`,{className:f.bodyMuted,children:`Available on your network:`}),(0,b.jsx)(`ul`,{className:`${f.mono} space-y-1`,children:S.map(ve)})]}),t[72]=S,t[73]=C,t[74]=Y):Y=t[74];let X;t[75]!==S||t[76]!==C?(X=C===`network`&&S.length===0&&(0,b.jsx)(`p`,{className:`${f.bodyMuted} mt-3`,children:`No network IP addresses were detected on this computer.`}),t[75]=S,t[76]=C,t[77]=X):X=t[77];let Z;t[78]===we?Z=t[79]:(Z=we&&(0,b.jsx)(`p`,{className:`${f.bodyMuted} mt-3`,children:`Restart Tarsk for this change to take effect.`}),t[78]=we,t[79]=Z);let Q;t[80]!==Ie||t[81]!==J||t[82]!==Y||t[83]!==X||t[84]!==Z?(Q=(0,b.jsxs)(v,{title:`Local`,description:Ie,children:[J,Y,X,Z]}),t[80]=Ie,t[81]=J,t[82]=Y,t[83]=X,t[84]=Z,t[85]=Q):Q=t[85];let $;t[86]!==z||t[87]!==U||t[88]!==K||t[89]!==Q?($=(0,b.jsxs)(`div`,{className:`space-y-8`,children:[z,U,K,Q]}),t[86]=z,t[87]=U,t[88]=K,t[89]=Q,t[90]=$):$=t[90];let ze;return t[91]!==$||t[92]!==k?(ze=(0,b.jsx)(te,{children:(0,b.jsxs)(ne,{children:[k,$]})}),t[91]=$,t[92]=k,t[93]=ze):ze=t[93],ze}function ve(e){return(0,b.jsxs)(`li`,{children:[`http://`,e,`:`,he]},e)}function ye(e){return(0,b.jsx)(d,{value:e.value,"aria-label":e.label,className:`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm dark:data-[state=on]:bg-background dark:data-[state=on]:text-foreground`,children:e.label},e.value)}function be(e){return(0,b.jsx)(d,{value:e.value,"aria-label":e.label,className:`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm dark:data-[state=on]:bg-background dark:data-[state=on]:text-foreground`,children:e.label},e.value)}export{_e as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dt as t,Ti as n,an as r,ii as i,mo as a,ni as o,vi as s,ya as c}from"./dialogs-config-B4TDFSrS.js";import{E as l,S as u,T as d,w as f}from"./history-view-Ds_0e_bx.js";import{E as p,O as m,j as h}from"./index-DOsSr4dl.js";var g=e(a(),1),_=n();function v(){let e=h(e=>e.selectedThreadId),[n,a]=(0,g.useState)(``),[v,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(!1);(0,g.useEffect)(()=>{e&&(y(!0),t(e,`AGENTS.md`).then(e=>a(e.content)).catch(()=>a(``)).finally(()=>y(!1)))},[e]);async function S(){if(e){x(!0);try{await r(e,`AGENTS.md`,n),p({title:`Instructions saved`})}catch(e){p({title:`Error`,description:e instanceof Error?e.message:`Failed to save instructions`,variant:`destructive`})}finally{x(!1)}}}return e?(0,_.jsx)(f,{children:(0,_.jsxs)(l,{className:`w-full flex-1 flex flex-col min-h-0`,children:[(0,_.jsx)(u,{title:`Instructions`,description:`Add context like coding guidelines and expectations. Stored in AGENTS.md file.`,action:(0,_.jsx)(o,{onClick:S,disabled:v||b,children:b?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(c,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`})}),v?(0,_.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,_.jsx)(c,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,_.jsx)(m,{value:n,onChange:e=>a(e.target.value),className:i(s.mono,`flex-1 min-h-0 resize-none`),placeholder:`Add instructions for your agent in AGENTS.md...`,disabled:b})]})}):(0,_.jsx)(d,{children:`Select a thread to edit instructions.`})}export{v as SettingsInstructionsView,v as default};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-aKtaBQYM.js";import{Ti as e,Zi as t,ar as n,br as r,fo as i,ii as a,ir as o,mo as s,ni as c,or as l,rr as u,vi as d}from"./dialogs-config-B4TDFSrS.js";import{i as f,r as p}from"./history-view-Ds_0e_bx.js";var m=i();s();var h=e();function g(e){let t=(0,m.c)(16),{title:n,subtitle:r,subtitleMono:i,badge:o,actions:s}=e,c=i===void 0?!1:i,l;t[0]===n?l=t[1]:(l=typeof n==`string`?(0,h.jsx)(`h3`,{className:a(d.label,`truncate`),children:n}):n,t[0]=n,t[1]=l);let u;t[2]!==o||t[3]!==l?(u=(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l,o]}),t[2]=o,t[3]=l,t[4]=u):u=t[4];let g;t[5]!==r||t[6]!==c?(g=r?(0,h.jsx)(`p`,{className:a(d.bodyMuted,`mt-1 truncate`,c&&d.mono),children:r}):null,t[5]=r,t[6]=c,t[7]=g):g=t[7];let v;t[8]!==u||t[9]!==g?(v=(0,h.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[u,g]}),t[8]=u,t[9]=g,t[10]=v):v=t[10];let y;t[11]===s?y=t[12]:(y=(0,h.jsx)(_,{actions:s}),t[11]=s,t[12]=y);let b;return t[13]!==v||t[14]!==y?(b=(0,h.jsx)(p,{children:(0,h.jsxs)(f,{className:`flex items-center justify-between p-4`,children:[v,y]})}),t[13]=v,t[14]=y,t[15]=b):b=t[15],b}function _(e){let t=(0,m.c)(4),{actions:r}=e,i;t[0]===r?i=t[1]:(i=r.map(v),t[0]=r,t[1]=i);let a;return t[2]===i?a=t[3]:(a=(0,h.jsx)(n,{delayDuration:300,children:(0,h.jsx)(`div`,{className:`flex items-center gap-1 ml-4 flex-shrink-0`,children:i})}),t[2]=i,t[3]=a),a}function v(e){return(0,h.jsxs)(u,{children:[(0,h.jsx)(l,{asChild:!0,children:(0,h.jsx)(c,{variant:`ghost`,size:`icon-sm`,onClick:e.onClick,children:(0,h.jsx)(`span`,{className:e.destructive?`text-destructive`:void 0,children:e.icon})})}),(0,h.jsx)(o,{children:e.label})]},e.label)}function y(e){let t=(0,m.c)(12),{icon:n,title:r,description:i}=e,o;t[0]===n?o=t[1]:(o=(0,h.jsx)(n,{className:`mx-auto h-10 w-10 text-muted-foreground/50 mb-3`}),t[0]=n,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=a(d.emptyStateTitle,`mb-1`),t[2]=s):s=t[2];let c;t[3]===r?c=t[4]:(c=(0,h.jsx)(`h3`,{className:s,children:r}),t[3]=r,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=a(d.bodyMuted,`mb-3`),t[5]=l):l=t[5];let u;t[6]===i?u=t[7]:(u=(0,h.jsx)(`p`,{className:l,children:i}),t[6]=i,t[7]=u);let f;return t[8]!==o||t[9]!==c||t[10]!==u?(f=(0,h.jsxs)(`div`,{className:`text-center py-12 border border-dashed rounded-lg mb-8`,children:[o,c,u]}),t[8]=o,t[9]=c,t[10]=u,t[11]=f):f=t[11],f}function b(e){let n=(0,m.c)(7),{placeholder:i,value:a,onChange:o}=e,s;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,h.jsx)(t,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),n[0]=s):s=n[0];let c;n[1]===o?c=n[2]:(c=e=>o(e.target.value),n[1]=o,n[2]=c);let l;return n[3]!==i||n[4]!==c||n[5]!==a?(l=(0,h.jsxs)(`div`,{className:`relative mb-4`,children:[s,(0,h.jsx)(r,{placeholder:i,value:a,onChange:c,className:`pl-8`})]}),n[3]=i,n[4]=c,n[5]=a,n[6]=l):l=n[6],l}function x(e){let t=(0,m.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,h.jsx)(`div`,{className:`grid gap-2 [grid-template-columns:repeat(auto-fill,minmax(min(220px,100%),1fr))]`,children:n}),t[0]=n,t[1]=r),r}function S(e){let t=(0,m.c)(3),{searchQuery:n,emptyLabel:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=a(d.bodyMuted,`text-center py-8`),t[0]=i):i=t[0];let o=n.trim()?`No results for "${n}"`:r,s;return t[1]===o?s=t[2]:(s=(0,h.jsx)(`p`,{className:i,children:o}),t[1]=o,t[2]=s),s}function C(e){let t=(0,m.c)(3),{message:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=a(d.bodyMuted,`text-center py-8`),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,h.jsx)(`p`,{className:r,children:n}),t[1]=n,t[2]=i),i}export{b as a,S as i,g as n,C as o,x as r,y as t};
@@ -0,0 +1,5 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,La as n,Li as r,Sr as i,Ti as a,Yi as o,aa as s,at as c,br as l,fo as u,k as d,lt as f,mo as p,ni as m,nn as h,ra as g,vi as _,xr as v}from"./dialogs-config-B4TDFSrS.js";import{A as y,C as b,D as ee,E as x,F as S,M as C,N as w,O as T,P as E,S as te,T as D,b as O,d as k,f as A,g as j,h as M,j as N,k as P,p as F,y as I}from"./history-view-Ds_0e_bx.js";import{C as L,E as R,O as z,c as B,j as V,l as ne,s as re,u as H}from"./index-DOsSr4dl.js";import{t as U}from"./skeleton-BvSNJL9q.js";import{a as W,i as ie,n as G,r as K,t as ae}from"./settings-list-CUbZrggr.js";import{t as oe}from"./mcp-server-card-DrUUKNXv.js";var q=u(),J=e(p(),1);function se(e){let[t,n]=(0,J.useState)([]),[r,i]=(0,J.useState)(!1),a=(0,J.useCallback)(async()=>{if(e){i(!0);try{let t=await c(e);n(Object.entries(t.servers??{}).map(([e,t])=>({name:e,config:t})))}catch{n([])}finally{i(!1)}}},[e]);return(0,J.useEffect)(()=>{a()},[a]),{installedServers:t,loadingConfig:r,loadInstalledServers:a}}function Y(){let e=(0,q.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,J.useState)(t),i,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{f().then(r).catch(()=>r([]))},a=[],e[1]=i,e[2]=a):(i=e[1],a=e[2]),(0,J.useEffect)(i,a);let o;return e[3]===n?o=e[4]:(o={popularServers:n},e[3]=n,e[4]=o),o}async function X(e,t,n){await h(e,t,n)}async function ce(e,t){await d(e,t)}var Z=a();function le(e){return e?.url?`remote`:`local`}function ue(e){return Object.entries(e??{}).map(([e,t])=>({key:e,value:t}))}function Q({projectPath:e,serverName:n,initialName:r,initialConfig:i,onBack:a}){let{installedServers:o}=se(e),s=!!n,[c,u]=(0,J.useState)(`local`),[d,f]=(0,J.useState)(``),[p,h]=(0,J.useState)(``),[v,y]=(0,J.useState)(``),[b,x]=(0,J.useState)(``),[S,C]=(0,J.useState)(`sse`),[w,T]=(0,J.useState)([]),[E,D]=(0,J.useState)([]),[N,P]=(0,J.useState)(!1),[L,V]=(0,J.useState)(!1),[U,W]=(0,J.useState)(null),[ie,G]=(0,J.useState)(s),[K,ae]=(0,J.useState)(``),[oe,q]=(0,J.useState)(``);function Y(e,t){let n=le(t);u(n),f(e),h(t.command??``),y((t.args??[]).join(`
2
+ `)),x(t.url??``),C(t.transport??`sse`),T(ue(t.env)),D(ue(t.headers)),ae(e),q(JSON.stringify({name:e,type:n,config:t}))}(0,J.useEffect)(()=>{if(s&&n){let e=o.find(e=>e.name===n);e&&(Y(e.name,e.config),G(!1))}else i&&Y(r??``,i),G(!1)},[o,n,s,i,r]);let Q=(0,J.useCallback)(()=>{T(e=>[...e,{key:``,value:``}])},[]),$=(0,J.useCallback)(e=>{T(t=>t.filter((t,n)=>n!==e))},[]),de=(0,J.useCallback)((e,t)=>{T(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),fe=(0,J.useCallback)((e,t)=>{T(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]),pe=(0,J.useCallback)(()=>{D(e=>[...e,{key:``,value:``}])},[]),me=(0,J.useCallback)(e=>{D(t=>t.filter((t,n)=>n!==e))},[]),he=(0,J.useCallback)((e,t)=>{D(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),ge=(0,J.useCallback)((e,t)=>{D(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]);function _e(e){let t={};for(let{key:n,value:r}of e)n.trim()&&(t[n.trim()]=r);return Object.keys(t).length>0?t:void 0}function ve(){let e=_e(w);if(c===`remote`){let t=_e(E);return{url:b.trim(),transport:S,...t?{headers:t}:{},...e?{env:e}:{}}}let t=v.split(`
3
+ `).map(e=>e.trim()).filter(Boolean);return{command:p.trim(),args:t,...e?{env:e}:{}}}let ye=JSON.stringify({name:d.trim(),type:c,config:ve()}),be=async()=>{W(null);let t=d.trim();if(!t){W(`Server name is required`);return}if(c===`remote`){if(!b.trim()){W(`Server URL is required`);return}try{new URL(b.trim())}catch{W(`Server URL must be a valid URL`);return}}else if(!p.trim()){W(`Command is required`);return}P(!0);try{if(!e)throw Error(`No project path`);await X(e,K||t,ve()),R({title:`Success`,description:s?`MCP server configuration saved`:`MCP server added`}),a()}catch(e){W(e instanceof Error?e.message:`Failed to save server`)}finally{P(!1)}},xe=async()=>{if(e){V(!0);try{await ce(e,K),R({title:`Success`,description:`MCP server removed`}),a()}catch(e){W(e instanceof Error?e.message:`Failed to delete server`)}finally{V(!1)}}},Se=s?ye!==oe:d.trim()!==``||p.trim()!==``||v.trim()!==``||b.trim()!==``||w.length>0||E.length>0;return ie?(0,Z.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Z.jsx)(`p`,{className:_.bodyMuted,children:`Loading server configuration...`})}):(0,Z.jsx)(ee,{children:(0,Z.jsxs)(I,{children:[(0,Z.jsx)(te,{title:s?d:`Add MCP Server`,description:s?`Edit MCP Server configuration.`:`Configure a new MCP Server.`}),(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsx)(O,{title:`Server name`,description:s?`Server name cannot be changed`:void 0,children:(0,Z.jsx)(l,{id:`server-name`,placeholder:`e.g. filesystem`,value:d,onChange:e=>f(e.target.value),disabled:s})}),(0,Z.jsxs)(re,{value:c,onValueChange:e=>u(e),className:`w-full`,children:[(0,Z.jsxs)(ne,{className:`grid w-full grid-cols-2`,children:[(0,Z.jsx)(H,{value:`local`,children:`Local (stdio)`}),(0,Z.jsx)(H,{value:`remote`,children:`Remote (HTTP/SSE)`})]}),(0,Z.jsxs)(B,{value:`local`,className:`space-y-6 mt-6`,children:[(0,Z.jsx)(O,{title:`Command`,children:(0,Z.jsx)(l,{id:`server-command`,placeholder:`e.g. npx`,value:p,onChange:e=>h(e.target.value)})}),(0,Z.jsx)(O,{title:`Arguments`,description:`One argument per line`,children:(0,Z.jsx)(z,{id:`server-args`,placeholder:`-y
4
+ @modelcontextprotocol/server-filesystem
5
+ /path/to/dir`,value:v,onChange:e=>y(e.target.value),className:`font-mono min-h-[80px] resize-none`})})]}),(0,Z.jsxs)(B,{value:`remote`,className:`space-y-6 mt-6`,children:[(0,Z.jsx)(O,{title:`Server URL`,description:`Paste the MCP endpoint URL from your provider.`,children:(0,Z.jsx)(l,{id:`server-url`,placeholder:`https://example.com/mcp`,value:b,onChange:e=>x(e.target.value),className:`font-mono`})}),(0,Z.jsx)(O,{title:`Transport`,children:(0,Z.jsxs)(k,{value:S,onValueChange:e=>C(e),children:[(0,Z.jsx)(M,{children:(0,Z.jsx)(j,{})}),(0,Z.jsxs)(A,{children:[(0,Z.jsx)(F,{value:`sse`,children:`SSE (Server-Sent Events)`}),(0,Z.jsx)(F,{value:`streamableHttp`,children:`Streamable HTTP`})]})]})}),(0,Z.jsx)(O,{title:`HTTP headers`,description:`Optional headers for authentication.`,action:(0,Z.jsxs)(m,{variant:`ghost`,size:`sm`,onClick:pe,children:[(0,Z.jsx)(g,{className:`h-3 w-3 mr-1`}),`Add header`]}),children:E.length===0?(0,Z.jsx)(`p`,{className:_.caption,children:`No headers configured`}):(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:E.map((e,n)=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(l,{placeholder:`Authorization`,value:e.key,onChange:e=>he(n,e.target.value),className:`font-mono w-[35%]`}),(0,Z.jsx)(l,{placeholder:`Bearer ...`,value:e.value,onChange:e=>ge(n,e.target.value),className:`font-mono flex-1`}),(0,Z.jsx)(m,{variant:`ghost`,size:`icon`,onClick:()=>me(n),className:`h-9 w-9 flex-shrink-0`,children:(0,Z.jsx)(t,{className:`h-3.5 w-3.5`})})]},n))})})]})]}),(0,Z.jsx)(O,{title:`Environment variables`,description:c===`remote`?`Optional metadata for local tooling.`:void 0,action:(0,Z.jsxs)(m,{variant:`ghost`,size:`sm`,onClick:Q,children:[(0,Z.jsx)(g,{className:`h-3 w-3 mr-1`}),`Add variable`]}),children:w.length===0?(0,Z.jsx)(`p`,{className:_.caption,children:`No environment variables configured`}):(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:w.map((e,n)=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(l,{placeholder:`KEY`,value:e.key,onChange:e=>de(n,e.target.value),className:`font-mono w-[35%]`}),(0,Z.jsx)(l,{placeholder:`value`,value:e.value,onChange:e=>fe(n,e.target.value),className:`font-mono flex-1`}),(0,Z.jsx)(m,{variant:`ghost`,size:`icon`,onClick:()=>$(n),className:`h-9 w-9 flex-shrink-0`,children:(0,Z.jsx)(t,{className:`h-3.5 w-3.5`})})]},n))})}),U&&(0,Z.jsx)(`p`,{className:_.error,children:U}),(0,Z.jsxs)(`div`,{className:`border-t pt-4 flex items-center justify-between`,children:[s&&(0,Z.jsx)(m,{variant:`destructive`,onClick:xe,disabled:L||N,children:L?`Removing...`:`Remove`}),!s&&(0,Z.jsx)(`div`,{}),(0,Z.jsx)(m,{onClick:be,disabled:N||L||!Se,children:N?s?`Saving...`:`Adding...`:s?`Save`:`Add`})]})]})]})})}function $(e){return e.name.toLowerCase().replace(/\s+/g,`-`)}function de(e){return e.url?e.url:`${e.command??``} ${e.args?.join(` `)??``}`.trim()}function fe(){let e=V(e=>e.selectedProjectId),t=V(e=>e.projects).find(t=>t.projectId===e)?.projectPath,{installedServers:a,loadingConfig:c,loadInstalledServers:l}=se(t),{popularServers:u}=Y(),{setActiveMainTab:d,setPendingExplorerPath:f,triggerExplorerRefresh:p}=L(),[h,g]=(0,J.useState)(!1),[_,O]=(0,J.useState)(null),[k,A]=(0,J.useState)(null),[j,M]=(0,J.useState)(null),[F,I]=(0,J.useState)(!1),[z,B]=(0,J.useState)(``),ne=(0,J.useCallback)(async e=>{if(t){I(!0);try{await ce(t,e),await l(),p(),R({title:`MCP server removed`,description:e}),M(null)}catch(e){R({title:`Error`,description:e instanceof Error?e.message:`Failed to remove server`,variant:`destructive`})}finally{I(!1)}}},[t,l,p]),re=(0,J.useCallback)(()=>{f(`.agents/mcp.json`),d(`explorer`)},[f,d]),H=(0,J.useCallback)(async e=>{if(!t)return;let n=$(e);if(!a.some(t=>t.name===n||t.name===e.id)){if(e.url!==void 0){if(!e.url.trim()){O({name:n,config:{url:``,transport:e.transport??`sse`,...Object.keys(e.env??{}).length>0?{env:e.env}:{}}}),g(!0);return}try{await X(t,n,{url:e.url,transport:e.transport??`sse`,...Object.keys(e.env??{}).length>0?{env:e.env}:{}}),await l(),p(),R({title:`MCP server installed`,description:e.name})}catch(e){R({title:`Error`,description:e instanceof Error?e.message:`Failed to install server`,variant:`destructive`})}return}if(!e.command){R({title:`Error`,description:`This server is missing install configuration.`,variant:`destructive`});return}try{await X(t,n,{command:e.command,args:e.args??[],...Object.keys(e.env??{}).length>0?{env:e.env}:{}}),await l(),p(),R({title:`MCP server installed`,description:e.name})}catch(e){R({title:`Error`,description:e instanceof Error?e.message:`Failed to install server`,variant:`destructive`})}}},[t,a,l,p]),q=z.trim()?u.filter(e=>e.name.toLowerCase().includes(z.toLowerCase())||e.description.toLowerCase().includes(z.toLowerCase())):u;return e?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ee,{children:(0,Z.jsxs)(x,{children:[(0,Z.jsx)(te,{title:`MCP Servers`,description:`Manage Model Context Protocol servers for your project.`,action:(0,Z.jsx)(m,{onClick:()=>g(!0),children:`Add Server`})}),(0,Z.jsx)(b,{title:`Installed`}),c?(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(U,{className:`h-20 w-full`}),(0,Z.jsx)(U,{className:`h-20 w-full`})]}):a.length===0?(0,Z.jsx)(ae,{icon:o,title:`No MCP servers installed`,description:`Add an MCP server to extend agent capabilities.`}):(0,Z.jsx)(`div`,{className:`space-y-3 mb-8`,children:a.map(e=>(0,Z.jsx)(G,{title:e.name,subtitle:de(e.config),subtitleMono:!0,actions:[{label:`View config file`,icon:(0,Z.jsx)(n,{className:`h-4 w-4`}),onClick:re},{label:`Edit server`,icon:(0,Z.jsx)(s,{className:`h-4 w-4`}),onClick:()=>A(e.name)},{label:`Delete server`,icon:(0,Z.jsx)(r,{className:`h-4 w-4`}),onClick:()=>M(e.name),destructive:!0}]},e.name))}),(0,Z.jsx)(b,{title:`Available`,className:`mb-0`}),(0,Z.jsx)(W,{placeholder:`Search available servers...`,value:z,onChange:B}),u.length===0?(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(U,{className:`h-20 w-full`}),(0,Z.jsx)(U,{className:`h-20 w-full`})]}):q.length===0?(0,Z.jsx)(ie,{searchQuery:z,emptyLabel:`No available servers found.`}):(0,Z.jsx)(K,{children:q.map(e=>{let t=$(e),n=a.some(n=>n.name===t||n.name===e.id);return(0,Z.jsx)(oe,{name:e.name,description:e.description,installed:n,onClick:()=>{n||H(e)},showInstalledControls:!1},e.id)})})]})}),(0,Z.jsx)(v,{open:h,onOpenChange:e=>{g(e),e||O(null)},children:(0,Z.jsx)(i,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,Z.jsx)(Q,{projectPath:t,initialName:_?.name,initialConfig:_?.config,onBack:()=>{g(!1),O(null),l(),p()}})})}),(0,Z.jsx)(v,{open:k!==null,onOpenChange:e=>{e||A(null)},children:(0,Z.jsx)(i,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,Z.jsx)(Q,{projectPath:t,serverName:k??void 0,onBack:()=>{A(null),l(),p()}})})}),(0,Z.jsx)(T,{open:j!==null,onOpenChange:e=>!e&&M(null),children:(0,Z.jsxs)(N,{children:[(0,Z.jsxs)(E,{children:[(0,Z.jsx)(S,{children:`Delete MCP Server`}),(0,Z.jsxs)(C,{children:[`Are you sure you want to delete the server "`,j,`"? This action cannot be undone.`]})]}),(0,Z.jsxs)(w,{children:[(0,Z.jsx)(y,{children:`Cancel`}),(0,Z.jsx)(P,{onClick:()=>j&&void ne(j),disabled:F,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:F?`Deleting...`:`Delete`})]})]})})]}):(0,Z.jsx)(D,{children:`Select a project to manage MCP servers.`})}export{fe as SettingsMCPServersView,fe as default};
@@ -1 +1 @@
1
- import{gi as e,no as t}from"./dialogs-config-Ct6i8Iij.js";import{D as n,E as r,S as i}from"./history-view-CFot099O.js";import{t as a}from"./skeleton-pSKdmWyJ.js";var o=t(),s=e();function c(){let e=(0,o.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,s.jsx)(i,{title:`Models`,description:`View and manage available models from your configured providers.`}),e[0]=t):t=e[0];let c,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,s.jsx)(a,{className:`h-10 w-full`}),u=(0,s.jsx)(a,{className:`h-9 w-48`}),e[1]=c,e[2]=u):(c=e[1],u=e[2]);let d;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,s.jsx)(n,{children:(0,s.jsxs)(r,{children:[t,(0,s.jsxs)(`div`,{className:`space-y-6`,children:[c,u,(0,s.jsx)(`div`,{className:`space-y-6`,children:[1,2].map(l)})]})]})}),e[3]=d):d=e[3],d}function l(e){return(0,s.jsxs)(`div`,{className:`space-y-3`,children:[(0,s.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,s.jsx)(a,{className:`h-8 w-8 rounded-full`}),(0,s.jsx)(a,{className:`h-6 w-36`})]}),(0,s.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,s.jsx)(a,{className:`h-5 w-32`}),(0,s.jsx)(a,{className:`h-8 w-28`})]}),(0,s.jsx)(`div`,{className:`border border-border rounded-md overflow-hidden`,children:[1,2,3,4,5].map(u)})]},e)}function u(e){return(0,s.jsxs)(`div`,{className:`flex items-center gap-3 p-3 border-b border-border last:border-b-0`,children:[(0,s.jsx)(a,{className:`h-4 w-4 rounded-sm`}),(0,s.jsx)(a,{className:`h-4 flex-1 max-w-xs`}),(0,s.jsx)(a,{className:`h-3 w-24`})]},e)}export{c as t};
1
+ import{Ti as e,fo as t}from"./dialogs-config-B4TDFSrS.js";import{D as n,E as r,S as i}from"./history-view-Ds_0e_bx.js";import{t as a}from"./skeleton-BvSNJL9q.js";var o=t(),s=e();function c(){let e=(0,o.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,s.jsx)(i,{title:`Models`,description:`View and manage available models from your configured providers.`}),e[0]=t):t=e[0];let c,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,s.jsx)(a,{className:`h-10 w-full`}),u=(0,s.jsx)(a,{className:`h-9 w-48`}),e[1]=c,e[2]=u):(c=e[1],u=e[2]);let d;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,s.jsx)(n,{children:(0,s.jsxs)(r,{children:[t,(0,s.jsxs)(`div`,{className:`space-y-6`,children:[c,u,(0,s.jsx)(`div`,{className:`space-y-6`,children:[1,2].map(l)})]})]})}),e[3]=d):d=e[3],d}function l(e){return(0,s.jsxs)(`div`,{className:`space-y-3`,children:[(0,s.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,s.jsx)(a,{className:`h-8 w-8 rounded-full`}),(0,s.jsx)(a,{className:`h-6 w-36`})]}),(0,s.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,s.jsx)(a,{className:`h-5 w-32`}),(0,s.jsx)(a,{className:`h-8 w-28`})]}),(0,s.jsx)(`div`,{className:`border border-border rounded-md overflow-hidden`,children:[1,2,3,4,5].map(u)})]},e)}function u(e){return(0,s.jsxs)(`div`,{className:`flex items-center gap-3 p-3 border-b border-border last:border-b-0`,children:[(0,s.jsx)(a,{className:`h-4 w-4 rounded-sm`}),(0,s.jsx)(a,{className:`h-4 flex-1 max-w-xs`}),(0,s.jsx)(a,{className:`h-3 w-24`})]},e)}export{c as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{B as t,Hi as n,I as r,L as i,R as a,St as o,Ti as s,Ua as c,V as l,ai as u,ar as d,do as f,fo as p,ii as m,ir as h,mo as g,ni as _,or as v,rr as y,vi as b,xt as x,z as S}from"./dialogs-config-B4TDFSrS.js";import{l as C,n as w}from"./onboarding-DfL8a0LZ.js";import{C as T,D as E,E as D,S as O,T as k,a as A,l as j,n as M,o as N,x as P}from"./history-view-Ds_0e_bx.js";import{c as F,l as I,s as L,u as R}from"./index-DOsSr4dl.js";import{a as z,o as B}from"./settings-list-CUbZrggr.js";import{t as V}from"./settings-models-skeleton-B_56ozbA.js";var H=e(g(),1),U=p();function W(e){return`settings-models:coding:${e}`}function G(e){return`settings-models:image:${e}`}async function K(){let e=(await o()).filter(e=>e.apiKey),t={};e.forEach(e=>{t[e.slug]=`alphabetical`});let n={},r={};return await Promise.all(e.map(async e=>{try{let t=await l(e.slug);n[e.slug]=t.models,r[e.slug]=new Set(t.enabledModelIds)}catch(t){console.error(`Failed to load models for ${e.slug}:`,t),n[e.slug]=[],r[e.slug]=new Set}})),{providers:e,allModels:n,enabledModelIds:r,providerSortOptions:t}}async function q(e){let n=e.filter(e=>e.name.toLowerCase()===`openrouter`),r={},i={};return await Promise.all(n.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 image models for ${e.slug}:`,t),r[e.slug]=[],i[e.slug]=new Set}})),{allImageModels:r,enabledImageModelIds:i}}var J=s();function ee({providers:e,globalSearchQuery:t,providerSortOptions:n,setProviderSortOptions:i,filterAndSortModels:o,getModelDisplayName:s,onSaveStatus:l}){let p=A(G(0),()=>q(e)),[g]=(0,H.useState)(p.allImageModels),[S,C]=(0,H.useState)(p.enabledImageModelIds);async function E(e,t){try{S[e]?.has(t)?(await r(e,t),C(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await a(e,t),C(n=>({...n,[e]:new Set([...n[e]||[],t])}))),l(`Model preferences saved successfully`)}catch(e){l(e instanceof Error?e.message:`Failed to save model changes`)}}async function D(e,t){let n=g[e],r=S[e];if(n)for(let i of n)r?.has(i.id)!==t&&await E(e,i.id)}return(0,J.jsx)(`div`,{className:`space-y-6`,children:e.filter(e=>e.name.toLowerCase()===`openrouter`).map(e=>{let r=g[e.slug]||[],a=S[e.slug]||new Set,l=n[e.slug]||`alphabetical`,p=o(r,a,l);return p.length===0&&t?null:(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:(0,J.jsx)(`img`,{src:x(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,J.jsx)(T,{title:e.name,className:`mb-0`})]}),p.length>0&&(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(w,{id:`select-all-image-${e.slug}`,checked:p.every(e=>a.has(e.id)),onCheckedChange:t=>void D(e.slug,t===!0)}),(0,J.jsx)(`label`,{htmlFor:`select-all-image-${e.slug}`,className:m(b.body,`cursor-pointer whitespace-nowrap`),children:`Select all models`})]}),(0,J.jsx)(d,{children:(0,J.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,J.jsxs)(y,{children:[(0,J.jsx)(v,{asChild:!0,children:(0,J.jsx)(_,{type:`button`,variant:l===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>i(t=>({...t,[e.slug]:`alphabetical`})),children:(0,J.jsx)(f,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort A–Z`})]}),(0,J.jsxs)(y,{children:[(0,J.jsx)(v,{asChild:!0,children:(0,J.jsx)(_,{type:`button`,variant:l===`price-low`||l===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>i(t=>({...t,[e.slug]:`price-low`})),children:(0,J.jsx)(c,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort by price`})]})]})})]}),p.length===0?(0,J.jsx)(B,{message:t?`No models matching your search.`:`No image models available for this provider.`}):(0,J.jsx)(d,{children:(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:p.map(t=>{let n=a.has(t.id),r=t.pricing;return(0,J.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,J.jsx)(w,{id:`image-${t.id}`,checked:n,onCheckedChange:()=>void E(e.slug,t.id),className:`mt-0`}),(0,J.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,J.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,J.jsx)(`label`,{htmlFor:`image-${t.id}`,className:m(b.label,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:s(t)})}),r&&(0,J.jsx)(`span`,{className:m(b.compact,`text-muted-foreground whitespace-nowrap flex-shrink-0`),children:(r.prompt??0)===0&&(r.completion??0)===0?``:`$${u(r.prompt??0)} in | $${u(r.completion??0)} out`})]})]},t.id)})})})]},e.slug)})})}function Y({loadVersion:e}){let t=A(W(e),()=>K()),r=t.providers,[a]=(0,H.useState)(t.allModels),[o,s]=(0,H.useState)(t.enabledModelIds),[l,p]=(0,H.useState)(`coding`),[g,M]=(0,H.useState)(``),[N,V]=(0,H.useState)(t.providerSortOptions),[U,G]=(0,H.useState)(``),q=e=>C(e.id),Y=async(e,t)=>{try{o[e]?.has(t)?(await i(e,t),s(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await S(e,t),s(n=>({...n,[e]:new Set([...n[e]||[],t])}))),G(`Model preferences saved successfully`),setTimeout(()=>G(``),3e3)}catch(e){G(e instanceof Error?e.message:`Failed to save model changes`)}},X=async(e,t)=>{let n=a[e],r=o[e];if(n)for(let i of n)r?.has(i.id)!==t&&await Y(e,i.id)},Z=e=>e?e<20?1:e<30?2:e<40?3:e<50?4:5:0,Q=({codingIndex:e,modelName:t})=>{let r=Z(e);return r===0?null:(0,J.jsx)(d,{children:(0,J.jsxs)(y,{children:[(0,J.jsx)(v,{asChild:!0,children:(0,J.jsx)(`div`,{className:`flex items-center gap-0.5`,children:[1,2,3,4,5].map(e=>(0,J.jsx)(n,{className:`h-3 w-3 ${e<=r?`fill-yellow-400 text-yellow-400`:`text-gray-300`}`},e))})}),(0,J.jsx)(h,{children:(0,J.jsxs)(`p`,{className:b.body,children:[t,` was indexed `,e,` for coding intelligence`]})})]})})},$=(e,t,n)=>{let r=g.toLowerCase();return e.filter(e=>{let t=q(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 q(e).localeCompare(q(r))})};return r.length===0?(0,J.jsx)(k,{title:`No providers configured`,children:`Configure a provider with an API key to view available models.`}):(0,J.jsx)(E,{children:(0,J.jsxs)(D,{children:[(0,J.jsx)(O,{title:`Models`,description:`View and manage available models from your configured providers.`}),(0,J.jsxs)(`div`,{className:`space-y-6`,children:[(0,J.jsx)(z,{placeholder:`Search models across all providers...`,value:g,onChange:M}),(0,J.jsxs)(L,{value:l,onValueChange:e=>{p(e),M(``)},children:[(0,J.jsxs)(I,{className:`mb-4`,children:[(0,J.jsx)(R,{value:`coding`,children:`Coding`}),r.some(e=>e.name.toLowerCase()===`openrouter`)&&(0,J.jsx)(R,{value:`image`,children:`Image`})]}),(0,J.jsx)(F,{value:`coding`,children:(0,J.jsx)(`div`,{className:`space-y-6`,children:r.map(e=>{let t=a[e.slug]||[],r=o[e.slug]||new Set,i=N[e.slug]||`alphabetical`,s=$(t,r,i);return s.length===0&&g?null:(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:(0,J.jsx)(`img`,{src:x(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,J.jsx)(T,{title:e.name,className:`mb-0`})]}),s.length>0&&(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(w,{id:`select-all-${e.slug}`,checked:s.every(e=>r.has(e.id)),onCheckedChange:t=>X(e.slug,t===!0)}),(0,J.jsx)(`label`,{htmlFor:`select-all-${e.slug}`,className:m(b.body,`cursor-pointer whitespace-nowrap`),children:`Select all models`})]}),(0,J.jsx)(d,{children:(0,J.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,J.jsxs)(y,{children:[(0,J.jsx)(v,{asChild:!0,children:(0,J.jsx)(_,{type:`button`,variant:i===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(t=>({...t,[e.slug]:`alphabetical`})),children:(0,J.jsx)(f,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort A–Z`})]}),(0,J.jsxs)(y,{children:[(0,J.jsx)(v,{asChild:!0,children:(0,J.jsx)(_,{type:`button`,variant:i===`price-low`||i===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(t=>({...t,[e.slug]:`price-low`})),children:(0,J.jsx)(c,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort by price`})]}),(0,J.jsxs)(y,{children:[(0,J.jsx)(v,{asChild:!0,children:(0,J.jsx)(_,{type:`button`,variant:i===`coding-index`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(t=>({...t,[e.slug]:`coding-index`})),children:(0,J.jsx)(n,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort by coding intelligence`})]})]})})]}),s.length===0?(0,J.jsx)(B,{message:g?`No models matching your search.`:`No models available for this provider.`}):(0,J.jsx)(d,{children:(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:s.map(t=>{let n=r.has(t.id),a=t.pricing;return(0,J.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,J.jsx)(w,{id:t.id,checked:n,onCheckedChange:()=>Y(e.slug,t.id),className:`mt-0`}),(0,J.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,J.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,J.jsx)(`label`,{htmlFor:t.id,className:m(b.body,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:q(t)})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[i===`coding-index`&&(0,J.jsx)(Q,{codingIndex:t.coding_index,modelName:q(t)}),a&&(0,J.jsx)(`span`,{className:m(b.compact,`text-muted-foreground whitespace-nowrap`),children:(a.prompt??0)===0&&(a.completion??0)===0?``:`$${u(a.prompt??0)} in | $${u(a.completion??0)} out`})]})]})]},t.id)})})})]},e.slug)})})}),(0,J.jsx)(F,{value:`image`,children:l===`image`?(0,J.jsx)(H.Suspense,{fallback:(0,J.jsx)(j,{className:`py-12`,size:`sm`}),children:(0,J.jsx)(ee,{providers:r,globalSearchQuery:g,providerSortOptions:N,setProviderSortOptions:V,filterAndSortModels:$,getModelDisplayName:q,onSaveStatus:e=>{G(e),e.includes(`Failed`)||setTimeout(()=>G(``),3e3)}})}):null})]}),U&&(0,J.jsx)(P,{variant:U.includes(`error`)||U.includes(`Failed`)?`error`:`success`,className:`mb-0`,children:U})]})]})})}function X(){let e=(0,U.c)(8),[t,n]=(0,H.useState)(0),r;e[0]===t?r=e[1]:(r=function(){N(W(t)),n(Q)},e[0]=t,e[1]=r);let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,J.jsx)(V,{}),e[2]=a):a=e[2];let o;e[3]===t?o=e[4]:(o=(0,J.jsx)(H.Suspense,{fallback:a,children:(0,J.jsx)(Y,{loadVersion:t},t)}),e[3]=t,e[4]=o);let s;return e[5]!==i||e[6]!==o?(s=(0,J.jsx)(M,{fallbackTitle:`Failed to load models`,onRetry:i,renderFallback:Z,children:o}),e[5]=i,e[6]=o,e[7]=s):s=e[7],s}function Z(e,t){return(0,J.jsx)(k,{title:`Failed to load models`,action:(0,J.jsx)(_,{variant:`outline`,onClick:t,children:`Retry`}),children:e.message})}function Q(e){return e+1}export{X as SettingsModelsView,X as default};
@@ -0,0 +1,8 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ht as t,La as n,Li as r,Ot as i,P as a,Qi as o,Sr as s,Ti as c,an as l,br as u,eo as d,fo as f,ht as p,ii as m,j as h,mo as g,ni as _,ut as v,vi as y,xr as ee,ya as b}from"./dialogs-config-B4TDFSrS.js";import{n as x,t as S}from"./react-vendor-unlDVFpU.js";import{A as te,C,D as w,E as ne,F as T,M as E,N as re,O as ie,P as ae,S as D,T as O,b as k,j as A,k as oe,x as se,y as j}from"./history-view-Ds_0e_bx.js";import{C as ce,E as M,O as N,j as P}from"./index-DOsSr4dl.js";import{t as F}from"./skeleton-BvSNJL9q.js";import{a as I,i as L,n as R,r as z,t as B}from"./settings-list-CUbZrggr.js";import{t as V}from"./mcp-server-card-DrUUKNXv.js";var H=f(),U=e(g(),1),W=c(),G=U.forwardRef((e,t)=>{let n=(0,H.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=m(`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,W.jsx)(x,{className:m(`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,W.jsx)(S,{className:a,...i,ref:t,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});G.displayName=S.displayName;function le({threadId:e,onRuleCreated:t}){let[n,r]=(0,U.useState)(``),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(!1),[c,f]=(0,U.useState)(!1),p=n.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),h=p.length>0&&p.length<=64;return e?(0,W.jsx)(w,{children:(0,W.jsxs)(j,{children:[(0,W.jsx)(D,{title:`Add Rule`,description:`Create a new agent rule. The rule will be saved as a .md file in the .agents/rules folder.`}),(0,W.jsxs)(`div`,{className:`space-y-6`,children:[(0,W.jsxs)(k,{title:`Rule Name`,children:[(0,W.jsx)(u,{id:`ruleName`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Code Style Guide`,disabled:c}),n?(0,W.jsxs)(`p`,{className:m(y.caption,`mt-2`),children:[`File name: `,(0,W.jsxs)(`span`,{className:`font-mono`,children:[p||`...`,`.md`]})]}):null]}),(0,W.jsx)(k,{title:`Description`,children:(0,W.jsx)(N,{id:`ruleDescription`,value:i,onChange:e=>a(e.target.value),placeholder:`Describe when Tarsk should apply this rule...`,className:`resize-none min-h-[120px]`,disabled:c})}),(0,W.jsx)(k,{title:`Always Apply`,description:o?`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.`,action:(0,W.jsx)(G,{id:`alwaysApply`,checked:o,onCheckedChange:s,disabled:c})}),(0,W.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,W.jsx)(_,{onClick:async()=>{if(!(!h||!e)){f(!0);try{let n=`---
2
+ description: ${i.trim()}
3
+ alwaysApply: ${o}
4
+ ---
5
+
6
+ Place your rule instructions here as markdown.
7
+ `;await l(e,`.agents/rules/${p}.md`,n),M({title:`Rule created`,description:`Rule '${p}' was created successfully.`}),r(``),a(``),s(!1),t?.(p)}catch(e){M({title:`Error`,description:e instanceof Error?e.message:`Failed to create rule`,variant:`destructive`})}finally{f(!1)}}},disabled:!h||!i.trim()||c,children:c?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(b,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,W.jsxs)(W.Fragment,{children:[`Continue`,(0,W.jsx)(d,{className:`ml-2 h-4 w-4`})]})})})]})]})}):(0,W.jsx)(O,{title:`No thread selected`,children:`Please select a thread to add a rule.`})}function K(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(...K(n.children));return t}function q(){let e=P(e=>e.selectedProjectId),c=P(e=>e.selectedThreadId),{setActiveMainTab:u,setPendingExplorerPath:d,triggerExplorerRefresh:f,setExplorerClearPath:m}=ce(),[g,y]=(0,U.useState)([]),[b,x]=(0,U.useState)(!1),[S,k]=(0,U.useState)(!1),[j,N]=(0,U.useState)(null),[H,G]=(0,U.useState)(!1),[q,J]=(0,U.useState)([]),[Y,X]=(0,U.useState)(new Set),[Z,ue]=(0,U.useState)(``),Q=(0,U.useCallback)(async()=>{if(e){x(!0);try{let t=K(await p(e));if(c)try{let e=K(await i(c)),n=new Set(t.map(e=>e.path));for(let r of e)n.has(r.path)||t.push(r)}catch{}y(t),X(new Set(t.map(e=>e.path)))}catch{y([]),X(new Set)}finally{x(!1)}}},[e,c]);(0,U.useEffect)(()=>{Q()},[Q]),(0,U.useEffect)(()=>{v().then(J).catch(()=>J([]))},[]);let de=(0,U.useCallback)(async t=>{if(!e)return;let n=t.name,r=t.path;G(!0);try{try{await h(e,r)}catch{if(c)await a(c,r);else throw Error(`No thread selected to delete from`)}m(r),f(),X(e=>{let t=new Set(e);return t.delete(r),t}),M({title:`Rule removed`,description:n}),N(null),await Q()}catch(e){M({title:`Error`,description:e instanceof Error?e.message:`Failed to remove rule`,variant:`destructive`})}finally{G(!1)}},[e,c,Q,f,m]),fe=(0,U.useCallback)(e=>{d(e),u(`explorer`)},[d,u]),pe=(0,U.useCallback)(async e=>{let n=`.agents/rules/${e.name}.md`;if(!(!c||Y.has(n)))try{e.gitHubRepo&&e.gitHubFolder?await t(c,e.gitHubRepo,e.gitHubFolder,`.agents/rules`):await l(c,n,[`---`,`description: ${e.description}`,`alwaysApply: ${e.alwaysApply??!1}`,`---`,``,e.content].join(`
8
+ `)),X(e=>new Set(e).add(n)),f(),Q(),M({title:`Rule installed`,description:e.name})}catch(e){M({title:`Error`,description:e instanceof Error?e.message:`Failed to install rule`,variant:`destructive`})}},[c,Y,f,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return e?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(w,{children:(0,W.jsxs)(ne,{children:[(0,W.jsx)(D,{title:`Rules`,description:`Manage agent rules. Rules define coding standards and project-wide guidelines.`,action:(0,W.jsx)(_,{onClick:()=>k(!0),disabled:!c,children:`Add Rule`})}),!c&&(0,W.jsx)(se,{children:`Select a thread to add or install rules.`}),(0,W.jsx)(C,{title:`Installed`}),b?(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(F,{className:`h-20 w-full`}),(0,W.jsx)(F,{className:`h-20 w-full`})]}):g.length===0?(0,W.jsx)(B,{icon:o,title:`No rules installed`,description:`Add rules to enforce coding standards and project conventions.`}):(0,W.jsx)(`div`,{className:`space-y-3 mb-8`,children:g.map(e=>(0,W.jsx)(R,{title:e.name,subtitle:e.path,subtitleMono:!0,actions:[{label:`View in explorer`,icon:(0,W.jsx)(n,{className:`h-4 w-4`}),onClick:()=>fe(e.path)},{label:`Delete rule`,icon:(0,W.jsx)(r,{className:`h-4 w-4`}),onClick:()=>N(e),destructive:!0}]},e.id))}),(0,W.jsx)(C,{title:`Available`,className:`mb-0`}),(0,W.jsx)(I,{placeholder:`Search available rules...`,value:Z,onChange:ue}),q.length===0?(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(F,{className:`h-20 w-full`}),(0,W.jsx)(F,{className:`h-20 w-full`})]}):$.length===0?(0,W.jsx)(L,{searchQuery:Z,emptyLabel:`No available rules found.`}):(0,W.jsx)(z,{children:$.map(e=>{let t=`.agents/rules/${e.name}.md`,n=Y.has(t);return(0,W.jsx)(V,{name:e.name,description:e.description,installed:n,onClick:()=>{n||pe(e)},showInstalledControls:!1},e.id)})})]})}),(0,W.jsx)(ee,{open:S,onOpenChange:k,children:(0,W.jsx)(s,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,W.jsx)(le,{threadId:c,onRuleCreated:()=>{k(!1),Q(),f()}})})}),(0,W.jsx)(ie,{open:j!==null,onOpenChange:e=>!e&&N(null),children:(0,W.jsxs)(A,{children:[(0,W.jsxs)(ae,{children:[(0,W.jsx)(T,{children:`Delete Rule`}),(0,W.jsxs)(E,{children:[`Are you sure you want to delete the rule "`,j?.name,`"? This action cannot be undone.`]})]}),(0,W.jsxs)(re,{children:[(0,W.jsx)(te,{children:`Cancel`}),(0,W.jsx)(oe,{onClick:()=>j&&void de(j),disabled:H,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:H?`Deleting...`:`Delete`})]})]})})]}):(0,W.jsx)(O,{children:`Select a project to manage rules.`})}export{q as SettingsRulesView,q as default};
@@ -0,0 +1,2 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{E as t,Ht as n,La as r,Li as i,Ot as a,P as o,Sr as s,Ti as c,an as l,br as u,dt as d,eo as f,ht as p,ii as m,j as ee,ji as te,mo as h,ni as g,vi as _,xr as ne,ya as v}from"./dialogs-config-B4TDFSrS.js";import{A as y,C as b,D as x,E as S,F as C,M as w,N as re,O as ie,P as ae,S as T,T as E,b as D,j as oe,k as se,x as ce,y as O}from"./history-view-Ds_0e_bx.js";import{C as le,E as k,O as A,j}from"./index-DOsSr4dl.js";import{t as M}from"./skeleton-BvSNJL9q.js";import{a as N,i as P,n as F,r as I,t as L}from"./settings-list-CUbZrggr.js";import{t as R}from"./mcp-server-card-DrUUKNXv.js";var z=e(h(),1),B=c();function V({threadId:e,onSkillCreated:n}){let[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(!1),l=r.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),d=l.length>0&&l.length<=64;return e?(0,B.jsx)(x,{children:(0,B.jsxs)(O,{children:[(0,B.jsx)(T,{title:`Add Skill`,description:`Create a new agent skill. The skill will be saved as a SKILL.md file in the .agents/skills folder.`}),(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(D,{title:`Skill Name`,children:[(0,B.jsx)(u,{id:`skillName`,value:r,onChange:e=>i(e.target.value),placeholder:`e.g. Code Review`,disabled:s}),r?(0,B.jsxs)(`p`,{className:m(_.caption,`mt-2`),children:[`Folder name: `,(0,B.jsx)(`span`,{className:`font-mono`,children:l||`...`})]}):null]}),(0,B.jsx)(D,{title:`Description`,children:(0,B.jsx)(A,{id:`skillDescription`,value:a,onChange:e=>o(e.target.value),placeholder:`Describe when Tarsk should apply this skill`,className:`resize-none min-h-[120px]`,disabled:s})}),(0,B.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,B.jsx)(g,{onClick:async()=>{if(!(!d||!a.trim()||!e)){c(!0);try{let r=await t(e,l,a.trim());k({title:`Skill created`,description:`Skill '${l}' was created successfully.`}),i(``),o(``),n?.(r.path,`SKILL.md`)}catch(e){k({title:`Error`,description:e instanceof Error?e.message:`Failed to create skill`,variant:`destructive`})}finally{c(!1)}}},disabled:!d||!a.trim()||s,children:s?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(v,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,B.jsxs)(B.Fragment,{children:[`Continue`,(0,B.jsx)(f,{className:`ml-2 h-4 w-4`})]})})})]})]})}):(0,B.jsx)(E,{title:`No thread selected`,children:`Please select a thread to add a skill.`})}function H(e){let t=[];for(let n of e){if(n.path===`.agents/skills`&&n.type===`folder`&&n.children)for(let e of n.children)e.type===`folder`&&t.push(e);n.children&&n.children.length>0&&t.push(...H(n.children))}return t}function U(){let e=j(e=>e.selectedProjectId),t=j(e=>e.selectedThreadId),{setActiveMainTab:c,setPendingExplorerPath:u,triggerExplorerRefresh:f,setExplorerClearPath:m}=le(),[h,_]=(0,z.useState)([]),[v,D]=(0,z.useState)(!1),[O,A]=(0,z.useState)(!1),[U,W]=(0,z.useState)(null),[G,K]=(0,z.useState)(!1),[q,J]=(0,z.useState)([]),[Y,X]=(0,z.useState)(new Set),[Z,ue]=(0,z.useState)(``),Q=(0,z.useCallback)(async()=>{if(e){D(!0);try{let n=H(await p(e));if(t)try{let e=H(await a(t)),r=new Set(n.map(e=>e.path));for(let t of e)r.has(t.path)||n.push(t)}catch{}_(n),X(new Set(n.map(e=>`${e.path}/SKILL.md`)))}catch{_([]),X(new Set)}finally{D(!1)}}},[e,t]);(0,z.useEffect)(()=>{Q()},[Q]),(0,z.useEffect)(()=>{d().then(J).catch(()=>J([]))},[]);let de=(0,z.useCallback)(async n=>{if(!e)return;let r=n.name,i=n.path;K(!0);try{try{await ee(e,i)}catch{if(t)await o(t,i);else throw Error(`No thread selected to delete from`)}m(i),f(),X(e=>{let t=new Set(e);return t.delete(`${i}/SKILL.md`),t}),k({title:`Skill removed`,description:r}),W(null),await Q()}catch(e){k({title:`Error`,description:e instanceof Error?e.message:`Failed to remove skill`,variant:`destructive`})}finally{K(!1)}},[e,t,Q,f,m]),fe=(0,z.useCallback)(e=>{u(`${e}/SKILL.md`),c(`explorer`)},[u,c]),pe=(0,z.useCallback)(async e=>{let r=`.agents/skills/${e.id}/SKILL.md`;if(!(!t||Y.has(r)))try{if(e.gitHubRepo&&e.gitHubFolder)await n(t,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 l(t,r,n.join(`
2
+ `))}X(e=>new Set(e).add(r)),f(),Q(),k({title:`Skill installed`,description:e.name})}catch(e){k({title:`Error`,description:e instanceof Error?e.message:`Failed to install skill`,variant:`destructive`})}},[t,Y,f,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(x,{children:(0,B.jsxs)(S,{children:[(0,B.jsx)(T,{title:`Skills`,description:`Manage agent skills. Skills are reusable instruction sets that guide agent behavior.`,action:(0,B.jsx)(g,{onClick:()=>A(!0),disabled:!t,children:`Add Skill`})}),!t&&(0,B.jsx)(ce,{children:`Select a thread to add or install skills.`}),(0,B.jsx)(b,{title:`Installed`}),v?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(M,{className:`h-20 w-full`}),(0,B.jsx)(M,{className:`h-20 w-full`})]}):h.length===0?(0,B.jsx)(L,{icon:te,title:`No skills installed`,description:`Add skills to extend agent capabilities with reusable instructions.`}):(0,B.jsx)(`div`,{className:`space-y-3 mb-8`,children:h.map(e=>(0,B.jsx)(F,{title:e.name,subtitle:e.path,subtitleMono:!0,actions:[{label:`View in explorer`,icon:(0,B.jsx)(r,{className:`h-4 w-4`}),onClick:()=>fe(e.path)},{label:`Delete skill`,icon:(0,B.jsx)(i,{className:`h-4 w-4`}),onClick:()=>W(e),destructive:!0}]},e.id))}),(0,B.jsx)(b,{title:`Available`,className:`mb-0`}),(0,B.jsx)(N,{placeholder:`Search available skills...`,value:Z,onChange:ue}),q.length===0?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(M,{className:`h-20 w-full`}),(0,B.jsx)(M,{className:`h-20 w-full`})]}):$.length===0?(0,B.jsx)(P,{searchQuery:Z,emptyLabel:`No available skills found.`}):(0,B.jsx)(I,{children:$.map(e=>{let t=`.agents/skills/${e.id}/SKILL.md`,n=Y.has(t);return(0,B.jsx)(R,{name:e.name,description:e.description,installed:n,onClick:()=>{n||pe(e)},showInstalledControls:!1},e.id)})})]})}),(0,B.jsx)(ne,{open:O,onOpenChange:A,children:(0,B.jsx)(s,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,B.jsx)(V,{threadId:t,onSkillCreated:()=>{A(!1),Q(),f()}})})}),(0,B.jsx)(ie,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,B.jsxs)(oe,{children:[(0,B.jsxs)(ae,{children:[(0,B.jsx)(C,{children:`Delete Skill`}),(0,B.jsxs)(w,{children:[`Are you sure you want to delete the skill "`,U?.name,`"? This action cannot be undone.`]})]}),(0,B.jsxs)(re,{children:[(0,B.jsx)(y,{children:`Cancel`}),(0,B.jsx)(se,{onClick:()=>U&&void de(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,B.jsx)(E,{children:`Select a project to manage skills.`})}export{U as SettingsSkillsView,U as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{C as t,Ht as n,La as r,Li as i,M as a,Sr as o,Ti as s,br as c,eo as l,ft as u,ii as d,mo as f,ni as p,vi as m,vr as h,wt as g,xr as _,ya as v,zi as y}from"./dialogs-config-B4TDFSrS.js";import{A as b,C as x,D as S,E as C,F as ee,M as te,N as w,O as T,P as ne,S as E,T as D,b as O,j as k,k as A,x as j,y as M}from"./history-view-Ds_0e_bx.js";import{C as re,E as N,j as P}from"./index-DOsSr4dl.js";import{t as F}from"./skeleton-BvSNJL9q.js";import{n as I,t as L}from"./radio-group-c0sU992r.js";import{a as ie,i as ae,n as oe,r as R,t as se}from"./settings-list-CUbZrggr.js";import{t as ce}from"./mcp-server-card-DrUUKNXv.js";var z=e(f(),1),B=s();function V({projectId:e,threadId:n,onCommandCreated:r}){let[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(``),[u,f]=(0,z.useState)(``),[g,_]=(0,z.useState)(`default`),[y,b]=(0,z.useState)(!1),x=i.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),C=x.length>0&&x.length<=64;return e?(0,B.jsx)(S,{children:(0,B.jsxs)(M,{children:[(0,B.jsx)(E,{title:`Add Slash Command`,description:`Create a new slash command. The command will be saved as a .md file in the ~/.agents/commands folder.`}),(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(O,{title:`Command Name`,children:[(0,B.jsx)(c,{id:`commandName`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g. review`,disabled:y}),i?(0,B.jsxs)(`p`,{className:d(m.caption,`mt-2`),children:[`Command: `,(0,B.jsxs)(`span`,{className:`font-mono`,children:[`/`,x||`...`]})]}):null]}),(0,B.jsx)(O,{title:`Description`,children:(0,B.jsx)(c,{id:`commandDescription`,value:o,onChange:e=>s(e.target.value),placeholder:`Brief description shown in autocomplete`,disabled:y})}),(0,B.jsx)(O,{title:`Argument Hint`,description:`Shows after the command name to guide users what to type`,children:(0,B.jsx)(c,{id:`argumentHint`,value:u,onChange:e=>f(e.target.value),placeholder:`e.g. <focus-area> or <branch-name>`,disabled:y})}),(0,B.jsx)(O,{title:`Mode`,description:g==="default"?`Standard chat mode`:`Activates plan mode when this command is used`,children:(0,B.jsxs)(L,{value:g,onValueChange:e=>_(e),className:`flex gap-4`,disabled:y,children:[(0,B.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,B.jsx)(I,{value:`default`,id:`mode-default`}),(0,B.jsx)(h,{htmlFor:`mode-default`,className:d(m.labelNormal,`cursor-pointer`),children:`Default`})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,B.jsx)(I,{value:`plan`,id:`mode-plan`}),(0,B.jsx)(h,{htmlFor:`mode-plan`,className:d(m.labelNormal,`cursor-pointer`),children:`Plan`})]})]})}),(0,B.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,B.jsx)(p,{onClick:async()=>{if(!(!C||!e)){b(!0);try{await t(x,``,{description:o.trim()||void 0,argumentHint:u.trim()||void 0,mode:g===`plan`?`plan`:void 0},`project`,n??void 0),N({title:`Command created`,description:`Command '/${x}' was created successfully.`}),a(``),s(``),f(``),_(`default`),r?.(x)}catch(e){N({title:`Error`,description:e instanceof Error?e.message:`Failed to create command`,variant:`destructive`})}finally{b(!1)}}},disabled:!C||y,children:y?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(v,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,B.jsxs)(B.Fragment,{children:[`Continue`,(0,B.jsx)(l,{className:`ml-2 h-4 w-4`})]})})})]})]})}):(0,B.jsx)(D,{title:`No project selected`,children:`Please select a project to add a slash command.`})}function H(){let e=P(e=>e.selectedProjectId),s=P(e=>e.selectedThreadId),{setActiveMainTab:c,setPendingExplorerPath:l,triggerExplorerRefresh:f,setExplorerClearPath:h}=re(),[v,O]=(0,z.useState)([]),[M,I]=(0,z.useState)(!1),[L,H]=(0,z.useState)(!1),[U,W]=(0,z.useState)(null),[G,K]=(0,z.useState)(!1),[q,J]=(0,z.useState)([]),[Y,X]=(0,z.useState)(new Map),[Z,le]=(0,z.useState)(``),Q=(0,z.useCallback)(async()=>{if(s){I(!0);try{let e=await g(s);O(e.filter(e=>!e.isBuiltIn)),X(new Map(e.map(e=>[e.name,e.filePath])))}catch{O([]),X(new Map)}finally{I(!1)}}},[s]);(0,z.useEffect)(()=>{Q()},[Q]),(0,z.useEffect)(()=>{u().then(J).catch(()=>J([]))},[]);let ue=(0,z.useCallback)(async e=>{K(!0);try{await a(e.filePath),h(e.filePath),f(),X(t=>{let n=new Map(t);return n.delete(e.name),n}),N({title:`Command removed`,description:`/${e.name}`}),W(null),await Q()}catch(e){N({title:`Error`,description:e instanceof Error?e.message:`Failed to remove command`,variant:`destructive`})}finally{K(!1)}},[Q,f,h]),de=(0,z.useCallback)(e=>{l(e),c(`explorer`)},[l,c]),fe=(0,z.useCallback)(async e=>{if(!(!s||Y.has(e.name)))try{if(e.gitHubRepo&&e.gitHubFolder){let t=`.agents/commands`;await n(s,e.gitHubRepo,e.gitHubFolder,t);let r=`${t}/${e.name}.md`;X(t=>new Map(t).set(e.name,r))}else{let n=await t(e.name,e.content,{description:e.description,argumentHint:e.argumentHint},`project`,s);X(t=>new Map(t).set(e.name,n.filePath))}f(),Q(),N({title:`Command installed`,description:`/${e.name}`})}catch(e){N({title:`Error`,description:e instanceof Error?e.message:`Failed to install command`,variant:`destructive`})}},[s,Y,f,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(S,{children:(0,B.jsxs)(C,{children:[(0,B.jsx)(E,{title:`Slash Commands`,description:`Manage slash commands. Commands are quick actions available via / in chat.`,action:(0,B.jsx)(p,{onClick:()=>H(!0),disabled:!s,children:`Add Command`})}),!s&&(0,B.jsx)(j,{children:`Select a thread to add or install slash commands.`}),(0,B.jsx)(x,{title:`Installed`}),M?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(F,{className:`h-20 w-full`}),(0,B.jsx)(F,{className:`h-20 w-full`})]}):v.length===0?(0,B.jsx)(se,{icon:y,title:`No slash commands installed`,description:`Add slash commands to create quick actions in chat.`}):(0,B.jsx)(`div`,{className:`space-y-3 mb-8`,children:v.map(e=>(0,B.jsx)(oe,{title:`/${e.name}`,subtitle:e.metadata?.description||`No description`,badge:e.metadata?.mode?(0,B.jsx)(`span`,{className:d(m.compact,`bg-muted px-1.5 py-0.5 rounded flex-shrink-0`),children:e.metadata.mode}):void 0,actions:[{label:`View in explorer`,icon:(0,B.jsx)(r,{className:`h-4 w-4`}),onClick:()=>de(e.filePath)},{label:`Delete command`,icon:(0,B.jsx)(i,{className:`h-4 w-4`}),onClick:()=>W(e),destructive:!0}]},e.filePath))}),(0,B.jsx)(x,{title:`Available`,className:`mb-0`}),(0,B.jsx)(ie,{placeholder:`Search available commands...`,value:Z,onChange:le}),q.length===0?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(F,{className:`h-20 w-full`}),(0,B.jsx)(F,{className:`h-20 w-full`})]}):$.length===0?(0,B.jsx)(ae,{searchQuery:Z,emptyLabel:`No available commands found.`}):(0,B.jsx)(R,{children:$.map(e=>{let t=Y.has(e.name);return(0,B.jsx)(ce,{name:`/${e.name}`,description:e.description,installed:t,onClick:()=>{t||fe(e)},showInstalledControls:!1},e.id)})})]})}),(0,B.jsx)(_,{open:L,onOpenChange:H,children:(0,B.jsx)(o,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,B.jsx)(V,{projectId:e,threadId:s,onCommandCreated:()=>{H(!1),Q(),f()}})})}),(0,B.jsx)(T,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,B.jsxs)(k,{children:[(0,B.jsxs)(ne,{children:[(0,B.jsx)(ee,{children:`Delete Slash Command`}),(0,B.jsxs)(te,{children:[`Are you sure you want to delete "/`,U?.name,`"? This action cannot be undone.`]})]}),(0,B.jsxs)(w,{children:[(0,B.jsx)(b,{children:`Cancel`}),(0,B.jsx)(A,{onClick:()=>U&&void ue(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,B.jsx)(D,{children:`Select a project to manage slash commands.`})}export{H as SettingsSlashCommandsView,H as default};
@@ -0,0 +1,2 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ht as t,La as n,Li as r,Mi as i,Ot as a,P as o,Sr as s,T as c,Ti as l,an as u,br as d,ct as f,eo as p,ht as m,ii as h,j as ee,mo as g,ni as _,vi as v,xr as te,ya as y}from"./dialogs-config-B4TDFSrS.js";import{A as b,C as x,D as S,E as ne,F as C,M as w,N as T,O as re,P as ie,S as E,T as D,b as O,j as k,k as ae,x as oe,y as A}from"./history-view-Ds_0e_bx.js";import{C as se,E as j,O as M,j as N}from"./index-DOsSr4dl.js";import{t as P}from"./skeleton-BvSNJL9q.js";import{a as ce,i as le,n as F,r as I,t as L}from"./settings-list-CUbZrggr.js";import{t as R}from"./mcp-server-card-DrUUKNXv.js";var z=e(g(),1),B=l();function V({threadId:e,onAgentCreated:t}){let[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(``),[l,u]=(0,z.useState)(!1),f=n.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),m=f.length>0&&f.length<=64;return e?(0,B.jsx)(S,{children:(0,B.jsxs)(A,{children:[(0,B.jsx)(E,{title:`Add Agent`,description:`Create a new subagent. The agent will be saved as an AGENT.md file in the .agents/agents folder.`}),(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(O,{title:`Agent Name`,children:[(0,B.jsx)(d,{id:`agentName`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Security Reviewer`,disabled:l}),n?(0,B.jsxs)(`p`,{className:h(v.caption,`mt-2`),children:[`Folder name: `,(0,B.jsx)(`span`,{className:`font-mono`,children:f||`...`})]}):null]}),(0,B.jsx)(O,{title:`Description`,children:(0,B.jsx)(M,{id:`agentDescription`,value:i,onChange:e=>a(e.target.value),placeholder:`Describe what this agent does and when it should be invoked`,className:`resize-none min-h-[120px]`,disabled:l})}),(0,B.jsx)(O,{title:`Allowed Tools`,description:`Space-separated list of tools this agent can use. Leave empty to allow all coding tools.`,children:(0,B.jsx)(d,{id:`agentTools`,value:o,onChange:e=>s(e.target.value),placeholder:`e.g. read grep glob`,disabled:l})}),(0,B.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,B.jsx)(_,{onClick:async()=>{if(!(!m||!i.trim()||!e)){u(!0);try{let n=await c(e,f,i.trim(),o.trim()||void 0);j({title:`Agent created`,description:`Agent '${f}' was created successfully.`}),r(``),a(``),s(``),t?.(n.path,`AGENT.md`)}catch(e){j({title:`Error`,description:e instanceof Error?e.message:`Failed to create agent`,variant:`destructive`})}finally{u(!1)}}},disabled:!m||!i.trim()||l,children:l?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(y,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,B.jsxs)(B.Fragment,{children:[`Continue`,(0,B.jsx)(p,{className:`ml-2 h-4 w-4`})]})})})]})]})}):(0,B.jsx)(D,{title:`No thread selected`,children:`Please select a thread to add an agent.`})}function H(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(...H(n.children));return t}function U(){let e=N(e=>e.selectedProjectId),c=N(e=>e.selectedThreadId),{setActiveMainTab:l,setPendingExplorerPath:d,triggerExplorerRefresh:p,setExplorerClearPath:h}=se(),[g,v]=(0,z.useState)([]),[y,O]=(0,z.useState)(!1),[A,M]=(0,z.useState)(!1),[U,W]=(0,z.useState)(null),[G,K]=(0,z.useState)(!1),[q,J]=(0,z.useState)([]),[Y,X]=(0,z.useState)(new Set),[Z,ue]=(0,z.useState)(``),Q=(0,z.useCallback)(async()=>{if(e){O(!0);try{let t=H(await m(e));if(c)try{let e=H(await a(c)),n=new Set(t.map(e=>e.path));for(let r of e)n.has(r.path)||t.push(r)}catch{}v(t),X(new Set(t.map(e=>`${e.path}/AGENT.md`)))}catch{v([]),X(new Set)}finally{O(!1)}}},[e,c]);(0,z.useEffect)(()=>{Q()},[Q]),(0,z.useEffect)(()=>{f().then(J).catch(()=>J([]))},[]);let de=(0,z.useCallback)(async t=>{if(!e)return;let n=t.name,r=t.path;K(!0);try{try{await ee(e,r)}catch{if(c)await o(c,r);else throw Error(`No thread selected to delete from`)}h(r),p(),X(e=>{let t=new Set(e);return t.delete(`${r}/AGENT.md`),t}),j({title:`Agent removed`,description:n}),W(null),await Q()}catch(e){j({title:`Error`,description:e instanceof Error?e.message:`Failed to remove agent`,variant:`destructive`})}finally{K(!1)}},[e,c,Q,p,h]),fe=(0,z.useCallback)(e=>{d(`${e}/AGENT.md`),l(`explorer`)},[d,l]),pe=(0,z.useCallback)(async e=>{let n=`.agents/agents/${e.id}/AGENT.md`;if(!(!c||Y.has(n)))try{if(e.gitHubRepo&&e.gitHubFolder)await t(c,e.gitHubRepo,e.gitHubFolder,`.agents/agents/${e.id}`);else{let t=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.tools&&t.push(`tools: ${e.tools}`),t.push(`---`,``,e.systemPrompt),await u(c,n,t.join(`
2
+ `))}X(e=>new Set(e).add(n)),p(),Q(),j({title:`Agent installed`,description:e.name})}catch(e){j({title:`Error`,description:e instanceof Error?e.message:`Failed to install agent`,variant:`destructive`})}},[c,Y,p,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(S,{children:(0,B.jsxs)(ne,{children:[(0,B.jsx)(E,{title:`Subagents`,description:`Manage subagents. Subagents are specialized agents for focused tasks.`,action:(0,B.jsx)(_,{onClick:()=>M(!0),disabled:!c,children:`Add Subagent`})}),!c&&(0,B.jsx)(oe,{children:`Select a thread to add or install subagents.`}),(0,B.jsx)(x,{title:`Installed`}),y?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(P,{className:`h-20 w-full`}),(0,B.jsx)(P,{className:`h-20 w-full`})]}):g.length===0?(0,B.jsx)(L,{icon:i,title:`No subagents installed`,description:`Add subagents for specialized, focused tasks.`}):(0,B.jsx)(`div`,{className:`space-y-3 mb-8`,children:g.map(e=>(0,B.jsx)(F,{title:e.name,subtitle:e.path,subtitleMono:!0,actions:[{label:`View in explorer`,icon:(0,B.jsx)(n,{className:`h-4 w-4`}),onClick:()=>fe(e.path)},{label:`Delete agent`,icon:(0,B.jsx)(r,{className:`h-4 w-4`}),onClick:()=>W(e),destructive:!0}]},e.id))}),(0,B.jsx)(x,{title:`Available`,className:`mb-0`}),(0,B.jsx)(ce,{placeholder:`Search available subagents...`,value:Z,onChange:ue}),q.length===0?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(P,{className:`h-20 w-full`}),(0,B.jsx)(P,{className:`h-20 w-full`})]}):$.length===0?(0,B.jsx)(le,{searchQuery:Z,emptyLabel:`No available subagents found.`}):(0,B.jsx)(I,{children:$.map(e=>{let t=`.agents/agents/${e.id}/AGENT.md`,n=Y.has(t);return(0,B.jsx)(R,{name:e.name,description:e.description,installed:n,onClick:()=>{n||pe(e)},showInstalledControls:!1},e.id)})})]})}),(0,B.jsx)(te,{open:A,onOpenChange:M,children:(0,B.jsx)(s,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,B.jsx)(V,{threadId:c,onAgentCreated:()=>{M(!1),Q(),p()}})})}),(0,B.jsx)(re,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,B.jsxs)(k,{children:[(0,B.jsxs)(ie,{children:[(0,B.jsx)(C,{children:`Delete Subagent`}),(0,B.jsxs)(w,{children:[`Are you sure you want to delete the subagent "`,U?.name,`"? This action cannot be undone.`]})]}),(0,B.jsxs)(T,{children:[(0,B.jsx)(b,{children:`Cancel`}),(0,B.jsx)(ae,{onClick:()=>U&&void de(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,B.jsx)(D,{children:`Select a project to manage subagents.`})}export{U as SettingsSubagentsView,U as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{It as t,Ln as n,Qr as r,Xr as i,fr as a,gi as o,io as s,la as c,li as l,sn as u}from"./dialogs-config-Ct6i8Iij.js";import{n as d}from"./onboarding-DHCR18iU.js";import{A as f,E as p,F as m,M as h,N as g,O as _,P as v,S as y,T as b,j as x,k as S,w as C}from"./history-view-CFot099O.js";import{A as w,D as T,T as E}from"./index-6DhhjIBL.js";var D=e(s(),1),O=o();function k(){let e=w(e=>e.selectedProjectId),[o,s]=(0,D.useState)(``),[k,A]=(0,D.useState)(``),[j,M]=(0,D.useState)(!0),[N,P]=(0,D.useState)(!1),[F,I]=(0,D.useState)(``),[L,R]=(0,D.useState)(!1),[z,B]=(0,D.useState)(!1),[V,H]=(0,D.useState)(!1);(0,D.useEffect)(()=>{e&&(R(!0),t(e).then(e=>{let t=e.useCustomSystemPrompt;s(e.generatedPrompt),P(t),I(e.customSystemPrompt),M(!t),A(t?e.customSystemPrompt:e.generatedPrompt)}).catch(()=>{s(``),A(``),M(!0),P(!1),I(``)}).finally(()=>R(!1)))},[e]);function U(){return j?N:k.trim()!==F.trim()}function W(e){A(e),j&&M(!1)}function G(){A(o),M(!0)}function K(e){if(!e){M(!1);return}if(k===o){G();return}H(!0)}function q(){G(),H(!1)}function J(){H(!1)}async function Y(){if(e){if(!j&&!k.trim()){E({title:`System prompt required`,description:`Enter a system prompt or enable Generated.`,variant:`destructive`});return}B(!0);try{await n(e,{customSystemPrompt:j?null:k.trim(),useCustomSystemPrompt:!j}),u(),P(!j),I(j?``:k.trim()),E({title:`System prompt settings saved`})}catch(e){E({title:`Error`,description:e instanceof Error?e.message:`Failed to save system prompt settings`,variant:`destructive`})}finally{B(!1)}}}return e?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(C,{children:(0,O.jsxs)(p,{className:`w-full flex-1 flex flex-col min-h-0`,children:[(0,O.jsx)(y,{title:`System Prompt`,description:`View the default system prompt or override it for this project. Instructions, rules, and other context are added separately at runtime.`,action:(0,O.jsx)(i,{onClick:Y,disabled:L||z||!U(),children:z?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(c,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`})}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,O.jsx)(d,{id:`use-generated-prompt`,checked:j,onCheckedChange:e=>K(e===!0),disabled:L||z}),(0,O.jsx)(a,{htmlFor:`use-generated-prompt`,className:r(l.labelNormal,`cursor-pointer`),children:`Generated`})]}),L?(0,O.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,O.jsx)(c,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,O.jsx)(T,{value:k,onChange:e=>W(e.target.value),className:r(l.mono,`flex-1 min-h-0 resize-none`),placeholder:`System prompt will appear here...`,disabled:z})]})}),(0,O.jsx)(_,{open:V,onOpenChange:H,children:(0,O.jsxs)(x,{children:[(0,O.jsxs)(v,{children:[(0,O.jsx)(m,{children:`Overwrite custom system prompt?`}),(0,O.jsx)(h,{children:`This will replace your custom system prompt with the generated default. You can save the change after confirming.`})]}),(0,O.jsxs)(g,{children:[(0,O.jsx)(f,{onClick:J,children:`No`}),(0,O.jsx)(S,{onClick:q,children:`Yes`})]})]})})]}):(0,O.jsx)(b,{children:`Select a project to edit the system prompt.`})}export{k as SettingsSystemPromptView,k as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ti as t,Ut as n,bn as r,ii as i,mo as a,ni as o,vi as s,vr as c,vt as l,ya as u}from"./dialogs-config-B4TDFSrS.js";import{n as d}from"./onboarding-DfL8a0LZ.js";import{A as f,E as p,F as m,M as h,N as g,O as _,P as v,S as y,T as b,j as x,k as S,w as C}from"./history-view-Ds_0e_bx.js";import{E as w,O as T,j as E}from"./index-DOsSr4dl.js";var D=e(a(),1),O=t();function k(){let e=E(e=>e.selectedProjectId),[t,a]=(0,D.useState)(``),[k,A]=(0,D.useState)(``),[j,M]=(0,D.useState)(!0),[N,P]=(0,D.useState)(!1),[F,I]=(0,D.useState)(``),[L,R]=(0,D.useState)(!1),[z,B]=(0,D.useState)(!1),[V,H]=(0,D.useState)(!1);(0,D.useEffect)(()=>{e&&(R(!0),l(e).then(e=>{let t=e.useCustomSystemPrompt;a(e.generatedPrompt),P(t),I(e.customSystemPrompt),M(!t),A(t?e.customSystemPrompt:e.generatedPrompt)}).catch(()=>{a(``),A(``),M(!0),P(!1),I(``)}).finally(()=>R(!1)))},[e]);function U(){return j?N:k.trim()!==F.trim()}function W(e){A(e),j&&M(!1)}function G(){A(t),M(!0)}function K(e){if(!e){M(!1);return}if(k===t){G();return}H(!0)}function q(){G(),H(!1)}function J(){H(!1)}async function Y(){if(e){if(!j&&!k.trim()){w({title:`System prompt required`,description:`Enter a system prompt or enable Generated.`,variant:`destructive`});return}B(!0);try{await r(e,{customSystemPrompt:j?null:k.trim(),useCustomSystemPrompt:!j}),n(),P(!j),I(j?``:k.trim()),w({title:`System prompt settings saved`})}catch(e){w({title:`Error`,description:e instanceof Error?e.message:`Failed to save system prompt settings`,variant:`destructive`})}finally{B(!1)}}}return e?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(C,{children:(0,O.jsxs)(p,{className:`w-full flex-1 flex flex-col min-h-0`,children:[(0,O.jsx)(y,{title:`System Prompt`,description:`View the default system prompt or override it for this project. Instructions, rules, and other context are added separately at runtime.`,action:(0,O.jsx)(o,{onClick:Y,disabled:L||z||!U(),children:z?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(u,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`})}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,O.jsx)(d,{id:`use-generated-prompt`,checked:j,onCheckedChange:e=>K(e===!0),disabled:L||z}),(0,O.jsx)(c,{htmlFor:`use-generated-prompt`,className:i(s.labelNormal,`cursor-pointer`),children:`Generated`})]}),L?(0,O.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,O.jsx)(u,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,O.jsx)(T,{value:k,onChange:e=>W(e.target.value),className:i(s.mono,`flex-1 min-h-0 resize-none`),placeholder:`System prompt will appear here...`,disabled:z})]})}),(0,O.jsx)(_,{open:V,onOpenChange:H,children:(0,O.jsxs)(x,{children:[(0,O.jsxs)(v,{children:[(0,O.jsx)(m,{children:`Overwrite custom system prompt?`}),(0,O.jsx)(h,{children:`This will replace your custom system prompt with the generated default. You can save the change after confirming.`})]}),(0,O.jsxs)(g,{children:[(0,O.jsx)(f,{onClick:J,children:`No`}),(0,O.jsx)(S,{onClick:q,children:`Yes`})]})]})})]}):(0,O.jsx)(b,{children:`Select a project to edit the system prompt.`})}export{k as SettingsSystemPromptView,k as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/settings-general-view-DI-lvP0L.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-DOsSr4dl.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-Ds_0e_bx.js","assets/dialogs-config-B4TDFSrS.js","assets/onboarding-DfL8a0LZ.js","assets/whisper-wasm-Cq5Ofwpd.js","assets/react-vendor-unlDVFpU.js","assets/utils-umVhs9to.js","assets/index-C0lTt0ZK.css","assets/project-settings-view-Cd_l3Lfy.js","assets/radio-group-c0sU992r.js","assets/providers-list-view-VXhgM3vp.js","assets/skeleton-BvSNJL9q.js","assets/settings-models-view-ms828HDa.js","assets/settings-models-skeleton-B_56ozbA.js","assets/settings-list-CUbZrggr.js","assets/settings-mcp-servers-view-DmxUO42I.js","assets/mcp-server-card-DrUUKNXv.js","assets/settings-skills-view-DvPPdsi_.js","assets/settings-rules-view-Xx0ymfnQ.js","assets/settings-slash-commands-view-BULIAW2o.js","assets/settings-subagents-view-B7FcLaZT.js","assets/settings-instructions-view-kUG32_dT.js","assets/settings-system-prompt-view-66zf0gRc.js","assets/account-view-k5jIArY-.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ga as t,Mi as n,Na as r,Ni as i,Qi as a,Ti as o,Ut as s,Wi as c,Xt as l,Yi as u,ca as d,fo as f,ii as p,io as m,ji as h,mo as g,ni as ee,oo as te,qi as ne,vi as _,wa as v,yt as y,zi as b}from"./dialogs-config-B4TDFSrS.js";import{ct as x,lt as re,st as ie}from"./react-vendor-unlDVFpU.js";import{r as S}from"./monaco-CZnIWXyV.js";import{c as C,u as w}from"./onboarding-DfL8a0LZ.js";import{D as T,E,T as D}from"./history-view-Ds_0e_bx.js";import{A as O,T as k,a as ae,i as A,j,k as oe,n as M,o as N,r as se}from"./index-DOsSr4dl.js";import{t as P}from"./settings-models-skeleton-B_56ozbA.js";var F=f(),I=e(g(),1),L=o(),ce=(0,I.forwardRef)(function(e,t){let n=(0,F.c)(28),{sidebar:r,children:i,defaultSidebarSize:a,minSidebarSize:o,maxSidebarSize:s,minContentSize:c,collapsible:l,collapsedSize:u,className:d,onCollapse:f,onExpand:m,isMobile:h,mobileShowSidebar:g}=e,ee=a===void 0?25:a,te=o===void 0?20:o,ne=s===void 0?30:s,_=c===void 0?40:c,v=l===void 0?!1:l,y=u===void 0?0:u,b=d===void 0?``:d,x=h===void 0?!1:h,re=g===void 0?!0:g,ie=x&&!re,S=x&&re,C=`h-full ${b}`,w=x?100:ee,T=x?50:te,E=x?100:ne,D=ie&&`hidden`,O;n[0]===D?O=n[1]:(O=p(`border-r border-transparent`,D),n[0]=D,n[1]=O);let k;n[2]!==y||n[3]!==v||n[4]!==f||n[5]!==m||n[6]!==t||n[7]!==r||n[8]!==w||n[9]!==T||n[10]!==E||n[11]!==O?(k=(0,L.jsx)(A,{ref:t,defaultSize:w,minSize:T,maxSize:E,collapsible:v,collapsedSize:y,onCollapse:f,onExpand:m,className:O,children:r}),n[2]=y,n[3]=v,n[4]=f,n[5]=m,n[6]=t,n[7]=r,n[8]=w,n[9]=T,n[10]=E,n[11]=O,n[12]=k):k=n[12];let j;n[13]===x?j=n[14]:(j=!x&&(0,L.jsx)(se,{withHandle:!0,className:`ml-[-40px]`}),n[13]=x,n[14]=j);let oe=S&&`hidden`,M;n[15]===oe?M=n[16]:(M=p(`overflow-hidden`,oe),n[15]=oe,n[16]=M);let N;n[17]!==i||n[18]!==_||n[19]!==M?(N=(0,L.jsx)(A,{minSize:_,className:M,children:i}),n[17]=i,n[18]=_,n[19]=M,n[20]=N):N=n[20];let P;n[21]!==k||n[22]!==j||n[23]!==N?(P=(0,L.jsxs)(ae,{direction:`horizontal`,className:`h-full`,children:[k,j,N]}),n[21]=k,n[22]=j,n[23]=N,n[24]=P):P=n[24];let I;return n[25]!==C||n[26]!==P?(I=(0,L.jsx)(`div`,{className:C,children:P}),n[25]=C,n[26]=P,n[27]=I):I=n[27],I}),le=[{id:`providers`,label:`Providers`,icon:(0,L.jsx)(t,{className:`h-4 w-4`}),route:`/settings/providers`},{id:`models`,label:`Models`,icon:(0,L.jsx)(m,{className:`h-4 w-4`}),route:`/settings/models`},{id:`skills`,label:`Skills`,icon:(0,L.jsx)(h,{className:`h-4 w-4`}),route:`/settings/skills`},{id:`rules`,label:`Rules`,icon:(0,L.jsx)(a,{className:`h-4 w-4`}),route:`/settings/rules`},{id:`slash-commands`,label:`Slash Commands`,icon:(0,L.jsx)(b,{className:`h-4 w-4`}),route:`/settings/slash-commands`},{id:`subagents`,label:`Subagents`,icon:(0,L.jsx)(n,{className:`h-4 w-4`}),route:`/settings/subagents`},{id:`instructions`,label:`Instructions`,icon:(0,L.jsx)(te,{className:`h-4 w-4`}),route:`/settings/instructions`},{id:`system-prompt`,label:`System Prompt`,icon:(0,L.jsx)(c,{className:`h-4 w-4`}),route:`/settings/system-prompt`},{id:`mcp-servers`,label:`MCP Servers`,icon:(0,L.jsx)(u,{className:`h-4 w-4`}),route:`/settings/mcp-servers`},{id:`general`,label:`General`,icon:(0,L.jsx)(ne,{className:`h-4 w-4`}),route:`/settings/general`},{id:`history`,label:`History`,icon:(0,L.jsx)(v,{className:`h-4 w-4`}),route:`/settings/history`},{id:`account`,label:`Account`,icon:(0,L.jsx)(i,{className:`h-4 w-4`}),route:`/settings/account`}];function R(e){let t=[...le];if(!e)return t;let n=t.findIndex(e=>e.id===`skills`);return t.splice(n,0,{id:`project`,label:`Project`,icon:(0,L.jsx)(r,{className:`h-4 w-4`}),route:`/settings/project/${e}`}),t}function ue(e){let t=(0,F.c)(13),{className:n,selectedProjectId:r,onResetOnboarding:i,onNavItemSelect:a}=e,o=x(),s=ie(),c=(0,I.useRef)(0),l=(0,I.useRef)(null),u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>()=>{l.current&&clearTimeout(l.current)},d=[],t[0]=u,t[1]=d):(u=t[0],d=t[1]),(0,I.useEffect)(u,d);let f,p;if(t[2]!==n||t[3]!==s.pathname||t[4]!==o||t[5]!==a||t[6]!==i||t[7]!==r){let e=R(r),u=function(){let t=s.pathname;if(t.startsWith(`/settings/project/`))return`project`;for(let n of e)if(t.startsWith(n.route))return n.id;return`general`}(),d=function(e){e.id===`general`&&i&&(l.current&&clearTimeout(l.current),c.current+=1,c.current>=3?(c.current=0,i()):l.current=setTimeout(()=>{c.current=0},1500)),a?.(),o(e.route)};f=`space-y-1${n?` ${n}`:``}`,p=e.map((t,n)=>(0,L.jsxs)(I.Fragment,{children:[(0,L.jsx)(w,{selected:u===t.id,asChild:!0,children:(0,L.jsx)(`button`,{className:`justify-start`,onClick:()=>d(t),children:(0,L.jsxs)(`span`,{className:`flex items-center gap-2`,children:[t.icon,(0,L.jsx)(`span`,{children:t.label})]})})}),(t.id===`models`||t.id===`mcp-servers`||n===e.length-1)&&(0,L.jsx)(C,{className:`my-2 bg-sidebar-border`})]},t.id)),t[2]=n,t[3]=s.pathname,t[4]=o,t[5]=a,t[6]=i,t[7]=r,t[8]=f,t[9]=p}else f=t[8],p=t[9];let m;return t[10]!==f||t[11]!==p?(m=(0,L.jsx)(`div`,{className:f,children:p}),t[10]=f,t[11]=p,t[12]=m):m=t[12],m}var de=(0,I.lazy)(()=>S(()=>import(`./settings-general-view-DI-lvP0L.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),fe=(0,I.lazy)(()=>S(()=>import(`./project-settings-view-Cd_l3Lfy.js`),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11,13]))),pe=(0,I.lazy)(()=>S(()=>import(`./providers-list-view-VXhgM3vp.js`),__vite__mapDeps([14,1,2,3,4,5,6,7,8,9,10,11,15]))),me=(0,I.lazy)(()=>S(()=>import(`./settings-models-view-ms828HDa.js`),__vite__mapDeps([16,1,2,3,4,5,6,7,8,9,10,11,17,15,18]))),he=(0,I.lazy)(()=>S(()=>import(`./settings-mcp-servers-view-DmxUO42I.js`),__vite__mapDeps([19,1,2,3,4,5,6,7,8,9,10,11,20,18,15]))),ge=(0,I.lazy)(()=>S(()=>import(`./settings-skills-view-DvPPdsi_.js`),__vite__mapDeps([21,1,2,3,4,5,6,7,8,9,10,11,20,18,15]))),_e=(0,I.lazy)(()=>S(()=>import(`./settings-rules-view-Xx0ymfnQ.js`),__vite__mapDeps([22,1,2,3,4,5,6,7,8,9,10,11,20,18,15]))),ve=(0,I.lazy)(()=>S(()=>import(`./settings-slash-commands-view-BULIAW2o.js`),__vite__mapDeps([23,1,2,3,4,5,6,7,8,9,10,11,20,13,18,15]))),ye=(0,I.lazy)(()=>S(()=>import(`./settings-subagents-view-B7FcLaZT.js`),__vite__mapDeps([24,1,2,3,4,5,6,7,8,9,10,11,20,18,15]))),be=(0,I.lazy)(()=>S(()=>import(`./settings-instructions-view-kUG32_dT.js`),__vite__mapDeps([25,1,2,3,4,5,6,7,8,9,10,11]))),xe=(0,I.lazy)(()=>S(()=>import(`./settings-system-prompt-view-66zf0gRc.js`),__vite__mapDeps([26,1,2,3,4,5,6,7,8,9,10,11]))),Se=(0,I.lazy)(()=>S(()=>import(`./account-view-k5jIArY-.js`),__vite__mapDeps([27,1,2,3,4,5,6,7,8,9,10,11,15]))),Ce=(0,I.lazy)(()=>S(()=>import(`./history-view-Ds_0e_bx.js`).then(e=>e.t),__vite__mapDeps([5,1,6]))),we=[`general`,`providers`,`models`,`skills`,`rules`,`slash-commands`,`subagents`,`instructions`,`system-prompt`,`mcp-servers`,`history`,`account`];function z(e){let t=(0,F.c)(2),{title:n}=e,r;return t[0]===n?r=t[1]:(r=(0,L.jsx)(D,{title:n,children:`Content coming soon...`}),t[0]=n,t[1]=r),r}function Te(){let e=(0,F.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsxs)(`div`,{className:`mb-6`,children:[(0,L.jsx)(`div`,{className:`h-8 w-32 bg-muted rounded animate-pulse mb-2`}),(0,L.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,L.jsx)(`div`,{className:`mb-6`,children:(0,L.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,L.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,L.jsxs)(`div`,{children:[r,(0,L.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,L.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,L.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`})]})]}),a=(0,L.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,L.jsx)(T,{children:(0,L.jsxs)(E,{children:[t,n,(0,L.jsxs)(`div`,{className:`space-y-8`,children:[i,(0,L.jsxs)(`div`,{children:[a,(0,L.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,L.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,L.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,L.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,L.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`})]})]})]})]})}),e[5]=o):o=e[5],o}function Ee(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/system-prompt`)?`system-prompt`:e.startsWith(`/settings/mcp-servers`)?`mcp-servers`:e.startsWith(`/settings/history`)?`history`:e.startsWith(`/settings/account`)?`account`:`general`}function De(){let e=(0,F.c)(62),{tab:t,projectId:n}=re(),r=x(),i=ie(),a=O(),o=j(Ae),c=j(ke),u;e[0]!==i.pathname||e[1]!==n?(u=!!n&&i.pathname.startsWith(`/settings/project/`),e[0]=i.pathname,e[1]=n,e[2]=u):u=e[2];let f=u,m;if(e[3]!==i.pathname||e[4]!==i.search||e[5]!==t){let n=new URLSearchParams(i.search).get(`tab`);m=n&&we.includes(n)?n:t&&we.includes(t)?t:Ee(i.pathname),e[3]=i.pathname,e[4]=i.search,e[5]=t,e[6]=m}else m=e[6];let h=m,g=M(),[te,ne]=(0,I.useState)(!1),[v,b]=(0,I.useState)(!0),[S,C]=(0,I.useState)(0),w=(0,I.useRef)(null),T;bb0:{if(f){T=`Project`;break bb0}let t;e[7]===h?t=e[8]:(t=le.find(e=>e.id===h)?.label??`Settings`,e[7]=h,e[8]=t),T=t}let E=T,D;e[9]===g?D=e[10]:(D=()=>{g&&b(!1)},e[9]=g,e[10]=D);let ae=D,A;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{b(!0)},e[11]=A):A=e[11];let se=A,R;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(R=async()=>{try{await l(),C(Oe)}catch(e){console.error(`Failed to reset onboarding:`,e)}},e[12]=R):R=e[12];let De=R,B;e[13]===r?B=e[14]:(B=()=>{r(`/`)},e[13]=r,e[14]=B);let je=B,V;e[15]===o?V=e[16]:(V=o?{type:`project`,id:o}:void 0,e[15]=o,e[16]=V);let Me=V,H;e[17]===r?H=e[18]:(H=()=>{r(`/settings/general`)},e[17]=r,e[18]=H);let Ne=H,U;e[19]!==a||e[20]!==n?(U=async()=>{s(n);try{let e=await y();a({type:oe.SetProjects,projects:e.projects})}catch(e){let t=e;throw console.error(`Failed to refresh projects after settings update:`,t),t}},e[19]=a,e[20]=n,e[21]=U):U=e[21];let Pe=U,W,G;e[22]!==i.pathname||e[23]!==r?(W=()=>{(i.pathname===`/settings`||i.pathname===`/settings/project`||[`/settings/mcp-server-edit`,`/settings/add-skill`,`/settings/add-command`,`/settings/add-rule`,`/settings/add-agent`].some(e=>i.pathname.startsWith(e)))&&r(`/settings/general`,{replace:!0})},G=[i.pathname,r],e[22]=i.pathname,e[23]=r,e[24]=W,e[25]=G):(W=e[24],G=e[25]),(0,I.useEffect)(W,G);let K;e[26]!==je||e[27]!==ae||e[28]!==o?(K=()=>(0,L.jsx)(k,{onTitleClose:je,subtitle:`Settings`,children:(0,L.jsx)(`div`,{className:`px-2 py-2`,children:(0,L.jsx)(ue,{selectedProjectId:o,onResetOnboarding:De,onNavItemSelect:ae})})}),e[26]=je,e[27]=ae,e[28]=o,e[29]=K):K=e[29];let Fe=K,Ie;e[30]!==h||e[31]!==Ne||e[32]!==Pe||e[33]!==Me||e[34]!==f||e[35]!==S||e[36]!==n||e[37]!==c?(Ie=()=>{if(f&&n)return(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(z,{title:`Project Settings`}),children:(0,L.jsx)(fe,{projectId:n,onProjectUpdated:Pe})});switch(h){case`general`:return(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(z,{title:`General`}),children:(0,L.jsx)(de,{onboardingResetSignal:S})});case`providers`:return(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(Te,{}),children:(0,L.jsx)(pe,{})});case`models`:return(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(P,{}),children:(0,L.jsx)(me,{})});case`skills`:return(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(z,{title:`Skills`}),children:(0,L.jsx)(ge,{})});case`rules`:return(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(z,{title:`Rules`}),children:(0,L.jsx)(_e,{})});case`slash-commands`:return(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(z,{title:`Slash Commands`}),children:(0,L.jsx)(ve,{})});case`subagents`:return(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(z,{title:`Subagents`}),children:(0,L.jsx)(ye,{})});case`instructions`:return(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(z,{title:`Instructions`}),children:(0,L.jsx)(be,{})});case`system-prompt`:return(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(z,{title:`System Prompt`}),children:(0,L.jsx)(xe,{})});case`mcp-servers`:return(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(z,{title:`MCP Servers`}),children:(0,L.jsx)(he,{})});case`history`:return(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(z,{title:`History`}),children:(0,L.jsx)(Ce,{isOpen:!0,onClose:Ne,initialFilter:Me,projects:c,inline:!0})});case`account`:return(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(z,{title:`Account`}),children:(0,L.jsx)(Se,{})});default:return(0,L.jsx)(z,{title:`Settings`})}},e[30]=h,e[31]=Ne,e[32]=Pe,e[33]=Me,e[34]=f,e[35]=S,e[36]=n,e[37]=c,e[38]=Ie):Ie=e[38];let Le=Ie,Re,ze;e[39]===Symbol.for(`react.memo_cache_sentinel`)?(Re=()=>ne(!0),ze=()=>ne(!1),e[39]=Re,e[40]=ze):(Re=e[39],ze=e[40]);let q;e[41]===Fe?q=e[42]:(q=Fe(),e[41]=Fe,e[42]=q);let J;e[43]!==E||e[44]!==g||e[45]!==v?(J=g&&!v&&(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,L.jsxs)(ee,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground electrobun-webkit-app-region-no-drag`,onClick:se,children:[(0,L.jsx)(d,{className:`h-4 w-4`}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Show settings menu`})]}),(0,L.jsx)(`span`,{className:p(_.sectionTitle,`truncate text-foreground`),children:E})]}),e[43]=E,e[44]=g,e[45]=v,e[46]=J):J=e[46];let Y;e[47]===J?Y=e[48]:(Y=(0,L.jsx)(N,{className:`pt-8 md:min-h-[103px]`,children:J}),e[47]=J,e[48]=Y);let Be=`flex-1 overflow-auto ${te&&!g?`ml-[40px]`:``}`,X;e[49]===Le?X=e[50]:(X=Le(),e[49]=Le,e[50]=X);let Z;e[51]!==Be||e[52]!==X?(Z=(0,L.jsx)(`div`,{className:Be,children:X}),e[51]=Be,e[52]=X,e[53]=Z):Z=e[53];let Q;e[54]!==Y||e[55]!==Z?(Q=(0,L.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[Y,Z]}),e[54]=Y,e[55]=Z,e[56]=Q):Q=e[56];let $;return e[57]!==g||e[58]!==v||e[59]!==q||e[60]!==Q?($=(0,L.jsx)(ce,{ref:w,collapsible:!0,isMobile:g,mobileShowSidebar:v,onCollapse:Re,onExpand:ze,sidebar:q,children:Q}),e[57]=g,e[58]=v,e[59]=q,e[60]=Q,e[61]=$):$=e[61],$}function Oe(e){return e+1}function ke(e){return e.projects}function Ae(e){return e.selectedProjectId}export{De as default};
@@ -0,0 +1 @@
1
+ import{Ti as e,fo as t,ii as n}from"./dialogs-config-B4TDFSrS.js";var r=t(),i=e();function a(e){let t=(0,r.c)(8),a,o;t[0]===e?(a=t[1],o=t[2]):({className:a,...o}=e,t[0]=e,t[1]=a,t[2]=o);let s;t[3]===a?s=t[4]:(s=n(`animate-pulse rounded-md bg-muted`,a),t[3]=a,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,i.jsx)(`div`,{className:s,...o}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}export{a as t};
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ia as t,Wa as n,gi as r,gn as i,io as a}from"./dialogs-config-Ct6i8Iij.js";import{A as o,O as s,S as c,j as l,x as u}from"./index-6DhhjIBL.js";var d=e(a(),1),f=r();function p(){let e=o(e=>e.selectedProjectId),r=o(e=>e.selectedThreadId),a=o(e=>e.projects),{terminalState:p,dispatch:m}=l(r),{queuedCommand:h,queuedRelativeFolder:g,outputLines:_,history:v,historyIndex:y,cwd:b,isRunning:x}=p,[S,C]=(0,d.useState)(``),[w,T]=(0,d.useState)([]),E=a.flatMap(e=>e.threads).find(e=>e.threadId===r)?.path??null,D=!b||b===`.`||b===`./`?E:b,O=!D||D===E,{activeMainTab:k}=c(),A=(0,d.useRef)(null),j=(0,d.useRef)(null),M=(0,d.useRef)(0);(0,d.useEffect)(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[w]),(0,d.useEffect)(()=>{T(_),M.current=_.length},[r,_]),(0,d.useEffect)(()=>{if(_.length===0)T([]),M.current=0;else if(_.length>M.current){let e=_.slice(M.current);T(t=>[...t,...e]),M.current=_.length}},[_]),(0,d.useEffect)(()=>{x||j.current?.focus()},[x]),(0,d.useEffect)(()=>{k===`terminal`&&j.current?.focus()},[k]);let N=(0,d.useCallback)(async(t,n)=>{if(!(!e||!r||!t.trim())){m({type:s.AppendTerminalLine,line:{type:`input`,content:t}}),m({type:s.SetTerminalHistory,history:[t,...v.filter(e=>e!==t)].slice(0,50)}),m({type:s.SetTerminalHistoryIndex,index:-1}),C(``),m({type:s.SetTerminalRunning,isRunning:!0});try{let a=await i(e,r,t,n??void 0);if(!a){m({type:s.AppendTerminalLine,line:{type:`system`,content:`Command started but no output stream received.`}}),m({type:s.SetTerminalRunning,isRunning:!1});return}let o=a.getReader(),c=new TextDecoder,l=``;for(;;){let{done:e,value:t}=await o.read();if(e)break;l+=c.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`?m({type:s.AppendTerminalLine,line:{type:`output`,content:u(t)}}):t.type===`error`?m({type:s.AppendTerminalLine,line:{type:`error`,content:u(t.message)}}):t.type===`cwd`&&m({type:s.SetTerminalCwd,cwd:t.path})}catch{m({type:s.AppendTerminalLine,line:{type:`output`,content:u(e)}})}}if(l.trim())try{let e=JSON.parse(l);typeof e==`string`?m({type:s.AppendTerminalLine,line:{type:`output`,content:u(e)}}):e.type===`error`?m({type:s.AppendTerminalLine,line:{type:`error`,content:u(e.message)}}):e.type===`cwd`&&m({type:s.SetTerminalCwd,cwd:e.path})}catch{m({type:s.AppendTerminalLine,line:{type:`output`,content:u(l)}})}}catch(e){m({type:s.AppendTerminalLine,line:{type:`error`,content:e instanceof Error?e.message:`Failed to run command`}})}finally{m({type:s.SetTerminalRunning,isRunning:!1})}}},[e,r,m,v]);return(0,d.useEffect)(()=>{h&&!x&&(N(h,g??void 0),m({type:s.ClearQueuedTerminalCommand}))},[h,g,x,m,N]),(0,f.jsxs)(`div`,{className:`flex flex-col h-full bg-neutral-950 text-neutral-200 font-mono text-sm overflow-hidden`,children:[(0,f.jsxs)(`div`,{ref:A,className:`flex-1 overflow-y-auto p-4 space-y-0.5 terminal-scrollbar`,onClick:e=>{e.target===e.currentTarget&&j.current?.focus()},children:[w.length===0&&!x&&(0,f.jsx)(`div`,{className:`text-neutral-600 italic text-xs`,children:`Enter your commands below...`}),w.map((e,t)=>(0,f.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,f.jsx)(n,{className:`h-4 w-4 mt-1 shrink-0 text-blue-400/70`}),(0,f.jsx)(`span`,{children:e.content})]},t))]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 border-t border-white/5 bg-white/5`,children:[!O&&(0,f.jsx)(`span`,{className:`text-blue-400 text-xs font-bold whitespace-nowrap`,children:D.split(`/`).pop()}),(0,f.jsx)(n,{className:`h-4 w-4 text-blue-400 ${O?``:`-ml-1`}`}),(0,f.jsx)(`input`,{ref:j,type:`text`,className:`flex-1 bg-transparent border-none outline-none text-neutral-200 placeholder:text-neutral-700 h-6`,placeholder:x?`Running...`:`Type a command...`,value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{if(e.key===`Enter`)N(S);else if(e.key===`ArrowUp`){e.preventDefault();let t=y+1;t<v.length&&(m({type:s.SetTerminalHistoryIndex,index:t}),C(v[t]))}else if(e.key===`ArrowDown`){e.preventDefault();let t=y-1;t>=0?(m({type:s.SetTerminalHistoryIndex,index:t}),C(v[t])):(m({type:s.SetTerminalHistoryIndex,index:-1}),C(``))}},disabled:x}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1 px-1.5 py-0.5 rounded border border-white/10 bg-white/5`,children:[(0,f.jsx)(t,{className:`h-3 w-3 text-neutral-600`}),(0,f.jsx)(`span`,{className:`text-[10px] text-neutral-600 uppercase font-bold`,children:`Enter`})]})]})]})}export{p as TerminalPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ka as t,Qt as n,Ti as r,eo as i,mo as a}from"./dialogs-config-B4TDFSrS.js";import{C as o,M as s,S as c,j as l,k as u}from"./index-DOsSr4dl.js";var d=e(a(),1),f=r();function p(){let e=l(e=>e.selectedProjectId),r=l(e=>e.selectedThreadId),a=l(e=>e.projects),{terminalState:p,dispatch:m}=s(r),{queuedCommand:h,queuedRelativeFolder:g,outputLines:_,history:v,historyIndex:y,cwd:b,isRunning:x}=p,[S,C]=(0,d.useState)(``),[w,T]=(0,d.useState)([]),E=a.flatMap(e=>e.threads).find(e=>e.threadId===r)?.path??null,D=!b||b===`.`||b===`./`?E:b,O=!D||D===E,{activeMainTab:k}=o(),A=(0,d.useRef)(null),j=(0,d.useRef)(null),M=(0,d.useRef)(0);(0,d.useEffect)(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[w]),(0,d.useEffect)(()=>{T(_),M.current=_.length},[r,_]),(0,d.useEffect)(()=>{if(_.length===0)T([]),M.current=0;else if(_.length>M.current){let e=_.slice(M.current);T(t=>[...t,...e]),M.current=_.length}},[_]),(0,d.useEffect)(()=>{x||j.current?.focus()},[x]),(0,d.useEffect)(()=>{k===`terminal`&&j.current?.focus()},[k]);let N=(0,d.useCallback)(async(t,i)=>{if(!(!e||!r||!t.trim())){m({type:u.AppendTerminalLine,line:{type:`input`,content:t}}),m({type:u.SetTerminalHistory,history:[t,...v.filter(e=>e!==t)].slice(0,50)}),m({type:u.SetTerminalHistoryIndex,index:-1}),C(``),m({type:u.SetTerminalRunning,isRunning:!0});try{let a=await n(e,r,t,i??void 0);if(!a){m({type:u.AppendTerminalLine,line:{type:`system`,content:`Command started but no output stream received.`}}),m({type:u.SetTerminalRunning,isRunning:!1});return}let o=a.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`?m({type:u.AppendTerminalLine,line:{type:`output`,content:c(t)}}):t.type===`error`?m({type:u.AppendTerminalLine,line:{type:`error`,content:c(t.message)}}):t.type===`cwd`&&m({type:u.SetTerminalCwd,cwd:t.path})}catch{m({type:u.AppendTerminalLine,line:{type:`output`,content:c(e)}})}}if(l.trim())try{let e=JSON.parse(l);typeof e==`string`?m({type:u.AppendTerminalLine,line:{type:`output`,content:c(e)}}):e.type===`error`?m({type:u.AppendTerminalLine,line:{type:`error`,content:c(e.message)}}):e.type===`cwd`&&m({type:u.SetTerminalCwd,cwd:e.path})}catch{m({type:u.AppendTerminalLine,line:{type:`output`,content:c(l)}})}}catch(e){m({type:u.AppendTerminalLine,line:{type:`error`,content:e instanceof Error?e.message:`Failed to run command`}})}finally{m({type:u.SetTerminalRunning,isRunning:!1})}}},[e,r,m,v]);return(0,d.useEffect)(()=>{h&&!x&&(N(h,g??void 0),m({type:u.ClearQueuedTerminalCommand}))},[h,g,x,m,N]),(0,f.jsxs)(`div`,{className:`flex flex-col h-full bg-neutral-950 text-neutral-200 font-mono text-sm overflow-hidden`,children:[(0,f.jsxs)(`div`,{ref:A,className:`flex-1 overflow-y-auto p-4 space-y-0.5 terminal-scrollbar`,onClick:e=>{e.target===e.currentTarget&&j.current?.focus()},children:[w.length===0&&!x&&(0,f.jsx)(`div`,{className:`text-neutral-600 italic text-xs`,children:`Enter your commands below...`}),w.map((e,t)=>(0,f.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,f.jsx)(i,{className:`h-4 w-4 mt-1 shrink-0 text-blue-400/70`}),(0,f.jsx)(`span`,{children:e.content})]},t))]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 border-t border-white/5 bg-white/5`,children:[!O&&(0,f.jsx)(`span`,{className:`text-blue-400 text-xs font-bold whitespace-nowrap`,children:D.split(`/`).pop()}),(0,f.jsx)(i,{className:`h-4 w-4 text-blue-400 ${O?``:`-ml-1`}`}),(0,f.jsx)(`input`,{ref:j,type:`text`,className:`flex-1 bg-transparent border-none outline-none text-neutral-200 placeholder:text-neutral-700 h-6`,placeholder:x?`Running...`:`Type a command...`,value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{if(e.key===`Enter`)N(S);else if(e.key===`ArrowUp`){e.preventDefault();let t=y+1;t<v.length&&(m({type:u.SetTerminalHistoryIndex,index:t}),C(v[t]))}else if(e.key===`ArrowDown`){e.preventDefault();let t=y-1;t>=0?(m({type:u.SetTerminalHistoryIndex,index:t}),C(v[t])):(m({type:u.SetTerminalHistoryIndex,index:-1}),C(``))}},disabled:x}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1 px-1.5 py-0.5 rounded border border-white/10 bg-white/5`,children:[(0,f.jsx)(t,{className:`h-3 w-3 text-neutral-600`}),(0,f.jsx)(`span`,{className:`text-[10px] text-neutral-600 uppercase font-bold`,children:`Enter`})]})]})]})}export{p as TerminalPanel};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Er as t,Kr as n,Sr as r,Tr as i,_i as a,io as o,pr as s,wr as c}from"./dialogs-config-Ct6i8Iij.js";var l=1,u=.9,d=.8,f=.17,p=.1,m=.999,h=.9999,g=.99,_=/[\\\/_+.#"@\[\(\{&]/,v=/[\\\/_+.#"@\[\(\{&]/g,y=/[\s-]/,b=/[\s-]/g;function x(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?l:g;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),S=n.indexOf(c,i),C=0,w,T,E,D;S>=0;)w=x(e,t,n,r,S+1,a+1,o),w>C&&(S===i?w*=l:_.test(e.charAt(S-1))?(w*=d,E=e.slice(i,S-1).match(v),E&&i>0&&(w*=m**+E.length)):y.test(e.charAt(S-1))?(w*=u,D=e.slice(i,S-1).match(b),D&&i>0&&(w*=m**+D.length)):(w*=f,i>0&&(w*=m**+(S-i))),e.charAt(S)!==t.charAt(a)&&(w*=h)),(w<p&&n.charAt(S-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(S-1)!==r.charAt(a))&&(T=x(e,t,n,r,S+1,a+2,o),T*p>w&&(w=T*p)),w>C&&(C=w),S=n.indexOf(c,S+1);return o[s]=C,C}function S(e){return e.toLowerCase().replace(b,` `)}function C(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,x(e,t,S(e),S(t),0,0,{})}var w=e(o(),1),T=`[cmdk-group=""]`,E=`[cmdk-group-items=""]`,D=`[cmdk-group-heading=""]`,O=`[cmdk-item=""]`,k=`${O}:not([aria-disabled="true"])`,A=`cmdk-item-select`,j=`data-value`,ee=(e,t,n)=>C(e,t,n),M=w.createContext(void 0),N=()=>w.useContext(M),P=w.createContext(void 0),F=()=>w.useContext(P),I=w.createContext(void 0),L=w.forwardRef((e,t)=>{let r=Y(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),i=Y(()=>new Set),a=Y(()=>new Map),o=Y(()=>new Map),c=Y(()=>new Set),l=q(e),{label:u,children:d,value:f,onValueChange:p,filter:m,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...y}=e,b=n(),x=n(),S=n(),C=w.useRef(null),N=re();J(()=>{if(f!==void 0){let e=f.trim();r.current.value=e,F.emit()}},[f]),J(()=>{N(6,V)},[]);let F=w.useMemo(()=>({subscribe:e=>(c.current.add(e),()=>c.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var i,a,o;if(!Object.is(r.current[e],t)){if(r.current[e]=t,e===`search`)B(),R(),N(1,z);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(S);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(N(7,()=>{r.current.selectedItemId=H()?.id,F.emit()}),n||N(5,V),l.current?.value!==void 0){let e=t??``;(o=(a=l.current).onValueChange)==null||o.call(a,e);return}}F.emit()}},emit:()=>{c.current.forEach(e=>e())}}),[]),I=w.useMemo(()=>({value:(e,t,n)=>{t!==o.current.get(e)?.value&&(o.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,L(t,n)),N(2,()=>{R(),F.emit()}))},item:(e,t)=>(i.current.add(e),t&&(a.current.has(t)?a.current.get(t).add(e):a.current.set(t,new Set([e]))),N(3,()=>{B(),R(),r.current.value||z(),F.emit()}),()=>{o.current.delete(e),i.current.delete(e),r.current.filtered.items.delete(e);let t=H();N(4,()=>{B(),t?.getAttribute(`id`)===e&&z(),F.emit()})}),group:e=>(a.current.has(e)||a.current.set(e,new Set),()=>{o.current.delete(e),a.current.delete(e)}),filter:()=>l.current.shouldFilter,label:u||e[`aria-label`],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:S,labelId:x,listInnerRef:C}),[]);function L(e,t){let n=l.current?.filter??ee;return e?n(e,r.current.search,t):0}function R(){if(!r.current.search||l.current.shouldFilter===!1)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(n=>{let r=a.current.get(n),i=0;r.forEach(t=>{let n=e.get(t);i=Math.max(n,i)}),t.push([n,i])});let n=C.current;U().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(E);t?t.appendChild(e.parentElement===t?e:e.closest(`${E} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${E} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${T}[${j}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function z(){let e=U().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(j);F.setState(`value`,e||void 0)}function B(){if(!r.current.search||l.current.shouldFilter===!1){r.current.filtered.count=i.current.size;return}r.current.filtered.groups=new Set;let e=0;for(let t of i.current){let n=L(o.current.get(t)?.value??``,o.current.get(t)?.keywords??[]);r.current.filtered.items.set(t,n),n>0&&e++}for(let[e,t]of a.current)for(let n of t)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=e}function V(){var e;let t=H();t&&(t.parentElement?.firstChild===t&&((e=t.closest(T)?.querySelector(D))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function H(){return C.current?.querySelector(`${O}[aria-selected="true"]`)}function U(){return Array.from(C.current?.querySelectorAll(k)||[])}function W(e){let t=U()[e];t&&F.setState(`value`,t.getAttribute(j))}function G(e){var t;let n=H(),r=U(),i=r.findIndex(e=>e===n),a=r[i+e];(t=l.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&F.setState(`value`,a.getAttribute(j))}function K(e){let t=H()?.closest(T),n;for(;t&&!n;)t=e>0?te(t,T):ne(t,T),n=t?.querySelector(k);n?F.setState(`value`,n.getAttribute(j)):G(e)}let X=()=>W(U().length-1),Z=e=>{e.preventDefault(),e.metaKey?X():e.altKey?K(1):G(1)},Q=e=>{e.preventDefault(),e.metaKey?W(0):e.altKey?K(-1):G(-1)};return w.createElement(s.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&Z(e);break;case`ArrowDown`:Z(e);break;case`p`:case`k`:v&&e.ctrlKey&&Q(e);break;case`ArrowUp`:Q(e);break;case`Home`:e.preventDefault(),W(0);break;case`End`:e.preventDefault(),X();break;case`Enter`:{e.preventDefault();let t=H();if(t){let e=new Event(A);t.dispatchEvent(e)}}}}},w.createElement(`label`,{"cmdk-label":``,htmlFor:I.inputId,id:I.labelId,style:ie},u),$(e,e=>w.createElement(P.Provider,{value:F},w.createElement(M.Provider,{value:I},e))))}),R=w.forwardRef((e,t)=>{let r=n(),i=w.useRef(null),o=w.useContext(I),c=N(),l=q(e),u=l.current?.forceMount??o?.forceMount;J(()=>{if(!u)return c.item(r,o?.id)},[u]);let d=Z(r,i,[e.value,e.children,i],e.keywords),f=F(),p=X(e=>e.value&&e.value===d.current),m=X(e=>u||c.filter()===!1?!0:e.search?e.filtered.items.get(r)>0:!0);w.useEffect(()=>{let t=i.current;if(!(!t||e.disabled))return t.addEventListener(A,h),()=>t.removeEventListener(A,h)},[m,e.onSelect,e.disabled]);function h(){var e,t;g(),(t=(e=l.current).onSelect)==null||t.call(e,d.current)}function g(){f.setState(`value`,d.current,!0)}if(!m)return null;let{disabled:_,value:v,onSelect:y,forceMount:b,keywords:x,...S}=e;return w.createElement(s.div,{ref:a(i,t),...S,id:r,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!p,"data-disabled":!!_,"data-selected":!!p,onPointerMove:_||c.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),z=w.forwardRef((e,t)=>{let{heading:r,children:i,forceMount:o,...c}=e,l=n(),u=w.useRef(null),d=w.useRef(null),f=n(),p=N(),m=X(e=>o||p.filter()===!1?!0:e.search?e.filtered.groups.has(l):!0);J(()=>p.group(l),[]),Z(l,u,[e.value,e.heading,d]);let h=w.useMemo(()=>({id:l,forceMount:o}),[o]);return w.createElement(s.div,{ref:a(u,t),...c,"cmdk-group":``,role:`presentation`,hidden:m?void 0:!0},r&&w.createElement(`div`,{ref:d,"cmdk-group-heading":``,"aria-hidden":!0,id:f},r),$(e,e=>w.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":r?f:void 0},w.createElement(I.Provider,{value:h},e))))}),B=w.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=w.useRef(null),o=X(e=>!e.search);return!n&&!o?null:w.createElement(s.div,{ref:a(i,t),...r,"cmdk-separator":``,role:`separator`})}),V=w.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=F(),o=X(e=>e.search),c=X(e=>e.selectedItemId),l=N();return w.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),w.createElement(s.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),H=w.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,o=w.useRef(null),c=w.useRef(null),l=X(e=>e.selectedItemId),u=N();return w.useEffect(()=>{if(c.current&&o.current){let e=c.current,t=o.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),w.createElement(s.div,{ref:a(o,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:u.listId},$(e,e=>w.createElement(`div`,{ref:a(c,u.listInnerRef),"cmdk-list-sizer":``},e)))}),U=w.forwardRef((e,n)=>{let{open:a,onOpenChange:o,overlayClassName:s,contentClassName:l,container:u,...d}=e;return w.createElement(t,{open:a,onOpenChange:o},w.createElement(i,{container:u},w.createElement(c,{"cmdk-overlay":``,className:s}),w.createElement(r,{"aria-label":e.label,"cmdk-dialog":``,className:l},w.createElement(L,{ref:n,...d}))))}),W=w.forwardRef((e,t)=>X(e=>e.filtered.count===0)?w.createElement(s.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),G=w.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return w.createElement(s.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},$(e,e=>w.createElement(`div`,{"aria-hidden":!0},e)))}),K=Object.assign(L,{List:H,Item:R,Input:V,Group:z,Separator:B,Dialog:U,Empty:W,Loading:G});function te(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ne(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function q(e){let t=w.useRef(e);return J(()=>{t.current=e}),t}var J=typeof window>`u`?w.useEffect:w.useLayoutEffect;function Y(e){let t=w.useRef();return t.current===void 0&&(t.current=e()),t}function X(e){let t=F(),n=()=>e(t.snapshot());return w.useSyncExternalStore(t.subscribe,n,n)}function Z(e,t,n,r=[]){let i=w.useRef(),a=N();return J(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(j,s),i.current=s}),i}var re=()=>{let[e,t]=w.useState(),n=Y(()=>new Map);return J(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Q(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function $({asChild:e,children:t},n){return e&&w.isValidElement(t)?w.cloneElement(Q(t),{ref:t.ref},n(t.props.children)):n(t)}var ie={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};export{K as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ar as t,Ei as n,Mr as r,Or as i,Qr as a,jr as o,mo as s,yr as c}from"./dialogs-config-B4TDFSrS.js";var l=1,u=.9,d=.8,f=.17,p=.1,m=.999,h=.9999,g=.99,_=/[\\\/_+.#"@\[\(\{&]/,v=/[\\\/_+.#"@\[\(\{&]/g,y=/[\s-]/,b=/[\s-]/g;function x(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?l:g;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),S=n.indexOf(c,i),C=0,w,T,E,D;S>=0;)w=x(e,t,n,r,S+1,a+1,o),w>C&&(S===i?w*=l:_.test(e.charAt(S-1))?(w*=d,E=e.slice(i,S-1).match(v),E&&i>0&&(w*=m**+E.length)):y.test(e.charAt(S-1))?(w*=u,D=e.slice(i,S-1).match(b),D&&i>0&&(w*=m**+D.length)):(w*=f,i>0&&(w*=m**+(S-i))),e.charAt(S)!==t.charAt(a)&&(w*=h)),(w<p&&n.charAt(S-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(S-1)!==r.charAt(a))&&(T=x(e,t,n,r,S+1,a+2,o),T*p>w&&(w=T*p)),w>C&&(C=w),S=n.indexOf(c,S+1);return o[s]=C,C}function S(e){return e.toLowerCase().replace(b,` `)}function C(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,x(e,t,S(e),S(t),0,0,{})}var w=e(s(),1),T=`[cmdk-group=""]`,E=`[cmdk-group-items=""]`,D=`[cmdk-group-heading=""]`,O=`[cmdk-item=""]`,k=`${O}:not([aria-disabled="true"])`,A=`cmdk-item-select`,j=`data-value`,ee=(e,t,n)=>C(e,t,n),M=w.createContext(void 0),N=()=>w.useContext(M),P=w.createContext(void 0),F=()=>w.useContext(P),I=w.createContext(void 0),L=w.forwardRef((e,t)=>{let n=Y(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=Y(()=>new Set),i=Y(()=>new Map),o=Y(()=>new Map),s=Y(()=>new Set),l=q(e),{label:u,children:d,value:f,onValueChange:p,filter:m,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...y}=e,b=a(),x=a(),S=a(),C=w.useRef(null),N=re();J(()=>{if(f!==void 0){let e=f.trim();n.current.value=e,F.emit()}},[f]),J(()=>{N(6,V)},[]);let F=w.useMemo(()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)B(),R(),N(1,z);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(S);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(N(7,()=>{n.current.selectedItemId=H()?.id,F.emit()}),r||N(5,V),l.current?.value!==void 0){let e=t??``;(o=(a=l.current).onValueChange)==null||o.call(a,e);return}}F.emit()}},emit:()=>{s.current.forEach(e=>e())}}),[]),I=w.useMemo(()=>({value:(e,t,r)=>{t!==o.current.get(e)?.value&&(o.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,L(t,r)),N(2,()=>{R(),F.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),N(3,()=>{B(),R(),n.current.value||z(),F.emit()}),()=>{o.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=H();N(4,()=>{B(),t?.getAttribute(`id`)===e&&z(),F.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{o.current.delete(e),i.current.delete(e)}),filter:()=>l.current.shouldFilter,label:u||e[`aria-label`],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:S,labelId:x,listInnerRef:C}),[]);function L(e,t){let r=l.current?.filter??ee;return e?r(e,n.current.search,t):0}function R(){if(!n.current.search||l.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=C.current;U().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(E);t?t.appendChild(e.parentElement===t?e:e.closest(`${E} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${E} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${T}[${j}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function z(){let e=U().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(j);F.setState(`value`,e||void 0)}function B(){if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=L(o.current.get(t)?.value??``,o.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function V(){var e;let t=H();t&&(t.parentElement?.firstChild===t&&((e=t.closest(T)?.querySelector(D))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function H(){return C.current?.querySelector(`${O}[aria-selected="true"]`)}function U(){return Array.from(C.current?.querySelectorAll(k)||[])}function W(e){let t=U()[e];t&&F.setState(`value`,t.getAttribute(j))}function G(e){var t;let n=H(),r=U(),i=r.findIndex(e=>e===n),a=r[i+e];(t=l.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&F.setState(`value`,a.getAttribute(j))}function K(e){let t=H()?.closest(T),n;for(;t&&!n;)t=e>0?te(t,T):ne(t,T),n=t?.querySelector(k);n?F.setState(`value`,n.getAttribute(j)):G(e)}let X=()=>W(U().length-1),Z=e=>{e.preventDefault(),e.metaKey?X():e.altKey?K(1):G(1)},Q=e=>{e.preventDefault(),e.metaKey?W(0):e.altKey?K(-1):G(-1)};return w.createElement(c.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&Z(e);break;case`ArrowDown`:Z(e);break;case`p`:case`k`:v&&e.ctrlKey&&Q(e);break;case`ArrowUp`:Q(e);break;case`Home`:e.preventDefault(),W(0);break;case`End`:e.preventDefault(),X();break;case`Enter`:{e.preventDefault();let t=H();if(t){let e=new Event(A);t.dispatchEvent(e)}}}}},w.createElement(`label`,{"cmdk-label":``,htmlFor:I.inputId,id:I.labelId,style:ie},u),$(e,e=>w.createElement(P.Provider,{value:F},w.createElement(M.Provider,{value:I},e))))}),R=w.forwardRef((e,t)=>{let r=a(),i=w.useRef(null),o=w.useContext(I),s=N(),l=q(e),u=l.current?.forceMount??o?.forceMount;J(()=>{if(!u)return s.item(r,o?.id)},[u]);let d=Z(r,i,[e.value,e.children,i],e.keywords),f=F(),p=X(e=>e.value&&e.value===d.current),m=X(e=>u||s.filter()===!1?!0:e.search?e.filtered.items.get(r)>0:!0);w.useEffect(()=>{let t=i.current;if(!(!t||e.disabled))return t.addEventListener(A,h),()=>t.removeEventListener(A,h)},[m,e.onSelect,e.disabled]);function h(){var e,t;g(),(t=(e=l.current).onSelect)==null||t.call(e,d.current)}function g(){f.setState(`value`,d.current,!0)}if(!m)return null;let{disabled:_,value:v,onSelect:y,forceMount:b,keywords:x,...S}=e;return w.createElement(c.div,{ref:n(i,t),...S,id:r,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!p,"data-disabled":!!_,"data-selected":!!p,onPointerMove:_||s.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),z=w.forwardRef((e,t)=>{let{heading:r,children:i,forceMount:o,...s}=e,l=a(),u=w.useRef(null),d=w.useRef(null),f=a(),p=N(),m=X(e=>o||p.filter()===!1?!0:e.search?e.filtered.groups.has(l):!0);J(()=>p.group(l),[]),Z(l,u,[e.value,e.heading,d]);let h=w.useMemo(()=>({id:l,forceMount:o}),[o]);return w.createElement(c.div,{ref:n(u,t),...s,"cmdk-group":``,role:`presentation`,hidden:m?void 0:!0},r&&w.createElement(`div`,{ref:d,"cmdk-group-heading":``,"aria-hidden":!0,id:f},r),$(e,e=>w.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":r?f:void 0},w.createElement(I.Provider,{value:h},e))))}),B=w.forwardRef((e,t)=>{let{alwaysRender:r,...i}=e,a=w.useRef(null),o=X(e=>!e.search);return!r&&!o?null:w.createElement(c.div,{ref:n(a,t),...i,"cmdk-separator":``,role:`separator`})}),V=w.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=F(),o=X(e=>e.search),s=X(e=>e.selectedItemId),l=N();return w.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),w.createElement(c.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":s,id:l.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),H=w.forwardRef((e,t)=>{let{children:r,label:i=`Suggestions`,...a}=e,o=w.useRef(null),s=w.useRef(null),l=X(e=>e.selectedItemId),u=N();return w.useEffect(()=>{if(s.current&&o.current){let e=s.current,t=o.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),w.createElement(c.div,{ref:n(o,t),...a,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":l,"aria-label":i,id:u.listId},$(e,e=>w.createElement(`div`,{ref:n(s,u.listInnerRef),"cmdk-list-sizer":``},e)))}),U=w.forwardRef((e,n)=>{let{open:a,onOpenChange:s,overlayClassName:c,contentClassName:l,container:u,...d}=e;return w.createElement(r,{open:a,onOpenChange:s},w.createElement(o,{container:u},w.createElement(t,{"cmdk-overlay":``,className:c}),w.createElement(i,{"aria-label":e.label,"cmdk-dialog":``,className:l},w.createElement(L,{ref:n,...d}))))}),W=w.forwardRef((e,t)=>X(e=>e.filtered.count===0)?w.createElement(c.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),G=w.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return w.createElement(c.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},$(e,e=>w.createElement(`div`,{"aria-hidden":!0},e)))}),K=Object.assign(L,{List:H,Item:R,Input:V,Group:z,Separator:B,Dialog:U,Empty:W,Loading:G});function te(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ne(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function q(e){let t=w.useRef(e);return J(()=>{t.current=e}),t}var J=typeof window>`u`?w.useEffect:w.useLayoutEffect;function Y(e){let t=w.useRef();return t.current===void 0&&(t.current=e()),t}function X(e){let t=F(),n=()=>e(t.snapshot());return w.useSyncExternalStore(t.subscribe,n,n)}function Z(e,t,n,r=[]){let i=w.useRef(),a=N();return J(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(j,s),i.current=s}),i}var re=()=>{let[e,t]=w.useState(),n=Y(()=>new Map);return J(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Q(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function $({asChild:e,children:t},n){return e&&w.isValidElement(t)?w.cloneElement(Q(t),{ref:t.ref},n(t.props.children)):n(t)}var ie={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};export{K as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{io as t}from"./dialogs-config-Ct6i8Iij.js";var n=e(t(),1),r=(e,t,n,r,i,a,o,s)=>{let c=document.documentElement,l=[`light`,`dark`];function u(t){(Array.isArray(e)?e:[e]).forEach(e=>{let n=e===`class`,r=n&&a?i.map(e=>a[e]||e):i;n?(c.classList.remove(...r),c.classList.add(a&&a[t]?a[t]:t)):c.setAttribute(e,t)}),d(t)}function d(e){s&&l.includes(e)&&(c.style.colorScheme=e)}function f(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}if(r)u(r);else try{let e=localStorage.getItem(t)||n;u(o&&e===`system`?f():e)}catch{}},i=[`light`,`dark`],a=`(prefers-color-scheme: dark)`,o=typeof window>`u`,s=n.createContext(void 0),c={setTheme:e=>{},themes:[]},l=()=>n.useContext(s)??c,u=e=>n.useContext(s)?n.createElement(n.Fragment,null,e.children):n.createElement(f,{...e}),d=[`light`,`dark`],f=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:r=!0,enableColorScheme:o=!0,storageKey:c=`theme`,themes:l=d,defaultTheme:u=r?`system`:`light`,attribute:f=`data-theme`,value:_,children:v,nonce:y,scriptProps:b})=>{let[x,S]=n.useState(()=>m(c,u)),[C,w]=n.useState(()=>x===`system`?g():x),T=_?Object.values(_):l,E=n.useCallback(e=>{let n=e;if(!n)return;e===`system`&&r&&(n=g());let a=_?_[n]:n,s=t?h(y):null,c=document.documentElement,l=e=>{e===`class`?(c.classList.remove(...T),a&&c.classList.add(a)):e.startsWith(`data-`)&&(a?c.setAttribute(e,a):c.removeAttribute(e))};if(Array.isArray(f)?f.forEach(l):l(f),o){let e=i.includes(u)?u:null,t=i.includes(n)?n:e;c.style.colorScheme=t}s?.()},[y]),D=n.useCallback(e=>{let t=typeof e==`function`?e(x):e;S(t);try{localStorage.setItem(c,t)}catch{}},[x]),O=n.useCallback(t=>{w(g(t)),x===`system`&&r&&!e&&E(`system`)},[x,e]);n.useEffect(()=>{let e=window.matchMedia(a);return e.addListener(O),O(e),()=>e.removeListener(O)},[O]),n.useEffect(()=>{let e=e=>{e.key===c&&(e.newValue?S(e.newValue):D(u))};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[D]),n.useEffect(()=>{E(e??x)},[e,x]);let k=n.useMemo(()=>({theme:x,setTheme:D,forcedTheme:e,resolvedTheme:x===`system`?C:x,themes:r?[...l,`system`]:l,systemTheme:r?C:void 0}),[x,D,e,C,r,l]);return n.createElement(s.Provider,{value:k},n.createElement(p,{forcedTheme:e,storageKey:c,attribute:f,enableSystem:r,enableColorScheme:o,defaultTheme:u,value:_,themes:l,nonce:y,scriptProps:b}),v)},p=n.memo(({forcedTheme:e,storageKey:t,attribute:i,enableSystem:a,enableColorScheme:o,defaultTheme:s,value:c,themes:l,nonce:u,scriptProps:d})=>{let f=JSON.stringify([i,t,s,e,l,c,a,o]).slice(1,-1);return n.createElement(`script`,{...d,suppressHydrationWarning:!0,nonce:typeof window>`u`?u:``,dangerouslySetInnerHTML:{__html:`(${r.toString()})(${f})`}})}),m=(e,t)=>{if(o)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||t},h=e=>{let t=document.createElement(`style`);return e&&t.setAttribute(`nonce`,e),t.appendChild(document.createTextNode(`*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`)),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},g=e=>(e||=window.matchMedia(a),e.matches?`dark`:`light`);export{l as n,u as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{mo as t}from"./dialogs-config-B4TDFSrS.js";var n=e(t(),1),r=(e,t,n,r,i,a,o,s)=>{let c=document.documentElement,l=[`light`,`dark`];function u(t){(Array.isArray(e)?e:[e]).forEach(e=>{let n=e===`class`,r=n&&a?i.map(e=>a[e]||e):i;n?(c.classList.remove(...r),c.classList.add(a&&a[t]?a[t]:t)):c.setAttribute(e,t)}),d(t)}function d(e){s&&l.includes(e)&&(c.style.colorScheme=e)}function f(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}if(r)u(r);else try{let e=localStorage.getItem(t)||n;u(o&&e===`system`?f():e)}catch{}},i=[`light`,`dark`],a=`(prefers-color-scheme: dark)`,o=typeof window>`u`,s=n.createContext(void 0),c={setTheme:e=>{},themes:[]},l=()=>n.useContext(s)??c,u=e=>n.useContext(s)?n.createElement(n.Fragment,null,e.children):n.createElement(f,{...e}),d=[`light`,`dark`],f=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:r=!0,enableColorScheme:o=!0,storageKey:c=`theme`,themes:l=d,defaultTheme:u=r?`system`:`light`,attribute:f=`data-theme`,value:_,children:v,nonce:y,scriptProps:b})=>{let[x,S]=n.useState(()=>m(c,u)),[C,w]=n.useState(()=>x===`system`?g():x),T=_?Object.values(_):l,E=n.useCallback(e=>{let n=e;if(!n)return;e===`system`&&r&&(n=g());let a=_?_[n]:n,s=t?h(y):null,c=document.documentElement,l=e=>{e===`class`?(c.classList.remove(...T),a&&c.classList.add(a)):e.startsWith(`data-`)&&(a?c.setAttribute(e,a):c.removeAttribute(e))};if(Array.isArray(f)?f.forEach(l):l(f),o){let e=i.includes(u)?u:null,t=i.includes(n)?n:e;c.style.colorScheme=t}s?.()},[y]),D=n.useCallback(e=>{let t=typeof e==`function`?e(x):e;S(t);try{localStorage.setItem(c,t)}catch{}},[x]),O=n.useCallback(t=>{w(g(t)),x===`system`&&r&&!e&&E(`system`)},[x,e]);n.useEffect(()=>{let e=window.matchMedia(a);return e.addListener(O),O(e),()=>e.removeListener(O)},[O]),n.useEffect(()=>{let e=e=>{e.key===c&&(e.newValue?S(e.newValue):D(u))};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[D]),n.useEffect(()=>{E(e??x)},[e,x]);let k=n.useMemo(()=>({theme:x,setTheme:D,forcedTheme:e,resolvedTheme:x===`system`?C:x,themes:r?[...l,`system`]:l,systemTheme:r?C:void 0}),[x,D,e,C,r,l]);return n.createElement(s.Provider,{value:k},n.createElement(p,{forcedTheme:e,storageKey:c,attribute:f,enableSystem:r,enableColorScheme:o,defaultTheme:u,value:_,themes:l,nonce:y,scriptProps:b}),v)},p=n.memo(({forcedTheme:e,storageKey:t,attribute:i,enableSystem:a,enableColorScheme:o,defaultTheme:s,value:c,themes:l,nonce:u,scriptProps:d})=>{let f=JSON.stringify([i,t,s,e,l,c,a,o]).slice(1,-1);return n.createElement(`script`,{...d,suppressHydrationWarning:!0,nonce:typeof window>`u`?u:``,dangerouslySetInnerHTML:{__html:`(${r.toString()})(${f})`}})}),m=(e,t)=>{if(o)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||t},h=e=>{let t=document.createElement(`style`);return e&&t.setAttribute(`nonce`,e),t.appendChild(document.createTextNode(`*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`)),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},g=e=>(e||=window.matchMedia(a),e.matches?`dark`:`light`);export{l as n,u as t};
@@ -19,17 +19,17 @@
19
19
  <meta name="apple-mobile-web-app-title" content="Tarsk" />
20
20
 
21
21
  <title>Tarsk</title>
22
- <script type="module" crossorigin src="/assets/index-6DhhjIBL.js"></script>
22
+ <script type="module" crossorigin src="/assets/index-DOsSr4dl.js"></script>
23
23
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
24
24
  <link rel="modulepreload" crossorigin href="/assets/monaco-CZnIWXyV.js">
25
- <link rel="modulepreload" crossorigin href="/assets/dialogs-config-Ct6i8Iij.js">
26
- <link rel="modulepreload" crossorigin href="/assets/history-view-CFot099O.js">
27
- <link rel="modulepreload" crossorigin href="/assets/onboarding-DHCR18iU.js">
25
+ <link rel="modulepreload" crossorigin href="/assets/dialogs-config-B4TDFSrS.js">
26
+ <link rel="modulepreload" crossorigin href="/assets/history-view-Ds_0e_bx.js">
27
+ <link rel="modulepreload" crossorigin href="/assets/onboarding-DfL8a0LZ.js">
28
28
  <link rel="modulepreload" crossorigin href="/assets/whisper-wasm-Cq5Ofwpd.js">
29
- <link rel="modulepreload" crossorigin href="/assets/react-vendor-CjZZeCRj.js">
30
- <link rel="modulepreload" crossorigin href="/assets/utils-DDDR42pW.js">
29
+ <link rel="modulepreload" crossorigin href="/assets/react-vendor-unlDVFpU.js">
30
+ <link rel="modulepreload" crossorigin href="/assets/utils-umVhs9to.js">
31
31
  <link rel="stylesheet" crossorigin href="/assets/monaco-Br_kD0ds.css">
32
- <link rel="stylesheet" crossorigin href="/assets/index-sEZ3wJXu.css">
32
+ <link rel="stylesheet" crossorigin href="/assets/index-C0lTt0ZK.css">
33
33
  </head>
34
34
  <body class="font-sans antialiased">
35
35
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tarsk",
3
- "version": "0.5.34",
3
+ "version": "0.5.35",
4
4
  "description": "CLI for Tarsk - Project Threads Manager",
5
5
  "keywords": [
6
6
  "cli",
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Pa as t,Qr as n,Xr as r,dt as i,gi as a,io as o,li as s,ln as c,qa as l,sa as u}from"./dialogs-config-Ct6i8Iij.js";import{C as d,D as f,S as p,v as m}from"./history-view-CFot099O.js";import{T as h}from"./index-6DhhjIBL.js";import{t as g}from"./skeleton-pSKdmWyJ.js";var _=e(o(),1),v=a();function y(){let[e,a]=(0,_.useState)(null),[o,y]=(0,_.useState)(!0);(0,_.useEffect)(()=>{b();let e=()=>{document.visibilityState===`visible`&&b()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);async function b(){y(!0);try{a(await i())}catch(e){h({title:`Error`,description:e instanceof Error?e.message:`Failed to load account info`,variant:`destructive`})}finally{y(!1)}}function x(){c(`https://buy.stripe.com/14AcN6feK0Jjbheb2H3Nm03?client_reference_id=${e?.clientReferenceId??``}`)}function S(){c(`https://buy.stripe.com/9B67sMd6CgIh70Y0o33Nm04?client_reference_id=${e?.clientReferenceId??``}`)}if(o)return(0,v.jsx)(f,{children:(0,v.jsxs)(m,{children:[(0,v.jsxs)(`div`,{className:`mb-6`,children:[(0,v.jsx)(g,{className:`h-8 w-32 mb-2`}),(0,v.jsx)(g,{className:`h-4 w-64`})]}),(0,v.jsxs)(`div`,{className:`space-y-6`,children:[(0,v.jsxs)(`div`,{className:`flex gap-4`,children:[(0,v.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,v.jsx)(g,{className:`h-4 w-20`}),(0,v.jsx)(g,{className:`h-9 w-28`})]}),(0,v.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,v.jsx)(g,{className:`h-4 w-24`}),(0,v.jsx)(g,{className:`h-6 w-32`}),(0,v.jsx)(g,{className:`h-4 w-full`})]})]}),(0,v.jsxs)(`div`,{className:`space-y-3`,children:[(0,v.jsx)(g,{className:`h-4 w-24`}),(0,v.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,v.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,v.jsx)(g,{className:`h-5 w-28`}),(0,v.jsx)(g,{className:`h-4 w-64`})]}),(0,v.jsx)(g,{className:`h-9 w-28 shrink-0`})]}),(0,v.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,v.jsxs)(`div`,{className:`space-y-1 flex-1`,children:[(0,v.jsx)(g,{className:`h-5 w-36`}),(0,v.jsx)(g,{className:`h-4 w-56`}),(0,v.jsx)(g,{className:`h-4 w-32`})]}),(0,v.jsx)(g,{className:`h-9 w-24 shrink-0`})]})]})]})]})});let C=e?.plan===`unlimited-pro`;return(0,v.jsx)(f,{children:(0,v.jsxs)(m,{children:[(0,v.jsx)(p,{title:`Account`,description:`Manage your Tarsk plan and prompt balance.`}),(0,v.jsxs)(`div`,{className:`space-y-6`,children:[(0,v.jsxs)(`div`,{className:`flex gap-4`,children:[(0,v.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,v.jsxs)(`div`,{className:n(s.label,`flex items-center gap-2 text-muted-foreground`),children:[(0,v.jsx)(u,{className:`h-4 w-4`}),`Balance`]}),(0,v.jsx)(`div`,{className:`flex items-end gap-2`,children:C?(0,v.jsx)(`span`,{className:s.stat,children:`Unlimited`}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`span`,{className:s.stat,children:e?.promptsRemaining.toLocaleString()??0}),(0,v.jsx)(`span`,{className:`${s.caption} mb-1`,children:`prompts remaining`})]})})]}),(0,v.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,v.jsxs)(`div`,{className:n(s.label,`flex items-center gap-2 text-muted-foreground`),children:[(0,v.jsx)(t,{className:`h-4 w-4`}),`Current Plan`]}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(`span`,{className:s.label,children:C?`Unlimited Pro`:`Pay as you go`}),C&&(0,v.jsx)(`span`,{className:n(s.compact,`rounded-full bg-primary/10 px-2 py-0.5 font-medium text-primary`),children:`Active`})]}),(0,v.jsx)(`p`,{className:s.bodyMuted,children:C?`You have unlimited prompts with no restrictions.`:`Purchase prompts as needed. Upgrade to Pro for unlimited access.`})]})]}),!C&&(0,v.jsxs)(`div`,{className:`space-y-3`,children:[(0,v.jsx)(d,{title:`Add Prompts`,className:`mb-0`}),(0,v.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,v.jsxs)(`div`,{className:`space-y-1`,children:[(0,v.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,v.jsx)(`span`,{className:s.label,children:`1,000 Prompts`})}),(0,v.jsx)(`p`,{className:s.bodyMuted,children:`Top up your balance with 1,000 additional prompts for $5.`})]}),(0,v.jsx)(r,{onClick:x,className:`shrink-0`,children:`Top Up Balance`})]}),(0,v.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,v.jsxs)(`div`,{className:`space-y-1`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(t,{className:`h-4 w-4 text-primary`}),(0,v.jsx)(`span`,{className:s.label,children:`Unlimited Pro Plan`})]}),(0,v.jsx)(`p`,{className:s.bodyMuted,children:`Unlimited prompts for $100 and lifetime access to Tarsk.`}),(0,v.jsxs)(`ul`,{className:n(s.bodyMuted,`space-y-0.5`),children:[(0,v.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,v.jsx)(l,{className:`h-3 w-3 text-primary`}),`Unlimited prompts`]}),(0,v.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,v.jsx)(l,{className:`h-3 w-3 text-primary`}),`Priority access`]})]})]}),(0,v.jsx)(r,{onClick:S,className:`shrink-0`,children:`Purchase`})]})]})]})]})})}export{y as default};
@@ -1 +0,0 @@
1
- import{Gn as e,Jn as t,Kn as n,Wn as r,Xn as i,Yn as a,qn as o}from"./dialogs-config-Ct6i8Iij.js";async function s(t,r,i=!1){return n(`api/threads/${e(t)}/explorer?path=${encodeURIComponent(r)}&recursive=${i}`)}async function c(t,r){return n(`api/threads/${e(t)}/ai-file?path=${encodeURIComponent(r)}`)}async function l(t,n,r){return i(`api/threads/${e(t)}/ai-file`,{path:n,content:r})}async function u(t,n){return r(`api/threads/${e(t)}/explorer?path=${encodeURIComponent(n)}`)}async function d(n,r,i){return t(`api/threads/${e(n)}/explorer`,{path:r,newName:i})}async function f(t,n,r){return a(`api/threads/${e(t)}/explorer/file`,{dirPath:n,name:r})}function p(t,n){return`${o()}/api/threads/${e(t)}/explorer/media?path=${encodeURIComponent(n)}`}async function m(t,n,r){return a(`api/threads/${e(t)}/explorer/folder`,{dirPath:n,name:r})}export{p as a,l as c,c as i,m as n,s as o,u as r,d as s,f as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$n as t,Gi as n,Ii as r,Qn as i,Qr as a,Zn as o,er as s,gi as c,io as l,ja as u,ji as d,li as f,ln as p,mr as m,no as h,ra as g}from"./dialogs-config-Ct6i8Iij.js";import{A as _,S as v,a as y}from"./index-6DhhjIBL.js";var b=e(l(),1),x=h();function S(){return typeof window<`u`&&`__electrobunWebviewId`in window}var C=c();function w(e){let t=e.trim();return t?(!t.startsWith(`http://`)&&!t.startsWith(`https://`)&&(t=`http://${t}`),t):``}function T(e,t){let n=!1,r=0;function i(){if(!n){if(e.webviewId==null){r=requestAnimationFrame(i);return}t&&e.getAttribute(`src`)!==t&&e.loadURL(t),e.toggleHidden(!1),e.syncDimensions(!0)}}return r=requestAnimationFrame(i),function(){n=!0,cancelAnimationFrame(r)}}function E(e){let t=(0,x.c)(9),{onClick:n,label:r,children:a,isActive:c}=e,l=`p-1.5 rounded transition-colors ${c!==void 0&&c?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-background/50`}`,u;t[0]!==a||t[1]!==n||t[2]!==l?(u=(0,C.jsx)(s,{asChild:!0,children:(0,C.jsx)(`button`,{type:`button`,onClick:n,className:l,children:a})}),t[0]=a,t[1]=n,t[2]=l,t[3]=u):u=t[3];let d;t[4]===r?d=t[5]:(d=(0,C.jsx)(i,{children:r}),t[4]=r,t[5]=d);let f;return t[6]!==u||t[7]!==d?(f=(0,C.jsxs)(o,{children:[u,d]}),t[6]=u,t[7]=d,t[8]=f):f=t[8],f}function D(){let{activeMainTab:e,devServerUrl:i,browserResetTrigger:o}=v(),s=_(e=>e.selectedProjectId),c=_(e=>e.projects).find(e=>e.projectId===s),[l,h]=(0,b.useState)(``),[x,D]=(0,b.useState)(``),[O,k]=(0,b.useState)(``),[A,j]=(0,b.useState)(`desktop`),M=(0,b.useRef)(null),N=(0,b.useRef)(O),P=(0,b.useRef)(null),F=(0,b.useRef)(null),I=S(),L=e===`browser`;N.current=O,(0,b.useEffect)(()=>{D(``),k(``),h(``);let e=M.current;e&&(e.src=``),P.current&&(P.current.src=``)},[o]),(0,b.useEffect)(()=>{if(!i)return;let e=w(i);h(e),D(e),k(e)},[i]);let R=(0,b.useCallback)(e=>{M.current=e,e&&T(e,N.current)},[]);(0,b.useEffect)(()=>{let e=M.current;if(!(!I||!e||!O))return T(e,O)},[O,I,x]),(0,b.useEffect)(()=>{let e=M.current;!I||!e||(e.toggleHidden(!L),L&&requestAnimationFrame(()=>{e.syncDimensions(!0)}))},[L,I,x]),(0,b.useEffect)(()=>{let e=F.current,t=M.current;if(!I||!e||!t)return;let n=new IntersectionObserver(e=>{let n=e.some(e=>e.isIntersecting);t.toggleHidden(!n),n&&t.syncDimensions(!0)},{threshold:0});return n.observe(e),function(){n.disconnect()}},[I,x]),(0,b.useEffect)(()=>{let e=M.current;if(!I||!e)return;function t(e){let t=typeof e.detail==`string`?e.detail:x;t&&(D(t),k(``),h(t))}function n(e){let t=typeof e.detail==`string`?e.detail:x;t&&(D(t),h(t))}function r(e){let t=e.detail,n=typeof t==`string`?t:typeof t==`object`&&t&&`url`in t?String(t.url):``;n&&p(n)}return e.on(`did-navigate`,t),e.on(`did-navigate-in-page`,n),e.on(`new-window-open`,r),function(){e.off(`did-navigate`,t),e.off(`did-navigate-in-page`,n),e.off(`new-window-open`,r)}},[x,I]);function z(e){let t=w(e);t&&(h(t),D(t),k(t))}function B(e){e.key===`Enter`&&z(l)}function V(){if(I){let e=M.current;e&&e.reload();return}let e=P.current;if(!e)return;let t=e.src;e.src=``,requestAnimationFrame(()=>{e.src=t})}let H={desktop:{width:`100%`,height:`100%`},tablet:{width:`768px`,height:`1024px`},mobile:{width:`375px`,height:`667px`}}[A];function U(){return I?(0,b.createElement)(`electrobun-webview`,{ref:R,src:x,renderer:`native`,className:`block h-full w-full bg-background`}):(0,C.jsx)(`iframe`,{ref:P,src:x,className:`h-full w-full border-none`,title:`Browser`})}return(0,C.jsx)(t,{children:(0,C.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,C.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-border px-3 py-2`,children:[(0,C.jsx)(m,{type:`text`,value:l,onChange:e=>h(e.target.value),onKeyDown:B,placeholder:`Enter URL...`,className:a(`flex-1 rounded-full bg-muted font-mono`),spellCheck:!1}),x&&(0,C.jsx)(E,{onClick:V,label:`Refresh page`,children:(0,C.jsx)(n,{size:15})}),x&&(0,C.jsxs)(`div`,{className:`flex items-center rounded-md bg-muted p-0.5`,children:[(0,C.jsx)(E,{onClick:()=>j(`desktop`),label:`Desktop view`,isActive:A===`desktop`,children:(0,C.jsx)(g,{size:15})}),(0,C.jsx)(E,{onClick:()=>j(`tablet`),label:`Tablet view`,isActive:A===`tablet`,children:(0,C.jsx)(d,{size:15})}),(0,C.jsx)(E,{onClick:()=>j(`mobile`),label:`Mobile view`,isActive:A===`mobile`,children:(0,C.jsx)(r,{size:15})})]}),x&&(0,C.jsx)(E,{onClick:()=>void p(x),label:`Open in external browser`,children:(0,C.jsx)(u,{size:15})})]}),x?(0,C.jsx)(`div`,{ref:F,className:`flex min-h-0 flex-1 items-center justify-center bg-background`,children:(0,C.jsx)(`div`,{className:`overflow-hidden border border-border bg-background shadow-sm ${A===`desktop`?`h-full w-full rounded-none border-0 shadow-none`:`rounded-lg`}`,style:{width:H.width,height:H.height,maxWidth:`100%`,maxHeight:`100%`},children:U()})}):(0,C.jsx)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-6 text-muted-foreground`,children:s&&c?.runCommand?(0,C.jsx)(y,{projectId:s,runCommand:c.runCommand,large:!0}):(0,C.jsx)(`p`,{className:f.body,children:`Enter a URL to browse`})})]})})}export{D as BrowserTab};
@@ -1 +0,0 @@
1
- import{$n as e,Fi as ee,Qn as t,Xr as n,Zn as r,_r as i,br as a,er as o,fr as s,gi as c,gr as l,hr as u,la as d,li as f,no as p,vr as m,yr as te}from"./dialogs-config-Ct6i8Iij.js";import{n as ne}from"./onboarding-DHCR18iU.js";import{D as h}from"./index-6DhhjIBL.js";var g=p(),_=c();function v(c){let p=(0,g.c)(57),{open:v,onOpenChange:y,commitMessage:b,onCommitMessageChange:x,autoGenerateCommitMessage:S,onAutoGenerateChange:C,isGeneratingMessage:w,isLoading:T,onGenerateMessage:E,onCommit:D,currentBranch:O}=c,k;p[0]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,_.jsx)(a,{children:`Commit Changes`}),p[0]=k):k=p[0];let A;p[1]===O?A=p[2]:(A=(0,_.jsxs)(te,{children:[k,(0,_.jsxs)(i,{children:[`Enter a commit message for your changes on branch `,O]})]}),p[1]=O,p[2]=A);let j;p[3]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,_.jsx)(s,{htmlFor:`commit-message`,children:`Commit Message`}),p[3]=j):j=p[3];let M;p[4]===x?M=p[5]:(M=e=>x(e.target.value),p[4]=x,p[5]=M);let N;p[6]!==b||p[7]!==M?(N=(0,_.jsx)(h,{id:`commit-message`,placeholder:`Enter commit message...`,value:b,onChange:M,rows:4,className:`pr-10`}),p[6]=b,p[7]=M,p[8]=N):N=p[8];let P=w||T,F;p[9]===w?F=p[10]:(F=w?(0,_.jsx)(d,{className:`h-3.5 w-3.5 animate-spin`}):(0,_.jsx)(ee,{className:`h-3.5 w-3.5`}),p[9]=w,p[10]=F);let I;p[11]!==E||p[12]!==P||p[13]!==F?(I=(0,_.jsx)(o,{asChild:!0,children:(0,_.jsx)(n,{type:`button`,variant:`ghost`,size:`icon`,className:`absolute top-2 right-2 h-6 w-6`,onClick:E,disabled:P,children:F})}),p[11]=E,p[12]=P,p[13]=F,p[14]=I):I=p[14];let L=w?`Generating commit message...`:`Generate commit message with AI`,R;p[15]===L?R=p[16]:(R=(0,_.jsx)(t,{children:L}),p[15]=L,p[16]=R);let z;p[17]!==R||p[18]!==I?(z=(0,_.jsx)(e,{children:(0,_.jsxs)(r,{children:[I,R]})}),p[17]=R,p[18]=I,p[19]=z):z=p[19];let B;p[20]!==z||p[21]!==N?(B=(0,_.jsxs)(`div`,{className:`grid gap-2`,children:[j,(0,_.jsxs)(`div`,{className:`relative`,children:[N,z]})]}),p[20]=z,p[21]=N,p[22]=B):B=p[22];let V;p[23]===C?V=p[24]:(V=e=>C(e===!0),p[23]=C,p[24]=V);let H;p[25]!==S||p[26]!==V?(H=(0,_.jsx)(ne,{id:`auto-generate`,checked:S,onCheckedChange:V}),p[25]=S,p[26]=V,p[27]=H):H=p[27];let U;p[28]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,_.jsx)(s,{htmlFor:`auto-generate`,className:f.labelNormal,children:`Auto generate commit messages`}),p[28]=U):U=p[28];let W;p[29]===H?W=p[30]:(W=(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[H,U]}),p[29]=H,p[30]=W);let G;p[31]!==B||p[32]!==W?(G=(0,_.jsxs)(`div`,{className:`grid gap-4 py-4`,children:[B,W]}),p[31]=B,p[32]=W,p[33]=G):G=p[33];let K;p[34]===y?K=p[35]:(K=()=>y(!1),p[34]=y,p[35]=K);let q;p[36]!==T||p[37]!==K?(q=(0,_.jsx)(n,{variant:`outline`,onClick:K,disabled:T,children:`Cancel`}),p[36]=T,p[37]=K,p[38]=q):q=p[38];let J;p[39]!==b||p[40]!==T?(J=T||!b.trim(),p[39]=b,p[40]=T,p[41]=J):J=p[41];let Y=T?`Committing...`:`Commit`,X;p[42]!==D||p[43]!==J||p[44]!==Y?(X=(0,_.jsx)(n,{onClick:D,disabled:J,children:Y}),p[42]=D,p[43]=J,p[44]=Y,p[45]=X):X=p[45];let Z;p[46]!==q||p[47]!==X?(Z=(0,_.jsxs)(m,{children:[q,X]}),p[46]=q,p[47]=X,p[48]=Z):Z=p[48];let Q;p[49]!==G||p[50]!==A||p[51]!==Z?(Q=(0,_.jsxs)(l,{children:[A,G,Z]}),p[49]=G,p[50]=A,p[51]=Z,p[52]=Q):Q=p[52];let $;return p[53]!==y||p[54]!==v||p[55]!==Q?($=(0,_.jsx)(u,{open:v,onOpenChange:y,children:Q}),p[53]=y,p[54]=v,p[55]=Q,p[56]=$):$=p[56],$}export{v as CommitDialog};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Qr as t,Wa as n,gi as r,io as i,li as a,no as o,qa as s,za as c}from"./dialogs-config-Ct6i8Iij.js";import{_ as l,b as u,d,f,g as p,h as m,m as h,p as g,u as _,v,x as y,y as b}from"./react-vendor-CjZZeCRj.js";var x=o(),S=e(i(),1),C=r(),w=l,T=y,E=S.forwardRef((e,r)=>{let i=(0,x.c)(14),o,s,c,l;i[0]===e?(o=i[1],s=i[2],c=i[3],l=i[4]):({className:s,inset:c,children:o,...l}=e,i[0]=e,i[1]=o,i[2]=s,i[3]=c,i[4]=l);let d;i[5]!==s||i[6]!==c?(d=t(t(a.body,`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground`),c&&`pl-8`,s),i[5]=s,i[6]=c,i[7]=d):d=i[7];let f;i[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,C.jsx)(n,{className:`ml-auto h-4 w-4`}),i[8]=f):f=i[8];let p;return i[9]!==o||i[10]!==l||i[11]!==r||i[12]!==d?(p=(0,C.jsxs)(u,{ref:r,className:d,...l,children:[o,f]}),i[9]=o,i[10]=l,i[11]=r,i[12]=d,i[13]=p):p=i[13],p});E.displayName=u.displayName;var D=S.forwardRef((e,n)=>{let r=(0,x.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(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==n||r[7]!==o?(s=(0,C.jsx)(b,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});D.displayName=b.displayName;var O=S.forwardRef((e,n)=>{let r=(0,x.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(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==n||r[7]!==o?(s=(0,C.jsx)(m,{children:(0,C.jsx)(d,{ref:n,className:o,...a})}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});O.displayName=d.displayName;var k=S.forwardRef((e,n)=>{let r=(0,x.c)(11),i,o,s;r[0]===e?(i=r[1],o=r[2],s=r[3]):({className:i,inset:o,...s}=e,r[0]=e,r[1]=i,r[2]=o,r[3]=s);let c;r[4]!==i||r[5]!==o?(c=t(t(a.body,`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`),o&&`pl-8`,i),r[4]=i,r[5]=o,r[6]=c):c=r[6];let l;return r[7]!==s||r[8]!==n||r[9]!==c?(l=(0,C.jsx)(f,{ref:n,className:c,...s}),r[7]=s,r[8]=n,r[9]=c,r[10]=l):l=r[10],l});k.displayName=f.displayName;var A=S.forwardRef((e,n)=>{let r=(0,x.c)(14),i,o,c,l;r[0]===e?(i=r[1],o=r[2],c=r[3],l=r[4]):({className:c,children:o,checked:i,...l}=e,r[0]=e,r[1]=i,r[2]=o,r[3]=c,r[4]=l);let u;r[5]===c?u=r[6]:(u=t(t(a.body,`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`),c),r[5]=c,r[6]=u);let d;r[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,C.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,C.jsx)(g,{children:(0,C.jsx)(s,{className:`h-4 w-4`})})}),r[7]=d):d=r[7];let f;return r[8]!==i||r[9]!==o||r[10]!==l||r[11]!==n||r[12]!==u?(f=(0,C.jsxs)(_,{ref:n,className:u,checked:i,...l,children:[d,o]}),r[8]=i,r[9]=o,r[10]=l,r[11]=n,r[12]=u,r[13]=f):f=r[13],f});A.displayName=_.displayName;var j=S.forwardRef((e,n)=>{let r=(0,x.c)(12),i,o,s;r[0]===e?(i=r[1],o=r[2],s=r[3]):({className:o,children:i,...s}=e,r[0]=e,r[1]=i,r[2]=o,r[3]=s);let l;r[4]===o?l=r[5]:(l=t(t(a.body,`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`),o),r[4]=o,r[5]=l);let u;r[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,C.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,C.jsx)(g,{children:(0,C.jsx)(c,{className:`h-2 w-2 fill-current`})})}),r[6]=u):u=r[6];let d;return r[7]!==i||r[8]!==s||r[9]!==n||r[10]!==l?(d=(0,C.jsxs)(p,{ref:n,className:l,...s,children:[u,i]}),r[7]=i,r[8]=s,r[9]=n,r[10]=l,r[11]=d):d=r[11],d});j.displayName=p.displayName;var M=S.forwardRef((e,n)=>{let r=(0,x.c)(11),i,o,s;r[0]===e?(i=r[1],o=r[2],s=r[3]):({className:i,inset:o,...s}=e,r[0]=e,r[1]=i,r[2]=o,r[3]=s);let c;r[4]!==i||r[5]!==o?(c=t(t(a.body,`px-2 py-1.5 font-semibold text-foreground`),o&&`pl-8`,i),r[4]=i,r[5]=o,r[6]=c):c=r[6];let l;return r[7]!==s||r[8]!==n||r[9]!==c?(l=(0,C.jsx)(h,{ref:n,className:c,...s}),r[7]=s,r[8]=n,r[9]=c,r[10]=l):l=r[10],l});M.displayName=h.displayName;var N=S.forwardRef((e,n)=>{let r=(0,x.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(`-mx-1 my-1 h-px bg-border`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==n||r[7]!==o?(s=(0,C.jsx)(v,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});N.displayName=v.displayName;var P=e=>{let n=(0,x.c)(8),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 o;n[3]===r?o=n[4]:(o=t(a.compact,`ml-auto tracking-widest text-muted-foreground`,r),n[3]=r,n[4]=o);let s;return n[5]!==i||n[6]!==o?(s=(0,C.jsx)(`span`,{className:o,...i}),n[5]=i,n[6]=o,n[7]=s):s=n[7],s};P.displayName=`ContextMenuShortcut`;export{T as a,N as i,O as n,k as r,w as t};
@@ -1 +0,0 @@
1
- import{Xr as e,_r as t,br as n,fr as r,gi as i,gr as a,hr as o,li as s,mr as c,no as l,vr as u,yr as d}from"./dialogs-config-Ct6i8Iij.js";import{n as f}from"./onboarding-DHCR18iU.js";import{D as p}from"./index-6DhhjIBL.js";var m=l(),h=i();function g(i){let l=(0,m.c)(48),{open:g,onOpenChange:_,repoName:v,onRepoNameChange:y,repoDescription:b,onRepoDescriptionChange:x,isPrivateRepo:S,onPrivateRepoChange:C,isLoading:w,onCreateRepo:T}=i,E;l[0]!==_||l[1]!==x||l[2]!==y?(E=e=>{e||(y(``),x(``)),_(e)},l[0]=_,l[1]=x,l[2]=y,l[3]=E):E=l[3];let D;l[4]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,h.jsxs)(d,{children:[(0,h.jsx)(n,{children:`Create GitHub Repository`}),(0,h.jsx)(t,{children:`Create a new GitHub repository and push your local repository`})]}),l[4]=D):D=l[4];let O;l[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,h.jsx)(r,{htmlFor:`repo-name`,children:`Repository Name (optional)`}),l[5]=O):O=l[5];let k;l[6]===y?k=l[7]:(k=e=>y(e.target.value),l[6]=y,l[7]=k);let A;l[8]!==v||l[9]!==k?(A=(0,h.jsxs)(`div`,{className:`grid gap-2`,children:[O,(0,h.jsx)(c,{id:`repo-name`,placeholder:`Leave empty to use current folder name`,value:v,onChange:k})]}),l[8]=v,l[9]=k,l[10]=A):A=l[10];let j;l[11]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,h.jsx)(r,{htmlFor:`repo-description`,children:`Description (optional)`}),l[11]=j):j=l[11];let M;l[12]===x?M=l[13]:(M=e=>x(e.target.value),l[12]=x,l[13]=M);let N;l[14]!==b||l[15]!==M?(N=(0,h.jsxs)(`div`,{className:`grid gap-2`,children:[j,(0,h.jsx)(p,{id:`repo-description`,placeholder:`Enter repository description...`,value:b,onChange:M,rows:3})]}),l[14]=b,l[15]=M,l[16]=N):N=l[16];let P;l[17]===C?P=l[18]:(P=e=>C(e===!0),l[17]=C,l[18]=P);let F;l[19]!==S||l[20]!==P?(F=(0,h.jsx)(f,{id:`repo-private`,checked:S,onCheckedChange:P}),l[19]=S,l[20]=P,l[21]=F):F=l[21];let I;l[22]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,h.jsx)(r,{htmlFor:`repo-private`,className:s.labelNormal,children:`Private repository`}),l[22]=I):I=l[22];let L;l[23]===F?L=l[24]:(L=(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[F,I]}),l[23]=F,l[24]=L);let R;l[25]!==L||l[26]!==A||l[27]!==N?(R=(0,h.jsxs)(`div`,{className:`grid gap-4 py-4`,children:[A,N,L]}),l[25]=L,l[26]=A,l[27]=N,l[28]=R):R=l[28];let z;l[29]===_?z=l[30]:(z=()=>_(!1),l[29]=_,l[30]=z);let B;l[31]!==w||l[32]!==z?(B=(0,h.jsx)(e,{variant:`outline`,onClick:z,disabled:w,children:`Cancel`}),l[31]=w,l[32]=z,l[33]=B):B=l[33];let V=w?`Creating...`:`Create & Push`,H;l[34]!==w||l[35]!==T||l[36]!==V?(H=(0,h.jsx)(e,{onClick:T,disabled:w,children:V}),l[34]=w,l[35]=T,l[36]=V,l[37]=H):H=l[37];let U;l[38]!==B||l[39]!==H?(U=(0,h.jsxs)(u,{children:[B,H]}),l[38]=B,l[39]=H,l[40]=U):U=l[40];let W;l[41]!==R||l[42]!==U?(W=(0,h.jsxs)(a,{children:[D,R,U]}),l[41]=R,l[42]=U,l[43]=W):W=l[43];let G;return l[44]!==g||l[45]!==E||l[46]!==W?(G=(0,h.jsx)(o,{open:g,onOpenChange:E,children:W}),l[44]=g,l[45]=E,l[46]=W,l[47]=G):G=l[47],G}export{g as CreateRepoDialog};
@@ -1,3 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$i as t,Ca as n,Ea as r,Ga as i,Hn as a,Ki as o,Qn as s,Qr as c,Wa as l,Wt as u,Xr as d,Zn as f,aa as p,br as m,bt as h,ca as g,ea as _,er as v,gi as y,gr as b,hr as x,in as S,io as C,li as w,lr as T,mt as E,no as D,sa as O,st as k,vr as A,wa as j,xi as ee,yr as te}from"./dialogs-config-Ct6i8Iij.js";import{C as M}from"./react-vendor-CjZZeCRj.js";import{t as N}from"./monaco-CZnIWXyV.js";import{u as P}from"./onboarding-DHCR18iU.js";import{a as F,l as ne,n as I,o as re}from"./history-view-CFot099O.js";import{n as ie}from"./utils-DDDR42pW.js";import{A as ae,D as oe,E as se,O as ce,d as le,i as ue,k as de,n as L,o as fe,r as pe}from"./index-6DhhjIBL.js";import{a as R,n as z,r as B,t as me}from"./context-menu-S8y0c1Fx.js";var V=e(C(),1),H=D(),U=y();function W(e){let t=(0,H.c)(17),{children:n,title:r,headerAction:i,footer:a}=e,o;t[0]===r?o=t[1]:(o=r&&(0,U.jsx)(`span`,{className:w.sectionTitle,children:r}),t[0]=r,t[1]=o);let s;t[2]===o?s=t[3]:(s=(0,U.jsx)(`div`,{className:`flex items-center gap-2`,children:o}),t[2]=o,t[3]=s);let c;t[4]===i?c=t[5]:(c=i&&(0,U.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,U.jsxs)(`div`,{className:`flex items-center justify-between border-b border-sidebar-border px-4 py-6`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===n?u=t[10]:(u=(0,U.jsx)(T,{className:`flex-1`,children:n}),t[9]=n,t[10]=u);let d;t[11]===a?d=t[12]:(d=a&&(0,U.jsx)(`div`,{className:`border-t border-sidebar-border`,children:a}),t[11]=a,t[12]=d);let f;return t[13]!==l||t[14]!==u||t[15]!==d?(f=(0,U.jsxs)(`div`,{className:`flex flex-col h-full`,children:[l,u,d]}),t[13]=l,t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function he(e){let t=[],n={};return e.forEach((e,r)=>{let i=e.path.split(`/`),a=t,o=``;for(let e=0;e<i.length-1;e++){if(o=o?`${o}/${i[e]}`:i[e],!n[o]){let t={id:`dir:${o}`,name:i[e],children:[]};n[o]=t,a.push(t)}a=n[o].children}a.push({id:`file:${e.path}`,name:i[i.length-1],fileIndex:r,status:e.status})}),t}var G={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},K={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function q(e){return c(c(w.compact,`status-badge font-mono font-semibold`),G[e]??`text-orange-500`)}function J(e){return K[e]??`M`}function ge(e){let t=(0,H.c)(38),{treeData:i,files:a,error:s,selectedFileIndex:u,onFileSelect:d,onRevertFile:f}=e,p;t[0]===a?p=t[1]:(p=a.reduce(ye,0),t[0]=a,t[1]=p);let m=p,h;t[2]===a?h=t[3]:(h=a.reduce(_e,0),t[2]=a,t[3]=h);let g=h,_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=c(w.compact,`text-muted-foreground`),t[4]=_):_=t[4];let v=a.length===1?``:`s`,y;t[5]!==a.length||t[6]!==v?(y=(0,U.jsxs)(`span`,{className:_,children:[a.length,` file`,v]}),t[5]=a.length,t[6]=v,t[7]=y):y=t[7];let b;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=c(w.compact,`text-green-500`),t[8]=b):b=t[8];let x;t[9]===m?x=t[10]:(x=(0,U.jsxs)(`span`,{className:b,children:[`+`,m]}),t[9]=m,t[10]=x);let S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=c(w.compact,`text-red-500`),t[11]=S):S=t[11];let C;t[12]===g?C=t[13]:(C=(0,U.jsxs)(`span`,{className:S,children:[`-`,g]}),t[12]=g,t[13]=C);let T;t[14]!==y||t[15]!==x||t[16]!==C?(T=(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[y,x,C]}),t[14]=y,t[15]=x,t[16]=C,t[17]=T):T=t[17];let E=T;if(s){let e;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=c(w.compact,`text-destructive text-center`),t[18]=e):e=t[18];let n;t[19]===s?n=t[20]:(n=(0,U.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,U.jsx)(`p`,{className:e,children:s})}),t[19]=s,t[20]=n);let r;return t[21]!==E||t[22]!==n?(r=(0,U.jsx)(W,{title:`Review Changes`,headerAction:E,children:n}),t[21]=E,t[22]=n,t[23]=r):r=t[23],r}if(a.length===0){let e;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,U.jsx)(`p`,{className:c(w.compact,w.bodyMuted,`text-center`),children:`No changes to review`})}),t[24]=e):e=t[24];let n;return t[25]===E?n=t[26]:(n=(0,U.jsx)(W,{title:`Review Changes`,headerAction:E,children:e}),t[25]=E,t[26]=n),n}let D;t[27]!==a||t[28]!==d||t[29]!==f||t[30]!==u?(D=(e,t)=>{let{isOpen:i,toggle:s}=t,p=!!e.children,m=(0,U.jsxs)(P,{onClick:()=>{p?s():e.fileIndex!==void 0&&d(e.fileIndex)},selected:!p&&e.fileIndex===u,className:`gap-1.5`,children:[p?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(l,{className:c(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,i&&`rotate-90`)}),i?(0,U.jsx)(j,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,U.jsx)(n,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,U.jsx)(r,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:e.name}),!p&&e.status&&(0,U.jsx)(`span`,{className:q(e.status),children:J(e.status)})]});return p?m:(0,U.jsxs)(me,{children:[(0,U.jsx)(R,{asChild:!0,children:m}),(0,U.jsx)(z,{children:(0,U.jsxs)(B,{onClick:()=>{e.fileIndex!==void 0&&f?.(a[e.fileIndex])},children:[(0,U.jsx)(o,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},t[27]=a,t[28]=d,t[29]=f,t[30]=u,t[31]=D):D=t[31];let O;t[32]!==D||t[33]!==i?(O=(0,U.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3 pb-2 px-1`,children:(0,U.jsx)(se,{nodes:i,defaultOpen:!0,resetKey:i,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:D})}),t[32]=D,t[33]=i,t[34]=O):O=t[34];let k;return t[35]!==E||t[36]!==O?(k=(0,U.jsx)(W,{title:`Review Changes`,headerAction:E,children:O}),t[35]=E,t[36]=O,t[37]=k):k=t[37],k}function _e(e,t){return e+t.hunks.reduce(ve,0)}function ve(e,t){return e+t.changes.filter(Y).length}function Y(e){return e.type===`delete`}function ye(e,t){return e+t.hunks.reduce(be,0)}function be(e,t){return e+t.changes.filter(xe).length}function xe(e){return e.type===`add`}function Se(e){let t=(0,H.c)(2),{isOpen:n}=e,r=n===void 0||n?`ml-[-40px]`:``,i;return t[0]===r?i=t[1]:(i=(0,U.jsx)(L,{withHandle:!0,className:r}),t[0]=r,t[1]=i),i}function Ce(e){let t=(0,H.c)(36),{open:n,lineNumber:r,lineContent:i,initialComment:a,isEditing:o,onSave:s,onDelete:l,onClose:u}=e,[f,p]=(0,V.useState)((a===void 0?``:a)??``),h;t[0]!==s||t[1]!==f?(h=()=>{f.trim()&&s(f.trim())},t[0]=s,t[1]=f,t[2]=h):h=t[2];let g=h,_;t[3]===g?_=t[4]:(_=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),g())},t[3]=g,t[4]=_);let v=_,y;t[5]===u?y=t[6]:(y=e=>{e||u()},t[5]=u,t[6]=y);let S;t[7]===r?S=t[8]:(S=(0,U.jsx)(te,{children:(0,U.jsxs)(m,{children:[`Comment on line `,r]})}),t[7]=r,t[8]=S);let C;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(C=c(w.compact,`font-mono rounded bg-muted px-3 py-2 text-muted-foreground overflow-x-auto whitespace-pre`),t[9]=C):C=t[9];let T=i||` `,E;t[10]===T?E=t[11]:(E=(0,U.jsx)(`div`,{className:C,children:T}),t[10]=T,t[11]=E);let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>p(e.target.value),t[12]=D):D=t[12];let O;t[13]!==v||t[14]!==f?(O=(0,U.jsx)(oe,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:f,onChange:D,onKeyDown:v,rows:12,className:`resize-none text-base`}),t[13]=v,t[14]=f,t[15]=O):O=t[15];let k;t[16]!==o||t[17]!==l?(k=o&&l&&(0,U.jsx)(d,{variant:`destructive`,size:`sm`,onClick:l,className:`mr-auto`,children:`Delete`}),t[16]=o,t[17]=l,t[18]=k):k=t[18];let j;t[19]===f?j=t[20]:(j=f.trim(),t[19]=f,t[20]=j);let ee=!j,M;t[21]!==g||t[22]!==ee?(M=(0,U.jsx)(d,{size:`sm`,onClick:g,disabled:ee,children:`Save`}),t[21]=g,t[22]=ee,t[23]=M):M=t[23];let N;t[24]!==k||t[25]!==M?(N=(0,U.jsxs)(A,{className:`gap-2 sm:gap-0`,children:[k,M]}),t[24]=k,t[25]=M,t[26]=N):N=t[26];let P;t[27]!==O||t[28]!==N||t[29]!==S||t[30]!==E?(P=(0,U.jsxs)(b,{className:`max-w-2xl`,children:[S,E,O,N]}),t[27]=O,t[28]=N,t[29]=S,t[30]=E,t[31]=P):P=t[31];let F;return t[32]!==n||t[33]!==P||t[34]!==y?(F=(0,U.jsx)(x,{open:n,onOpenChange:y,children:P}),t[32]=n,t[33]=P,t[34]=y,t[35]=F):F=t[35],F}function we(e,t){return`git-diff:${e}:${t}`}function Te({threadId:e,onExit:n,loadVersion:r}){let o=F(we(e,r),()=>h(e)),m=de(),y=ae(e=>e.diffComments),b=ae(e=>e.projectModelSelections),{resolvedTheme:x}=ie(),[C,T]=(0,V.useState)(o.files||[]),[D,A]=(0,V.useState)(null),[j,te]=(0,V.useState)(0),[P,ne]=(0,V.useState)(!1),[I,re]=(0,V.useState)(!1),[oe,se]=(0,V.useState)(!1),L=(0,V.useRef)(null),R=(0,V.useMemo)(()=>y[e]??[],[y,e]),z=(0,V.useCallback)(t=>{let n=y[e]??[],r=typeof t==`function`?t(n):t;m({type:ce.SetDiffComments,threadId:e,comments:r})},[m,e,y]),[B,me]=(0,V.useState)(null),[H,W]=(0,V.useState)(null),[G,K]=(0,V.useState)(null),q=(0,V.useRef)(null),J=(0,V.useRef)(R),_e=(0,V.useRef)(B),ve=(0,V.useRef)({isFullView:P,selectedFileIndex:j,files:C}),Y=(0,V.useRef)({original:[],modified:[]}),ye=(0,V.useRef)(!0);(0,V.useEffect)(()=>{J.current=R},[R]),(0,V.useEffect)(()=>{_e.current=B},[B]),(0,V.useEffect)(()=>{ve.current={isFullView:P,selectedFileIndex:j,files:C}},[P,j,C]);let be=(0,V.useCallback)(()=>{L.current&&(I?L.current.expand():L.current.collapse())},[I]),xe=(0,V.useCallback)(async()=>{if(e){A(null);try{T((await h(e)).files||[]),te(0)}catch(e){A(e instanceof Error?e.message:`Failed to load diff`)}}},[e]),Te=(0,V.useCallback)(async t=>{try{await S(e,t.path),await xe()}catch(e){A(e instanceof Error?e.message:`Failed to revert file`)}},[e,xe]),X=(0,V.useRef)(!1);(0,V.useEffect)(()=>{if((y[e]??[]).length>0){X.current=!0;return}u(e).then(t=>{t.diffComments&&t.diffComments.length>0&&m({type:ce.SetDiffComments,threadId:e,comments:t.diffComments}),X.current=!0}).catch(()=>{X.current=!0})},[e]),(0,V.useEffect)(()=>{X.current&&a(e,{diffComments:R}).catch(()=>{})},[e,R]);let Ee=(0,V.useMemo)(()=>he(C),[C]),Z=e=>{if(e.hunks.length===0)return null;let t=1/0,n=0;return e.hunks.forEach(e=>{let r=Math.min(e.oldStart,e.newStart),i=e.oldStart+e.oldLines,a=e.newStart+e.newLines,o=Math.max(i,a);t=Math.min(t,r),n=Math.max(n,o)}),t===1/0?null:{startLine:Math.max(1,t-2),endLine:n+2}},De=(e,t,n)=>e.split(`
2
- `).slice(t-1,n).join(`
3
- `),Oe=e=>{let t=Z(e);return t?t.startLine<=1:!0},ke=e=>({ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`})[e.split(`.`).pop()??``]||`plaintext`,Q=C[j],Ae=Q?P?Q.oldContent:(()=>{let e=Z(Q);return e?De(Q.oldContent,e.startLine,e.endLine):Q.oldContent})():``,je=Q?P?Q.newContent:(()=>{let e=Z(Q);return e?De(Q.newContent,e.startLine,e.endLine):Q.newContent})():``,$=(0,V.useCallback)(()=>{if(!ye.current)return;let e=q.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=ve.current,i=J.current,a=_e.current,o=r[n];if(!o)return;let s=(e,r)=>{let s=t?null:Z(o),c=i.filter(e=>e.fileIndex===n&&e.side===r),l=new Set(c.map(e=>s?e.lineNumber-s.startLine+1:e.lineNumber)),u=e.getModel()?.getLineCount()??0,d=[];for(let e=1;e<=u;e++)l.has(e)||d.push({range:{startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1},options:{isWholeLine:!0,glyphMarginClassName:`diff-gutter-add-comment`,glyphMarginHoverMessage:{value:`$(add) Click to add a comment`},stickiness:N.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}});let f=c.map(e=>{let t=s?e.lineNumber-s.startLine+1:e.lineNumber;if(t<1)return null;let n=i.indexOf(e)===a;return{range:{startLineNumber:t,startColumn:1,endLineNumber:t,endColumn:1},options:{isWholeLine:!0,className:n?`diff-comment-active-line`:`diff-comment-marked-line`,glyphMarginClassName:n?`diff-comment-glyph-active`:`diff-comment-glyph`,glyphMarginHoverMessage:{value:e.comment},stickiness:N.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}}).filter(e=>e!==null);d.push(...f);let p=r===`original`?Y.current.original:Y.current.modified,m=e.deltaDecorations(p,d);r===`original`?Y.current.original=m:Y.current.modified=m};s(e.getOriginalEditor(),`original`),s(e.getModifiedEditor(),`modified`)},[]);(0,V.useEffect)(()=>{$()},[$,R,B,j,P,Q]),(0,V.useEffect)(()=>()=>{q.current=null,Y.current={original:[],modified:[]}},[j]),(0,V.useEffect)(()=>()=>{ye.current=!1,q.current&&=(q.current.getOriginalEditor().getModel()?.dispose(),q.current.getModifiedEditor().getModel()?.dispose(),q.current.dispose(),null),Y.current={original:[],modified:[]}},[]);let Me=(0,V.useCallback)(e=>{q.current=e;let t=e=>e===N.MouseTargetType.GUTTER_GLYPH_MARGIN||e===N.MouseTargetType.GUTTER_LINE_NUMBERS||e===N.MouseTargetType.GUTTER_LINE_DECORATIONS||e===N.MouseTargetType.GUTTER_VIEW_ZONE,n=(e,n)=>{e.onMouseDown(r=>{if(!r.target?.position||!t(r.target.type))return;let i=r.target.position.lineNumber,{isFullView:a,selectedFileIndex:o,files:s}=ve.current,c=s[o];if(!c)return;let l=a?null:Z(c),u=l?l.startLine+i-1:i,d=e.getModel()?.getLineContent(i)??``,f=J.current.find(e=>e.fileIndex===o&&e.lineNumber===u&&e.side===n);f?K(f):W({lineNumber:u,lineContent:d,side:n})})};n(e.getOriginalEditor(),`original`),n(e.getModifiedEditor(),`modified`),setTimeout(()=>{q.current===e&&$()},150)},[$]),Ne=(0,V.useCallback)(e=>{if(H&&Q){let t={id:`comment-${Date.now()}`,filePath:Q.path,fileIndex:j,lineNumber:H.lineNumber,lineContent:H.lineContent,comment:e,side:H.side};z(e=>[...e,t]),W(null)}else G&&(z(t=>t.map(t=>t.id===G.id?{...t,comment:e}:t)),K(null))},[H,G,Q,j,z]),Pe=(0,V.useCallback)(()=>{G&&(z(e=>e.filter(e=>e.id!==G.id)),K(null))},[G,z]),Fe=(0,V.useCallback)(e=>{if(R.length===0)return;let t=(e%R.length+R.length)%R.length,n=R[t];me(t),te(n.fileIndex),setTimeout(()=>{let e=q.current;if(!e)return;let t=C[n.fileIndex];if(!t)return;let r=P?null:Z(t),i=r?n.lineNumber-r.startLine+1:n.lineNumber;(n.side===`original`?e.getOriginalEditor():e.getModifiedEditor()).revealLineInCenter(Math.max(1,i)),$()},100)},[R,C,P,$]),Ie=(0,V.useCallback)(()=>{Fe((B??0)-1)},[Fe,B]),Le=(0,V.useCallback)(()=>{Fe((B??-1)+1)},[Fe,B]),Re=(0,V.useCallback)(async()=>{let t=b[e];if(!t)try{let e=await E(),n=Object.values(e).flat();if(n.length>0)t=n[0];else{console.error(`No models available to process comments`);return}}catch(e){console.error(`Failed to load models:`,e);return}let r=t.id,i=t.provider;try{let{prompt:t}=await k(e,R);z([]),m({type:ce.SetPendingChatMessage,message:{threadId:e,message:t,model:r,provider:i}}),n()}catch(e){console.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[R,b,m,e,n,z]),ze={readOnly:!0,renderSideBySide:!0,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,glyphMargin:!0,lineNumbers:Q&&(P||Oe(Q))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0};return(0,U.jsxs)(`div`,{className:`diff-view-root flex h-full flex-col`,children:[(0,U.jsx)(`div`,{className:`diff-body flex flex-1 overflow-hidden`,children:(0,U.jsxs)(ue,{direction:`horizontal`,children:[(0,U.jsx)(pe,{ref:L,defaultSize:25,minSize:12,maxSize:40,collapsible:!0,collapsedSize:0,onCollapse:()=>re(!0),onExpand:()=>re(!1),className:`border-r border-transparent`,children:(0,U.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,U.jsx)(ge,{treeData:Ee,files:C,error:D,selectedFileIndex:j,onFileSelect:te,onRevertFile:Te})})}),(0,U.jsx)(Se,{isOpen:!I}),(0,U.jsx)(pe,{className:`overflow-hidden bg-transparent`,children:(0,U.jsxs)(`div`,{className:`diff-editor-panel flex h-full bg-transparent flex-col overflow-hidden`,children:[(0,U.jsxs)(fe,{className:c(`bg-transparent`,I&&`h-auto py-3 flex-col items-start gap-3 md:flex-row md:items-center md:h-[71px] md:py-0 md:gap-2 justify-between`),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(d,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:be,children:[I?(0,U.jsx)(t,{className:`h-4 w-4`}):(0,U.jsx)(_,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),(0,U.jsx)(`span`,{className:c(w.label,`text-foreground`),children:Q?Q.path:`Review Changes`})]}),(0,U.jsxs)(`div`,{className:c(`flex items-center gap-2`,I&&`ml-0`,!I&&`ml-auto`,`md:ml-auto`),children:[(0,U.jsx)(d,{variant:`ghost`,size:`sm`,onClick:()=>ne(e=>!e),disabled:!Q,className:c(w.compact,`h-8 gap-1 px-2`),children:P?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(p,{className:`h-3 w-3`}),` Show changes only`]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(g,{className:`h-3 w-3`}),` Show full file`]})}),R.length>0&&(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(f,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsx)(d,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Ie,disabled:(B??0)===0,children:(0,U.jsx)(i,{className:`h-3 w-3`})})}),(0,U.jsx)(s,{children:`Previous comment`})]}),(0,U.jsx)(`span`,{className:c(w.caption,`whitespace-nowrap`),children:R.length===1?`1 Comment`:`Comment ${(B??0)+1} of ${R.length}`}),(0,U.jsxs)(f,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsx)(d,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Le,disabled:(B??0)===R.length-1,children:(0,U.jsx)(l,{className:`h-3 w-3`})})}),(0,U.jsx)(s,{children:`Next comment`})]})]}),R.length>0&&(0,U.jsxs)(f,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsxs)(d,{size:`sm`,onClick:Re,className:c(w.compact,`h-8 gap-1 px-3 bg-foreground text-background hover:bg-foreground/90`),children:[(0,U.jsx)(O,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,U.jsx)(s,{children:`Send all comments to Tarsk for resolution`})]})]})]}),(0,U.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[(0,U.jsx)(M,{height:`100%`,language:ke(Q?.path||``),original:Ae,modified:je,theme:x===`dark`?`vs-dark`:`vs-light`,onMount:Me,options:ze},`diff-${j}`),(0,U.jsxs)(`div`,{className:`pointer-events-none absolute bottom-4 right-4 z-20 flex flex-col items-end gap-3`,children:[oe&&(0,U.jsxs)(`div`,{className:`pointer-events-auto w-[min(100%,48rem)] rounded-2xl bg-background/50 p-4 backdrop-blur-md`,children:[(0,U.jsx)(`div`,{className:`mb-3 flex items-center justify-end`,children:(0,U.jsxs)(d,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>se(!1),children:[(0,U.jsx)(ee,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Close chat`})]})}),(0,U.jsx)(le,{})]}),!oe&&(0,U.jsxs)(f,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsxs)(d,{size:`icon`,className:`pointer-events-auto h-12 w-12 rounded-full shadow-lg`,onClick:()=>se(!0),children:[(0,U.jsx)(O,{className:`h-5 w-5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Open review chat`})]})}),(0,U.jsx)(s,{children:`Chat about this diff`})]})]})]})]})})]})}),(0,U.jsx)(Ce,{open:H!==null||G!==null,lineNumber:G?.lineNumber??H?.lineNumber??0,lineContent:G?.lineContent??H?.lineContent??``,initialComment:G?.comment,isEditing:G!==null,onSave:Ne,onDelete:Pe,onClose:()=>{W(null),K(null)}},`${G?.id??``}-${H?.lineNumber??``}-${H?.side??``}`)]})}function X(e){let t=(0,H.c)(11),[n,r]=(0,V.useState)(0),i;t[0]!==n||t[1]!==e.threadId?(i=function(){re(we(e.threadId,n)),r(Ee)},t[0]=n,t[1]=e.threadId,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsx)(ne,{}),t[3]=o):o=t[3];let s=`${e.threadId}:${n}`,c;t[4]!==n||t[5]!==e||t[6]!==s?(c=(0,U.jsx)(V.Suspense,{fallback:o,children:(0,U.jsx)(Te,{...e,loadVersion:n},s)}),t[4]=n,t[5]=e,t[6]=s,t[7]=c):c=t[7];let l;return t[8]!==a||t[9]!==c?(l=(0,U.jsx)(I,{fallbackTitle:`Failed to load review changes`,onRetry:a,children:c}),t[8]=a,t[9]=c,t[10]=l):l=t[10],l}function Ee(e){return e+1}export{X as DiffView,X as default};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-Dq44yA1j.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-6DhhjIBL.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-CFot099O.js","assets/dialogs-config-Ct6i8Iij.js","assets/onboarding-DHCR18iU.js","assets/whisper-wasm-Cq5Ofwpd.js","assets/react-vendor-CjZZeCRj.js","assets/utils-DDDR42pW.js","assets/index-sEZ3wJXu.css","assets/api-BHfaVqlR.js","assets/context-menu-S8y0c1Fx.js","assets/ui-components-Di-9yNr4.js","assets/explorer-view-BMrlX2hb.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Qr as t,gi as n,io as r,li as i,lr as a,no as o}from"./dialogs-config-Ct6i8Iij.js";import{r as s}from"./monaco-CZnIWXyV.js";import{l as c,u as l}from"./history-view-CFot099O.js";import{A as u,S as d,i as f,n as p,r as m}from"./index-6DhhjIBL.js";var h=o(),g=e(r(),1),_=n(),v=(0,g.lazy)(()=>s(()=>import(`./explorer-tree-Dq44yA1j.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),y=(0,g.lazy)(()=>s(()=>import(`./explorer-view-BMrlX2hb.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12])));function b(){let e=(0,h.c)(18),n=u(x),[r,o]=(0,g.useState)(null),{pendingExplorerPath:s,setPendingExplorerPath:b,explorerClearPath:S,setExplorerClearPath:C}=d(),w,T;e[0]!==s||e[1]!==b?(w=()=>{s&&b(null)},T=[s,b],e[0]=s,e[1]=b,e[2]=w,e[3]=T):(w=e[2],T=e[3]),(0,g.useEffect)(w,T);let E,D;e[4]!==S||e[5]!==C?(E=()=>{S&&(o(e=>e&&(e.path===S||e.path.startsWith(S+`/`)?null:e)),C(null))},D=[S,C],e[4]=S,e[5]=C,e[6]=E,e[7]=D):(E=e[6],D=e[7]),(0,g.useEffect)(E,D);let O;e[8]!==r?.path||e[9]!==n?(O=(0,_.jsx)(m,{defaultSize:25,minSize:15,maxSize:50,className:`overflow-hidden border-r border-border`,children:(0,_.jsx)(a,{className:`h-full`,children:n?(0,_.jsx)(g.Suspense,{fallback:(0,_.jsx)(l,{}),children:(0,_.jsx)(v,{threadId:n,selectedPath:r?.path??null,onNodeSelect:o})}):(0,_.jsx)(`p`,{className:t(i.caption,`px-3 py-4 text-center`),children:`No thread selected.`})})}),e[8]=r?.path,e[9]=n,e[10]=O):O=e[10];let k;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,_.jsx)(p,{withHandle:!0}),e[11]=k):k=e[11];let A;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,_.jsx)(c,{}),e[12]=A):A=e[12];let j;e[13]===r?j=e[14]:(j=(0,_.jsx)(m,{className:`overflow-hidden`,children:(0,_.jsx)(g.Suspense,{fallback:A,children:(0,_.jsx)(y,{selectedFile:r})})}),e[13]=r,e[14]=j);let M;return e[15]!==O||e[16]!==j?(M=(0,_.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,_.jsxs)(f,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[O,k,j]})}),e[15]=O,e[16]=j,e[17]=M):M=e[17],M}function x(e){return e.selectedThreadId}export{b as default};