tarsk 0.5.52 → 0.5.53
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 +1550 -1796
- package/dist/public/assets/{account-view-C5bYplbC.js → account-view-5qdPli2O.js} +1 -1
- package/dist/public/assets/{api-DDjBQKVp.js → api-DM6LtnPA.js} +1 -1
- package/dist/public/assets/browser-tab-B9KCHZ2L.js +8 -0
- package/dist/public/assets/commit-dialog-DeVXqj1Z.js +1 -0
- package/dist/public/assets/{context-menu-CyWNCdS8.js → context-menu-CHJI6MbC.js} +1 -1
- package/dist/public/assets/create-repo-dialog-ByIjJnh7.js +1 -0
- package/dist/public/assets/dialogs-config-DAMqiy-4.js +51 -0
- package/dist/public/assets/{diff-view-CUydKAcj.js → diff-view-DxSswxah.js} +2 -2
- package/dist/public/assets/{explorer-tab-view-DImsoaa7.js → explorer-tab-view-DMt-0Zcl.js} +2 -2
- package/dist/public/assets/{explorer-tree-C3N9yUX2.js → explorer-tree-D3nyQX1f.js} +1 -1
- package/dist/public/assets/explorer-view-BRBtKxsw.js +75 -0
- package/dist/public/assets/git-history-dialog-DJfkffd6.js +1 -0
- package/dist/public/assets/git-ops-button-0DrfLBkC.js +2 -0
- package/dist/public/assets/history-view-lvvTzW7O.js +9 -0
- package/dist/public/assets/index-C_iiobDl.js +81 -0
- package/dist/public/assets/index-DhnUeGIU.css +1 -0
- package/dist/public/assets/{mcp-server-card-euln08CV.js → mcp-server-card-DPMxJJU6.js} +1 -1
- package/dist/public/assets/merged-pr-dialog-BC9NMIet.js +1 -0
- package/dist/public/assets/model-star-rating-C4Ugsik_.js +1 -0
- package/dist/public/assets/onboarding-dys9Rwb5.js +1 -0
- package/dist/public/assets/project-settings-view-XGHhtLr_.js +1 -0
- package/dist/public/assets/providers-list-view-Cbndeobz.js +1 -0
- package/dist/public/assets/pull-request-dialog-kuaKjUle.js +1 -0
- package/dist/public/assets/pull-with-changes-dialog-CoxkFsGu.js +1 -0
- package/dist/public/assets/push-before-pr-dialog-C4cbgPuA.js +1 -0
- package/dist/public/assets/{radio-group-DZUWbeu6.js → radio-group-C6EDTFov.js} +1 -1
- package/dist/public/assets/{react-vendor-G5EdW8A3.js → react-vendor-U9lUQswz.js} +5 -5
- package/dist/public/assets/settings-general-view-BHj9qn0K.js +1 -0
- package/dist/public/assets/{settings-instructions-view-DdZptx3T.js → settings-instructions-view-CRUCeWUk.js} +1 -1
- package/dist/public/assets/{settings-list-CKN-l-Ee.js → settings-list-BapKAJV3.js} +1 -1
- package/dist/public/assets/settings-mcp-servers-view-M2DQPcpo.js +5 -0
- package/dist/public/assets/{settings-models-skeleton-bDHbKptW.js → settings-models-skeleton-B7TMwjxe.js} +1 -1
- package/dist/public/assets/{settings-models-view-Dm63snYH.js → settings-models-view-ObE_ktqH.js} +1 -1
- package/dist/public/assets/settings-rules-view-BhRBowk9.js +8 -0
- package/dist/public/assets/{settings-skills-view-DUq0nOrv.js → settings-skills-view-MZQjnD_g.js} +3 -3
- package/dist/public/assets/{settings-slash-commands-view-3UGw-rg7.js → settings-slash-commands-view-BYHthCEM.js} +1 -1
- package/dist/public/assets/settings-subagents-view-CmrFQcUF.js +2 -0
- package/dist/public/assets/{settings-system-prompt-view-C5zpTiRs.js → settings-system-prompt-view-CZe9uYNN.js} +1 -1
- package/dist/public/assets/{settings-view-BqDpwOQy.js → settings-view-BQL9vEvw.js} +2 -2
- package/dist/public/assets/{skeleton-jLDiBDMB.js → skeleton-rEPpLCqo.js} +1 -1
- package/dist/public/assets/{slug-utils-CKHx-ORv.js → slug-utils-DZ59sTAJ.js} +1 -1
- package/dist/public/assets/{tabs-BDis0z_E.js → tabs-D57g7ER1.js} +1 -1
- package/dist/public/assets/tasks-view-Bn9GiPNp.js +3 -0
- package/dist/public/assets/{terminal-panel-qSiost2C.js → terminal-panel-CrBP1KEj.js} +2 -2
- package/dist/public/assets/{ui-components-CxpS-7ye.js → ui-components-BPFbmhJA.js} +1 -1
- package/dist/public/assets/{use-deferred-search-BqzgL9XK.js → use-deferred-search-Bi99md6l.js} +1 -1
- package/dist/public/assets/{utils-DKzTCvnZ.js → utils-C-7eVelM.js} +1 -1
- package/dist/public/assets/{vosk-speech-Im3i-XDL.js → vosk-speech-DC3I453R.js} +1 -1
- package/dist/public/assets/{web-DE8zJOsF.js → web-CHeXRjkl.js} +1 -1
- package/dist/public/assets/{web-CY9AvMQI.js → web-DbVs7vzI.js} +1 -1
- package/dist/public/assets/{web-CtID-CpM.js → web-GowI_ZaX.js} +1 -1
- package/dist/public/assets/{web-D7a-Gt-K.js → web-t7m2rd8w.js} +1 -1
- package/dist/public/index.html +8 -8
- package/package.json +3 -3
- package/dist/public/assets/browser-tab-BLzy-OnY.js +0 -8
- package/dist/public/assets/commit-dialog-VaKgg0v7.js +0 -1
- package/dist/public/assets/create-repo-dialog-CxeBrzuI.js +0 -1
- package/dist/public/assets/dialogs-config-sFb6rmoV.js +0 -51
- package/dist/public/assets/explorer-view-t0Ubx-_E.js +0 -75
- package/dist/public/assets/git-history-dialog-BdFqU3-t.js +0 -1
- package/dist/public/assets/git-ops-button-DREYFquW.js +0 -2
- package/dist/public/assets/history-view-BaNsCvOG.js +0 -9
- package/dist/public/assets/index-BabXMhGR.js +0 -81
- package/dist/public/assets/index-CouJM3yT.css +0 -1
- package/dist/public/assets/merged-pr-dialog-CU3eepWu.js +0 -1
- package/dist/public/assets/model-star-rating-BeaqZyyn.js +0 -1
- package/dist/public/assets/onboarding-BtDZI4KL.js +0 -1
- package/dist/public/assets/project-settings-view-nULqYl1Q.js +0 -1
- package/dist/public/assets/providers-list-view-C_I7apJ0.js +0 -1
- package/dist/public/assets/pull-request-dialog-DPoyoAzR.js +0 -1
- package/dist/public/assets/pull-with-changes-dialog-BWeBUSvR.js +0 -1
- package/dist/public/assets/push-before-pr-dialog-CelqoZ3J.js +0 -1
- package/dist/public/assets/settings-general-view-BIpRxHjN.js +0 -1
- package/dist/public/assets/settings-mcp-servers-view-DThIXFIU.js +0 -5
- package/dist/public/assets/settings-rules-view-C8EhiuF6.js +0 -8
- package/dist/public/assets/settings-subagents-view-DjY_-Vkl.js +0 -2
- package/dist/public/assets/tasks-view-Chkg_CWm.js +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ao as t,Ba as n,Ii as r,Is as i,Ko as a,Na as o,Ns as s,Oo as c,Pi as l,Ps as u,Z as ee,Zn as te,Zr as ne,fs as d,ga as re,jo as ie,n as ae,r as f,tr as oe,zn as p}from"./dialogs-config-DAMqiy-4.js";import{a as se,i as ce,o as m,r as le,s as h}from"./react-vendor-U9lUQswz.js";import{C as ue,D as de,E as fe,S as pe,b as g}from"./history-view-lvvTzW7O.js";import{n as me}from"./utils-C-7eVelM.js";import{a as he,t as ge,x as _e}from"./index-C_iiobDl.js";var ve=u(),_=e(i(),1),v=s(),ye=_.forwardRef((e,t)=>{let n=(0,ve.c)(11),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`relative flex w-full touch-none select-none items-center`,i),n[3]=i,n[4]=o);let s,c;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,v.jsx)(h,{className:`relative h-2 w-full grow overflow-hidden rounded-full bg-secondary`,children:(0,v.jsx)(ce,{className:`absolute h-full bg-primary`})}),c=(0,v.jsx)(m,{className:`block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`}),n[5]=s,n[6]=c):(s=n[5],c=n[6]);let l;return n[7]!==a||n[8]!==t||n[9]!==o?(l=(0,v.jsxs)(se,{ref:t,className:o,...a,children:[s,c]}),n[7]=a,n[8]=t,n[9]=o,n[10]=l):l=n[10],l});ye.displayName=se.displayName;var y=a(`app.use-maximum-turn-count.hook`),b=50;function be(){let[e,t]=(0,_.useState)(b),[n,r]=(0,_.useState)(b.toString()),[i,a]=(0,_.useState)(!0),[o,s]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let e=!1;async function n(){try{let n=await ee();e||(t(n.maximumTurnCount),r(n.maximumTurnCount.toString()))}catch(e){y.error(`Failed to load maximum turn count:`,e)}finally{e||a(!1)}}return n(),()=>{e=!0}},[]);function c(e){r(e)}async function l(e){s(!0);try{let n=await p({maximumTurnCount:e});t(n.maximumTurnCount),r(n.maximumTurnCount.toString())}catch(e){throw y.error(`Failed to update maximum turn count:`,e),e}finally{s(!1)}}function u(){r(e.toString())}return{defaultMaximumTurnCount:b,draftMaximumTurnCount:n,isLoading:i,isSaving:o,maximumTurnCount:e,resetDraftMaximumTurnCount:u,setDraftMaximumTurnCount:c,updateMaximumTurnCount:l}}function x(){return typeof navigator>`u`?!1:navigator.userAgentData?.platform===`macOS`?!0:navigator.platform.startsWith(`Mac`)}var xe=a(`app.use-screen-recording-permission.hook`),Se={isMacOS:!1,granted:!1,available:!1,message:``};function Ce(){return{...Se,isMacOS:x()}}function we(){let[e,t]=(0,_.useState)(Ce),[n,r]=(0,_.useState)(!0),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null),u=(0,_.useCallback)(async()=>{r(!0),a(null);try{t(await te(`api/system-permissions/screen-recording`))}catch(e){a(e instanceof Error?e.message:`Failed to check screen recording permission`),t(e=>({...Se,isMacOS:e?.isMacOS??x(),message:`Unable to check permission status.`}))}finally{r(!1)}},[]);return(0,_.useEffect)(()=>{u()},[u]),{status:e,isLoading:n,error:i,isOpeningSettings:o,openSettingsError:c,refresh:u,openSystemSettings:(0,_.useCallback)(async()=>{s(!0),l(null);try{let e=await oe(`api/system-permissions/screen-recording/open-settings`,{});if(!e.success){let t=e.message||`Failed to open System Settings`;xe.error(`[useScreenRecordingPermission] ${t}`,e.error),l(t)}}catch(e){let t=e instanceof Error?e.message:`Failed to open System Settings`;xe.error(`[useScreenRecordingPermission] Error opening System Settings:`,e),l(t)}finally{s(!1)}},[])}}var Te=a(`app.use-server-bind-mode.hook`),Ee=`local`,S=`tarsk-server-bind-mode-changed`;function C(){if(typeof window>`u`)return!1;try{return sessionStorage.getItem(S)===`true`}catch{return!1}}function De(e){if(!(typeof window>`u`))try{e?sessionStorage.setItem(S,`true`):sessionStorage.removeItem(S)}catch{}}function Oe(){let[e,t]=(0,_.useState)(Ee),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)([]),[o,s]=(0,_.useState)(!0),[c,l]=(0,_.useState)(!1),[u,te]=(0,_.useState)(C);(0,_.useEffect)(()=>{let e=!1;async function n(){try{let n=await ee();e||(t(n.serverBindMode),r(n.serverBindMode),a(n.networkAddresses))}catch(e){Te.error(`Failed to load server bind mode:`,e)}finally{e||s(!1)}}return n(),()=>{e=!0}},[]);async function ne(e){l(!0);try{let n=await p({serverBindMode:e});t(n.serverBindMode),a(n.networkAddresses),te(!0),De(!0)}catch(e){throw Te.error(`Failed to update server bind mode:`,e),e}finally{l(!1)}}let d=n!==null&&e!==n;return{defaultServerBindMode:Ee,hasServerBindModeChanged:d,isLoading:o,isSaving:c,needsRestart:d||u,networkAddresses:i,serverBindMode:e,updateServerBindMode:ne}}var w=a(`app.use-betterstack-logging.hook`);function ke(){let[e,t]=(0,_.useState)(!1),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!0),[c,l]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let e=!1;async function n(){try{let n=await ee();e||(t(n.betterStackLoggingEnabled),r(n.betterStackEnvConfigured),a(n.betterStackIngestingHost))}catch(e){w.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 p({betterStackLoggingEnabled:e});t(n.betterStackLoggingEnabled),r(n.betterStackEnvConfigured),a(n.betterStackIngestingHost)}catch(e){throw w.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 Ae=[{value:`local`,label:`No`},{value:`network`,label:`Yes`}],je=[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`system`,label:`System`}],Me=[{value:`no`,label:`No`},{value:`yes`,label:`Yes`}],Ne=[`462`,`8100`].includes(typeof document<`u`?document.location.port:``)?`462`:`641`,Pe=600;function Fe(e){let i=(0,ve.c)(150),{onboardingResetSignal:a}=e,s=a===void 0?0:a,[u,ee]=(0,_.useState)(!1),{theme:te,setTheme:oe}=me(),{scale:p,updateScale:se,resetScale:ce,min:m,max:h,default:y}=ge(),{defaultMaximumTurnCount:b,draftMaximumTurnCount:x,isLoading:xe,isSaving:Se,resetDraftMaximumTurnCount:Ce,setDraftMaximumTurnCount:Te,updateMaximumTurnCount:Ee}=be(),{status:S,isLoading:C,isOpeningSettings:De,openSettingsError:w,refresh:Fe,openSystemSettings:ze}=we(),{isLoading:Be,isSaving:Ve,needsRestart:T,networkAddresses:E,serverBindMode:D,updateServerBindMode:He}=Oe(),{isEnabled:Ue,isLoading:We,isSaving:Ge,updateIsEnabled:Ke}=_e(),{isEnabled:qe,isLoading:Je,isSaving:Ye,updateIsEnabled:Xe}=he(),{isEnabled:O,isEnvConfigured:k,ingestingHost:Ze,isLoading:Qe,isSaving:$e,updateIsEnabled:et}=ke(),tt,nt;i[0]===s?(tt=i[1],nt=i[2]):(tt=()=>{if(s===0)return;ee(!0);let e=setTimeout(()=>{ee(!1)},Pe);return()=>{clearTimeout(e)}},nt=[s],i[0]=s,i[1]=tt,i[2]=nt),(0,_.useEffect)(tt,nt);let rt;i[3]===Te?rt=i[4]:(rt=function(e){Te(e.target.value)},i[3]=Te,i[4]=rt);let it=rt,at;i[5]!==b||i[6]!==x||i[7]!==Ce||i[8]!==Ee?(at=async function(){let e=Number.parseInt(x,10),t=Number.isFinite(e)&&e>0?e:b;try{await Ee(t)}catch{Ce()}},i[5]=b,i[6]=x,i[7]=Ce,i[8]=Ee,i[9]=at):at=i[9];let ot=at,st;i[10]===se?st=i[11]:(st=function(e){e.length>0&&se(e[0])},i[10]=se,i[11]=st);let ct=st,lt=u&&`animate-headline-reset`,A;i[12]===lt?A=i[13]:(A=r(lt),i[12]=lt,i[13]=A);let j;i[14]===A?j=i[15]:(j=(0,v.jsx)(pe,{title:`General`,description:`Customize the appearance and behavior of Tarsk.`,titleClassName:A}),i[14]=A,i[15]=j);let ut,dt;i[16]===Symbol.for(`react.memo_cache_sentinel`)?(ut=(0,v.jsx)(re,{className:`h-3.5 w-3.5`}),dt=(0,v.jsx)(`span`,{className:`sr-only`,children:`Reset font size to default`}),i[16]=ut,i[17]=dt):(ut=i[16],dt=i[17]);let M;i[18]===ce?M=i[19]:(M=(0,v.jsxs)(l,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:ce,children:[ut,dt]}),i[18]=ce,i[19]=M);let N;i[20]===p?N=i[21]:(N=(0,v.jsxs)(`span`,{className:`${d.mono} tabular-nums w-12 text-right`,children:[p,`%`]}),i[20]=p,i[21]=N);let P;i[22]!==M||i[23]!==N?(P=(0,v.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[M,N]}),i[22]=M,i[23]=N,i[24]=P):P=i[24];let F;i[25]===m?F=i[26]:(F=(0,v.jsxs)(`span`,{className:`${d.bodyMuted} w-8 text-right`,children:[m,`%`]}),i[25]=m,i[26]=F);let I;i[27]===p?I=i[28]:(I=[p],i[27]=p,i[28]=I);let L;i[29]!==ct||i[30]!==h||i[31]!==m||i[32]!==I?(L=(0,v.jsx)(ye,{value:I,min:m,max:h,step:5,onValueChange:ct,"aria-label":`Font size`}),i[29]=ct,i[30]=h,i[31]=m,i[32]=I,i[33]=L):L=i[33];let ft;i[34]===h?ft=i[35]:(ft=(0,v.jsxs)(`span`,{className:`${d.bodyMuted} w-9`,children:[h,`%`]}),i[34]=h,i[35]=ft);let R;i[36]!==F||i[37]!==L||i[38]!==ft?(R=(0,v.jsxs)(`div`,{className:`flex items-center gap-3`,children:[F,L,ft]}),i[36]=F,i[37]=L,i[38]=ft,i[39]=R):R=i[39];let z;i[40]!==y||i[41]!==p?(z=p!==y&&(0,v.jsxs)(`p`,{className:`${d.bodyMuted} mt-2`,children:[`Font size has been changed from the default (`,y,`%).`]}),i[40]=y,i[41]=p,i[42]=z):z=i[42];let B;i[43]!==P||i[44]!==R||i[45]!==z?(B=(0,v.jsxs)(g,{title:`Font Size`,description:`Adjust the text size across the entire application.`,action:P,children:[R,z]}),i[43]=P,i[44]=R,i[45]=z,i[46]=B):B=i[46];let V;i[47]===oe?V=i[48]:(V=e=>{(e===`light`||e===`dark`||e===`system`)&&oe(e)},i[47]=oe,i[48]=V);let pt;i[49]===Symbol.for(`react.memo_cache_sentinel`)?(pt=je.map(Re),i[49]=pt):pt=i[49];let H;i[50]!==V||i[51]!==te?(H=(0,v.jsx)(g,{title:`Appearance`,description:`Choose your preferred color scheme.`,children:(0,v.jsx)(ae,{type:`single`,value:te,onValueChange:V,"aria-label":`Appearance`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:pt})}),i[50]=V,i[51]=te,i[52]=H):H=i[52];let U;i[53]===ot?U=i[54]:(U=()=>{ot()},i[53]=ot,i[54]=U);let mt=xe||Se,W;i[55]!==x||i[56]!==it||i[57]!==U||i[58]!==mt?(W=(0,v.jsx)(ne,{type:`number`,min:1,step:1,value:x,onChange:it,onBlur:U,disabled:mt,"aria-label":`Maximum turn count`,className:`w-28 text-right font-mono tabular-nums flex-shrink-0`}),i[55]=x,i[56]=it,i[57]=U,i[58]=mt,i[59]=W):W=i[59];let G;i[60]===b?G=i[61]:(G=(0,v.jsxs)(`p`,{className:d.bodyMuted,children:[`Default: `,b,` turns.`]}),i[60]=b,i[61]=G);let K;i[62]!==W||i[63]!==G?(K=(0,v.jsx)(g,{title:`Maximum Turn Count`,description:`Set how many turns a long-running agent chat can take before Tarsk asks whether to continue.`,action:W,children:G}),i[62]=W,i[63]=G,i[64]=K):K=i[64];let ht=Ue?`on`:`off`,q;i[65]===Ke?q=i[66]:(q=e=>{e&&Ke(e===`on`)},i[65]=Ke,i[66]=q);let gt=We||Ge,_t,vt;i[67]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,v.jsx)(f,{value:`off`,className:`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm dark:data-[state=on]:bg-background dark:data-[state=on]:text-foreground`,children:`Off`}),vt=(0,v.jsx)(f,{value:`on`,className:`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm dark:data-[state=on]:bg-background dark:data-[state=on]:text-foreground`,children:`On`}),i[67]=_t,i[68]=vt):(_t=i[67],vt=i[68]);let J;i[69]!==ht||i[70]!==q||i[71]!==gt?(J=(0,v.jsx)(g,{title:`AI Voice Cleanup`,description:`After stopping voice recording, run the transcription through AI to remove filler words, false starts, and repetitions.`,children:(0,v.jsxs)(ae,{type:`single`,value:ht,onValueChange:q,disabled:gt,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,"aria-label":`AI Voice Cleanup`,children:[_t,vt]})}),i[69]=ht,i[70]=q,i[71]=gt,i[72]=J):J=i[72];let yt=qe?`on`:`off`,Y;i[73]===Xe?Y=i[74]:(Y=e=>{e&&Xe(e===`on`)},i[73]=Xe,i[74]=Y);let bt=Je||Ye,xt,St;i[75]===Symbol.for(`react.memo_cache_sentinel`)?(xt=(0,v.jsx)(f,{value:`off`,className:`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm dark:data-[state=on]:bg-background dark:data-[state=on]:text-foreground`,children:`Off`}),St=(0,v.jsx)(f,{value:`on`,className:`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm dark:data-[state=on]:bg-background dark:data-[state=on]:text-foreground`,children:`On`}),i[75]=xt,i[76]=St):(xt=i[75],St=i[76]);let X;i[77]!==yt||i[78]!==Y||i[79]!==bt?(X=(0,v.jsx)(g,{title:`Daily Spend`,description:`Show an estimated daily spend counter in the chat header.`,children:(0,v.jsxs)(ae,{type:`single`,value:yt,onValueChange:Y,disabled:bt,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,"aria-label":`Daily Spend`,children:[xt,St]})}),i[77]=yt,i[78]=Y,i[79]=bt,i[80]=X):X=i[80];let Ct;i[81]!==De||i[82]!==C||i[83]!==ze||i[84]!==Fe||i[85]!==w||i[86]!==S?.granted||i[87]!==S?.isMacOS||i[88]!==S?.message?(Ct=S?.isMacOS&&(0,v.jsx)(g,{title:`Screen & System Audio Recording`,description:`Tarsk needs this macOS permission to capture screen content for browser tools and screen sharing features.`,action:(0,v.jsx)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:(0,v.jsxs)(l,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>void Fe(),disabled:C,children:[C?(0,v.jsx)(n,{className:`h-3.5 w-3.5 animate-spin`}):(0,v.jsx)(re,{className:`h-3.5 w-3.5`}),(0,v.jsx)(`span`,{className:`sr-only`,children:`Refresh permission status`})]})}),children:(0,v.jsx)(`div`,{className:`flex items-center gap-3`,children:!C&&S?.granted?(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(t,{className:`h-4 w-4 text-green-500`}),(0,v.jsx)(`span`,{className:r(d.body,`text-green-600 dark:text-green-400`),children:`Permission granted`})]}):C?null:(0,v.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(c,{className:`h-4 w-4 text-amber-500`}),(0,v.jsx)(`span`,{className:r(d.body,`text-amber-600 dark:text-amber-400`),children:`Permission not granted`})]}),(0,v.jsx)(`p`,{className:d.bodyMuted,children:S?.message??`Tarsk needs Screen & System Audio Recording permission to use browser tools.`}),(0,v.jsx)(l,{size:`sm`,onClick:()=>void ze(),disabled:De,className:`w-fit`,children:De?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(n,{className:`h-4 w-4 mr-2 animate-spin`}),`Opening Settings...`]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o,{className:`h-4 w-4 mr-2`}),`Open System Settings`]})}),w&&(0,v.jsxs)(`div`,{className:`flex items-start gap-2 p-3 rounded-md bg-destructive/10 text-destructive`,children:[(0,v.jsx)(ie,{className:`h-4 w-4 mt-0.5 flex-shrink-0`}),(0,v.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,v.jsx)(`p`,{className:d.body,children:`Failed to open System Settings`}),(0,v.jsx)(`p`,{className:d.bodyMuted,children:w}),(0,v.jsxs)(`p`,{className:d.bodyMuted,children:[`Please open it manually:`,` `,(0,v.jsx)(`strong`,{children:`System Settings > Privacy & Security > Screen & System Audio Recording`})]})]})]})]})})}),i[81]=De,i[82]=C,i[83]=ze,i[84]=Fe,i[85]=w,i[86]=S?.granted,i[87]=S?.isMacOS,i[88]=S?.message,i[89]=Ct):Ct=i[89];let wt,Tt;i[90]===Symbol.for(`react.memo_cache_sentinel`)?(wt=(0,v.jsx)(ue,{title:`Mobile & Network Access`,className:`mb-1`}),Tt=(0,v.jsx)(`p`,{className:r(d.bodyMuted,`mb-3`),children:`Allow the Tarsk mobile app or other web browsers to access Tarsk on the wifi network.`}),i[90]=wt,i[91]=Tt):(wt=i[90],Tt=i[91]);let Et=Be||Ve,Dt;i[92]===He?Dt=i[93]:(Dt=e=>{(e===`local`||e===`network`)&&He(e)},i[92]=He,i[93]=Dt);let Ot;i[94]===Symbol.for(`react.memo_cache_sentinel`)?(Ot=Ae.map(Le),i[94]=Ot):Ot=i[94];let Z;i[95]!==D||i[96]!==Et||i[97]!==Dt?(Z=(0,v.jsx)(ae,{type:`single`,value:D,disabled:Et,onValueChange:Dt,"aria-label":`Server bind mode`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:Ot}),i[95]=D,i[96]=Et,i[97]=Dt,i[98]=Z):Z=i[98];let kt;i[99]!==T||i[100]!==E||i[101]!==D?(kt=D===`network`&&E.length>0&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`p`,{className:`${d.bodyMuted} mt-3`,children:[`Available on the network at:`,` `,(0,v.jsxs)(`span`,{className:d.mono,children:[`http://`,E[0],`:`,Ne]})]}),T&&(0,v.jsx)(`p`,{className:`${d.bodyMuted} mt-1`,children:`You will need to restart for this setting to take effect.`})]}),i[99]=T,i[100]=E,i[101]=D,i[102]=kt):kt=i[102];let At;i[103]!==E||i[104]!==D?(At=D===`network`&&E.length===0&&(0,v.jsx)(`p`,{className:`${d.bodyMuted} mt-3`,children:`No network IP addresses were detected on this computer.`}),i[103]=E,i[104]=D,i[105]=At):At=i[105];let jt;i[106]!==T||i[107]!==D?(jt=T&&D===`local`&&(0,v.jsxs)(`p`,{className:`${d.bodyMuted} mt-3`,children:[(0,v.jsx)(`br`,{}),`You will need to restart for this setting to take effect.`]}),i[106]=T,i[107]=D,i[108]=jt):jt=i[108];let Mt;i[109]!==Z||i[110]!==kt||i[111]!==At||i[112]!==jt?(Mt=(0,v.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[wt,Tt,Z,kt,At,jt]}),i[109]=Z,i[110]=kt,i[111]=At,i[112]=jt,i[113]=Mt):Mt=i[113];let Nt;i[114]!==E||i[115]!==D?(Nt=D===`network`&&E.length>0&&(0,v.jsxs)(`div`,{className:`hidden md:flex flex-col items-center gap-2 flex-shrink-0`,children:[(0,v.jsx)(le,{value:`http://${E[0]}:${Ne}`,size:128,bgColor:`hsl(var(--background))`,fgColor:`hsl(var(--foreground))`,level:`M`}),(0,v.jsx)(`p`,{className:`${d.compact} text-muted-foreground text-center`,children:`Scan with the Tarsk Mobile App`})]}),i[114]=E,i[115]=D,i[116]=Nt):Nt=i[116];let Pt;i[117]!==Mt||i[118]!==Nt?(Pt=(0,v.jsxs)(`div`,{className:`flex items-start gap-6`,children:[Mt,Nt]}),i[117]=Mt,i[118]=Nt,i[119]=Pt):Pt=i[119];let Ft=O?`yes`:`no`,It;i[120]===et?It=i[121]:(It=e=>{(e===`yes`||e===`no`)&&et(e===`yes`)},i[120]=et,i[121]=It);let Lt=Qe||$e,Rt;i[122]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=Me.map(Ie),i[122]=Rt):Rt=i[122];let zt;i[123]!==Ft||i[124]!==It||i[125]!==Lt?(zt=(0,v.jsx)(ae,{type:`single`,value:Ft,onValueChange:It,disabled:Lt,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,"aria-label":`Better Stack logging`,children:Rt}),i[123]=Ft,i[124]=It,i[125]=Lt,i[126]=zt):zt=i[126];let Bt;i[127]!==Ze||i[128]!==O||i[129]!==k?(Bt=O&&k&&Ze&&(0,v.jsxs)(`p`,{className:`${d.bodyMuted} mt-3`,children:[`Ingesting host:`,` `,(0,v.jsx)(`span`,{className:d.mono,children:Ze})]}),i[127]=Ze,i[128]=O,i[129]=k,i[130]=Bt):Bt=i[130];let Vt;i[131]!==O||i[132]!==k?(Vt=O&&!k&&(0,v.jsxs)(`p`,{className:`${d.bodyMuted} mt-3`,children:[`Logging requires the`,` `,(0,v.jsx)(`span`,{className:d.mono,children:`BETTERSTACK_SOURCE_TOKEN`}),` and`,` `,(0,v.jsx)(`span`,{className:d.mono,children:`BETTERSTACK_INGESTING_HOST`}),` environment variables to be set. Restart Tarsk after configuring them.`]}),i[131]=O,i[132]=k,i[133]=Vt):Vt=i[133];let Q;i[134]!==zt||i[135]!==Bt||i[136]!==Vt?(Q=(0,v.jsxs)(g,{title:`Logging`,description:`Send application logs to Better Stack for remote monitoring and debugging.`,children:[zt,Bt,Vt]}),i[134]=zt,i[135]=Bt,i[136]=Vt,i[137]=Q):Q=i[137];let $;i[138]!==B||i[139]!==H||i[140]!==K||i[141]!==J||i[142]!==X||i[143]!==Ct||i[144]!==Pt||i[145]!==Q?($=(0,v.jsxs)(`div`,{className:`space-y-8`,children:[B,H,K,J,X,Ct,Pt,Q]}),i[138]=B,i[139]=H,i[140]=K,i[141]=J,i[142]=X,i[143]=Ct,i[144]=Pt,i[145]=Q,i[146]=$):$=i[146];let Ht;return i[147]!==$||i[148]!==j?(Ht=(0,v.jsx)(de,{children:(0,v.jsxs)(fe,{children:[j,$]})}),i[147]=$,i[148]=j,i[149]=Ht):Ht=i[149],Ht}function Ie(e){return(0,v.jsx)(f,{value:e.value,"aria-label":e.label,className:`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm dark:data-[state=on]:bg-background dark:data-[state=on]:text-foreground`,children:e.label},e.value)}function Le(e){return(0,v.jsx)(f,{value:e.value,"aria-label":e.label,className:`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm dark:data-[state=on]:bg-background dark:data-[state=on]:text-foreground`,children:e.label},e.value)}function Re(e){return(0,v.jsx)(f,{value:e.value,"aria-label":e.label,className:`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm dark:data-[state=on]:bg-background dark:data-[state=on]:text-foreground`,children:e.label},e.value)}export{Fe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ba as t,Ii as n,
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ba as t,Ii as n,Is as r,Ns as i,Pi as a,Rt as o,fs as s,wn as c}from"./dialogs-config-DAMqiy-4.js";import{E as l,S as u,T as d,w as f}from"./history-view-lvvTzW7O.js";import{B as p,H as m,W as h}from"./index-C_iiobDl.js";var g=e(r(),1),_=i();function v(){let e=h(e=>e.selectedThreadId),[r,i]=(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=>i(e.content)).catch(()=>i(``)).finally(()=>y(!1)))},[e]);async function S(){if(e){x(!0);try{await c(e,`AGENTS.md`,r),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)(a,{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:r,onChange:e=>i(e.target.value),className:n(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{Ii as e,
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{Ii as e,Is as t,Ns as n,Ps as r,Zr as i,fa as a,fs as o}from"./dialogs-config-DAMqiy-4.js";import{I as s}from"./history-view-lvvTzW7O.js";import"./skeleton-rEPpLCqo.js";var c=r(),l=n();t();var u=s(e=>(0,l.jsxs)(`div`,{className:`text-center py-12 border border-dashed rounded-lg mb-8`,children:[e.v0,(0,l.jsx)(`h3`,{className:e.v1,children:e.v2}),(0,l.jsx)(`p`,{className:e.v3,children:e.v4})]}),{name:`InstalledEmptyState_1`,portals:[`v0`,`v2`,`v4`]}),d=function(t){let n=(0,c.c)(8),{icon:r,title:i,description:a}=t,s;n[0]===r?s=n[1]:(s=(0,l.jsx)(r,{className:`mx-auto h-10 w-10 text-muted-foreground/50 mb-3`}),n[0]=r,n[1]=s);let d;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=e(o.emptyStateTitle,`mb-1`),n[2]=d):d=n[2];let f;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=e(o.bodyMuted,`mb-3`),n[3]=f):f=n[3];let p;return n[4]!==a||n[5]!==s||n[6]!==i?(p=(0,l.jsx)(u,{v0:s,v1:d,v2:i,v3:f,v4:a}),n[4]=a,n[5]=s,n[6]=i,n[7]=p):p=n[7],p};function f(t){let n=(0,c.c)(12),{placeholder:r,value:o,onChange:s,className:u}=t,d=u??`mb-4`,f;n[0]===d?f=n[1]:(f=e(`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(t){let n=(0,c.c)(3),{searchQuery:r,emptyLabel:i}=t,a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=e(o.bodyMuted,`text-center py-8`),n[0]=a):a=n[0];let s=r.trim()?`No results for "${r}"`:i,u;return n[1]===s?u=n[2]:(u=(0,l.jsx)(`p`,{className:a,children:s}),n[1]=s,n[2]=u),u}function g(t){let n=(0,c.c)(3),{message:r}=t,i;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=e(o.bodyMuted,`text-center py-8`),n[0]=i):i=n[0];let a;return n[1]===r?a=n[2]:(a=(0,l.jsx)(`p`,{className:i,children:r}),n[1]=r,n[2]=a),a}export{p as a,f as i,m as n,g as o,h as r,d as t};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$i as t,Br as n,Ii as r,Is as i,Ki as a,Lr as o,M as s,Ns as c,Pi as l,Ps as u,Qr as d,Rr 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-DAMqiy-4.js";import{A as ee,C as S,D as te,E as C,F as w,M as T,N as E,O as D,P as O,S as ne,T as k,b as A,d as j,f as M,g as N,h as P,j as F,k as I,p as L,y as R}from"./history-view-lvvTzW7O.js";import{B as z,H as B,L as V,P as re,W as H}from"./index-C_iiobDl.js";import{t as U}from"./skeleton-rEPpLCqo.js";import{i as W,n as G,r as ie,t as ae}from"./tabs-D57g7ER1.js";import{i as oe,n as se,r as ce,t as K}from"./settings-list-BapKAJV3.js";import{t as le}from"./mcp-server-card-DPMxJJU6.js";var q=u(),J=e(i(),1);function ue(e){let[t,n]=(0,J.useState)([]),[r,i]=(0,J.useState)(!1),a=(0,J.useCallback)(async()=>{if(e){i(!0);try{let t=await y(e);n(Object.entries(t.servers??{}).map(([e,t])=>({name:e,config:t})))}catch{n([])}finally{i(!1)}}},[e]);return(0,J.useEffect)(()=>{a()},[a]),{installedServers:t,loadingConfig:r,loadInstalledServers:a}}function de(){let e=(0,q.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,J.useState)(t),i,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{h().then(r).catch(()=>r([]))},a=[],e[1]=i,e[2]=a):(i=e[1],a=e[2]),(0,J.useEffect)(i,a);let o;return e[3]===n?o=e[4]:(o={popularServers:n},e[3]=n,e[4]=o),o}async function Y(e,t,n){await g(e,t,n)}async function fe(e,t){await s(e,t)}var X=c();function Z(e){return e?.url?`remote`:`local`}function pe(e){return Object.entries(e??{}).map(([e,t])=>({key:e,value:t}))}function Q({projectPath:e,serverName:t,initialName:n,initialConfig:r,onBack:i}){let{installedServers:o}=ue(e),s=!!t,[c,u]=(0,J.useState)(`local`),[d,f]=(0,J.useState)(``),[h,g]=(0,J.useState)(``),[_,y]=(0,J.useState)(``),[b,x]=(0,J.useState)(``),[ee,S]=(0,J.useState)(`sse`),[C,w]=(0,J.useState)([]),[T,E]=(0,J.useState)([]),[D,O]=(0,J.useState)(!1),[k,F]=(0,J.useState)(!1),[I,V]=(0,J.useState)(null),[re,H]=(0,J.useState)(s),[U,oe]=(0,J.useState)(``),[se,ce]=(0,J.useState)(``);function K(e,t){let n=Z(t);u(n),f(e),g(t.command??``),y((t.args??[]).join(`
|
|
2
|
+
`)),x(t.url??``),S(t.transport??`sse`),w(pe(t.env)),E(pe(t.headers)),oe(e),ce(JSON.stringify({name:e,type:n,config:t}))}(0,J.useEffect)(()=>{if(s&&t){let e=o.find(e=>e.name===t);e&&(K(e.name,e.config),H(!1))}else r&&K(n??``,r),H(!1)},[o,t,s,r,n]);let le=(0,J.useCallback)(()=>{w(e=>[...e,{key:``,value:``}])},[]),q=(0,J.useCallback)(e=>{w(t=>t.filter((t,n)=>n!==e))},[]),de=(0,J.useCallback)((e,t)=>{w(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),Q=(0,J.useCallback)((e,t)=>{w(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]),$=(0,J.useCallback)(()=>{E(e=>[...e,{key:``,value:``}])},[]),me=(0,J.useCallback)(e=>{E(t=>t.filter((t,n)=>n!==e))},[]),he=(0,J.useCallback)((e,t)=>{E(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),ge=(0,J.useCallback)((e,t)=>{E(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(C);if(c===`remote`){let t=_e(T);return{url:b.trim(),transport:ee,...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}O(!0);try{if(!e)throw Error(`No project path`);await Y(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{O(!1)}},xe=async()=>{if(e){F(!0);try{await fe(e,U),z({title:`Success`,description:`MCP server removed`}),i()}catch(e){V(e instanceof Error?e.message:`Failed to delete server`)}finally{F(!1)}}},Se=s?ye!==se:d.trim()!==``||h.trim()!==``||_.trim()!==``||b.trim()!==``||C.length>0||T.length>0;return re?(0,X.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,X.jsx)(`p`,{className:v.bodyMuted,children:`Loading server configuration...`})}):(0,X.jsx)(te,{children:(0,X.jsxs)(R,{children:[(0,X.jsx)(ne,{title:s?d:`Add MCP Server`,description:s?`Edit MCP Server configuration.`:`Configure a new MCP Server.`}),(0,X.jsxs)(`div`,{className:`space-y-6`,children:[(0,X.jsx)(A,{title:`Server name`,description:s?`Server name cannot be changed`:void 0,children:(0,X.jsx)(m,{id:`server-name`,placeholder:`e.g. filesystem`,value:d,onChange:e=>f(e.target.value),disabled:s})}),(0,X.jsxs)(ae,{value:c,onValueChange:e=>u(e),className:`w-full`,children:[(0,X.jsxs)(ie,{className:`grid w-full grid-cols-2`,children:[(0,X.jsx)(W,{value:`local`,children:`Local (stdio)`}),(0,X.jsx)(W,{value:`remote`,children:`Remote (HTTP/SSE)`})]}),(0,X.jsxs)(G,{value:`local`,className:`space-y-6 mt-6`,children:[(0,X.jsx)(A,{title:`Command`,children:(0,X.jsx)(m,{id:`server-command`,placeholder:`e.g. npx`,value:h,onChange:e=>g(e.target.value)})}),(0,X.jsx)(A,{title:`Arguments`,description:`One argument per line`,children:(0,X.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,X.jsxs)(G,{value:`remote`,className:`space-y-6 mt-6`,children:[(0,X.jsx)(A,{title:`Server URL`,description:`Paste the MCP endpoint URL from your provider.`,children:(0,X.jsx)(m,{id:`server-url`,placeholder:`https://example.com/mcp`,value:b,onChange:e=>x(e.target.value),className:`font-mono`})}),(0,X.jsx)(A,{title:`Transport`,children:(0,X.jsxs)(j,{value:ee,onValueChange:e=>S(e),children:[(0,X.jsx)(P,{children:(0,X.jsx)(N,{})}),(0,X.jsxs)(M,{children:[(0,X.jsx)(L,{value:`sse`,children:`SSE (Server-Sent Events)`}),(0,X.jsx)(L,{value:`streamableHttp`,children:`Streamable HTTP`})]})]})}),(0,X.jsx)(A,{title:`HTTP headers`,description:`Optional headers for authentication.`,action:(0,X.jsxs)(l,{variant:`ghost`,size:`sm`,onClick:$,children:[(0,X.jsx)(p,{className:`h-3 w-3 mr-1`}),`Add header`]}),children:T.length===0?(0,X.jsx)(`p`,{className:v.caption,children:`No headers configured`}):(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:T.map((e,t)=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(m,{placeholder:`Authorization`,value:e.key,onChange:e=>he(t,e.target.value),className:`font-mono w-[35%]`}),(0,X.jsx)(m,{placeholder:`Bearer ...`,value:e.value,onChange:e=>ge(t,e.target.value),className:`font-mono flex-1`}),(0,X.jsx)(l,{variant:`ghost`,size:`icon`,onClick:()=>me(t),className:`h-9 w-9 flex-shrink-0`,children:(0,X.jsx)(a,{className:`h-3.5 w-3.5`})})]},t))})})]})]}),(0,X.jsx)(A,{title:`Environment variables`,description:c===`remote`?`Optional metadata for local tooling.`:void 0,action:(0,X.jsxs)(l,{variant:`ghost`,size:`sm`,onClick:le,children:[(0,X.jsx)(p,{className:`h-3 w-3 mr-1`}),`Add variable`]}),children:C.length===0?(0,X.jsx)(`p`,{className:v.caption,children:`No environment variables configured`}):(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:C.map((e,t)=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(m,{placeholder:`KEY`,value:e.key,onChange:e=>de(t,e.target.value),className:`font-mono w-[35%]`}),(0,X.jsx)(m,{placeholder:`value`,value:e.value,onChange:e=>Q(t,e.target.value),className:`font-mono flex-1`}),(0,X.jsx)(l,{variant:`ghost`,size:`icon`,onClick:()=>q(t),className:`h-9 w-9 flex-shrink-0`,children:(0,X.jsx)(a,{className:`h-3.5 w-3.5`})})]},t))})}),I&&(0,X.jsx)(`p`,{className:v.error,children:I}),(0,X.jsxs)(`div`,{className:`border-t pt-4 flex items-center justify-between`,children:[s&&(0,X.jsx)(l,{variant:`destructive`,onClick:xe,disabled:k||D,children:k?`Removing...`:`Remove`}),!s&&(0,X.jsx)(`div`,{}),(0,X.jsx)(l,{onClick:be,disabled:D||k||!Se,children:D?s?`Saving...`:`Adding...`:s?`Save`:`Add`})]})]})]})})}function $(e){return e.name.toLowerCase().replace(/\s+/g,`-`)}function me(e){return e.url?e.url:`${e.command??``} ${e.args?.join(` `)??``}`.trim()}function he(){let e=H(e=>e.selectedProjectId),i=H(e=>e.projects).find(t=>t.projectId===e)?.projectPath,{installedServers:a,loadingConfig:s,loadInstalledServers:c}=ue(i),{popularServers:u}=de(),{setActiveMainTab:p}=V(),{setPendingExplorerPath:m,triggerExplorerRefresh:h}=re(),[g,y]=(0,J.useState)(!1),[A,j]=(0,J.useState)(null),[M,N]=(0,J.useState)(null),[P,L]=(0,J.useState)(null),[R,B]=(0,J.useState)(!1),[W,G]=(0,J.useState)(``),ie=(0,J.useCallback)(async e=>{if(i){B(!0);try{await fe(i,e),await c(),h(),z({title:`MCP server removed`,description:e}),L(null)}catch(e){z({title:`Error`,description:e instanceof Error?e.message:`Failed to remove server`,variant:`destructive`})}finally{B(!1)}}},[i,c,h]),ae=(0,J.useCallback)(()=>{m(`.agents/mcp.json`),p(`explorer`)},[m,p]),q=(0,J.useCallback)(async e=>{if(!i)return;let t=$(e);if(!a.some(n=>n.name===t||n.name===e.id)){if(e.url!==void 0){if(!e.url.trim()){j({name:t,config:{url:``,transport:e.transport??`sse`,...Object.keys(e.env??{}).length>0?{env:e.env}:{}}}),y(!0);return}try{await Y(i,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 Y(i,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`})}}},[i,a,c,h]),Z=W.trim()?u.filter(e=>e.name.toLowerCase().includes(W.toLowerCase())||e.description.toLowerCase().includes(W.toLowerCase())):u;return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(te,{children:(0,X.jsxs)(C,{children:[(0,X.jsx)(ne,{title:`MCP Servers`,description:`Manage Model Context Protocol servers for your project.`,action:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(l,{variant:`ghost`,onClick:ae,children:`Config`}),(0,X.jsx)(l,{onClick:()=>y(!0),children:`Add Server`})]})}),(0,X.jsx)(S,{title:`Installed`}),s?(0,X.jsxs)(`div`,{className:`space-y-3 mb-8`,children:[(0,X.jsx)(U,{className:`h-12 w-full`}),(0,X.jsx)(U,{className:`h-12 w-full`})]}):a.length===0?(0,X.jsx)(K,{icon:b,title:`No MCP servers installed`,description:`Add an MCP server to extend agent capabilities.`}):(0,X.jsx)(`div`,{className:`mb-8 overflow-hidden rounded-md border border-border`,children:a.map((e,i)=>(0,X.jsxs)(`div`,{className:r(`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`,i>0&&`border-t border-border`),children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>N(e.name),className:`min-w-0 text-left`,children:[(0,X.jsx)(`div`,{className:r(v.body,`truncate`),children:e.name}),(0,X.jsx)(`div`,{className:r(v.compact,`truncate text-muted-foreground font-mono`),children:me(e.config)})]}),(0,X.jsx)(`div`,{className:`shrink-0`}),(0,X.jsx)(x,{children:(0,X.jsxs)(o,{children:[(0,X.jsx)(n,{asChild:!0,children:(0,X.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:()=>L(e.name),"aria-label":`Delete ${e.name}`,children:(0,X.jsx)(t,{className:`h-4 w-4`})})}),(0,X.jsx)(f,{children:`Remove this MCP server from the project`})]})})]},e.name))}),(0,X.jsx)(S,{title:`Available`,className:`mb-0`}),(0,X.jsx)(oe,{placeholder:`Search available servers...`,value:W,onChange:G}),u.length===0?(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsx)(U,{className:`h-20 w-full`}),(0,X.jsx)(U,{className:`h-20 w-full`})]}):Z.length===0?(0,X.jsx)(ce,{searchQuery:W,emptyLabel:`No available servers found.`}):(0,X.jsx)(se,{children:Z.map(e=>{let t=$(e),n=a.some(n=>n.name===t||n.name===e.id);return(0,X.jsx)(le,{name:e.name,description:e.description,installed:n,onClick:()=>{n||q(e)},showInstalledControls:!1},e.id)})})]})}),(0,X.jsx)(d,{open:g,onOpenChange:e=>{y(e),e||j(null)},children:(0,X.jsx)(_,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,X.jsx)(Q,{projectPath:i,initialName:A?.name,initialConfig:A?.config,onBack:()=>{y(!1),j(null),c(),h()}})})}),(0,X.jsx)(d,{open:M!==null,onOpenChange:e=>{e||N(null)},children:(0,X.jsx)(_,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,X.jsx)(Q,{projectPath:i,serverName:M??void 0,onBack:()=>{N(null),c(),h()}})})}),(0,X.jsx)(D,{open:P!==null,onOpenChange:e=>!e&&L(null),children:(0,X.jsxs)(F,{children:[(0,X.jsxs)(O,{children:[(0,X.jsx)(w,{children:`Delete MCP Server`}),(0,X.jsxs)(T,{children:[`Are you sure you want to delete the server "`,P,`"? This action cannot be undone.`]})]}),(0,X.jsxs)(E,{children:[(0,X.jsx)(ee,{children:`Cancel`}),(0,X.jsx)(I,{onClick:()=>P&&void ie(P),disabled:R,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:R?`Deleting...`:`Delete`})]})]})})]}):(0,X.jsx)(k,{children:`Select a project to manage MCP servers.`})}export{he as SettingsMCPServersView,he as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ns as e,Ps as t}from"./dialogs-config-DAMqiy-4.js";import{D as n,E as r,S as i}from"./history-view-lvvTzW7O.js";import{t as a}from"./skeleton-rEPpLCqo.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-Dm63snYH.js → settings-models-view-ObE_ktqH.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,Ko as s,Li as c,Lr as l,Ms as u,Pi as d,Ps as f,Rr as p,So as m,U as h,V as g,W as _,Wo as v,fs as y,js as b,kt as x,ra as S,zr as C}from"./dialogs-config-sFb6rmoV.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-BaNsCvOG.js";import{a as N,n as P,u as F}from"./onboarding-BtDZI4KL.js";import{i as I,n as L,r as R,t as z}from"./tabs-BDis0z_E.js";import{t as B}from"./use-deferred-search-BqzgL9XK.js";import{t as V}from"./model-star-rating-BeaqZyyn.js";import{i as H,o as U}from"./settings-list-CKN-l-Ee.js";import{t as W}from"./settings-models-skeleton-bDHbKptW.js";var G=e(f(),1),K=u(),q=s(`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 _(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=b();function ne({providers:e,globalSearchQuery:t,providerSortOptions:i,setProviderSortOptions:s,filterAndSortModels:u,getModelDisplayName:f,onSaveStatus:h}){let g=k(Y(0),()=>X(e)),[_]=(0,G.useState)(g.allImageModels),[b,S]=(0,G.useState)(g.enabledImageModelIds);async function T(e,t){try{b[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])}))),h(`Model preferences saved successfully`)}catch(e){h(e instanceof Error?e.message:`Failed to save model changes`)}}async function E(e,t){let n=_[e],r=b[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=b[e.slug]||new Set,h=i[e.slug]||`alphabetical`,g=u(n,a,h);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(y.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)(l,{children:[(0,Z.jsx)(r,{asChild:!0,children:(0,Z.jsx)(d,{type:`button`,variant:h===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>s(t=>({...t,[e.slug]:`alphabetical`})),children:(0,Z.jsx)(v,{className:`h-4 w-4`})})}),(0,Z.jsx)(p,{children:`Sort A–Z`})]}),(0,Z.jsxs)(l,{children:[(0,Z.jsx)(r,{asChild:!0,children:(0,Z.jsx)(d,{type:`button`,variant:h===`price-low`||h===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>s(t=>({...t,[e.slug]:`price-low`})),children:(0,Z.jsx)(m,{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=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(y.label,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:f(t)})}),r&&(0,Z.jsx)(`span`,{className:o(y.compact,`text-muted-foreground whitespace-nowrap flex-shrink-0`),children:(r.prompt??0)===0&&(r.completion??0)===0?``:`$${c(r.prompt??0)} in | $${c(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),[u,f]=(0,G.useState)(`coding`),{query:_,setQuery:b,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 g(e,t),s(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await h(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:_,onChange:b}),(0,Z.jsxs)(z,{value:u,onValueChange:e=>{f(e),b(``)},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`,u=$(t,n,s);return u.length===0&&_?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`})]}),u.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:u.every(e=>n.has(e.id)),onCheckedChange:t=>Q(e.slug,t===!0)}),(0,Z.jsx)(`label`,{htmlFor:`select-all-${e.slug}`,className:o(y.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)(l,{children:[(0,Z.jsx)(r,{asChild:!0,children:(0,Z.jsx)(d,{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)(v,{className:`h-4 w-4`})})}),(0,Z.jsx)(p,{children:`Sort A–Z`})]}),(0,Z.jsxs)(l,{children:[(0,Z.jsx)(r,{asChild:!0,children:(0,Z.jsx)(d,{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)(m,{className:`h-4 w-4`})})}),(0,Z.jsx)(p,{children:`Sort by price`})]}),(0,Z.jsxs)(l,{children:[(0,Z.jsx)(r,{asChild:!0,children:(0,Z.jsx)(d,{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)(p,{children:`Sort by coding intelligence`})]})]})})]}),u.length===0?(0,Z.jsx)(U,{message:_?`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:u.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(y.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(y.compact,`text-muted-foreground whitespace-nowrap`),children:(i.prompt??0)===0&&(i.completion??0)===0?``:`$${c(i.prompt??0)} in | $${c(i.completion??0)} out`})]})]})]},t.id)})})})]},e.slug)})})}),(0,Z.jsx)(L,{value:`image`,children:u===`image`?(0,Z.jsx)(G.Suspense,{fallback:(0,Z.jsx)(ee,{className:`py-12`,size:`sm`}),children:(0,Z.jsx)(ne,{providers:n,globalSearchQuery:_,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)(d,{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,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};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$i as t,Br as n,Ct as r,Ii as i,Is as a,Lr as o,Ns as s,P as c,Pi as l,Ps as u,Qr as d,R as f,Rr as p,Zr as m,ei as ee,fs as h,nn as te,pa as ne,vt as re,wn as g,zr as _,zt as v}from"./dialogs-config-DAMqiy-4.js";import{n as y,t as b}from"./react-vendor-U9lUQswz.js";import{A as ie,C as x,D as S,E as ae,F as oe,M as se,N as ce,O as le,P as ue,S as C,T as w,b as T,j as de,k as fe,x as pe,y as E}from"./history-view-lvvTzW7O.js";import{B as D,H as O,L as me,P as he,W as k}from"./index-C_iiobDl.js";import{t as A}from"./skeleton-rEPpLCqo.js";import{t as ge}from"./use-deferred-search-Bi99md6l.js";import{i as j,n as M,r as N,t as P}from"./settings-list-BapKAJV3.js";import{t as F}from"./mcp-server-card-DPMxJJU6.js";import{i as I,n as L,r as R,t as _e}from"./slug-utils-DZ59sTAJ.js";var z=u(),B=e(a(),1),V=s(),H=B.forwardRef((e,t)=>{let n=(0,z.c)(10),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(`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,V.jsx)(y,{className:i(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`)}),n[5]=s):s=n[5];let c;return n[6]!==a||n[7]!==t||n[8]!==o?(c=(0,V.jsx)(b,{className:o,...a,ref:t,children:s}),n[6]=a,n[7]=t,n[8]=o,n[9]=c):c=n[9],c});H.displayName=b.displayName;function ve({threadId:e,onRuleCreated:t}){let[n,r]=(0,B.useState)(``),[a,o]=(0,B.useState)(``),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(!1),d=R(n),f=L(d),p=async()=>{if(!(!f||!e)){u(!0);try{let n=`---
|
|
2
|
+
description: ${a.trim()}
|
|
3
|
+
alwaysApply: ${s}
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Place your rule instructions here as markdown.
|
|
7
|
+
`;await g(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,V.jsx)(S,{children:(0,V.jsxs)(E,{children:[(0,V.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,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(T,{title:`Rule Name`,children:[(0,V.jsx)(m,{id:`ruleName`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Code Style Guide`,disabled:l}),n?(0,V.jsxs)(`p`,{className:i(h.caption,`mt-2`),children:[`File name: `,(0,V.jsxs)(`span`,{className:`font-mono`,children:[d||`...`,`.md`]})]}):null]}),(0,V.jsx)(T,{title:`Description`,children:(0,V.jsx)(O,{id:`ruleDescription`,value:a,onChange:e=>o(e.target.value),placeholder:`Describe when Tarsk should apply this rule...`,className:`resize-none min-h-[120px]`,disabled:l})}),(0,V.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,V.jsx)(H,{id:`alwaysApply`,checked:s,onCheckedChange:c,disabled:l})}),(0,V.jsx)(I,{onContinue:()=>void p(),disabled:!f||!a.trim(),creating:l})]})]})}):(0,V.jsx)(w,{title:`No thread selected`,children:`Please select a thread to add a rule.`})}function U(e){let t=[];for(let n of e)n.type===`file`&&n.path.startsWith(`.agents/rules/`)&&t.push(n),n.children&&n.children.length>0&&t.push(...U(n.children));return t}function W(){let e=k(e=>e.selectedProjectId),a=k(e=>e.selectedThreadId),{setActiveMainTab:s}=me(),{setPendingExplorerPath:u,triggerExplorerRefresh:m,setExplorerClearPath:y}=he(),[b,T]=(0,B.useState)([]),[E,O]=(0,B.useState)(!1),[I,L]=(0,B.useState)(!1),[R,z]=(0,B.useState)(null),[H,W]=(0,B.useState)(!1),[G,K]=(0,B.useState)([]),[q,J]=(0,B.useState)(new Set),{query:Y,setQuery:X,deferredQuery:Z}=ge(),Q=(0,B.useCallback)(async()=>{if(e){O(!0);try{let t=U(await r(e));if(a)try{let e=U(await v(a)),n=new Set(t.map(e=>e.path));for(let r of e)n.has(r.path)||t.push(r)}catch{}T(t),J(new Set(t.map(e=>e.path)))}catch{T([]),J(new Set)}finally{O(!1)}}},[e,a]);(0,B.useEffect)(()=>{Q()},[Q]),(0,B.useEffect)(()=>{re().then(K).catch(()=>K([]))},[]);let ye=(0,B.useCallback)(async t=>{if(!e)return;let n=t.name,r=t.path;W(!0);try{try{await c(e,r)}catch{if(a)await f(a,r);else throw Error(`No thread selected to delete from`)}y(r),m(),J(e=>{let t=new Set(e);return t.delete(r),t}),D({title:`Rule removed`,description:n}),z(null),await Q()}catch(e){D({title:`Error`,description:e instanceof Error?e.message:`Failed to remove rule`,variant:`destructive`})}finally{W(!1)}},[e,a,Q,m,y]),be=(0,B.useCallback)(e=>{u(e),s(`explorer`)},[u,s]),xe=(0,B.useCallback)(async e=>{let t=`.agents/rules/${e.name}.md`;if(!(!a||q.has(t)))try{e.gitHubRepo&&e.gitHubFolder?await te(a,e.gitHubRepo,e.gitHubFolder,`.agents/rules`):await g(a,t,[`---`,`description: ${e.description}`,`alwaysApply: ${e.alwaysApply??!1}`,`---`,``,e.content].join(`
|
|
8
|
+
`)),J(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`})}},[a,q,m,Q]),$=(0,B.useMemo)(()=>Z.trim()?G.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):G,[G,Z]);return e?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(S,{children:(0,V.jsxs)(ae,{children:[(0,V.jsx)(C,{title:`Rules`,description:`Manage agent rules. Rules define coding standards and project-wide guidelines.`,action:(0,V.jsx)(l,{onClick:()=>L(!0),disabled:!a,children:`Add Rule`})}),!a&&(0,V.jsx)(pe,{children:`Select a thread to add or install rules.`}),(0,V.jsx)(x,{title:`Installed`}),E?(0,V.jsxs)(`div`,{className:`space-y-3 mb-8`,children:[(0,V.jsx)(A,{className:`h-12 w-full`}),(0,V.jsx)(A,{className:`h-12 w-full`})]}):b.length===0?(0,V.jsx)(P,{icon:ne,title:`No rules installed`,description:`Add rules to enforce coding standards and project conventions.`}):(0,V.jsx)(`div`,{className:`mb-8 overflow-hidden rounded-md border border-border`,children:b.map((e,r)=>(0,V.jsxs)(`div`,{className:i(`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,V.jsx)(`button`,{type:`button`,onClick:()=>be(e.path),className:i(h.body,`truncate text-left`),children:e.name.replace(/\.mdc$/i,``)}),(0,V.jsx)(_,{children:(0,V.jsxs)(o,{children:[(0,V.jsx)(n,{asChild:!0,children:(0,V.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:()=>z(e),"aria-label":`Delete ${e.name.replace(/\.mdc$/i,``)}`,children:(0,V.jsx)(t,{className:`h-4 w-4`})})}),(0,V.jsx)(p,{children:`Remove this rule from the project`})]})})]},e.id))}),(0,V.jsx)(x,{title:`Available`,className:`mb-0`}),(0,V.jsx)(j,{placeholder:`Search available rules...`,value:Y,onChange:X}),G.length===0?(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(A,{className:`h-20 w-full`}),(0,V.jsx)(A,{className:`h-20 w-full`})]}):$.length===0?(0,V.jsx)(N,{searchQuery:Y,emptyLabel:`No available rules found.`}):(0,V.jsx)(M,{children:$.map(e=>{let t=`.agents/rules/${e.name}.md`,n=q.has(t);return(0,V.jsx)(F,{name:_e(e.name),description:e.description,installed:n,onClick:()=>{n||xe(e)},showInstalledControls:!1},e.id)})})]})}),(0,V.jsx)(d,{open:I,onOpenChange:L,children:(0,V.jsx)(ee,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,V.jsx)(ve,{threadId:a,onRuleCreated:()=>{L(!1),Q(),m()}})})}),(0,V.jsx)(le,{open:R!==null,onOpenChange:e=>!e&&z(null),children:(0,V.jsxs)(de,{children:[(0,V.jsxs)(ue,{children:[(0,V.jsx)(oe,{children:`Delete Rule`}),(0,V.jsxs)(se,{children:[`Are you sure you want to delete the rule "`,R?.name,`"? This action cannot be undone.`]})]}),(0,V.jsxs)(ce,{children:[(0,V.jsx)(ie,{children:`Cancel`}),(0,V.jsx)(fe,{onClick:()=>R&&void ye(R),disabled:H,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:H?`Deleting...`:`Delete`})]})]})})]}):(0,V.jsx)(w,{children:`Select a project to manage rules.`})}export{W as SettingsRulesView,W as default};
|
package/dist/public/assets/{settings-skills-view-DUq0nOrv.js → settings-skills-view-MZQjnD_g.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,Gn as s,Ii as c,Ir as l,
|
|
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,g]=(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([]),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;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(){g(!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||g(!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,D=s?X(s):!1,A=(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(O.caption,`truncate`),children:e})]},e)),[a,s]);return(0,J.jsx)(v,{open:e,onOpenChange:t,children:(0,J.jsxs)(E,{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)(k,{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(O.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(O.caption,`px-3 py-2 text-muted-foreground`),children:`No files found.`}):A})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-4`,children:_?(0,J.jsx)(`p`,{className:c(O.body,`text-destructive`),children:_}):T?(0,J.jsx)(H,{className:`py-12`,label:`Loading preview...`}):D?(0,J.jsx)(Me,{content:u,enableMermaid:!1}):(0,J.jsx)(`pre`,{className:c(O.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)(h,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,J.jsx)(h,{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=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),[m,h]=(0,q.useState)(!1),_;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(_=async()=>{try{r(await p())}catch{r([])}},e[2]=_):_=e[2];let v=_,y,b;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{(async function(){let e=z();if(e.length>0)try{await D(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),g(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,O;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>{r(t=>t.filter(t=>t.id!==e)),M(e),o(t=>t===e?(g(`default`),`default`):t)},e[8]=O):O=e[8];let k=O,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]!==m||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:m},e[12]=c,e[13]=d,e[14]=m,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,g]=(0,q.useState)(null),[_,y]=(0,q.useState)(!1),[b,x]=(0,q.useState)(!1),[S,w]=(0,q.useState)(!1),D=r!=null;function A(){d(``),p(``),g(null),y(!1),x(!1),w(!1)}function j(e){e||A(),t(e)}(0,q.useEffect)(()=>{if(e){if(r){d(r.title),p(r.url),g(null);return}d(``),p(``),g(null)}},[e,r]);async function M(){let e=u.trim(),t=f.trim();if(!e||!t){g(`Title and URL are required.`);return}y(!0),g(null);try{if(D&&r){let n=await s(r.id,e,t);a?.(n.source)}else i((await I(e,t)).source);j(!1)}catch(e){g(e instanceof Error?e.message:`Failed to verify skill source`)}finally{y(!1)}}async function P(){if(r){x(!0),g(null);try{await o(r.id),l?.(r.id),w(!1),j(!1)}catch(e){g(e instanceof Error?e.message:`Failed to delete skill source`),w(!1)}finally{x(!1)}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(v,{open:e,onOpenChange:j,children:(0,J.jsxs)(E,{className:`sm:max-w-lg`,children:[(0,J.jsxs)(te,{children:[(0,J.jsx)(k,{children:D?`Edit Skill Source`:`Add Skill Source`}),(0,J.jsx)(R,{children:D?`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)(C,{htmlFor:`skill-source-title`,children:`Title`}),(0,J.jsx)(T,{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)(C,{htmlFor:`skill-source-url`,children:`URL`}),(0,J.jsx)(T,{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(O.caption,`text-destructive`),children:m}):null]}),(0,J.jsxs)(N,{className:`flex-col-reverse gap-2 sm:flex-row sm:justify-between`,children:[D?(0,J.jsx)(h,{type:`button`,variant:`destructive`,onClick:()=>w(!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)(h,{variant:`outline`,onClick:()=>j(!1),disabled:_||b,children:`Cancel`}),(0,J.jsx)(h,{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...`]}):D?`Save Changes`:`Add Source`})]})]})]})}),(0,J.jsx)(he,{open:S,onOpenChange:w,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}=ke(),{setPendingExplorerPath:o,triggerExplorerRefresh:s,setExplorerClearPath:l}=je(),[d,f]=(0,q.useState)([]),[p,g]=(0,q.useState)(!1),[_,C]=(0,q.useState)(!1),[T,D]=(0,q.useState)(null),[k,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:Ae,removeSource:Me,catalogSkills:G,isLoadingCatalog:Be}=Je(),K=V==="default",Y=(0,q.useMemo)(()=>w(V)?B.find(e=>e.id===V)??null:null,[V,B]),X=(0,q.useCallback)(async()=>{if(e){g(!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{g(!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 m(e,i)}catch{if(n)await y(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}),D(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)(
|
|
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,Gn as s,Ii as c,Ir as l,Is as u,Lr as d,Mt as f,Ns as p,Nt as m,P as h,Pi as g,Pr as _,Ps as v,Qr as y,R as b,Rr 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-DAMqiy-4.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-lvvTzW7O.js";import{d as Oe}from"./onboarding-dys9Rwb5.js";import{B as U,H as ke,L as Ae,P as je,R as Me,W as Ne}from"./index-C_iiobDl.js";import{t as W}from"./skeleton-rEPpLCqo.js";import{t as Pe}from"./use-deferred-search-Bi99md6l.js";import{a as Fe,n as Ie,r as Le,t as Re}from"./settings-list-BapKAJV3.js";import{t as ze}from"./mcp-server-card-DPMxJJU6.js";import{i as G,n as Be,r as K,t as Ve}from"./slug-utils-DZ59sTAJ.js";var q=e(u(),1),J=p();function He({threadId:e,onSkillCreated:t}){let[n,r]=(0,q.useState)(``),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(!1),l=K(n),u=Be(l),d=async()=>{if(!(!u||!i.trim()||!e)){s(!0);try{let n=await j(e,l,i.trim());U({title:`Skill created`,description:`Skill '${l}' 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:c(k.caption,`mt-2`),children:[`Folder name: `,(0,J.jsx)(`span`,{className:`font-mono`,children:l||`...`})]}):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,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:()=>v(!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:c(`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:c(k.body,`truncate text-left`),children:e.name}),(0,J.jsx)(oe,{children:(0,J.jsxs)(d,{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)(x,{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)(d,{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)(x,{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)(y,{open:_,onOpenChange:v,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:()=>{v(!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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$i as t,Br as n,E as r,I as i,Ii as a,
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$i as t,Br as n,E as r,I as i,Ii as a,Is as o,Lr as s,Ns as c,Pi as l,Pt as u,Qr as d,Rr 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-DAMqiy-4.js";import{A as ee,C as x,D as S,E as te,F as ne,M as re,N as C,O as ie,P as ae,S as w,T,b as E,j as D,k as O,x as oe,y as k}from"./history-view-lvvTzW7O.js";import{B as A,L as j,P as M,W as N}from"./index-C_iiobDl.js";import{t as P}from"./skeleton-rEPpLCqo.js";import{n as F,t as I}from"./radio-group-C6EDTFov.js";import{i as se,n as ce,r as L,t as le}from"./settings-list-BapKAJV3.js";import{t as ue}from"./mcp-server-card-DPMxJJU6.js";import{i as R,n as z,r as B}from"./slug-utils-DZ59sTAJ.js";var V=e(o(),1),H=c();function de({projectId:e,threadId:t,onCommandCreated:n}){let[i,o]=(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.`}),o(``),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)(w,{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)(E,{title:`Command Name`,children:[(0,H.jsx)(m,{id:`commandName`,value:i,onChange:e=>o(e.target.value),placeholder:`e.g. review`,disabled:h}),i?(0,H.jsxs)(`p`,{className:a(_.caption,`mt-2`),children:[`Command: `,(0,H.jsxs)(`span`,{className:`font-mono`,children:[`/`,v||`...`]})]}):null]}),(0,H.jsx)(E,{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)(E,{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)(E,{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:a(_.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:a(_.labelNormal,`cursor-pointer`),children:`Plan`})]})]})}),(0,H.jsx)(R,{onContinue:()=>void b(),disabled:!y,creating:h})]})]})}):(0,H.jsx)(T,{title:`No project selected`,children:`Please select a project to add a slash command.`})}function U(){let e=N(e=>e.selectedProjectId),o=N(e=>e.selectedThreadId),{setActiveMainTab:c}=j(),{setPendingExplorerPath:p,triggerExplorerRefresh:m,setExplorerClearPath:E}=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(o){R(!0);try{let e=await u(o);F(e.filter(e=>!e.isBuiltIn)),X(new Map(e.map(e=>[e.name,e.filePath])))}catch{F([]),X(new Map)}finally{R(!1)}}},[o]);(0,V.useEffect)(()=>{Q()},[Q]),(0,V.useEffect)(()=>{h().then(J).catch(()=>J([]))},[]);let pe=(0,V.useCallback)(async e=>{K(!0);try{await i(e.filePath),E(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,E]),me=(0,V.useCallback)(e=>{p(e),c(`explorer`)},[p,c]),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(!(!o||Y.has(e.name)))try{if(e.gitHubRepo&&e.gitHubFolder){let t=`.agents/commands`;await v(o,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`,o);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`})}},[o,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)(w,{title:`Slash Commands`,description:`Manage slash commands. Commands are quick actions available via / in chat.`,action:(0,H.jsx)(l,{onClick:()=>B(!0),disabled:!o,children:`Add Command`})}),!o&&(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:a(`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:a(_.body,`truncate`),children:[`/`,e.name]}),(0,H.jsx)(`div`,{className:a(_.compact,`truncate text-muted-foreground`),children:he(e)})]}),e.metadata?.mode?(0,H.jsx)(`span`,{className:a(_.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)(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:()=>W(e),"aria-label":`Delete /${e.name}`,children:(0,H.jsx)(t,{className:`h-4 w-4`})})}),(0,H.jsx)(f,{children:`Remove this slash command from the project`})]})})]},e.filePath))}),(0,H.jsx)(x,{title:`Available`,className:`mb-0`}),(0,H.jsx)(se,{placeholder:`Search available commands...`,value:Z,onChange:fe}),q.length===0?(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(P,{className:`h-20 w-full`}),(0,H.jsx)(P,{className:`h-20 w-full`})]}):$.length===0?(0,H.jsx)(L,{searchQuery:Z,emptyLabel:`No available commands found.`}):(0,H.jsx)(ce,{children:$.map(e=>{let t=Y.has(e.name);return(0,H.jsx)(ue,{name:`/${e.name}`,description:e.description,installed:t,onClick:()=>{t||ge(e)},showInstalledControls:!1},e.id)})})]})}),(0,H.jsx)(d,{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:o,onCommandCreated:()=>{B(!1),Q(),m()}})})}),(0,H.jsx)(ie,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,H.jsxs)(D,{children:[(0,H.jsxs)(ae,{children:[(0,H.jsx)(ne,{children:`Delete Slash Command`}),(0,H.jsxs)(re,{children:[`Are you sure you want to delete "/`,U?.name,`"? This action cannot be undone.`]})]}),(0,H.jsxs)(C,{children:[(0,H.jsx)(ee,{children:`Cancel`}),(0,H.jsx)(O,{onClick:()=>U&&void pe(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,H.jsx)(T,{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,Ii as i,Is as a,Ji as o,Lr as s,Ns as c,O as l,P as u,Pi as d,Qr as f,R as p,Rr as m,Zr as h,ei as ee,fs as g,gt as te,nn as ne,wn as re,zr as _,zt as v}from"./dialogs-config-DAMqiy-4.js";import{A as ie,C as y,D as b,E as ae,F as oe,M as se,N as ce,O as le,P as ue,S as x,T as S,b as C,j as de,k as w,x as T,y as E}from"./history-view-lvvTzW7O.js";import{B as D,H as O,L as fe,P as pe,W as k}from"./index-C_iiobDl.js";import{t as A}from"./skeleton-rEPpLCqo.js";import{i as j,n as M,r as N,t as P}from"./settings-list-BapKAJV3.js";import{t as F}from"./mcp-server-card-DPMxJJU6.js";import{i as I,n as L,r as R}from"./slug-utils-DZ59sTAJ.js";var z=e(a(),1),B=c();function me({threadId:e,onAgentCreated:t}){let[n,r]=(0,z.useState)(``),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(``),[u,d]=(0,z.useState)(!1),f=R(n),p=L(f),m=async()=>{if(!(!p||!a.trim()||!e)){d(!0);try{let n=await l(e,f,a.trim(),s.trim()||void 0);D({title:`Agent created`,description:`Agent '${f}' was created successfully.`}),r(``),o(``),c(``),t?.(n.path,`AGENTS.md`)}catch(e){D({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)(E,{children:[(0,B.jsx)(x,{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)(C,{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:i(g.caption,`mt-2`),children:[`Folder name: `,(0,B.jsx)(`span`,{className:`font-mono`,children:f||`...`})]}):null]}),(0,B.jsx)(C,{title:`Description`,children:(0,B.jsx)(O,{id:`agentDescription`,value:a,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)(C,{title:`Tools`,description:`Optional space-separated list of tools this agent can use`,children:(0,B.jsx)(h,{id:`agentTools`,value:s,onChange:e=>c(e.target.value),placeholder:`e.g. read grep glob`,disabled:u})}),(0,B.jsx)(I,{onContinue:()=>void m(),disabled:!p||!a.trim(),creating:u})]})]})}):(0,B.jsx)(S,{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=k(e=>e.selectedProjectId),a=k(e=>e.selectedThreadId),{setActiveMainTab:c}=fe(),{setPendingExplorerPath:l,triggerExplorerRefresh:h,setExplorerClearPath:C}=pe(),[E,O]=(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(a)try{let e=V(await v(a)),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)),O(t),X(new Set(t.map(e=>`${e.path}/AGENT.md`)))}catch{O([]),X(new Set)}finally{L(!1)}}},[e,a]);(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 u(e,r)}catch{if(a)await p(a,r);else throw Error(`No thread selected to delete from`)}C(r),h(),X(e=>{let t=new Set(e);return t.delete(`${r}/AGENT.md`),t}),D({title:`Agent removed`,description:n}),W(null),await Q()}catch(e){D({title:`Error`,description:e instanceof Error?e.message:`Failed to remove agent`,variant:`destructive`})}finally{K(!1)}},[e,a,Q,h,C]),_e=(0,z.useCallback)(e=>{l(`${e}/AGENT.md`),c(`explorer`)},[l,c]),ve=(0,z.useCallback)(async e=>{let t=`.agents/agents/${e.id}/AGENT.md`;if(!(!a||Y.has(t)))try{if(e.gitHubRepo&&e.gitHubFolder)await ne(a,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(a,t,n.join(`
|
|
2
|
+
`))}X(e=>new Set(e).add(t)),h(),Q(),D({title:`Agent installed`,description:e.name})}catch(e){D({title:`Error`,description:e instanceof Error?e.message:`Failed to install agent`,variant:`destructive`})}},[a,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)(x,{title:`Subagents`,description:`Manage subagents. Subagents are specialized agents for focused tasks.`,action:(0,B.jsx)(d,{onClick:()=>H(!0),disabled:!a,children:`Add Subagent`})}),!a&&(0,B.jsx)(T,{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)(A,{className:`h-12 w-full`}),(0,B.jsx)(A,{className:`h-12 w-full`})]}):E.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:E.map((e,r)=>(0,B.jsxs)(`div`,{className:i(`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:i(g.body,`truncate text-left`),children:e.name}),(0,B.jsx)(_,{children:(0,B.jsxs)(s,{children:[(0,B.jsx)(n,{asChild:!0,children:(0,B.jsx)(d,{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)(m,{children:`Remove this subagent from the project`})]})})]},e.id))}),(0,B.jsx)(y,{title:`Available`,className:`mb-0`}),(0,B.jsx)(j,{placeholder:`Search available subagents...`,value:Z,onChange:he}),q.length===0?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(A,{className:`h-20 w-full`}),(0,B.jsx)(A,{className:`h-20 w-full`})]}):$.length===0?(0,B.jsx)(N,{searchQuery:Z,emptyLabel:`No available subagents found.`}):(0,B.jsx)(M,{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)(f,{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:a,onAgentCreated:()=>{H(!1),Q(),h()}})})}),(0,B.jsx)(le,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,B.jsxs)(de,{children:[(0,B.jsxs)(ue,{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)(ce,{children:[(0,B.jsx)(ie,{children:`Cancel`}),(0,B.jsx)(w,{onClick:()=>U&&void ge(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,B.jsx)(S,{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,Ii as i,
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ba as t,Bn as n,Et as r,Ii as i,Is as a,Ns as o,Pi as s,Yr as c,fs as l,rn as u}from"./dialogs-config-DAMqiy-4.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-lvvTzW7O.js";import{a as C}from"./onboarding-dys9Rwb5.js";import{B as w,H as T,W as E}from"./index-C_iiobDl.js";var D=e(a(),1),O=o();function k(){let e=E(e=>e.selectedProjectId),[a,o]=(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;o(e.generatedPrompt),P(t),I(e.customSystemPrompt),M(!t),A(t?e.customSystemPrompt:e.generatedPrompt)}).catch(()=>{o(``),A(``),M(!0),P(!1),I(``)}).finally(()=>R(!1)))},[e]);function U(){return j?N:k.trim()!==F.trim()}function W(e){A(e),j&&M(!1)}function G(){A(a),M(!0)}function K(e){if(!e){M(!1);return}if(k===a){G();return}H(!0)}function q(){G(),H(!1)}function J(){H(!1)}async function Y(){if(e){if(!j&&!k.trim()){w({title:`System prompt required`,description:`Enter a system prompt or enable Generated.`,variant:`destructive`});return}B(!0);try{await 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)(s,{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:i(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:i(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,Ji as r,Ka as i,Ko as a,Lo as o,Ms as s,Pi as c,Ps as l,Yi as u,aa as d,ca as f,ds as p,eo as m,fs as h,hn as g,js 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-sFb6rmoV.js";import{Ft as te,It as ne,Pt as T}from"./react-vendor-G5EdW8A3.js";import{r as E}from"./monaco-CZnIWXyV.js";import{D,E as O,T as k}from"./history-view-BaNsCvOG.js";import{d as A,l as j}from"./onboarding-BtDZI4KL.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-BabXMhGR.js";import{t as R}from"./settings-models-skeleton-bDHbKptW.js";var z=s(),B=e(l(),1),V=_(),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)(o,{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)(r,{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)(d,{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)(f,{className:`h-4 w-4`}),route:`/settings/general`},{id:`history`,label:`History`,icon:(0,V.jsx)(i,{className:`h-4 w-4`}),route:`/settings/history`},{id:`account`,label:`Account`,icon:(0,V.jsx)(u,{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)(m,{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=a(`app.settings-view.ui`),ue=(0,B.lazy)(()=>E(()=>import(`./settings-general-view-BIpRxHjN.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),de=(0,B.lazy)(()=>E(()=>import(`./project-settings-view-nULqYl1Q.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-C_I7apJ0.js`),__vite__mapDeps([14,1,5,6,7,15,16,17,9,3,4,18]))),pe=(0,B.lazy)(()=>E(()=>import(`./settings-models-view-Dm63snYH.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-DThIXFIU.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-DUq0nOrv.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-C8EhiuF6.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-3UGw-rg7.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-DjY_-Vkl.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-DdZptx3T.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-C5zpTiRs.js`),__vite__mapDeps([30,1,2,3,4,5,6,7,8,9,10,11]))),xe=(0,B.lazy)(()=>E(()=>import(`./account-view-C5bYplbC.js`),__vite__mapDeps([31,1,2,3,4,5,6,7,8,9,10,11,16]))),Se=(0,B.lazy)(()=>E(()=>import(`./history-view-BaNsCvOG.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(),l=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,m;e[3]===o.pathname?m=e[4]:(m=Ee(o.pathname),e[3]=o.pathname,e[4]=m);let _=m!==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 g(),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]===l?G=e[18]:(G=l?{type:`project`,id:l}:void 0,e[17]=l,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]!==l?(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:l,onResetOnboarding:De,onNavItemSelect:ie})})}),e[29]=je,e[30]=ie,e[31]=l,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]!==_||e[49]!==w?(X=S&&!w&&!_?(0,V.jsx)(`div`,{className:n(p.settingsPage,`pb-0`),children:(0,V.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-center gap-2`,children:[(0,V.jsxs)(c,{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(h.sectionTitle,`truncate text-foreground`),children:j})]})}):null,e[46]=j,e[47]=S,e[48]=_,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-BHj9qn0K.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-C_iiobDl.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-lvvTzW7O.js","assets/dialogs-config-DAMqiy-4.js","assets/onboarding-dys9Rwb5.js","assets/vosk-speech-DC3I453R.js","assets/react-vendor-U9lUQswz.js","assets/utils-C-7eVelM.js","assets/index-DhnUeGIU.css","assets/project-settings-view-XGHhtLr_.js","assets/radio-group-C6EDTFov.js","assets/providers-list-view-Cbndeobz.js","assets/model-star-rating-C4Ugsik_.js","assets/skeleton-rEPpLCqo.js","assets/tabs-D57g7ER1.js","assets/use-deferred-search-Bi99md6l.js","assets/settings-models-view-ObE_ktqH.js","assets/settings-models-skeleton-B7TMwjxe.js","assets/settings-list-BapKAJV3.js","assets/settings-mcp-servers-view-M2DQPcpo.js","assets/mcp-server-card-DPMxJJU6.js","assets/settings-skills-view-MZQjnD_g.js","assets/slug-utils-DZ59sTAJ.js","assets/settings-rules-view-BhRBowk9.js","assets/settings-slash-commands-view-BYHthCEM.js","assets/settings-subagents-view-CmrFQcUF.js","assets/settings-instructions-view-CRUCeWUk.js","assets/settings-system-prompt-view-CZe9uYNN.js","assets/account-view-5qdPli2O.js"])))=>i.map(i=>d[i]);
|
|
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 +1 @@
|
|
|
1
|
-
import{Ii as e,
|
|
1
|
+
import{Ii as e,Ns as t,Ps as n}from"./dialogs-config-DAMqiy-4.js";var r=n(),i=t();function a(t){let n=(0,r.c)(8),a,o;n[0]===t?(a=n[1],o=n[2]):({className:a,...o}=t,n[0]=t,n[1]=a,n[2]=o);let s;n[3]===a?s=n[4]:(s=e(`animate-pulse rounded-md bg-muted`,a),n[3]=a,n[4]=s);let c;return n[5]!==o||n[6]!==s?(c=(0,i.jsx)(`div`,{className:s,...o}),n[5]=o,n[6]=s,n[7]=c):c=n[7],c}export{a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ba as e,
|
|
1
|
+
import{Ba as e,No as t,Ns as n,Pi as r,Ps as i}from"./dialogs-config-DAMqiy-4.js";var a=i(),o=n();function s(n){let i=(0,a.c)(6),{onContinue:s,disabled:c,creating:l}=n,u=c||l,d;i[0]===l?d=i[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)(t,{className:`ml-2 h-4 w-4`})]}),i[0]=l,i[1]=d);let f;return i[2]!==s||i[3]!==u||i[4]!==d?(f=(0,o.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,o.jsx)(r,{onClick:s,disabled:u,children:d})}),i[2]=s,i[3]=u,i[4]=d,i[5]=f):f=i[5],f}function c(e){return e.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``)}function l(e){return e.replace(/-/g,` `).split(/\s+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function u(e){return e.length>0&&e.length<=64}export{s as i,u as n,c as r,l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ii as t,
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ii as t,Is as n,Ns as r,Ps as i}from"./dialogs-config-DAMqiy-4.js";import{c as a,d as o,l as s,u as c}from"./react-vendor-U9lUQswz.js";var l=i(),u=e(n(),1),d=r(),f=c,p=u.forwardRef((e,n)=>{let r=(0,l.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=t(`inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground`,i),r[3]=i,r[4]=o);let c;return r[5]!==a||r[6]!==n||r[7]!==o?(c=(0,d.jsx)(s,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=c):c=r[8],c});p.displayName=s.displayName;var m=u.forwardRef((e,n)=>{let r=(0,l.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let s;r[3]===i?s=r[4]:(s=t(`inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-base font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm`,i),r[3]=i,r[4]=s);let c;return r[5]!==a||r[6]!==n||r[7]!==s?(c=(0,d.jsx)(o,{ref:n,className:s,...a}),r[5]=a,r[6]=n,r[7]=s,r[8]=c):c=r[8],c});m.displayName=o.displayName;var h=u.forwardRef((e,n)=>{let r=(0,l.c)(9),i,o;r[0]===e?(i=r[1],o=r[2]):({className:i,...o}=e,r[0]=e,r[1]=i,r[2]=o);let s;r[3]===i?s=r[4]:(s=t(`mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,i),r[3]=i,r[4]=s);let c;return r[5]!==o||r[6]!==n||r[7]!==s?(c=(0,d.jsx)(a,{ref:n,className:s,...o}),r[5]=o,r[6]=n,r[7]=s,r[8]=c):c=r[8],c});h.displayName=a.displayName;export{m as i,h as n,p as r,f as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialogs-config-DAMqiy-4.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,Ii as o,Is as s,Kn as c,Ko as l,Lr as u,Lt as d,Ns as f,Pi as p,Ps as m,Qr as h,Rr as g,Sa as ee,Xn as _,Yn as v,Zn as y,bo as te,c as ne,ei as re,er as b,fs as x,ii as ie,ni as S,ri as C,rn as w,tr as T,xt as E}from"./dialogs-config-DAMqiy-4.js";import{r as D}from"./monaco-CZnIWXyV.js";import{a as O,l as k,n as A,o as j,s as M}from"./history-view-lvvTzW7O.js";import{A as N,D as P,E as F,H as I,K as L,L as R,T as z,U as ae,W as B}from"./index-C_iiobDl.js";var V=e(s(),1),H=m();async function U(e){return y(`api/projects/${_(e)}/tasks`)}async function oe(e,t,n){return T(`api/projects/${_(e)}/tasks`,{description:t,threadId:n?.threadId,provider:n?.provider,model:n?.model})}async function W(e,t,n){return b(`api/projects/${_(e)}/tasks/${_(t)}`,n)}async function se(e,t){await v(`api/projects/${_(e)}/tasks/${_(t)}`)}function G(e,t){return`project-tasks:${e}:${t}`}function K(e){return e.status===`Done`?`Done`:e.working?`Working`:`Ready`}function q(e){return e.status!==`Done`&&!e.working}function ce(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 le(e){w(),M(`projects:bootstrap:`);let t=await i();e({type:L.SetProjects,projects:t.projects}),e({type:L.SetProjectsLoading,projectsLoading:!1})}async function J(e){let t=await U(e),n=t.filter(e=>e.threadId&&e.status!==`Done`),r=[...t];return await Promise.all(n.map(async t=>{try{await d(t.threadId)}catch(n){if(n instanceof Error&&n.message.includes(`not found`)){let n=await W(e,t.id,{status:`Done`}),i=r.findIndex(e=>e.id===t.id);i!==-1&&(r[i]=n)}}})),r}async function ue(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 de(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 Y=l(`app.task-agent-run.ui`);async function fe(e,t){let n=await d(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){Y.error(`Failed to get project threads:`,e)}return null}function X(e,t,n,r){e({type:L.SetProjectModel,threadId:t,model:{id:n,provider:r,name:n,description:``}}),c(t,{model:n,modelProvider:r})}async function pe(e,t,n,r,i,a){i||a(await W(e,t.id,{status:n,working:!0,threadId:r}))}var Z=f();function me({task:e,disabled:n=!1,onImplementInNewThread:r,onImplementInThisThread:i,onMarkDone:s}){let[c,l]=(0,V.useState)(!1),u=K(e),d=q(e),f=e.status!==`Done`,m=n||c||!d&&!f;async function h(e){l(!0);try{await e()}finally{l(!1)}}return(0,Z.jsxs)(z,{children:[(0,Z.jsx)(N,{asChild:!0,children:(0,Z.jsxs)(p,{variant:`outline`,size:`sm`,className:o(`shrink-0 gap-1.5`,e.working&&`border-primary/50`),disabled:m,children:[(c||e.working)&&(0,Z.jsx)(t,{className:`h-3.5 w-3.5 animate-spin`}),(0,Z.jsx)(`span`,{children:u}),!m&&(0,Z.jsx)(a,{className:`h-3.5 w-3.5 opacity-60`})]})}),(0,Z.jsxs)(F,{align:`end`,children:[d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(P,{onClick:()=>void h(()=>r(e)),children:`Implement in New Thread`}),(0,Z.jsx)(P,{onClick:()=>void h(()=>i(e)),children:`Implement in this thread`})]}),f&&(0,Z.jsx)(P,{onClick:()=>void h(()=>s(e)),children:`Mark done`})]})]})}var Q=l(`app.task-list.ui`);function he({projectId:e,onThreadSelect:i,initialTasks:a}){let s=ae(),c=B(e=>e.projects),l=B(e=>e.selectedThreadId),d=B(e=>e.processingThreadIds),f=B(e=>e.pendingChatMessage),m=B(e=>e.queuedChatMessages),_=B(e=>e.projectModelSelections),v=c.find(t=>t.projectId===e),y=v?.threads.find(e=>e.threadId===l),b=l?_[l]:void 0,[w,T]=(0,V.useState)(a),[E,D]=(0,V.useState)(!1),[O,k]=(0,V.useState)(null),[A,j]=(0,V.useState)(``),[M,N]=(0,V.useState)(!1);(0,V.useEffect)(()=>{if(!w.some(e=>e.working))return;let t=setInterval(async()=>{try{let n=await U(e);T(n),n.some(e=>e.working)||clearInterval(t)}catch(e){Q.error(`Failed to poll project tasks:`,e)}},2e3);return()=>clearInterval(t)},[w,e]),(0,V.useEffect)(()=>{T(a)},[a]),(0,V.useEffect)(()=>{E&&j(``)},[E]);function P(e){T(t=>t.map(t=>t.id===e.id?e:t))}function F(e){j(e.description),k({task:e})}function R(){k(null),j(``)}async function z(){if(A.trim()){N(!0);try{let t=await oe(e,A,{threadId:l??void 0,provider:b?.provider??y?.modelProvider,model:b?.id??y?.model});T(e=>[...e,t]),D(!1),j(``)}finally{N(!1)}}}async function H(){if(!(!A.trim()||!O)){N(!0);try{let t=await W(e,O.task.id,{description:A,threadId:l??void 0,provider:b?.provider??y?.modelProvider,model:b?.id??y?.model});T(e=>e.map(e=>e.id===t.id?t:e)),R()}finally{N(!1)}}}async function G(){if(O){N(!0);try{await se(e,O.task.id),T(e=>e.filter(e=>e.id!==O.task.id)),R()}finally{N(!1)}}}async function K(t){let n=await r(e);if(!n)return;let a=null,o=null,c=await ue(n,n=>{o||(o=n,s({type:L.AddCreatingThread,projectId:e,threadId:n,title:ce(v)}),s({type:L.AddProcessingThread,threadId:n})),W(e,t.id,{status:`Build`,working:!0,threadId:n}).then(e=>{a=e,P(e)})});if(!c){o&&(s({type:L.RemoveCreatingThread,projectId:e,threadId:o}),s({type:L.RemoveProcessingThread,threadId:o}));return}s({type:L.RemoveProcessingThread,threadId:c});try{await le(s)}catch(e){Q.error(`Failed to refresh projects after task thread creation:`,e)}await pe(e,t,`Build`,c,a,P);let l=await fe(e,c);if(!l){Q.error(`No model configuration found. Please configure a model and provider for this project first.`);return}X(s,c,l.model,l.provider),i?await i(c):s({type:L.SelectThread,threadId:c,projectId:e}),s({type:L.SetPendingChatMessage,message:{threadId:c,message:t.description,model:l.model,provider:l.provider}})}async function q(t){if(!l){Q.error(`No selected thread found for project task implementation.`);return}let n=await fe(e,l);if(!n){Q.error(`No model configuration found. Please configure a model and provider for this project first.`);return}if(X(s,l,n.model,n.provider),P(await W(e,t.id,{status:`Build`,working:!0,threadId:l})),i?await i(l):s({type:L.SelectThread,threadId:l,projectId:e}),d.includes(l)||f?.threadId===l||m.some(e=>e.threadId===l)){s({type:L.EnqueueChatMessage,message:{id:crypto.randomUUID(),threadId:l,paneId:`primary`,message:t.description,model:n.model,attachments:[],provider:n.provider}});return}s({type:L.SetPendingChatMessage,message:{threadId:l,message:t.description,model:n.model,provider:n.provider}})}async function J(t){P(await W(e,t.id,{status:`Done`,working:!1}))}let Y=de(w);return(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,children:[(0,Z.jsx)(ne,{className:`min-h-0 min-w-0 flex-1 overflow-hidden pb-24`,children:Y.length===0?(0,Z.jsx)(`p`,{className:o(x.bodyMuted,`px-4 py-8 text-center`),children:`No tasks yet. Add one to get started.`}):(0,Z.jsx)(`div`,{className:`min-w-0 w-full divide-y divide-border`,children:Y.map(e=>(0,Z.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,Z.jsxs)(`button`,{type:`button`,className:`col-start-1 row-start-1 block min-w-0 overflow-hidden text-left sm:flex-1`,onClick:()=>F(e),children:[(0,Z.jsx)(`p`,{className:o(x.label,`truncate`),children:e.title}),(0,Z.jsx)(`p`,{className:o(x.caption,`mt-1 line-clamp-2 break-all text-muted-foreground max-sm:hidden`),children:e.description})]}),(0,Z.jsx)(`button`,{type:`button`,className:`col-span-2 row-start-2 block min-w-0 overflow-hidden text-left sm:hidden`,onClick:()=>F(e),children:(0,Z.jsx)(`p`,{className:o(x.caption,`line-clamp-4 break-all text-muted-foreground`),children:e.description})}),(0,Z.jsxs)(`div`,{className:`col-start-2 row-start-1 flex shrink-0 items-center gap-1.5 self-start`,children:[e.threadId&&i&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(n,{asChild:!0,children:(0,Z.jsxs)(p,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0`,onClick:()=>i(e.threadId),children:[(0,Z.jsx)(te,{className:`h-4 w-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Open thread`})]})}),(0,Z.jsx)(g,{children:`Open thread`})]}),(0,Z.jsx)(me,{task:e,onImplementInNewThread:K,onImplementInThisThread:q,onMarkDone:J})]})]},e.id))})}),(0,Z.jsxs)(u,{children:[(0,Z.jsx)(n,{asChild:!0,children:(0,Z.jsxs)(p,{size:`icon`,className:`absolute bottom-6 right-6 z-10 h-14 w-14 rounded-full shadow-lg`,onClick:()=>D(!0),children:[(0,Z.jsx)(ee,{className:`h-6 w-6`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Add task`})]})}),(0,Z.jsx)(g,{children:`Add task`})]}),(0,Z.jsx)(h,{open:E,onOpenChange:D,children:(0,Z.jsxs)(re,{className:`sm:max-w-2xl`,children:[(0,Z.jsx)(C,{children:(0,Z.jsx)(ie,{children:`Add Task`})}),(0,Z.jsxs)(`div`,{className:`py-2`,children:[(0,Z.jsx)(I,{placeholder:`Describe what needs to be done...`,value:A,onChange:e=>j(e.target.value),rows:12,className:`resize-none text-base`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&z()}}),(0,Z.jsx)(`p`,{className:o(x.caption,`mt-1.5`),children:`A title will be generated automatically from your description.`})]}),(0,Z.jsx)(S,{children:(0,Z.jsx)(p,{onClick:()=>void z(),disabled:M||!A.trim(),children:M?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(t,{className:`mr-1 h-3 w-3 animate-spin`}),`Generating title...`]}):`Add`})})]})}),(0,Z.jsx)(h,{open:O!==null,onOpenChange:e=>!e&&R(),children:(0,Z.jsxs)(re,{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,Z.jsx)(C,{children:(0,Z.jsx)(ie,{children:`Edit Task`})}),(0,Z.jsx)(`div`,{className:`py-2`,children:(0,Z.jsx)(I,{placeholder:`Describe what needs to be done...`,value:A,onChange:e=>j(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)&&H()}})}),(0,Z.jsxs)(S,{className:`flex-row justify-between gap-2 sm:gap-0`,children:[(0,Z.jsx)(p,{variant:`destructive`,onClick:()=>void G(),disabled:M,children:`Delete`}),(0,Z.jsx)(p,{onClick:()=>void H(),disabled:M||!A.trim(),className:`w-auto`,children:M?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(t,{className:`mr-1 h-3 w-3 animate-spin`}),`Saving...`]}):`Save`})]})]})})]})}function ge(e){let t=(0,H.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=G(r,n),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o;t[7]===r?o=t[8]:(o=()=>J(r),t[7]=r,t[8]=o);let s=O(a,o),c;return t[9]!==s||t[10]!==r||t[11]!==i?(c=(0,Z.jsx)(he,{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,H.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,V.useState)(0),s,c;t[3]!==n.projectId||t[4]!==i?(s=()=>{i!==0&&o(e=>(j(G(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,V.useEffect)(s,c);let l;t[7]!==a||t[8]!==n.projectId?(l=function(){j(G(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,Z.jsx)(k,{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,Z.jsx)(V.Suspense,{fallback:d,children:(0,Z.jsx)(ge,{...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,Z.jsx)(A,{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 $=l(`app.tasks-view.ui`);function ye({projectId:e,refreshTrigger:t}){let n=ae(),r=B(e=>e.projects),i=B(e=>e.selectedThreadId),a=B(e=>e.selectedProjectId),{setActiveMainTab:o}=R();async function s(t){if(r.find(t=>t.projectId===e)){o(`chat`);try{let{getProjects:r,invalidateProjectsCache:o}=await D(async()=>{let{getProjects:e,invalidateProjectsCache:t}=await import(`./dialogs-config-DAMqiy-4.js`).then(e=>e.f);return{getProjects:e,invalidateProjectsCache:t}},__vite__mapDeps([0,1]));o();let s=await r();n({type:L.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:L.SelectThread,threadId:t,projectId:e});try{let e=await E();n({type:L.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:L.SelectThread,threadId:t,projectId:e});try{let e=await E();n({type:L.SetProcessingThreads,threadIds:e})}catch(e){$.error(`Failed to fetch processing threads after fallback thread selection:`,e)}}}}return(0,Z.jsx)(`div`,{className:`relative flex h-full min-w-0 flex-col overflow-hidden`,children:(0,Z.jsx)(`div`,{className:`min-w-0 flex-1 overflow-hidden pt-8`,children:(0,Z.jsx)(_e,{projectId:e,refreshTrigger:t,onThreadSelect:s})})})}export{ye as TasksView};
|