tarsk 0.5.49 → 0.5.51
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.
- package/README.md +85 -3
- package/dist/index.js +10869 -8554
- package/dist/public/assets/{account-view-DxHV7OtO.js → account-view-CGokQA1o.js} +1 -1
- package/dist/public/assets/api-BRrGio-B.js +1 -0
- package/dist/public/assets/browser-tab-B3BybVD0.js +1 -0
- package/dist/public/assets/commit-dialog-BLzHl6oN.js +1 -0
- package/dist/public/assets/context-menu-yKNgVtVk.js +1 -0
- package/dist/public/assets/create-repo-dialog-DHFloJc3.js +1 -0
- package/dist/public/assets/{dialogs-config-BEazgV7k.js → dialogs-config-BF_RyK5j.js} +14 -14
- package/dist/public/assets/diff-view-DONeogdk.js +3 -0
- package/dist/public/assets/explorer-tab-view-C1Dex751.js +2 -0
- package/dist/public/assets/{explorer-tree-CiPMm5ck.js → explorer-tree-BmsrsMXJ.js} +1 -1
- package/dist/public/assets/explorer-view-1fAca9It.js +1 -0
- package/dist/public/assets/git-history-dialog-DXsSt3e0.js +1 -0
- package/dist/public/assets/git-ops-button-Cj3j4bvy.js +2 -0
- package/dist/public/assets/history-view-COEFPP2U.js +9 -0
- package/dist/public/assets/index-Dsj5zHdU.js +73 -0
- package/dist/public/assets/index-DzUALYN4.css +1 -0
- package/dist/public/assets/mcp-server-card-3bFOnHFO.js +1 -0
- package/dist/public/assets/merged-pr-dialog-C5vgSXwq.js +1 -0
- package/dist/public/assets/model-star-rating-GWRgO9pY.js +1 -0
- package/dist/public/assets/onboarding-B_n7I3ri.js +1 -0
- package/dist/public/assets/project-settings-view-DsVEiQM_.js +1 -0
- package/dist/public/assets/providers-list-view-BT5XZP-F.js +1 -0
- package/dist/public/assets/pull-request-dialog-BO_7fALs.js +1 -0
- package/dist/public/assets/pull-with-changes-dialog-DQSC-HUH.js +1 -0
- package/dist/public/assets/push-before-pr-dialog-B9evx_c7.js +1 -0
- package/dist/public/assets/radio-group-CNuRXtN5.js +1 -0
- package/dist/public/assets/react-vendor-D-z0br-z.js +16 -0
- package/dist/public/assets/settings-general-view-BaTUBgdM.js +1 -0
- package/dist/public/assets/settings-instructions-view-Bit7tYRh.js +1 -0
- package/dist/public/assets/settings-list-Cc_0YmxB.js +1 -0
- package/dist/public/assets/settings-mcp-servers-view-BcuuyWhI.js +5 -0
- package/dist/public/assets/{settings-models-skeleton-Cse6L-Nd.js → settings-models-skeleton-BfIx9XDs.js} +1 -1
- package/dist/public/assets/{settings-models-view-BAxf3eJq.js → settings-models-view-CNFB1Iqn.js} +1 -1
- package/dist/public/assets/settings-rules-view-BvelCH4j.js +8 -0
- package/dist/public/assets/settings-skills-view-DV-cA6cj.js +3 -0
- package/dist/public/assets/settings-slash-commands-view-CKxQnzse.js +1 -0
- package/dist/public/assets/settings-subagents-view-DAl5Db-p.js +2 -0
- package/dist/public/assets/{settings-system-prompt-view-B1vc2cgC.js → settings-system-prompt-view-BdwsxqMo.js} +1 -1
- package/dist/public/assets/settings-view-BxiazdKG.js +2 -0
- package/dist/public/assets/{skeleton-6mGMglV0.js → skeleton-DJZ5x6e0.js} +1 -1
- package/dist/public/assets/{slug-utils-BT1eqWhW.js → slug-utils-D4uxO5qv.js} +1 -1
- package/dist/public/assets/{tabs-iUSYYupj.js → tabs-TGCt-ze0.js} +1 -1
- package/dist/public/assets/{terminal-panel-DIpnKR-N.js → terminal-panel-Bh_CKydu.js} +2 -2
- package/dist/public/assets/todos-view-DDSSplmi.js +17 -0
- package/dist/public/assets/{ui-components-kSaUEA_X.js → ui-components-JEH8JAJ7.js} +1 -1
- package/dist/public/assets/{use-deferred-search-DGJskNBr.js → use-deferred-search-BZg7Bt7W.js} +1 -1
- package/dist/public/assets/{utils-CECQ_-6N.js → utils-H-1x3dmp.js} +1 -1
- package/dist/public/assets/{vosk-speech-CgILeNJR.js → vosk-speech-FJiKHPe4.js} +2 -2
- package/dist/public/assets/{web-DGalafxk.js → web-B4cuelyi.js} +1 -1
- package/dist/public/assets/{web-BD1sqxMq.js → web-CQpWcSn8.js} +1 -1
- package/dist/public/assets/{web-BWAZk7ug.js → web-Cq4yC7dg.js} +1 -1
- package/dist/public/assets/{web-Dt5YgbhM.js → web-DOZOaJlj.js} +1 -1
- package/dist/public/index.html +8 -8
- package/package.json +1 -1
- package/dist/public/assets/api-Dhzdgb40.js +0 -1
- package/dist/public/assets/browser-tab-qhf-xKwZ.js +0 -1
- package/dist/public/assets/commit-dialog-DcVXFOBP.js +0 -1
- package/dist/public/assets/context-menu-PIC-g8wy.js +0 -1
- package/dist/public/assets/create-repo-dialog-CsjpTBPU.js +0 -1
- package/dist/public/assets/diff-view-CGEl0YbC.js +0 -3
- package/dist/public/assets/explorer-tab-view--ib_BjId.js +0 -2
- package/dist/public/assets/explorer-view-odyQutTO.js +0 -1
- package/dist/public/assets/git-history-dialog-qUZ7Qsp4.js +0 -1
- package/dist/public/assets/git-ops-button-Bced-_39.js +0 -2
- package/dist/public/assets/history-view-BMVTxWTg.js +0 -9
- package/dist/public/assets/index-C7FLshNp.css +0 -1
- package/dist/public/assets/index-_SOdLUMq.js +0 -73
- package/dist/public/assets/mcp-server-card-ChdAZekt.js +0 -1
- package/dist/public/assets/merged-pr-dialog-DAXqT4Xe.js +0 -1
- package/dist/public/assets/model-star-rating-BzpXBjSo.js +0 -1
- package/dist/public/assets/onboarding-Bi5MieW-.js +0 -1
- package/dist/public/assets/project-settings-view-CHV6lJG4.js +0 -1
- package/dist/public/assets/providers-list-view-Dgid2Wui.js +0 -1
- package/dist/public/assets/pull-request-dialog-BFgRF5AH.js +0 -1
- package/dist/public/assets/pull-with-changes-dialog-oGP-j8Yw.js +0 -1
- package/dist/public/assets/push-before-pr-dialog-BQ0QC6Qu.js +0 -1
- package/dist/public/assets/radio-group-n9qyUxmu.js +0 -1
- package/dist/public/assets/react-vendor-iDwBzcYF.js +0 -16
- package/dist/public/assets/settings-general-view-Vwi9J6Tn.js +0 -1
- package/dist/public/assets/settings-instructions-view-8YIr0PO3.js +0 -1
- package/dist/public/assets/settings-list-owWkHWxE.js +0 -1
- package/dist/public/assets/settings-mcp-servers-view-CCXW_uet.js +0 -5
- package/dist/public/assets/settings-rules-view-D3KLTKVZ.js +0 -8
- package/dist/public/assets/settings-skills-view-DaqOna-w.js +0 -3
- package/dist/public/assets/settings-slash-commands-view-CN8_DTYX.js +0 -1
- package/dist/public/assets/settings-subagents-view-BIejA-ck.js +0 -2
- package/dist/public/assets/settings-view-DLBIkYoA.js +0 -2
- package/dist/public/assets/todos-view-BK6i_oPT.js +0 -17
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$n as t,Ja as n,Jo as r,Ln as i,Mi as a,Pi as o,Xo as s,Yn as c,Yr as l,Z as ee,Zo as u,co as d,ds as te,fs as ne,ho as re,ms as ie,n as ae,r as oe,ta as f}from"./dialogs-config-BF_RyK5j.js";import{a as p,i as se,o as ce,r as le,s as m}from"./react-vendor-D-z0br-z.js";import{C as ue,D as de,E as fe,S as pe,b as me}from"./history-view-COEFPP2U.js";import{n as he}from"./utils-H-1x3dmp.js";import{t as ge,v as _e}from"./index-Dsj5zHdU.js";var ve=ne(),h=e(ie(),1),g=te(),ye=h.forwardRef((e,t)=>{let n=(0,ve.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 a;n[3]===r?a=n[4]:(a=o(`relative flex w-full touch-none select-none items-center`,r),n[3]=r,n[4]=a);let s,c;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,g.jsx)(m,{className:`relative h-2 w-full grow overflow-hidden rounded-full bg-secondary`,children:(0,g.jsx)(se,{className:`absolute h-full bg-primary`})}),c=(0,g.jsx)(ce,{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]!==a?(l=(0,g.jsxs)(p,{ref:t,className:a,...i,children:[s,c]}),n[7]=i,n[8]=t,n[9]=a,n[10]=l):l=n[10],l});ye.displayName=p.displayName;var _=50;function be(){let[e,t]=(0,h.useState)(_),[n,r]=(0,h.useState)(_.toString()),[a,o]=(0,h.useState)(!0),[s,c]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=!1;async function n(){try{let n=await ee();e||(t(n.maximumTurnCount),r(n.maximumTurnCount.toString()))}catch(e){console.error(`Failed to load maximum turn count:`,e)}finally{e||o(!1)}}return n(),()=>{e=!0}},[]);function l(e){r(e)}async function u(e){c(!0);try{let n=await i({maximumTurnCount:e});t(n.maximumTurnCount),r(n.maximumTurnCount.toString())}catch(e){throw console.error(`Failed to update maximum turn count:`,e),e}finally{c(!1)}}function d(){r(e.toString())}return{defaultMaximumTurnCount:_,draftMaximumTurnCount:n,isLoading:a,isSaving:s,maximumTurnCount:e,resetDraftMaximumTurnCount:d,setDraftMaximumTurnCount:l,updateMaximumTurnCount:u}}function v(){return typeof navigator>`u`?!1:navigator.userAgentData?.platform===`macOS`?!0:navigator.platform.startsWith(`Mac`)}var y={isMacOS:!1,granted:!1,available:!1,message:``};function b(){return{...y,isMacOS:v()}}function xe(){let[e,n]=(0,h.useState)(b),[r,i]=(0,h.useState)(!0),[a,o]=(0,h.useState)(null),[s,l]=(0,h.useState)(!1),[ee,u]=(0,h.useState)(null),d=(0,h.useCallback)(async()=>{i(!0),o(null);try{n(await c(`api/system-permissions/screen-recording`))}catch(e){o(e instanceof Error?e.message:`Failed to check screen recording permission`),n(e=>({...y,isMacOS:e?.isMacOS??v(),message:`Unable to check permission status.`}))}finally{i(!1)}},[]);return(0,h.useEffect)(()=>{d()},[d]),{status:e,isLoading:r,error:a,isOpeningSettings:s,openSettingsError:ee,refresh:d,openSystemSettings:(0,h.useCallback)(async()=>{l(!0),u(null);try{let e=await t(`api/system-permissions/screen-recording/open-settings`,{});if(!e.success){let t=e.message||`Failed to open System Settings`;console.error(`[useScreenRecordingPermission] ${t}`,e.error),u(t)}}catch(e){let t=e instanceof Error?e.message:`Failed to open System Settings`;console.error(`[useScreenRecordingPermission] Error opening System Settings:`,e),u(t)}finally{l(!1)}},[])}}var Se=`local`,Ce=`tarsk-server-bind-mode-changed`;function we(){if(typeof window>`u`)return!1;try{return sessionStorage.getItem(Ce)===`true`}catch{return!1}}function Te(e){if(!(typeof window>`u`))try{e?sessionStorage.setItem(Ce,`true`):sessionStorage.removeItem(Ce)}catch{}}function Ee(){let[e,t]=(0,h.useState)(Se),[n,r]=(0,h.useState)(null),[a,o]=(0,h.useState)([]),[s,c]=(0,h.useState)(!0),[l,u]=(0,h.useState)(!1),[d,te]=(0,h.useState)(we);(0,h.useEffect)(()=>{let e=!1;async function n(){try{let n=await ee();e||(t(n.serverBindMode),r(n.serverBindMode),o(n.networkAddresses))}catch(e){console.error(`Failed to load server bind mode:`,e)}finally{e||c(!1)}}return n(),()=>{e=!0}},[]);async function ne(e){u(!0);try{let n=await i({serverBindMode:e});t(n.serverBindMode),o(n.networkAddresses),te(!0),Te(!0)}catch(e){throw console.error(`Failed to update server bind mode:`,e),e}finally{u(!1)}}let re=n!==null&&e!==n;return{defaultServerBindMode:Se,hasServerBindModeChanged:re,isLoading:s,isSaving:l,needsRestart:re||d,networkAddresses:a,serverBindMode:e,updateServerBindMode:ne}}var De=[{value:`local`,label:`No`},{value:`network`,label:`Yes`}],Oe=[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`system`,label:`System`}],ke=[`462`,`8100`].includes(typeof document<`u`?document.location.port:``)?`462`:`641`,Ae=600;function je(e){let t=(0,ve.c)(122),{onboardingResetSignal:i}=e,c=i===void 0?0:i,[ee,te]=(0,h.useState)(!1),{theme:ne,setTheme:ie}=he(),{scale:p,updateScale:se,resetScale:ce,min:m,max:_,default:v}=ge(),{defaultMaximumTurnCount:y,draftMaximumTurnCount:b,isLoading:Se,isSaving:Ce,resetDraftMaximumTurnCount:we,setDraftMaximumTurnCount:Te,updateMaximumTurnCount:je}=be(),{status:x,isLoading:S,isOpeningSettings:Pe,openSettingsError:Fe,refresh:Ie,openSystemSettings:Le}=xe(),{isLoading:Re,isSaving:ze,needsRestart:C,networkAddresses:w,serverBindMode:T,updateServerBindMode:Be}=Ee(),{isEnabled:Ve,isLoading:He,isSaving:Ue,updateIsEnabled:We}=_e(),Ge,Ke;t[0]===c?(Ge=t[1],Ke=t[2]):(Ge=()=>{if(c===0)return;te(!0);let e=setTimeout(()=>{te(!1)},Ae);return()=>{clearTimeout(e)}},Ke=[c],t[0]=c,t[1]=Ge,t[2]=Ke),(0,h.useEffect)(Ge,Ke);let qe;t[3]===Te?qe=t[4]:(qe=function(e){Te(e.target.value)},t[3]=Te,t[4]=qe);let Je=qe,Ye;t[5]!==y||t[6]!==b||t[7]!==we||t[8]!==je?(Ye=async function(){let e=Number.parseInt(b,10),t=Number.isFinite(e)&&e>0?e:y;try{await je(t)}catch{we()}},t[5]=y,t[6]=b,t[7]=we,t[8]=je,t[9]=Ye):Ye=t[9];let Xe=Ye,Ze;t[10]===se?Ze=t[11]:(Ze=function(e){e.length>0&&se(e[0])},t[10]=se,t[11]=Ze);let Qe=Ze,$e=ee&&`animate-headline-reset`,E;t[12]===$e?E=t[13]:(E=o($e),t[12]=$e,t[13]=E);let D;t[14]===E?D=t[15]:(D=(0,g.jsx)(pe,{title:`General`,description:`Customize the appearance and behavior of Tarsk.`,titleClassName:E}),t[14]=E,t[15]=D);let et,tt;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,g.jsx)(n,{className:`h-3.5 w-3.5`}),tt=(0,g.jsx)(`span`,{className:`sr-only`,children:`Reset font size to default`}),t[16]=et,t[17]=tt):(et=t[16],tt=t[17]);let O;t[18]===ce?O=t[19]:(O=(0,g.jsxs)(a,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:ce,children:[et,tt]}),t[18]=ce,t[19]=O);let k;t[20]===p?k=t[21]:(k=(0,g.jsxs)(`span`,{className:`${f.mono} tabular-nums w-12 text-right`,children:[p,`%`]}),t[20]=p,t[21]=k);let A;t[22]!==O||t[23]!==k?(A=(0,g.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[O,k]}),t[22]=O,t[23]=k,t[24]=A):A=t[24];let j;t[25]===m?j=t[26]:(j=(0,g.jsxs)(`span`,{className:`${f.bodyMuted} w-8 text-right`,children:[m,`%`]}),t[25]=m,t[26]=j);let M;t[27]===p?M=t[28]:(M=[p],t[27]=p,t[28]=M);let N;t[29]!==Qe||t[30]!==_||t[31]!==m||t[32]!==M?(N=(0,g.jsx)(ye,{value:M,min:m,max:_,step:5,onValueChange:Qe,"aria-label":`Font size`}),t[29]=Qe,t[30]=_,t[31]=m,t[32]=M,t[33]=N):N=t[33];let P;t[34]===_?P=t[35]:(P=(0,g.jsxs)(`span`,{className:`${f.bodyMuted} w-9`,children:[_,`%`]}),t[34]=_,t[35]=P);let F;t[36]!==j||t[37]!==N||t[38]!==P?(F=(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[j,N,P]}),t[36]=j,t[37]=N,t[38]=P,t[39]=F):F=t[39];let I;t[40]!==v||t[41]!==p?(I=p!==v&&(0,g.jsxs)(`p`,{className:`${f.bodyMuted} mt-2`,children:[`Font size has been changed from the default (`,v,`%).`]}),t[40]=v,t[41]=p,t[42]=I):I=t[42];let L;t[43]!==A||t[44]!==F||t[45]!==I?(L=(0,g.jsxs)(me,{title:`Font Size`,description:`Adjust the text size across the entire application.`,action:A,children:[F,I]}),t[43]=A,t[44]=F,t[45]=I,t[46]=L):L=t[46];let nt;t[47]===ie?nt=t[48]:(nt=e=>{(e===`light`||e===`dark`||e===`system`)&&ie(e)},t[47]=ie,t[48]=nt);let rt;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(rt=Oe.map(Ne),t[49]=rt):rt=t[49];let R;t[50]!==nt||t[51]!==ne?(R=(0,g.jsx)(me,{title:`Appearance`,description:`Choose your preferred color scheme.`,children:(0,g.jsx)(ae,{type:`single`,value:ne,onValueChange:nt,"aria-label":`Appearance`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:rt})}),t[50]=nt,t[51]=ne,t[52]=R):R=t[52];let z;t[53]===Xe?z=t[54]:(z=()=>{Xe()},t[53]=Xe,t[54]=z);let it=Se||Ce,B;t[55]!==b||t[56]!==Je||t[57]!==z||t[58]!==it?(B=(0,g.jsx)(l,{type:`number`,min:1,step:1,value:b,onChange:Je,onBlur:z,disabled:it,"aria-label":`Maximum turn count`,className:`w-28 text-right font-mono tabular-nums flex-shrink-0`}),t[55]=b,t[56]=Je,t[57]=z,t[58]=it,t[59]=B):B=t[59];let V;t[60]===y?V=t[61]:(V=(0,g.jsxs)(`p`,{className:f.bodyMuted,children:[`Default: `,y,` turns.`]}),t[60]=y,t[61]=V);let H;t[62]!==B||t[63]!==V?(H=(0,g.jsx)(me,{title:`Maximum Turn Count`,description:`Set how many turns a long-running agent chat can take before Tarsk asks whether to continue.`,action:B,children:V}),t[62]=B,t[63]=V,t[64]=H):H=t[64];let at=Ve?`on`:`off`,U;t[65]===We?U=t[66]:(U=e=>{e&&We(e===`on`)},t[65]=We,t[66]=U);let ot=He||Ue,st,ct;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,g.jsx)(oe,{value:`off`,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:`Off`}),ct=(0,g.jsx)(oe,{value:`on`,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:`On`}),t[67]=st,t[68]=ct):(st=t[67],ct=t[68]);let W;t[69]!==at||t[70]!==U||t[71]!==ot?(W=(0,g.jsx)(me,{title:`AI Voice Cleanup`,description:`After stopping voice recording, run the transcription through AI to remove filler words, false starts, and repetitions.`,children:(0,g.jsxs)(ae,{type:`single`,value:at,onValueChange:U,disabled:ot,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,"aria-label":`AI Voice Cleanup`,children:[st,ct]})}),t[69]=at,t[70]=U,t[71]=ot,t[72]=W):W=t[72];let G;t[73]!==Pe||t[74]!==S||t[75]!==Le||t[76]!==Ie||t[77]!==Fe||t[78]!==x?.granted||t[79]!==x?.isMacOS||t[80]!==x?.message?(G=x?.isMacOS&&(0,g.jsx)(me,{title:`Screen & System Audio Recording`,description:`Tarsk needs this macOS permission to capture screen content for browser tools and screen sharing features.`,action:(0,g.jsx)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:(0,g.jsxs)(a,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>void Ie(),disabled:S,children:[S?(0,g.jsx)(re,{className:`h-3.5 w-3.5 animate-spin`}):(0,g.jsx)(n,{className:`h-3.5 w-3.5`}),(0,g.jsx)(`span`,{className:`sr-only`,children:`Refresh permission status`})]})}),children:(0,g.jsx)(`div`,{className:`flex items-center gap-3`,children:!S&&x?.granted?(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(s,{className:`h-4 w-4 text-green-500`}),(0,g.jsx)(`span`,{className:o(f.body,`text-green-600 dark:text-green-400`),children:`Permission granted`})]}):S?null:(0,g.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(r,{className:`h-4 w-4 text-amber-500`}),(0,g.jsx)(`span`,{className:o(f.body,`text-amber-600 dark:text-amber-400`),children:`Permission not granted`})]}),(0,g.jsx)(`p`,{className:f.bodyMuted,children:x?.message??`Tarsk needs Screen & System Audio Recording permission to use browser tools.`}),(0,g.jsx)(a,{size:`sm`,onClick:()=>void Le(),disabled:Pe,className:`w-fit`,children:Pe?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(re,{className:`h-4 w-4 mr-2 animate-spin`}),`Opening Settings...`]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d,{className:`h-4 w-4 mr-2`}),`Open System Settings`]})}),Fe&&(0,g.jsxs)(`div`,{className:`flex items-start gap-2 p-3 rounded-md bg-destructive/10 text-destructive`,children:[(0,g.jsx)(u,{className:`h-4 w-4 mt-0.5 flex-shrink-0`}),(0,g.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,g.jsx)(`p`,{className:f.body,children:`Failed to open System Settings`}),(0,g.jsx)(`p`,{className:f.bodyMuted,children:Fe}),(0,g.jsxs)(`p`,{className:f.bodyMuted,children:[`Please open it manually:`,` `,(0,g.jsx)(`strong`,{children:`System Settings > Privacy & Security > Screen & System Audio Recording`})]})]})]})]})})}),t[73]=Pe,t[74]=S,t[75]=Le,t[76]=Ie,t[77]=Fe,t[78]=x?.granted,t[79]=x?.isMacOS,t[80]=x?.message,t[81]=G):G=t[81];let lt,ut;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(lt=(0,g.jsx)(ue,{title:`Mobile & Network Access`,className:`mb-1`}),ut=(0,g.jsx)(`p`,{className:o(f.bodyMuted,`mb-3`),children:`Allow the Tarsk mobile app or other web browsers to access Tarsk on the wifi network.`}),t[82]=lt,t[83]=ut):(lt=t[82],ut=t[83]);let dt=Re||ze,K;t[84]===Be?K=t[85]:(K=e=>{(e===`local`||e===`network`)&&Be(e)},t[84]=Be,t[85]=K);let ft;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(ft=De.map(Me),t[86]=ft):ft=t[86];let q;t[87]!==T||t[88]!==dt||t[89]!==K?(q=(0,g.jsx)(ae,{type:`single`,value:T,disabled:dt,onValueChange:K,"aria-label":`Server bind mode`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:ft}),t[87]=T,t[88]=dt,t[89]=K,t[90]=q):q=t[90];let J;t[91]!==C||t[92]!==w||t[93]!==T?(J=T===`network`&&w.length>0&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`p`,{className:`${f.bodyMuted} mt-3`,children:[`Available on the network at:`,` `,(0,g.jsxs)(`span`,{className:f.mono,children:[`http://`,w[0],`:`,ke]})]}),C&&(0,g.jsx)(`p`,{className:`${f.bodyMuted} mt-1`,children:`You will need to restart for this setting to take effect.`})]}),t[91]=C,t[92]=w,t[93]=T,t[94]=J):J=t[94];let Y;t[95]!==w||t[96]!==T?(Y=T===`network`&&w.length===0&&(0,g.jsx)(`p`,{className:`${f.bodyMuted} mt-3`,children:`No network IP addresses were detected on this computer.`}),t[95]=w,t[96]=T,t[97]=Y):Y=t[97];let X;t[98]!==C||t[99]!==T?(X=C&&T===`local`&&(0,g.jsxs)(`p`,{className:`${f.bodyMuted} mt-3`,children:[(0,g.jsx)(`br`,{}),`You will need to restart for this setting to take effect.`]}),t[98]=C,t[99]=T,t[100]=X):X=t[100];let Z;t[101]!==q||t[102]!==J||t[103]!==Y||t[104]!==X?(Z=(0,g.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[lt,ut,q,J,Y,X]}),t[101]=q,t[102]=J,t[103]=Y,t[104]=X,t[105]=Z):Z=t[105];let Q;t[106]!==w||t[107]!==T?(Q=T===`network`&&w.length>0&&(0,g.jsxs)(`div`,{className:`hidden md:flex flex-col items-center gap-2 flex-shrink-0`,children:[(0,g.jsx)(le,{value:`http://${w[0]}:${ke}`,size:128,bgColor:`hsl(var(--background))`,fgColor:`hsl(var(--foreground))`,level:`M`}),(0,g.jsx)(`p`,{className:`${f.compact} text-muted-foreground text-center`,children:`Scan with the Tarsk Mobile App`})]}),t[106]=w,t[107]=T,t[108]=Q):Q=t[108];let $;t[109]!==Z||t[110]!==Q?($=(0,g.jsxs)(`div`,{className:`flex items-start gap-6`,children:[Z,Q]}),t[109]=Z,t[110]=Q,t[111]=$):$=t[111];let pt;t[112]!==L||t[113]!==R||t[114]!==H||t[115]!==W||t[116]!==G||t[117]!==$?(pt=(0,g.jsxs)(`div`,{className:`space-y-8`,children:[L,R,H,W,G,$]}),t[112]=L,t[113]=R,t[114]=H,t[115]=W,t[116]=G,t[117]=$,t[118]=pt):pt=t[118];let mt;return t[119]!==pt||t[120]!==D?(mt=(0,g.jsx)(de,{children:(0,g.jsxs)(fe,{children:[D,pt]})}),t[119]=pt,t[120]=D,t[121]=mt):mt=t[121],mt}function Me(e){return(0,g.jsx)(oe,{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 Ne(e){return(0,g.jsx)(oe,{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{je as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Cn as t,Lt as n,Mi as r,Pi as i,ds as a,ho as o,ms as s,ta as c}from"./dialogs-config-BF_RyK5j.js";import{E as l,S as u,T as d,w as f}from"./history-view-COEFPP2U.js";import{F as p,L as m,z as h}from"./index-Dsj5zHdU.js";var g=e(s(),1),_=a();function v(){let e=h(e=>e.selectedThreadId),[a,s]=(0,g.useState)(``),[v,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(!1);(0,g.useEffect)(()=>{e&&(y(!0),n(e,`AGENTS.md`).then(e=>s(e.content)).catch(()=>s(``)).finally(()=>y(!1)))},[e]);async function S(){if(e){x(!0);try{await t(e,`AGENTS.md`,a),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)(r,{onClick:S,disabled:v||b,children:b?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(o,{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)(o,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,_.jsx)(m,{value:a,onChange:e=>s(e.target.value),className:i(c.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{Pi as e,Wa as t,Yr as n,ds as r,fs as i,ms as a,ta as o}from"./dialogs-config-BF_RyK5j.js";import{I as s}from"./history-view-COEFPP2U.js";import"./skeleton-DJZ5x6e0.js";var c=i(),l=r();a();var u=s(e=>(0,l.jsxs)(`div`,{className:`text-center py-12 border border-dashed rounded-lg mb-8`,children:[e.v0,(0,l.jsx)(`h3`,{className:e.v1,children:e.v2}),(0,l.jsx)(`p`,{className:e.v3,children:e.v4})]}),{name:`InstalledEmptyState_1`,portals:[`v0`,`v2`,`v4`]}),d=function(t){let n=(0,c.c)(8),{icon:r,title:i,description:a}=t,s;n[0]===r?s=n[1]:(s=(0,l.jsx)(r,{className:`mx-auto h-10 w-10 text-muted-foreground/50 mb-3`}),n[0]=r,n[1]=s);let d;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=e(o.emptyStateTitle,`mb-1`),n[2]=d):d=n[2];let f;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=e(o.bodyMuted,`mb-3`),n[3]=f):f=n[3];let p;return n[4]!==a||n[5]!==s||n[6]!==i?(p=(0,l.jsx)(u,{v0:s,v1:d,v2:i,v3:f,v4:a}),n[4]=a,n[5]=s,n[6]=i,n[7]=p):p=n[7],p};function f(r){let i=(0,c.c)(12),{placeholder:a,value:o,onChange:s,className:u}=r,d=u??`mb-4`,f;i[0]===d?f=i[1]:(f=e(`relative`,d),i[0]=d,i[1]=f);let p;i[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,l.jsx)(t,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),i[2]=p):p=i[2];let m;i[3]===s?m=i[4]:(m=e=>s(e.target.value),i[3]=s,i[4]=m);let h;i[5]!==a||i[6]!==m||i[7]!==o?(h=(0,l.jsx)(n,{placeholder:a,value:o,onChange:m,className:`pl-8`}),i[5]=a,i[6]=m,i[7]=o,i[8]=h):h=i[8];let g;return i[9]!==f||i[10]!==h?(g=(0,l.jsxs)(`div`,{className:f,children:[p,h]}),i[9]=f,i[10]=h,i[11]=g):g=i[11],g}function p(e){let t=(0,c.c)(7),{search:n,trailing:r}=e,i;t[0]===n?i=t[1]:(i=(0,l.jsx)(f,{...n,className:`min-w-0 flex-1 basis-0`}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r?(0,l.jsx)(`div`,{className:`min-w-0 flex-1 basis-0`,children:r}):null,t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,l.jsxs)(`div`,{className:`mb-4 flex items-center gap-2`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function m(e){let t=(0,c.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,l.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 h(t){let n=(0,c.c)(3),{searchQuery:r,emptyLabel:i}=t,a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=e(o.bodyMuted,`text-center py-8`),n[0]=a):a=n[0];let s=r.trim()?`No results for "${r}"`:i,u;return n[1]===s?u=n[2]:(u=(0,l.jsx)(`p`,{className:a,children:s}),n[1]=s,n[2]=u),u}function g(t){let n=(0,c.c)(3),{message:r}=t,i;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=e(o.bodyMuted,`text-center py-8`),n[0]=i):i=n[0];let a;return n[1]===r?a=n[2]:(a=(0,l.jsx)(`p`,{className:i,children:r}),n[1]=r,n[2]=a),a}export{p as a,f as i,m as n,g as o,h as r,d as t};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Fr as t,Ha as n,Ir as r,Lr as i,M as a,Mi as o,Pi as s,Qa as c,Qr as l,Rr as u,Xr as d,Yr as f,_t as p,ds as m,fs as h,ft as g,ja as _,ms as v,ta as y,wa as b,yn as x}from"./dialogs-config-BF_RyK5j.js";import{A as S,C,D as ee,E as w,F as T,M as E,N as D,O,P as k,S as te,T as A,b as j,d as M,f as N,g as P,h as F,j as I,k as L,p as R,y as z}from"./history-view-COEFPP2U.js";import{A as B,F as V,L as H,j as ne,z as U}from"./index-Dsj5zHdU.js";import{t as W}from"./skeleton-DJZ5x6e0.js";import{i as G,n as K,r as re,t as ie}from"./tabs-TGCt-ze0.js";import{i as ae,n as oe,r as se,t as q}from"./settings-list-Cc_0YmxB.js";import{t as ce}from"./mcp-server-card-3bFOnHFO.js";var J=h(),Y=e(v(),1);function le(e){let[t,n]=(0,Y.useState)([]),[r,i]=(0,Y.useState)(!1),a=(0,Y.useCallback)(async()=>{if(e){i(!0);try{let t=await g(e);n(Object.entries(t.servers??{}).map(([e,t])=>({name:e,config:t})))}catch{n([])}finally{i(!1)}}},[e]);return(0,Y.useEffect)(()=>{a()},[a]),{installedServers:t,loadingConfig:r,loadInstalledServers:a}}function ue(){let e=(0,J.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,Y.useState)(t),i,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{p().then(r).catch(()=>r([]))},a=[],e[1]=i,e[2]=a):(i=e[1],a=e[2]),(0,Y.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 x(e,t,n)}async function de(e,t){await a(e,t)}var Z=m();function Q(e){return e?.url?`remote`:`local`}function fe(e){return Object.entries(e??{}).map(([e,t])=>({key:e,value:t}))}function $({projectPath:e,serverName:t,initialName:n,initialConfig:r,onBack:i}){let{installedServers:a}=le(e),s=!!t,[l,u]=(0,Y.useState)(`local`),[d,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(``),[g,_]=(0,Y.useState)(``),[v,x]=(0,Y.useState)(``),[S,C]=(0,Y.useState)(`sse`),[w,T]=(0,Y.useState)([]),[E,D]=(0,Y.useState)([]),[O,k]=(0,Y.useState)(!1),[A,I]=(0,Y.useState)(!1),[L,B]=(0,Y.useState)(null),[ne,U]=(0,Y.useState)(s),[W,ae]=(0,Y.useState)(``),[oe,se]=(0,Y.useState)(``);function q(e,t){let n=Q(t);u(n),p(e),h(t.command??``),_((t.args??[]).join(`
|
|
2
|
+
`)),x(t.url??``),C(t.transport??`sse`),T(fe(t.env)),D(fe(t.headers)),ae(e),se(JSON.stringify({name:e,type:n,config:t}))}(0,Y.useEffect)(()=>{if(s&&t){let e=a.find(e=>e.name===t);e&&(q(e.name,e.config),U(!1))}else r&&q(n??``,r),U(!1)},[a,t,s,r,n]);let ce=(0,Y.useCallback)(()=>{T(e=>[...e,{key:``,value:``}])},[]),J=(0,Y.useCallback)(e=>{T(t=>t.filter((t,n)=>n!==e))},[]),ue=(0,Y.useCallback)((e,t)=>{T(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),$=(0,Y.useCallback)((e,t)=>{T(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]),pe=(0,Y.useCallback)(()=>{D(e=>[...e,{key:``,value:``}])},[]),me=(0,Y.useCallback)(e=>{D(t=>t.filter((t,n)=>n!==e))},[]),he=(0,Y.useCallback)((e,t)=>{D(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),ge=(0,Y.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(l===`remote`){let t=_e(E);return{url:v.trim(),transport:S,...t?{headers:t}:{},...e?{env:e}:{}}}let t=g.split(`
|
|
3
|
+
`).map(e=>e.trim()).filter(Boolean);return{command:m.trim(),args:t,...e?{env:e}:{}}}let ye=JSON.stringify({name:d.trim(),type:l,config:ve()}),be=async()=>{B(null);let t=d.trim();if(!t){B(`Server name is required`);return}if(l===`remote`){if(!v.trim()){B(`Server URL is required`);return}try{new URL(v.trim())}catch{B(`Server URL must be a valid URL`);return}}else if(!m.trim()){B(`Command is required`);return}k(!0);try{if(!e)throw Error(`No project path`);await X(e,W||t,ve()),V({title:`Success`,description:s?`MCP server configuration saved`:`MCP server added`}),i()}catch(e){B(e instanceof Error?e.message:`Failed to save server`)}finally{k(!1)}},xe=async()=>{if(e){I(!0);try{await de(e,W),V({title:`Success`,description:`MCP server removed`}),i()}catch(e){B(e instanceof Error?e.message:`Failed to delete server`)}finally{I(!1)}}},Se=s?ye!==oe:d.trim()!==``||m.trim()!==``||g.trim()!==``||v.trim()!==``||w.length>0||E.length>0;return ne?(0,Z.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Z.jsx)(`p`,{className:y.bodyMuted,children:`Loading server configuration...`})}):(0,Z.jsx)(ee,{children:(0,Z.jsxs)(z,{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)(j,{title:`Server name`,description:s?`Server name cannot be changed`:void 0,children:(0,Z.jsx)(f,{id:`server-name`,placeholder:`e.g. filesystem`,value:d,onChange:e=>p(e.target.value),disabled:s})}),(0,Z.jsxs)(ie,{value:l,onValueChange:e=>u(e),className:`w-full`,children:[(0,Z.jsxs)(re,{className:`grid w-full grid-cols-2`,children:[(0,Z.jsx)(G,{value:`local`,children:`Local (stdio)`}),(0,Z.jsx)(G,{value:`remote`,children:`Remote (HTTP/SSE)`})]}),(0,Z.jsxs)(K,{value:`local`,className:`space-y-6 mt-6`,children:[(0,Z.jsx)(j,{title:`Command`,children:(0,Z.jsx)(f,{id:`server-command`,placeholder:`e.g. npx`,value:m,onChange:e=>h(e.target.value)})}),(0,Z.jsx)(j,{title:`Arguments`,description:`One argument per line`,children:(0,Z.jsx)(H,{id:`server-args`,placeholder:`-y
|
|
4
|
+
@modelcontextprotocol/server-filesystem
|
|
5
|
+
/path/to/dir`,value:g,onChange:e=>_(e.target.value),className:`font-mono min-h-[80px] resize-none`})})]}),(0,Z.jsxs)(K,{value:`remote`,className:`space-y-6 mt-6`,children:[(0,Z.jsx)(j,{title:`Server URL`,description:`Paste the MCP endpoint URL from your provider.`,children:(0,Z.jsx)(f,{id:`server-url`,placeholder:`https://example.com/mcp`,value:v,onChange:e=>x(e.target.value),className:`font-mono`})}),(0,Z.jsx)(j,{title:`Transport`,children:(0,Z.jsxs)(M,{value:S,onValueChange:e=>C(e),children:[(0,Z.jsx)(F,{children:(0,Z.jsx)(P,{})}),(0,Z.jsxs)(N,{children:[(0,Z.jsx)(R,{value:`sse`,children:`SSE (Server-Sent Events)`}),(0,Z.jsx)(R,{value:`streamableHttp`,children:`Streamable HTTP`})]})]})}),(0,Z.jsx)(j,{title:`HTTP headers`,description:`Optional headers for authentication.`,action:(0,Z.jsxs)(o,{variant:`ghost`,size:`sm`,onClick:pe,children:[(0,Z.jsx)(c,{className:`h-3 w-3 mr-1`}),`Add header`]}),children:E.length===0?(0,Z.jsx)(`p`,{className:y.caption,children:`No headers configured`}):(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:E.map((e,t)=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(f,{placeholder:`Authorization`,value:e.key,onChange:e=>he(t,e.target.value),className:`font-mono w-[35%]`}),(0,Z.jsx)(f,{placeholder:`Bearer ...`,value:e.value,onChange:e=>ge(t,e.target.value),className:`font-mono flex-1`}),(0,Z.jsx)(o,{variant:`ghost`,size:`icon`,onClick:()=>me(t),className:`h-9 w-9 flex-shrink-0`,children:(0,Z.jsx)(b,{className:`h-3.5 w-3.5`})})]},t))})})]})]}),(0,Z.jsx)(j,{title:`Environment variables`,description:l===`remote`?`Optional metadata for local tooling.`:void 0,action:(0,Z.jsxs)(o,{variant:`ghost`,size:`sm`,onClick:ce,children:[(0,Z.jsx)(c,{className:`h-3 w-3 mr-1`}),`Add variable`]}),children:w.length===0?(0,Z.jsx)(`p`,{className:y.caption,children:`No environment variables configured`}):(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:w.map((e,t)=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(f,{placeholder:`KEY`,value:e.key,onChange:e=>ue(t,e.target.value),className:`font-mono w-[35%]`}),(0,Z.jsx)(f,{placeholder:`value`,value:e.value,onChange:e=>$(t,e.target.value),className:`font-mono flex-1`}),(0,Z.jsx)(o,{variant:`ghost`,size:`icon`,onClick:()=>J(t),className:`h-9 w-9 flex-shrink-0`,children:(0,Z.jsx)(b,{className:`h-3.5 w-3.5`})})]},t))})}),L&&(0,Z.jsx)(`p`,{className:y.error,children:L}),(0,Z.jsxs)(`div`,{className:`border-t pt-4 flex items-center justify-between`,children:[s&&(0,Z.jsx)(o,{variant:`destructive`,onClick:xe,disabled:A||O,children:A?`Removing...`:`Remove`}),!s&&(0,Z.jsx)(`div`,{}),(0,Z.jsx)(o,{onClick:be,disabled:O||A||!Se,children:O?s?`Saving...`:`Adding...`:s?`Save`:`Add`})]})]})]})})}function pe(e){return e.name.toLowerCase().replace(/\s+/g,`-`)}function me(e){return e.url?e.url:`${e.command??``} ${e.args?.join(` `)??``}`.trim()}function he(){let e=U(e=>e.selectedProjectId),a=U(e=>e.projects).find(t=>t.projectId===e)?.projectPath,{installedServers:c,loadingConfig:f,loadInstalledServers:p}=le(a),{popularServers:m}=ue(),{setActiveMainTab:h}=ne(),{setPendingExplorerPath:g,triggerExplorerRefresh:v}=B(),[b,x]=(0,Y.useState)(!1),[j,M]=(0,Y.useState)(null),[N,P]=(0,Y.useState)(null),[F,R]=(0,Y.useState)(null),[z,H]=(0,Y.useState)(!1),[G,K]=(0,Y.useState)(``),re=(0,Y.useCallback)(async e=>{if(a){H(!0);try{await de(a,e),await p(),v(),V({title:`MCP server removed`,description:e}),R(null)}catch(e){V({title:`Error`,description:e instanceof Error?e.message:`Failed to remove server`,variant:`destructive`})}finally{H(!1)}}},[a,p,v]),ie=(0,Y.useCallback)(()=>{g(`.agents/mcp.json`),h(`explorer`)},[g,h]),J=(0,Y.useCallback)(async e=>{if(!a)return;let t=pe(e);if(!c.some(n=>n.name===t||n.name===e.id)){if(e.url!==void 0){if(!e.url.trim()){M({name:t,config:{url:``,transport:e.transport??`sse`,...Object.keys(e.env??{}).length>0?{env:e.env}:{}}}),x(!0);return}try{await X(a,t,{url:e.url,transport:e.transport??`sse`,...Object.keys(e.env??{}).length>0?{env:e.env}:{}}),await p(),v(),V({title:`MCP server installed`,description:e.name})}catch(e){V({title:`Error`,description:e instanceof Error?e.message:`Failed to install server`,variant:`destructive`})}return}if(!e.command){V({title:`Error`,description:`This server is missing install configuration.`,variant:`destructive`});return}try{await X(a,t,{command:e.command,args:e.args??[],...Object.keys(e.env??{}).length>0?{env:e.env}:{}}),await p(),v(),V({title:`MCP server installed`,description:e.name})}catch(e){V({title:`Error`,description:e instanceof Error?e.message:`Failed to install server`,variant:`destructive`})}}},[a,c,p,v]),Q=G.trim()?m.filter(e=>e.name.toLowerCase().includes(G.toLowerCase())||e.description.toLowerCase().includes(G.toLowerCase())):m;return e?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ee,{children:(0,Z.jsxs)(w,{children:[(0,Z.jsx)(te,{title:`MCP Servers`,description:`Manage Model Context Protocol servers for your project.`,action:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(o,{variant:`ghost`,onClick:ie,children:`Config`}),(0,Z.jsx)(o,{onClick:()=>x(!0),children:`Add Server`})]})}),(0,Z.jsx)(C,{title:`Installed`}),f?(0,Z.jsxs)(`div`,{className:`space-y-3 mb-8`,children:[(0,Z.jsx)(W,{className:`h-12 w-full`}),(0,Z.jsx)(W,{className:`h-12 w-full`})]}):c.length===0?(0,Z.jsx)(q,{icon:n,title:`No MCP servers installed`,description:`Add an MCP server to extend agent capabilities.`}):(0,Z.jsx)(`div`,{className:`mb-8 overflow-hidden rounded-md border border-border`,children:c.map((e,n)=>(0,Z.jsxs)(`div`,{className:s(`group grid min-h-13 grid-cols-[minmax(0,1fr)_auto_1.75rem] items-center gap-3 px-3 py-3 hover:bg-muted/30`,n>0&&`border-t border-border`),children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>P(e.name),className:`min-w-0 text-left`,children:[(0,Z.jsx)(`div`,{className:s(y.body,`truncate`),children:e.name}),(0,Z.jsx)(`div`,{className:s(y.compact,`truncate text-muted-foreground font-mono`),children:me(e.config)})]}),(0,Z.jsx)(`div`,{className:`shrink-0`}),(0,Z.jsx)(i,{children:(0,Z.jsxs)(t,{children:[(0,Z.jsx)(u,{asChild:!0,children:(0,Z.jsx)(o,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`shrink-0 items-center justify-center text-muted-foreground opacity-0 pointer-events-none can-hover:group-hover:opacity-100 can-hover:group-hover:pointer-events-auto can-hover:hover:bg-destructive can-hover:hover:text-destructive-foreground transition-[opacity,color,background-color]`,onClick:()=>R(e.name),"aria-label":`Delete ${e.name}`,children:(0,Z.jsx)(_,{className:`h-4 w-4`})})}),(0,Z.jsx)(r,{children:`Remove this MCP server from the project`})]})})]},e.name))}),(0,Z.jsx)(C,{title:`Available`,className:`mb-0`}),(0,Z.jsx)(ae,{placeholder:`Search available servers...`,value:G,onChange:K}),m.length===0?(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(W,{className:`h-20 w-full`}),(0,Z.jsx)(W,{className:`h-20 w-full`})]}):Q.length===0?(0,Z.jsx)(se,{searchQuery:G,emptyLabel:`No available servers found.`}):(0,Z.jsx)(oe,{children:Q.map(e=>{let t=pe(e),n=c.some(n=>n.name===t||n.name===e.id);return(0,Z.jsx)(ce,{name:e.name,description:e.description,installed:n,onClick:()=>{n||J(e)},showInstalledControls:!1},e.id)})})]})}),(0,Z.jsx)(d,{open:b,onOpenChange:e=>{x(e),e||M(null)},children:(0,Z.jsx)(l,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,Z.jsx)($,{projectPath:a,initialName:j?.name,initialConfig:j?.config,onBack:()=>{x(!1),M(null),p(),v()}})})}),(0,Z.jsx)(d,{open:N!==null,onOpenChange:e=>{e||P(null)},children:(0,Z.jsx)(l,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,Z.jsx)($,{projectPath:a,serverName:N??void 0,onBack:()=>{P(null),p(),v()}})})}),(0,Z.jsx)(O,{open:F!==null,onOpenChange:e=>!e&&R(null),children:(0,Z.jsxs)(I,{children:[(0,Z.jsxs)(k,{children:[(0,Z.jsx)(T,{children:`Delete MCP Server`}),(0,Z.jsxs)(E,{children:[`Are you sure you want to delete the server "`,F,`"? This action cannot be undone.`]})]}),(0,Z.jsxs)(D,{children:[(0,Z.jsx)(S,{children:`Cancel`}),(0,Z.jsx)(L,{onClick:()=>F&&void re(F),disabled:z,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:z?`Deleting...`:`Delete`})]})]})})]}):(0,Z.jsx)(A,{children:`Select a project to manage MCP servers.`})}export{he as SettingsMCPServersView,he as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ds as e,fs as t}from"./dialogs-config-BF_RyK5j.js";import{D as n,E as r,S as i}from"./history-view-COEFPP2U.js";import{t as a}from"./skeleton-DJZ5x6e0.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};
|
package/dist/public/assets/{settings-models-view-BAxf3eJq.js → settings-models-view-CNFB1Iqn.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Aa as t,Ai as n,B as r,Fr as i,G as a,H as o,Ir as s,Lo as c,Mi as l,Ni as u,Nr as d,Ot as f,Pr as p,U as m,V as h,W as g,Xi as _,as as v,kt as y,ls as b,os as x,ss as S}from"./dialogs-config-BEazgV7k.js";import{C,D as w,E as T,S as E,T as D,a as O,l as ee,n as k,o as A,x as te}from"./history-view-BMVTxWTg.js";import{a as j,n as M,u as N}from"./onboarding-Bi5MieW-.js";import{i as P,n as F,r as I,t as L}from"./tabs-iUSYYupj.js";import{t as R}from"./use-deferred-search-DGJskNBr.js";import{t as z}from"./model-star-rating-BzpXBjSo.js";import{i as B,o as V}from"./settings-list-owWkHWxE.js";import{t as H}from"./settings-models-skeleton-Cse6L-Nd.js";var U=e(b(),1),W=S();function G(e){return`settings-models:coding:${e}`}function K(e){return`settings-models:image:${e}`}async function q(){let e=(await y()).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 a(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 J(e){let t=e.filter(e=>e.name.toLowerCase()===`openrouter`),n={},r={};return await Promise.all(t.map(async e=>{try{let t=await g(e.slug);n[e.slug]=t.models,r[e.slug]=new Set(t.enabledModelIds)}catch(t){console.error(`Failed to load image models for ${e.slug}:`,t),n[e.slug]=[],r[e.slug]=new Set}})),{allImageModels:n,enabledImageModelIds:r}}var Y=x();function ne({providers:e,globalSearchQuery:t,providerSortOptions:a,setProviderSortOptions:m,filterAndSortModels:h,getModelDisplayName:g,onSaveStatus:y}){let b=O(K(0),()=>J(e)),[x]=(0,U.useState)(b.allImageModels),[S,w]=(0,U.useState)(b.enabledImageModelIds);async function T(e,t){try{S[e]?.has(t)?(await r(e,t),w(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await o(e,t),w(n=>({...n,[e]:new Set([...n[e]||[],t])}))),y(`Model preferences saved successfully`)}catch(e){y(e instanceof Error?e.message:`Failed to save model changes`)}}async function E(e,t){let n=x[e],r=S[e];if(n)for(let i of n)r?.has(i.id)!==t&&await T(e,i.id)}return(0,Y.jsx)(`div`,{className:`space-y-6`,children:e.filter(e=>e.name.toLowerCase()===`openrouter`).map(e=>{let r=x[e.slug]||[],o=S[e.slug]||new Set,y=a[e.slug]||`alphabetical`,b=h(r,o,y);return b.length===0&&t?null:(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:(0,Y.jsx)(`img`,{src:f(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,Y.jsx)(C,{title:e.name,className:`mb-0`})]}),b.length>0&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(j,{id:`select-all-image-${e.slug}`,checked:b.every(e=>o.has(e.id)),onCheckedChange:t=>void E(e.slug,t===!0)}),(0,Y.jsx)(`label`,{htmlFor:`select-all-image-${e.slug}`,className:l(_.body,`cursor-pointer whitespace-nowrap`),children:`Select all models`})]}),(0,Y.jsx)(i,{children:(0,Y.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,Y.jsxs)(d,{children:[(0,Y.jsx)(s,{asChild:!0,children:(0,Y.jsx)(n,{type:`button`,variant:y===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>m(t=>({...t,[e.slug]:`alphabetical`})),children:(0,Y.jsx)(v,{className:`h-4 w-4`})})}),(0,Y.jsx)(p,{children:`Sort A–Z`})]}),(0,Y.jsxs)(d,{children:[(0,Y.jsx)(s,{asChild:!0,children:(0,Y.jsx)(n,{type:`button`,variant:y===`price-low`||y===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>m(t=>({...t,[e.slug]:`price-low`})),children:(0,Y.jsx)(c,{className:`h-4 w-4`})})}),(0,Y.jsx)(p,{children:`Sort by price`})]})]})})]}),b.length===0?(0,Y.jsx)(V,{message:t?`No models matching your search.`:`No image models available for this provider.`}):(0,Y.jsx)(i,{children:(0,Y.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:b.map(t=>{let n=o.has(t.id),r=t.pricing;return(0,Y.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,Y.jsx)(j,{id:`image-${t.id}`,checked:n,onCheckedChange:()=>void T(e.slug,t.id),className:`mt-0`}),(0,Y.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,Y.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,Y.jsx)(`label`,{htmlFor:`image-${t.id}`,className:l(_.label,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:g(t)})}),r&&(0,Y.jsx)(`span`,{className:l(_.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 X({loadVersion:e}){let r=O(G(e),()=>q()),a=r.providers,[o]=(0,U.useState)(r.allModels),[g,y]=(0,U.useState)(r.enabledModelIds),[b,x]=(0,U.useState)(`coding`),{query:S,setQuery:k,deferredQuery:A}=R(),[H,W]=(0,U.useState)(r.providerSortOptions),[K,J]=(0,U.useState)(``),X=e=>N(e.id),Z=async(e,t)=>{try{g[e]?.has(t)?(await h(e,t),y(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await m(e,t),y(n=>({...n,[e]:new Set([...n[e]||[],t])}))),J(`Model preferences saved successfully`),setTimeout(()=>J(``),3e3)}catch(e){J(e instanceof Error?e.message:`Failed to save model changes`)}},Q=async(e,t)=>{let n=o[e],r=g[e];if(n)for(let i of n)r?.has(i.id)!==t&&await Z(e,i.id)},$=(e,t,n)=>M({models:e,query:A,sortBy:n,getDisplayName:X,getPriority:e=>+!t.has(e.id)});return a.length===0?(0,Y.jsx)(D,{title:`No providers configured`,children:`Configure a provider with an API key to view available models.`}):(0,Y.jsx)(w,{children:(0,Y.jsxs)(T,{children:[(0,Y.jsx)(E,{title:`Models`,description:`View and manage available models from your configured providers.`}),(0,Y.jsxs)(`div`,{className:`space-y-6`,children:[(0,Y.jsx)(B,{placeholder:`Search models across all providers...`,value:S,onChange:k}),(0,Y.jsxs)(L,{value:b,onValueChange:e=>{x(e),k(``)},children:[(0,Y.jsxs)(I,{className:`mb-4`,children:[(0,Y.jsx)(P,{value:`coding`,children:`Coding`}),a.some(e=>e.name.toLowerCase()===`openrouter`)&&(0,Y.jsx)(P,{value:`image`,children:`Image`})]}),(0,Y.jsx)(F,{value:`coding`,children:(0,Y.jsx)(`div`,{className:`space-y-6`,children:a.map(e=>{let r=o[e.slug]||[],a=g[e.slug]||new Set,m=H[e.slug]||`alphabetical`,h=$(r,a,m);return h.length===0&&S?null:(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:(0,Y.jsx)(`img`,{src:f(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,Y.jsx)(C,{title:e.name,className:`mb-0`})]}),h.length>0&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(j,{id:`select-all-${e.slug}`,checked:h.every(e=>a.has(e.id)),onCheckedChange:t=>Q(e.slug,t===!0)}),(0,Y.jsx)(`label`,{htmlFor:`select-all-${e.slug}`,className:l(_.body,`cursor-pointer whitespace-nowrap`),children:`Select all models`})]}),(0,Y.jsx)(i,{children:(0,Y.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,Y.jsxs)(d,{children:[(0,Y.jsx)(s,{asChild:!0,children:(0,Y.jsx)(n,{type:`button`,variant:m===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>W(t=>({...t,[e.slug]:`alphabetical`})),children:(0,Y.jsx)(v,{className:`h-4 w-4`})})}),(0,Y.jsx)(p,{children:`Sort A–Z`})]}),(0,Y.jsxs)(d,{children:[(0,Y.jsx)(s,{asChild:!0,children:(0,Y.jsx)(n,{type:`button`,variant:m===`price-low`||m===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>W(t=>({...t,[e.slug]:`price-low`})),children:(0,Y.jsx)(c,{className:`h-4 w-4`})})}),(0,Y.jsx)(p,{children:`Sort by price`})]}),(0,Y.jsxs)(d,{children:[(0,Y.jsx)(s,{asChild:!0,children:(0,Y.jsx)(n,{type:`button`,variant:m===`coding-index`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>W(t=>({...t,[e.slug]:`coding-index`})),children:(0,Y.jsx)(t,{className:`h-4 w-4`})})}),(0,Y.jsx)(p,{children:`Sort by coding intelligence`})]})]})})]}),h.length===0?(0,Y.jsx)(V,{message:S?`No models matching your search.`:`No models available for this provider.`}):(0,Y.jsx)(i,{children:(0,Y.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:h.map(t=>{let n=a.has(t.id),r=t.pricing;return(0,Y.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,Y.jsx)(j,{id:t.id,checked:n,onCheckedChange:()=>Z(e.slug,t.id),className:`mt-0`}),(0,Y.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,Y.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,Y.jsx)(`label`,{htmlFor:t.id,className:l(_.body,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:X(t)})}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[m===`coding-index`&&(0,Y.jsx)(z,{codingIndex:t.coding_index,modelName:X(t)}),r&&(0,Y.jsx)(`span`,{className:l(_.compact,`text-muted-foreground whitespace-nowrap`),children:(r.prompt??0)===0&&(r.completion??0)===0?``:`$${u(r.prompt??0)} in | $${u(r.completion??0)} out`})]})]})]},t.id)})})})]},e.slug)})})}),(0,Y.jsx)(F,{value:`image`,children:b===`image`?(0,Y.jsx)(U.Suspense,{fallback:(0,Y.jsx)(ee,{className:`py-12`,size:`sm`}),children:(0,Y.jsx)(ne,{providers:a,globalSearchQuery:S,providerSortOptions:H,setProviderSortOptions:W,filterAndSortModels:$,getModelDisplayName:X,onSaveStatus:e=>{J(e),e.includes(`Failed`)||setTimeout(()=>J(``),3e3)}})}):null})]}),K&&(0,Y.jsx)(te,{variant:K.includes(`error`)||K.includes(`Failed`)?`error`:`success`,className:`mb-0`,children:K})]})]})})}function Z(){let e=(0,W.c)(8),[t,n]=(0,U.useState)(0),r;e[0]===t?r=e[1]:(r=function(){A(G(t)),n($)},e[0]=t,e[1]=r);let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(H,{}),e[2]=a):a=e[2];let o;e[3]===t?o=e[4]:(o=(0,Y.jsx)(U.Suspense,{fallback:a,children:(0,Y.jsx)(X,{loadVersion:t},t)}),e[3]=t,e[4]=o);let s;return e[5]!==i||e[6]!==o?(s=(0,Y.jsx)(k,{fallbackTitle:`Failed to load models`,onRetry:i,renderFallback:Q,children:o}),e[5]=i,e[6]=o,e[7]=s):s=e[7],s}function Q(e,t){return(0,Y.jsx)(D,{title:`Failed to load models`,action:(0,Y.jsx)(n,{variant:`outline`,onClick:t,children:`Retry`}),children:e.message})}function $(e){return e+1}export{Z as SettingsModelsView,Z as default};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{At as t,B as n,Fa as r,Fi as i,Fr as a,G as o,H as s,Ho as c,Ir as l,Lr as u,Mi as d,Pi as f,Rr as p,U as m,V as h,W as g,ds as _,fs as v,kt as y,ms as b,ta as x,us as S}from"./dialogs-config-BF_RyK5j.js";import{C,D as w,E as T,S as E,T as D,a as O,l as ee,n as k,o as A,x as te}from"./history-view-COEFPP2U.js";import{a as j,n as M,u as N}from"./onboarding-B_n7I3ri.js";import{i as P,n as F,r as I,t as L}from"./tabs-TGCt-ze0.js";import{t as R}from"./use-deferred-search-BZg7Bt7W.js";import{t as z}from"./model-star-rating-GWRgO9pY.js";import{i as B,o as V}from"./settings-list-Cc_0YmxB.js";import{t as H}from"./settings-models-skeleton-BfIx9XDs.js";var U=e(b(),1),W=v();function G(e){return`settings-models:coding:${e}`}function K(e){return`settings-models:image:${e}`}async function q(){let e=(await t()).filter(e=>e.apiKey),n={};e.forEach(e=>{n[e.slug]=`alphabetical`});let r={},i={};return await Promise.all(e.map(async e=>{try{let t=await o(e.slug);r[e.slug]=t.models,i[e.slug]=new Set(t.enabledModelIds)}catch(t){console.error(`Failed to load models for ${e.slug}:`,t),r[e.slug]=[],i[e.slug]=new Set}})),{providers:e,allModels:r,enabledModelIds:i,providerSortOptions:n}}async function J(e){let t=e.filter(e=>e.name.toLowerCase()===`openrouter`),n={},r={};return await Promise.all(t.map(async e=>{try{let t=await g(e.slug);n[e.slug]=t.models,r[e.slug]=new Set(t.enabledModelIds)}catch(t){console.error(`Failed to load image models for ${e.slug}:`,t),n[e.slug]=[],r[e.slug]=new Set}})),{allImageModels:n,enabledImageModelIds:r}}var Y=_();function ne({providers:e,globalSearchQuery:t,providerSortOptions:r,setProviderSortOptions:o,filterAndSortModels:m,getModelDisplayName:h,onSaveStatus:g}){let _=O(K(0),()=>J(e)),[v]=(0,U.useState)(_.allImageModels),[b,w]=(0,U.useState)(_.enabledImageModelIds);async function T(e,t){try{b[e]?.has(t)?(await n(e,t),w(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await s(e,t),w(n=>({...n,[e]:new Set([...n[e]||[],t])}))),g(`Model preferences saved successfully`)}catch(e){g(e instanceof Error?e.message:`Failed to save model changes`)}}async function E(e,t){let n=v[e],r=b[e];if(n)for(let i of n)r?.has(i.id)!==t&&await T(e,i.id)}return(0,Y.jsx)(`div`,{className:`space-y-6`,children:e.filter(e=>e.name.toLowerCase()===`openrouter`).map(e=>{let n=v[e.slug]||[],s=b[e.slug]||new Set,g=r[e.slug]||`alphabetical`,_=m(n,s,g);return _.length===0&&t?null:(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:(0,Y.jsx)(`img`,{src:y(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,Y.jsx)(C,{title:e.name,className:`mb-0`})]}),_.length>0&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(j,{id:`select-all-image-${e.slug}`,checked:_.every(e=>s.has(e.id)),onCheckedChange:t=>void E(e.slug,t===!0)}),(0,Y.jsx)(`label`,{htmlFor:`select-all-image-${e.slug}`,className:f(x.body,`cursor-pointer whitespace-nowrap`),children:`Select all models`})]}),(0,Y.jsx)(u,{children:(0,Y.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,Y.jsxs)(a,{children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsx)(d,{type:`button`,variant:g===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>o(t=>({...t,[e.slug]:`alphabetical`})),children:(0,Y.jsx)(S,{className:`h-4 w-4`})})}),(0,Y.jsx)(l,{children:`Sort A–Z`})]}),(0,Y.jsxs)(a,{children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsx)(d,{type:`button`,variant:g===`price-low`||g===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>o(t=>({...t,[e.slug]:`price-low`})),children:(0,Y.jsx)(c,{className:`h-4 w-4`})})}),(0,Y.jsx)(l,{children:`Sort by price`})]})]})})]}),_.length===0?(0,Y.jsx)(V,{message:t?`No models matching your search.`:`No image models available for this provider.`}):(0,Y.jsx)(u,{children:(0,Y.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:_.map(t=>{let n=s.has(t.id),r=t.pricing;return(0,Y.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,Y.jsx)(j,{id:`image-${t.id}`,checked:n,onCheckedChange:()=>void T(e.slug,t.id),className:`mt-0`}),(0,Y.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,Y.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,Y.jsx)(`label`,{htmlFor:`image-${t.id}`,className:f(x.label,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:h(t)})}),r&&(0,Y.jsx)(`span`,{className:f(x.compact,`text-muted-foreground whitespace-nowrap flex-shrink-0`),children:(r.prompt??0)===0&&(r.completion??0)===0?``:`$${i(r.prompt??0)} in | $${i(r.completion??0)} out`})]})]},t.id)})})})]},e.slug)})})}function X({loadVersion:e}){let t=O(G(e),()=>q()),n=t.providers,[o]=(0,U.useState)(t.allModels),[s,g]=(0,U.useState)(t.enabledModelIds),[_,v]=(0,U.useState)(`coding`),{query:b,setQuery:k,deferredQuery:A}=R(),[H,W]=(0,U.useState)(t.providerSortOptions),[K,J]=(0,U.useState)(``),X=e=>N(e.id),Z=async(e,t)=>{try{s[e]?.has(t)?(await h(e,t),g(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await m(e,t),g(n=>({...n,[e]:new Set([...n[e]||[],t])}))),J(`Model preferences saved successfully`),setTimeout(()=>J(``),3e3)}catch(e){J(e instanceof Error?e.message:`Failed to save model changes`)}},Q=async(e,t)=>{let n=o[e],r=s[e];if(n)for(let i of n)r?.has(i.id)!==t&&await Z(e,i.id)},$=(e,t,n)=>M({models:e,query:A,sortBy:n,getDisplayName:X,getPriority:e=>+!t.has(e.id)});return n.length===0?(0,Y.jsx)(D,{title:`No providers configured`,children:`Configure a provider with an API key to view available models.`}):(0,Y.jsx)(w,{children:(0,Y.jsxs)(T,{children:[(0,Y.jsx)(E,{title:`Models`,description:`View and manage available models from your configured providers.`}),(0,Y.jsxs)(`div`,{className:`space-y-6`,children:[(0,Y.jsx)(B,{placeholder:`Search models across all providers...`,value:b,onChange:k}),(0,Y.jsxs)(L,{value:_,onValueChange:e=>{v(e),k(``)},children:[(0,Y.jsxs)(I,{className:`mb-4`,children:[(0,Y.jsx)(P,{value:`coding`,children:`Coding`}),n.some(e=>e.name.toLowerCase()===`openrouter`)&&(0,Y.jsx)(P,{value:`image`,children:`Image`})]}),(0,Y.jsx)(F,{value:`coding`,children:(0,Y.jsx)(`div`,{className:`space-y-6`,children:n.map(e=>{let t=o[e.slug]||[],n=s[e.slug]||new Set,m=H[e.slug]||`alphabetical`,h=$(t,n,m);return h.length===0&&b?null:(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:(0,Y.jsx)(`img`,{src:y(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,Y.jsx)(C,{title:e.name,className:`mb-0`})]}),h.length>0&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(j,{id:`select-all-${e.slug}`,checked:h.every(e=>n.has(e.id)),onCheckedChange:t=>Q(e.slug,t===!0)}),(0,Y.jsx)(`label`,{htmlFor:`select-all-${e.slug}`,className:f(x.body,`cursor-pointer whitespace-nowrap`),children:`Select all models`})]}),(0,Y.jsx)(u,{children:(0,Y.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,Y.jsxs)(a,{children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsx)(d,{type:`button`,variant:m===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>W(t=>({...t,[e.slug]:`alphabetical`})),children:(0,Y.jsx)(S,{className:`h-4 w-4`})})}),(0,Y.jsx)(l,{children:`Sort A–Z`})]}),(0,Y.jsxs)(a,{children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsx)(d,{type:`button`,variant:m===`price-low`||m===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>W(t=>({...t,[e.slug]:`price-low`})),children:(0,Y.jsx)(c,{className:`h-4 w-4`})})}),(0,Y.jsx)(l,{children:`Sort by price`})]}),(0,Y.jsxs)(a,{children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsx)(d,{type:`button`,variant:m===`coding-index`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>W(t=>({...t,[e.slug]:`coding-index`})),children:(0,Y.jsx)(r,{className:`h-4 w-4`})})}),(0,Y.jsx)(l,{children:`Sort by coding intelligence`})]})]})})]}),h.length===0?(0,Y.jsx)(V,{message:b?`No models matching your search.`:`No models available for this provider.`}):(0,Y.jsx)(u,{children:(0,Y.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:h.map(t=>{let r=n.has(t.id),a=t.pricing;return(0,Y.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,Y.jsx)(j,{id:t.id,checked:r,onCheckedChange:()=>Z(e.slug,t.id),className:`mt-0`}),(0,Y.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,Y.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,Y.jsx)(`label`,{htmlFor:t.id,className:f(x.body,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:X(t)})}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[m===`coding-index`&&(0,Y.jsx)(z,{codingIndex:t.coding_index,modelName:X(t)}),a&&(0,Y.jsx)(`span`,{className:f(x.compact,`text-muted-foreground whitespace-nowrap`),children:(a.prompt??0)===0&&(a.completion??0)===0?``:`$${i(a.prompt??0)} in | $${i(a.completion??0)} out`})]})]})]},t.id)})})})]},e.slug)})})}),(0,Y.jsx)(F,{value:`image`,children:_===`image`?(0,Y.jsx)(U.Suspense,{fallback:(0,Y.jsx)(ee,{className:`py-12`,size:`sm`}),children:(0,Y.jsx)(ne,{providers:n,globalSearchQuery:b,providerSortOptions:H,setProviderSortOptions:W,filterAndSortModels:$,getModelDisplayName:X,onSaveStatus:e=>{J(e),e.includes(`Failed`)||setTimeout(()=>J(``),3e3)}})}):null})]}),K&&(0,Y.jsx)(te,{variant:K.includes(`error`)||K.includes(`Failed`)?`error`:`success`,className:`mb-0`,children:K})]})]})})}function Z(){let e=(0,W.c)(8),[t,n]=(0,U.useState)(0),r;e[0]===t?r=e[1]:(r=function(){A(G(t)),n($)},e[0]=t,e[1]=r);let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(H,{}),e[2]=a):a=e[2];let o;e[3]===t?o=e[4]:(o=(0,Y.jsx)(U.Suspense,{fallback:a,children:(0,Y.jsx)(X,{loadVersion:t},t)}),e[3]=t,e[4]=o);let s;return e[5]!==i||e[6]!==o?(s=(0,Y.jsx)(k,{fallbackTitle:`Failed to load models`,onRetry:i,renderFallback:Q,children:o}),e[5]=i,e[6]=o,e[7]=s):s=e[7],s}function Q(e,t){return(0,Y.jsx)(D,{title:`Failed to load models`,action:(0,Y.jsx)(d,{variant:`outline`,onClick:t,children:`Retry`}),children:e.message})}function $(e){return e+1}export{Z as SettingsModelsView,Z as default};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Cn as t,Ct as n,Fr as r,Ga as i,Ir as a,Lr as o,Mi as s,P as c,Pi as l,Qr as u,R as d,Rr as f,Rt as p,Xr as m,Yr as h,ds as g,fs as _,ja as ee,ms as v,ta as y,tn as b,vt as x}from"./dialogs-config-BF_RyK5j.js";import{n as S,t as C}from"./react-vendor-D-z0br-z.js";import{A as te,C as w,D as T,E as ne,F as re,M as ie,N as ae,O as oe,P as se,S as E,T as D,b as O,j as ce,k as le,x as ue,y as k}from"./history-view-COEFPP2U.js";import{A as de,F as A,L as j,j as fe,z as M}from"./index-Dsj5zHdU.js";import{t as N}from"./skeleton-DJZ5x6e0.js";import{t as pe}from"./use-deferred-search-BZg7Bt7W.js";import{i as me,n as he,r as ge,t as P}from"./settings-list-Cc_0YmxB.js";import{t as F}from"./mcp-server-card-3bFOnHFO.js";import{i as I,n as L,r as R,t as _e}from"./slug-utils-D4uxO5qv.js";var z=_(),B=e(v(),1),V=g(),H=B.forwardRef((e,t)=>{let n=(0,z.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=l(`peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,V.jsx)(S,{className:l(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`)}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,V.jsx)(C,{className:a,...i,ref:t,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});H.displayName=C.displayName;function ve({threadId:e,onRuleCreated:n}){let[r,i]=(0,B.useState)(``),[a,o]=(0,B.useState)(``),[s,c]=(0,B.useState)(!1),[u,d]=(0,B.useState)(!1),f=R(r),p=L(f),m=async()=>{if(!(!p||!e)){d(!0);try{let r=`---
|
|
2
|
+
description: ${a.trim()}
|
|
3
|
+
alwaysApply: ${s}
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Place your rule instructions here as markdown.
|
|
7
|
+
`;await t(e,`.agents/rules/${f}.md`,r),A({title:`Rule created`,description:`Rule '${f}' was created successfully.`}),i(``),o(``),c(!1),n?.(f)}catch(e){A({title:`Error`,description:e instanceof Error?e.message:`Failed to create rule`,variant:`destructive`})}finally{d(!1)}}};return e?(0,V.jsx)(T,{children:(0,V.jsxs)(k,{children:[(0,V.jsx)(E,{title:`Add Rule`,description:`Create a new agent rule. The rule will be saved as a .md file in the .agents/rules folder.`}),(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(O,{title:`Rule Name`,children:[(0,V.jsx)(h,{id:`ruleName`,value:r,onChange:e=>i(e.target.value),placeholder:`e.g. Code Style Guide`,disabled:u}),r?(0,V.jsxs)(`p`,{className:l(y.caption,`mt-2`),children:[`File name: `,(0,V.jsxs)(`span`,{className:`font-mono`,children:[f||`...`,`.md`]})]}):null]}),(0,V.jsx)(O,{title:`Description`,children:(0,V.jsx)(j,{id:`ruleDescription`,value:a,onChange:e=>o(e.target.value),placeholder:`Describe when Tarsk should apply this rule...`,className:`resize-none min-h-[120px]`,disabled:u})}),(0,V.jsx)(O,{title:`Always Apply`,description:s?`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,V.jsx)(H,{id:`alwaysApply`,checked:s,onCheckedChange:c,disabled:u})}),(0,V.jsx)(I,{onContinue:()=>void m(),disabled:!p||!a.trim(),creating:u})]})]})}):(0,V.jsx)(D,{title:`No thread selected`,children:`Please select a thread to add a rule.`})}function U(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(...U(n.children));return t}function W(){let e=M(e=>e.selectedProjectId),h=M(e=>e.selectedThreadId),{setActiveMainTab:g}=fe(),{setPendingExplorerPath:_,triggerExplorerRefresh:v,setExplorerClearPath:S}=de(),[C,O]=(0,B.useState)([]),[k,j]=(0,B.useState)(!1),[I,L]=(0,B.useState)(!1),[R,z]=(0,B.useState)(null),[H,W]=(0,B.useState)(!1),[G,K]=(0,B.useState)([]),[q,J]=(0,B.useState)(new Set),{query:Y,setQuery:X,deferredQuery:Z}=pe(),Q=(0,B.useCallback)(async()=>{if(e){j(!0);try{let t=U(await n(e));if(h)try{let e=U(await p(h)),n=new Set(t.map(e=>e.path));for(let r of e)n.has(r.path)||t.push(r)}catch{}O(t),J(new Set(t.map(e=>e.path)))}catch{O([]),J(new Set)}finally{j(!1)}}},[e,h]);(0,B.useEffect)(()=>{Q()},[Q]),(0,B.useEffect)(()=>{x().then(K).catch(()=>K([]))},[]);let ye=(0,B.useCallback)(async t=>{if(!e)return;let n=t.name,r=t.path;W(!0);try{try{await c(e,r)}catch{if(h)await d(h,r);else throw Error(`No thread selected to delete from`)}S(r),v(),J(e=>{let t=new Set(e);return t.delete(r),t}),A({title:`Rule removed`,description:n}),z(null),await Q()}catch(e){A({title:`Error`,description:e instanceof Error?e.message:`Failed to remove rule`,variant:`destructive`})}finally{W(!1)}},[e,h,Q,v,S]),be=(0,B.useCallback)(e=>{_(e),g(`explorer`)},[_,g]),xe=(0,B.useCallback)(async e=>{let n=`.agents/rules/${e.name}.md`;if(!(!h||q.has(n)))try{e.gitHubRepo&&e.gitHubFolder?await b(h,e.gitHubRepo,e.gitHubFolder,`.agents/rules`):await t(h,n,[`---`,`description: ${e.description}`,`alwaysApply: ${e.alwaysApply??!1}`,`---`,``,e.content].join(`
|
|
8
|
+
`)),J(e=>new Set(e).add(n)),v(),Q(),A({title:`Rule installed`,description:e.name})}catch(e){A({title:`Error`,description:e instanceof Error?e.message:`Failed to install rule`,variant:`destructive`})}},[h,q,v,Q]),$=(0,B.useMemo)(()=>Z.trim()?G.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):G,[G,Z]);return e?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(T,{children:(0,V.jsxs)(ne,{children:[(0,V.jsx)(E,{title:`Rules`,description:`Manage agent rules. Rules define coding standards and project-wide guidelines.`,action:(0,V.jsx)(s,{onClick:()=>L(!0),disabled:!h,children:`Add Rule`})}),!h&&(0,V.jsx)(ue,{children:`Select a thread to add or install rules.`}),(0,V.jsx)(w,{title:`Installed`}),k?(0,V.jsxs)(`div`,{className:`space-y-3 mb-8`,children:[(0,V.jsx)(N,{className:`h-12 w-full`}),(0,V.jsx)(N,{className:`h-12 w-full`})]}):C.length===0?(0,V.jsx)(P,{icon:i,title:`No rules installed`,description:`Add rules to enforce coding standards and project conventions.`}):(0,V.jsx)(`div`,{className:`mb-8 overflow-hidden rounded-md border border-border`,children:C.map((e,t)=>(0,V.jsxs)(`div`,{className:l(`group grid min-h-13 grid-cols-[minmax(0,1fr)_1.75rem] items-center gap-3 px-3 py-3 hover:bg-muted/30`,t>0&&`border-t border-border`),children:[(0,V.jsx)(`button`,{type:`button`,onClick:()=>be(e.path),className:l(y.body,`truncate text-left`),children:e.name.replace(/\.mdc$/i,``)}),(0,V.jsx)(o,{children:(0,V.jsxs)(r,{children:[(0,V.jsx)(f,{asChild:!0,children:(0,V.jsx)(s,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`shrink-0 items-center justify-center text-muted-foreground opacity-0 pointer-events-none can-hover:group-hover:opacity-100 can-hover:group-hover:pointer-events-auto can-hover:hover:bg-destructive can-hover:hover:text-destructive-foreground transition-[opacity,color,background-color]`,onClick:()=>z(e),"aria-label":`Delete ${e.name.replace(/\.mdc$/i,``)}`,children:(0,V.jsx)(ee,{className:`h-4 w-4`})})}),(0,V.jsx)(a,{children:`Remove this rule from the project`})]})})]},e.id))}),(0,V.jsx)(w,{title:`Available`,className:`mb-0`}),(0,V.jsx)(me,{placeholder:`Search available rules...`,value:Y,onChange:X}),G.length===0?(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(N,{className:`h-20 w-full`}),(0,V.jsx)(N,{className:`h-20 w-full`})]}):$.length===0?(0,V.jsx)(ge,{searchQuery:Y,emptyLabel:`No available rules found.`}):(0,V.jsx)(he,{children:$.map(e=>{let t=`.agents/rules/${e.name}.md`,n=q.has(t);return(0,V.jsx)(F,{name:_e(e.name),description:e.description,installed:n,onClick:()=>{n||xe(e)},showInstalledControls:!1},e.id)})})]})}),(0,V.jsx)(m,{open:I,onOpenChange:L,children:(0,V.jsx)(u,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,V.jsx)(ve,{threadId:h,onRuleCreated:()=>{L(!1),Q(),v()}})})}),(0,V.jsx)(oe,{open:R!==null,onOpenChange:e=>!e&&z(null),children:(0,V.jsxs)(ce,{children:[(0,V.jsxs)(se,{children:[(0,V.jsx)(re,{children:`Delete Rule`}),(0,V.jsxs)(ie,{children:[`Are you sure you want to delete the rule "`,R?.name,`"? This action cannot be undone.`]})]}),(0,V.jsxs)(ae,{children:[(0,V.jsx)(te,{children:`Cancel`}),(0,V.jsx)(le,{onClick:()=>R&&void ye(R),disabled:H,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:H?`Deleting...`:`Delete`})]})]})})]}):(0,V.jsx)(D,{children:`Select a project to manage rules.`})}export{W as SettingsRulesView,W as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$r as t,$t as n,Cn as r,Ct as i,F as a,Fr as o,Gn as s,Ir as c,Lr as l,Mi as u,Mo as d,Mr as f,Mt as p,Nt as m,P as h,Pi as g,Pr as _,Qa as v,Qr as y,R as b,Rr as x,Rt as S,Sr as C,Ta as w,Un as T,Vi as E,Xr as D,Yr as O,dr as k,ds as A,ei as j,en as M,fr as N,fs as P,gr as F,ho as I,ja as ee,k as te,ms as L,ni as ne,nt as re,qr as R,ta as z,ti as ie,to as ae,tt as B,wr as V,yt as oe}from"./dialogs-config-BF_RyK5j.js";import{A as se,C as ce,D as le,E as ue,F as de,M as fe,N as pe,O as me,P as he,S as ge,T as _e,b as H,d as ve,f as ye,g as be,h as xe,j as Se,k as Ce,l as we,p as Te,x as Ee,y as De}from"./history-view-COEFPP2U.js";import{d as Oe}from"./onboarding-B_n7I3ri.js";import{A as ke,F as U,L as Ae,N as je,j as Me,z as Ne}from"./index-Dsj5zHdU.js";import{t as W}from"./skeleton-DJZ5x6e0.js";import{t as Pe}from"./use-deferred-search-BZg7Bt7W.js";import{a as Fe,n as Ie,r as Le,t as Re}from"./settings-list-Cc_0YmxB.js";import{t as ze}from"./mcp-server-card-3bFOnHFO.js";import{i as G,n as Be,r as K,t as Ve}from"./slug-utils-D4uxO5qv.js";var q=e(L(),1),J=A();function He({threadId:e,onSkillCreated:t}){let[n,r]=(0,q.useState)(``),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(!1),c=K(n),l=Be(c),u=async()=>{if(!(!l||!i.trim()||!e)){s(!0);try{let n=await te(e,c,i.trim());U({title:`Skill created`,description:`Skill '${c}' was created successfully.`}),r(``),a(``),t?.(n.path,`SKILL.md`)}catch(e){U({title:`Error`,description:e instanceof Error?e.message:`Failed to create skill`,variant:`destructive`})}finally{s(!1)}}};return e?(0,J.jsx)(le,{children:(0,J.jsxs)(De,{children:[(0,J.jsx)(ge,{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,J.jsxs)(`div`,{className:`space-y-6`,children:[(0,J.jsxs)(H,{title:`Skill Name`,children:[(0,J.jsx)(O,{id:`skillName`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Code Review`,disabled:o}),n?(0,J.jsxs)(`p`,{className:g(z.caption,`mt-2`),children:[`Folder name: `,(0,J.jsx)(`span`,{className:`font-mono`,children:c||`...`})]}):null]}),(0,J.jsx)(H,{title:`Description`,children:(0,J.jsx)(Ae,{id:`skillDescription`,value:i,onChange:e=>a(e.target.value),placeholder:`Describe when Tarsk should apply this skill`,className:`resize-none min-h-[120px]`,disabled:o})}),(0,J.jsx)(G,{onContinue:()=>void u(),disabled:!l||!i.trim(),creating:o})]})]})}):(0,J.jsx)(_e,{title:`No thread selected`,children:`Please select a thread to add a skill.`})}function Y(e){let t=[`---`,`name: ${e.id}`,`description: ${e.description}`];return e.allowedTools&&t.push(`allowed-tools: ${e.allowedTools}`),e.license&&t.push(`license: ${e.license}`),t.push(`---`,``,e.instructions??``),t.join(`
|
|
2
|
+
`)}function X(e){return e.endsWith(`.md`)||e.endsWith(`.mdx`)}function Ue(e){return e.includes(`SKILL.md`)?`SKILL.md`:e[0]??`SKILL.md`}function Z(e,t){let n=e?.sourceId??t;if(!(!n||n==="default"))return n}function We({open:e,onOpenChange:n,skill:r,catalogSourceId:i,onInstall:a}){let[o,s]=(0,q.useState)([]),[c,l]=(0,q.useState)(null),[f,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(!1),[_,v]=(0,q.useState)(!1),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(!1),w=Z(r,i),T=!!w;(0,q.useEffect)(()=>{if(!e||!r)return;let t=r,n=Z(t,i),a=!1;async function o(){h(!0),x(null),s([]),l(null),p(``);try{if(n){let e=await re(n,t.id);if(a)return;s(e.files),l(Ue(e.files))}else{if(a)return;s([`SKILL.md`]),l(`SKILL.md`),p(Y(t))}}catch(e){if(a)return;x(e instanceof Error?e.message:`Failed to load skill files`)}finally{a||h(!1)}}return o(),()=>{a=!0}},[e,r,i]),(0,q.useEffect)(()=>{if(!e||!r||!c||!T||!w)return;let t=r,n=c,i=!1;async function a(){v(!0),x(null);try{let e=await B(w,t.id,n);if(i)return;p(e.content)}catch(e){if(i)return;x(e instanceof Error?e.message:`Failed to load file`),p(``)}finally{i||v(!1)}}return a(),()=>{i=!0}},[e,r,c,T,w]);let E=(0,q.useCallback)(async()=>{if(!r)return;let e=w?{...r,sourceId:w}:r;C(!0);try{await a(e),n(!1)}finally{C(!1)}},[r,w,a,n]),O=m||T&&_,k=c?X(c):!1,A=(0,q.useMemo)(()=>o.map(e=>(0,J.jsxs)(Oe,{selected:e===c,onClick:()=>l(e),className:`gap-2 cursor-pointer`,children:[(0,J.jsx)(d,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,J.jsx)(`span`,{className:g(z.caption,`truncate`),children:e})]},e)),[o,c]);return(0,J.jsx)(D,{open:e,onOpenChange:n,children:(0,J.jsxs)(y,{className:`flex max-h-[90vh] max-w-5xl flex-col gap-0 overflow-hidden p-0`,children:[(0,J.jsxs)(ie,{className:`border-b border-border px-6 py-4`,children:[(0,J.jsx)(ne,{children:r?.name??`Review skill`}),r?.description?(0,J.jsx)(t,{children:r.description}):null]}),(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,J.jsxs)(`div`,{className:`flex max-h-40 shrink-0 flex-col border-b border-border sm:max-h-none sm:w-56 sm:border-b-0 sm:border-r`,children:[(0,J.jsx)(`div`,{className:g(z.labelMuted,`px-3 py-2`),children:`Files`}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-1 pb-2`,children:m?(0,J.jsx)(we,{className:`py-8`,label:`Loading files...`}):o.length===0?(0,J.jsx)(`p`,{className:g(z.caption,`px-3 py-2 text-muted-foreground`),children:`No files found.`}):A})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-4`,children:b?(0,J.jsx)(`p`,{className:g(z.body,`text-destructive`),children:b}):O?(0,J.jsx)(we,{className:`py-12`,label:`Loading preview...`}):k?(0,J.jsx)(je,{content:f,enableMermaid:!1}):(0,J.jsx)(`pre`,{className:g(z.caption,`overflow-x-auto whitespace-pre-wrap font-mono`),children:f})})]}),(0,J.jsxs)(j,{className:`border-t border-border px-6 py-4 sm:justify-between`,children:[(0,J.jsx)(u,{type:`button`,variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,J.jsx)(u,{type:`button`,onClick:()=>void E(),disabled:S||!r,children:S?`Installing...`:`Install`})]})]})})}var Ge=P(),Q=new Map;function Ke(e){let t=Q.get(e);if(t)return t;let n=p(e).finally(()=>{Q.delete(e)});return Q.set(e,n),n}function qe(e,t){return t.map(t=>({...t,sourceId:t.sourceId??e}))}function Je(){let e=(0,Ge.c)(18),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[r,i]=(0,q.useState)(t),[a,o]=(0,q.useState)(C),s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=[],e[1]=s):s=e[1];let[c,l]=(0,q.useState)(s),[u,d]=(0,q.useState)(!1),[p,h]=(0,q.useState)(!1),g;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=async()=>{try{i(await m())}catch{i([])}},e[2]=g):g=e[2];let v=g,y,b;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{(async function(){let e=F();if(e.length>0)try{await n(e),k()}catch{}await v()})()},b=[v],e[3]=y,e[4]=b):(y=e[3],b=e[4]),(0,q.useEffect)(y,b);let x;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{o(e),f(e)},e[5]=x):x=e[5];let S=x,w;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{i(t=>[...t.filter(t=>t.id!==e.id),e].sort(Xe)),S(e.id)},e[6]=w):w=e[6];let T=w,E;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{i(t=>t.map(t=>t.id===e.id?e:t).sort(Ye)),N(e.id)},e[7]=E):E=e[7];let D=E,O;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>{i(t=>t.filter(t=>t.id!==e)),N(e),o(t=>t===e?(f(`default`),`default`):t)},e[8]=O):O=e[8];let A=O,j,M;e[9]===a?(j=e[10],M=e[11]):(M=()=>{if(a==="default"){l([]),d(!1),h(!1);return}let e=V(a);e?.skills?(l(qe(a,e.skills)),d(!1)):(l([]),d(!0));let t=!1;return h(!!e?.skills),Ke(a).then(e=>{if(t)return;let n=qe(a,e);l(n),_(a,{fetchedAt:Date.now(),skills:n})}).catch(n=>{t||(e?.skills||l([]),U({title:`Error`,description:n instanceof Error?n.message:`Failed to load skill catalog`,variant:`destructive`}))}).finally(()=>{t||(d(!1),h(!1))}),()=>{t=!0}},j=[a],e[9]=a,e[10]=j,e[11]=M),(0,q.useEffect)(M,j);let P;return e[12]!==c||e[13]!==u||e[14]!==p||e[15]!==a||e[16]!==r?(P={sources:r,selectedSourceId:a,setSelectedSourceId:S,addSource:T,updateSource:D,removeSource:A,reloadSources:v,catalogSkills:c,isLoadingCatalog:u,isRefreshingCatalog:p},e[12]=c,e[13]=u,e[14]=p,e[15]=a,e[16]=r,e[17]=P):P=e[17],P}function Ye(e,t){return e.title.localeCompare(t.title)}function Xe(e,t){return e.title.localeCompare(t.title)}function Ze({open:e,onOpenChange:n,editingSource:r,onSourceAdded:i,onSourceUpdated:o,onSourceDeleted:c}){let[l,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(null),[_,v]=(0,q.useState)(!1),[b,x]=(0,q.useState)(!1),[S,C]=(0,q.useState)(!1),w=r!=null;function E(){d(``),p(``),h(null),v(!1),x(!1),C(!1)}function k(e){e||E(),n(e)}(0,q.useEffect)(()=>{if(e){if(r){d(r.title),p(r.url),h(null);return}d(``),p(``),h(null)}},[e,r]);async function A(){let e=l.trim(),t=f.trim();if(!e||!t){h(`Title and URL are required.`);return}v(!0),h(null);try{if(w&&r){let n=await T(r.id,e,t);o?.(n.source)}else i((await s(e,t)).source);k(!1)}catch(e){h(e instanceof Error?e.message:`Failed to verify skill source`)}finally{v(!1)}}async function M(){if(r){x(!0),h(null);try{await a(r.id),c?.(r.id),C(!1),k(!1)}catch(e){h(e instanceof Error?e.message:`Failed to delete skill source`),C(!1)}finally{x(!1)}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(D,{open:e,onOpenChange:k,children:(0,J.jsxs)(y,{className:`sm:max-w-lg`,children:[(0,J.jsxs)(ie,{children:[(0,J.jsx)(ne,{children:w?`Edit Skill Source`:`Add Skill Source`}),(0,J.jsx)(t,{children:w?`Update the title or GitHub skills folder URL for this custom source.`:`Add a GitHub skills folder URL. The source is verified by loading at least one skill from the repository.`})]}),(0,J.jsxs)(`div`,{className:`grid gap-4 py-2`,children:[(0,J.jsxs)(`div`,{className:`grid gap-2`,children:[(0,J.jsx)(R,{htmlFor:`skill-source-title`,children:`Title`}),(0,J.jsx)(O,{id:`skill-source-title`,placeholder:`e.g. My Team Skills`,value:l,onChange:e=>d(e.target.value),disabled:_||b,autoFocus:!0})]}),(0,J.jsxs)(`div`,{className:`grid gap-2`,children:[(0,J.jsx)(R,{htmlFor:`skill-source-url`,children:`URL`}),(0,J.jsx)(O,{id:`skill-source-url`,placeholder:`https://github.com/org/repo or .../tree/main/skills`,value:f,onChange:e=>p(e.target.value),disabled:_||b})]}),m?(0,J.jsx)(`p`,{className:g(z.caption,`text-destructive`),children:m}):null]}),(0,J.jsxs)(j,{className:`flex-col-reverse gap-2 sm:flex-row sm:justify-between`,children:[w?(0,J.jsx)(u,{type:`button`,variant:`destructive`,onClick:()=>C(!0),disabled:_||b,children:`Delete`}):(0,J.jsx)(`div`,{className:`hidden sm:block`}),(0,J.jsxs)(`div`,{className:`flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row`,children:[(0,J.jsx)(u,{variant:`outline`,onClick:()=>k(!1),disabled:_||b,children:`Cancel`}),(0,J.jsx)(u,{onClick:()=>void A(),disabled:_||b||!l.trim()||!f.trim(),children:_?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(I,{className:`mr-2 h-4 w-4 animate-spin`}),`Verifying...`]}):w?`Save Changes`:`Add Source`})]})]})]})}),(0,J.jsx)(me,{open:S,onOpenChange:C,children:(0,J.jsxs)(Se,{children:[(0,J.jsxs)(he,{children:[(0,J.jsx)(de,{children:`Delete Skill Source`}),(0,J.jsxs)(fe,{children:[`Are you sure you want to delete "`,r?.title,`"? This removes the source from your list but does not uninstall skills you already added.`]})]}),(0,J.jsxs)(pe,{children:[(0,J.jsx)(se,{disabled:b,children:`Cancel`}),(0,J.jsx)(Ce,{onClick:()=>void M(),disabled:b,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:b?`Deleting...`:`Delete`})]})]})})]})}function $(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(...$(n.children))}return t}function Qe(){let e=Ne(e=>e.selectedProjectId),t=Ne(e=>e.selectedThreadId),{setActiveMainTab:n}=Me(),{setPendingExplorerPath:a,triggerExplorerRefresh:s,setExplorerClearPath:d}=ke(),[f,p]=(0,q.useState)([]),[m,_]=(0,q.useState)(!1),[C,T]=(0,q.useState)(!1),[O,k]=(0,q.useState)(null),[A,j]=(0,q.useState)(!1),[N,P]=(0,q.useState)([]),[F,I]=(0,q.useState)(new Set),[te,L]=(0,q.useState)(null),[ne,re]=(0,q.useState)(!1),{query:R,setQuery:ie,deferredQuery:B}=Pe(),{sources:V,selectedSourceId:H,setSelectedSourceId:De,addSource:Oe,updateSource:Ae,removeSource:je,catalogSkills:G,isLoadingCatalog:Be}=Je(),K=H==="default",Y=(0,q.useMemo)(()=>E(H)?V.find(e=>e.id===H)??null:null,[H,V]),X=(0,q.useCallback)(async()=>{if(e){_(!0);try{let n=$(await i(e));if(t)try{let e=$(await S(t)),r=new Set(n.map(e=>e.path));for(let t of e)r.has(t.path)||n.push(t)}catch{}n.sort((e,t)=>e.name.localeCompare(t.name)),p(n),I(new Set(n.map(e=>`${e.path}/SKILL.md`)))}catch{p([]),I(new Set)}finally{_(!1)}}},[e,t]);(0,q.useEffect)(()=>{X()},[X]),(0,q.useEffect)(()=>{oe().then(P).catch(()=>P([]))},[]);let Ue=(0,q.useCallback)(async n=>{if(!e)return;let r=n.name,i=n.path;j(!0);try{try{await h(e,i)}catch{if(t)await b(t,i);else throw Error(`No thread selected to delete from`)}d(i),s(),I(e=>{let t=new Set(e);return t.delete(`${i}/SKILL.md`),t}),U({title:`Skill removed`,description:r}),k(null),await X()}catch(e){U({title:`Error`,description:e instanceof Error?e.message:`Failed to remove skill`,variant:`destructive`})}finally{j(!1)}},[e,t,X,s,d]),Z=(0,q.useCallback)(e=>{a(`${e}/SKILL.md`),n(`explorer`)},[a,n]),Ge=(0,q.useCallback)(async e=>{let n=`.agents/skills/${e.id}/SKILL.md`;if(!t||F.has(n))return;let i=e.sourceId??(H==="default"?void 0:H);try{if(i)await M(t,i,e.id,`.agents/skills/${e.id}`);else{let i=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.allowedTools&&i.push(`allowed-tools: ${e.allowedTools}`),e.license&&i.push(`license: ${e.license}`),i.push(`---`,``,e.instructions??``),await r(t,n,i.join(`
|
|
3
|
+
`))}I(e=>new Set(e).add(n)),s(),X(),U({title:`Skill installed`,description:e.name})}catch(e){throw U({title:`Error`,description:e instanceof Error?e.message:`Failed to install skill`,variant:`destructive`}),e}},[t,H,F,s,X]),Q=(0,q.useMemo)(()=>B.trim()?N.filter(e=>e.name.toLowerCase().includes(B.toLowerCase())||e.description.toLowerCase().includes(B.toLowerCase())):N,[N,B]),Ke=(0,q.useMemo)(()=>B.trim()?G.filter(e=>e.name.toLowerCase().includes(B.toLowerCase())||e.description.toLowerCase().includes(B.toLowerCase())):G,[G,B]),qe=K?N.length===0:Be&&G.length===0;return e?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(le,{children:(0,J.jsxs)(ue,{children:[(0,J.jsx)(ge,{title:`Skills`,description:`Manage agent skills. Skills are reusable instruction sets that guide agent behavior.`,action:(0,J.jsx)(u,{onClick:()=>T(!0),disabled:!t,children:`Add Skill`})}),!t&&(0,J.jsx)(Ee,{children:`Select a thread to add or install skills.`}),(0,J.jsx)(ce,{title:`Installed`}),m?(0,J.jsxs)(`div`,{className:`space-y-3 mb-8`,children:[(0,J.jsx)(W,{className:`h-12 w-full`}),(0,J.jsx)(W,{className:`h-12 w-full`})]}):f.length===0?(0,J.jsx)(Re,{icon:w,title:`No skills installed`,description:`Add skills to extend agent capabilities with reusable instructions.`}):(0,J.jsx)(`div`,{className:`mb-8 overflow-hidden rounded-md border border-border`,children:f.map((e,t)=>(0,J.jsxs)(`div`,{className:g(`group grid min-h-13 grid-cols-[minmax(0,1fr)_1.75rem] items-center gap-3 px-3 py-3 hover:bg-muted/30`,t>0&&`border-t border-border`),children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>Z(e.path),className:g(z.body,`truncate text-left`),children:e.name}),(0,J.jsx)(l,{children:(0,J.jsxs)(o,{children:[(0,J.jsx)(x,{asChild:!0,children:(0,J.jsx)(u,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`shrink-0 items-center justify-center text-muted-foreground opacity-0 pointer-events-none can-hover:group-hover:opacity-100 can-hover:group-hover:pointer-events-auto can-hover:hover:bg-destructive can-hover:hover:text-destructive-foreground transition-[opacity,color,background-color]`,onClick:()=>k(e),"aria-label":`Delete ${e.name}`,children:(0,J.jsx)(ee,{className:`h-4 w-4`})})}),(0,J.jsx)(c,{children:`Remove this skill from the project`})]})})]},e.id))}),(0,J.jsx)(ce,{title:`Available`,className:`mb-0`}),(0,J.jsx)(Fe,{search:{placeholder:`Search available skills...`,value:R,onChange:ie},trailing:(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(ve,{value:H,onValueChange:De,children:[(0,J.jsx)(xe,{className:`w-full min-w-0`,"aria-label":`Skill source`,children:(0,J.jsx)(be,{placeholder:`Default`})}),(0,J.jsxs)(ye,{children:[(0,J.jsx)(Te,{value:`default`,children:`Default`}),V.map(e=>(0,J.jsx)(Te,{value:e.id,children:e.title},e.id))]})]}),(0,J.jsx)(l,{children:(0,J.jsxs)(o,{children:[(0,J.jsx)(x,{asChild:!0,children:(0,J.jsx)(u,{type:`button`,variant:`outline`,size:`icon`,className:`shrink-0`,onClick:()=>re(!0),"aria-label":Y?`Edit skill source`:`Add skill source`,children:Y?(0,J.jsx)(ae,{className:`h-4 w-4`}):(0,J.jsx)(v,{className:`h-4 w-4`})})}),(0,J.jsx)(c,{children:Y?`Edit this custom skill source`:`Add a custom skill source`})]})})]})}),qe?K?(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsx)(W,{className:`h-20 w-full`}),(0,J.jsx)(W,{className:`h-20 w-full`})]}):(0,J.jsx)(we,{className:`py-12`,label:`Loading skills...`}):K?Q.length===0?(0,J.jsx)(Le,{searchQuery:R,emptyLabel:`No available skills found.`}):(0,J.jsx)(Ie,{children:Q.map(e=>{let t=`.agents/skills/${e.id}/SKILL.md`,n=F.has(t);return(0,J.jsx)(ze,{name:Ve(e.name),description:e.description,installed:n,onClick:()=>{n||L(e)},showInstalledControls:!1},e.id)})}):Ke.length===0?(0,J.jsx)(Le,{searchQuery:R,emptyLabel:`No available skills found.`}):(0,J.jsx)(Ie,{children:Ke.map(e=>{let t=`.agents/skills/${e.id}/SKILL.md`,n=F.has(t);return(0,J.jsx)(ze,{name:Ve(e.name),description:e.description,installed:n,onClick:()=>{n||L({...e,sourceId:e.sourceId??H})},showInstalledControls:!1},e.id)})})]})}),(0,J.jsx)(We,{open:te!==null,onOpenChange:e=>{e||L(null)},skill:te,catalogSourceId:K?void 0:H,onInstall:Ge}),(0,J.jsx)(Ze,{open:ne,onOpenChange:re,editingSource:Y,onSourceAdded:e=>{Oe(e),U({title:`Skill source added`,description:`${e.title} is now available in the source list.`})},onSourceUpdated:e=>{Ae(e),U({title:`Skill source updated`,description:`${e.title} has been saved.`})},onSourceDeleted:e=>{je(e),U({title:`Skill source removed`,description:`The custom source has been deleted.`})}}),(0,J.jsx)(D,{open:C,onOpenChange:T,children:(0,J.jsx)(y,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,J.jsx)(He,{threadId:t,onSkillCreated:()=>{T(!1),X(),s()}})})}),(0,J.jsx)(me,{open:O!==null,onOpenChange:e=>!e&&k(null),children:(0,J.jsxs)(Se,{children:[(0,J.jsxs)(he,{children:[(0,J.jsx)(de,{children:`Delete Skill`}),(0,J.jsxs)(fe,{children:[`Are you sure you want to delete the skill "`,O?.name,`"? This action cannot be undone.`]})]}),(0,J.jsxs)(pe,{children:[(0,J.jsx)(se,{children:`Cancel`}),(0,J.jsx)(Ce,{onClick:()=>O&&void Ue(O),disabled:A,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:A?`Deleting...`:`Delete`})]})]})})]}):(0,J.jsx)(_e,{children:`Select a project to manage skills.`})}export{Qe as SettingsSkillsView,Qe as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{E as t,Fr as n,I as r,Ir as i,Lr as a,Mi as o,Na as s,Pi as c,Pt as l,Qr as u,Rr as d,Xr as f,Yr as p,bt as m,ds as h,ja as g,ms as _,qr as v,ta as y,tn as b}from"./dialogs-config-BF_RyK5j.js";import{A as ee,C as x,D as S,E as te,F as ne,M as re,N as C,O as w,P as ie,S as T,T as E,b as D,j as O,k,x as ae,y as A}from"./history-view-COEFPP2U.js";import{A as oe,F as j,j as M,z as N}from"./index-Dsj5zHdU.js";import{t as P}from"./skeleton-DJZ5x6e0.js";import{n as F,t as I}from"./radio-group-CNuRXtN5.js";import{i as se,n as ce,r as L,t as le}from"./settings-list-Cc_0YmxB.js";import{t as ue}from"./mcp-server-card-3bFOnHFO.js";import{i as R,n as z,r as B}from"./slug-utils-D4uxO5qv.js";var V=e(_(),1),H=h();function de({projectId:e,threadId:n,onCommandCreated:r}){let[i,a]=(0,V.useState)(``),[o,s]=(0,V.useState)(``),[l,u]=(0,V.useState)(``),[d,f]=(0,V.useState)(`default`),[m,h]=(0,V.useState)(!1),g=B(i),_=z(g),b=async()=>{if(!(!_||!e)){h(!0);try{await t(g,``,{description:o.trim()||void 0,argumentHint:l.trim()||void 0,mode:d===`plan`?`plan`:void 0},`project`,n??void 0),j({title:`Command created`,description:`Command '/${g}' was created successfully.`}),a(``),s(``),u(``),f(`default`),r?.(g)}catch(e){j({title:`Error`,description:e instanceof Error?e.message:`Failed to create command`,variant:`destructive`})}finally{h(!1)}}};return e?(0,H.jsx)(S,{children:(0,H.jsxs)(A,{children:[(0,H.jsx)(T,{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,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsxs)(D,{title:`Command Name`,children:[(0,H.jsx)(p,{id:`commandName`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g. review`,disabled:m}),i?(0,H.jsxs)(`p`,{className:c(y.caption,`mt-2`),children:[`Command: `,(0,H.jsxs)(`span`,{className:`font-mono`,children:[`/`,g||`...`]})]}):null]}),(0,H.jsx)(D,{title:`Description`,children:(0,H.jsx)(p,{id:`commandDescription`,value:o,onChange:e=>s(e.target.value),placeholder:`Brief description shown in autocomplete`,disabled:m})}),(0,H.jsx)(D,{title:`Argument Hint`,description:`Shows after the command name to guide users what to type`,children:(0,H.jsx)(p,{id:`argumentHint`,value:l,onChange:e=>u(e.target.value),placeholder:`e.g. <focus-area> or <branch-name>`,disabled:m})}),(0,H.jsx)(D,{title:`Mode`,description:d==="default"?`Standard chat mode`:`Activates plan mode when this command is used`,children:(0,H.jsxs)(I,{value:d,onValueChange:e=>f(e),className:`flex gap-4`,disabled:m,children:[(0,H.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,H.jsx)(F,{value:`default`,id:`mode-default`}),(0,H.jsx)(v,{htmlFor:`mode-default`,className:c(y.labelNormal,`cursor-pointer`),children:`Default`})]}),(0,H.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,H.jsx)(F,{value:`plan`,id:`mode-plan`}),(0,H.jsx)(v,{htmlFor:`mode-plan`,className:c(y.labelNormal,`cursor-pointer`),children:`Plan`})]})]})}),(0,H.jsx)(R,{onContinue:()=>void b(),disabled:!_,creating:m})]})]})}):(0,H.jsx)(E,{title:`No project selected`,children:`Please select a project to add a slash command.`})}function U(){let e=N(e=>e.selectedProjectId),p=N(e=>e.selectedThreadId),{setActiveMainTab:h}=M(),{setPendingExplorerPath:_,triggerExplorerRefresh:v,setExplorerClearPath:D}=oe(),[A,F]=(0,V.useState)([]),[I,R]=(0,V.useState)(!1),[z,B]=(0,V.useState)(!1),[U,W]=(0,V.useState)(null),[G,K]=(0,V.useState)(!1),[q,J]=(0,V.useState)([]),[Y,X]=(0,V.useState)(new Map),[Z,fe]=(0,V.useState)(``),Q=(0,V.useCallback)(async()=>{if(p){R(!0);try{let e=await l(p);F(e.filter(e=>!e.isBuiltIn)),X(new Map(e.map(e=>[e.name,e.filePath])))}catch{F([]),X(new Map)}finally{R(!1)}}},[p]);(0,V.useEffect)(()=>{Q()},[Q]),(0,V.useEffect)(()=>{m().then(J).catch(()=>J([]))},[]);let pe=(0,V.useCallback)(async e=>{K(!0);try{await r(e.filePath),D(e.filePath),v(),X(t=>{let n=new Map(t);return n.delete(e.name),n}),j({title:`Command removed`,description:`/${e.name}`}),W(null),await Q()}catch(e){j({title:`Error`,description:e instanceof Error?e.message:`Failed to remove command`,variant:`destructive`})}finally{K(!1)}},[Q,v,D]),me=(0,V.useCallback)(e=>{_(e),h(`explorer`)},[_,h]),he=(0,V.useCallback)(e=>{let t=e.metadata?.description?.trim();return t&&t.length>0?t:`No description`},[]),ge=(0,V.useCallback)(async e=>{if(!(!p||Y.has(e.name)))try{if(e.gitHubRepo&&e.gitHubFolder){let t=`.agents/commands`;await b(p,e.gitHubRepo,e.gitHubFolder,t);let n=`${t}/${e.name}.md`;X(t=>new Map(t).set(e.name,n))}else{let n=await t(e.name,e.content,{description:e.description,argumentHint:e.argumentHint},`project`,p);X(t=>new Map(t).set(e.name,n.filePath))}v(),Q(),j({title:`Command installed`,description:`/${e.name}`})}catch(e){j({title:`Error`,description:e instanceof Error?e.message:`Failed to install command`,variant:`destructive`})}},[p,Y,v,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S,{children:(0,H.jsxs)(te,{children:[(0,H.jsx)(T,{title:`Slash Commands`,description:`Manage slash commands. Commands are quick actions available via / in chat.`,action:(0,H.jsx)(o,{onClick:()=>B(!0),disabled:!p,children:`Add Command`})}),!p&&(0,H.jsx)(ae,{children:`Select a thread to add or install slash commands.`}),(0,H.jsx)(x,{title:`Installed`}),I?(0,H.jsxs)(`div`,{className:`space-y-3 mb-8`,children:[(0,H.jsx)(P,{className:`h-12 w-full`}),(0,H.jsx)(P,{className:`h-12 w-full`})]}):A.length===0?(0,H.jsx)(le,{icon:s,title:`No slash commands installed`,description:`Add slash commands to create quick actions in chat.`}):(0,H.jsx)(`div`,{className:`mb-8 overflow-hidden rounded-md border border-border`,children:A.map((e,t)=>(0,H.jsxs)(`div`,{className:c(`group grid min-h-13 grid-cols-[minmax(0,1fr)_auto_1.75rem] items-center gap-3 px-3 py-3 hover:bg-muted/30`,t>0&&`border-t border-border`),children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>me(e.filePath),className:`min-w-0 text-left`,children:[(0,H.jsxs)(`div`,{className:c(y.body,`truncate`),children:[`/`,e.name]}),(0,H.jsx)(`div`,{className:c(y.compact,`truncate text-muted-foreground`),children:he(e)})]}),e.metadata?.mode?(0,H.jsx)(`span`,{className:c(y.compact,`bg-muted px-1.5 py-0.5 rounded flex-shrink-0`),children:e.metadata.mode}):(0,H.jsx)(`div`,{}),(0,H.jsx)(a,{children:(0,H.jsxs)(n,{children:[(0,H.jsx)(d,{asChild:!0,children:(0,H.jsx)(o,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`shrink-0 items-center justify-center text-muted-foreground opacity-0 pointer-events-none can-hover:group-hover:opacity-100 can-hover:group-hover:pointer-events-auto can-hover:hover:bg-destructive can-hover:hover:text-destructive-foreground transition-[opacity,color,background-color]`,onClick:()=>W(e),"aria-label":`Delete /${e.name}`,children:(0,H.jsx)(g,{className:`h-4 w-4`})})}),(0,H.jsx)(i,{children:`Remove this slash command from the project`})]})})]},e.filePath))}),(0,H.jsx)(x,{title:`Available`,className:`mb-0`}),(0,H.jsx)(se,{placeholder:`Search available commands...`,value:Z,onChange:fe}),q.length===0?(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(P,{className:`h-20 w-full`}),(0,H.jsx)(P,{className:`h-20 w-full`})]}):$.length===0?(0,H.jsx)(L,{searchQuery:Z,emptyLabel:`No available commands found.`}):(0,H.jsx)(ce,{children:$.map(e=>{let t=Y.has(e.name);return(0,H.jsx)(ue,{name:`/${e.name}`,description:e.description,installed:t,onClick:()=>{t||ge(e)},showInstalledControls:!1},e.id)})})]})}),(0,H.jsx)(f,{open:z,onOpenChange:B,children:(0,H.jsx)(u,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,H.jsx)(de,{projectId:e,threadId:p,onCommandCreated:()=>{B(!1),Q(),v()}})})}),(0,H.jsx)(w,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,H.jsxs)(O,{children:[(0,H.jsxs)(ie,{children:[(0,H.jsx)(ne,{children:`Delete Slash Command`}),(0,H.jsxs)(re,{children:[`Are you sure you want to delete "/`,U?.name,`"? This action cannot be undone.`]})]}),(0,H.jsxs)(C,{children:[(0,H.jsx)(ee,{children:`Cancel`}),(0,H.jsx)(k,{onClick:()=>U&&void pe(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,H.jsx)(E,{children:`Select a project to manage slash commands.`})}export{U as SettingsSlashCommandsView,U as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Cn as t,Ct as n,Ea as r,Fr as i,Ir as a,Lr as o,Mi as s,O as c,P as l,Pi as u,Qr as d,R as f,Rr as p,Rt as m,Xr as ee,Yr as h,ds as g,gt as te,ja as _,ms as v,ta as y,tn as ne}from"./dialogs-config-BF_RyK5j.js";import{A as b,C as x,D as S,E as re,F as ie,M as ae,N as oe,O as se,P as ce,S as C,T as w,b as T,j as E,k as D,x as O,y as k}from"./history-view-COEFPP2U.js";import{A,F as j,L as M,j as le,z as N}from"./index-Dsj5zHdU.js";import{t as P}from"./skeleton-DJZ5x6e0.js";import{i as ue,n as de,r as fe,t as pe}from"./settings-list-Cc_0YmxB.js";import{t as F}from"./mcp-server-card-3bFOnHFO.js";import{i as I,n as L,r as R}from"./slug-utils-D4uxO5qv.js";var z=e(v(),1),B=g();function me({threadId:e,onAgentCreated:t}){let[n,r]=(0,z.useState)(``),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(``),[l,d]=(0,z.useState)(!1),f=R(n),p=L(f),m=async()=>{if(!(!p||!i.trim()||!e)){d(!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,`AGENTS.md`)}catch(e){j({title:`Error`,description:e instanceof Error?e.message:`Failed to create agent`,variant:`destructive`})}finally{d(!1)}}};return e?(0,B.jsx)(S,{children:(0,B.jsxs)(k,{children:[(0,B.jsx)(C,{title:`Add Agent`,description:`Create a new agent. The agent will be saved as an AGENTS.md file in the .agents folder.`}),(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(T,{title:`Agent Name`,children:[(0,B.jsx)(h,{id:`agentName`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Code Reviewer`,disabled:l}),n?(0,B.jsxs)(`p`,{className:u(y.caption,`mt-2`),children:[`Folder name: `,(0,B.jsx)(`span`,{className:`font-mono`,children:f||`...`})]}):null]}),(0,B.jsx)(T,{title:`Description`,children:(0,B.jsx)(M,{id:`agentDescription`,value:i,onChange:e=>a(e.target.value),placeholder:`Describe the agent's purpose and behavior...`,className:`resize-none min-h-[120px]`,disabled:l})}),(0,B.jsx)(T,{title:`Tools`,description:`Optional space-separated list of tools this agent can use`,children:(0,B.jsx)(h,{id:`agentTools`,value:o,onChange:e=>s(e.target.value),placeholder:`e.g. read grep glob`,disabled:l})}),(0,B.jsx)(I,{onContinue:()=>void m(),disabled:!p||!i.trim(),creating:l})]})]})}):(0,B.jsx)(w,{title:`No thread selected`,children:`Please select a thread to add an agent.`})}function V(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(...V(n.children));return t}function H(){let e=N(e=>e.selectedProjectId),c=N(e=>e.selectedThreadId),{setActiveMainTab:h}=le(),{setPendingExplorerPath:g,triggerExplorerRefresh:v,setExplorerClearPath:T}=A(),[k,M]=(0,z.useState)([]),[I,L]=(0,z.useState)(!1),[R,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 Set),[Z,he]=(0,z.useState)(``),Q=(0,z.useCallback)(async()=>{if(e){L(!0);try{let t=V(await n(e));if(c)try{let e=V(await m(c)),n=new Set(t.map(e=>e.path));for(let r of e)n.has(r.path)||t.push(r)}catch{}t.sort((e,t)=>e.name.localeCompare(t.name)),M(t),X(new Set(t.map(e=>`${e.path}/AGENT.md`)))}catch{M([]),X(new Set)}finally{L(!1)}}},[e,c]);(0,z.useEffect)(()=>{Q()},[Q]),(0,z.useEffect)(()=>{te().then(J).catch(()=>J([]))},[]);let ge=(0,z.useCallback)(async t=>{if(!e)return;let n=t.name,r=t.path;K(!0);try{try{await l(e,r)}catch{if(c)await f(c,r);else throw Error(`No thread selected to delete from`)}T(r),v(),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,v,T]),_e=(0,z.useCallback)(e=>{g(`${e}/AGENT.md`),h(`explorer`)},[g,h]),ve=(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 ne(c,e.gitHubRepo,e.gitHubFolder,`.agents/agents/${e.id}`);else{let r=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.tools&&r.push(`tools: ${e.tools}`),r.push(`---`,``,e.systemPrompt),await t(c,n,r.join(`
|
|
2
|
+
`))}X(e=>new Set(e).add(n)),v(),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,v,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)(re,{children:[(0,B.jsx)(C,{title:`Subagents`,description:`Manage subagents. Subagents are specialized agents for focused tasks.`,action:(0,B.jsx)(s,{onClick:()=>H(!0),disabled:!c,children:`Add Subagent`})}),!c&&(0,B.jsx)(O,{children:`Select a thread to add or install subagents.`}),(0,B.jsx)(x,{title:`Installed`}),I?(0,B.jsxs)(`div`,{className:`space-y-3 mb-8`,children:[(0,B.jsx)(P,{className:`h-12 w-full`}),(0,B.jsx)(P,{className:`h-12 w-full`})]}):k.length===0?(0,B.jsx)(pe,{icon:r,title:`No subagents installed`,description:`Add subagents for specialized, focused tasks.`}):(0,B.jsx)(`div`,{className:`mb-8 overflow-hidden rounded-md border border-border`,children:k.map((e,t)=>(0,B.jsxs)(`div`,{className:u(`group grid min-h-13 grid-cols-[minmax(0,1fr)_1.75rem] items-center gap-3 px-3 py-3 hover:bg-muted/30`,t>0&&`border-t border-border`),children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>_e(e.path),className:u(y.body,`truncate text-left`),children:e.name}),(0,B.jsx)(o,{children:(0,B.jsxs)(i,{children:[(0,B.jsx)(p,{asChild:!0,children:(0,B.jsx)(s,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`shrink-0 items-center justify-center text-muted-foreground opacity-0 pointer-events-none can-hover:group-hover:opacity-100 can-hover:group-hover:pointer-events-auto can-hover:hover:bg-destructive can-hover:hover:text-destructive-foreground transition-[opacity,color,background-color]`,onClick:()=>W(e),"aria-label":`Delete ${e.name}`,children:(0,B.jsx)(_,{className:`h-4 w-4`})})}),(0,B.jsx)(a,{children:`Remove this subagent from the project`})]})})]},e.id))}),(0,B.jsx)(x,{title:`Available`,className:`mb-0`}),(0,B.jsx)(ue,{placeholder:`Search available subagents...`,value:Z,onChange:he}),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)(fe,{searchQuery:Z,emptyLabel:`No available subagents found.`}):(0,B.jsx)(de,{children:$.map(e=>{let t=`.agents/agents/${e.id}/AGENT.md`,n=Y.has(t);return(0,B.jsx)(F,{name:e.name,description:e.description,installed:n,onClick:()=>{n||ve(e)},showInstalledControls:!1},e.id)})})]})}),(0,B.jsx)(ee,{open:R,onOpenChange:H,children:(0,B.jsx)(d,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,B.jsx)(me,{threadId:c,onAgentCreated:()=>{H(!1),Q(),v()}})})}),(0,B.jsx)(se,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,B.jsxs)(E,{children:[(0,B.jsxs)(ce,{children:[(0,B.jsx)(ie,{children:`Delete Subagent`}),(0,B.jsxs)(ae,{children:[`Are you sure you want to delete the subagent "`,U?.name,`"? This action cannot be undone.`]})]}),(0,B.jsxs)(oe,{children:[(0,B.jsx)(b,{children:`Cancel`}),(0,B.jsx)(D,{onClick:()=>U&&void ge(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,B.jsx)(w,{children:`Select a project to manage subagents.`})}export{H as SettingsSubagentsView,H as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Et as t,Mi as n,Pi as r,Rn as i,ds as a,ho as o,ms as s,nn as c,qr as l,ta as u}from"./dialogs-config-BF_RyK5j.js";import{A as d,E as f,F as p,M as m,N as h,O as g,P as _,S as v,T as y,j as b,k as x,w as S}from"./history-view-COEFPP2U.js";import{a as C}from"./onboarding-B_n7I3ri.js";import{F as w,L as T,z as E}from"./index-Dsj5zHdU.js";var D=e(s(),1),O=a();function k(){let e=E(e=>e.selectedProjectId),[a,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(a),M(!0)}function K(e){if(!e){M(!1);return}if(k===a){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 i(e,{customSystemPrompt:j?null:k.trim(),useCustomSystemPrompt:!j}),c(),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)(S,{children:(0,O.jsxs)(f,{className:`w-full flex-1 flex flex-col min-h-0`,children:[(0,O.jsx)(v,{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)(n,{onClick:Y,disabled:L||z||!U(),children:z?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(o,{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)(C,{id:`use-generated-prompt`,checked:j,onCheckedChange:e=>K(e===!0),disabled:L||z}),(0,O.jsx)(l,{htmlFor:`use-generated-prompt`,className:r(u.labelNormal,`cursor-pointer`),children:`Generated`})]}),L?(0,O.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,O.jsx)(o,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,O.jsx)(T,{value:k,onChange:e=>W(e.target.value),className:r(u.mono,`flex-1 min-h-0 resize-none`),placeholder:`System prompt will appear here...`,disabled:z})]})}),(0,O.jsx)(g,{open:V,onOpenChange:H,children:(0,O.jsxs)(b,{children:[(0,O.jsxs)(_,{children:[(0,O.jsx)(p,{children:`Overwrite custom system prompt?`}),(0,O.jsx)(m,{children:`This will replace your custom system prompt with the generated default. You can save the change after confirming.`})]}),(0,O.jsxs)(h,{children:[(0,O.jsx)(d,{onClick:J,children:`No`}),(0,O.jsx)(x,{onClick:q,children:`Yes`})]})]})})]}):(0,O.jsx)(y,{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-BaTUBgdM.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-Dsj5zHdU.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-COEFPP2U.js","assets/dialogs-config-BF_RyK5j.js","assets/onboarding-B_n7I3ri.js","assets/vosk-speech-FJiKHPe4.js","assets/react-vendor-D-z0br-z.js","assets/utils-H-1x3dmp.js","assets/index-DzUALYN4.css","assets/project-settings-view-DsVEiQM_.js","assets/radio-group-CNuRXtN5.js","assets/providers-list-view-BT5XZP-F.js","assets/model-star-rating-GWRgO9pY.js","assets/skeleton-DJZ5x6e0.js","assets/tabs-TGCt-ze0.js","assets/use-deferred-search-BZg7Bt7W.js","assets/settings-models-view-CNFB1Iqn.js","assets/settings-models-skeleton-BfIx9XDs.js","assets/settings-list-Cc_0YmxB.js","assets/settings-mcp-servers-view-BcuuyWhI.js","assets/mcp-server-card-3bFOnHFO.js","assets/settings-skills-view-DV-cA6cj.js","assets/slug-utils-D4uxO5qv.js","assets/settings-rules-view-BvelCH4j.js","assets/settings-slash-commands-view-CKxQnzse.js","assets/settings-subagents-view-DAl5Db-p.js","assets/settings-instructions-view-Bit7tYRh.js","assets/settings-system-prompt-view-BdwsxqMo.js","assets/account-view-CGokQA1o.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ba as t,Da as n,Dt as r,Ea as i,Ga as a,Ha as o,La as s,Mi as c,Na as l,Pi as u,Ta as d,Wo as f,ao as p,as as m,bo as h,ds as g,ea as _,fs as v,ko as y,mn as b,ms as x,nn as S,rs as C,ta as w}from"./dialogs-config-BF_RyK5j.js";import{Ft as ee,It as te,Pt as ne}from"./react-vendor-D-z0br-z.js";import{r as T}from"./monaco-CZnIWXyV.js";import{D as E,E as D,T as O}from"./history-view-COEFPP2U.js";import{d as k,l as A}from"./onboarding-B_n7I3ri.js";import{P as j,R as M,V as re,d as ie,l as N,u as P,y as F,z as I}from"./index-Dsj5zHdU.js";import{t as L}from"./settings-models-skeleton-BfIx9XDs.js";var R=v(),z=e(x(),1),B=g(),ae=(0,z.forwardRef)(function(e,t){let n=(0,R.c)(28),{sidebar:r,children:i,defaultSidebarSize:a,minSidebarSize:o,maxSidebarSize:s,minContentSize:c,collapsible:l,collapsedSize:d,className:f,onCollapse:p,onExpand:m,isMobile:h,mobileShowSidebar:g}=e,_=a===void 0?25:a,v=o===void 0?20:o,y=s===void 0?30:s,b=c===void 0?40:c,x=l===void 0?!1:l,S=d===void 0?0:d,C=f===void 0?``:f,w=h===void 0?!1:h,ee=g===void 0?!0:g,te=w&&!ee,ne=w&&ee,T=`h-full ${C}`,E=w?100:_,D=w?50:v,O=w?100:y,k=te&&`hidden`,A;n[0]===k?A=n[1]:(A=u(`border-r border-transparent`,k),n[0]=k,n[1]=A);let j;n[2]!==S||n[3]!==x||n[4]!==p||n[5]!==m||n[6]!==t||n[7]!==r||n[8]!==E||n[9]!==D||n[10]!==O||n[11]!==A?(j=(0,B.jsx)(P,{ref:t,defaultSize:E,minSize:D,maxSize:O,collapsible:x,collapsedSize:S,onCollapse:p,onExpand:m,className:A,children:r}),n[2]=S,n[3]=x,n[4]=p,n[5]=m,n[6]=t,n[7]=r,n[8]=E,n[9]=D,n[10]=O,n[11]=A,n[12]=j):j=n[12];let M;n[13]===w?M=n[14]:(M=!w&&(0,B.jsx)(N,{withHandle:!0,className:`ml-[-40px]`}),n[13]=w,n[14]=M);let re=ne&&`hidden`,F;n[15]===re?F=n[16]:(F=u(`overflow-hidden`,re),n[15]=re,n[16]=F);let I;n[17]!==i||n[18]!==b||n[19]!==F?(I=(0,B.jsx)(P,{minSize:b,className:F,children:i}),n[17]=i,n[18]=b,n[19]=F,n[20]=I):I=n[20];let L;n[21]!==j||n[22]!==M||n[23]!==I?(L=(0,B.jsxs)(ie,{direction:`horizontal`,className:`h-full`,children:[j,M,I]}),n[21]=j,n[22]=M,n[23]=I,n[24]=L):L=n[24];let z;return n[25]!==T||n[26]!==L?(z=(0,B.jsx)(`div`,{className:T,children:L}),n[25]=T,n[26]=L,n[27]=z):z=n[27],z}),oe=[{id:`providers`,label:`Providers`,icon:(0,B.jsx)(f,{className:`h-4 w-4`}),route:`/settings/providers`},{id:`models`,label:`Models`,icon:(0,B.jsx)(C,{className:`h-4 w-4`}),route:`/settings/models`},{id:`skills`,label:`Skills`,icon:(0,B.jsx)(d,{className:`h-4 w-4`}),route:`/settings/skills`},{id:`rules`,label:`Rules`,icon:(0,B.jsx)(a,{className:`h-4 w-4`}),route:`/settings/rules`},{id:`slash-commands`,label:`Slash Commands`,icon:(0,B.jsx)(l,{className:`h-4 w-4`}),route:`/settings/slash-commands`},{id:`subagents`,label:`Subagents`,icon:(0,B.jsx)(i,{className:`h-4 w-4`}),route:`/settings/subagents`},{id:`instructions`,label:`Instructions`,icon:(0,B.jsx)(m,{className:`h-4 w-4`}),route:`/settings/instructions`},{id:`system-prompt`,label:`System Prompt`,icon:(0,B.jsx)(s,{className:`h-4 w-4`}),route:`/settings/system-prompt`},{id:`mcp-servers`,label:`MCP Servers`,icon:(0,B.jsx)(o,{className:`h-4 w-4`}),route:`/settings/mcp-servers`},{id:`general`,label:`General`,icon:(0,B.jsx)(t,{className:`h-4 w-4`}),route:`/settings/general`},{id:`history`,label:`History`,icon:(0,B.jsx)(h,{className:`h-4 w-4`}),route:`/settings/history`},{id:`account`,label:`Account`,icon:(0,B.jsx)(n,{className:`h-4 w-4`}),route:`/settings/account`}];function V(e){let t=[...oe];if(!e)return t;let n=t.findIndex(e=>e.id===`skills`);return t.splice(n,0,{id:`project`,label:`Project`,icon:(0,B.jsx)(y,{className:`h-4 w-4`}),route:`/settings/project/${e}`}),t}function se(e){let t=(0,R.c)(21),{className:n,selectedProjectId:r,onResetOnboarding:i,onNavItemSelect:a}=e,o=ee(),s=ne(),c=(0,z.useRef)(0),l=(0,z.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,z.useEffect)(u,d);let f=F(),p;t[2]===r?p=t[3]:(p=V(r),t[2]=r,t[3]=p);let m=p,h;t[4]!==f||t[5]!==m?(h=f?m.filter(ce):m,t[4]=f,t[5]=m,t[6]=h):h=t[6];let g=h,_;t[7]!==s.pathname||t[8]!==g?(_=function(){let e=s.pathname;if(e.startsWith(`/settings/project/`))return`project`;for(let t of g)if(e.startsWith(t.route))return t.id;return`general`}(),t[7]=s.pathname,t[8]=g,t[9]=_):_=t[9];let v=_,y,b;if(t[10]!==v||t[11]!==n||t[12]!==g||t[13]!==o||t[14]!==a||t[15]!==i){let e=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)};y=`space-y-1${n?` ${n}`:``}`,b=g.map((t,n)=>(0,B.jsxs)(z.Fragment,{children:[(0,B.jsx)(k,{selected:v===t.id,asChild:!0,children:(0,B.jsx)(`button`,{className:`justify-start`,onClick:()=>e(t),children:(0,B.jsxs)(`span`,{className:`flex items-center gap-2`,children:[t.icon,(0,B.jsx)(`span`,{children:t.label})]})})}),(t.id===`models`||t.id===`mcp-servers`||n===g.length-1)&&(0,B.jsx)(A,{className:`my-2 bg-sidebar-border`})]},t.id)),t[10]=v,t[11]=n,t[12]=g,t[13]=o,t[14]=a,t[15]=i,t[16]=y,t[17]=b}else y=t[16],b=t[17];let x;return t[18]!==y||t[19]!==b?(x=(0,B.jsx)(`div`,{className:y,children:b}),t[18]=y,t[19]=b,t[20]=x):x=t[20],x}function ce(e){return e.id!==`account`}var le=(0,z.lazy)(()=>T(()=>import(`./settings-general-view-BaTUBgdM.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),ue=(0,z.lazy)(()=>T(()=>import(`./project-settings-view-DsVEiQM_.js`),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11,13]))),de=(0,z.lazy)(()=>T(()=>import(`./providers-list-view-BT5XZP-F.js`),__vite__mapDeps([14,1,5,6,7,15,16,17,9,3,4,18]))),fe=(0,z.lazy)(()=>T(()=>import(`./settings-models-view-CNFB1Iqn.js`),__vite__mapDeps([19,1,5,6,7,15,20,16,21,17,9,3,4,18]))),pe=(0,z.lazy)(()=>T(()=>import(`./settings-mcp-servers-view-BcuuyWhI.js`),__vite__mapDeps([22,1,2,3,4,5,6,7,8,9,10,11,23,21,16,17]))),me=(0,z.lazy)(()=>T(()=>import(`./settings-skills-view-DV-cA6cj.js`),__vite__mapDeps([24,1,2,3,4,5,6,7,8,9,10,11,23,25,21,16,18]))),he=(0,z.lazy)(()=>T(()=>import(`./settings-rules-view-BvelCH4j.js`),__vite__mapDeps([26,1,2,3,4,5,6,7,8,9,10,11,23,25,21,16,18]))),ge=(0,z.lazy)(()=>T(()=>import(`./settings-slash-commands-view-CKxQnzse.js`),__vite__mapDeps([27,1,2,3,4,5,6,7,8,9,10,11,23,25,13,21,16]))),_e=(0,z.lazy)(()=>T(()=>import(`./settings-subagents-view-DAl5Db-p.js`),__vite__mapDeps([28,1,2,3,4,5,6,7,8,9,10,11,23,25,21,16]))),ve=(0,z.lazy)(()=>T(()=>import(`./settings-instructions-view-Bit7tYRh.js`),__vite__mapDeps([29,1,2,3,4,5,6,7,8,9,10,11]))),ye=(0,z.lazy)(()=>T(()=>import(`./settings-system-prompt-view-BdwsxqMo.js`),__vite__mapDeps([30,1,2,3,4,5,6,7,8,9,10,11]))),be=(0,z.lazy)(()=>T(()=>import(`./account-view-CGokQA1o.js`),__vite__mapDeps([31,1,2,3,4,5,6,7,8,9,10,11,16]))),xe=(0,z.lazy)(()=>T(()=>import(`./history-view-COEFPP2U.js`).then(e=>e.t),__vite__mapDeps([5,1,6]))),Se=[`general`,`providers`,`models`,`skills`,`rules`,`slash-commands`,`subagents`,`instructions`,`system-prompt`,`mcp-servers`,`history`,`account`];function H(e){let t=(0,R.c)(2),{title:n}=e,r;return t[0]===n?r=t[1]:(r=(0,B.jsx)(O,{title:n,children:`Content coming soon...`}),t[0]=n,t[1]=r),r}function Ce(){let e=(0,R.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,B.jsxs)(`div`,{className:`mb-6`,children:[(0,B.jsx)(`div`,{className:`h-8 w-32 bg-muted rounded animate-pulse mb-2`}),(0,B.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,B.jsx)(`div`,{className:`mb-6`,children:(0,B.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,B.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,B.jsxs)(`div`,{children:[r,(0,B.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,B.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,B.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`})]})]}),a=(0,B.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,B.jsx)(E,{children:(0,B.jsxs)(D,{children:[t,n,(0,B.jsxs)(`div`,{className:`space-y-8`,children:[i,(0,B.jsxs)(`div`,{children:[a,(0,B.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,B.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,B.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,B.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,B.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`})]})]})]})]})}),e[5]=o):o=e[5],o}function we(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 Te(e){let t=e.match(/^\/settings\/providers\/([^/]+)$/);return t?decodeURIComponent(t[1]):null}function U(){let e=(0,R.c)(62),{tab:t,projectId:n}=te(),i=ee(),a=ne(),o=M(),s=I(Oe),l=I(De),d;e[0]!==a.pathname||e[1]!==n?(d=!!n&&a.pathname.startsWith(`/settings/project/`),e[0]=a.pathname,e[1]=n,e[2]=d):d=e[2];let f=d,m;e[3]===a.pathname?m=e[4]:(m=Te(a.pathname),e[3]=a.pathname,e[4]=m);let h=m!==null,g;if(e[5]!==a.pathname||e[6]!==a.search||e[7]!==t){let n=new URLSearchParams(a.search).get(`tab`);g=n&&Se.includes(n)?n:t&&Se.includes(t)?t:we(a.pathname),e[5]=a.pathname,e[6]=a.search,e[7]=t,e[8]=g}else g=e[8];let v=g,y=F(),[x,C]=(0,z.useState)(!1),[T,E]=(0,z.useState)(!0),[D,O]=(0,z.useState)(0),k=(0,z.useRef)(null),A;bb0:{if(f){A=`Project`;break bb0}let t;e[9]===v?t=e[10]:(t=oe.find(e=>e.id===v)?.label??`Settings`,e[9]=v,e[10]=t),A=t}let ie=A,N;e[11]===y?N=e[12]:(N=()=>{y&&E(!1)},e[11]=y,e[12]=N);let P=N,V;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{E(!0)},e[13]=V):V=e[13];let ce=V,U;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(U=async()=>{try{await b(),O(Ee)}catch(e){console.error(`Failed to reset onboarding:`,e)}},e[14]=U):U=e[14];let ke=U,W;e[15]===i?W=e[16]:(W=()=>{i(`/`)},e[15]=i,e[16]=W);let Ae=W,G;e[17]===s?G=e[18]:(G=s?{type:`project`,id:s}:void 0,e[17]=s,e[18]=G);let je=G,K;e[19]===i?K=e[20]:(K=()=>{i(`/settings/general`)},e[19]=i,e[20]=K);let Me=K,q;e[21]!==o||e[22]!==n?(q=async()=>{S(n);try{let e=await r();o({type:re.SetProjects,projects:e.projects})}catch(e){let t=e;throw console.error(`Failed to refresh projects after settings update:`,t),t}},e[21]=o,e[22]=n,e[23]=q):q=e[23];let Ne=q,J,Pe;e[24]!==y||e[25]!==a.pathname||e[26]!==i?(J=()=>{(a.pathname===`/settings`||a.pathname===`/settings/project`||[`/settings/mcp-server-edit`,`/settings/add-skill`,`/settings/add-command`,`/settings/add-rule`,`/settings/add-agent`].some(e=>a.pathname.startsWith(e))||y&&a.pathname.startsWith(`/settings/account`))&&i(`/settings/general`,{replace:!0})},Pe=[a.pathname,i,y],e[24]=y,e[25]=a.pathname,e[26]=i,e[27]=J,e[28]=Pe):(J=e[27],Pe=e[28]),(0,z.useEffect)(J,Pe);let Y;e[29]!==Ae||e[30]!==P||e[31]!==s?(Y=()=>(0,B.jsx)(j,{onTitleClose:Ae,subtitle:`Settings`,children:(0,B.jsx)(`div`,{className:`px-2 py-2`,children:(0,B.jsx)(se,{selectedProjectId:s,onResetOnboarding:ke,onNavItemSelect:P})})}),e[29]=Ae,e[30]=P,e[31]=s,e[32]=Y):Y=e[32];let Fe=Y,Ie;e[33]!==v||e[34]!==Me||e[35]!==Ne||e[36]!==je||e[37]!==f||e[38]!==D||e[39]!==n||e[40]!==l?(Ie=()=>{if(f&&n)return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Project Settings`}),children:(0,B.jsx)(ue,{projectId:n,onProjectUpdated:Ne})});switch(v){case`general`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`General`}),children:(0,B.jsx)(le,{onboardingResetSignal:D})});case`providers`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(Ce,{}),children:(0,B.jsx)(de,{})});case`models`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(L,{}),children:(0,B.jsx)(fe,{})});case`skills`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Skills`}),children:(0,B.jsx)(me,{})});case`rules`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Rules`}),children:(0,B.jsx)(he,{})});case`slash-commands`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Slash Commands`}),children:(0,B.jsx)(ge,{})});case`subagents`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Subagents`}),children:(0,B.jsx)(_e,{})});case`instructions`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Instructions`}),children:(0,B.jsx)(ve,{})});case`system-prompt`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`System Prompt`}),children:(0,B.jsx)(ye,{})});case`mcp-servers`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`MCP Servers`}),children:(0,B.jsx)(pe,{})});case`history`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`History`}),children:(0,B.jsx)(xe,{isOpen:!0,onClose:Me,initialFilter:je,projects:l,inline:!0})});case`account`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Account`}),children:(0,B.jsx)(be,{})});default:return(0,B.jsx)(H,{title:`Settings`})}},e[33]=v,e[34]=Me,e[35]=Ne,e[36]=je,e[37]=f,e[38]=D,e[39]=n,e[40]=l,e[41]=Ie):Ie=e[41];let Le=Ie,Re,ze;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Re=()=>C(!0),ze=()=>C(!1),e[42]=Re,e[43]=ze):(Re=e[42],ze=e[43]);let X;e[44]===Fe?X=e[45]:(X=Fe(),e[44]=Fe,e[45]=X);let Be=`flex-1 overflow-auto ${x&&!y?`ml-[40px]`:``}`,Z;e[46]!==ie||e[47]!==y||e[48]!==h||e[49]!==T?(Z=y&&!T&&!h?(0,B.jsx)(`div`,{className:u(_.settingsPage,`pb-0`),children:(0,B.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-center gap-2`,children:[(0,B.jsxs)(c,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground`,onClick:ce,children:[(0,B.jsx)(p,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Show settings menu`})]}),(0,B.jsx)(`span`,{className:u(w.sectionTitle,`truncate text-foreground`),children:ie})]})}):null,e[46]=ie,e[47]=y,e[48]=h,e[49]=T,e[50]=Z):Z=e[50];let Q;e[51]===Le?Q=e[52]:(Q=Le(),e[51]=Le,e[52]=Q);let $;e[53]!==Be||e[54]!==Z||e[55]!==Q?($=(0,B.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,B.jsxs)(`div`,{className:Be,children:[Z,Q]})}),e[53]=Be,e[54]=Z,e[55]=Q,e[56]=$):$=e[56];let Ve;return e[57]!==y||e[58]!==T||e[59]!==X||e[60]!==$?(Ve=(0,B.jsx)(ae,{ref:k,collapsible:!0,isMobile:y,mobileShowSidebar:T,onCollapse:Re,onExpand:ze,sidebar:X,children:$}),e[57]=y,e[58]=T,e[59]=X,e[60]=$,e[61]=Ve):Ve=e[61],Ve}function Ee(e){return e+1}function De(e){return e.projects}function Oe(e){return e.selectedProjectId}export{U as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Pi as e,ds as t,fs as n}from"./dialogs-config-BF_RyK5j.js";var r=n(),i=t();function a(t){let n=(0,r.c)(8),a,o;n[0]===t?(a=n[1],o=n[2]):({className:a,...o}=t,n[0]=t,n[1]=a,n[2]=o);let s;n[3]===a?s=n[4]:(s=e(`animate-pulse rounded-md bg-muted`,a),n[3]=a,n[4]=s);let c;return n[5]!==o||n[6]!==s?(c=(0,i.jsx)(`div`,{className:s,...o}),n[5]=o,n[6]=s,n[7]=c):c=n[7],c}export{a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{$o as e,Mi as t,ds as n,fs as r,ho as i}from"./dialogs-config-BF_RyK5j.js";var a=r(),o=n();function s(n){let r=(0,a.c)(6),{onContinue:s,disabled:c,creating:l}=n,u=c||l,d;r[0]===l?d=r[1]:(d=l?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(i,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,o.jsxs)(o.Fragment,{children:[`Continue`,(0,o.jsx)(e,{className:`ml-2 h-4 w-4`})]}),r[0]=l,r[1]=d);let f;return r[2]!==s||r[3]!==u||r[4]!==d?(f=(0,o.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,o.jsx)(t,{onClick:s,disabled:u,children:d})}),r[2]=s,r[3]=u,r[4]=d,r[5]=f):f=r[5],f}function c(e){return e.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``)}function l(e){return e.replace(/-/g,` `).split(/\s+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function u(e){return e.length>0&&e.length<=64}export{s as i,u as n,c as r,l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Pi as t,ds as n,fs as r,ms as i}from"./dialogs-config-BF_RyK5j.js";import{c as a,d as o,l as s,u as c}from"./react-vendor-D-z0br-z.js";var l=r(),u=e(i(),1),d=n(),f=c,p=u.forwardRef((e,n)=>{let r=(0,l.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=t(`inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground`,i),r[3]=i,r[4]=o);let c;return r[5]!==a||r[6]!==n||r[7]!==o?(c=(0,d.jsx)(s,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=c):c=r[8],c});p.displayName=s.displayName;var m=u.forwardRef((e,n)=>{let r=(0,l.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let s;r[3]===i?s=r[4]:(s=t(`inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-base font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm`,i),r[3]=i,r[4]=s);let c;return r[5]!==a||r[6]!==n||r[7]!==s?(c=(0,d.jsx)(o,{ref:n,className:s,...a}),r[5]=a,r[6]=n,r[7]=s,r[8]=c):c=r[8],c});m.displayName=o.displayName;var h=u.forwardRef((e,n)=>{let r=(0,l.c)(9),i,o;r[0]===e?(i=r[1],o=r[2]):({className:i,...o}=e,r[0]=e,r[1]=i,r[2]=o);let s;r[3]===i?s=r[4]:(s=t(`mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,i),r[3]=i,r[4]=s);let c;return r[5]!==o||r[6]!==n||r[7]!==s?(c=(0,d.jsx)(a,{ref:n,className:s,...o}),r[5]=o,r[6]=n,r[7]=s,r[8]=c):c=r[8],c});h.displayName=a.displayName;export{m as i,h as n,p as r,f as t};
|