tarsk 0.5.53 → 0.5.55
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/dist/index.js +2305 -1255
- package/dist/public/assets/{account-view-5qdPli2O.js → account-view-CkhRveFm.js} +1 -1
- package/dist/public/assets/{api-DM6LtnPA.js → api-BUjKoVUu.js} +1 -1
- package/dist/public/assets/browser-tab-DbT2QjH_.js +8 -0
- package/dist/public/assets/commit-dialog-DRMKciNP.js +1 -0
- package/dist/public/assets/context-menu-DO3hiSAo.js +1 -0
- package/dist/public/assets/create-repo-dialog-CXiWjkFb.js +1 -0
- package/dist/public/assets/dialogs-config-86QTDk4G.js +51 -0
- package/dist/public/assets/{diff-view-DxSswxah.js → diff-view-D_xoUbUb.js} +2 -2
- package/dist/public/assets/{explorer-tab-view-DMt-0Zcl.js → explorer-tab-view-JIMdE8cA.js} +2 -2
- package/dist/public/assets/{explorer-tree-D3nyQX1f.js → explorer-tree-B60M0QAV.js} +1 -1
- package/dist/public/assets/{explorer-view-BRBtKxsw.js → explorer-view-BBaEk8i9.js} +2 -2
- package/dist/public/assets/git-history-dialog-DfzFi0Nx.js +1 -0
- package/dist/public/assets/git-ops-button-C_4iUio-.js +2 -0
- package/dist/public/assets/history-view-BsN806ip.js +9 -0
- package/dist/public/assets/index-C2iIghSR.js +81 -0
- package/dist/public/assets/mcp-server-card-DUJUtQq-.js +1 -0
- package/dist/public/assets/merged-pr-dialog-DVNtED4V.js +1 -0
- package/dist/public/assets/model-star-rating-DrR6jzjq.js +1 -0
- package/dist/public/assets/onboarding-DCrFdRM5.js +1 -0
- package/dist/public/assets/{project-settings-view-XGHhtLr_.js → project-settings-view-DRL5CTSQ.js} +1 -1
- package/dist/public/assets/{providers-list-view-Cbndeobz.js → providers-list-view-DkmgzncX.js} +1 -1
- package/dist/public/assets/pull-request-dialog-CPjzwrdo.js +1 -0
- package/dist/public/assets/pull-with-changes-dialog-DLfDpEEX.js +1 -0
- package/dist/public/assets/push-before-pr-dialog-v-3J53Hw.js +1 -0
- package/dist/public/assets/radio-group-C7-1cZ2t.js +1 -0
- package/dist/public/assets/{react-vendor-U9lUQswz.js → react-vendor-DK2COBjg.js} +5 -5
- package/dist/public/assets/settings-general-view-BZZs0t0d.js +1 -0
- package/dist/public/assets/{settings-instructions-view-CRUCeWUk.js → settings-instructions-view-CE-ugC91.js} +1 -1
- package/dist/public/assets/{settings-list-BapKAJV3.js → settings-list-CICo_cz2.js} +1 -1
- package/dist/public/assets/settings-mcp-servers-view-DKviDm0q.js +5 -0
- package/dist/public/assets/{settings-models-skeleton-B7TMwjxe.js → settings-models-skeleton-MXSIpmT8.js} +1 -1
- package/dist/public/assets/{settings-models-view-ObE_ktqH.js → settings-models-view-DWqPx-2m.js} +1 -1
- package/dist/public/assets/settings-rules-view-Cq-60UOT.js +8 -0
- package/dist/public/assets/{settings-skills-view-MZQjnD_g.js → settings-skills-view-B6srjIvU.js} +3 -3
- package/dist/public/assets/settings-slash-commands-view-j8NdZX1V.js +1 -0
- package/dist/public/assets/settings-subagents-view-4LusGYrq.js +2 -0
- package/dist/public/assets/{settings-system-prompt-view-CZe9uYNN.js → settings-system-prompt-view-DPMiLsrM.js} +1 -1
- package/dist/public/assets/{settings-view-BQL9vEvw.js → settings-view-0Idf-mDz.js} +2 -2
- package/dist/public/assets/skeleton-BvvAbfo4.js +1 -0
- package/dist/public/assets/slug-utils-jE4NOx-f.js +1 -0
- package/dist/public/assets/tabs-0fGgot48.js +1 -0
- package/dist/public/assets/tasks-view-DD03SZ7R.js +3 -0
- package/dist/public/assets/{terminal-panel-CrBP1KEj.js → terminal-panel-D6RjOZfD.js} +2 -2
- package/dist/public/assets/{ui-components-BPFbmhJA.js → ui-components-BJRW2LJq.js} +1 -1
- package/dist/public/assets/{use-deferred-search-Bi99md6l.js → use-deferred-search-DOfdC3JO.js} +1 -1
- package/dist/public/assets/{utils-C-7eVelM.js → utils-DPYK-CSn.js} +1 -1
- package/dist/public/assets/{vosk-speech-DC3I453R.js → vosk-speech-Ce0kC8Ck.js} +1 -1
- package/dist/public/assets/{web-CHeXRjkl.js → web-BFYPtzjF.js} +1 -1
- package/dist/public/assets/{web-DbVs7vzI.js → web-Cp_I5n5Z.js} +1 -1
- package/dist/public/assets/{web-GowI_ZaX.js → web-DGEc3VyT.js} +1 -1
- package/dist/public/assets/{web-t7m2rd8w.js → web-DLSR_y_6.js} +1 -1
- package/dist/public/index.html +7 -7
- package/package.json +2 -1
- package/dist/public/assets/browser-tab-B9KCHZ2L.js +0 -8
- package/dist/public/assets/commit-dialog-DeVXqj1Z.js +0 -1
- package/dist/public/assets/context-menu-CHJI6MbC.js +0 -1
- package/dist/public/assets/create-repo-dialog-ByIjJnh7.js +0 -1
- package/dist/public/assets/dialogs-config-DAMqiy-4.js +0 -51
- package/dist/public/assets/git-history-dialog-DJfkffd6.js +0 -1
- package/dist/public/assets/git-ops-button-0DrfLBkC.js +0 -2
- package/dist/public/assets/history-view-lvvTzW7O.js +0 -9
- package/dist/public/assets/index-C_iiobDl.js +0 -81
- package/dist/public/assets/mcp-server-card-DPMxJJU6.js +0 -1
- package/dist/public/assets/merged-pr-dialog-BC9NMIet.js +0 -1
- package/dist/public/assets/model-star-rating-C4Ugsik_.js +0 -1
- package/dist/public/assets/onboarding-dys9Rwb5.js +0 -1
- package/dist/public/assets/pull-request-dialog-kuaKjUle.js +0 -1
- package/dist/public/assets/pull-with-changes-dialog-CoxkFsGu.js +0 -1
- package/dist/public/assets/push-before-pr-dialog-C4cbgPuA.js +0 -1
- package/dist/public/assets/radio-group-C6EDTFov.js +0 -1
- package/dist/public/assets/settings-general-view-BHj9qn0K.js +0 -1
- package/dist/public/assets/settings-mcp-servers-view-M2DQPcpo.js +0 -5
- package/dist/public/assets/settings-rules-view-BhRBowk9.js +0 -8
- package/dist/public/assets/settings-slash-commands-view-BYHthCEM.js +0 -1
- package/dist/public/assets/settings-subagents-view-CmrFQcUF.js +0 -2
- package/dist/public/assets/skeleton-rEPpLCqo.js +0 -1
- package/dist/public/assets/slug-utils-DZ59sTAJ.js +0 -1
- package/dist/public/assets/tabs-D57g7ER1.js +0 -1
- package/dist/public/assets/tasks-view-Bn9GiPNp.js +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ao as t,Ba as n,Fs as r,Ii as i,Is as a,Ko as o,Na as s,Oo as c,Pi as l,Rs as u,Z as d,Zn as ee,Zr as te,fs as f,ga as ne,jo as re,n as p,r as m,tr as ie,zn as h}from"./dialogs-config-86QTDk4G.js";import{a as ae,i as oe,o as g,r as se,s as _}from"./react-vendor-DK2COBjg.js";import{D as ce,E as le,S as ue,b as v}from"./history-view-BsN806ip.js";import{n as de}from"./utils-DPYK-CSn.js";import{a as fe,t as pe,x as me}from"./index-C2iIghSR.js";var he=a(),y=e(u(),1),b=r(),ge=y.forwardRef((e,t)=>{let n=(0,he.c)(11),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`relative flex w-full touch-none select-none items-center`,r),n[3]=r,n[4]=o);let s,c;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,b.jsx)(_,{className:`relative h-2 w-full grow overflow-hidden rounded-full bg-secondary`,children:(0,b.jsx)(oe,{className:`absolute h-full bg-primary`})}),c=(0,b.jsx)(g,{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]!==a||n[8]!==t||n[9]!==o?(l=(0,b.jsxs)(ae,{ref:t,className:o,...a,children:[s,c]}),n[7]=a,n[8]=t,n[9]=o,n[10]=l):l=n[10],l});ge.displayName=ae.displayName;var x=o(`app.use-maximum-turn-count.hook`),S=50;function _e(){let[e,t]=(0,y.useState)(S),[n,r]=(0,y.useState)(S.toString()),[i,a]=(0,y.useState)(!0),[o,s]=(0,y.useState)(!1);(0,y.useEffect)(()=>{let e=!1;async function n(){try{let n=await d();e||(t(n.maximumTurnCount),r(n.maximumTurnCount.toString()))}catch(e){x.error(`Failed to load maximum turn count:`,e)}finally{e||a(!1)}}return n(),()=>{e=!0}},[]);function c(e){r(e)}async function l(e){s(!0);try{let n=await h({maximumTurnCount:e});t(n.maximumTurnCount),r(n.maximumTurnCount.toString())}catch(e){throw x.error(`Failed to update maximum turn count:`,e),e}finally{s(!1)}}function u(){r(e.toString())}return{defaultMaximumTurnCount:S,draftMaximumTurnCount:n,isLoading:i,isSaving:o,maximumTurnCount:e,resetDraftMaximumTurnCount:u,setDraftMaximumTurnCount:c,updateMaximumTurnCount:l}}function C(){return typeof navigator>`u`?!1:navigator.userAgentData?.platform===`macOS`?!0:navigator.platform.startsWith(`Mac`)}var ve=o(`app.use-screen-recording-permission.hook`),ye={isMacOS:!1,granted:!1,available:!1,message:``};function be(){return{...ye,isMacOS:C()}}function xe(){let[e,t]=(0,y.useState)(be),[n,r]=(0,y.useState)(!0),[i,a]=(0,y.useState)(null),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(null),u=(0,y.useCallback)(async()=>{r(!0),a(null);try{t(await ee(`api/system-permissions/screen-recording`))}catch(e){a(e instanceof Error?e.message:`Failed to check screen recording permission`),t(e=>({...ye,isMacOS:e?.isMacOS??C(),message:`Unable to check permission status.`}))}finally{r(!1)}},[]);return(0,y.useEffect)(()=>{u()},[u]),{status:e,isLoading:n,error:i,isOpeningSettings:o,openSettingsError:c,refresh:u,openSystemSettings:(0,y.useCallback)(async()=>{s(!0),l(null);try{let e=await ie(`api/system-permissions/screen-recording/open-settings`,{});if(!e.success){let t=e.message||`Failed to open System Settings`;ve.error(`[useScreenRecordingPermission] ${t}`,e.error),l(t)}}catch(e){let t=e instanceof Error?e.message:`Failed to open System Settings`;ve.error(`[useScreenRecordingPermission] Error opening System Settings:`,e),l(t)}finally{s(!1)}},[])}}var Se=o(`app.use-server-bind-mode.hook`),Ce=`local`,w=`tarsk-server-bind-mode-changed`;function T(){if(typeof window>`u`)return!1;try{return sessionStorage.getItem(w)===`true`}catch{return!1}}function we(e){if(!(typeof window>`u`))try{e?sessionStorage.setItem(w,`true`):sessionStorage.removeItem(w)}catch{}}function Te(){let[e,t]=(0,y.useState)(Ce),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)([]),[o,s]=(0,y.useState)(!0),[c,l]=(0,y.useState)(!1),[u,ee]=(0,y.useState)(T);(0,y.useEffect)(()=>{let e=!1;async function n(){try{let n=await d();e||(t(n.serverBindMode),r(n.serverBindMode),a(n.networkAddresses))}catch(e){Se.error(`Failed to load server bind mode:`,e)}finally{e||s(!1)}}return n(),()=>{e=!0}},[]);async function te(e){l(!0);try{let n=await h({serverBindMode:e});t(n.serverBindMode),a(n.networkAddresses),ee(!0),we(!0)}catch(e){throw Se.error(`Failed to update server bind mode:`,e),e}finally{l(!1)}}let f=n!==null&&e!==n;return{defaultServerBindMode:Ce,hasServerBindModeChanged:f,isLoading:o,isSaving:c,needsRestart:f||u,networkAddresses:i,serverBindMode:e,updateServerBindMode:te}}var E=o(`app.use-neural-savings.hook`);function Ee(){let[e,t]=(0,y.useState)(!0),[n,r]=(0,y.useState)(!0),[i,a]=(0,y.useState)(!1);(0,y.useEffect)(()=>{let e=!1;async function n(){try{let n=await d();e||t(n.neuralSavingsEnabled)}catch(e){E.error(`Failed to load neural savings setting:`,e)}finally{e||r(!1)}}return n(),()=>{e=!0}},[]);async function o(e){a(!0);try{t((await h({neuralSavingsEnabled:e})).neuralSavingsEnabled)}catch(e){throw E.error(`Failed to update neural savings setting`,e),e}finally{a(!1)}}return{isEnabled:e,isLoading:n,isSaving:i,updateIsEnabled:o}}var De=o(`app.use-betterstack-logging.hook`);function Oe(){let[e,t]=(0,y.useState)(!1),[n,r]=(0,y.useState)(!1),[i,a]=(0,y.useState)(null),[o,s]=(0,y.useState)(!0),[c,l]=(0,y.useState)(!1);(0,y.useEffect)(()=>{let e=!1;async function n(){try{let n=await d();e||(t(n.betterStackLoggingEnabled),r(n.betterStackEnvConfigured),a(n.betterStackIngestingHost))}catch(e){De.error(`Failed to load Better Stack logging setting:`,e)}finally{e||s(!1)}}return n(),()=>{e=!0}},[]);async function u(e){l(!0);try{let n=await h({betterStackLoggingEnabled:e});t(n.betterStackLoggingEnabled),r(n.betterStackEnvConfigured),a(n.betterStackIngestingHost)}catch(e){throw De.error(`Failed to update Better Stack logging setting:`,e),e}finally{l(!1)}}return{ingestingHost:i,isEnabled:e,isEnvConfigured:n,isLoading:o,isSaving:c,updateIsEnabled:u}}var ke=[{value:`local`,label:`No`},{value:`network`,label:`Yes`}],Ae=[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`system`,label:`System`}],je=[{value:`off`,label:`Off`},{value:`on`,label:`On`}],D=`inline-flex rounded-full border bg-muted/40 p-1`,O=`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`,Me=[`462`,`8100`].includes(typeof document<`u`?document.location.port:``)?`462`:`641`,Ne=600;function Pe(e){let r=(0,he.c)(151),{onboardingResetSignal:a}=e,o=a===void 0?0:a,[u,d]=(0,y.useState)(!1),{theme:ee,setTheme:ie}=de(),{scale:h,updateScale:ae,resetScale:oe,min:g,max:_,default:x}=pe(),{defaultMaximumTurnCount:S,draftMaximumTurnCount:C,isLoading:ve,isSaving:ye,resetDraftMaximumTurnCount:be,setDraftMaximumTurnCount:Se,updateMaximumTurnCount:Ce}=_e(),{status:w,isLoading:T,isOpeningSettings:we,openSettingsError:E,refresh:De,openSystemSettings:Pe}=xe(),{isLoading:Re,isSaving:ze,needsRestart:k,networkAddresses:A,serverBindMode:j,updateServerBindMode:Be}=Te(),{isEnabled:Ve,isLoading:He,isSaving:Ue,updateIsEnabled:We}=me(),{isEnabled:Ge,isLoading:Ke,isSaving:qe,updateIsEnabled:Je}=fe(),{isEnabled:Ye,isLoading:Xe,isSaving:Ze,updateIsEnabled:Qe}=Ee(),{isEnabled:M,isEnvConfigured:N,ingestingHost:$e,isLoading:et,isSaving:tt,updateIsEnabled:nt}=Oe(),rt,it;r[0]===o?(rt=r[1],it=r[2]):(rt=()=>{if(o===0)return;d(!0);let e=setTimeout(()=>{d(!1)},Ne);return()=>{clearTimeout(e)}},it=[o],r[0]=o,r[1]=rt,r[2]=it),(0,y.useEffect)(rt,it);let at;r[3]===Se?at=r[4]:(at=function(e){Se(e.target.value)},r[3]=Se,r[4]=at);let ot=at,st;r[5]!==S||r[6]!==C||r[7]!==be||r[8]!==Ce?(st=async function(){let e=Number.parseInt(C,10),t=Number.isFinite(e)&&e>0?e:S;try{await Ce(t)}catch{be()}},r[5]=S,r[6]=C,r[7]=be,r[8]=Ce,r[9]=st):st=r[9];let ct=st,lt;r[10]===ae?lt=r[11]:(lt=function(e){e.length>0&&ae(e[0])},r[10]=ae,r[11]=lt);let ut=lt,dt=u&&`animate-headline-reset`,ft;r[12]===dt?ft=r[13]:(ft=i(dt),r[12]=dt,r[13]=ft);let P;r[14]===ft?P=r[15]:(P=(0,b.jsx)(ue,{title:`General`,description:`Customize the appearance and behavior of Tarsk.`,titleClassName:ft}),r[14]=ft,r[15]=P);let pt,mt;r[16]===Symbol.for(`react.memo_cache_sentinel`)?(pt=(0,b.jsx)(ne,{className:`h-3.5 w-3.5`}),mt=(0,b.jsx)(`span`,{className:`sr-only`,children:`Reset font size to default`}),r[16]=pt,r[17]=mt):(pt=r[16],mt=r[17]);let F;r[18]===oe?F=r[19]:(F=(0,b.jsxs)(l,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:oe,children:[pt,mt]}),r[18]=oe,r[19]=F);let I;r[20]===h?I=r[21]:(I=(0,b.jsxs)(`span`,{className:`${f.mono} tabular-nums w-12 text-right`,children:[h,`%`]}),r[20]=h,r[21]=I);let L;r[22]!==F||r[23]!==I?(L=(0,b.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[F,I]}),r[22]=F,r[23]=I,r[24]=L):L=r[24];let R;r[25]===g?R=r[26]:(R=(0,b.jsxs)(`span`,{className:`${f.bodyMuted} w-8 text-right`,children:[g,`%`]}),r[25]=g,r[26]=R);let z;r[27]===h?z=r[28]:(z=[h],r[27]=h,r[28]=z);let B;r[29]!==ut||r[30]!==_||r[31]!==g||r[32]!==z?(B=(0,b.jsx)(ge,{value:z,min:g,max:_,step:5,onValueChange:ut,"aria-label":`Font size`}),r[29]=ut,r[30]=_,r[31]=g,r[32]=z,r[33]=B):B=r[33];let V;r[34]===_?V=r[35]:(V=(0,b.jsxs)(`span`,{className:`${f.bodyMuted} w-9`,children:[_,`%`]}),r[34]=_,r[35]=V);let H;r[36]!==R||r[37]!==B||r[38]!==V?(H=(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[R,B,V]}),r[36]=R,r[37]=B,r[38]=V,r[39]=H):H=r[39];let U;r[40]!==x||r[41]!==h?(U=h!==x&&(0,b.jsxs)(`p`,{className:`${f.bodyMuted} mt-2`,children:[`Font size has been changed from the default (`,x,`%).`]}),r[40]=x,r[41]=h,r[42]=U):U=r[42];let W;r[43]!==L||r[44]!==H||r[45]!==U?(W=(0,b.jsxs)(v,{title:`Font Size`,description:`Adjust the text size across the entire application.`,action:L,children:[H,U]}),r[43]=L,r[44]=H,r[45]=U,r[46]=W):W=r[46];let G;r[47]===ie?G=r[48]:(G=e=>{(e===`light`||e===`dark`||e===`system`)&&ie(e)},r[47]=ie,r[48]=G);let ht;r[49]===Symbol.for(`react.memo_cache_sentinel`)?(ht=Ae.map(Le),r[49]=ht):ht=r[49];let K;r[50]!==G||r[51]!==ee?(K=(0,b.jsx)(v,{title:`Appearance`,description:`Choose your preferred color scheme.`,action:(0,b.jsx)(p,{type:`single`,value:ee,onValueChange:G,"aria-label":`Appearance`,variant:`outline`,className:D,children:ht})}),r[50]=G,r[51]=ee,r[52]=K):K=r[52];let q;r[53]===ct?q=r[54]:(q=()=>{ct()},r[53]=ct,r[54]=q);let gt=ve||ye,J;r[55]!==C||r[56]!==ot||r[57]!==q||r[58]!==gt?(J=(0,b.jsx)(te,{type:`number`,min:1,step:1,value:C,onChange:ot,onBlur:q,disabled:gt,"aria-label":`Maximum turn count`,className:`w-28 text-right font-mono tabular-nums flex-shrink-0`}),r[55]=C,r[56]=ot,r[57]=q,r[58]=gt,r[59]=J):J=r[59];let Y;r[60]===S?Y=r[61]:(Y=(0,b.jsxs)(`p`,{className:f.bodyMuted,children:[`Default: `,S,` turns.`]}),r[60]=S,r[61]=Y);let X;r[62]!==J||r[63]!==Y?(X=(0,b.jsx)(v,{title:`Maximum Turn Count`,description:`Set how many turns a long-running agent chat can take before Tarsk asks whether to continue.`,action:J,children:Y}),r[62]=J,r[63]=Y,r[64]=X):X=r[64];let _t=Ve?`on`:`off`,Z;r[65]===We?Z=r[66]:(Z=e=>{e&&We(e===`on`)},r[65]=We,r[66]=Z);let vt=He||Ue,yt,bt;r[67]===Symbol.for(`react.memo_cache_sentinel`)?(yt=(0,b.jsx)(m,{value:`off`,className:O,children:`Off`}),bt=(0,b.jsx)(m,{value:`on`,className:O,children:`On`}),r[67]=yt,r[68]=bt):(yt=r[67],bt=r[68]);let xt;r[69]!==_t||r[70]!==Z||r[71]!==vt?(xt=(0,b.jsx)(v,{title:`AI Voice Cleanup`,description:`After stopping voice recording, run the transcription through AI to remove filler words, false starts, and repetitions.`,action:(0,b.jsxs)(p,{type:`single`,value:_t,onValueChange:Z,disabled:vt,variant:`outline`,className:D,"aria-label":`AI Voice Cleanup`,children:[yt,bt]})}),r[69]=_t,r[70]=Z,r[71]=vt,r[72]=xt):xt=r[72];let St=Ge?`on`:`off`,Ct;r[73]===Je?Ct=r[74]:(Ct=e=>{e&&Je(e===`on`)},r[73]=Je,r[74]=Ct);let wt=Ke||qe,Tt,Et;r[75]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=(0,b.jsx)(m,{value:`off`,className:O,children:`Off`}),Et=(0,b.jsx)(m,{value:`on`,className:O,children:`On`}),r[75]=Tt,r[76]=Et):(Tt=r[75],Et=r[76]);let Q;r[77]!==St||r[78]!==Ct||r[79]!==wt?(Q=(0,b.jsx)(v,{title:`Daily Spend`,description:`Show an estimated daily spend counter in the chat header.`,action:(0,b.jsxs)(p,{type:`single`,value:St,onValueChange:Ct,disabled:wt,variant:`outline`,className:D,"aria-label":`Daily Spend`,children:[Tt,Et]})}),r[77]=St,r[78]=Ct,r[79]=wt,r[80]=Q):Q=r[80];let Dt=Ye?`on`:`off`,Ot;r[81]===Qe?Ot=r[82]:(Ot=e=>{e&&Qe(e===`on`)},r[81]=Qe,r[82]=Ot);let kt=Xe||Ze,At,jt;r[83]===Symbol.for(`react.memo_cache_sentinel`)?(At=(0,b.jsx)(m,{value:`off`,className:O,children:`Off`}),jt=(0,b.jsx)(m,{value:`on`,className:O,children:`On`}),r[83]=At,r[84]=jt):(At=r[83],jt=r[84]);let Mt;r[85]!==Dt||r[86]!==Ot||r[87]!==kt?(Mt=(0,b.jsx)(v,{title:`Neural Net Savings`,description:`Train a small local model on committed agent sessions to prune irrelevant skills, preload tools, and prefetch files. Reduces tokens and turns.`,action:(0,b.jsxs)(p,{type:`single`,value:Dt,onValueChange:Ot,disabled:kt,variant:`outline`,className:D,"aria-label":`Neural Net Savings`,children:[At,jt]})}),r[85]=Dt,r[86]=Ot,r[87]=kt,r[88]=Mt):Mt=r[88];let Nt;r[89]!==we||r[90]!==T||r[91]!==Pe||r[92]!==De||r[93]!==E||r[94]!==w?.granted||r[95]!==w?.isMacOS||r[96]!==w?.message?(Nt=w?.isMacOS&&(0,b.jsx)(v,{title:`Screen & System Audio Recording`,description:`Tarsk needs this macOS permission to capture screen content for browser tools and screen sharing features.`,action:(0,b.jsx)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:(0,b.jsxs)(l,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>void De(),disabled:T,children:[T?(0,b.jsx)(n,{className:`h-3.5 w-3.5 animate-spin`}):(0,b.jsx)(ne,{className:`h-3.5 w-3.5`}),(0,b.jsx)(`span`,{className:`sr-only`,children:`Refresh permission status`})]})}),children:(0,b.jsx)(`div`,{className:`flex items-center gap-3`,children:!T&&w?.granted?(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(t,{className:`h-4 w-4 text-green-500`}),(0,b.jsx)(`span`,{className:i(f.body,`text-green-600 dark:text-green-400`),children:`Permission granted`})]}):T?null:(0,b.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(c,{className:`h-4 w-4 text-amber-500`}),(0,b.jsx)(`span`,{className:i(f.body,`text-amber-600 dark:text-amber-400`),children:`Permission not granted`})]}),(0,b.jsx)(`p`,{className:f.bodyMuted,children:w?.message??`Tarsk needs Screen & System Audio Recording permission to use browser tools.`}),(0,b.jsx)(l,{size:`sm`,onClick:()=>void Pe(),disabled:we,className:`w-fit`,children:we?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n,{className:`h-4 w-4 mr-2 animate-spin`}),`Opening Settings...`]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(s,{className:`h-4 w-4 mr-2`}),`Open System Settings`]})}),E&&(0,b.jsxs)(`div`,{className:`flex items-start gap-2 p-3 rounded-md bg-destructive/10 text-destructive`,children:[(0,b.jsx)(re,{className:`h-4 w-4 mt-0.5 flex-shrink-0`}),(0,b.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,b.jsx)(`p`,{className:f.body,children:`Failed to open System Settings`}),(0,b.jsx)(`p`,{className:f.bodyMuted,children:E}),(0,b.jsxs)(`p`,{className:f.bodyMuted,children:[`Please open it manually:`,` `,(0,b.jsx)(`strong`,{children:`System Settings > Privacy & Security > Screen & System Audio Recording`})]})]})]})]})})}),r[89]=we,r[90]=T,r[91]=Pe,r[92]=De,r[93]=E,r[94]=w?.granted,r[95]=w?.isMacOS,r[96]=w?.message,r[97]=Nt):Nt=r[97];let Pt=Re||ze,Ft;r[98]===Be?Ft=r[99]:(Ft=e=>{(e===`local`||e===`network`)&&Be(e)},r[98]=Be,r[99]=Ft);let It;r[100]===Symbol.for(`react.memo_cache_sentinel`)?(It=ke.map(Ie),r[100]=It):It=r[100];let Lt;r[101]!==j||r[102]!==Pt||r[103]!==Ft?(Lt=(0,b.jsx)(p,{type:`single`,value:j,disabled:Pt,onValueChange:Ft,"aria-label":`Server bind mode`,variant:`outline`,className:D,children:It}),r[101]=j,r[102]=Pt,r[103]=Ft,r[104]=Lt):Lt=r[104];let Rt;r[105]!==k||r[106]!==A||r[107]!==j?(Rt=j===`network`&&A.length>0&&(0,b.jsxs)(`div`,{className:`flex items-start gap-4 mt-3`,children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsxs)(`p`,{className:f.bodyMuted,children:[`Available on the network at:`,` `,(0,b.jsxs)(`span`,{className:f.mono,children:[`http://`,A[0],`:`,Me]})]}),k&&(0,b.jsx)(`p`,{className:`${f.bodyMuted} mt-1`,children:`You will need to restart for this setting to take effect.`})]}),(0,b.jsxs)(`div`,{className:`hidden md:flex flex-col items-center gap-2 flex-shrink-0`,children:[(0,b.jsx)(se,{value:`http://${A[0]}:${Me}`,size:128,bgColor:`hsl(var(--background))`,fgColor:`hsl(var(--foreground))`,level:`M`}),(0,b.jsx)(`p`,{className:`${f.compact} text-muted-foreground text-center`,children:`Scan with the Tarsk Mobile App`})]})]}),r[105]=k,r[106]=A,r[107]=j,r[108]=Rt):Rt=r[108];let zt;r[109]!==A||r[110]!==j?(zt=j===`network`&&A.length===0&&(0,b.jsx)(`p`,{className:`${f.bodyMuted} mt-3`,children:`No network IP addresses were detected on this computer.`}),r[109]=A,r[110]=j,r[111]=zt):zt=r[111];let Bt;r[112]!==k||r[113]!==j?(Bt=k&&j===`local`&&(0,b.jsx)(`p`,{className:`${f.bodyMuted} mt-3`,children:`You will need to restart for this setting to take effect.`}),r[112]=k,r[113]=j,r[114]=Bt):Bt=r[114];let Vt;r[115]!==Lt||r[116]!==Rt||r[117]!==zt||r[118]!==Bt?(Vt=(0,b.jsxs)(v,{title:`Mobile & Network Access`,description:`Allow the Tarsk mobile app or other web browsers to access Tarsk on the wifi network.`,action:Lt,children:[Rt,zt,Bt]}),r[115]=Lt,r[116]=Rt,r[117]=zt,r[118]=Bt,r[119]=Vt):Vt=r[119];let Ht=M?`on`:`off`,Ut;r[120]===nt?Ut=r[121]:(Ut=e=>{(e===`on`||e===`off`)&&nt(e===`on`)},r[120]=nt,r[121]=Ut);let Wt=et||tt,Gt;r[122]===Symbol.for(`react.memo_cache_sentinel`)?(Gt=je.map(Fe),r[122]=Gt):Gt=r[122];let Kt;r[123]!==Ht||r[124]!==Ut||r[125]!==Wt?(Kt=(0,b.jsx)(p,{type:`single`,value:Ht,onValueChange:Ut,disabled:Wt,variant:`outline`,className:D,"aria-label":`Better Stack logging`,children:Gt}),r[123]=Ht,r[124]=Ut,r[125]=Wt,r[126]=Kt):Kt=r[126];let qt;r[127]!==$e||r[128]!==M||r[129]!==N?(qt=M&&N&&$e&&(0,b.jsxs)(`p`,{className:`${f.bodyMuted} mt-3`,children:[`Ingesting host:`,` `,(0,b.jsx)(`span`,{className:f.mono,children:$e})]}),r[127]=$e,r[128]=M,r[129]=N,r[130]=qt):qt=r[130];let Jt;r[131]!==M||r[132]!==N?(Jt=M&&!N&&(0,b.jsxs)(`p`,{className:`${f.bodyMuted} mt-3`,children:[`Logging requires the`,` `,(0,b.jsx)(`span`,{className:f.mono,children:`BETTERSTACK_SOURCE_TOKEN`}),` and`,` `,(0,b.jsx)(`span`,{className:f.mono,children:`BETTERSTACK_INGESTING_HOST`}),` environment variables to be set. Restart Tarsk after configuring them.`]}),r[131]=M,r[132]=N,r[133]=Jt):Jt=r[133];let Yt;r[134]!==Kt||r[135]!==qt||r[136]!==Jt?(Yt=(0,b.jsxs)(v,{title:`Logging`,description:`Send application logs to Better Stack for remote monitoring and debugging.`,action:Kt,children:[qt,Jt]}),r[134]=Kt,r[135]=qt,r[136]=Jt,r[137]=Yt):Yt=r[137];let $;r[138]!==W||r[139]!==K||r[140]!==X||r[141]!==xt||r[142]!==Q||r[143]!==Mt||r[144]!==Nt||r[145]!==Vt||r[146]!==Yt?($=(0,b.jsxs)(`div`,{className:`space-y-8`,children:[W,K,X,xt,Q,Mt,Nt,Vt,Yt]}),r[138]=W,r[139]=K,r[140]=X,r[141]=xt,r[142]=Q,r[143]=Mt,r[144]=Nt,r[145]=Vt,r[146]=Yt,r[147]=$):$=r[147];let Xt;return r[148]!==$||r[149]!==P?(Xt=(0,b.jsx)(ce,{children:(0,b.jsxs)(le,{children:[P,$]})}),r[148]=$,r[149]=P,r[150]=Xt):Xt=r[150],Xt}function Fe(e){return(0,b.jsx)(m,{value:e.value,"aria-label":e.label,className:O,children:e.label},e.value)}function Ie(e){return(0,b.jsx)(m,{value:e.value,"aria-label":e.label,className:O,children:e.label},e.value)}function Le(e){return(0,b.jsx)(m,{value:e.value,"aria-label":e.label,className:O,children:e.label},e.value)}export{Pe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ba as t,
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ba as t,Fs as n,Ii as r,Pi as i,Rs as a,Rt as o,fs as s,wn as c}from"./dialogs-config-86QTDk4G.js";import{E as l,S as u,T as d,w as f}from"./history-view-BsN806ip.js";import{B as p,H as m,W as h}from"./index-C2iIghSR.js";var g=e(a(),1),_=n();function v(){let e=h(e=>e.selectedThreadId),[n,a]=(0,g.useState)(``),[v,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(!1);(0,g.useEffect)(()=>{e&&(y(!0),o(e,`AGENTS.md`).then(e=>a(e.content)).catch(()=>a(``)).finally(()=>y(!1)))},[e]);async function S(){if(e){x(!0);try{await c(e,`AGENTS.md`,n),p({title:`Instructions saved`})}catch(e){p({title:`Error`,description:e instanceof Error?e.message:`Failed to save instructions`,variant:`destructive`})}finally{x(!1)}}}return e?(0,_.jsx)(f,{children:(0,_.jsxs)(l,{className:`w-full flex-1 flex flex-col min-h-0`,children:[(0,_.jsx)(u,{title:`Instructions`,description:`Add context like coding guidelines and expectations. Stored in AGENTS.md file.`,action:(0,_.jsx)(i,{onClick:S,disabled:v||b,children:b?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(t,{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)(t,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,_.jsx)(m,{value:n,onChange:e=>a(e.target.value),className:r(s.mono,`flex-1 min-h-0 resize-none`),placeholder:`Add instructions for your agent in AGENTS.md...`,disabled:b})]})}):(0,_.jsx)(d,{children:`Select a thread to edit instructions.`})}export{v as SettingsInstructionsView,v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{Fs as e,Ii as t,Is as n,Rs as r,Zr as i,fa as a,fs as o}from"./dialogs-config-86QTDk4G.js";import{I as s}from"./history-view-BsN806ip.js";import"./skeleton-BvvAbfo4.js";var c=n(),l=e();r();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(e){let n=(0,c.c)(8),{icon:r,title:i,description:a}=e,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=t(o.emptyStateTitle,`mb-1`),n[2]=d):d=n[2];let f;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=t(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(e){let n=(0,c.c)(12),{placeholder:r,value:o,onChange:s,className:u}=e,d=u??`mb-4`,f;n[0]===d?f=n[1]:(f=t(`relative`,d),n[0]=d,n[1]=f);let p;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,l.jsx)(a,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),n[2]=p):p=n[2];let m;n[3]===s?m=n[4]:(m=e=>s(e.target.value),n[3]=s,n[4]=m);let h;n[5]!==r||n[6]!==m||n[7]!==o?(h=(0,l.jsx)(i,{placeholder:r,value:o,onChange:m,className:`pl-8`}),n[5]=r,n[6]=m,n[7]=o,n[8]=h):h=n[8];let g;return n[9]!==f||n[10]!==h?(g=(0,l.jsxs)(`div`,{className:f,children:[p,h]}),n[9]=f,n[10]=h,n[11]=g):g=n[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(e){let n=(0,c.c)(3),{searchQuery:r,emptyLabel:i}=e,a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=t(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(e){let n=(0,c.c)(3),{message:r}=e,i;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(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{$i as t,Br as n,Fs as r,Ii as i,Is as a,Ki as o,Lr as s,M as c,Pi as l,Qr as u,Rr as d,Rs as f,Sa as p,Zr as m,_t as h,bn as g,ei as _,fs as v,ft as y,ua as b,zr as x}from"./dialogs-config-86QTDk4G.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 ne}from"./history-view-BsN806ip.js";import{B as z,H as B,L as V,P as re,W as H}from"./index-C2iIghSR.js";import{t as U}from"./skeleton-BvvAbfo4.js";import{i as W,n as G,r as ie,t as ae}from"./tabs-0fGgot48.js";import{i as oe,n as se,r as ce,t as K}from"./settings-list-CICo_cz2.js";import{t as le}from"./mcp-server-card-DUJUtQq-.js";var ue=a(),q=e(f(),1);function de(e){let[t,n]=(0,q.useState)([]),[r,i]=(0,q.useState)(!1),a=(0,q.useCallback)(async()=>{if(e){i(!0);try{let t=await y(e);n(Object.entries(t.servers??{}).map(([e,t])=>({name:e,config:t})))}catch{n([])}finally{i(!1)}}},[e]);return(0,q.useEffect)(()=>{a()},[a]),{installedServers:t,loadingConfig:r,loadInstalledServers:a}}function fe(){let e=(0,ue.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,q.useState)(t),i,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{h().then(r).catch(()=>r([]))},a=[],e[1]=i,e[2]=a):(i=e[1],a=e[2]),(0,q.useEffect)(i,a);let o;return e[3]===n?o=e[4]:(o={popularServers:n},e[3]=n,e[4]=o),o}async function J(e,t,n){await g(e,t,n)}async function pe(e,t){await c(e,t)}var Y=r();function X(e){return e?.url?`remote`:`local`}function me(e){return Object.entries(e??{}).map(([e,t])=>({key:e,value:t}))}function Z({projectPath:e,serverName:t,initialName:n,initialConfig:r,onBack:i}){let{installedServers:a}=de(e),s=!!t,[c,u]=(0,q.useState)(`local`),[d,f]=(0,q.useState)(``),[h,g]=(0,q.useState)(``),[_,y]=(0,q.useState)(``),[b,x]=(0,q.useState)(``),[S,C]=(0,q.useState)(`sse`),[w,T]=(0,q.useState)([]),[E,D]=(0,q.useState)([]),[O,k]=(0,q.useState)(!1),[A,I]=(0,q.useState)(!1),[L,V]=(0,q.useState)(null),[re,H]=(0,q.useState)(s),[U,oe]=(0,q.useState)(``),[se,ce]=(0,q.useState)(``);function K(e,t){let n=X(t);u(n),f(e),g(t.command??``),y((t.args??[]).join(`
|
|
2
|
+
`)),x(t.url??``),C(t.transport??`sse`),T(me(t.env)),D(me(t.headers)),oe(e),ce(JSON.stringify({name:e,type:n,config:t}))}(0,q.useEffect)(()=>{if(s&&t){let e=a.find(e=>e.name===t);e&&(K(e.name,e.config),H(!1))}else r&&K(n??``,r),H(!1)},[a,t,s,r,n]);let le=(0,q.useCallback)(()=>{T(e=>[...e,{key:``,value:``}])},[]),ue=(0,q.useCallback)(e=>{T(t=>t.filter((t,n)=>n!==e))},[]),fe=(0,q.useCallback)((e,t)=>{T(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),Z=(0,q.useCallback)((e,t)=>{T(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]),Q=(0,q.useCallback)(()=>{D(e=>[...e,{key:``,value:``}])},[]),he=(0,q.useCallback)(e=>{D(t=>t.filter((t,n)=>n!==e))},[]),$=(0,q.useCallback)((e,t)=>{D(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),ge=(0,q.useCallback)((e,t)=>{D(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]);function _e(e){let t={};for(let{key:n,value:r}of e)n.trim()&&(t[n.trim()]=r);return Object.keys(t).length>0?t:void 0}function ve(){let e=_e(w);if(c===`remote`){let t=_e(E);return{url:b.trim(),transport:S,...t?{headers:t}:{},...e?{env:e}:{}}}let t=_.split(`
|
|
3
|
+
`).map(e=>e.trim()).filter(Boolean);return{command:h.trim(),args:t,...e?{env:e}:{}}}let ye=JSON.stringify({name:d.trim(),type:c,config:ve()}),be=async()=>{V(null);let t=d.trim();if(!t){V(`Server name is required`);return}if(c===`remote`){if(!b.trim()){V(`Server URL is required`);return}try{new URL(b.trim())}catch{V(`Server URL must be a valid URL`);return}}else if(!h.trim()){V(`Command is required`);return}k(!0);try{if(!e)throw Error(`No project path`);await J(e,U||t,ve()),z({title:`Success`,description:s?`MCP server configuration saved`:`MCP server added`}),i()}catch(e){V(e instanceof Error?e.message:`Failed to save server`)}finally{k(!1)}},xe=async()=>{if(e){I(!0);try{await pe(e,U),z({title:`Success`,description:`MCP server removed`}),i()}catch(e){V(e instanceof Error?e.message:`Failed to delete server`)}finally{I(!1)}}},Se=s?ye!==se:d.trim()!==``||h.trim()!==``||_.trim()!==``||b.trim()!==``||w.length>0||E.length>0;return re?(0,Y.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Y.jsx)(`p`,{className:v.bodyMuted,children:`Loading server configuration...`})}):(0,Y.jsx)(ee,{children:(0,Y.jsxs)(ne,{children:[(0,Y.jsx)(te,{title:s?d:`Add MCP Server`,description:s?`Edit MCP Server configuration.`:`Configure a new MCP Server.`}),(0,Y.jsxs)(`div`,{className:`space-y-6`,children:[(0,Y.jsx)(j,{title:`Server name`,description:s?`Server name cannot be changed`:void 0,children:(0,Y.jsx)(m,{id:`server-name`,placeholder:`e.g. filesystem`,value:d,onChange:e=>f(e.target.value),disabled:s})}),(0,Y.jsxs)(ae,{value:c,onValueChange:e=>u(e),className:`w-full`,children:[(0,Y.jsxs)(ie,{className:`grid w-full grid-cols-2`,children:[(0,Y.jsx)(W,{value:`local`,children:`Local (stdio)`}),(0,Y.jsx)(W,{value:`remote`,children:`Remote (HTTP/SSE)`})]}),(0,Y.jsxs)(G,{value:`local`,className:`space-y-6 mt-6`,children:[(0,Y.jsx)(j,{title:`Command`,children:(0,Y.jsx)(m,{id:`server-command`,placeholder:`e.g. npx`,value:h,onChange:e=>g(e.target.value)})}),(0,Y.jsx)(j,{title:`Arguments`,description:`One argument per line`,children:(0,Y.jsx)(B,{id:`server-args`,placeholder:`-y
|
|
4
|
+
@modelcontextprotocol/server-filesystem
|
|
5
|
+
/path/to/dir`,value:_,onChange:e=>y(e.target.value),className:`font-mono min-h-[80px] resize-none`})})]}),(0,Y.jsxs)(G,{value:`remote`,className:`space-y-6 mt-6`,children:[(0,Y.jsx)(j,{title:`Server URL`,description:`Paste the MCP endpoint URL from your provider.`,children:(0,Y.jsx)(m,{id:`server-url`,placeholder:`https://example.com/mcp`,value:b,onChange:e=>x(e.target.value),className:`font-mono`})}),(0,Y.jsx)(j,{title:`Transport`,children:(0,Y.jsxs)(M,{value:S,onValueChange:e=>C(e),children:[(0,Y.jsx)(F,{children:(0,Y.jsx)(P,{})}),(0,Y.jsxs)(N,{children:[(0,Y.jsx)(R,{value:`sse`,children:`SSE (Server-Sent Events)`}),(0,Y.jsx)(R,{value:`streamableHttp`,children:`Streamable HTTP`})]})]})}),(0,Y.jsx)(j,{title:`HTTP headers`,description:`Optional headers for authentication.`,action:(0,Y.jsxs)(l,{variant:`ghost`,size:`sm`,onClick:Q,children:[(0,Y.jsx)(p,{className:`h-3 w-3 mr-1`}),`Add header`]}),children:E.length===0?(0,Y.jsx)(`p`,{className:v.caption,children:`No headers configured`}):(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:E.map((e,t)=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(m,{placeholder:`Authorization`,value:e.key,onChange:e=>$(t,e.target.value),className:`font-mono w-[35%]`}),(0,Y.jsx)(m,{placeholder:`Bearer ...`,value:e.value,onChange:e=>ge(t,e.target.value),className:`font-mono flex-1`}),(0,Y.jsx)(l,{variant:`ghost`,size:`icon`,onClick:()=>he(t),className:`h-9 w-9 flex-shrink-0`,children:(0,Y.jsx)(o,{className:`h-3.5 w-3.5`})})]},t))})})]})]}),(0,Y.jsx)(j,{title:`Environment variables`,description:c===`remote`?`Optional metadata for local tooling.`:void 0,action:(0,Y.jsxs)(l,{variant:`ghost`,size:`sm`,onClick:le,children:[(0,Y.jsx)(p,{className:`h-3 w-3 mr-1`}),`Add variable`]}),children:w.length===0?(0,Y.jsx)(`p`,{className:v.caption,children:`No environment variables configured`}):(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:w.map((e,t)=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(m,{placeholder:`KEY`,value:e.key,onChange:e=>fe(t,e.target.value),className:`font-mono w-[35%]`}),(0,Y.jsx)(m,{placeholder:`value`,value:e.value,onChange:e=>Z(t,e.target.value),className:`font-mono flex-1`}),(0,Y.jsx)(l,{variant:`ghost`,size:`icon`,onClick:()=>ue(t),className:`h-9 w-9 flex-shrink-0`,children:(0,Y.jsx)(o,{className:`h-3.5 w-3.5`})})]},t))})}),L&&(0,Y.jsx)(`p`,{className:v.error,children:L}),(0,Y.jsxs)(`div`,{className:`border-t pt-4 flex items-center justify-between`,children:[s&&(0,Y.jsx)(l,{variant:`destructive`,onClick:xe,disabled:A||O,children:A?`Removing...`:`Remove`}),!s&&(0,Y.jsx)(`div`,{}),(0,Y.jsx)(l,{onClick:be,disabled:O||A||!Se,children:O?s?`Saving...`:`Adding...`:s?`Save`:`Add`})]})]})]})})}function Q(e){return e.name.toLowerCase().replace(/\s+/g,`-`)}function he(e){return e.url?e.url:`${e.command??``} ${e.args?.join(` `)??``}`.trim()}function $(){let e=H(e=>e.selectedProjectId),r=H(e=>e.projects).find(t=>t.projectId===e)?.projectPath,{installedServers:a,loadingConfig:o,loadInstalledServers:c}=de(r),{popularServers:f}=fe(),{setActiveMainTab:p}=V(),{setPendingExplorerPath:m,triggerExplorerRefresh:h}=re(),[g,y]=(0,q.useState)(!1),[j,M]=(0,q.useState)(null),[N,P]=(0,q.useState)(null),[F,R]=(0,q.useState)(null),[ne,B]=(0,q.useState)(!1),[W,G]=(0,q.useState)(``),ie=(0,q.useCallback)(async e=>{if(r){B(!0);try{await pe(r,e),await c(),h(),z({title:`MCP server removed`,description:e}),R(null)}catch(e){z({title:`Error`,description:e instanceof Error?e.message:`Failed to remove server`,variant:`destructive`})}finally{B(!1)}}},[r,c,h]),ae=(0,q.useCallback)(()=>{m(`.agents/mcp.json`),p(`explorer`)},[m,p]),ue=(0,q.useCallback)(async e=>{if(!r)return;let t=Q(e);if(!a.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}:{}}}),y(!0);return}try{await J(r,t,{url:e.url,transport:e.transport??`sse`,...Object.keys(e.env??{}).length>0?{env:e.env}:{}}),await c(),h(),z({title:`MCP server installed`,description:e.name})}catch(e){z({title:`Error`,description:e instanceof Error?e.message:`Failed to install server`,variant:`destructive`})}return}if(!e.command){z({title:`Error`,description:`This server is missing install configuration.`,variant:`destructive`});return}try{await J(r,t,{command:e.command,args:e.args??[],...Object.keys(e.env??{}).length>0?{env:e.env}:{}}),await c(),h(),z({title:`MCP server installed`,description:e.name})}catch(e){z({title:`Error`,description:e instanceof Error?e.message:`Failed to install server`,variant:`destructive`})}}},[r,a,c,h]),X=W.trim()?f.filter(e=>e.name.toLowerCase().includes(W.toLowerCase())||e.description.toLowerCase().includes(W.toLowerCase())):f;return e?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ee,{children:(0,Y.jsxs)(w,{children:[(0,Y.jsx)(te,{title:`MCP Servers`,description:`Manage Model Context Protocol servers for your project.`,action:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(l,{variant:`ghost`,onClick:ae,children:`Config`}),(0,Y.jsx)(l,{onClick:()=>y(!0),children:`Add Server`})]})}),(0,Y.jsx)(C,{title:`Installed`}),o?(0,Y.jsxs)(`div`,{className:`space-y-3 mb-8`,children:[(0,Y.jsx)(U,{className:`h-12 w-full`}),(0,Y.jsx)(U,{className:`h-12 w-full`})]}):a.length===0?(0,Y.jsx)(K,{icon:b,title:`No MCP servers installed`,description:`Add an MCP server to extend agent capabilities.`}):(0,Y.jsx)(`div`,{className:`mb-8 overflow-hidden rounded-md border border-border`,children:a.map((e,r)=>(0,Y.jsxs)(`div`,{className:i(`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`,r>0&&`border-t border-border`),children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>P(e.name),className:`min-w-0 text-left`,children:[(0,Y.jsx)(`div`,{className:i(v.body,`truncate`),children:e.name}),(0,Y.jsx)(`div`,{className:i(v.compact,`truncate text-muted-foreground font-mono`),children:he(e.config)})]}),(0,Y.jsx)(`div`,{className:`shrink-0`}),(0,Y.jsx)(x,{children:(0,Y.jsxs)(s,{children:[(0,Y.jsx)(n,{asChild:!0,children:(0,Y.jsx)(l,{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,Y.jsx)(t,{className:`h-4 w-4`})})}),(0,Y.jsx)(d,{children:`Remove this MCP server from the project`})]})})]},e.name))}),(0,Y.jsx)(C,{title:`Available`,className:`mb-0`}),(0,Y.jsx)(oe,{placeholder:`Search available servers...`,value:W,onChange:G}),f.length===0?(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(U,{className:`h-20 w-full`}),(0,Y.jsx)(U,{className:`h-20 w-full`})]}):X.length===0?(0,Y.jsx)(ce,{searchQuery:W,emptyLabel:`No available servers found.`}):(0,Y.jsx)(se,{children:X.map(e=>{let t=Q(e),n=a.some(n=>n.name===t||n.name===e.id);return(0,Y.jsx)(le,{name:e.name,description:e.description,installed:n,onClick:()=>{n||ue(e)},showInstalledControls:!1},e.id)})})]})}),(0,Y.jsx)(u,{open:g,onOpenChange:e=>{y(e),e||M(null)},children:(0,Y.jsx)(_,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,Y.jsx)(Z,{projectPath:r,initialName:j?.name,initialConfig:j?.config,onBack:()=>{y(!1),M(null),c(),h()}})})}),(0,Y.jsx)(u,{open:N!==null,onOpenChange:e=>{e||P(null)},children:(0,Y.jsx)(_,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,Y.jsx)(Z,{projectPath:r,serverName:N??void 0,onBack:()=>{P(null),c(),h()}})})}),(0,Y.jsx)(O,{open:F!==null,onOpenChange:e=>!e&&R(null),children:(0,Y.jsxs)(I,{children:[(0,Y.jsxs)(k,{children:[(0,Y.jsx)(T,{children:`Delete MCP Server`}),(0,Y.jsxs)(E,{children:[`Are you sure you want to delete the server "`,F,`"? This action cannot be undone.`]})]}),(0,Y.jsxs)(D,{children:[(0,Y.jsx)(S,{children:`Cancel`}),(0,Y.jsx)(L,{onClick:()=>F&&void ie(F),disabled:ne,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:ne?`Deleting...`:`Delete`})]})]})})]}):(0,Y.jsx)(A,{children:`Select a project to manage MCP servers.`})}export{$ as SettingsMCPServersView,$ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Fs as e,Is as t}from"./dialogs-config-86QTDk4G.js";import{D as n,E as r,S as i}from"./history-view-BsN806ip.js";import{t as a}from"./skeleton-BvvAbfo4.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-ObE_ktqH.js → settings-models-view-DWqPx-2m.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{At as t,B as n,Br as r,G as i,H as a,Ii as o,Is as s,Ko as c,Li as l,Lr as u,Ns as d,Pi as f,Ps as p,Rr as m,So as h,U as g,V as _,W as v,Wo as y,fs as b,kt as x,ra as S,zr as C}from"./dialogs-config-DAMqiy-4.js";import{C as w,D as T,E,S as D,T as O,a as k,l as ee,n as A,o as j,x as M}from"./history-view-lvvTzW7O.js";import{a as N,n as P,u as F}from"./onboarding-dys9Rwb5.js";import{i as I,n as L,r as R,t as z}from"./tabs-D57g7ER1.js";import{t as B}from"./use-deferred-search-Bi99md6l.js";import{t as V}from"./model-star-rating-C4Ugsik_.js";import{i as H,o as U}from"./settings-list-BapKAJV3.js";import{t as W}from"./settings-models-skeleton-B7TMwjxe.js";var G=e(s(),1),K=p(),q=c(`app.use-settings-models-data.hook`);function J(e){return`settings-models:coding:${e}`}function Y(e){return`settings-models:image:${e}`}async function te(){let e=(await t()).filter(e=>e.apiKey),n={};e.forEach(e=>{n[e.slug]=`alphabetical`});let r={},a={};return await Promise.all(e.map(async e=>{try{let t=await i(e.slug);r[e.slug]=t.models,a[e.slug]=new Set(t.enabledModelIds)}catch(t){q.error(`Failed to load models for ${e.slug}:`,t),r[e.slug]=[],a[e.slug]=new Set}})),{providers:e,allModels:r,enabledModelIds:a,providerSortOptions:n}}async function X(e){let t=e.filter(e=>e.name.toLowerCase()===`openrouter`),n={},r={};return await Promise.all(t.map(async e=>{try{let t=await v(e.slug);n[e.slug]=t.models,r[e.slug]=new Set(t.enabledModelIds)}catch(t){q.error(`Failed to load image models for ${e.slug}:`,t),n[e.slug]=[],r[e.slug]=new Set}})),{allImageModels:n,enabledImageModelIds:r}}var Z=d();function ne({providers:e,globalSearchQuery:t,providerSortOptions:i,setProviderSortOptions:s,filterAndSortModels:c,getModelDisplayName:d,onSaveStatus:p}){let g=k(Y(0),()=>X(e)),[_]=(0,G.useState)(g.allImageModels),[v,S]=(0,G.useState)(g.enabledImageModelIds);async function T(e,t){try{v[e]?.has(t)?(await n(e,t),S(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await a(e,t),S(n=>({...n,[e]:new Set([...n[e]||[],t])}))),p(`Model preferences saved successfully`)}catch(e){p(e instanceof Error?e.message:`Failed to save model changes`)}}async function E(e,t){let n=_[e],r=v[e];if(n)for(let i of n)r?.has(i.id)!==t&&await T(e,i.id)}return(0,Z.jsx)(`div`,{className:`space-y-6`,children:e.filter(e=>e.name.toLowerCase()===`openrouter`).map(e=>{let n=_[e.slug]||[],a=v[e.slug]||new Set,p=i[e.slug]||`alphabetical`,g=c(n,a,p);return g.length===0&&t?null:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:(0,Z.jsx)(`img`,{src:x(e.slug),alt:`${e.name} logo`,className:`h-5 w-5 dark:invert`,onError:e=>{e.target.style.display=`none`;let t=e.target.parentElement;t&&(t.classList.remove(`overflow-hidden`),t.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-muted-foreground"><path d="M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5"/><path d="M8.5 8.5a2.5 2.5 0 0 0 0 5"/><path d="M15.5 15.5a2.5 2.5 0 0 0 0-5"/></svg>`)}})}),(0,Z.jsx)(w,{title:e.name,className:`mb-0`})]}),g.length>0&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(N,{id:`select-all-image-${e.slug}`,checked:g.every(e=>a.has(e.id)),onCheckedChange:t=>void E(e.slug,t===!0)}),(0,Z.jsx)(`label`,{htmlFor:`select-all-image-${e.slug}`,className:o(b.body,`cursor-pointer whitespace-nowrap`),children:`Select all models`})]}),(0,Z.jsx)(C,{children:(0,Z.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,Z.jsxs)(u,{children:[(0,Z.jsx)(r,{asChild:!0,children:(0,Z.jsx)(f,{type:`button`,variant:p===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>s(t=>({...t,[e.slug]:`alphabetical`})),children:(0,Z.jsx)(y,{className:`h-4 w-4`})})}),(0,Z.jsx)(m,{children:`Sort A–Z`})]}),(0,Z.jsxs)(u,{children:[(0,Z.jsx)(r,{asChild:!0,children:(0,Z.jsx)(f,{type:`button`,variant:p===`price-low`||p===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>s(t=>({...t,[e.slug]:`price-low`})),children:(0,Z.jsx)(h,{className:`h-4 w-4`})})}),(0,Z.jsx)(m,{children:`Sort by price`})]})]})})]}),g.length===0?(0,Z.jsx)(U,{message:t?`No models matching your search.`:`No image models available for this provider.`}):(0,Z.jsx)(C,{children:(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:g.map(t=>{let n=a.has(t.id),r=t.pricing;return(0,Z.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,Z.jsx)(N,{id:`image-${t.id}`,checked:n,onCheckedChange:()=>void T(e.slug,t.id),className:`mt-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,Z.jsx)(`label`,{htmlFor:`image-${t.id}`,className:o(b.label,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:d(t)})}),r&&(0,Z.jsx)(`span`,{className:o(b.compact,`text-muted-foreground whitespace-nowrap flex-shrink-0`),children:(r.prompt??0)===0&&(r.completion??0)===0?``:`$${l(r.prompt??0)} in | $${l(r.completion??0)} out`})]})]},t.id)})})})]},e.slug)})})}function Q({loadVersion:e}){let t=k(J(e),()=>te()),n=t.providers,[i]=(0,G.useState)(t.allModels),[a,s]=(0,G.useState)(t.enabledModelIds),[c,d]=(0,G.useState)(`coding`),{query:p,setQuery:v,deferredQuery:A}=B(),[j,W]=(0,G.useState)(t.providerSortOptions),[K,q]=(0,G.useState)(``),Y=e=>F(e.id),X=async(e,t)=>{try{a[e]?.has(t)?(await _(e,t),s(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await g(e,t),s(n=>({...n,[e]:new Set([...n[e]||[],t])}))),q(`Model preferences saved successfully`),setTimeout(()=>q(``),3e3)}catch(e){q(e instanceof Error?e.message:`Failed to save model changes`)}},Q=async(e,t)=>{let n=i[e],r=a[e];if(n)for(let i of n)r?.has(i.id)!==t&&await X(e,i.id)},$=(e,t,n)=>P({models:e,query:A,sortBy:n,getDisplayName:Y,getPriority:e=>+!t.has(e.id)});return n.length===0?(0,Z.jsx)(O,{title:`No providers configured`,children:`Configure a provider with an API key to view available models.`}):(0,Z.jsx)(T,{children:(0,Z.jsxs)(E,{children:[(0,Z.jsx)(D,{title:`Models`,description:`View and manage available models from your configured providers.`}),(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsx)(H,{placeholder:`Search models across all providers...`,value:p,onChange:v}),(0,Z.jsxs)(z,{value:c,onValueChange:e=>{d(e),v(``)},children:[(0,Z.jsxs)(R,{className:`mb-4`,children:[(0,Z.jsx)(I,{value:`coding`,children:`Coding`}),n.some(e=>e.name.toLowerCase()===`openrouter`)&&(0,Z.jsx)(I,{value:`image`,children:`Image`})]}),(0,Z.jsx)(L,{value:`coding`,children:(0,Z.jsx)(`div`,{className:`space-y-6`,children:n.map(e=>{let t=i[e.slug]||[],n=a[e.slug]||new Set,s=j[e.slug]||`alphabetical`,c=$(t,n,s);return c.length===0&&p?null:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:(0,Z.jsx)(`img`,{src:x(e.slug),alt:`${e.name} logo`,className:`h-5 w-5 dark:invert`,onError:e=>{e.target.style.display=`none`;let t=e.target.parentElement;t&&(t.classList.remove(`overflow-hidden`),t.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-muted-foreground"><path d="M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5"/><path d="M8.5 8.5a2.5 2.5 0 0 0 0 5"/><path d="M15.5 15.5a2.5 2.5 0 0 0 0-5"/></svg>`)}})}),(0,Z.jsx)(w,{title:e.name,className:`mb-0`})]}),c.length>0&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(N,{id:`select-all-${e.slug}`,checked:c.every(e=>n.has(e.id)),onCheckedChange:t=>Q(e.slug,t===!0)}),(0,Z.jsx)(`label`,{htmlFor:`select-all-${e.slug}`,className:o(b.body,`cursor-pointer whitespace-nowrap`),children:`Select all models`})]}),(0,Z.jsx)(C,{children:(0,Z.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,Z.jsxs)(u,{children:[(0,Z.jsx)(r,{asChild:!0,children:(0,Z.jsx)(f,{type:`button`,variant:s===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>W(t=>({...t,[e.slug]:`alphabetical`})),children:(0,Z.jsx)(y,{className:`h-4 w-4`})})}),(0,Z.jsx)(m,{children:`Sort A–Z`})]}),(0,Z.jsxs)(u,{children:[(0,Z.jsx)(r,{asChild:!0,children:(0,Z.jsx)(f,{type:`button`,variant:s===`price-low`||s===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>W(t=>({...t,[e.slug]:`price-low`})),children:(0,Z.jsx)(h,{className:`h-4 w-4`})})}),(0,Z.jsx)(m,{children:`Sort by price`})]}),(0,Z.jsxs)(u,{children:[(0,Z.jsx)(r,{asChild:!0,children:(0,Z.jsx)(f,{type:`button`,variant:s===`coding-index`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>W(t=>({...t,[e.slug]:`coding-index`})),children:(0,Z.jsx)(S,{className:`h-4 w-4`})})}),(0,Z.jsx)(m,{children:`Sort by coding intelligence`})]})]})})]}),c.length===0?(0,Z.jsx)(U,{message:p?`No models matching your search.`:`No models available for this provider.`}):(0,Z.jsx)(C,{children:(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:c.map(t=>{let r=n.has(t.id),i=t.pricing;return(0,Z.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,Z.jsx)(N,{id:t.id,checked:r,onCheckedChange:()=>X(e.slug,t.id),className:`mt-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,Z.jsx)(`label`,{htmlFor:t.id,className:o(b.body,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:Y(t)})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[s===`coding-index`&&(0,Z.jsx)(V,{codingIndex:t.coding_index,modelName:Y(t)}),i&&(0,Z.jsx)(`span`,{className:o(b.compact,`text-muted-foreground whitespace-nowrap`),children:(i.prompt??0)===0&&(i.completion??0)===0?``:`$${l(i.prompt??0)} in | $${l(i.completion??0)} out`})]})]})]},t.id)})})})]},e.slug)})})}),(0,Z.jsx)(L,{value:`image`,children:c===`image`?(0,Z.jsx)(G.Suspense,{fallback:(0,Z.jsx)(ee,{className:`py-12`,size:`sm`}),children:(0,Z.jsx)(ne,{providers:n,globalSearchQuery:p,providerSortOptions:j,setProviderSortOptions:W,filterAndSortModels:$,getModelDisplayName:Y,onSaveStatus:e=>{q(e),e.includes(`Failed`)||setTimeout(()=>q(``),3e3)}})}):null})]}),K&&(0,Z.jsx)(M,{variant:K.includes(`error`)||K.includes(`Failed`)?`error`:`success`,className:`mb-0`,children:K})]})]})})}function $(){let e=(0,K.c)(8),[t,n]=(0,G.useState)(0),r;e[0]===t?r=e[1]:(r=function(){j(J(t)),n(ie)},e[0]=t,e[1]=r);let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(W,{}),e[2]=a):a=e[2];let o;e[3]===t?o=e[4]:(o=(0,Z.jsx)(G.Suspense,{fallback:a,children:(0,Z.jsx)(Q,{loadVersion:t},t)}),e[3]=t,e[4]=o);let s;return e[5]!==i||e[6]!==o?(s=(0,Z.jsx)(A,{fallbackTitle:`Failed to load models`,onRetry:i,renderFallback:re,children:o}),e[5]=i,e[6]=o,e[7]=s):s=e[7],s}function re(e,t){return(0,Z.jsx)(O,{title:`Failed to load models`,action:(0,Z.jsx)(f,{variant:`outline`,onClick:t,children:`Retry`}),children:e.message})}function ie(e){return e+1}export{$ as SettingsModelsView,$ as default};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{At as t,B as n,Br as r,Fs as i,G as a,H as o,Ii as s,Is as c,Ko as l,Li as u,Lr as d,Pi as f,Rr as p,Rs as m,So as h,U as g,V as _,W as v,Wo as y,fs as b,kt as x,ra as S,zr as C}from"./dialogs-config-86QTDk4G.js";import{C as w,D as T,E,S as D,T as O,a as k,l as ee,n as A,o as j,x as M}from"./history-view-BsN806ip.js";import{a as N,n as P,u as F}from"./onboarding-DCrFdRM5.js";import{i as I,n as L,r as R,t as z}from"./tabs-0fGgot48.js";import{t as B}from"./use-deferred-search-DOfdC3JO.js";import{t as V}from"./model-star-rating-DrR6jzjq.js";import{i as H,o as U}from"./settings-list-CICo_cz2.js";import{t as W}from"./settings-models-skeleton-MXSIpmT8.js";var G=e(m(),1),K=c(),q=l(`app.use-settings-models-data.hook`);function J(e){return`settings-models:coding:${e}`}function Y(e){return`settings-models:image:${e}`}async function te(){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 a(e.slug);r[e.slug]=t.models,i[e.slug]=new Set(t.enabledModelIds)}catch(t){q.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 X(e){let t=e.filter(e=>e.name.toLowerCase()===`openrouter`),n={},r={};return await Promise.all(t.map(async e=>{try{let t=await v(e.slug);n[e.slug]=t.models,r[e.slug]=new Set(t.enabledModelIds)}catch(t){q.error(`Failed to load image models for ${e.slug}:`,t),n[e.slug]=[],r[e.slug]=new Set}})),{allImageModels:n,enabledImageModelIds:r}}var Z=i();function ne({providers:e,globalSearchQuery:t,providerSortOptions:i,setProviderSortOptions:a,filterAndSortModels:c,getModelDisplayName:l,onSaveStatus:m}){let g=k(Y(0),()=>X(e)),[_]=(0,G.useState)(g.allImageModels),[v,S]=(0,G.useState)(g.enabledImageModelIds);async function T(e,t){try{v[e]?.has(t)?(await n(e,t),S(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await o(e,t),S(n=>({...n,[e]:new Set([...n[e]||[],t])}))),m(`Model preferences saved successfully`)}catch(e){m(e instanceof Error?e.message:`Failed to save model changes`)}}async function E(e,t){let n=_[e],r=v[e];if(n)for(let i of n)r?.has(i.id)!==t&&await T(e,i.id)}return(0,Z.jsx)(`div`,{className:`space-y-6`,children:e.filter(e=>e.name.toLowerCase()===`openrouter`).map(e=>{let n=_[e.slug]||[],o=v[e.slug]||new Set,m=i[e.slug]||`alphabetical`,g=c(n,o,m);return g.length===0&&t?null:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:(0,Z.jsx)(`img`,{src:x(e.slug),alt:`${e.name} logo`,className:`h-5 w-5 dark:invert`,onError:e=>{e.target.style.display=`none`;let t=e.target.parentElement;t&&(t.classList.remove(`overflow-hidden`),t.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-muted-foreground"><path d="M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5"/><path d="M8.5 8.5a2.5 2.5 0 0 0 0 5"/><path d="M15.5 15.5a2.5 2.5 0 0 0 0-5"/></svg>`)}})}),(0,Z.jsx)(w,{title:e.name,className:`mb-0`})]}),g.length>0&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(N,{id:`select-all-image-${e.slug}`,checked:g.every(e=>o.has(e.id)),onCheckedChange:t=>void E(e.slug,t===!0)}),(0,Z.jsx)(`label`,{htmlFor:`select-all-image-${e.slug}`,className:s(b.body,`cursor-pointer whitespace-nowrap`),children:`Select all models`})]}),(0,Z.jsx)(C,{children:(0,Z.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,Z.jsxs)(d,{children:[(0,Z.jsx)(r,{asChild:!0,children:(0,Z.jsx)(f,{type:`button`,variant:m===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>a(t=>({...t,[e.slug]:`alphabetical`})),children:(0,Z.jsx)(y,{className:`h-4 w-4`})})}),(0,Z.jsx)(p,{children:`Sort A–Z`})]}),(0,Z.jsxs)(d,{children:[(0,Z.jsx)(r,{asChild:!0,children:(0,Z.jsx)(f,{type:`button`,variant:m===`price-low`||m===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>a(t=>({...t,[e.slug]:`price-low`})),children:(0,Z.jsx)(h,{className:`h-4 w-4`})})}),(0,Z.jsx)(p,{children:`Sort by price`})]})]})})]}),g.length===0?(0,Z.jsx)(U,{message:t?`No models matching your search.`:`No image models available for this provider.`}):(0,Z.jsx)(C,{children:(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:g.map(t=>{let n=o.has(t.id),r=t.pricing;return(0,Z.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,Z.jsx)(N,{id:`image-${t.id}`,checked:n,onCheckedChange:()=>void T(e.slug,t.id),className:`mt-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,Z.jsx)(`label`,{htmlFor:`image-${t.id}`,className:s(b.label,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:l(t)})}),r&&(0,Z.jsx)(`span`,{className:s(b.compact,`text-muted-foreground whitespace-nowrap flex-shrink-0`),children:(r.prompt??0)===0&&(r.completion??0)===0?``:`$${u(r.prompt??0)} in | $${u(r.completion??0)} out`})]})]},t.id)})})})]},e.slug)})})}function Q({loadVersion:e}){let t=k(J(e),()=>te()),n=t.providers,[i]=(0,G.useState)(t.allModels),[a,o]=(0,G.useState)(t.enabledModelIds),[c,l]=(0,G.useState)(`coding`),{query:m,setQuery:v,deferredQuery:A}=B(),[j,W]=(0,G.useState)(t.providerSortOptions),[K,q]=(0,G.useState)(``),Y=e=>F(e.id),X=async(e,t)=>{try{a[e]?.has(t)?(await _(e,t),o(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await g(e,t),o(n=>({...n,[e]:new Set([...n[e]||[],t])}))),q(`Model preferences saved successfully`),setTimeout(()=>q(``),3e3)}catch(e){q(e instanceof Error?e.message:`Failed to save model changes`)}},Q=async(e,t)=>{let n=i[e],r=a[e];if(n)for(let i of n)r?.has(i.id)!==t&&await X(e,i.id)},$=(e,t,n)=>P({models:e,query:A,sortBy:n,getDisplayName:Y,getPriority:e=>+!t.has(e.id)});return n.length===0?(0,Z.jsx)(O,{title:`No providers configured`,children:`Configure a provider with an API key to view available models.`}):(0,Z.jsx)(T,{children:(0,Z.jsxs)(E,{children:[(0,Z.jsx)(D,{title:`Models`,description:`View and manage available models from your configured providers.`}),(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsx)(H,{placeholder:`Search models across all providers...`,value:m,onChange:v}),(0,Z.jsxs)(z,{value:c,onValueChange:e=>{l(e),v(``)},children:[(0,Z.jsxs)(R,{className:`mb-4`,children:[(0,Z.jsx)(I,{value:`coding`,children:`Coding`}),n.some(e=>e.name.toLowerCase()===`openrouter`)&&(0,Z.jsx)(I,{value:`image`,children:`Image`})]}),(0,Z.jsx)(L,{value:`coding`,children:(0,Z.jsx)(`div`,{className:`space-y-6`,children:n.map(e=>{let t=i[e.slug]||[],n=a[e.slug]||new Set,o=j[e.slug]||`alphabetical`,c=$(t,n,o);return c.length===0&&m?null:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:(0,Z.jsx)(`img`,{src:x(e.slug),alt:`${e.name} logo`,className:`h-5 w-5 dark:invert`,onError:e=>{e.target.style.display=`none`;let t=e.target.parentElement;t&&(t.classList.remove(`overflow-hidden`),t.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-muted-foreground"><path d="M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5"/><path d="M8.5 8.5a2.5 2.5 0 0 0 0 5"/><path d="M15.5 15.5a2.5 2.5 0 0 0 0-5"/></svg>`)}})}),(0,Z.jsx)(w,{title:e.name,className:`mb-0`})]}),c.length>0&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(N,{id:`select-all-${e.slug}`,checked:c.every(e=>n.has(e.id)),onCheckedChange:t=>Q(e.slug,t===!0)}),(0,Z.jsx)(`label`,{htmlFor:`select-all-${e.slug}`,className:s(b.body,`cursor-pointer whitespace-nowrap`),children:`Select all models`})]}),(0,Z.jsx)(C,{children:(0,Z.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,Z.jsxs)(d,{children:[(0,Z.jsx)(r,{asChild:!0,children:(0,Z.jsx)(f,{type:`button`,variant:o===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>W(t=>({...t,[e.slug]:`alphabetical`})),children:(0,Z.jsx)(y,{className:`h-4 w-4`})})}),(0,Z.jsx)(p,{children:`Sort A–Z`})]}),(0,Z.jsxs)(d,{children:[(0,Z.jsx)(r,{asChild:!0,children:(0,Z.jsx)(f,{type:`button`,variant:o===`price-low`||o===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>W(t=>({...t,[e.slug]:`price-low`})),children:(0,Z.jsx)(h,{className:`h-4 w-4`})})}),(0,Z.jsx)(p,{children:`Sort by price`})]}),(0,Z.jsxs)(d,{children:[(0,Z.jsx)(r,{asChild:!0,children:(0,Z.jsx)(f,{type:`button`,variant:o===`coding-index`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>W(t=>({...t,[e.slug]:`coding-index`})),children:(0,Z.jsx)(S,{className:`h-4 w-4`})})}),(0,Z.jsx)(p,{children:`Sort by coding intelligence`})]})]})})]}),c.length===0?(0,Z.jsx)(U,{message:m?`No models matching your search.`:`No models available for this provider.`}):(0,Z.jsx)(C,{children:(0,Z.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:c.map(t=>{let r=n.has(t.id),i=t.pricing;return(0,Z.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,Z.jsx)(N,{id:t.id,checked:r,onCheckedChange:()=>X(e.slug,t.id),className:`mt-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,Z.jsx)(`label`,{htmlFor:t.id,className:s(b.body,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:Y(t)})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[o===`coding-index`&&(0,Z.jsx)(V,{codingIndex:t.coding_index,modelName:Y(t)}),i&&(0,Z.jsx)(`span`,{className:s(b.compact,`text-muted-foreground whitespace-nowrap`),children:(i.prompt??0)===0&&(i.completion??0)===0?``:`$${u(i.prompt??0)} in | $${u(i.completion??0)} out`})]})]})]},t.id)})})})]},e.slug)})})}),(0,Z.jsx)(L,{value:`image`,children:c===`image`?(0,Z.jsx)(G.Suspense,{fallback:(0,Z.jsx)(ee,{className:`py-12`,size:`sm`}),children:(0,Z.jsx)(ne,{providers:n,globalSearchQuery:m,providerSortOptions:j,setProviderSortOptions:W,filterAndSortModels:$,getModelDisplayName:Y,onSaveStatus:e=>{q(e),e.includes(`Failed`)||setTimeout(()=>q(``),3e3)}})}):null})]}),K&&(0,Z.jsx)(M,{variant:K.includes(`error`)||K.includes(`Failed`)?`error`:`success`,className:`mb-0`,children:K})]})]})})}function $(){let e=(0,K.c)(8),[t,n]=(0,G.useState)(0),r;e[0]===t?r=e[1]:(r=function(){j(J(t)),n(ie)},e[0]=t,e[1]=r);let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(W,{}),e[2]=a):a=e[2];let o;e[3]===t?o=e[4]:(o=(0,Z.jsx)(G.Suspense,{fallback:a,children:(0,Z.jsx)(Q,{loadVersion:t},t)}),e[3]=t,e[4]=o);let s;return e[5]!==i||e[6]!==o?(s=(0,Z.jsx)(A,{fallbackTitle:`Failed to load models`,onRetry:i,renderFallback:re,children:o}),e[5]=i,e[6]=o,e[7]=s):s=e[7],s}function re(e,t){return(0,Z.jsx)(O,{title:`Failed to load models`,action:(0,Z.jsx)(f,{variant:`outline`,onClick:t,children:`Retry`}),children:e.message})}function ie(e){return e+1}export{$ as SettingsModelsView,$ as default};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$i as t,Br as n,Ct as r,Fs as i,Ii as a,Is as o,Lr as s,P as c,Pi as l,Qr as u,R as d,Rr as f,Rs as p,Zr as m,ei as ee,fs as h,nn as te,pa as ne,vt as g,wn as _,zr as re,zt as ie}from"./dialogs-config-86QTDk4G.js";import{n as v,t as y}from"./react-vendor-DK2COBjg.js";import{A as ae,C as b,D as x,E as oe,F as se,M as ce,N as le,O as ue,P as S,S as C,T as w,b as T,j as de,k as fe,x as pe,y as E}from"./history-view-BsN806ip.js";import{B as D,H as O,L as me,P as he,W as k}from"./index-C2iIghSR.js";import{t as A}from"./skeleton-BvvAbfo4.js";import{t as j}from"./use-deferred-search-DOfdC3JO.js";import{i as M,n as N,r as P,t as F}from"./settings-list-CICo_cz2.js";import{t as I}from"./mcp-server-card-DUJUtQq-.js";import{i as L,n as R,r as z,t as ge}from"./slug-utils-jE4NOx-f.js";var B=o(),V=e(p(),1),H=i(),U=V.forwardRef((e,t)=>{let n=(0,B.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 o;n[3]===r?o=n[4]:(o=a(`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]=o);let s;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,H.jsx)(v,{className:a(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`)}),n[5]=s):s=n[5];let c;return n[6]!==i||n[7]!==t||n[8]!==o?(c=(0,H.jsx)(y,{className:o,...i,ref:t,children:s}),n[6]=i,n[7]=t,n[8]=o,n[9]=c):c=n[9],c});U.displayName=y.displayName;function _e({threadId:e,onRuleCreated:t}){let[n,r]=(0,V.useState)(``),[i,o]=(0,V.useState)(``),[s,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(!1),d=z(n),f=R(d),p=async()=>{if(!(!f||!e)){u(!0);try{let n=`---
|
|
2
|
+
description: ${i.trim()}
|
|
3
|
+
alwaysApply: ${s}
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Place your rule instructions here as markdown.
|
|
7
|
+
`;await _(e,`.agents/rules/${d}.md`,n),D({title:`Rule created`,description:`Rule '${d}' was created successfully.`}),r(``),o(``),c(!1),t?.(d)}catch(e){D({title:`Error`,description:e instanceof Error?e.message:`Failed to create rule`,variant:`destructive`})}finally{u(!1)}}};return e?(0,H.jsx)(x,{children:(0,H.jsxs)(E,{children:[(0,H.jsx)(C,{title:`Add Rule`,description:`Create a new agent rule. The rule will be saved as a .md file in the .agents/rules folder.`}),(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsxs)(T,{title:`Rule Name`,children:[(0,H.jsx)(m,{id:`ruleName`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Code Style Guide`,disabled:l}),n?(0,H.jsxs)(`p`,{className:a(h.caption,`mt-2`),children:[`File name: `,(0,H.jsxs)(`span`,{className:`font-mono`,children:[d||`...`,`.md`]})]}):null]}),(0,H.jsx)(T,{title:`Description`,children:(0,H.jsx)(O,{id:`ruleDescription`,value:i,onChange:e=>o(e.target.value),placeholder:`Describe when Tarsk should apply this rule...`,className:`resize-none min-h-[120px]`,disabled:l})}),(0,H.jsx)(T,{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,H.jsx)(U,{id:`alwaysApply`,checked:s,onCheckedChange:c,disabled:l})}),(0,H.jsx)(L,{onContinue:()=>void p(),disabled:!f||!i.trim(),creating:l})]})]})}):(0,H.jsx)(w,{title:`No thread selected`,children:`Please select a thread to add a rule.`})}function W(e){let t=[];for(let n of e)n.type===`file`&&n.path.startsWith(`.agents/rules/`)&&t.push(n),n.children&&n.children.length>0&&t.push(...W(n.children));return t}function G(){let e=k(e=>e.selectedProjectId),i=k(e=>e.selectedThreadId),{setActiveMainTab:o}=me(),{setPendingExplorerPath:p,triggerExplorerRefresh:m,setExplorerClearPath:v}=he(),[y,T]=(0,V.useState)([]),[E,O]=(0,V.useState)(!1),[L,R]=(0,V.useState)(!1),[z,B]=(0,V.useState)(null),[U,G]=(0,V.useState)(!1),[K,q]=(0,V.useState)([]),[J,Y]=(0,V.useState)(new Set),{query:X,setQuery:ve,deferredQuery:Z}=j(),Q=(0,V.useCallback)(async()=>{if(e){O(!0);try{let t=W(await r(e));if(i)try{let e=W(await ie(i)),n=new Set(t.map(e=>e.path));for(let r of e)n.has(r.path)||t.push(r)}catch{}T(t),Y(new Set(t.map(e=>e.path)))}catch{T([]),Y(new Set)}finally{O(!1)}}},[e,i]);(0,V.useEffect)(()=>{Q()},[Q]),(0,V.useEffect)(()=>{g().then(q).catch(()=>q([]))},[]);let ye=(0,V.useCallback)(async t=>{if(!e)return;let n=t.name,r=t.path;G(!0);try{try{await c(e,r)}catch{if(i)await d(i,r);else throw Error(`No thread selected to delete from`)}v(r),m(),Y(e=>{let t=new Set(e);return t.delete(r),t}),D({title:`Rule removed`,description:n}),B(null),await Q()}catch(e){D({title:`Error`,description:e instanceof Error?e.message:`Failed to remove rule`,variant:`destructive`})}finally{G(!1)}},[e,i,Q,m,v]),be=(0,V.useCallback)(e=>{p(e),o(`explorer`)},[p,o]),xe=(0,V.useCallback)(async e=>{let t=`.agents/rules/${e.name}.md`;if(!(!i||J.has(t)))try{e.gitHubRepo&&e.gitHubFolder?await te(i,e.gitHubRepo,e.gitHubFolder,`.agents/rules`):await _(i,t,[`---`,`description: ${e.description}`,`alwaysApply: ${e.alwaysApply??!1}`,`---`,``,e.content].join(`
|
|
8
|
+
`)),Y(e=>new Set(e).add(t)),m(),Q(),D({title:`Rule installed`,description:e.name})}catch(e){D({title:`Error`,description:e instanceof Error?e.message:`Failed to install rule`,variant:`destructive`})}},[i,J,m,Q]),$=(0,V.useMemo)(()=>Z.trim()?K.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):K,[K,Z]);return e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(x,{children:(0,H.jsxs)(oe,{children:[(0,H.jsx)(C,{title:`Rules`,description:`Manage agent rules. Rules define coding standards and project-wide guidelines.`,action:(0,H.jsx)(l,{onClick:()=>R(!0),disabled:!i,children:`Add Rule`})}),!i&&(0,H.jsx)(pe,{children:`Select a thread to add or install rules.`}),(0,H.jsx)(b,{title:`Installed`}),E?(0,H.jsxs)(`div`,{className:`space-y-3 mb-8`,children:[(0,H.jsx)(A,{className:`h-12 w-full`}),(0,H.jsx)(A,{className:`h-12 w-full`})]}):y.length===0?(0,H.jsx)(F,{icon:ne,title:`No rules installed`,description:`Add rules to enforce coding standards and project conventions.`}):(0,H.jsx)(`div`,{className:`mb-8 overflow-hidden rounded-md border border-border`,children:y.map((e,r)=>(0,H.jsxs)(`div`,{className:a(`group grid min-h-13 grid-cols-[minmax(0,1fr)_1.75rem] items-center gap-3 px-3 py-3 hover:bg-muted/30`,r>0&&`border-t border-border`),children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>be(e.path),className:a(h.body,`truncate text-left`),children:e.name.replace(/\.mdc$/i,``)}),(0,H.jsx)(re,{children:(0,H.jsxs)(s,{children:[(0,H.jsx)(n,{asChild:!0,children:(0,H.jsx)(l,{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:()=>B(e),"aria-label":`Delete ${e.name.replace(/\.mdc$/i,``)}`,children:(0,H.jsx)(t,{className:`h-4 w-4`})})}),(0,H.jsx)(f,{children:`Remove this rule from the project`})]})})]},e.id))}),(0,H.jsx)(b,{title:`Available`,className:`mb-0`}),(0,H.jsx)(M,{placeholder:`Search available rules...`,value:X,onChange:ve}),K.length===0?(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(A,{className:`h-20 w-full`}),(0,H.jsx)(A,{className:`h-20 w-full`})]}):$.length===0?(0,H.jsx)(P,{searchQuery:X,emptyLabel:`No available rules found.`}):(0,H.jsx)(N,{children:$.map(e=>{let t=`.agents/rules/${e.name}.md`,n=J.has(t);return(0,H.jsx)(I,{name:ge(e.name),description:e.description,installed:n,onClick:()=>{n||xe(e)},showInstalledControls:!1},e.id)})})]})}),(0,H.jsx)(u,{open:L,onOpenChange:R,children:(0,H.jsx)(ee,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,H.jsx)(_e,{threadId:i,onRuleCreated:()=>{R(!1),Q(),m()}})})}),(0,H.jsx)(ue,{open:z!==null,onOpenChange:e=>!e&&B(null),children:(0,H.jsxs)(de,{children:[(0,H.jsxs)(S,{children:[(0,H.jsx)(se,{children:`Delete Rule`}),(0,H.jsxs)(ce,{children:[`Are you sure you want to delete the rule "`,z?.name,`"? This action cannot be undone.`]})]}),(0,H.jsxs)(le,{children:[(0,H.jsx)(ae,{children:`Cancel`}),(0,H.jsx)(fe,{onClick:()=>z&&void ye(z),disabled:U,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:U?`Deleting...`:`Delete`})]})]})})]}):(0,H.jsx)(w,{children:`Select a project to manage rules.`})}export{G as SettingsRulesView,G as default};
|
package/dist/public/assets/{settings-skills-view-MZQjnD_g.js → settings-skills-view-B6srjIvU.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$i as t,Ba as n,Br as r,Ct as i,Er as a,F as o,
|
|
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:t,skill:n,catalogSourceId:r,onInstall:i}){let[a,o]=(0,q.useState)([]),[s,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(!1),[_,v]=(0,q.useState)(null),[b,x]=(0,q.useState)(!1),S=Z(n,r),C=!!S;(0,q.useEffect)(()=>{if(!e||!n)return;let t=n,i=Z(t,r),a=!1;async function s(){p(!0),v(null),o([]),l(null),d(``);try{if(i){let e=await P(i,t.id);if(a)return;o(e.files),l(Ue(e.files))}else{if(a)return;o([`SKILL.md`]),l(`SKILL.md`),d(Y(t))}}catch(e){if(a)return;v(e instanceof Error?e.message:`Failed to load skill files`)}finally{a||p(!1)}}return s(),()=>{a=!0}},[e,n,r]),(0,q.useEffect)(()=>{if(!e||!n||!s||!C||!S)return;let t=n,r=s,i=!1;async function a(){h(!0),v(null);try{let e=await re(S,t.id,r);if(i)return;d(e.content)}catch(e){if(i)return;v(e instanceof Error?e.message:`Failed to load file`),d(``)}finally{i||h(!1)}}return a(),()=>{i=!0}},[e,n,s,C,S]);let w=(0,q.useCallback)(async()=>{if(!n)return;let e=S?{...n,sourceId:S}:n;x(!0);try{await i(e),t(!1)}finally{x(!1)}},[n,S,i,t]),T=f||C&&m,E=s?X(s):!1,O=(0,q.useMemo)(()=>a.map(e=>(0,J.jsxs)(Oe,{selected:e===s,onClick:()=>l(e),className:`gap-2 cursor-pointer`,children:[(0,J.jsx)(L,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,J.jsx)(`span`,{className:c(k.caption,`truncate`),children:e})]},e)),[a,s]);return(0,J.jsx)(y,{open:e,onOpenChange:t,children:(0,J.jsxs)(D,{className:`flex max-h-[90vh] max-w-5xl flex-col gap-0 overflow-hidden p-0`,children:[(0,J.jsxs)(te,{className:`border-b border-border px-6 py-4`,children:[(0,J.jsx)(A,{children:n?.name??`Review skill`}),n?.description?(0,J.jsx)(R,{children:n.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:c(k.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:f?(0,J.jsx)(H,{className:`py-8`,label:`Loading files...`}):a.length===0?(0,J.jsx)(`p`,{className:c(k.caption,`px-3 py-2 text-muted-foreground`),children:`No files found.`}):O})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-4`,children:_?(0,J.jsx)(`p`,{className:c(k.body,`text-destructive`),children:_}):T?(0,J.jsx)(H,{className:`py-12`,label:`Loading preview...`}):E?(0,J.jsx)(Me,{content:u,enableMermaid:!1}):(0,J.jsx)(`pre`,{className:c(k.caption,`overflow-x-auto whitespace-pre-wrap font-mono`),children:u})})]}),(0,J.jsxs)(N,{className:`border-t border-border px-6 py-4 sm:justify-between`,children:[(0,J.jsx)(g,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,J.jsx)(g,{type:`button`,onClick:()=>void w(),disabled:b||!n,children:b?`Installing...`:`Install`})]})]})})}var Ge=v(),Q=new Map;function Ke(e){let t=Q.get(e);if(t)return t;let n=f(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[n,r]=(0,q.useState)(t),[i,o]=(0,q.useState)(B),s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=[],e[1]=s):s=e[1];let[c,u]=(0,q.useState)(s),[d,f]=(0,q.useState)(!1),[p,h]=(0,q.useState)(!1),g;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=async()=>{try{r(await m())}catch{r([])}},e[2]=g):g=e[2];let v=g,y,b;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{(async function(){let e=z();if(e.length>0)try{await O(e),F()}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),_(e)},e[5]=x):x=e[5];let S=x,C;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{r(t=>[...t.filter(t=>t.id!==e.id),e].sort(Xe)),S(e.id)},e[6]=C):C=e[6];let w=C,T;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{r(t=>t.map(t=>t.id===e.id?e:t).sort(Ye)),M(e.id)},e[7]=T):T=e[7];let E=T,D;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{r(t=>t.filter(t=>t.id!==e)),M(e),o(t=>t===e?(_(`default`),`default`):t)},e[8]=D):D=e[8];let k=D,A,j;e[9]===i?(A=e[10],j=e[11]):(j=()=>{if(i==="default"){u([]),f(!1),h(!1);return}let e=a(i);e?.skills?(u(qe(i,e.skills)),f(!1)):(u([]),f(!0));let t=!1;return h(!!e?.skills),Ke(i).then(e=>{if(t)return;let n=qe(i,e);u(n),l(i,{fetchedAt:Date.now(),skills:n})}).catch(n=>{t||(e?.skills||u([]),U({title:`Error`,description:n instanceof Error?n.message:`Failed to load skill catalog`,variant:`destructive`}))}).finally(()=>{t||(f(!1),h(!1))}),()=>{t=!0}},A=[i],e[9]=i,e[10]=A,e[11]=j),(0,q.useEffect)(j,A);let N;return e[12]!==c||e[13]!==d||e[14]!==p||e[15]!==i||e[16]!==n?(N={sources:n,selectedSourceId:i,setSelectedSourceId:S,addSource:w,updateSource:E,removeSource:k,reloadSources:v,catalogSkills:c,isLoadingCatalog:d,isRefreshingCatalog:p},e[12]=c,e[13]=d,e[14]=p,e[15]=i,e[16]=n,e[17]=N):N=e[17],N}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:t,editingSource:r,onSourceAdded:i,onSourceUpdated:a,onSourceDeleted:l}){let[u,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),T=r!=null;function O(){d(``),p(``),h(null),v(!1),x(!1),C(!1)}function j(e){e||O(),t(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 M(){let e=u.trim(),t=f.trim();if(!e||!t){h(`Title and URL are required.`);return}v(!0),h(null);try{if(T&&r){let n=await s(r.id,e,t);a?.(n.source)}else i((await I(e,t)).source);j(!1)}catch(e){h(e instanceof Error?e.message:`Failed to verify skill source`)}finally{v(!1)}}async function P(){if(r){x(!0),h(null);try{await o(r.id),l?.(r.id),C(!1),j(!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)(y,{open:e,onOpenChange:j,children:(0,J.jsxs)(D,{className:`sm:max-w-lg`,children:[(0,J.jsxs)(te,{children:[(0,J.jsx)(A,{children:T?`Edit Skill Source`:`Add Skill Source`}),(0,J.jsx)(R,{children:T?`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)(w,{htmlFor:`skill-source-title`,children:`Title`}),(0,J.jsx)(E,{id:`skill-source-title`,placeholder:`e.g. My Team Skills`,value:u,onChange:e=>d(e.target.value),disabled:_||b,autoFocus:!0})]}),(0,J.jsxs)(`div`,{className:`grid gap-2`,children:[(0,J.jsx)(w,{htmlFor:`skill-source-url`,children:`URL`}),(0,J.jsx)(E,{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:c(k.caption,`text-destructive`),children:m}):null]}),(0,J.jsxs)(N,{className:`flex-col-reverse gap-2 sm:flex-row sm:justify-between`,children:[T?(0,J.jsx)(g,{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)(g,{variant:`outline`,onClick:()=>j(!1),disabled:_||b,children:`Cancel`}),(0,J.jsx)(g,{onClick:()=>void M(),disabled:_||b||!u.trim()||!f.trim(),children:_?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(n,{className:`mr-2 h-4 w-4 animate-spin`}),`Verifying...`]}):T?`Save Changes`:`Add Source`})]})]})]})}),(0,J.jsx)(he,{open:S,onOpenChange:C,children:(0,J.jsxs)(Ce,{children:[(0,J.jsxs)(ge,{children:[(0,J.jsx)(fe,{children:`Delete Skill Source`}),(0,J.jsxs)(pe,{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)(me,{children:[(0,J.jsx)(ce,{disabled:b,children:`Cancel`}),(0,J.jsx)(we,{onClick:()=>void P(),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),n=Ne(e=>e.selectedThreadId),{setActiveMainTab:a}=Ae(),{setPendingExplorerPath:o,triggerExplorerRefresh:s,setExplorerClearPath:l}=je(),[u,f]=(0,q.useState)([]),[p,m]=(0,q.useState)(!1),[_,v]=(0,q.useState)(!1),[w,E]=(0,q.useState)(null),[O,A]=(0,q.useState)(!1),[j,M]=(0,q.useState)([]),[N,P]=(0,q.useState)(new Set),[F,I]=(0,q.useState)(null),[te,L]=(0,q.useState)(!1),{query:R,setQuery:re,deferredQuery:z}=Pe(),{sources:B,selectedSourceId:V,setSelectedSourceId:De,addSource:Oe,updateSource:ke,removeSource:Me,catalogSkills:G,isLoadingCatalog:Be}=Je(),K=V==="default",Y=(0,q.useMemo)(()=>T(V)?B.find(e=>e.id===V)??null:null,[V,B]),X=(0,q.useCallback)(async()=>{if(e){m(!0);try{let t=$(await i(e));if(n)try{let e=$(await se(n)),r=new Set(t.map(e=>e.path));for(let n of e)r.has(n.path)||t.push(n)}catch{}t.sort((e,t)=>e.name.localeCompare(t.name)),f(t),P(new Set(t.map(e=>`${e.path}/SKILL.md`)))}catch{f([]),P(new Set)}finally{m(!1)}}},[e,n]);(0,q.useEffect)(()=>{X()},[X]),(0,q.useEffect)(()=>{ae().then(M).catch(()=>M([]))},[]);let Ue=(0,q.useCallback)(async t=>{if(!e)return;let r=t.name,i=t.path;A(!0);try{try{await h(e,i)}catch{if(n)await b(n,i);else throw Error(`No thread selected to delete from`)}l(i),s(),P(e=>{let t=new Set(e);return t.delete(`${i}/SKILL.md`),t}),U({title:`Skill removed`,description:r}),E(null),await X()}catch(e){U({title:`Error`,description:e instanceof Error?e.message:`Failed to remove skill`,variant:`destructive`})}finally{A(!1)}},[e,n,X,s,l]),Z=(0,q.useCallback)(e=>{o(`${e}/SKILL.md`),a(`explorer`)},[o,a]),Ge=(0,q.useCallback)(async e=>{let t=`.agents/skills/${e.id}/SKILL.md`;if(!n||N.has(t))return;let r=e.sourceId??(V==="default"?void 0:V);try{if(r)await ne(n,r,e.id,`.agents/skills/${e.id}`);else{let r=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.allowedTools&&r.push(`allowed-tools: ${e.allowedTools}`),e.license&&r.push(`license: ${e.license}`),r.push(`---`,``,e.instructions??``),await ie(n,t,r.join(`
|
|
3
|
-
`))}P(e=>new Set(e).add(t)),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}},[n,V,N,s,X]),Q=(0,q.useMemo)(()=>z.trim()?j.filter(e=>e.name.toLowerCase().includes(z.toLowerCase())||e.description.toLowerCase().includes(z.toLowerCase())):j,[j,z]),Ke=(0,q.useMemo)(()=>z.trim()?G.filter(e=>e.name.toLowerCase().includes(z.toLowerCase())||e.description.toLowerCase().includes(z.toLowerCase())):G,[G,z]),qe=K?j.length===0:Be&&G.length===0;return e?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(ue,{children:(0,J.jsxs)(de,{children:[(0,J.jsx)(_e,{title:`Skills`,description:`Manage agent skills. Skills are reusable instruction sets that guide agent behavior.`,action:(0,J.jsx)(g,{onClick:()=>
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$i as t,Ba as n,Br as r,Ct as i,Er as a,F as o,Fs as s,Gn as c,Ii as l,Ir as u,Is as d,Lr as f,Mt as p,Nt as m,P as h,Pi as g,Pr as _,Qr as v,R as y,Rr as b,Rs as x,Sa as S,Ta as C,Yr as w,Zo as T,Zr as E,ei as D,en as O,fs as k,ii as A,k as j,mr as M,ni as N,nt as P,pr as F,qi as ee,qn as I,ri as te,ro as L,ti as R,tn as ne,tt as re,vr as z,wn as ie,wr as B,yt as ae,zr as oe,zt as se}from"./dialogs-config-86QTDk4G.js";import{A as ce,C as le,D as ue,E as de,F as fe,M as pe,N as me,O as he,P as ge,S as _e,T as ve,b as V,d as ye,f as be,g as xe,h as Se,j as Ce,k as we,l as H,p as Te,x as Ee,y as De}from"./history-view-BsN806ip.js";import{d as Oe}from"./onboarding-DCrFdRM5.js";import{B as U,H as ke,L as Ae,P as je,R as Me,W as Ne}from"./index-C2iIghSR.js";import{t as W}from"./skeleton-BvvAbfo4.js";import{t as Pe}from"./use-deferred-search-DOfdC3JO.js";import{a as Fe,n as Ie,r as Le,t as Re}from"./settings-list-CICo_cz2.js";import{t as ze}from"./mcp-server-card-DUJUtQq-.js";import{i as G,n as Be,r as K,t as Ve}from"./slug-utils-jE4NOx-f.js";var q=e(x(),1),J=s();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),u=Be(c),d=async()=>{if(!(!u||!i.trim()||!e)){s(!0);try{let n=await j(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)(ue,{children:(0,J.jsxs)(De,{children:[(0,J.jsx)(_e,{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)(V,{title:`Skill Name`,children:[(0,J.jsx)(E,{id:`skillName`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Code Review`,disabled:o}),n?(0,J.jsxs)(`p`,{className:l(k.caption,`mt-2`),children:[`Folder name: `,(0,J.jsx)(`span`,{className:`font-mono`,children:c||`...`})]}):null]}),(0,J.jsx)(V,{title:`Description`,children:(0,J.jsx)(ke,{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 d(),disabled:!u||!i.trim(),creating:o})]})]})}):(0,J.jsx)(ve,{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:t,skill:n,catalogSourceId:r,onInstall:i}){let[a,o]=(0,q.useState)([]),[s,c]=(0,q.useState)(null),[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(!1),[_,y]=(0,q.useState)(null),[b,x]=(0,q.useState)(!1),S=Z(n,r),C=!!S;(0,q.useEffect)(()=>{if(!e||!n)return;let t=n,i=Z(t,r),a=!1;async function s(){p(!0),y(null),o([]),c(null),d(``);try{if(i){let e=await P(i,t.id);if(a)return;o(e.files),c(Ue(e.files))}else{if(a)return;o([`SKILL.md`]),c(`SKILL.md`),d(Y(t))}}catch(e){if(a)return;y(e instanceof Error?e.message:`Failed to load skill files`)}finally{a||p(!1)}}return s(),()=>{a=!0}},[e,n,r]),(0,q.useEffect)(()=>{if(!e||!n||!s||!C||!S)return;let t=n,r=s,i=!1;async function a(){h(!0),y(null);try{let e=await re(S,t.id,r);if(i)return;d(e.content)}catch(e){if(i)return;y(e instanceof Error?e.message:`Failed to load file`),d(``)}finally{i||h(!1)}}return a(),()=>{i=!0}},[e,n,s,C,S]);let w=(0,q.useCallback)(async()=>{if(!n)return;let e=S?{...n,sourceId:S}:n;x(!0);try{await i(e),t(!1)}finally{x(!1)}},[n,S,i,t]),T=f||C&&m,E=s?X(s):!1,O=(0,q.useMemo)(()=>a.map(e=>(0,J.jsxs)(Oe,{selected:e===s,onClick:()=>c(e),className:`gap-2 cursor-pointer`,children:[(0,J.jsx)(L,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,J.jsx)(`span`,{className:l(k.caption,`truncate`),children:e})]},e)),[a,s]);return(0,J.jsx)(v,{open:e,onOpenChange:t,children:(0,J.jsxs)(D,{className:`flex max-h-[90vh] max-w-5xl flex-col gap-0 overflow-hidden p-0`,children:[(0,J.jsxs)(te,{className:`border-b border-border px-6 py-4`,children:[(0,J.jsx)(A,{children:n?.name??`Review skill`}),n?.description?(0,J.jsx)(R,{children:n.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:l(k.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:f?(0,J.jsx)(H,{className:`py-8`,label:`Loading files...`}):a.length===0?(0,J.jsx)(`p`,{className:l(k.caption,`px-3 py-2 text-muted-foreground`),children:`No files found.`}):O})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-4`,children:_?(0,J.jsx)(`p`,{className:l(k.body,`text-destructive`),children:_}):T?(0,J.jsx)(H,{className:`py-12`,label:`Loading preview...`}):E?(0,J.jsx)(Me,{content:u,enableMermaid:!1}):(0,J.jsx)(`pre`,{className:l(k.caption,`overflow-x-auto whitespace-pre-wrap font-mono`),children:u})})]}),(0,J.jsxs)(N,{className:`border-t border-border px-6 py-4 sm:justify-between`,children:[(0,J.jsx)(g,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,J.jsx)(g,{type:`button`,onClick:()=>void w(),disabled:b||!n,children:b?`Installing...`:`Install`})]})]})})}var Ge=d(),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[n,r]=(0,q.useState)(t),[i,o]=(0,q.useState)(B),s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=[],e[1]=s):s=e[1];let[c,l]=(0,q.useState)(s),[d,f]=(0,q.useState)(!1),[p,h]=(0,q.useState)(!1),g;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=async()=>{try{r(await m())}catch{r([])}},e[2]=g):g=e[2];let v=g,y,b;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{(async function(){let e=z();if(e.length>0)try{await O(e),F()}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),_(e)},e[5]=x):x=e[5];let S=x,C;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{r(t=>[...t.filter(t=>t.id!==e.id),e].sort(Xe)),S(e.id)},e[6]=C):C=e[6];let w=C,T;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{r(t=>t.map(t=>t.id===e.id?e:t).sort(Ye)),M(e.id)},e[7]=T):T=e[7];let E=T,D;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{r(t=>t.filter(t=>t.id!==e)),M(e),o(t=>t===e?(_(`default`),`default`):t)},e[8]=D):D=e[8];let k=D,A,j;e[9]===i?(A=e[10],j=e[11]):(j=()=>{if(i==="default"){l([]),f(!1),h(!1);return}let e=a(i);e?.skills?(l(qe(i,e.skills)),f(!1)):(l([]),f(!0));let t=!1;return h(!!e?.skills),Ke(i).then(e=>{if(t)return;let n=qe(i,e);l(n),u(i,{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||(f(!1),h(!1))}),()=>{t=!0}},A=[i],e[9]=i,e[10]=A,e[11]=j),(0,q.useEffect)(j,A);let N;return e[12]!==c||e[13]!==d||e[14]!==p||e[15]!==i||e[16]!==n?(N={sources:n,selectedSourceId:i,setSelectedSourceId:S,addSource:w,updateSource:E,removeSource:k,reloadSources:v,catalogSkills:c,isLoadingCatalog:d,isRefreshingCatalog:p},e[12]=c,e[13]=d,e[14]=p,e[15]=i,e[16]=n,e[17]=N):N=e[17],N}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:t,editingSource:r,onSourceAdded:i,onSourceUpdated:a,onSourceDeleted:s}){let[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(null),[_,y]=(0,q.useState)(!1),[b,x]=(0,q.useState)(!1),[S,C]=(0,q.useState)(!1),T=r!=null;function O(){d(``),p(``),h(null),y(!1),x(!1),C(!1)}function j(e){e||O(),t(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 M(){let e=u.trim(),t=f.trim();if(!e||!t){h(`Title and URL are required.`);return}y(!0),h(null);try{if(T&&r){let n=await c(r.id,e,t);a?.(n.source)}else i((await I(e,t)).source);j(!1)}catch(e){h(e instanceof Error?e.message:`Failed to verify skill source`)}finally{y(!1)}}async function P(){if(r){x(!0),h(null);try{await o(r.id),s?.(r.id),C(!1),j(!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)(v,{open:e,onOpenChange:j,children:(0,J.jsxs)(D,{className:`sm:max-w-lg`,children:[(0,J.jsxs)(te,{children:[(0,J.jsx)(A,{children:T?`Edit Skill Source`:`Add Skill Source`}),(0,J.jsx)(R,{children:T?`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)(w,{htmlFor:`skill-source-title`,children:`Title`}),(0,J.jsx)(E,{id:`skill-source-title`,placeholder:`e.g. My Team Skills`,value:u,onChange:e=>d(e.target.value),disabled:_||b,autoFocus:!0})]}),(0,J.jsxs)(`div`,{className:`grid gap-2`,children:[(0,J.jsx)(w,{htmlFor:`skill-source-url`,children:`URL`}),(0,J.jsx)(E,{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:l(k.caption,`text-destructive`),children:m}):null]}),(0,J.jsxs)(N,{className:`flex-col-reverse gap-2 sm:flex-row sm:justify-between`,children:[T?(0,J.jsx)(g,{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)(g,{variant:`outline`,onClick:()=>j(!1),disabled:_||b,children:`Cancel`}),(0,J.jsx)(g,{onClick:()=>void M(),disabled:_||b||!u.trim()||!f.trim(),children:_?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(n,{className:`mr-2 h-4 w-4 animate-spin`}),`Verifying...`]}):T?`Save Changes`:`Add Source`})]})]})]})}),(0,J.jsx)(he,{open:S,onOpenChange:C,children:(0,J.jsxs)(Ce,{children:[(0,J.jsxs)(ge,{children:[(0,J.jsx)(fe,{children:`Delete Skill Source`}),(0,J.jsxs)(pe,{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)(me,{children:[(0,J.jsx)(ce,{disabled:b,children:`Cancel`}),(0,J.jsx)(we,{onClick:()=>void P(),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),n=Ne(e=>e.selectedThreadId),{setActiveMainTab:a}=Ae(),{setPendingExplorerPath:o,triggerExplorerRefresh:s,setExplorerClearPath:c}=je(),[u,d]=(0,q.useState)([]),[p,m]=(0,q.useState)(!1),[_,x]=(0,q.useState)(!1),[w,E]=(0,q.useState)(null),[O,A]=(0,q.useState)(!1),[j,M]=(0,q.useState)([]),[N,P]=(0,q.useState)(new Set),[F,I]=(0,q.useState)(null),[te,L]=(0,q.useState)(!1),{query:R,setQuery:re,deferredQuery:z}=Pe(),{sources:B,selectedSourceId:V,setSelectedSourceId:De,addSource:Oe,updateSource:ke,removeSource:Me,catalogSkills:G,isLoadingCatalog:Be}=Je(),K=V==="default",Y=(0,q.useMemo)(()=>T(V)?B.find(e=>e.id===V)??null:null,[V,B]),X=(0,q.useCallback)(async()=>{if(e){m(!0);try{let t=$(await i(e));if(n)try{let e=$(await se(n)),r=new Set(t.map(e=>e.path));for(let n of e)r.has(n.path)||t.push(n)}catch{}t.sort((e,t)=>e.name.localeCompare(t.name)),d(t),P(new Set(t.map(e=>`${e.path}/SKILL.md`)))}catch{d([]),P(new Set)}finally{m(!1)}}},[e,n]);(0,q.useEffect)(()=>{X()},[X]),(0,q.useEffect)(()=>{ae().then(M).catch(()=>M([]))},[]);let Ue=(0,q.useCallback)(async t=>{if(!e)return;let r=t.name,i=t.path;A(!0);try{try{await h(e,i)}catch{if(n)await y(n,i);else throw Error(`No thread selected to delete from`)}c(i),s(),P(e=>{let t=new Set(e);return t.delete(`${i}/SKILL.md`),t}),U({title:`Skill removed`,description:r}),E(null),await X()}catch(e){U({title:`Error`,description:e instanceof Error?e.message:`Failed to remove skill`,variant:`destructive`})}finally{A(!1)}},[e,n,X,s,c]),Z=(0,q.useCallback)(e=>{o(`${e}/SKILL.md`),a(`explorer`)},[o,a]),Ge=(0,q.useCallback)(async e=>{let t=`.agents/skills/${e.id}/SKILL.md`;if(!n||N.has(t))return;let r=e.sourceId??(V==="default"?void 0:V);try{if(r)await ne(n,r,e.id,`.agents/skills/${e.id}`);else{let r=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.allowedTools&&r.push(`allowed-tools: ${e.allowedTools}`),e.license&&r.push(`license: ${e.license}`),r.push(`---`,``,e.instructions??``),await ie(n,t,r.join(`
|
|
3
|
+
`))}P(e=>new Set(e).add(t)),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}},[n,V,N,s,X]),Q=(0,q.useMemo)(()=>z.trim()?j.filter(e=>e.name.toLowerCase().includes(z.toLowerCase())||e.description.toLowerCase().includes(z.toLowerCase())):j,[j,z]),Ke=(0,q.useMemo)(()=>z.trim()?G.filter(e=>e.name.toLowerCase().includes(z.toLowerCase())||e.description.toLowerCase().includes(z.toLowerCase())):G,[G,z]),qe=K?j.length===0:Be&&G.length===0;return e?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(ue,{children:(0,J.jsxs)(de,{children:[(0,J.jsx)(_e,{title:`Skills`,description:`Manage agent skills. Skills are reusable instruction sets that guide agent behavior.`,action:(0,J.jsx)(g,{onClick:()=>x(!0),disabled:!n,children:`Add Skill`})}),!n&&(0,J.jsx)(Ee,{children:`Select a thread to add or install skills.`}),(0,J.jsx)(le,{title:`Installed`}),p?(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`})]}):u.length===0?(0,J.jsx)(Re,{icon:ee,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:u.map((e,n)=>(0,J.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`,n>0&&`border-t border-border`),children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>Z(e.path),className:l(k.body,`truncate text-left`),children:e.name}),(0,J.jsx)(oe,{children:(0,J.jsxs)(f,{children:[(0,J.jsx)(r,{asChild:!0,children:(0,J.jsx)(g,{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:()=>E(e),"aria-label":`Delete ${e.name}`,children:(0,J.jsx)(t,{className:`h-4 w-4`})})}),(0,J.jsx)(b,{children:`Remove this skill from the project`})]})})]},e.id))}),(0,J.jsx)(le,{title:`Available`,className:`mb-0`}),(0,J.jsx)(Fe,{search:{placeholder:`Search available skills...`,value:R,onChange:re},trailing:(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(ye,{value:V,onValueChange:De,children:[(0,J.jsx)(Se,{className:`w-full min-w-0`,"aria-label":`Skill source`,children:(0,J.jsx)(xe,{placeholder:`Default`})}),(0,J.jsxs)(be,{children:[(0,J.jsx)(Te,{value:`default`,children:`Default`}),B.map(e=>(0,J.jsx)(Te,{value:e.id,children:e.title},e.id))]})]}),(0,J.jsx)(oe,{children:(0,J.jsxs)(f,{children:[(0,J.jsx)(r,{asChild:!0,children:(0,J.jsx)(g,{type:`button`,variant:`outline`,size:`icon`,className:`shrink-0`,onClick:()=>L(!0),"aria-label":Y?`Edit skill source`:`Add skill source`,children:Y?(0,J.jsx)(C,{className:`h-4 w-4`}):(0,J.jsx)(S,{className:`h-4 w-4`})})}),(0,J.jsx)(b,{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)(H,{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=N.has(t);return(0,J.jsx)(ze,{name:Ve(e.name),description:e.description,installed:n,onClick:()=>{n||I(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=N.has(t);return(0,J.jsx)(ze,{name:Ve(e.name),description:e.description,installed:n,onClick:()=>{n||I({...e,sourceId:e.sourceId??V})},showInstalledControls:!1},e.id)})})]})}),(0,J.jsx)(We,{open:F!==null,onOpenChange:e=>{e||I(null)},skill:F,catalogSourceId:K?void 0:V,onInstall:Ge}),(0,J.jsx)(Ze,{open:te,onOpenChange:L,editingSource:Y,onSourceAdded:e=>{Oe(e),U({title:`Skill source added`,description:`${e.title} is now available in the source list.`})},onSourceUpdated:e=>{ke(e),U({title:`Skill source updated`,description:`${e.title} has been saved.`})},onSourceDeleted:e=>{Me(e),U({title:`Skill source removed`,description:`The custom source has been deleted.`})}}),(0,J.jsx)(v,{open:_,onOpenChange:x,children:(0,J.jsx)(D,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,J.jsx)(He,{threadId:n,onSkillCreated:()=>{x(!1),X(),s()}})})}),(0,J.jsx)(he,{open:w!==null,onOpenChange:e=>!e&&E(null),children:(0,J.jsxs)(Ce,{children:[(0,J.jsxs)(ge,{children:[(0,J.jsx)(fe,{children:`Delete Skill`}),(0,J.jsxs)(pe,{children:[`Are you sure you want to delete the skill "`,w?.name,`"? This action cannot be undone.`]})]}),(0,J.jsxs)(me,{children:[(0,J.jsx)(ce,{children:`Cancel`}),(0,J.jsx)(we,{onClick:()=>w&&void Ue(w),disabled:O,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:O?`Deleting...`:`Delete`})]})]})})]}):(0,J.jsx)(ve,{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{$i as t,Br as n,E as r,Fs as i,I as a,Ii as o,Lr as s,Pi as c,Pt as l,Qr as u,Rr as d,Rs as f,Yr as p,Zr as m,bt as h,ei as g,fs as _,nn as v,ta as y,zr as b}from"./dialogs-config-86QTDk4G.js";import{A as ee,C as x,D as S,E as te,F as ne,M as C,N as re,O as w,P as T,S as E,T as D,b as O,j as ie,k as ae,x as oe,y as k}from"./history-view-BsN806ip.js";import{B as A,L as j,P as M,W as N}from"./index-C2iIghSR.js";import{t as P}from"./skeleton-BvvAbfo4.js";import{n as F,t as I}from"./radio-group-C7-1cZ2t.js";import{i as se,n as L,r as ce,t as le}from"./settings-list-CICo_cz2.js";import{t as ue}from"./mcp-server-card-DUJUtQq-.js";import{i as R,n as z,r as B}from"./slug-utils-jE4NOx-f.js";var V=e(f(),1),H=i();function de({projectId:e,threadId:t,onCommandCreated:n}){let[i,a]=(0,V.useState)(``),[s,c]=(0,V.useState)(``),[l,u]=(0,V.useState)(``),[d,f]=(0,V.useState)(`default`),[h,g]=(0,V.useState)(!1),v=B(i),y=z(v),b=async()=>{if(!(!y||!e)){g(!0);try{await r(v,``,{description:s.trim()||void 0,argumentHint:l.trim()||void 0,mode:d===`plan`?`plan`:void 0},`project`,t??void 0),A({title:`Command created`,description:`Command '/${v}' was created successfully.`}),a(``),c(``),u(``),f(`default`),n?.(v)}catch(e){A({title:`Error`,description:e instanceof Error?e.message:`Failed to create command`,variant:`destructive`})}finally{g(!1)}}};return e?(0,H.jsx)(S,{children:(0,H.jsxs)(k,{children:[(0,H.jsx)(E,{title:`Add Slash Command`,description:`Create a new slash command. The command will be saved as a .md file in the ~/.agents/commands folder.`}),(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsxs)(O,{title:`Command Name`,children:[(0,H.jsx)(m,{id:`commandName`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g. review`,disabled:h}),i?(0,H.jsxs)(`p`,{className:o(_.caption,`mt-2`),children:[`Command: `,(0,H.jsxs)(`span`,{className:`font-mono`,children:[`/`,v||`...`]})]}):null]}),(0,H.jsx)(O,{title:`Description`,children:(0,H.jsx)(m,{id:`commandDescription`,value:s,onChange:e=>c(e.target.value),placeholder:`Brief description shown in autocomplete`,disabled:h})}),(0,H.jsx)(O,{title:`Argument Hint`,description:`Shows after the command name to guide users what to type`,children:(0,H.jsx)(m,{id:`argumentHint`,value:l,onChange:e=>u(e.target.value),placeholder:`e.g. <focus-area> or <branch-name>`,disabled:h})}),(0,H.jsx)(O,{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:h,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)(p,{htmlFor:`mode-default`,className:o(_.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)(p,{htmlFor:`mode-plan`,className:o(_.labelNormal,`cursor-pointer`),children:`Plan`})]})]})}),(0,H.jsx)(R,{onContinue:()=>void b(),disabled:!y,creating:h})]})]})}):(0,H.jsx)(D,{title:`No project selected`,children:`Please select a project to add a slash command.`})}function U(){let e=N(e=>e.selectedProjectId),i=N(e=>e.selectedThreadId),{setActiveMainTab:f}=j(),{setPendingExplorerPath:p,triggerExplorerRefresh:m,setExplorerClearPath:O}=M(),[k,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(i){R(!0);try{let e=await l(i);F(e.filter(e=>!e.isBuiltIn)),X(new Map(e.map(e=>[e.name,e.filePath])))}catch{F([]),X(new Map)}finally{R(!1)}}},[i]);(0,V.useEffect)(()=>{Q()},[Q]),(0,V.useEffect)(()=>{h().then(J).catch(()=>J([]))},[]);let pe=(0,V.useCallback)(async e=>{K(!0);try{await a(e.filePath),O(e.filePath),m(),X(t=>{let n=new Map(t);return n.delete(e.name),n}),A({title:`Command removed`,description:`/${e.name}`}),W(null),await Q()}catch(e){A({title:`Error`,description:e instanceof Error?e.message:`Failed to remove command`,variant:`destructive`})}finally{K(!1)}},[Q,m,O]),me=(0,V.useCallback)(e=>{p(e),f(`explorer`)},[p,f]),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(!(!i||Y.has(e.name)))try{if(e.gitHubRepo&&e.gitHubFolder){let t=`.agents/commands`;await v(i,e.gitHubRepo,e.gitHubFolder,t);let n=`${t}/${e.name}.md`;X(t=>new Map(t).set(e.name,n))}else{let t=await r(e.name,e.content,{description:e.description,argumentHint:e.argumentHint},`project`,i);X(n=>new Map(n).set(e.name,t.filePath))}m(),Q(),A({title:`Command installed`,description:`/${e.name}`})}catch(e){A({title:`Error`,description:e instanceof Error?e.message:`Failed to install command`,variant:`destructive`})}},[i,Y,m,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)(E,{title:`Slash Commands`,description:`Manage slash commands. Commands are quick actions available via / in chat.`,action:(0,H.jsx)(c,{onClick:()=>B(!0),disabled:!i,children:`Add Command`})}),!i&&(0,H.jsx)(oe,{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`})]}):k.length===0?(0,H.jsx)(le,{icon:y,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:k.map((e,r)=>(0,H.jsxs)(`div`,{className:o(`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`,r>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:o(_.body,`truncate`),children:[`/`,e.name]}),(0,H.jsx)(`div`,{className:o(_.compact,`truncate text-muted-foreground`),children:he(e)})]}),e.metadata?.mode?(0,H.jsx)(`span`,{className:o(_.compact,`bg-muted px-1.5 py-0.5 rounded flex-shrink-0`),children:e.metadata.mode}):(0,H.jsx)(`div`,{}),(0,H.jsx)(b,{children:(0,H.jsxs)(s,{children:[(0,H.jsx)(n,{asChild:!0,children:(0,H.jsx)(c,{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)(t,{className:`h-4 w-4`})})}),(0,H.jsx)(d,{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)(ce,{searchQuery:Z,emptyLabel:`No available commands found.`}):(0,H.jsx)(L,{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)(u,{open:z,onOpenChange:B,children:(0,H.jsx)(g,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,H.jsx)(de,{projectId:e,threadId:i,onCommandCreated:()=>{B(!1),Q(),m()}})})}),(0,H.jsx)(w,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,H.jsxs)(ie,{children:[(0,H.jsxs)(T,{children:[(0,H.jsx)(ne,{children:`Delete Slash Command`}),(0,H.jsxs)(C,{children:[`Are you sure you want to delete "/`,U?.name,`"? This action cannot be undone.`]})]}),(0,H.jsxs)(re,{children:[(0,H.jsx)(ee,{children:`Cancel`}),(0,H.jsx)(ae,{onClick:()=>U&&void pe(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,H.jsx)(D,{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{$i as t,Br as n,Ct as r,Fs as i,Ii as a,Ji as o,Lr as s,O as c,P as l,Pi as u,Qr as d,R as f,Rr as p,Rs as m,Zr as h,ei as ee,fs as g,gt as te,nn as ne,wn as re,zr as ie,zt as _}from"./dialogs-config-86QTDk4G.js";import{A as v,C as y,D as b,E as ae,F as oe,M as se,N as x,O as ce,P as le,S,T as C,b as w,j as T,k as E,x as D,y as O}from"./history-view-BsN806ip.js";import{B as k,H as A,L as ue,P as de,W as j}from"./index-C2iIghSR.js";import{t as M}from"./skeleton-BvvAbfo4.js";import{i as fe,n as pe,r as N,t as P}from"./settings-list-CICo_cz2.js";import{t as F}from"./mcp-server-card-DUJUtQq-.js";import{i as I,n as L,r as R}from"./slug-utils-jE4NOx-f.js";var z=e(m(),1),B=i();function me({threadId:e,onAgentCreated:t}){let[n,r]=(0,z.useState)(``),[i,o]=(0,z.useState)(``),[s,l]=(0,z.useState)(``),[u,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(),s.trim()||void 0);k({title:`Agent created`,description:`Agent '${f}' was created successfully.`}),r(``),o(``),l(``),t?.(n.path,`AGENTS.md`)}catch(e){k({title:`Error`,description:e instanceof Error?e.message:`Failed to create agent`,variant:`destructive`})}finally{d(!1)}}};return e?(0,B.jsx)(b,{children:(0,B.jsxs)(O,{children:[(0,B.jsx)(S,{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)(w,{title:`Agent Name`,children:[(0,B.jsx)(h,{id:`agentName`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Code Reviewer`,disabled:u}),n?(0,B.jsxs)(`p`,{className:a(g.caption,`mt-2`),children:[`Folder name: `,(0,B.jsx)(`span`,{className:`font-mono`,children:f||`...`})]}):null]}),(0,B.jsx)(w,{title:`Description`,children:(0,B.jsx)(A,{id:`agentDescription`,value:i,onChange:e=>o(e.target.value),placeholder:`Describe the agent's purpose and behavior...`,className:`resize-none min-h-[120px]`,disabled:u})}),(0,B.jsx)(w,{title:`Tools`,description:`Optional space-separated list of tools this agent can use`,children:(0,B.jsx)(h,{id:`agentTools`,value:s,onChange:e=>l(e.target.value),placeholder:`e.g. read grep glob`,disabled:u})}),(0,B.jsx)(I,{onContinue:()=>void m(),disabled:!p||!i.trim(),creating:u})]})]})}):(0,B.jsx)(C,{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=j(e=>e.selectedProjectId),i=j(e=>e.selectedThreadId),{setActiveMainTab:c}=ue(),{setPendingExplorerPath:m,triggerExplorerRefresh:h,setExplorerClearPath:w}=de(),[O,A]=(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 r(e));if(i)try{let e=V(await _(i)),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)),A(t),X(new Set(t.map(e=>`${e.path}/AGENT.md`)))}catch{A([]),X(new Set)}finally{L(!1)}}},[e,i]);(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(i)await f(i,r);else throw Error(`No thread selected to delete from`)}w(r),h(),X(e=>{let t=new Set(e);return t.delete(`${r}/AGENT.md`),t}),k({title:`Agent removed`,description:n}),W(null),await Q()}catch(e){k({title:`Error`,description:e instanceof Error?e.message:`Failed to remove agent`,variant:`destructive`})}finally{K(!1)}},[e,i,Q,h,w]),_e=(0,z.useCallback)(e=>{m(`${e}/AGENT.md`),c(`explorer`)},[m,c]),ve=(0,z.useCallback)(async e=>{let t=`.agents/agents/${e.id}/AGENT.md`;if(!(!i||Y.has(t)))try{if(e.gitHubRepo&&e.gitHubFolder)await ne(i,e.gitHubRepo,e.gitHubFolder,`.agents/agents/${e.id}`);else{let n=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.tools&&n.push(`tools: ${e.tools}`),n.push(`---`,``,e.systemPrompt),await re(i,t,n.join(`
|
|
2
|
+
`))}X(e=>new Set(e).add(t)),h(),Q(),k({title:`Agent installed`,description:e.name})}catch(e){k({title:`Error`,description:e instanceof Error?e.message:`Failed to install agent`,variant:`destructive`})}},[i,Y,h,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)(b,{children:(0,B.jsxs)(ae,{children:[(0,B.jsx)(S,{title:`Subagents`,description:`Manage subagents. Subagents are specialized agents for focused tasks.`,action:(0,B.jsx)(u,{onClick:()=>H(!0),disabled:!i,children:`Add Subagent`})}),!i&&(0,B.jsx)(D,{children:`Select a thread to add or install subagents.`}),(0,B.jsx)(y,{title:`Installed`}),I?(0,B.jsxs)(`div`,{className:`space-y-3 mb-8`,children:[(0,B.jsx)(M,{className:`h-12 w-full`}),(0,B.jsx)(M,{className:`h-12 w-full`})]}):O.length===0?(0,B.jsx)(P,{icon:o,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:O.map((e,r)=>(0,B.jsxs)(`div`,{className:a(`group grid min-h-13 grid-cols-[minmax(0,1fr)_1.75rem] items-center gap-3 px-3 py-3 hover:bg-muted/30`,r>0&&`border-t border-border`),children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>_e(e.path),className:a(g.body,`truncate text-left`),children:e.name}),(0,B.jsx)(ie,{children:(0,B.jsxs)(s,{children:[(0,B.jsx)(n,{asChild:!0,children:(0,B.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:()=>W(e),"aria-label":`Delete ${e.name}`,children:(0,B.jsx)(t,{className:`h-4 w-4`})})}),(0,B.jsx)(p,{children:`Remove this subagent from the project`})]})})]},e.id))}),(0,B.jsx)(y,{title:`Available`,className:`mb-0`}),(0,B.jsx)(fe,{placeholder:`Search available subagents...`,value:Z,onChange:he}),q.length===0?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(M,{className:`h-20 w-full`}),(0,B.jsx)(M,{className:`h-20 w-full`})]}):$.length===0?(0,B.jsx)(N,{searchQuery:Z,emptyLabel:`No available subagents found.`}):(0,B.jsx)(pe,{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)(d,{open:R,onOpenChange:H,children:(0,B.jsx)(ee,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,B.jsx)(me,{threadId:i,onAgentCreated:()=>{H(!1),Q(),h()}})})}),(0,B.jsx)(ce,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,B.jsxs)(T,{children:[(0,B.jsxs)(le,{children:[(0,B.jsx)(oe,{children:`Delete Subagent`}),(0,B.jsxs)(se,{children:[`Are you sure you want to delete the subagent "`,U?.name,`"? This action cannot be undone.`]})]}),(0,B.jsxs)(x,{children:[(0,B.jsx)(v,{children:`Cancel`}),(0,B.jsx)(E,{onClick:()=>U&&void ge(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,B.jsx)(C,{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{Ba as t,Bn as n,Et as r,
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ba as t,Bn as n,Et as r,Fs as i,Ii as a,Pi as o,Rs as s,Yr as c,fs as l,rn as u}from"./dialogs-config-86QTDk4G.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-BsN806ip.js";import{a as C}from"./onboarding-DCrFdRM5.js";import{B as w,H as T,W as E}from"./index-C2iIghSR.js";var D=e(s(),1),O=i();function k(){let e=E(e=>e.selectedProjectId),[i,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),r(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(i),M(!0)}function K(e){if(!e){M(!1);return}if(k===i){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 n(e,{customSystemPrompt:j?null:k.trim(),useCustomSystemPrompt:!j}),u(),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)(o,{onClick:Y,disabled:L||z||!U(),children:z?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(t,{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)(c,{htmlFor:`use-generated-prompt`,className:a(l.labelNormal,`cursor-pointer`),children:`Generated`})]}),L?(0,O.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,O.jsx)(t,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,O.jsx)(T,{value:k,onChange:e=>W(e.target.value),className:a(l.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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/settings-general-view-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dt as t,Ii as n,Is as r,Ji as i,Ka as a,Ko as o,Lo as s,Ns as c,Pi as l,Ps as u,Yi as d,aa as f,ca as p,ds as m,eo as h,fs as g,hn as _,ka as v,pa as y,qi as b,rn as x,ta as S,ua as ee,wo as C,zo as w}from"./dialogs-config-DAMqiy-4.js";import{Ft as te,It as ne,Pt as T}from"./react-vendor-U9lUQswz.js";import{r as E}from"./monaco-CZnIWXyV.js";import{D,E as O,T as k}from"./history-view-lvvTzW7O.js";import{d as A,l as j}from"./onboarding-dys9Rwb5.js";import{C as M,K as re,U as N,W as P,f as F,m as ie,p as I,z as L}from"./index-C_iiobDl.js";import{t as R}from"./settings-models-skeleton-B7TMwjxe.js";var z=u(),B=e(r(),1),V=c(),ae=(0,B.forwardRef)(function(e,t){let r=(0,z.c)(28),{sidebar:i,children:a,defaultSidebarSize:o,minSidebarSize:s,maxSidebarSize:c,minContentSize:l,collapsible:u,collapsedSize:d,className:f,onCollapse:p,onExpand:m,isMobile:h,mobileShowSidebar:g}=e,_=o===void 0?25:o,v=s===void 0?20:s,y=c===void 0?30:c,b=l===void 0?40:l,x=u===void 0?!1:u,S=d===void 0?0:d,ee=f===void 0?``:f,C=h===void 0?!1:h,w=g===void 0?!0:g,te=C&&!w,ne=C&&w,T=`h-full ${ee}`,E=C?100:_,D=C?50:v,O=C?100:y,k=te&&`hidden`,A;r[0]===k?A=r[1]:(A=n(`border-r border-transparent`,k),r[0]=k,r[1]=A);let j;r[2]!==S||r[3]!==x||r[4]!==p||r[5]!==m||r[6]!==t||r[7]!==i||r[8]!==E||r[9]!==D||r[10]!==O||r[11]!==A?(j=(0,V.jsx)(I,{ref:t,defaultSize:E,minSize:D,maxSize:O,collapsible:x,collapsedSize:S,onCollapse:p,onExpand:m,className:A,children:i}),r[2]=S,r[3]=x,r[4]=p,r[5]=m,r[6]=t,r[7]=i,r[8]=E,r[9]=D,r[10]=O,r[11]=A,r[12]=j):j=r[12];let M;r[13]===C?M=r[14]:(M=!C&&(0,V.jsx)(F,{withHandle:!0,className:`ml-[-40px]`}),r[13]=C,r[14]=M);let re=ne&&`hidden`,N;r[15]===re?N=r[16]:(N=n(`overflow-hidden`,re),r[15]=re,r[16]=N);let P;r[17]!==a||r[18]!==b||r[19]!==N?(P=(0,V.jsx)(I,{minSize:b,className:N,children:a}),r[17]=a,r[18]=b,r[19]=N,r[20]=P):P=r[20];let L;r[21]!==j||r[22]!==M||r[23]!==P?(L=(0,V.jsxs)(ie,{direction:`horizontal`,className:`h-full`,children:[j,M,P]}),r[21]=j,r[22]=M,r[23]=P,r[24]=L):L=r[24];let R;return r[25]!==T||r[26]!==L?(R=(0,V.jsx)(`div`,{className:T,children:L}),r[25]=T,r[26]=L,r[27]=R):R=r[27],R}),oe=[{id:`providers`,label:`Providers`,icon:(0,V.jsx)(C,{className:`h-4 w-4`}),route:`/settings/providers`},{id:`models`,label:`Models`,icon:(0,V.jsx)(s,{className:`h-4 w-4`}),route:`/settings/models`},{id:`skills`,label:`Skills`,icon:(0,V.jsx)(b,{className:`h-4 w-4`}),route:`/settings/skills`},{id:`rules`,label:`Rules`,icon:(0,V.jsx)(y,{className:`h-4 w-4`}),route:`/settings/rules`},{id:`slash-commands`,label:`Slash Commands`,icon:(0,V.jsx)(S,{className:`h-4 w-4`}),route:`/settings/slash-commands`},{id:`subagents`,label:`Subagents`,icon:(0,V.jsx)(i,{className:`h-4 w-4`}),route:`/settings/subagents`},{id:`instructions`,label:`Instructions`,icon:(0,V.jsx)(w,{className:`h-4 w-4`}),route:`/settings/instructions`},{id:`system-prompt`,label:`System Prompt`,icon:(0,V.jsx)(f,{className:`h-4 w-4`}),route:`/settings/system-prompt`},{id:`mcp-servers`,label:`MCP Servers`,icon:(0,V.jsx)(ee,{className:`h-4 w-4`}),route:`/settings/mcp-servers`},{id:`general`,label:`General`,icon:(0,V.jsx)(p,{className:`h-4 w-4`}),route:`/settings/general`},{id:`history`,label:`History`,icon:(0,V.jsx)(a,{className:`h-4 w-4`}),route:`/settings/history`},{id:`account`,label:`Account`,icon:(0,V.jsx)(d,{className:`h-4 w-4`}),route:`/settings/account`}];function se(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,V.jsx)(h,{className:`h-4 w-4`}),route:`/settings/project/${e}`}),t}function ce(e){let t=(0,z.c)(21),{className:n,selectedProjectId:r,onResetOnboarding:i,onNavItemSelect:a}=e,o=te(),s=T(),c=(0,B.useRef)(0),l=(0,B.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,B.useEffect)(u,d);let f=M(),p;t[2]===r?p=t[3]:(p=se(r),t[2]=r,t[3]=p);let m=p,h;t[4]!==f||t[5]!==m?(h=f?m.filter(H):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,V.jsxs)(B.Fragment,{children:[(0,V.jsx)(A,{selected:v===t.id,asChild:!0,children:(0,V.jsx)(`button`,{className:`justify-start`,onClick:()=>e(t),children:(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[t.icon,(0,V.jsx)(`span`,{children:t.label})]})})}),(t.id===`models`||t.id===`mcp-servers`||n===g.length-1)&&(0,V.jsx)(j,{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,V.jsx)(`div`,{className:y,children:b}),t[18]=y,t[19]=b,t[20]=x):x=t[20],x}function H(e){return e.id!==`account`}var le=o(`app.settings-view.ui`),ue=(0,B.lazy)(()=>E(()=>import(`./settings-general-view-BHj9qn0K.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),de=(0,B.lazy)(()=>E(()=>import(`./project-settings-view-XGHhtLr_.js`),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11,13]))),fe=(0,B.lazy)(()=>E(()=>import(`./providers-list-view-Cbndeobz.js`),__vite__mapDeps([14,1,5,6,7,15,16,17,9,3,4,18]))),pe=(0,B.lazy)(()=>E(()=>import(`./settings-models-view-ObE_ktqH.js`),__vite__mapDeps([19,1,5,6,7,15,20,16,21,17,9,3,4,18]))),me=(0,B.lazy)(()=>E(()=>import(`./settings-mcp-servers-view-M2DQPcpo.js`),__vite__mapDeps([22,1,2,3,4,5,6,7,8,9,10,11,23,21,16,17]))),he=(0,B.lazy)(()=>E(()=>import(`./settings-skills-view-MZQjnD_g.js`),__vite__mapDeps([24,1,2,3,4,5,6,7,8,9,10,11,23,25,21,16,18]))),ge=(0,B.lazy)(()=>E(()=>import(`./settings-rules-view-BhRBowk9.js`),__vite__mapDeps([26,1,2,3,4,5,6,7,8,9,10,11,23,25,21,16,18]))),_e=(0,B.lazy)(()=>E(()=>import(`./settings-slash-commands-view-BYHthCEM.js`),__vite__mapDeps([27,1,2,3,4,5,6,7,8,9,10,11,23,25,13,21,16]))),ve=(0,B.lazy)(()=>E(()=>import(`./settings-subagents-view-CmrFQcUF.js`),__vite__mapDeps([28,1,2,3,4,5,6,7,8,9,10,11,23,25,21,16]))),ye=(0,B.lazy)(()=>E(()=>import(`./settings-instructions-view-CRUCeWUk.js`),__vite__mapDeps([29,1,2,3,4,5,6,7,8,9,10,11]))),be=(0,B.lazy)(()=>E(()=>import(`./settings-system-prompt-view-CZe9uYNN.js`),__vite__mapDeps([30,1,2,3,4,5,6,7,8,9,10,11]))),xe=(0,B.lazy)(()=>E(()=>import(`./account-view-5qdPli2O.js`),__vite__mapDeps([31,1,2,3,4,5,6,7,8,9,10,11,16]))),Se=(0,B.lazy)(()=>E(()=>import(`./history-view-lvvTzW7O.js`).then(e=>e.t),__vite__mapDeps([5,1,6]))),Ce=[`general`,`providers`,`models`,`skills`,`rules`,`slash-commands`,`subagents`,`instructions`,`system-prompt`,`mcp-servers`,`history`,`account`];function U(e){let t=(0,z.c)(2),{title:n}=e,r;return t[0]===n?r=t[1]:(r=(0,V.jsx)(k,{title:n,children:`Content coming soon...`}),t[0]=n,t[1]=r),r}function we(){let e=(0,z.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,V.jsxs)(`div`,{className:`mb-6`,children:[(0,V.jsx)(`div`,{className:`h-8 w-32 bg-muted rounded animate-pulse mb-2`}),(0,V.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,V.jsx)(`div`,{className:`mb-6`,children:(0,V.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,V.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,V.jsxs)(`div`,{children:[r,(0,V.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,V.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,V.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`})]})]}),a=(0,V.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,V.jsx)(D,{children:(0,V.jsxs)(O,{children:[t,n,(0,V.jsxs)(`div`,{className:`space-y-8`,children:[i,(0,V.jsxs)(`div`,{children:[a,(0,V.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,V.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,V.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,V.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,V.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`})]})]})]})]})}),e[5]=o):o=e[5],o}function Te(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 Ee(e){let t=e.match(/^\/settings\/providers\/([^/]+)$/);return t?decodeURIComponent(t[1]):null}function De(){let e=(0,z.c)(62),{tab:r,projectId:i}=ne(),a=te(),o=T(),s=N(),c=P(Ae),u=P(ke),d;e[0]!==o.pathname||e[1]!==i?(d=!!i&&o.pathname.startsWith(`/settings/project/`),e[0]=o.pathname,e[1]=i,e[2]=d):d=e[2];let f=d,p;e[3]===o.pathname?p=e[4]:(p=Ee(o.pathname),e[3]=o.pathname,e[4]=p);let h=p!==null,y;if(e[5]!==o.pathname||e[6]!==o.search||e[7]!==r){let t=new URLSearchParams(o.search).get(`tab`);y=t&&Ce.includes(t)?t:r&&Ce.includes(r)?r:Te(o.pathname),e[5]=o.pathname,e[6]=o.search,e[7]=r,e[8]=y}else y=e[8];let b=y,S=M(),[ee,C]=(0,B.useState)(!1),[w,E]=(0,B.useState)(!0),[D,O]=(0,B.useState)(0),k=(0,B.useRef)(null),A;bb0:{if(f){A=`Project`;break bb0}let t;e[9]===b?t=e[10]:(t=oe.find(e=>e.id===b)?.label??`Settings`,e[9]=b,e[10]=t),A=t}let j=A,F;e[11]===S?F=e[12]:(F=()=>{S&&E(!1)},e[11]=S,e[12]=F);let ie=F,I;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>{E(!0)},e[13]=I):I=e[13];let se=I,H;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(H=async()=>{try{await _(),O(Oe)}catch(e){let t=e;le.error(`Failed to reset onboarding:`,t)}},e[14]=H):H=e[14];let De=H,W;e[15]===a?W=e[16]:(W=()=>{a(`/`)},e[15]=a,e[16]=W);let je=W,G;e[17]===c?G=e[18]:(G=c?{type:`project`,id:c}:void 0,e[17]=c,e[18]=G);let Me=G,K;e[19]===a?K=e[20]:(K=()=>{a(`/settings/general`)},e[19]=a,e[20]=K);let Ne=K,q;e[21]!==s||e[22]!==i?(q=async()=>{x(i);try{let e=await t();s({type:re.SetProjects,projects:e.projects})}catch(e){let t=e;throw le.error(`Failed to refresh projects after settings update:`,t),t}},e[21]=s,e[22]=i,e[23]=q):q=e[23];let Pe=q,Fe,J;e[24]!==S||e[25]!==o.pathname||e[26]!==a?(Fe=()=>{(o.pathname===`/settings`||o.pathname===`/settings/project`||[`/settings/mcp-server-edit`,`/settings/add-skill`,`/settings/add-command`,`/settings/add-rule`,`/settings/add-agent`].some(e=>o.pathname.startsWith(e))||S&&o.pathname.startsWith(`/settings/account`))&&a(`/settings/general`,{replace:!0})},J=[o.pathname,a,S],e[24]=S,e[25]=o.pathname,e[26]=a,e[27]=Fe,e[28]=J):(Fe=e[27],J=e[28]),(0,B.useEffect)(Fe,J);let Ie;e[29]!==je||e[30]!==ie||e[31]!==c?(Ie=()=>(0,V.jsx)(L,{onTitleClose:je,subtitle:`Settings`,children:(0,V.jsx)(`div`,{className:`px-2 py-2`,children:(0,V.jsx)(ce,{selectedProjectId:c,onResetOnboarding:De,onNavItemSelect:ie})})}),e[29]=je,e[30]=ie,e[31]=c,e[32]=Ie):Ie=e[32];let Le=Ie,Re;e[33]!==b||e[34]!==Ne||e[35]!==Pe||e[36]!==Me||e[37]!==f||e[38]!==D||e[39]!==i||e[40]!==u?(Re=()=>{if(f&&i)return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`Project Settings`}),children:(0,V.jsx)(de,{projectId:i,onProjectUpdated:Pe})});switch(b){case`general`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`General`}),children:(0,V.jsx)(ue,{onboardingResetSignal:D})});case`providers`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(we,{}),children:(0,V.jsx)(fe,{})});case`models`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(R,{}),children:(0,V.jsx)(pe,{})});case`skills`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`Skills`}),children:(0,V.jsx)(he,{})});case`rules`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`Rules`}),children:(0,V.jsx)(ge,{})});case`slash-commands`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`Slash Commands`}),children:(0,V.jsx)(_e,{})});case`subagents`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`Subagents`}),children:(0,V.jsx)(ve,{})});case`instructions`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`Instructions`}),children:(0,V.jsx)(ye,{})});case`system-prompt`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`System Prompt`}),children:(0,V.jsx)(be,{})});case`mcp-servers`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`MCP Servers`}),children:(0,V.jsx)(me,{})});case`history`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`History`}),children:(0,V.jsx)(Se,{isOpen:!0,onClose:Ne,initialFilter:Me,projects:u,inline:!0})});case`account`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`Account`}),children:(0,V.jsx)(xe,{})});default:return(0,V.jsx)(U,{title:`Settings`})}},e[33]=b,e[34]=Ne,e[35]=Pe,e[36]=Me,e[37]=f,e[38]=D,e[39]=i,e[40]=u,e[41]=Re):Re=e[41];let ze=Re,Be,Ve;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Be=()=>C(!0),Ve=()=>C(!1),e[42]=Be,e[43]=Ve):(Be=e[42],Ve=e[43]);let Y;e[44]===Le?Y=e[45]:(Y=Le(),e[44]=Le,e[45]=Y);let He=`flex-1 overflow-auto ${ee&&!S?`ml-[40px]`:``}`,X;e[46]!==j||e[47]!==S||e[48]!==h||e[49]!==w?(X=S&&!w&&!h?(0,V.jsx)(`div`,{className:n(m.settingsPage,`pb-0`),children:(0,V.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-center gap-2`,children:[(0,V.jsxs)(l,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground`,onClick:se,children:[(0,V.jsx)(v,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{className:`sr-only`,children:`Show settings menu`})]}),(0,V.jsx)(`span`,{className:n(g.sectionTitle,`truncate text-foreground`),children:j})]})}):null,e[46]=j,e[47]=S,e[48]=h,e[49]=w,e[50]=X):X=e[50];let Z;e[51]===ze?Z=e[52]:(Z=ze(),e[51]=ze,e[52]=Z);let Q;e[53]!==He||e[54]!==X||e[55]!==Z?(Q=(0,V.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,V.jsxs)(`div`,{className:He,children:[X,Z]})}),e[53]=He,e[54]=X,e[55]=Z,e[56]=Q):Q=e[56];let $;return e[57]!==S||e[58]!==w||e[59]!==Y||e[60]!==Q?($=(0,V.jsx)(ae,{ref:k,collapsible:!0,isMobile:S,mobileShowSidebar:w,onCollapse:Be,onExpand:Ve,sidebar:Y,children:Q}),e[57]=S,e[58]=w,e[59]=Y,e[60]=Q,e[61]=$):$=e[61],$}function Oe(e){return e+1}function ke(e){return e.projects}function Ae(e){return e.selectedProjectId}export{De as default};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/settings-general-view-BZZs0t0d.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-C2iIghSR.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-BsN806ip.js","assets/dialogs-config-86QTDk4G.js","assets/onboarding-DCrFdRM5.js","assets/vosk-speech-Ce0kC8Ck.js","assets/react-vendor-DK2COBjg.js","assets/utils-DPYK-CSn.js","assets/index-DhnUeGIU.css","assets/project-settings-view-DRL5CTSQ.js","assets/radio-group-C7-1cZ2t.js","assets/providers-list-view-DkmgzncX.js","assets/model-star-rating-DrR6jzjq.js","assets/skeleton-BvvAbfo4.js","assets/tabs-0fGgot48.js","assets/use-deferred-search-DOfdC3JO.js","assets/settings-models-view-DWqPx-2m.js","assets/settings-models-skeleton-MXSIpmT8.js","assets/settings-list-CICo_cz2.js","assets/settings-mcp-servers-view-DKviDm0q.js","assets/mcp-server-card-DUJUtQq-.js","assets/settings-skills-view-B6srjIvU.js","assets/slug-utils-jE4NOx-f.js","assets/settings-rules-view-Cq-60UOT.js","assets/settings-slash-commands-view-j8NdZX1V.js","assets/settings-subagents-view-4LusGYrq.js","assets/settings-instructions-view-CE-ugC91.js","assets/settings-system-prompt-view-DPMiLsrM.js","assets/account-view-CkhRveFm.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dt as t,Fs as n,Ii as r,Is as i,Ji as a,Ka as o,Ko as s,Lo as c,Pi as l,Rs as u,Yi as d,aa as f,ca as p,ds as m,eo as h,fs as g,hn as _,ka as v,pa as y,qi as b,rn as x,ta as S,ua as ee,wo as C,zo as w}from"./dialogs-config-86QTDk4G.js";import{Ft as te,It as ne,Pt as T}from"./react-vendor-DK2COBjg.js";import{r as E}from"./monaco-CZnIWXyV.js";import{D,E as O,T as k}from"./history-view-BsN806ip.js";import{d as A,l as j}from"./onboarding-DCrFdRM5.js";import{C as M,K as re,U as N,W as P,f as F,m as ie,p as I,z as L}from"./index-C2iIghSR.js";import{t as R}from"./settings-models-skeleton-MXSIpmT8.js";var z=i(),B=e(u(),1),V=n(),ae=(0,B.forwardRef)(function(e,t){let n=(0,z.c)(28),{sidebar:i,children:a,defaultSidebarSize:o,minSidebarSize:s,maxSidebarSize:c,minContentSize:l,collapsible:u,collapsedSize:d,className:f,onCollapse:p,onExpand:m,isMobile:h,mobileShowSidebar:g}=e,_=o===void 0?25:o,v=s===void 0?20:s,y=c===void 0?30:c,b=l===void 0?40:l,x=u===void 0?!1:u,S=d===void 0?0:d,ee=f===void 0?``:f,C=h===void 0?!1:h,w=g===void 0?!0:g,te=C&&!w,ne=C&&w,T=`h-full ${ee}`,E=C?100:_,D=C?50:v,O=C?100:y,k=te&&`hidden`,A;n[0]===k?A=n[1]:(A=r(`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]!==i||n[8]!==E||n[9]!==D||n[10]!==O||n[11]!==A?(j=(0,V.jsx)(I,{ref:t,defaultSize:E,minSize:D,maxSize:O,collapsible:x,collapsedSize:S,onCollapse:p,onExpand:m,className:A,children:i}),n[2]=S,n[3]=x,n[4]=p,n[5]=m,n[6]=t,n[7]=i,n[8]=E,n[9]=D,n[10]=O,n[11]=A,n[12]=j):j=n[12];let M;n[13]===C?M=n[14]:(M=!C&&(0,V.jsx)(F,{withHandle:!0,className:`ml-[-40px]`}),n[13]=C,n[14]=M);let re=ne&&`hidden`,N;n[15]===re?N=n[16]:(N=r(`overflow-hidden`,re),n[15]=re,n[16]=N);let P;n[17]!==a||n[18]!==b||n[19]!==N?(P=(0,V.jsx)(I,{minSize:b,className:N,children:a}),n[17]=a,n[18]=b,n[19]=N,n[20]=P):P=n[20];let L;n[21]!==j||n[22]!==M||n[23]!==P?(L=(0,V.jsxs)(ie,{direction:`horizontal`,className:`h-full`,children:[j,M,P]}),n[21]=j,n[22]=M,n[23]=P,n[24]=L):L=n[24];let R;return n[25]!==T||n[26]!==L?(R=(0,V.jsx)(`div`,{className:T,children:L}),n[25]=T,n[26]=L,n[27]=R):R=n[27],R}),oe=[{id:`providers`,label:`Providers`,icon:(0,V.jsx)(C,{className:`h-4 w-4`}),route:`/settings/providers`},{id:`models`,label:`Models`,icon:(0,V.jsx)(c,{className:`h-4 w-4`}),route:`/settings/models`},{id:`skills`,label:`Skills`,icon:(0,V.jsx)(b,{className:`h-4 w-4`}),route:`/settings/skills`},{id:`rules`,label:`Rules`,icon:(0,V.jsx)(y,{className:`h-4 w-4`}),route:`/settings/rules`},{id:`slash-commands`,label:`Slash Commands`,icon:(0,V.jsx)(S,{className:`h-4 w-4`}),route:`/settings/slash-commands`},{id:`subagents`,label:`Subagents`,icon:(0,V.jsx)(a,{className:`h-4 w-4`}),route:`/settings/subagents`},{id:`instructions`,label:`Instructions`,icon:(0,V.jsx)(w,{className:`h-4 w-4`}),route:`/settings/instructions`},{id:`system-prompt`,label:`System Prompt`,icon:(0,V.jsx)(f,{className:`h-4 w-4`}),route:`/settings/system-prompt`},{id:`mcp-servers`,label:`MCP Servers`,icon:(0,V.jsx)(ee,{className:`h-4 w-4`}),route:`/settings/mcp-servers`},{id:`general`,label:`General`,icon:(0,V.jsx)(p,{className:`h-4 w-4`}),route:`/settings/general`},{id:`history`,label:`History`,icon:(0,V.jsx)(o,{className:`h-4 w-4`}),route:`/settings/history`},{id:`account`,label:`Account`,icon:(0,V.jsx)(d,{className:`h-4 w-4`}),route:`/settings/account`}];function se(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,V.jsx)(h,{className:`h-4 w-4`}),route:`/settings/project/${e}`}),t}function ce(e){let t=(0,z.c)(21),{className:n,selectedProjectId:r,onResetOnboarding:i,onNavItemSelect:a}=e,o=te(),s=T(),c=(0,B.useRef)(0),l=(0,B.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,B.useEffect)(u,d);let f=M(),p;t[2]===r?p=t[3]:(p=se(r),t[2]=r,t[3]=p);let m=p,h;t[4]!==f||t[5]!==m?(h=f?m.filter(H):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,V.jsxs)(B.Fragment,{children:[(0,V.jsx)(A,{selected:v===t.id,asChild:!0,children:(0,V.jsx)(`button`,{className:`justify-start`,onClick:()=>e(t),children:(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[t.icon,(0,V.jsx)(`span`,{children:t.label})]})})}),(t.id===`models`||t.id===`mcp-servers`||n===g.length-1)&&(0,V.jsx)(j,{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,V.jsx)(`div`,{className:y,children:b}),t[18]=y,t[19]=b,t[20]=x):x=t[20],x}function H(e){return e.id!==`account`}var le=s(`app.settings-view.ui`),ue=(0,B.lazy)(()=>E(()=>import(`./settings-general-view-BZZs0t0d.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),de=(0,B.lazy)(()=>E(()=>import(`./project-settings-view-DRL5CTSQ.js`),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11,13]))),fe=(0,B.lazy)(()=>E(()=>import(`./providers-list-view-DkmgzncX.js`),__vite__mapDeps([14,1,5,6,7,15,16,17,9,3,4,18]))),pe=(0,B.lazy)(()=>E(()=>import(`./settings-models-view-DWqPx-2m.js`),__vite__mapDeps([19,1,5,6,7,15,20,16,21,17,9,3,4,18]))),me=(0,B.lazy)(()=>E(()=>import(`./settings-mcp-servers-view-DKviDm0q.js`),__vite__mapDeps([22,1,2,3,4,5,6,7,8,9,10,11,23,21,16,17]))),he=(0,B.lazy)(()=>E(()=>import(`./settings-skills-view-B6srjIvU.js`),__vite__mapDeps([24,1,2,3,4,5,6,7,8,9,10,11,23,25,21,16,18]))),ge=(0,B.lazy)(()=>E(()=>import(`./settings-rules-view-Cq-60UOT.js`),__vite__mapDeps([26,1,2,3,4,5,6,7,8,9,10,11,23,25,21,16,18]))),_e=(0,B.lazy)(()=>E(()=>import(`./settings-slash-commands-view-j8NdZX1V.js`),__vite__mapDeps([27,1,2,3,4,5,6,7,8,9,10,11,23,25,13,21,16]))),ve=(0,B.lazy)(()=>E(()=>import(`./settings-subagents-view-4LusGYrq.js`),__vite__mapDeps([28,1,2,3,4,5,6,7,8,9,10,11,23,25,21,16]))),ye=(0,B.lazy)(()=>E(()=>import(`./settings-instructions-view-CE-ugC91.js`),__vite__mapDeps([29,1,2,3,4,5,6,7,8,9,10,11]))),be=(0,B.lazy)(()=>E(()=>import(`./settings-system-prompt-view-DPMiLsrM.js`),__vite__mapDeps([30,1,2,3,4,5,6,7,8,9,10,11]))),xe=(0,B.lazy)(()=>E(()=>import(`./account-view-CkhRveFm.js`),__vite__mapDeps([31,1,2,3,4,5,6,7,8,9,10,11,16]))),Se=(0,B.lazy)(()=>E(()=>import(`./history-view-BsN806ip.js`).then(e=>e.t),__vite__mapDeps([5,1,6]))),Ce=[`general`,`providers`,`models`,`skills`,`rules`,`slash-commands`,`subagents`,`instructions`,`system-prompt`,`mcp-servers`,`history`,`account`];function U(e){let t=(0,z.c)(2),{title:n}=e,r;return t[0]===n?r=t[1]:(r=(0,V.jsx)(k,{title:n,children:`Content coming soon...`}),t[0]=n,t[1]=r),r}function we(){let e=(0,z.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,V.jsxs)(`div`,{className:`mb-6`,children:[(0,V.jsx)(`div`,{className:`h-8 w-32 bg-muted rounded animate-pulse mb-2`}),(0,V.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,V.jsx)(`div`,{className:`mb-6`,children:(0,V.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,V.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,V.jsxs)(`div`,{children:[r,(0,V.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,V.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,V.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`})]})]}),a=(0,V.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,V.jsx)(D,{children:(0,V.jsxs)(O,{children:[t,n,(0,V.jsxs)(`div`,{className:`space-y-8`,children:[i,(0,V.jsxs)(`div`,{children:[a,(0,V.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,V.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,V.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,V.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,V.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`})]})]})]})]})}),e[5]=o):o=e[5],o}function Te(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 Ee(e){let t=e.match(/^\/settings\/providers\/([^/]+)$/);return t?decodeURIComponent(t[1]):null}function De(){let e=(0,z.c)(62),{tab:n,projectId:i}=ne(),a=te(),o=T(),s=N(),c=P(Ae),u=P(ke),d;e[0]!==o.pathname||e[1]!==i?(d=!!i&&o.pathname.startsWith(`/settings/project/`),e[0]=o.pathname,e[1]=i,e[2]=d):d=e[2];let f=d,p;e[3]===o.pathname?p=e[4]:(p=Ee(o.pathname),e[3]=o.pathname,e[4]=p);let h=p!==null,y;if(e[5]!==o.pathname||e[6]!==o.search||e[7]!==n){let t=new URLSearchParams(o.search).get(`tab`);y=t&&Ce.includes(t)?t:n&&Ce.includes(n)?n:Te(o.pathname),e[5]=o.pathname,e[6]=o.search,e[7]=n,e[8]=y}else y=e[8];let b=y,S=M(),[ee,C]=(0,B.useState)(!1),[w,E]=(0,B.useState)(!0),[D,O]=(0,B.useState)(0),k=(0,B.useRef)(null),A;bb0:{if(f){A=`Project`;break bb0}let t;e[9]===b?t=e[10]:(t=oe.find(e=>e.id===b)?.label??`Settings`,e[9]=b,e[10]=t),A=t}let j=A,F;e[11]===S?F=e[12]:(F=()=>{S&&E(!1)},e[11]=S,e[12]=F);let ie=F,I;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>{E(!0)},e[13]=I):I=e[13];let se=I,H;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(H=async()=>{try{await _(),O(Oe)}catch(e){let t=e;le.error(`Failed to reset onboarding:`,t)}},e[14]=H):H=e[14];let De=H,W;e[15]===a?W=e[16]:(W=()=>{a(`/`)},e[15]=a,e[16]=W);let je=W,G;e[17]===c?G=e[18]:(G=c?{type:`project`,id:c}:void 0,e[17]=c,e[18]=G);let Me=G,K;e[19]===a?K=e[20]:(K=()=>{a(`/settings/general`)},e[19]=a,e[20]=K);let Ne=K,q;e[21]!==s||e[22]!==i?(q=async()=>{x(i);try{let e=await t();s({type:re.SetProjects,projects:e.projects})}catch(e){let t=e;throw le.error(`Failed to refresh projects after settings update:`,t),t}},e[21]=s,e[22]=i,e[23]=q):q=e[23];let Pe=q,Fe,J;e[24]!==S||e[25]!==o.pathname||e[26]!==a?(Fe=()=>{(o.pathname===`/settings`||o.pathname===`/settings/project`||[`/settings/mcp-server-edit`,`/settings/add-skill`,`/settings/add-command`,`/settings/add-rule`,`/settings/add-agent`].some(e=>o.pathname.startsWith(e))||S&&o.pathname.startsWith(`/settings/account`))&&a(`/settings/general`,{replace:!0})},J=[o.pathname,a,S],e[24]=S,e[25]=o.pathname,e[26]=a,e[27]=Fe,e[28]=J):(Fe=e[27],J=e[28]),(0,B.useEffect)(Fe,J);let Ie;e[29]!==je||e[30]!==ie||e[31]!==c?(Ie=()=>(0,V.jsx)(L,{onTitleClose:je,subtitle:`Settings`,children:(0,V.jsx)(`div`,{className:`px-2 py-2`,children:(0,V.jsx)(ce,{selectedProjectId:c,onResetOnboarding:De,onNavItemSelect:ie})})}),e[29]=je,e[30]=ie,e[31]=c,e[32]=Ie):Ie=e[32];let Le=Ie,Re;e[33]!==b||e[34]!==Ne||e[35]!==Pe||e[36]!==Me||e[37]!==f||e[38]!==D||e[39]!==i||e[40]!==u?(Re=()=>{if(f&&i)return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`Project Settings`}),children:(0,V.jsx)(de,{projectId:i,onProjectUpdated:Pe})});switch(b){case`general`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`General`}),children:(0,V.jsx)(ue,{onboardingResetSignal:D})});case`providers`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(we,{}),children:(0,V.jsx)(fe,{})});case`models`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(R,{}),children:(0,V.jsx)(pe,{})});case`skills`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`Skills`}),children:(0,V.jsx)(he,{})});case`rules`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`Rules`}),children:(0,V.jsx)(ge,{})});case`slash-commands`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`Slash Commands`}),children:(0,V.jsx)(_e,{})});case`subagents`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`Subagents`}),children:(0,V.jsx)(ve,{})});case`instructions`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`Instructions`}),children:(0,V.jsx)(ye,{})});case`system-prompt`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`System Prompt`}),children:(0,V.jsx)(be,{})});case`mcp-servers`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`MCP Servers`}),children:(0,V.jsx)(me,{})});case`history`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`History`}),children:(0,V.jsx)(Se,{isOpen:!0,onClose:Ne,initialFilter:Me,projects:u,inline:!0})});case`account`:return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(U,{title:`Account`}),children:(0,V.jsx)(xe,{})});default:return(0,V.jsx)(U,{title:`Settings`})}},e[33]=b,e[34]=Ne,e[35]=Pe,e[36]=Me,e[37]=f,e[38]=D,e[39]=i,e[40]=u,e[41]=Re):Re=e[41];let ze=Re,Be,Ve;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Be=()=>C(!0),Ve=()=>C(!1),e[42]=Be,e[43]=Ve):(Be=e[42],Ve=e[43]);let Y;e[44]===Le?Y=e[45]:(Y=Le(),e[44]=Le,e[45]=Y);let He=`flex-1 overflow-auto ${ee&&!S?`ml-[40px]`:``}`,X;e[46]!==j||e[47]!==S||e[48]!==h||e[49]!==w?(X=S&&!w&&!h?(0,V.jsx)(`div`,{className:r(m.settingsPage,`pb-0`),children:(0,V.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-center gap-2`,children:[(0,V.jsxs)(l,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground`,onClick:se,children:[(0,V.jsx)(v,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{className:`sr-only`,children:`Show settings menu`})]}),(0,V.jsx)(`span`,{className:r(g.sectionTitle,`truncate text-foreground`),children:j})]})}):null,e[46]=j,e[47]=S,e[48]=h,e[49]=w,e[50]=X):X=e[50];let Z;e[51]===ze?Z=e[52]:(Z=ze(),e[51]=ze,e[52]=Z);let Q;e[53]!==He||e[54]!==X||e[55]!==Z?(Q=(0,V.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,V.jsxs)(`div`,{className:He,children:[X,Z]})}),e[53]=He,e[54]=X,e[55]=Z,e[56]=Q):Q=e[56];let $;return e[57]!==S||e[58]!==w||e[59]!==Y||e[60]!==Q?($=(0,V.jsx)(ae,{ref:k,collapsible:!0,isMobile:S,mobileShowSidebar:w,onCollapse:Be,onExpand:Ve,sidebar:Y,children:Q}),e[57]=S,e[58]=w,e[59]=Y,e[60]=Q,e[61]=$):$=e[61],$}function Oe(e){return e+1}function ke(e){return e.projects}function Ae(e){return e.selectedProjectId}export{De as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fs as e,Ii as t,Is as n}from"./dialogs-config-86QTDk4G.js";var r=n(),i=e();function a(e){let n=(0,r.c)(8),a,o;n[0]===e?(a=n[1],o=n[2]):({className:a,...o}=e,n[0]=e,n[1]=a,n[2]=o);let s;n[3]===a?s=n[4]:(s=t(`animate-pulse rounded-md bg-muted`,a),n[3]=a,n[4]=s);let c;return n[5]!==o||n[6]!==s?(c=(0,i.jsx)(`div`,{className:s,...o}),n[5]=o,n[6]=s,n[7]=c):c=n[7],c}export{a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ba as e,Fs as t,Is as n,No as r,Pi as i}from"./dialogs-config-86QTDk4G.js";var a=n(),o=t();function s(t){let n=(0,a.c)(6),{onContinue:s,disabled:c,creating:l}=t,u=c||l,d;n[0]===l?d=n[1]:(d=l?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(e,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,o.jsxs)(o.Fragment,{children:[`Continue`,(0,o.jsx)(r,{className:`ml-2 h-4 w-4`})]}),n[0]=l,n[1]=d);let f;return n[2]!==s||n[3]!==u||n[4]!==d?(f=(0,o.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,o.jsx)(i,{onClick:s,disabled:u,children:d})}),n[2]=s,n[3]=u,n[4]=d,n[5]=f):f=n[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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Fs as t,Ii as n,Is as r,Rs as i}from"./dialogs-config-86QTDk4G.js";import{c as a,d as o,l as s,u as c}from"./react-vendor-DK2COBjg.js";var l=r(),u=e(i(),1),d=t(),f=c,p=u.forwardRef((e,t)=>{let r=(0,l.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground`,i),r[3]=i,r[4]=o);let c;return r[5]!==a||r[6]!==t||r[7]!==o?(c=(0,d.jsx)(s,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=c):c=r[8],c});p.displayName=s.displayName;var m=u.forwardRef((e,t)=>{let r=(0,l.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let s;r[3]===i?s=r[4]:(s=n(`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]!==t||r[7]!==s?(c=(0,d.jsx)(o,{ref:t,className:s,...a}),r[5]=a,r[6]=t,r[7]=s,r[8]=c):c=r[8],c});m.displayName=o.displayName;var h=u.forwardRef((e,t)=>{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=n(`mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,i),r[3]=i,r[4]=s);let c;return r[5]!==o||r[6]!==t||r[7]!==s?(c=(0,d.jsx)(a,{ref:t,className:s,...o}),r[5]=o,r[6]=t,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};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialogs-config-86QTDk4G.js","assets/rolldown-runtime-aKtaBQYM.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ba as t,Br as n,D as r,Dt as i,Fo as a,Fs as o,Ii as s,Is as c,Kn as l,Ko as u,Lr as d,Lt as f,Pi as p,Qr as m,Rr as h,Rs as g,Sa as ee,Xn as _,Yn as v,Zn as y,bo as te,c as ne,ei as b,er as x,fs as S,ii as C,ni as w,ri as re,rn as T,tr as E,xt as D}from"./dialogs-config-86QTDk4G.js";import{r as O}from"./monaco-CZnIWXyV.js";import{a as k,l as A,n as j,o as M,s as N}from"./history-view-BsN806ip.js";import{A as P,D as F,E as I,H as L,K as R,L as z,T as B,U as ie,W as V}from"./index-C2iIghSR.js";var H=e(g(),1),U=c();async function W(e){return y(`api/projects/${_(e)}/tasks`)}async function ae(e,t,n){return E(`api/projects/${_(e)}/tasks`,{description:t,threadId:n?.threadId,provider:n?.provider,model:n?.model})}async function G(e,t,n){return x(`api/projects/${_(e)}/tasks/${_(t)}`,n)}async function oe(e,t){await v(`api/projects/${_(e)}/tasks/${_(t)}`)}function K(e,t){return`project-tasks:${e}:${t}`}function q(e){return e.status===`Done`?`Done`:e.working?`Working`:`Ready`}function J(e){return e.status!==`Done`&&!e.working}function se(e,t){if(t)return t;let n=e?.threads.map(e=>e.title)??[],r=/^thread-(\d+)$/i,i=0;for(let e of n){let t=e.match(r);t&&(i=Math.max(i,parseInt(t[1],10)))}return`thread-${i+1}`}async function ce(e){T(),N(`projects:bootstrap:`);let t=await i();e({type:R.SetProjects,projects:t.projects}),e({type:R.SetProjectsLoading,projectsLoading:!1})}async function Y(e){let t=await W(e),n=t.filter(e=>e.threadId&&e.status!==`Done`),r=[...t];return await Promise.all(n.map(async t=>{try{await f(t.threadId)}catch(n){if(n instanceof Error&&n.message.includes(`not found`)){let n=await G(e,t.id,{status:`Done`}),i=r.findIndex(e=>e.id===t.id);i!==-1&&(r[i]=n)}}})),r}async function le(e,t){let n=e.getReader(),r=new TextDecoder,i=``,a=null;try{for(;;){let{done:e,value:o}=await n.read();if(e)break;i+=r.decode(o,{stream:!0});let s=i.split(`
|
|
3
|
+
`);i=s.pop()??``;for(let e of s){let n=e.trim();if(n)try{let e=JSON.parse(n);e.type===`progress`&&typeof e.threadId==`string`&&!a&&(a=e.threadId,t(a))}catch{}}}}catch{}return a}function ue(e){return[...e].sort((e,t)=>e.status===`Done`&&t.status!==`Done`?1:e.status!==`Done`&&t.status===`Done`||e.working&&!t.working?-1:!e.working&&t.working?1:new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime())}var de=u(`app.task-agent-run.ui`);async function fe(e,t){let n=await f(t),r=n.model,i=n.modelProvider;if(r&&i)return{model:r,provider:i};try{let t=(await y(`api/threads?projectId=${encodeURIComponent(e)}`)||[]).map(e=>{let t=e;return{model:t.model??void 0,modelProvider:t.modelProvider??void 0}}).find(e=>e.model&&e.modelProvider);if(t?.model&&t.modelProvider)return{model:t.model,provider:t.modelProvider}}catch(e){de.error(`Failed to get project threads:`,e)}return null}function pe(e,t,n,r){e({type:R.SetProjectModel,threadId:t,model:{id:n,provider:r,name:n,description:``}}),l(t,{model:n,modelProvider:r})}async function me(e,t,n,r,i,a){i||a(await G(e,t.id,{status:n,working:!0,threadId:r}))}var X=o();function he({task:e,disabled:n=!1,onImplementInNewThread:r,onImplementInThisThread:i,onMarkDone:o}){let[c,l]=(0,H.useState)(!1),u=q(e),d=J(e),f=e.status!==`Done`,m=n||c||!d&&!f;async function h(e){l(!0);try{await e()}finally{l(!1)}}return(0,X.jsxs)(B,{children:[(0,X.jsx)(P,{asChild:!0,children:(0,X.jsxs)(p,{variant:`outline`,size:`sm`,className:s(`shrink-0 gap-1.5`,e.working&&`border-primary/50`),disabled:m,children:[(c||e.working)&&(0,X.jsx)(t,{className:`h-3.5 w-3.5 animate-spin`}),(0,X.jsx)(`span`,{children:u}),!m&&(0,X.jsx)(a,{className:`h-3.5 w-3.5 opacity-60`})]})}),(0,X.jsxs)(I,{align:`end`,children:[d&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(F,{onClick:()=>void h(()=>r(e)),children:`Implement in New Thread`}),(0,X.jsx)(F,{onClick:()=>void h(()=>i(e)),children:`Implement in this thread`})]}),f&&(0,X.jsx)(F,{onClick:()=>void h(()=>o(e)),children:`Mark done`})]})]})}var Z=u(`app.task-list.ui`);function ge({projectId:e,onThreadSelect:i,initialTasks:a}){let o=ie(),c=V(e=>e.projects),l=V(e=>e.selectedThreadId),u=V(e=>e.processingThreadIds),f=V(e=>e.pendingChatMessage),g=V(e=>e.queuedChatMessages),_=V(e=>e.projectModelSelections),v=c.find(t=>t.projectId===e),y=v?.threads.find(e=>e.threadId===l),x=l?_[l]:void 0,[T,E]=(0,H.useState)(a),[D,O]=(0,H.useState)(!1),[k,A]=(0,H.useState)(null),[j,M]=(0,H.useState)(``),[P,F]=(0,H.useState)(!1);function I(){N(`project-tasks:${e}:`)}(0,H.useEffect)(()=>{if(!T.some(e=>e.working))return;let t=setInterval(async()=>{try{let n=await W(e);E(n),n.some(e=>e.working)||clearInterval(t)}catch(e){Z.error(`Failed to poll project tasks:`,e)}},2e3);return()=>clearInterval(t)},[T,e]),(0,H.useEffect)(()=>{E(a)},[a]),(0,H.useEffect)(()=>{D&&M(``)},[D]);function z(e){E(t=>t.map(t=>t.id===e.id?e:t))}function B(e){M(e.description),A({task:e})}function U(){A(null),M(``)}async function K(){if(j.trim()){F(!0);try{let t=await ae(e,j,{threadId:l??void 0,provider:x?.provider??y?.modelProvider,model:x?.id??y?.model});E(e=>[...e,t]),I(),O(!1),M(``)}finally{F(!1)}}}async function q(){if(!(!j.trim()||!k)){F(!0);try{let t=await G(e,k.task.id,{description:j,threadId:l??void 0,provider:x?.provider??y?.modelProvider,model:x?.id??y?.model});E(e=>e.map(e=>e.id===t.id?t:e)),I(),U()}finally{F(!1)}}}async function J(){if(k){F(!0);try{await oe(e,k.task.id),E(e=>e.filter(e=>e.id!==k.task.id)),I(),U()}finally{F(!1)}}}async function Y(t){let n=await r(e);if(!n)return;let a=null,s=null,c=await le(n,n=>{s||(s=n,o({type:R.AddCreatingThread,projectId:e,threadId:n,title:se(v)}),o({type:R.AddProcessingThread,threadId:n})),G(e,t.id,{status:`Build`,working:!0,threadId:n}).then(e=>{a=e,z(e)})});if(!c){s&&(o({type:R.RemoveCreatingThread,projectId:e,threadId:s}),o({type:R.RemoveProcessingThread,threadId:s}));return}o({type:R.RemoveProcessingThread,threadId:c});try{await ce(o)}catch(e){Z.error(`Failed to refresh projects after task thread creation:`,e)}await me(e,t,`Build`,c,a,z);let l=await fe(e,c);if(!l){Z.error(`No model configuration found. Please configure a model and provider for this project first.`);return}pe(o,c,l.model,l.provider),i?await i(c):o({type:R.SelectThread,threadId:c,projectId:e}),o({type:R.SetPendingChatMessage,message:{threadId:c,message:t.description,model:l.model,provider:l.provider}})}async function de(t){if(!l){Z.error(`No selected thread found for project task implementation.`);return}let n=await fe(e,l);if(!n){Z.error(`No model configuration found. Please configure a model and provider for this project first.`);return}if(pe(o,l,n.model,n.provider),z(await G(e,t.id,{status:`Build`,working:!0,threadId:l})),i?await i(l):o({type:R.SelectThread,threadId:l,projectId:e}),u.includes(l)||f?.threadId===l||g.some(e=>e.threadId===l)){o({type:R.EnqueueChatMessage,message:{id:crypto.randomUUID(),threadId:l,paneId:`primary`,message:t.description,model:n.model,attachments:[],provider:n.provider}});return}o({type:R.SetPendingChatMessage,message:{threadId:l,message:t.description,model:n.model,provider:n.provider}})}async function ge(t){z(await G(e,t.id,{status:`Done`,working:!1})),I()}let Q=ue(T);return(0,X.jsxs)(`div`,{className:`relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,children:[(0,X.jsx)(ne,{className:`min-h-0 min-w-0 flex-1 overflow-hidden pb-24`,children:Q.length===0?(0,X.jsx)(`p`,{className:s(S.bodyMuted,`px-4 py-8 text-center`),children:`No tasks yet. Add one to get started.`}):(0,X.jsx)(`div`,{className:`min-w-0 w-full divide-y divide-border`,children:Q.map(e=>(0,X.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] grid-rows-[auto_auto] gap-x-2 gap-y-1 px-4 py-3 hover:bg-accent/40 sm:flex sm:items-start sm:gap-4`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`col-start-1 row-start-1 block min-w-0 overflow-hidden text-left sm:flex-1`,onClick:()=>B(e),children:[(0,X.jsx)(`p`,{className:s(S.label,`truncate`),children:e.title}),(0,X.jsx)(`p`,{className:s(S.caption,`mt-1 line-clamp-2 break-all text-muted-foreground max-sm:hidden`),children:e.description})]}),(0,X.jsx)(`button`,{type:`button`,className:`col-span-2 row-start-2 block min-w-0 overflow-hidden text-left sm:hidden`,onClick:()=>B(e),children:(0,X.jsx)(`p`,{className:s(S.caption,`line-clamp-4 break-all text-muted-foreground`),children:e.description})}),(0,X.jsxs)(`div`,{className:`col-start-2 row-start-1 flex shrink-0 items-center gap-1.5 self-start`,children:[e.threadId&&i&&(0,X.jsxs)(d,{children:[(0,X.jsx)(n,{asChild:!0,children:(0,X.jsxs)(p,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0`,onClick:()=>i(e.threadId),children:[(0,X.jsx)(te,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Open thread`})]})}),(0,X.jsx)(h,{children:`Open thread`})]}),(0,X.jsx)(he,{task:e,onImplementInNewThread:Y,onImplementInThisThread:de,onMarkDone:ge})]})]},e.id))})}),(0,X.jsxs)(d,{children:[(0,X.jsx)(n,{asChild:!0,children:(0,X.jsxs)(p,{size:`icon`,className:`absolute bottom-6 right-6 z-10 h-14 w-14 rounded-full shadow-lg`,onClick:()=>O(!0),children:[(0,X.jsx)(ee,{className:`h-6 w-6`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Add task`})]})}),(0,X.jsx)(h,{children:`Add task`})]}),(0,X.jsx)(m,{open:D,onOpenChange:O,children:(0,X.jsxs)(b,{className:`sm:max-w-2xl`,children:[(0,X.jsx)(re,{children:(0,X.jsx)(C,{children:`Add Task`})}),(0,X.jsxs)(`div`,{className:`py-2`,children:[(0,X.jsx)(L,{placeholder:`Describe what needs to be done...`,value:j,onChange:e=>M(e.target.value),rows:12,className:`resize-none text-base`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&K()}}),(0,X.jsx)(`p`,{className:s(S.caption,`mt-1.5`),children:`A title will be generated automatically from your description.`})]}),(0,X.jsx)(w,{children:(0,X.jsx)(p,{onClick:()=>void K(),disabled:P||!j.trim(),children:P?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(t,{className:`mr-1 h-3 w-3 animate-spin`}),`Generating title...`]}):`Add`})})]})}),(0,X.jsx)(m,{open:k!==null,onOpenChange:e=>!e&&U(),children:(0,X.jsxs)(b,{className:`max-w-2xl flex-col max-md:top-[max(1rem,env(safe-area-inset-top,0px))] max-md:max-h-[calc(100dvh-2rem)] max-md:translate-y-0 max-md:overflow-y-auto max-md:data-[state=closed]:slide-out-to-top max-md:data-[state=open]:slide-in-from-top max-md:data-[state=closed]:slide-out-to-left-0 max-md:data-[state=open]:slide-in-from-left-0 max-md:data-[state=closed]:zoom-out-100 max-md:data-[state=open]:zoom-in-100 md:max-h-[calc(100svh-2rem)]`,children:[(0,X.jsx)(re,{children:(0,X.jsx)(C,{children:`Edit Task`})}),(0,X.jsx)(`div`,{className:`py-2`,children:(0,X.jsx)(L,{placeholder:`Describe what needs to be done...`,value:j,onChange:e=>M(e.target.value),rows:12,className:`max-h-[min(16rem,40svh)] resize-none text-base sm:max-h-none`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&q()}})}),(0,X.jsxs)(w,{className:`flex-row justify-between gap-2 sm:gap-0`,children:[(0,X.jsx)(p,{variant:`destructive`,onClick:()=>void J(),disabled:P,children:`Delete`}),(0,X.jsx)(p,{onClick:()=>void q(),disabled:P||!j.trim(),className:`w-auto`,children:P?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(t,{className:`mr-1 h-3 w-3 animate-spin`}),`Saving...`]}):`Save`})]})]})})]})}function Q(e){let t=(0,U.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({projectId:r,loadVersion:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=K(r,n),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o;t[7]===r?o=t[8]:(o=()=>Y(r),t[7]=r,t[8]=o);let s=k(a,o),c;return t[9]!==s||t[10]!==r||t[11]!==i?(c=(0,X.jsx)(ge,{projectId:r,initialTasks:s,...i}),t[9]=s,t[10]=r,t[11]=i,t[12]=c):c=t[12],c}function _e(e){let t=(0,U.c)(18),n,r;t[0]===e?(n=t[1],r=t[2]):({refreshTrigger:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let i=r===void 0?0:r,[a,o]=(0,H.useState)(0),s,c;t[3]!==n.projectId||t[4]!==i?(s=()=>{i!==0&&o(e=>(M(K(n.projectId,e)),e+1))},c=[i,n.projectId],t[3]=n.projectId,t[4]=i,t[5]=s,t[6]=c):(s=t[5],c=t[6]),(0,H.useEffect)(s,c);let l;t[7]!==a||t[8]!==n.projectId?(l=function(){M(K(n.projectId,a)),o(ve)},t[7]=a,t[8]=n.projectId,t[9]=l):l=t[9];let u=l,d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsx)(A,{className:`h-64`}),t[10]=d):d=t[10];let f=`${n.projectId}:${a}`,p;t[11]!==a||t[12]!==n||t[13]!==f?(p=(0,X.jsx)(H.Suspense,{fallback:d,children:(0,X.jsx)(Q,{...n,loadVersion:a},f)}),t[11]=a,t[12]=n,t[13]=f,t[14]=p):p=t[14];let m;return t[15]!==u||t[16]!==p?(m=(0,X.jsx)(j,{fallbackTitle:`Failed to load tasks`,onRetry:u,children:p}),t[15]=u,t[16]=p,t[17]=m):m=t[17],m}function ve(e){return e+1}var $=u(`app.tasks-view.ui`);function ye({projectId:e,refreshTrigger:t}){let n=ie(),r=V(e=>e.projects),i=V(e=>e.selectedThreadId),a=V(e=>e.selectedProjectId),{setActiveMainTab:o}=z();async function s(t){if(r.find(t=>t.projectId===e)){o(`chat`);try{let{getProjects:r,invalidateProjectsCache:o}=await O(async()=>{let{getProjects:e,invalidateProjectsCache:t}=await import(`./dialogs-config-86QTDk4G.js`).then(e=>e.f);return{getProjects:e,invalidateProjectsCache:t}},__vite__mapDeps([0,1]));o();let s=await r();n({type:R.SetProjects,projects:s.projects});let c=s.projects.find(t=>t.projectId===e);if(c&&c.threads.find(e=>e.threadId===t)){(i!==t||a!==e)&&n({type:R.SelectThread,threadId:t,projectId:e});try{let e=await D();n({type:R.SetProcessingThreads,threadIds:e})}catch(e){$.error(`Failed to fetch processing threads after thread selection:`,e)}}}catch(r){$.error(`Failed to refresh projects for thread selection:`,r),(i!==t||a!==e)&&n({type:R.SelectThread,threadId:t,projectId:e});try{let e=await D();n({type:R.SetProcessingThreads,threadIds:e})}catch(e){$.error(`Failed to fetch processing threads after fallback thread selection:`,e)}}}}return(0,X.jsx)(`div`,{className:`relative flex h-full min-w-0 flex-col overflow-hidden`,children:(0,X.jsx)(`div`,{className:`min-w-0 flex-1 overflow-hidden pt-8`,children:(0,X.jsx)(_e,{projectId:e,refreshTrigger:t,onThreadSelect:s})})})}export{ye as TasksView};
|