tarsk 0.5.47 → 0.5.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/index.js +31 -15
  2. package/dist/public/assets/{account-view-XO30M3P0.js → account-view-DxHV7OtO.js} +1 -1
  3. package/dist/public/assets/{browser-tab-B7XwV-sa.js → browser-tab-qhf-xKwZ.js} +1 -1
  4. package/dist/public/assets/{commit-dialog-D96fJ90J.js → commit-dialog-DcVXFOBP.js} +1 -1
  5. package/dist/public/assets/{create-repo-dialog-CTyZJfi1.js → create-repo-dialog-CsjpTBPU.js} +1 -1
  6. package/dist/public/assets/{diff-view-JfXPy7qA.js → diff-view-CGEl0YbC.js} +1 -1
  7. package/dist/public/assets/{explorer-tab-view-CUFm_j8i.js → explorer-tab-view--ib_BjId.js} +2 -2
  8. package/dist/public/assets/{explorer-tree-D5h9dOAX.js → explorer-tree-CiPMm5ck.js} +1 -1
  9. package/dist/public/assets/{explorer-view-IOQM4kWJ.js → explorer-view-odyQutTO.js} +1 -1
  10. package/dist/public/assets/git-ops-button-Bced-_39.js +2 -0
  11. package/dist/public/assets/index-C7FLshNp.css +1 -0
  12. package/dist/public/assets/{index-B4PyD4Io.js → index-_SOdLUMq.js} +6 -6
  13. package/dist/public/assets/{project-settings-view-DHZVnkug.js → project-settings-view-CHV6lJG4.js} +1 -1
  14. package/dist/public/assets/{pull-request-dialog-RwRZAOLd.js → pull-request-dialog-BFgRF5AH.js} +1 -1
  15. package/dist/public/assets/{settings-general-view-D94zYQNc.js → settings-general-view-Vwi9J6Tn.js} +1 -1
  16. package/dist/public/assets/{settings-instructions-view-DG6YpJy-.js → settings-instructions-view-8YIr0PO3.js} +1 -1
  17. package/dist/public/assets/{settings-mcp-servers-view-DsUxcHD0.js → settings-mcp-servers-view-CCXW_uet.js} +1 -1
  18. package/dist/public/assets/{settings-rules-view-BPKmp2c-.js → settings-rules-view-D3KLTKVZ.js} +1 -1
  19. package/dist/public/assets/{settings-skills-view-DD_0AweF.js → settings-skills-view-DaqOna-w.js} +1 -1
  20. package/dist/public/assets/{settings-slash-commands-view-CSEjoSTd.js → settings-slash-commands-view-CN8_DTYX.js} +1 -1
  21. package/dist/public/assets/{settings-subagents-view-Bs5ftymi.js → settings-subagents-view-BIejA-ck.js} +1 -1
  22. package/dist/public/assets/{settings-system-prompt-view-BNhTFs0x.js → settings-system-prompt-view-B1vc2cgC.js} +1 -1
  23. package/dist/public/assets/{settings-view-CZ9Gvo8Y.js → settings-view-DLBIkYoA.js} +2 -2
  24. package/dist/public/assets/{terminal-panel-DwHeNF9e.js → terminal-panel-DIpnKR-N.js} +1 -1
  25. package/dist/public/assets/{todos-view-CWPTnaGF.js → todos-view-BK6i_oPT.js} +1 -1
  26. package/dist/public/assets/{web-B3nTDZgN.js → web-BD1sqxMq.js} +1 -1
  27. package/dist/public/assets/{web-C59q93HV.js → web-BWAZk7ug.js} +1 -1
  28. package/dist/public/assets/{web-DVkb9rcs.js → web-DGalafxk.js} +1 -1
  29. package/dist/public/assets/{web-bG55HoO2.js → web-Dt5YgbhM.js} +1 -1
  30. package/dist/public/index.html +2 -2
  31. package/package.json +1 -1
  32. package/dist/public/assets/git-ops-button-0IGtolLO.js +0 -2
  33. package/dist/public/assets/index-HzthG2_q.css +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$ as t,Ai as n,Bi as r,Bn as i,Ct as a,Gr as o,In as s,Ln as c,Mi as l,Nn as u,No as d,Pn as f,Po as p,Xi as m,Xo as h,ca as g,da as _,fa as ee,la as v,ls as y,oa as b,os as x,qa as S,qr as C,sa as w,ss as T,ua as E,uo as D,va as te,xt as ne,ya as re,zn as ie}from"./dialogs-config-BEazgV7k.js";import{Ft as ae,f as O,g as k,h as A,m as j,p as M}from"./react-vendor-iDwBzcYF.js";import{D as oe,E as se,S as ce,T as le,b as N,d as P,f as F,g as I,h as L,m as R,p as z}from"./history-view-BMVTxWTg.js";import{a as ue,u as B}from"./onboarding-Bi5MieW-.js";import{I as de,P as V}from"./index-B4PyD4Io.js";import{n as fe,t as pe}from"./radio-group-n9qyUxmu.js";var H=T(),U=e(y(),1),W=x(),me=A,he=U.forwardRef((e,t)=>{let n=(0,H.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=l(`border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(j,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});he.displayName=`AccordionItem`;var ge=U.forwardRef((e,t)=>{let n=(0,H.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=l(`flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180`,i),n[4]=i,n[5]=o);let s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,W.jsx)(h,{className:`h-4 w-4 shrink-0 transition-transform duration-200`}),n[6]=s):s=n[6];let c;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==o?(c=(0,W.jsx)(M,{className:`flex`,children:(0,W.jsxs)(k,{ref:t,className:o,...a,children:[r,s]})}),n[7]=r,n[8]=a,n[9]=t,n[10]=o,n[11]=c):c=n[11],c});ge.displayName=k.displayName;var _e=U.forwardRef((e,t)=>{let n=(0,H.c)(14),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=l(m.body,`overflow-hidden transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down`),n[4]=o):o=n[4];let s;n[5]===i?s=n[6]:(s=l(`pb-4 pt-0`,i),n[5]=i,n[6]=s);let c;n[7]!==r||n[8]!==s?(c=(0,W.jsx)(`div`,{className:s,children:r}),n[7]=r,n[8]=s,n[9]=c):c=n[9];let u;return n[10]!==a||n[11]!==t||n[12]!==c?(u=(0,W.jsx)(O,{ref:t,className:o,...a,children:c}),n[10]=a,n[11]=t,n[12]=c,n[13]=u):u=n[13],u});_e.displayName=O.displayName;var G=`__unspecified__`;function ve(e){return[...e].sort((e,t)=>{let n=(e.provider??``).localeCompare(t.provider??``);return n===0?B(e.id).localeCompare(B(t.id)):n})}function ye({value:e,onChange:n,disabled:r=!1}){let[i,a]=(0,U.useState)([]),[s,c]=(0,U.useState)(!0);(0,U.useEffect)(()=>{let e=!1;async function n(){c(!0);try{let n=await t();if(e)return;a(ve(Object.values(n).flat()))}catch(t){console.error(`Failed to load enabled models:`,t),e||a([])}finally{e||c(!1)}}return n(),()=>{e=!0}},[]);let u=(0,U.useMemo)(()=>{let e=new Map;for(let t of i){let n=t.provider??`other`,r=e.get(n);r?r.push(t):e.set(n,[t])}return e},[i]);function d(t,r){let i={...e};if(r===G){delete i[t],n(i);return}let a=E(r);a&&(i[t]=a,n(i))}return(0,W.jsx)(`div`,{className:`space-y-4`,children:v.map(t=>{let n=e[t],a=n?_(n):G;return(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(o,{htmlFor:`model-alias-${t}`,className:m.label,children:g[t]}),(0,W.jsx)(`p`,{className:l(m.caption,`mt-1`),children:w[t]})]}),(0,W.jsxs)(P,{value:a,onValueChange:e=>d(t,e),disabled:r||s,children:[(0,W.jsx)(L,{id:`model-alias-${t}`,children:(0,W.jsx)(I,{placeholder:s?`Loading models...`:`Unspecified`})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(z,{value:G,children:`Unspecified`}),i.length>0&&(0,W.jsx)(R,{}),[...u.entries()].map(([e,t])=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:l(m.dropdownGroupHeading,`px-2 py-1.5 uppercase`),children:e}),t.map(t=>{let n=_({provider:t.provider??e,model:t.id});return(0,W.jsx)(z,{value:n,children:B(t.id)},n)})]},e))]})]})]},t)})})}function be(e){let t=(0,H.c)(20),{entry:i,index:a,loading:o,onValueChange:s}=e,c=r(i.name),[u,f]=(0,U.useState)(!1),m=i.value.length>0||i.hasExistingValue,h=i.hasExistingValue&&!i.value?`••••••••`:`value`;(0,U.useEffect)(()=>{c||f(!1)},[c]);let g=C,_=c&&!u?`password`:`text`,ee=i.value,v;t[0]!==a||t[1]!==s?(v=e=>s(a,e.target.value),t[0]=a,t[1]=s,t[2]=v):v=t[2];let y=l(`font-mono`,c&&`pr-10`),b;t[3]!==g||t[4]!==i.value||t[5]!==o||t[6]!==h||t[7]!==_||t[8]!==v||t[9]!==y?(b=(0,W.jsx)(g,{type:_,placeholder:h,value:ee,onChange:v,className:y,disabled:o}),t[3]=g,t[4]=i.value,t[5]=o,t[6]=h,t[7]=_,t[8]=v,t[9]=y,t[10]=b):b=t[10];let x;t[11]!==m||t[12]!==c||t[13]!==o||t[14]!==f||t[15]!==u?(x=c&&(0,W.jsx)(n,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:()=>f(K),disabled:o||!m,children:u?(0,W.jsx)(p,{className:`h-4 w-4 text-muted-foreground`}):(0,W.jsx)(d,{className:`h-4 w-4 text-muted-foreground`})}),t[11]=m,t[12]=c,t[13]=o,t[14]=f,t[15]=u,t[16]=x):x=t[16];let S;return t[17]!==b||t[18]!==x?(S=(0,W.jsxs)(`div`,{className:`relative flex-1`,children:[b,x]}),t[17]=b,t[18]=x,t[19]=S):S=t[19],S}function K(e){return!e}function q({projectId:e,onProjectUpdated:r}){let d=ae(),[p,h]=(0,U.useState)(``),[g,_]=(0,U.useState)(``),[v,y]=(0,U.useState)(``),[x,w]=(0,U.useState)(b.PullRequest),[T,E]=(0,U.useState)(``),[O,k]=(0,U.useState)(!1),[A,j]=(0,U.useState)(!1),[M,P]=(0,U.useState)(!1),[F,I]=(0,U.useState)(``),[L,R]=(0,U.useState)(``),[z,B]=(0,U.useState)(``),[H,G]=(0,U.useState)(``),[ve,K]=(0,U.useState)(b.PullRequest),[q,xe]=(0,U.useState)(!0),[J,Se]=(0,U.useState)([]),[Ce,we]=(0,U.useState)(!0),[Te,Ee]=(0,U.useState)([]),[Y,X]=(0,U.useState)([]),[De,Oe]=(0,U.useState)([]),[Z,ke]=(0,U.useState)({}),[Ae,Q]=(0,U.useState)({}),$=(0,U.useCallback)(async()=>{if(e){P(!0);try{let t=await ne(e),n=await a(e),r=t.name??``,i=t.setupScript??``,o=t.validationScript??``,s=t.runCommand??``,c=t.commitMethod??b.PullRequest,l=t.allowAllCommands!==!1,u=t.allowedCommandPatterns??[],d=n.vars.map(e=>({name:e.name,value:e.value??``,hasExistingValue:e.hasValue&&e.value===void 0})),f=t.modelAliases??{};h(r),_(i),E(o),y(s),w(c),xe(l),Se(u),X(d),ke(f),I(r),R(i),B(o),G(s),K(c),we(l),Ee(u),Oe(d),Q(f)}catch(e){V({title:`Error`,description:e instanceof Error?e.message:`Failed to load project settings`,variant:`destructive`})}finally{P(!1)}}},[e]);(0,U.useEffect)(()=>{$()},[$]);function je(){X(e=>[...e,{name:``,value:``,hasExistingValue:!1}])}function Me(e,t){X(n=>n.map((n,r)=>r===e?{...n,name:t.toUpperCase()}:n))}function Ne(e,t){X(n=>n.map((n,r)=>r===e?{...n,value:t}:n))}function Pe(e){X(t=>t.filter((t,n)=>n!==e))}function Fe(){if(Y.length!==De.length)return!0;for(let e=0;e<Y.length;e+=1){let t=Y[e],n=De[e];if(!n||t.name!==n.name||t.value!==n.value||t.hasExistingValue!==n.hasExistingValue)return!0}return!1}function Ie(){return JSON.stringify(Z)!==JSON.stringify(Ae)}return e?(0,W.jsx)(oe,{children:(0,W.jsxs)(se,{children:[(0,W.jsx)(ce,{title:`Project Settings`,description:`Configure settings for your project.`,action:(0,W.jsx)(n,{onClick:async()=>{if(e){k(!0);try{if(p!==F&&await c(e,p),g!==L&&await ie(e,g.trim()||null,!1),T!==z&&await s(e,{validationScript:T.trim()||null}),v!==H&&await i(e,v.trim()||null),x!==ve&&await s(e,{commitMethod:x}),(q!==Ce||JSON.stringify(J)!==JSON.stringify(Te))&&await s(e,{allowAllCommands:q,allowedCommandPatterns:J}),Ie()){let n=Object.keys(Z).length>0?Z:void 0;if(n){let e=await t();ee(n,Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.map(e=>e.id)])))}await s(e,{modelAliases:n??null})}if(Fe()){let t=Y.map(e=>({name:e.name.trim(),value:e.value,hasExistingValue:e.hasExistingValue})).filter(e=>e.name.length>0),n=t.find((e,n)=>t.findIndex(t=>t.name===e.name)!==n);if(n)throw Error(`Duplicate environment variable name: ${n.name}`);let r=t.find(e=>!e.hasExistingValue&&!e.value.trim());if(r)throw Error(`Value is required for environment variable: ${r.name}`);await f(e,t.map(e=>({name:e.name,value:e.value.trim()||void 0})))}I(p),R(g),B(T),G(v),K(x),we(q),Ee(J),Q(Z),Oe(Y.map(e=>({...e,value:``}))),r&&await r(),await $(),V({title:`Success`,description:`Project settings saved`}),d(`/`)}catch(e){V({title:`Error`,description:e instanceof Error?e.message:`Failed to save settings`,variant:`destructive`})}finally{k(!1)}}},disabled:O||M,children:O?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(D,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):M?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(D,{className:`mr-2 h-4 w-4 animate-spin`}),`Loading...`]}):`Save`})}),(0,W.jsxs)(`div`,{className:`space-y-6`,children:[(0,W.jsx)(N,{title:`Project Name`,children:(0,W.jsx)(C,{id:`projectName`,value:p,onChange:e=>h(e.target.value),placeholder:`Enter project name`,disabled:M})}),(0,W.jsx)(N,{title:`Setup Script`,description:`This script runs automatically after cloning the repo for new threads.`,children:(0,W.jsx)(de,{id:`setupScript`,value:g,onChange:e=>_(e.target.value),placeholder:`e.g. npm install`,className:`font-mono min-h-[80px] resize-none`,disabled:M})}),(0,W.jsx)(N,{title:`Validation Script`,description:`This script runs after each chat response. If it fails, Tarsk will try to fix issues automatically up to the retry limit.`,children:(0,W.jsx)(de,{id:`validationScript`,value:T,onChange:e=>E(e.target.value),placeholder:`e.g. npm run lint && npm test`,className:`font-mono min-h-[80px] resize-none`,disabled:M})}),(0,W.jsx)(N,{title:`Run Command`,description:`The command to start the dev server. Leave empty to disable run functionality.`,action:(0,W.jsx)(n,{variant:`ghost`,size:`sm`,onClick:async()=>{if(e){j(!0);try{let t=await u(e);t.runCommand?(y(t.runCommand),V({title:`Success`,description:`Suggested: ${t.runCommand}`})):V({title:`No command found`,description:`Could not detect a dev script in package.json`})}catch(e){V({title:`Error`,description:e instanceof Error?e.message:`Failed to suggest command`,variant:`destructive`})}finally{j(!1)}}},disabled:A||M,children:A?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(D,{className:`h-3 w-3 animate-spin`}),`Suggesting...`]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(te,{className:`h-3 w-3`}),`Suggest`]})}),children:(0,W.jsx)(C,{id:`runCommand`,value:v,onChange:e=>y(e.target.value),placeholder:`e.g. npm run dev`,className:`font-mono`,disabled:M})}),(0,W.jsx)(N,{title:`Commit Method`,description:x===b.PullRequest?`Feature branches are created and pull requests can be created.`:`Commits are made directly to the main branch without feature branches.`,children:(0,W.jsxs)(pe,{value:x,onValueChange:e=>w(e),className:`flex gap-4`,disabled:M,children:[(0,W.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,W.jsx)(fe,{value:b.PullRequest,id:`commit-pr`}),(0,W.jsx)(o,{htmlFor:`commit-pr`,className:l(m.labelNormal,`cursor-pointer`),children:`Pull Requests`})]}),(0,W.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,W.jsx)(fe,{value:b.Direct,id:`commit-direct`}),(0,W.jsx)(o,{htmlFor:`commit-direct`,className:l(m.labelNormal,`cursor-pointer`),children:`Direct Commits`})]})]})}),(0,W.jsxs)(N,{title:`Confirm Commands`,description:`When checked, the agent asks for approval before running bash commands, skill scripts, and browser shell calls.`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(ue,{id:`confirmCommands`,checked:!q,onCheckedChange:e=>xe(e!==!0),disabled:M}),(0,W.jsx)(o,{htmlFor:`confirmCommands`,className:m.labelNormal,children:`Require approval for bash commands, skill scripts, and browser shell calls`})]}),!q&&J.length>0&&(0,W.jsxs)(`div`,{className:`space-y-2 mt-3`,children:[(0,W.jsx)(o,{children:`Allowed command patterns`}),(0,W.jsx)(`ul`,{className:`space-y-1`,children:J.map(e=>(0,W.jsxs)(`li`,{className:`flex items-center justify-between rounded-md border border-border px-3 py-2`,children:[(0,W.jsx)(`code`,{className:l(m.mono,m.bodyMuted),children:e}),(0,W.jsx)(n,{type:`button`,variant:`ghost`,size:`sm`,disabled:M||O,onClick:()=>Se(t=>t.filter(t=>t!==e)),children:`Remove`})]},e))})]})]}),(0,W.jsx)(N,{title:`Environment Variables`,description:`Stored encrypted in the Tarsk database and injected when the agent runs bash commands or MCP tools.`,action:(0,W.jsxs)(n,{variant:`ghost`,size:`sm`,onClick:je,disabled:M,children:[(0,W.jsx)(S,{className:`h-3 w-3 mr-1`}),`Add variable`]}),children:Y.length===0?(0,W.jsx)(`p`,{className:m.caption,children:`No environment variables configured`}):(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:Y.map((e,t)=>(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(C,{placeholder:`API_KEY`,value:e.name,onChange:e=>Me(t,e.target.value),className:`font-mono w-[35%]`,disabled:M}),(0,W.jsx)(be,{entry:e,index:t,loading:M,onValueChange:Ne}),(0,W.jsx)(n,{variant:`ghost`,size:`icon`,onClick:()=>Pe(t),className:`h-9 w-9 flex-shrink-0`,disabled:M||O,children:(0,W.jsx)(re,{className:`h-3.5 w-3.5`})})]},t))})}),(0,W.jsx)(me,{type:`single`,collapsible:!0,children:(0,W.jsxs)(he,{value:`advanced`,className:`border-b-0`,children:[(0,W.jsx)(ge,{className:l(m.sectionTitle,`text-2xl hover:no-underline py-0`),children:`Advanced`}),(0,W.jsx)(_e,{children:(0,W.jsx)(N,{title:`Model Aliases`,description:`Map short names (fast, local, cheap, smart) to enabled models. Subagents can reference these aliases in AGENT.md.`,className:`pt-2`,children:(0,W.jsx)(ye,{value:Z,onChange:ke,disabled:M||O})})})]})})]})]})}):(0,W.jsx)(le,{title:`No project selected`,children:`Please select a project from the sidebar to view its settings.`})}export{q as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$ as t,Ai as n,Bi as r,Bn as i,Ct as a,Gr as o,In as s,Ln as c,Mi as l,Nn as u,No as d,Pn as f,Po as p,Xi as m,Xo as h,ca as g,da as _,fa as ee,la as v,ls as y,oa as b,os as x,qa as S,qr as C,sa as w,ss as T,ua as E,uo as D,va as te,xt as ne,ya as re,zn as ie}from"./dialogs-config-BEazgV7k.js";import{Ft as ae,f as O,g as k,h as A,m as j,p as M}from"./react-vendor-iDwBzcYF.js";import{D as oe,E as se,S as ce,T as le,b as N,d as P,f as F,g as I,h as L,m as R,p as z}from"./history-view-BMVTxWTg.js";import{a as ue,u as B}from"./onboarding-Bi5MieW-.js";import{I as de,P as V}from"./index-_SOdLUMq.js";import{n as fe,t as pe}from"./radio-group-n9qyUxmu.js";var H=T(),U=e(y(),1),W=x(),me=A,he=U.forwardRef((e,t)=>{let n=(0,H.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=l(`border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(j,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});he.displayName=`AccordionItem`;var ge=U.forwardRef((e,t)=>{let n=(0,H.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=l(`flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180`,i),n[4]=i,n[5]=o);let s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,W.jsx)(h,{className:`h-4 w-4 shrink-0 transition-transform duration-200`}),n[6]=s):s=n[6];let c;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==o?(c=(0,W.jsx)(M,{className:`flex`,children:(0,W.jsxs)(k,{ref:t,className:o,...a,children:[r,s]})}),n[7]=r,n[8]=a,n[9]=t,n[10]=o,n[11]=c):c=n[11],c});ge.displayName=k.displayName;var _e=U.forwardRef((e,t)=>{let n=(0,H.c)(14),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=l(m.body,`overflow-hidden transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down`),n[4]=o):o=n[4];let s;n[5]===i?s=n[6]:(s=l(`pb-4 pt-0`,i),n[5]=i,n[6]=s);let c;n[7]!==r||n[8]!==s?(c=(0,W.jsx)(`div`,{className:s,children:r}),n[7]=r,n[8]=s,n[9]=c):c=n[9];let u;return n[10]!==a||n[11]!==t||n[12]!==c?(u=(0,W.jsx)(O,{ref:t,className:o,...a,children:c}),n[10]=a,n[11]=t,n[12]=c,n[13]=u):u=n[13],u});_e.displayName=O.displayName;var G=`__unspecified__`;function ve(e){return[...e].sort((e,t)=>{let n=(e.provider??``).localeCompare(t.provider??``);return n===0?B(e.id).localeCompare(B(t.id)):n})}function ye({value:e,onChange:n,disabled:r=!1}){let[i,a]=(0,U.useState)([]),[s,c]=(0,U.useState)(!0);(0,U.useEffect)(()=>{let e=!1;async function n(){c(!0);try{let n=await t();if(e)return;a(ve(Object.values(n).flat()))}catch(t){console.error(`Failed to load enabled models:`,t),e||a([])}finally{e||c(!1)}}return n(),()=>{e=!0}},[]);let u=(0,U.useMemo)(()=>{let e=new Map;for(let t of i){let n=t.provider??`other`,r=e.get(n);r?r.push(t):e.set(n,[t])}return e},[i]);function d(t,r){let i={...e};if(r===G){delete i[t],n(i);return}let a=E(r);a&&(i[t]=a,n(i))}return(0,W.jsx)(`div`,{className:`space-y-4`,children:v.map(t=>{let n=e[t],a=n?_(n):G;return(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(o,{htmlFor:`model-alias-${t}`,className:m.label,children:g[t]}),(0,W.jsx)(`p`,{className:l(m.caption,`mt-1`),children:w[t]})]}),(0,W.jsxs)(P,{value:a,onValueChange:e=>d(t,e),disabled:r||s,children:[(0,W.jsx)(L,{id:`model-alias-${t}`,children:(0,W.jsx)(I,{placeholder:s?`Loading models...`:`Unspecified`})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(z,{value:G,children:`Unspecified`}),i.length>0&&(0,W.jsx)(R,{}),[...u.entries()].map(([e,t])=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:l(m.dropdownGroupHeading,`px-2 py-1.5 uppercase`),children:e}),t.map(t=>{let n=_({provider:t.provider??e,model:t.id});return(0,W.jsx)(z,{value:n,children:B(t.id)},n)})]},e))]})]})]},t)})})}function be(e){let t=(0,H.c)(20),{entry:i,index:a,loading:o,onValueChange:s}=e,c=r(i.name),[u,f]=(0,U.useState)(!1),m=i.value.length>0||i.hasExistingValue,h=i.hasExistingValue&&!i.value?`••••••••`:`value`;(0,U.useEffect)(()=>{c||f(!1)},[c]);let g=C,_=c&&!u?`password`:`text`,ee=i.value,v;t[0]!==a||t[1]!==s?(v=e=>s(a,e.target.value),t[0]=a,t[1]=s,t[2]=v):v=t[2];let y=l(`font-mono`,c&&`pr-10`),b;t[3]!==g||t[4]!==i.value||t[5]!==o||t[6]!==h||t[7]!==_||t[8]!==v||t[9]!==y?(b=(0,W.jsx)(g,{type:_,placeholder:h,value:ee,onChange:v,className:y,disabled:o}),t[3]=g,t[4]=i.value,t[5]=o,t[6]=h,t[7]=_,t[8]=v,t[9]=y,t[10]=b):b=t[10];let x;t[11]!==m||t[12]!==c||t[13]!==o||t[14]!==f||t[15]!==u?(x=c&&(0,W.jsx)(n,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:()=>f(K),disabled:o||!m,children:u?(0,W.jsx)(p,{className:`h-4 w-4 text-muted-foreground`}):(0,W.jsx)(d,{className:`h-4 w-4 text-muted-foreground`})}),t[11]=m,t[12]=c,t[13]=o,t[14]=f,t[15]=u,t[16]=x):x=t[16];let S;return t[17]!==b||t[18]!==x?(S=(0,W.jsxs)(`div`,{className:`relative flex-1`,children:[b,x]}),t[17]=b,t[18]=x,t[19]=S):S=t[19],S}function K(e){return!e}function q({projectId:e,onProjectUpdated:r}){let d=ae(),[p,h]=(0,U.useState)(``),[g,_]=(0,U.useState)(``),[v,y]=(0,U.useState)(``),[x,w]=(0,U.useState)(b.PullRequest),[T,E]=(0,U.useState)(``),[O,k]=(0,U.useState)(!1),[A,j]=(0,U.useState)(!1),[M,P]=(0,U.useState)(!1),[F,I]=(0,U.useState)(``),[L,R]=(0,U.useState)(``),[z,B]=(0,U.useState)(``),[H,G]=(0,U.useState)(``),[ve,K]=(0,U.useState)(b.PullRequest),[q,xe]=(0,U.useState)(!0),[J,Se]=(0,U.useState)([]),[Ce,we]=(0,U.useState)(!0),[Te,Ee]=(0,U.useState)([]),[Y,X]=(0,U.useState)([]),[De,Oe]=(0,U.useState)([]),[Z,ke]=(0,U.useState)({}),[Ae,Q]=(0,U.useState)({}),$=(0,U.useCallback)(async()=>{if(e){P(!0);try{let t=await ne(e),n=await a(e),r=t.name??``,i=t.setupScript??``,o=t.validationScript??``,s=t.runCommand??``,c=t.commitMethod??b.PullRequest,l=t.allowAllCommands!==!1,u=t.allowedCommandPatterns??[],d=n.vars.map(e=>({name:e.name,value:e.value??``,hasExistingValue:e.hasValue&&e.value===void 0})),f=t.modelAliases??{};h(r),_(i),E(o),y(s),w(c),xe(l),Se(u),X(d),ke(f),I(r),R(i),B(o),G(s),K(c),we(l),Ee(u),Oe(d),Q(f)}catch(e){V({title:`Error`,description:e instanceof Error?e.message:`Failed to load project settings`,variant:`destructive`})}finally{P(!1)}}},[e]);(0,U.useEffect)(()=>{$()},[$]);function je(){X(e=>[...e,{name:``,value:``,hasExistingValue:!1}])}function Me(e,t){X(n=>n.map((n,r)=>r===e?{...n,name:t.toUpperCase()}:n))}function Ne(e,t){X(n=>n.map((n,r)=>r===e?{...n,value:t}:n))}function Pe(e){X(t=>t.filter((t,n)=>n!==e))}function Fe(){if(Y.length!==De.length)return!0;for(let e=0;e<Y.length;e+=1){let t=Y[e],n=De[e];if(!n||t.name!==n.name||t.value!==n.value||t.hasExistingValue!==n.hasExistingValue)return!0}return!1}function Ie(){return JSON.stringify(Z)!==JSON.stringify(Ae)}return e?(0,W.jsx)(oe,{children:(0,W.jsxs)(se,{children:[(0,W.jsx)(ce,{title:`Project Settings`,description:`Configure settings for your project.`,action:(0,W.jsx)(n,{onClick:async()=>{if(e){k(!0);try{if(p!==F&&await c(e,p),g!==L&&await ie(e,g.trim()||null,!1),T!==z&&await s(e,{validationScript:T.trim()||null}),v!==H&&await i(e,v.trim()||null),x!==ve&&await s(e,{commitMethod:x}),(q!==Ce||JSON.stringify(J)!==JSON.stringify(Te))&&await s(e,{allowAllCommands:q,allowedCommandPatterns:J}),Ie()){let n=Object.keys(Z).length>0?Z:void 0;if(n){let e=await t();ee(n,Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.map(e=>e.id)])))}await s(e,{modelAliases:n??null})}if(Fe()){let t=Y.map(e=>({name:e.name.trim(),value:e.value,hasExistingValue:e.hasExistingValue})).filter(e=>e.name.length>0),n=t.find((e,n)=>t.findIndex(t=>t.name===e.name)!==n);if(n)throw Error(`Duplicate environment variable name: ${n.name}`);let r=t.find(e=>!e.hasExistingValue&&!e.value.trim());if(r)throw Error(`Value is required for environment variable: ${r.name}`);await f(e,t.map(e=>({name:e.name,value:e.value.trim()||void 0})))}I(p),R(g),B(T),G(v),K(x),we(q),Ee(J),Q(Z),Oe(Y.map(e=>({...e,value:``}))),r&&await r(),await $(),V({title:`Success`,description:`Project settings saved`}),d(`/`)}catch(e){V({title:`Error`,description:e instanceof Error?e.message:`Failed to save settings`,variant:`destructive`})}finally{k(!1)}}},disabled:O||M,children:O?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(D,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):M?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(D,{className:`mr-2 h-4 w-4 animate-spin`}),`Loading...`]}):`Save`})}),(0,W.jsxs)(`div`,{className:`space-y-6`,children:[(0,W.jsx)(N,{title:`Project Name`,children:(0,W.jsx)(C,{id:`projectName`,value:p,onChange:e=>h(e.target.value),placeholder:`Enter project name`,disabled:M})}),(0,W.jsx)(N,{title:`Setup Script`,description:`This script runs automatically after cloning the repo for new threads.`,children:(0,W.jsx)(de,{id:`setupScript`,value:g,onChange:e=>_(e.target.value),placeholder:`e.g. npm install`,className:`font-mono min-h-[80px] resize-none`,disabled:M})}),(0,W.jsx)(N,{title:`Validation Script`,description:`This script runs after each chat response. If it fails, Tarsk will try to fix issues automatically up to the retry limit.`,children:(0,W.jsx)(de,{id:`validationScript`,value:T,onChange:e=>E(e.target.value),placeholder:`e.g. npm run lint && npm test`,className:`font-mono min-h-[80px] resize-none`,disabled:M})}),(0,W.jsx)(N,{title:`Run Command`,description:`The command to start the dev server. Leave empty to disable run functionality.`,action:(0,W.jsx)(n,{variant:`ghost`,size:`sm`,onClick:async()=>{if(e){j(!0);try{let t=await u(e);t.runCommand?(y(t.runCommand),V({title:`Success`,description:`Suggested: ${t.runCommand}`})):V({title:`No command found`,description:`Could not detect a dev script in package.json`})}catch(e){V({title:`Error`,description:e instanceof Error?e.message:`Failed to suggest command`,variant:`destructive`})}finally{j(!1)}}},disabled:A||M,children:A?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(D,{className:`h-3 w-3 animate-spin`}),`Suggesting...`]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(te,{className:`h-3 w-3`}),`Suggest`]})}),children:(0,W.jsx)(C,{id:`runCommand`,value:v,onChange:e=>y(e.target.value),placeholder:`e.g. npm run dev`,className:`font-mono`,disabled:M})}),(0,W.jsx)(N,{title:`Commit Method`,description:x===b.PullRequest?`Feature branches are created and pull requests can be created.`:`Commits are made directly to the main branch without feature branches.`,children:(0,W.jsxs)(pe,{value:x,onValueChange:e=>w(e),className:`flex gap-4`,disabled:M,children:[(0,W.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,W.jsx)(fe,{value:b.PullRequest,id:`commit-pr`}),(0,W.jsx)(o,{htmlFor:`commit-pr`,className:l(m.labelNormal,`cursor-pointer`),children:`Pull Requests`})]}),(0,W.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,W.jsx)(fe,{value:b.Direct,id:`commit-direct`}),(0,W.jsx)(o,{htmlFor:`commit-direct`,className:l(m.labelNormal,`cursor-pointer`),children:`Direct Commits`})]})]})}),(0,W.jsxs)(N,{title:`Confirm Commands`,description:`When checked, the agent asks for approval before running bash commands, skill scripts, and browser shell calls.`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(ue,{id:`confirmCommands`,checked:!q,onCheckedChange:e=>xe(e!==!0),disabled:M}),(0,W.jsx)(o,{htmlFor:`confirmCommands`,className:m.labelNormal,children:`Require approval for bash commands, skill scripts, and browser shell calls`})]}),!q&&J.length>0&&(0,W.jsxs)(`div`,{className:`space-y-2 mt-3`,children:[(0,W.jsx)(o,{children:`Allowed command patterns`}),(0,W.jsx)(`ul`,{className:`space-y-1`,children:J.map(e=>(0,W.jsxs)(`li`,{className:`flex items-center justify-between rounded-md border border-border px-3 py-2`,children:[(0,W.jsx)(`code`,{className:l(m.mono,m.bodyMuted),children:e}),(0,W.jsx)(n,{type:`button`,variant:`ghost`,size:`sm`,disabled:M||O,onClick:()=>Se(t=>t.filter(t=>t!==e)),children:`Remove`})]},e))})]})]}),(0,W.jsx)(N,{title:`Environment Variables`,description:`Stored encrypted in the Tarsk database and injected when the agent runs bash commands or MCP tools.`,action:(0,W.jsxs)(n,{variant:`ghost`,size:`sm`,onClick:je,disabled:M,children:[(0,W.jsx)(S,{className:`h-3 w-3 mr-1`}),`Add variable`]}),children:Y.length===0?(0,W.jsx)(`p`,{className:m.caption,children:`No environment variables configured`}):(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:Y.map((e,t)=>(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(C,{placeholder:`API_KEY`,value:e.name,onChange:e=>Me(t,e.target.value),className:`font-mono w-[35%]`,disabled:M}),(0,W.jsx)(be,{entry:e,index:t,loading:M,onValueChange:Ne}),(0,W.jsx)(n,{variant:`ghost`,size:`icon`,onClick:()=>Pe(t),className:`h-9 w-9 flex-shrink-0`,disabled:M||O,children:(0,W.jsx)(re,{className:`h-3.5 w-3.5`})})]},t))})}),(0,W.jsx)(me,{type:`single`,collapsible:!0,children:(0,W.jsxs)(he,{value:`advanced`,className:`border-b-0`,children:[(0,W.jsx)(ge,{className:l(m.sectionTitle,`text-2xl hover:no-underline py-0`),children:`Advanced`}),(0,W.jsx)(_e,{children:(0,W.jsx)(N,{title:`Model Aliases`,description:`Map short names (fast, local, cheap, smart) to enabled models. Subagents can reference these aliases in AGENT.md.`,className:`pt-2`,children:(0,W.jsx)(ye,{value:Z,onChange:ke,disabled:M||O})})})]})})]})]})}):(0,W.jsx)(le,{title:`No project selected`,children:`Please select a project from the sidebar to view its settings.`})}export{q as default};
@@ -1 +1 @@
1
- import{$r as e,Ai as t,Fr as n,Gr as r,Ir as ee,Jr as i,Ma as a,Nr as te,Pr as ne,Qr as o,Xi as s,Xr as c,Zr as l,ei as u,os as d,qr as f,ss as p,uo as re}from"./dialogs-config-BEazgV7k.js";import{a as ie}from"./onboarding-Bi5MieW-.js";import{I as ae}from"./index-B4PyD4Io.js";var m=p(),h=d();function g(d){let p=(0,m.c)(54),{open:g,onOpenChange:_,prTitle:v,onPrTitleChange:y,prDescription:b,onPrDescriptionChange:x,isGeneratingPRInfo:S,isLoading:C,onGeneratePRInfo:w,onCreatePR:T,currentBranch:E,autoGeneratePRInfo:D,onAutoGeneratePRInfoChange:O}=d,k;p[0]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,h.jsx)(u,{children:`Create Pull Request`}),p[0]=k):k=p[0];let A;p[1]===E?A=p[2]:(A=(0,h.jsxs)(e,{children:[k,(0,h.jsxs)(l,{children:[`Create a pull request for branch `,E]})]}),p[1]=E,p[2]=A);let j;p[3]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,h.jsx)(r,{htmlFor:`pr-title`,children:`Title`}),p[3]=j):j=p[3];let M=E||`Enter PR title...`,N;p[4]===y?N=p[5]:(N=e=>y(e.target.value),p[4]=y,p[5]=N);let P;p[6]!==v||p[7]!==M||p[8]!==N?(P=(0,h.jsxs)(`div`,{className:`grid gap-2`,children:[j,(0,h.jsx)(f,{id:`pr-title`,placeholder:M,value:v,onChange:N})]}),p[6]=v,p[7]=M,p[8]=N,p[9]=P):P=p[9];let F;p[10]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,h.jsx)(r,{htmlFor:`pr-description`,children:`Description`}),p[10]=F):F=p[10];let I;p[11]===x?I=p[12]:(I=e=>x(e.target.value),p[11]=x,p[12]=I);let L;p[13]!==b||p[14]!==I?(L=(0,h.jsx)(ae,{id:`pr-description`,placeholder:`Enter PR description...`,value:b,onChange:I,className:`pr-10 h-full min-h-[14rem] resize-none`}),p[13]=b,p[14]=I,p[15]=L):L=p[15];let R=S||C,z;p[16]===S?z=p[17]:(z=S?(0,h.jsx)(re,{className:`h-3.5 w-3.5 animate-spin`}):(0,h.jsx)(a,{className:`h-3.5 w-3.5`}),p[16]=S,p[17]=z);let B;p[18]!==w||p[19]!==R||p[20]!==z?(B=(0,h.jsx)(ee,{asChild:!0,children:(0,h.jsx)(t,{type:`button`,variant:`ghost`,size:`icon`,className:`absolute top-2 right-2 h-6 w-6`,onClick:w,disabled:R,children:z})}),p[18]=w,p[19]=R,p[20]=z,p[21]=B):B=p[21];let V=S?`Generating PR description...`:`Generate PR title and description with AI`,H;p[22]===V?H=p[23]:(H=(0,h.jsx)(ne,{children:V}),p[22]=V,p[23]=H);let U;p[24]!==B||p[25]!==H?(U=(0,h.jsx)(n,{children:(0,h.jsxs)(te,{children:[B,H]})}),p[24]=B,p[25]=H,p[26]=U):U=p[26];let W;p[27]!==U||p[28]!==L?(W=(0,h.jsxs)(`div`,{className:`grid gap-2 flex-1 min-h-0`,children:[F,(0,h.jsxs)(`div`,{className:`relative flex-1 min-h-0`,children:[L,U]})]}),p[27]=U,p[28]=L,p[29]=W):W=p[29];let G;p[30]!==W||p[31]!==P?(G=(0,h.jsxs)(`div`,{className:`grid gap-4 py-4 flex-1 min-h-0`,children:[P,W]}),p[30]=W,p[31]=P,p[32]=G):G=p[32];let K;p[33]===O?K=p[34]:(K=e=>O(e===!0),p[33]=O,p[34]=K);let q;p[35]!==D||p[36]!==K?(q=(0,h.jsx)(ie,{id:`auto-generate-pr`,checked:D,onCheckedChange:K}),p[35]=D,p[36]=K,p[37]=q):q=p[37];let J;p[38]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,h.jsx)(r,{htmlFor:`auto-generate-pr`,className:s.labelNormal,children:`Auto generate PR title and description`}),p[38]=J):J=p[38];let Y;p[39]===q?Y=p[40]:(Y=(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[q,J]}),p[39]=q,p[40]=Y);let X=C?`Creating...`:`Create PR`,Z;p[41]!==C||p[42]!==T||p[43]!==X?(Z=(0,h.jsx)(o,{children:(0,h.jsx)(t,{onClick:T,disabled:C,children:X})}),p[41]=C,p[42]=T,p[43]=X,p[44]=Z):Z=p[44];let Q;p[45]!==G||p[46]!==A||p[47]!==Y||p[48]!==Z?(Q=(0,h.jsxs)(c,{className:`flex 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:h-[min(36rem,85dvh)]`,children:[A,G,Y,Z]}),p[45]=G,p[46]=A,p[47]=Y,p[48]=Z,p[49]=Q):Q=p[49];let $;return p[50]!==_||p[51]!==g||p[52]!==Q?($=(0,h.jsx)(i,{open:g,onOpenChange:_,children:Q}),p[50]=_,p[51]=g,p[52]=Q,p[53]=$):$=p[53],$}export{g as PullRequestDialog};
1
+ import{$r as e,Ai as t,Fr as n,Gr as r,Ir as ee,Jr as i,Ma as a,Nr as te,Pr as ne,Qr as o,Xi as s,Xr as c,Zr as l,ei as u,os as d,qr as f,ss as p,uo as re}from"./dialogs-config-BEazgV7k.js";import{a as ie}from"./onboarding-Bi5MieW-.js";import{I as ae}from"./index-_SOdLUMq.js";var m=p(),h=d();function g(d){let p=(0,m.c)(54),{open:g,onOpenChange:_,prTitle:v,onPrTitleChange:y,prDescription:b,onPrDescriptionChange:x,isGeneratingPRInfo:S,isLoading:C,onGeneratePRInfo:w,onCreatePR:T,currentBranch:E,autoGeneratePRInfo:D,onAutoGeneratePRInfoChange:O}=d,k;p[0]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,h.jsx)(u,{children:`Create Pull Request`}),p[0]=k):k=p[0];let A;p[1]===E?A=p[2]:(A=(0,h.jsxs)(e,{children:[k,(0,h.jsxs)(l,{children:[`Create a pull request for branch `,E]})]}),p[1]=E,p[2]=A);let j;p[3]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,h.jsx)(r,{htmlFor:`pr-title`,children:`Title`}),p[3]=j):j=p[3];let M=E||`Enter PR title...`,N;p[4]===y?N=p[5]:(N=e=>y(e.target.value),p[4]=y,p[5]=N);let P;p[6]!==v||p[7]!==M||p[8]!==N?(P=(0,h.jsxs)(`div`,{className:`grid gap-2`,children:[j,(0,h.jsx)(f,{id:`pr-title`,placeholder:M,value:v,onChange:N})]}),p[6]=v,p[7]=M,p[8]=N,p[9]=P):P=p[9];let F;p[10]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,h.jsx)(r,{htmlFor:`pr-description`,children:`Description`}),p[10]=F):F=p[10];let I;p[11]===x?I=p[12]:(I=e=>x(e.target.value),p[11]=x,p[12]=I);let L;p[13]!==b||p[14]!==I?(L=(0,h.jsx)(ae,{id:`pr-description`,placeholder:`Enter PR description...`,value:b,onChange:I,className:`pr-10 h-full min-h-[14rem] resize-none`}),p[13]=b,p[14]=I,p[15]=L):L=p[15];let R=S||C,z;p[16]===S?z=p[17]:(z=S?(0,h.jsx)(re,{className:`h-3.5 w-3.5 animate-spin`}):(0,h.jsx)(a,{className:`h-3.5 w-3.5`}),p[16]=S,p[17]=z);let B;p[18]!==w||p[19]!==R||p[20]!==z?(B=(0,h.jsx)(ee,{asChild:!0,children:(0,h.jsx)(t,{type:`button`,variant:`ghost`,size:`icon`,className:`absolute top-2 right-2 h-6 w-6`,onClick:w,disabled:R,children:z})}),p[18]=w,p[19]=R,p[20]=z,p[21]=B):B=p[21];let V=S?`Generating PR description...`:`Generate PR title and description with AI`,H;p[22]===V?H=p[23]:(H=(0,h.jsx)(ne,{children:V}),p[22]=V,p[23]=H);let U;p[24]!==B||p[25]!==H?(U=(0,h.jsx)(n,{children:(0,h.jsxs)(te,{children:[B,H]})}),p[24]=B,p[25]=H,p[26]=U):U=p[26];let W;p[27]!==U||p[28]!==L?(W=(0,h.jsxs)(`div`,{className:`grid gap-2 flex-1 min-h-0`,children:[F,(0,h.jsxs)(`div`,{className:`relative flex-1 min-h-0`,children:[L,U]})]}),p[27]=U,p[28]=L,p[29]=W):W=p[29];let G;p[30]!==W||p[31]!==P?(G=(0,h.jsxs)(`div`,{className:`grid gap-4 py-4 flex-1 min-h-0`,children:[P,W]}),p[30]=W,p[31]=P,p[32]=G):G=p[32];let K;p[33]===O?K=p[34]:(K=e=>O(e===!0),p[33]=O,p[34]=K);let q;p[35]!==D||p[36]!==K?(q=(0,h.jsx)(ie,{id:`auto-generate-pr`,checked:D,onCheckedChange:K}),p[35]=D,p[36]=K,p[37]=q):q=p[37];let J;p[38]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,h.jsx)(r,{htmlFor:`auto-generate-pr`,className:s.labelNormal,children:`Auto generate PR title and description`}),p[38]=J):J=p[38];let Y;p[39]===q?Y=p[40]:(Y=(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[q,J]}),p[39]=q,p[40]=Y);let X=C?`Creating...`:`Create PR`,Z;p[41]!==C||p[42]!==T||p[43]!==X?(Z=(0,h.jsx)(o,{children:(0,h.jsx)(t,{onClick:T,disabled:C,children:X})}),p[41]=C,p[42]=T,p[43]=X,p[44]=Z):Z=p[44];let Q;p[45]!==G||p[46]!==A||p[47]!==Y||p[48]!==Z?(Q=(0,h.jsxs)(c,{className:`flex 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:h-[min(36rem,85dvh)]`,children:[A,G,Y,Z]}),p[45]=G,p[46]=A,p[47]=Y,p[48]=Z,p[49]=Q):Q=p[49];let $;return p[50]!==_||p[51]!==g||p[52]!==Q?($=(0,h.jsx)(i,{open:g,onOpenChange:_,children:Q}),p[50]=_,p[51]=g,p[52]=Q,p[53]=$):$=p[53],$}export{g as PullRequestDialog};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Fn as n,Go as r,Jn as i,Ko as a,Mi as o,Qn as s,Ua as c,Uo as l,Xi as u,Z as d,ls as f,n as ee,os as te,qr as ne,r as re,ro as ie,ss as p,uo as ae}from"./dialogs-config-BEazgV7k.js";import{a as oe,i as se,o as m,r as ce,s as h}from"./react-vendor-iDwBzcYF.js";import{C as le,D as ue,E as de,S as fe,b as pe}from"./history-view-BMVTxWTg.js";import{n as me}from"./utils-CECQ_-6N.js";import{t as he}from"./index-B4PyD4Io.js";var ge=p(),g=e(f(),1),_=te(),_e=g.forwardRef((e,t)=>{let n=(0,ge.c)(11),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(`relative flex w-full touch-none select-none items-center`,r),n[3]=r,n[4]=a);let s,c;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,_.jsx)(h,{className:`relative h-2 w-full grow overflow-hidden rounded-full bg-secondary`,children:(0,_.jsx)(se,{className:`absolute h-full bg-primary`})}),c=(0,_.jsx)(m,{className:`block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`}),n[5]=s,n[6]=c):(s=n[5],c=n[6]);let l;return n[7]!==i||n[8]!==t||n[9]!==a?(l=(0,_.jsxs)(oe,{ref:t,className:a,...i,children:[s,c]}),n[7]=i,n[8]=t,n[9]=a,n[10]=l):l=n[10],l});_e.displayName=oe.displayName;var v=50;function ve(){let[e,t]=(0,g.useState)(v),[r,i]=(0,g.useState)(v.toString()),[a,o]=(0,g.useState)(!0),[s,c]=(0,g.useState)(!1);(0,g.useEffect)(()=>{let e=!1;async function n(){try{let n=await d();e||(t(n.maximumTurnCount),i(n.maximumTurnCount.toString()))}catch(e){console.error(`Failed to load maximum turn count:`,e)}finally{e||o(!1)}}return n(),()=>{e=!0}},[]);function l(e){i(e)}async function u(e){c(!0);try{let r=await n({maximumTurnCount:e});t(r.maximumTurnCount),i(r.maximumTurnCount.toString())}catch(e){throw console.error(`Failed to update maximum turn count:`,e),e}finally{c(!1)}}function f(){i(e.toString())}return{defaultMaximumTurnCount:v,draftMaximumTurnCount:r,isLoading:a,isSaving:s,maximumTurnCount:e,resetDraftMaximumTurnCount:f,setDraftMaximumTurnCount:l,updateMaximumTurnCount:u}}function y(){return typeof navigator>`u`?!1:navigator.userAgentData?.platform===`macOS`?!0:navigator.platform.startsWith(`Mac`)}var b={isMacOS:!1,granted:!1,available:!1,message:``};function ye(){return{...b,isMacOS:y()}}function be(){let[e,t]=(0,g.useState)(ye),[n,r]=(0,g.useState)(!0),[a,o]=(0,g.useState)(null),[c,l]=(0,g.useState)(!1),[u,d]=(0,g.useState)(null),f=(0,g.useCallback)(async()=>{r(!0),o(null);try{t(await i(`api/system-permissions/screen-recording`))}catch(e){o(e instanceof Error?e.message:`Failed to check screen recording permission`),t(e=>({...b,isMacOS:e?.isMacOS??y(),message:`Unable to check permission status.`}))}finally{r(!1)}},[]);return(0,g.useEffect)(()=>{f()},[f]),{status:e,isLoading:n,error:a,isOpeningSettings:c,openSettingsError:u,refresh:f,openSystemSettings:(0,g.useCallback)(async()=>{l(!0),d(null);try{let e=await s(`api/system-permissions/screen-recording/open-settings`,{});if(!e.success){let t=e.message||`Failed to open System Settings`;console.error(`[useScreenRecordingPermission] ${t}`,e.error),d(t)}}catch(e){let t=e instanceof Error?e.message:`Failed to open System Settings`;console.error(`[useScreenRecordingPermission] Error opening System Settings:`,e),d(t)}finally{l(!1)}},[])}}var xe=`local`,x=`tarsk-server-bind-mode-changed`;function Se(){if(typeof window>`u`)return!1;try{return sessionStorage.getItem(x)===`true`}catch{return!1}}function Ce(e){if(!(typeof window>`u`))try{e?sessionStorage.setItem(x,`true`):sessionStorage.removeItem(x)}catch{}}function we(){let[e,t]=(0,g.useState)(xe),[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)([]),[s,c]=(0,g.useState)(!0),[l,u]=(0,g.useState)(!1),[f,ee]=(0,g.useState)(Se);(0,g.useEffect)(()=>{let e=!1;async function n(){try{let n=await d();e||(t(n.serverBindMode),i(n.serverBindMode),o(n.networkAddresses))}catch(e){console.error(`Failed to load server bind mode:`,e)}finally{e||c(!1)}}return n(),()=>{e=!0}},[]);async function te(e){u(!0);try{let r=await n({serverBindMode:e});t(r.serverBindMode),o(r.networkAddresses),ee(!0),Ce(!0)}catch(e){throw console.error(`Failed to update server bind mode:`,e),e}finally{u(!1)}}let ne=r!==null&&e!==r;return{defaultServerBindMode:xe,hasServerBindModeChanged:ne,isLoading:s,isSaving:l,needsRestart:ne||f,networkAddresses:a,serverBindMode:e,updateServerBindMode:te}}var Te=[{value:`local`,label:`No`},{value:`network`,label:`Yes`}],Ee=[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`system`,label:`System`}],De=[`462`,`8100`].includes(typeof document<`u`?document.location.port:``)?`462`:`641`,Oe=600;function S(e){let n=(0,ge.c)(113),{onboardingResetSignal:i}=e,s=i===void 0?0:i,[d,f]=(0,g.useState)(!1),{theme:te,setTheme:re}=me(),{scale:p,updateScale:oe,resetScale:se,min:m,max:h,default:v}=he(),{defaultMaximumTurnCount:y,draftMaximumTurnCount:b,isLoading:ye,isSaving:xe,resetDraftMaximumTurnCount:x,setDraftMaximumTurnCount:Se,updateMaximumTurnCount:Ce}=ve(),{status:S,isLoading:C,isOpeningSettings:je,openSettingsError:Me,refresh:Ne,openSystemSettings:Pe}=be(),{isLoading:Fe,isSaving:Ie,needsRestart:w,networkAddresses:T,serverBindMode:E,updateServerBindMode:Le}=we(),Re,ze;n[0]===s?(Re=n[1],ze=n[2]):(Re=()=>{if(s===0)return;f(!0);let e=setTimeout(()=>{f(!1)},Oe);return()=>{clearTimeout(e)}},ze=[s],n[0]=s,n[1]=Re,n[2]=ze),(0,g.useEffect)(Re,ze);let Be;n[3]===Se?Be=n[4]:(Be=function(e){Se(e.target.value)},n[3]=Se,n[4]=Be);let Ve=Be,He;n[5]!==y||n[6]!==b||n[7]!==x||n[8]!==Ce?(He=async function(){let e=Number.parseInt(b,10),t=Number.isFinite(e)&&e>0?e:y;try{await Ce(t)}catch{x()}},n[5]=y,n[6]=b,n[7]=x,n[8]=Ce,n[9]=He):He=n[9];let Ue=He,We;n[10]===oe?We=n[11]:(We=function(e){e.length>0&&oe(e[0])},n[10]=oe,n[11]=We);let Ge=We,Ke=d&&`animate-headline-reset`,D;n[12]===Ke?D=n[13]:(D=o(Ke),n[12]=Ke,n[13]=D);let O;n[14]===D?O=n[15]:(O=(0,_.jsx)(fe,{title:`General`,description:`Customize the appearance and behavior of Tarsk.`,titleClassName:D}),n[14]=D,n[15]=O);let qe,Je;n[16]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,_.jsx)(c,{className:`h-3.5 w-3.5`}),Je=(0,_.jsx)(`span`,{className:`sr-only`,children:`Reset font size to default`}),n[16]=qe,n[17]=Je):(qe=n[16],Je=n[17]);let k;n[18]===se?k=n[19]:(k=(0,_.jsxs)(t,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:se,children:[qe,Je]}),n[18]=se,n[19]=k);let Ye;n[20]===p?Ye=n[21]:(Ye=(0,_.jsxs)(`span`,{className:`${u.mono} tabular-nums w-12 text-right`,children:[p,`%`]}),n[20]=p,n[21]=Ye);let A;n[22]!==k||n[23]!==Ye?(A=(0,_.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[k,Ye]}),n[22]=k,n[23]=Ye,n[24]=A):A=n[24];let j;n[25]===m?j=n[26]:(j=(0,_.jsxs)(`span`,{className:`${u.bodyMuted} w-8 text-right`,children:[m,`%`]}),n[25]=m,n[26]=j);let M;n[27]===p?M=n[28]:(M=[p],n[27]=p,n[28]=M);let N;n[29]!==Ge||n[30]!==h||n[31]!==m||n[32]!==M?(N=(0,_.jsx)(_e,{value:M,min:m,max:h,step:5,onValueChange:Ge,"aria-label":`Font size`}),n[29]=Ge,n[30]=h,n[31]=m,n[32]=M,n[33]=N):N=n[33];let P;n[34]===h?P=n[35]:(P=(0,_.jsxs)(`span`,{className:`${u.bodyMuted} w-9`,children:[h,`%`]}),n[34]=h,n[35]=P);let F;n[36]!==j||n[37]!==N||n[38]!==P?(F=(0,_.jsxs)(`div`,{className:`flex items-center gap-3`,children:[j,N,P]}),n[36]=j,n[37]=N,n[38]=P,n[39]=F):F=n[39];let I;n[40]!==v||n[41]!==p?(I=p!==v&&(0,_.jsxs)(`p`,{className:`${u.bodyMuted} mt-2`,children:[`Font size has been changed from the default (`,v,`%).`]}),n[40]=v,n[41]=p,n[42]=I):I=n[42];let L;n[43]!==A||n[44]!==F||n[45]!==I?(L=(0,_.jsxs)(pe,{title:`Font Size`,description:`Adjust the text size across the entire application.`,action:A,children:[F,I]}),n[43]=A,n[44]=F,n[45]=I,n[46]=L):L=n[46];let R;n[47]===re?R=n[48]:(R=e=>{(e===`light`||e===`dark`||e===`system`)&&re(e)},n[47]=re,n[48]=R);let Xe;n[49]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=Ee.map(Ae),n[49]=Xe):Xe=n[49];let z;n[50]!==R||n[51]!==te?(z=(0,_.jsx)(pe,{title:`Appearance`,description:`Choose your preferred color scheme.`,children:(0,_.jsx)(ee,{type:`single`,value:te,onValueChange:R,"aria-label":`Appearance`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:Xe})}),n[50]=R,n[51]=te,n[52]=z):z=n[52];let B;n[53]===Ue?B=n[54]:(B=()=>{Ue()},n[53]=Ue,n[54]=B);let Ze=ye||xe,V;n[55]!==b||n[56]!==Ve||n[57]!==B||n[58]!==Ze?(V=(0,_.jsx)(ne,{type:`number`,min:1,step:1,value:b,onChange:Ve,onBlur:B,disabled:Ze,"aria-label":`Maximum turn count`,className:`w-28 text-right font-mono tabular-nums flex-shrink-0`}),n[55]=b,n[56]=Ve,n[57]=B,n[58]=Ze,n[59]=V):V=n[59];let H;n[60]===y?H=n[61]:(H=(0,_.jsxs)(`p`,{className:u.bodyMuted,children:[`Default: `,y,` turns.`]}),n[60]=y,n[61]=H);let U;n[62]!==V||n[63]!==H?(U=(0,_.jsx)(pe,{title:`Maximum Turn Count`,description:`Set how many turns a long-running agent chat can take before Tarsk asks whether to continue.`,action:V,children:H}),n[62]=V,n[63]=H,n[64]=U):U=n[64];let W;n[65]!==je||n[66]!==C||n[67]!==Pe||n[68]!==Ne||n[69]!==Me||n[70]!==S?.granted||n[71]!==S?.isMacOS||n[72]!==S?.message?(W=S?.isMacOS&&(0,_.jsx)(pe,{title:`Screen & System Audio Recording`,description:`Tarsk needs this macOS permission to capture screen content for browser tools and screen sharing features.`,action:(0,_.jsx)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:(0,_.jsxs)(t,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>void Ne(),disabled:C,children:[C?(0,_.jsx)(ae,{className:`h-3.5 w-3.5 animate-spin`}):(0,_.jsx)(c,{className:`h-3.5 w-3.5`}),(0,_.jsx)(`span`,{className:`sr-only`,children:`Refresh permission status`})]})}),children:(0,_.jsx)(`div`,{className:`flex items-center gap-3`,children:!C&&S?.granted?(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(r,{className:`h-4 w-4 text-green-500`}),(0,_.jsx)(`span`,{className:o(u.body,`text-green-600 dark:text-green-400`),children:`Permission granted`})]}):C?null:(0,_.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(l,{className:`h-4 w-4 text-amber-500`}),(0,_.jsx)(`span`,{className:o(u.body,`text-amber-600 dark:text-amber-400`),children:`Permission not granted`})]}),(0,_.jsx)(`p`,{className:u.bodyMuted,children:S?.message??`Tarsk needs Screen & System Audio Recording permission to use browser tools.`}),(0,_.jsx)(t,{size:`sm`,onClick:()=>void Pe(),disabled:je,className:`w-fit`,children:je?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(ae,{className:`h-4 w-4 mr-2 animate-spin`}),`Opening Settings...`]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(ie,{className:`h-4 w-4 mr-2`}),`Open System Settings`]})}),Me&&(0,_.jsxs)(`div`,{className:`flex items-start gap-2 p-3 rounded-md bg-destructive/10 text-destructive`,children:[(0,_.jsx)(a,{className:`h-4 w-4 mt-0.5 flex-shrink-0`}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,_.jsx)(`p`,{className:u.body,children:`Failed to open System Settings`}),(0,_.jsx)(`p`,{className:u.bodyMuted,children:Me}),(0,_.jsxs)(`p`,{className:u.bodyMuted,children:[`Please open it manually:`,` `,(0,_.jsx)(`strong`,{children:`System Settings > Privacy & Security > Screen & System Audio Recording`})]})]})]})]})})}),n[65]=je,n[66]=C,n[67]=Pe,n[68]=Ne,n[69]=Me,n[70]=S?.granted,n[71]=S?.isMacOS,n[72]=S?.message,n[73]=W):W=n[73];let Qe,$e;n[74]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,_.jsx)(le,{title:`Mobile & Network Access`,className:`mb-1`}),$e=(0,_.jsx)(`p`,{className:o(u.bodyMuted,`mb-3`),children:`Allow the Tarsk mobile app or other web browsers to access Tarsk on the wifi network.`}),n[74]=Qe,n[75]=$e):(Qe=n[74],$e=n[75]);let et=Fe||Ie,G;n[76]===Le?G=n[77]:(G=e=>{(e===`local`||e===`network`)&&Le(e)},n[76]=Le,n[77]=G);let tt;n[78]===Symbol.for(`react.memo_cache_sentinel`)?(tt=Te.map(ke),n[78]=tt):tt=n[78];let K;n[79]!==E||n[80]!==et||n[81]!==G?(K=(0,_.jsx)(ee,{type:`single`,value:E,disabled:et,onValueChange:G,"aria-label":`Server bind mode`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:tt}),n[79]=E,n[80]=et,n[81]=G,n[82]=K):K=n[82];let q;n[83]!==w||n[84]!==T||n[85]!==E?(q=E===`network`&&T.length>0&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`p`,{className:`${u.bodyMuted} mt-3`,children:[`Available on the network at:`,` `,(0,_.jsxs)(`span`,{className:u.mono,children:[`http://`,T[0],`:`,De]})]}),w&&(0,_.jsx)(`p`,{className:`${u.bodyMuted} mt-1`,children:`You will need to restart for this setting to take effect.`})]}),n[83]=w,n[84]=T,n[85]=E,n[86]=q):q=n[86];let J;n[87]!==T||n[88]!==E?(J=E===`network`&&T.length===0&&(0,_.jsx)(`p`,{className:`${u.bodyMuted} mt-3`,children:`No network IP addresses were detected on this computer.`}),n[87]=T,n[88]=E,n[89]=J):J=n[89];let Y;n[90]!==w||n[91]!==E?(Y=w&&E===`local`&&(0,_.jsxs)(`p`,{className:`${u.bodyMuted} mt-3`,children:[(0,_.jsx)(`br`,{}),`You will need to restart for this setting to take effect.`]}),n[90]=w,n[91]=E,n[92]=Y):Y=n[92];let X;n[93]!==K||n[94]!==q||n[95]!==J||n[96]!==Y?(X=(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[Qe,$e,K,q,J,Y]}),n[93]=K,n[94]=q,n[95]=J,n[96]=Y,n[97]=X):X=n[97];let Z;n[98]!==T||n[99]!==E?(Z=E===`network`&&T.length>0&&(0,_.jsxs)(`div`,{className:`hidden md:flex flex-col items-center gap-2 flex-shrink-0`,children:[(0,_.jsx)(ce,{value:`http://${T[0]}:${De}`,size:128,bgColor:`hsl(var(--background))`,fgColor:`hsl(var(--foreground))`,level:`M`}),(0,_.jsx)(`p`,{className:`${u.compact} text-muted-foreground text-center`,children:`Scan with the Tarsk Mobile App`})]}),n[98]=T,n[99]=E,n[100]=Z):Z=n[100];let Q;n[101]!==X||n[102]!==Z?(Q=(0,_.jsxs)(`div`,{className:`flex items-start gap-6`,children:[X,Z]}),n[101]=X,n[102]=Z,n[103]=Q):Q=n[103];let $;n[104]!==L||n[105]!==z||n[106]!==U||n[107]!==W||n[108]!==Q?($=(0,_.jsxs)(`div`,{className:`space-y-8`,children:[L,z,U,W,Q]}),n[104]=L,n[105]=z,n[106]=U,n[107]=W,n[108]=Q,n[109]=$):$=n[109];let nt;return n[110]!==$||n[111]!==O?(nt=(0,_.jsx)(ue,{children:(0,_.jsxs)(de,{children:[O,$]})}),n[110]=$,n[111]=O,n[112]=nt):nt=n[112],nt}function ke(e){return(0,_.jsx)(re,{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 Ae(e){return(0,_.jsx)(re,{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{S as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Fn as n,Go as r,Jn as i,Ko as a,Mi as o,Qn as s,Ua as c,Uo as l,Xi as u,Z as d,ls as f,n as ee,os as te,qr as ne,r as re,ro as ie,ss as p,uo as ae}from"./dialogs-config-BEazgV7k.js";import{a as oe,i as se,o as m,r as ce,s as h}from"./react-vendor-iDwBzcYF.js";import{C as le,D as ue,E as de,S as fe,b as pe}from"./history-view-BMVTxWTg.js";import{n as me}from"./utils-CECQ_-6N.js";import{t as he}from"./index-_SOdLUMq.js";var ge=p(),g=e(f(),1),_=te(),_e=g.forwardRef((e,t)=>{let n=(0,ge.c)(11),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=o(`relative flex w-full touch-none select-none items-center`,r),n[3]=r,n[4]=a);let s,c;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,_.jsx)(h,{className:`relative h-2 w-full grow overflow-hidden rounded-full bg-secondary`,children:(0,_.jsx)(se,{className:`absolute h-full bg-primary`})}),c=(0,_.jsx)(m,{className:`block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`}),n[5]=s,n[6]=c):(s=n[5],c=n[6]);let l;return n[7]!==i||n[8]!==t||n[9]!==a?(l=(0,_.jsxs)(oe,{ref:t,className:a,...i,children:[s,c]}),n[7]=i,n[8]=t,n[9]=a,n[10]=l):l=n[10],l});_e.displayName=oe.displayName;var v=50;function ve(){let[e,t]=(0,g.useState)(v),[r,i]=(0,g.useState)(v.toString()),[a,o]=(0,g.useState)(!0),[s,c]=(0,g.useState)(!1);(0,g.useEffect)(()=>{let e=!1;async function n(){try{let n=await d();e||(t(n.maximumTurnCount),i(n.maximumTurnCount.toString()))}catch(e){console.error(`Failed to load maximum turn count:`,e)}finally{e||o(!1)}}return n(),()=>{e=!0}},[]);function l(e){i(e)}async function u(e){c(!0);try{let r=await n({maximumTurnCount:e});t(r.maximumTurnCount),i(r.maximumTurnCount.toString())}catch(e){throw console.error(`Failed to update maximum turn count:`,e),e}finally{c(!1)}}function f(){i(e.toString())}return{defaultMaximumTurnCount:v,draftMaximumTurnCount:r,isLoading:a,isSaving:s,maximumTurnCount:e,resetDraftMaximumTurnCount:f,setDraftMaximumTurnCount:l,updateMaximumTurnCount:u}}function y(){return typeof navigator>`u`?!1:navigator.userAgentData?.platform===`macOS`?!0:navigator.platform.startsWith(`Mac`)}var b={isMacOS:!1,granted:!1,available:!1,message:``};function ye(){return{...b,isMacOS:y()}}function be(){let[e,t]=(0,g.useState)(ye),[n,r]=(0,g.useState)(!0),[a,o]=(0,g.useState)(null),[c,l]=(0,g.useState)(!1),[u,d]=(0,g.useState)(null),f=(0,g.useCallback)(async()=>{r(!0),o(null);try{t(await i(`api/system-permissions/screen-recording`))}catch(e){o(e instanceof Error?e.message:`Failed to check screen recording permission`),t(e=>({...b,isMacOS:e?.isMacOS??y(),message:`Unable to check permission status.`}))}finally{r(!1)}},[]);return(0,g.useEffect)(()=>{f()},[f]),{status:e,isLoading:n,error:a,isOpeningSettings:c,openSettingsError:u,refresh:f,openSystemSettings:(0,g.useCallback)(async()=>{l(!0),d(null);try{let e=await s(`api/system-permissions/screen-recording/open-settings`,{});if(!e.success){let t=e.message||`Failed to open System Settings`;console.error(`[useScreenRecordingPermission] ${t}`,e.error),d(t)}}catch(e){let t=e instanceof Error?e.message:`Failed to open System Settings`;console.error(`[useScreenRecordingPermission] Error opening System Settings:`,e),d(t)}finally{l(!1)}},[])}}var xe=`local`,x=`tarsk-server-bind-mode-changed`;function Se(){if(typeof window>`u`)return!1;try{return sessionStorage.getItem(x)===`true`}catch{return!1}}function Ce(e){if(!(typeof window>`u`))try{e?sessionStorage.setItem(x,`true`):sessionStorage.removeItem(x)}catch{}}function we(){let[e,t]=(0,g.useState)(xe),[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)([]),[s,c]=(0,g.useState)(!0),[l,u]=(0,g.useState)(!1),[f,ee]=(0,g.useState)(Se);(0,g.useEffect)(()=>{let e=!1;async function n(){try{let n=await d();e||(t(n.serverBindMode),i(n.serverBindMode),o(n.networkAddresses))}catch(e){console.error(`Failed to load server bind mode:`,e)}finally{e||c(!1)}}return n(),()=>{e=!0}},[]);async function te(e){u(!0);try{let r=await n({serverBindMode:e});t(r.serverBindMode),o(r.networkAddresses),ee(!0),Ce(!0)}catch(e){throw console.error(`Failed to update server bind mode:`,e),e}finally{u(!1)}}let ne=r!==null&&e!==r;return{defaultServerBindMode:xe,hasServerBindModeChanged:ne,isLoading:s,isSaving:l,needsRestart:ne||f,networkAddresses:a,serverBindMode:e,updateServerBindMode:te}}var Te=[{value:`local`,label:`No`},{value:`network`,label:`Yes`}],Ee=[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`system`,label:`System`}],De=[`462`,`8100`].includes(typeof document<`u`?document.location.port:``)?`462`:`641`,Oe=600;function S(e){let n=(0,ge.c)(113),{onboardingResetSignal:i}=e,s=i===void 0?0:i,[d,f]=(0,g.useState)(!1),{theme:te,setTheme:re}=me(),{scale:p,updateScale:oe,resetScale:se,min:m,max:h,default:v}=he(),{defaultMaximumTurnCount:y,draftMaximumTurnCount:b,isLoading:ye,isSaving:xe,resetDraftMaximumTurnCount:x,setDraftMaximumTurnCount:Se,updateMaximumTurnCount:Ce}=ve(),{status:S,isLoading:C,isOpeningSettings:je,openSettingsError:Me,refresh:Ne,openSystemSettings:Pe}=be(),{isLoading:Fe,isSaving:Ie,needsRestart:w,networkAddresses:T,serverBindMode:E,updateServerBindMode:Le}=we(),Re,ze;n[0]===s?(Re=n[1],ze=n[2]):(Re=()=>{if(s===0)return;f(!0);let e=setTimeout(()=>{f(!1)},Oe);return()=>{clearTimeout(e)}},ze=[s],n[0]=s,n[1]=Re,n[2]=ze),(0,g.useEffect)(Re,ze);let Be;n[3]===Se?Be=n[4]:(Be=function(e){Se(e.target.value)},n[3]=Se,n[4]=Be);let Ve=Be,He;n[5]!==y||n[6]!==b||n[7]!==x||n[8]!==Ce?(He=async function(){let e=Number.parseInt(b,10),t=Number.isFinite(e)&&e>0?e:y;try{await Ce(t)}catch{x()}},n[5]=y,n[6]=b,n[7]=x,n[8]=Ce,n[9]=He):He=n[9];let Ue=He,We;n[10]===oe?We=n[11]:(We=function(e){e.length>0&&oe(e[0])},n[10]=oe,n[11]=We);let Ge=We,Ke=d&&`animate-headline-reset`,D;n[12]===Ke?D=n[13]:(D=o(Ke),n[12]=Ke,n[13]=D);let O;n[14]===D?O=n[15]:(O=(0,_.jsx)(fe,{title:`General`,description:`Customize the appearance and behavior of Tarsk.`,titleClassName:D}),n[14]=D,n[15]=O);let qe,Je;n[16]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,_.jsx)(c,{className:`h-3.5 w-3.5`}),Je=(0,_.jsx)(`span`,{className:`sr-only`,children:`Reset font size to default`}),n[16]=qe,n[17]=Je):(qe=n[16],Je=n[17]);let k;n[18]===se?k=n[19]:(k=(0,_.jsxs)(t,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:se,children:[qe,Je]}),n[18]=se,n[19]=k);let Ye;n[20]===p?Ye=n[21]:(Ye=(0,_.jsxs)(`span`,{className:`${u.mono} tabular-nums w-12 text-right`,children:[p,`%`]}),n[20]=p,n[21]=Ye);let A;n[22]!==k||n[23]!==Ye?(A=(0,_.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[k,Ye]}),n[22]=k,n[23]=Ye,n[24]=A):A=n[24];let j;n[25]===m?j=n[26]:(j=(0,_.jsxs)(`span`,{className:`${u.bodyMuted} w-8 text-right`,children:[m,`%`]}),n[25]=m,n[26]=j);let M;n[27]===p?M=n[28]:(M=[p],n[27]=p,n[28]=M);let N;n[29]!==Ge||n[30]!==h||n[31]!==m||n[32]!==M?(N=(0,_.jsx)(_e,{value:M,min:m,max:h,step:5,onValueChange:Ge,"aria-label":`Font size`}),n[29]=Ge,n[30]=h,n[31]=m,n[32]=M,n[33]=N):N=n[33];let P;n[34]===h?P=n[35]:(P=(0,_.jsxs)(`span`,{className:`${u.bodyMuted} w-9`,children:[h,`%`]}),n[34]=h,n[35]=P);let F;n[36]!==j||n[37]!==N||n[38]!==P?(F=(0,_.jsxs)(`div`,{className:`flex items-center gap-3`,children:[j,N,P]}),n[36]=j,n[37]=N,n[38]=P,n[39]=F):F=n[39];let I;n[40]!==v||n[41]!==p?(I=p!==v&&(0,_.jsxs)(`p`,{className:`${u.bodyMuted} mt-2`,children:[`Font size has been changed from the default (`,v,`%).`]}),n[40]=v,n[41]=p,n[42]=I):I=n[42];let L;n[43]!==A||n[44]!==F||n[45]!==I?(L=(0,_.jsxs)(pe,{title:`Font Size`,description:`Adjust the text size across the entire application.`,action:A,children:[F,I]}),n[43]=A,n[44]=F,n[45]=I,n[46]=L):L=n[46];let R;n[47]===re?R=n[48]:(R=e=>{(e===`light`||e===`dark`||e===`system`)&&re(e)},n[47]=re,n[48]=R);let Xe;n[49]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=Ee.map(Ae),n[49]=Xe):Xe=n[49];let z;n[50]!==R||n[51]!==te?(z=(0,_.jsx)(pe,{title:`Appearance`,description:`Choose your preferred color scheme.`,children:(0,_.jsx)(ee,{type:`single`,value:te,onValueChange:R,"aria-label":`Appearance`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:Xe})}),n[50]=R,n[51]=te,n[52]=z):z=n[52];let B;n[53]===Ue?B=n[54]:(B=()=>{Ue()},n[53]=Ue,n[54]=B);let Ze=ye||xe,V;n[55]!==b||n[56]!==Ve||n[57]!==B||n[58]!==Ze?(V=(0,_.jsx)(ne,{type:`number`,min:1,step:1,value:b,onChange:Ve,onBlur:B,disabled:Ze,"aria-label":`Maximum turn count`,className:`w-28 text-right font-mono tabular-nums flex-shrink-0`}),n[55]=b,n[56]=Ve,n[57]=B,n[58]=Ze,n[59]=V):V=n[59];let H;n[60]===y?H=n[61]:(H=(0,_.jsxs)(`p`,{className:u.bodyMuted,children:[`Default: `,y,` turns.`]}),n[60]=y,n[61]=H);let U;n[62]!==V||n[63]!==H?(U=(0,_.jsx)(pe,{title:`Maximum Turn Count`,description:`Set how many turns a long-running agent chat can take before Tarsk asks whether to continue.`,action:V,children:H}),n[62]=V,n[63]=H,n[64]=U):U=n[64];let W;n[65]!==je||n[66]!==C||n[67]!==Pe||n[68]!==Ne||n[69]!==Me||n[70]!==S?.granted||n[71]!==S?.isMacOS||n[72]!==S?.message?(W=S?.isMacOS&&(0,_.jsx)(pe,{title:`Screen & System Audio Recording`,description:`Tarsk needs this macOS permission to capture screen content for browser tools and screen sharing features.`,action:(0,_.jsx)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:(0,_.jsxs)(t,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>void Ne(),disabled:C,children:[C?(0,_.jsx)(ae,{className:`h-3.5 w-3.5 animate-spin`}):(0,_.jsx)(c,{className:`h-3.5 w-3.5`}),(0,_.jsx)(`span`,{className:`sr-only`,children:`Refresh permission status`})]})}),children:(0,_.jsx)(`div`,{className:`flex items-center gap-3`,children:!C&&S?.granted?(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(r,{className:`h-4 w-4 text-green-500`}),(0,_.jsx)(`span`,{className:o(u.body,`text-green-600 dark:text-green-400`),children:`Permission granted`})]}):C?null:(0,_.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(l,{className:`h-4 w-4 text-amber-500`}),(0,_.jsx)(`span`,{className:o(u.body,`text-amber-600 dark:text-amber-400`),children:`Permission not granted`})]}),(0,_.jsx)(`p`,{className:u.bodyMuted,children:S?.message??`Tarsk needs Screen & System Audio Recording permission to use browser tools.`}),(0,_.jsx)(t,{size:`sm`,onClick:()=>void Pe(),disabled:je,className:`w-fit`,children:je?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(ae,{className:`h-4 w-4 mr-2 animate-spin`}),`Opening Settings...`]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(ie,{className:`h-4 w-4 mr-2`}),`Open System Settings`]})}),Me&&(0,_.jsxs)(`div`,{className:`flex items-start gap-2 p-3 rounded-md bg-destructive/10 text-destructive`,children:[(0,_.jsx)(a,{className:`h-4 w-4 mt-0.5 flex-shrink-0`}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,_.jsx)(`p`,{className:u.body,children:`Failed to open System Settings`}),(0,_.jsx)(`p`,{className:u.bodyMuted,children:Me}),(0,_.jsxs)(`p`,{className:u.bodyMuted,children:[`Please open it manually:`,` `,(0,_.jsx)(`strong`,{children:`System Settings > Privacy & Security > Screen & System Audio Recording`})]})]})]})]})})}),n[65]=je,n[66]=C,n[67]=Pe,n[68]=Ne,n[69]=Me,n[70]=S?.granted,n[71]=S?.isMacOS,n[72]=S?.message,n[73]=W):W=n[73];let Qe,$e;n[74]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,_.jsx)(le,{title:`Mobile & Network Access`,className:`mb-1`}),$e=(0,_.jsx)(`p`,{className:o(u.bodyMuted,`mb-3`),children:`Allow the Tarsk mobile app or other web browsers to access Tarsk on the wifi network.`}),n[74]=Qe,n[75]=$e):(Qe=n[74],$e=n[75]);let et=Fe||Ie,G;n[76]===Le?G=n[77]:(G=e=>{(e===`local`||e===`network`)&&Le(e)},n[76]=Le,n[77]=G);let tt;n[78]===Symbol.for(`react.memo_cache_sentinel`)?(tt=Te.map(ke),n[78]=tt):tt=n[78];let K;n[79]!==E||n[80]!==et||n[81]!==G?(K=(0,_.jsx)(ee,{type:`single`,value:E,disabled:et,onValueChange:G,"aria-label":`Server bind mode`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:tt}),n[79]=E,n[80]=et,n[81]=G,n[82]=K):K=n[82];let q;n[83]!==w||n[84]!==T||n[85]!==E?(q=E===`network`&&T.length>0&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`p`,{className:`${u.bodyMuted} mt-3`,children:[`Available on the network at:`,` `,(0,_.jsxs)(`span`,{className:u.mono,children:[`http://`,T[0],`:`,De]})]}),w&&(0,_.jsx)(`p`,{className:`${u.bodyMuted} mt-1`,children:`You will need to restart for this setting to take effect.`})]}),n[83]=w,n[84]=T,n[85]=E,n[86]=q):q=n[86];let J;n[87]!==T||n[88]!==E?(J=E===`network`&&T.length===0&&(0,_.jsx)(`p`,{className:`${u.bodyMuted} mt-3`,children:`No network IP addresses were detected on this computer.`}),n[87]=T,n[88]=E,n[89]=J):J=n[89];let Y;n[90]!==w||n[91]!==E?(Y=w&&E===`local`&&(0,_.jsxs)(`p`,{className:`${u.bodyMuted} mt-3`,children:[(0,_.jsx)(`br`,{}),`You will need to restart for this setting to take effect.`]}),n[90]=w,n[91]=E,n[92]=Y):Y=n[92];let X;n[93]!==K||n[94]!==q||n[95]!==J||n[96]!==Y?(X=(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[Qe,$e,K,q,J,Y]}),n[93]=K,n[94]=q,n[95]=J,n[96]=Y,n[97]=X):X=n[97];let Z;n[98]!==T||n[99]!==E?(Z=E===`network`&&T.length>0&&(0,_.jsxs)(`div`,{className:`hidden md:flex flex-col items-center gap-2 flex-shrink-0`,children:[(0,_.jsx)(ce,{value:`http://${T[0]}:${De}`,size:128,bgColor:`hsl(var(--background))`,fgColor:`hsl(var(--foreground))`,level:`M`}),(0,_.jsx)(`p`,{className:`${u.compact} text-muted-foreground text-center`,children:`Scan with the Tarsk Mobile App`})]}),n[98]=T,n[99]=E,n[100]=Z):Z=n[100];let Q;n[101]!==X||n[102]!==Z?(Q=(0,_.jsxs)(`div`,{className:`flex items-start gap-6`,children:[X,Z]}),n[101]=X,n[102]=Z,n[103]=Q):Q=n[103];let $;n[104]!==L||n[105]!==z||n[106]!==U||n[107]!==W||n[108]!==Q?($=(0,_.jsxs)(`div`,{className:`space-y-8`,children:[L,z,U,W,Q]}),n[104]=L,n[105]=z,n[106]=U,n[107]=W,n[108]=Q,n[109]=$):$=n[109];let nt;return n[110]!==$||n[111]!==O?(nt=(0,_.jsx)(ue,{children:(0,_.jsxs)(de,{children:[O,$]})}),n[110]=$,n[111]=O,n[112]=nt):nt=n[112],nt}function ke(e){return(0,_.jsx)(re,{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 Ae(e){return(0,_.jsx)(re,{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{S as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,It as n,Mi as r,Xi as i,ls as a,os as o,uo as s,xn as c}from"./dialogs-config-BEazgV7k.js";import{E as l,S as u,T as d,w as f}from"./history-view-BMVTxWTg.js";import{I as p,P as m,R as h}from"./index-B4PyD4Io.js";var g=e(a(),1),_=o();function v(){let e=h(e=>e.selectedThreadId),[a,o]=(0,g.useState)(``),[v,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(!1);(0,g.useEffect)(()=>{e&&(y(!0),n(e,`AGENTS.md`).then(e=>o(e.content)).catch(()=>o(``)).finally(()=>y(!1)))},[e]);async function S(){if(e){x(!0);try{await c(e,`AGENTS.md`,a),m({title:`Instructions saved`})}catch(e){m({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)(t,{onClick:S,disabled:v||b,children:b?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(s,{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)(s,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,_.jsx)(p,{value:a,onChange:e=>o(e.target.value),className:r(i.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
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,It as n,Mi as r,Xi as i,ls as a,os as o,uo as s,xn as c}from"./dialogs-config-BEazgV7k.js";import{E as l,S as u,T as d,w as f}from"./history-view-BMVTxWTg.js";import{I as p,P as m,R as h}from"./index-_SOdLUMq.js";var g=e(a(),1),_=o();function v(){let e=h(e=>e.selectedThreadId),[a,o]=(0,g.useState)(``),[v,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(!1);(0,g.useEffect)(()=>{e&&(y(!0),n(e,`AGENTS.md`).then(e=>o(e.content)).catch(()=>o(``)).finally(()=>y(!1)))},[e]);async function S(){if(e){x(!0);try{await c(e,`AGENTS.md`,a),m({title:`Instructions saved`})}catch(e){m({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)(t,{onClick:S,disabled:v||b,children:b?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(s,{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)(s,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,_.jsx)(p,{value:a,onChange:e=>o(e.target.value),className:r(i.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,4 +1,4 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Ea as n,Fr as r,Ir as i,Jr as a,La as o,M as s,Mi as c,Nr as l,Pr as u,Xi as d,Xr as f,_n as p,ft as m,gt as h,ls as g,os as _,qa as v,qr as y,ss as b,ya as x}from"./dialogs-config-BEazgV7k.js";import{A as S,C,D as ee,E as w,F as T,M as E,N as D,O,P as k,S as te,T as A,b as j,d as M,f as N,g as P,h as F,j as I,k as L,p as R,y as z}from"./history-view-BMVTxWTg.js";import{A as B,I as V,P as H,R as U,j as W}from"./index-B4PyD4Io.js";import{t as G}from"./skeleton-6mGMglV0.js";import{i as K,n as q,r as ne,t as re}from"./tabs-iUSYYupj.js";import{i as ie,n as ae,r as oe,t as J}from"./settings-list-owWkHWxE.js";import{t as se}from"./mcp-server-card-ChdAZekt.js";var Y=b(),X=e(g(),1);function ce(e){let[t,n]=(0,X.useState)([]),[r,i]=(0,X.useState)(!1),a=(0,X.useCallback)(async()=>{if(e){i(!0);try{let t=await m(e);n(Object.entries(t.servers??{}).map(([e,t])=>({name:e,config:t})))}catch{n([])}finally{i(!1)}}},[e]);return(0,X.useEffect)(()=>{a()},[a]),{installedServers:t,loadingConfig:r,loadInstalledServers:a}}function le(){let e=(0,Y.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,X.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,X.useEffect)(i,a);let o;return e[3]===n?o=e[4]:(o={popularServers:n},e[3]=n,e[4]=o),o}async function Z(e,t,n){await p(e,t,n)}async function ue(e,t){await s(e,t)}var Q=_();function $(e){return e?.url?`remote`:`local`}function de(e){return Object.entries(e??{}).map(([e,t])=>({key:e,value:t}))}function fe({projectPath:e,serverName:n,initialName:r,initialConfig:i,onBack:a}){let{installedServers:o}=ce(e),s=!!n,[c,l]=(0,X.useState)(`local`),[u,f]=(0,X.useState)(``),[p,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(``),[_,b]=(0,X.useState)(``),[S,C]=(0,X.useState)(`sse`),[w,T]=(0,X.useState)([]),[E,D]=(0,X.useState)([]),[O,k]=(0,X.useState)(!1),[A,I]=(0,X.useState)(!1),[L,B]=(0,X.useState)(null),[U,W]=(0,X.useState)(s),[G,ie]=(0,X.useState)(``),[ae,oe]=(0,X.useState)(``);function J(e,t){let n=$(t);l(n),f(e),m(t.command??``),g((t.args??[]).join(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Ea as n,Fr as r,Ir as i,Jr as a,La as o,M as s,Mi as c,Nr as l,Pr as u,Xi as d,Xr as f,_n as p,ft as m,gt as h,ls as g,os as _,qa as v,qr as y,ss as b,ya as x}from"./dialogs-config-BEazgV7k.js";import{A as S,C,D as ee,E as w,F as T,M as E,N as D,O,P as k,S as te,T as A,b as j,d as M,f as N,g as P,h as F,j as I,k as L,p as R,y as z}from"./history-view-BMVTxWTg.js";import{A as B,I as V,P as H,R as U,j as W}from"./index-_SOdLUMq.js";import{t as G}from"./skeleton-6mGMglV0.js";import{i as K,n as q,r as ne,t as re}from"./tabs-iUSYYupj.js";import{i as ie,n as ae,r as oe,t as J}from"./settings-list-owWkHWxE.js";import{t as se}from"./mcp-server-card-ChdAZekt.js";var Y=b(),X=e(g(),1);function ce(e){let[t,n]=(0,X.useState)([]),[r,i]=(0,X.useState)(!1),a=(0,X.useCallback)(async()=>{if(e){i(!0);try{let t=await m(e);n(Object.entries(t.servers??{}).map(([e,t])=>({name:e,config:t})))}catch{n([])}finally{i(!1)}}},[e]);return(0,X.useEffect)(()=>{a()},[a]),{installedServers:t,loadingConfig:r,loadInstalledServers:a}}function le(){let e=(0,Y.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,X.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,X.useEffect)(i,a);let o;return e[3]===n?o=e[4]:(o={popularServers:n},e[3]=n,e[4]=o),o}async function Z(e,t,n){await p(e,t,n)}async function ue(e,t){await s(e,t)}var Q=_();function $(e){return e?.url?`remote`:`local`}function de(e){return Object.entries(e??{}).map(([e,t])=>({key:e,value:t}))}function fe({projectPath:e,serverName:n,initialName:r,initialConfig:i,onBack:a}){let{installedServers:o}=ce(e),s=!!n,[c,l]=(0,X.useState)(`local`),[u,f]=(0,X.useState)(``),[p,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(``),[_,b]=(0,X.useState)(``),[S,C]=(0,X.useState)(`sse`),[w,T]=(0,X.useState)([]),[E,D]=(0,X.useState)([]),[O,k]=(0,X.useState)(!1),[A,I]=(0,X.useState)(!1),[L,B]=(0,X.useState)(null),[U,W]=(0,X.useState)(s),[G,ie]=(0,X.useState)(``),[ae,oe]=(0,X.useState)(``);function J(e,t){let n=$(t);l(n),f(e),m(t.command??``),g((t.args??[]).join(`
2
2
  `)),b(t.url??``),C(t.transport??`sse`),T(de(t.env)),D(de(t.headers)),ie(e),oe(JSON.stringify({name:e,type:n,config:t}))}(0,X.useEffect)(()=>{if(s&&n){let e=o.find(e=>e.name===n);e&&(J(e.name,e.config),W(!1))}else i&&J(r??``,i),W(!1)},[o,n,s,i,r]);let se=(0,X.useCallback)(()=>{T(e=>[...e,{key:``,value:``}])},[]),Y=(0,X.useCallback)(e=>{T(t=>t.filter((t,n)=>n!==e))},[]),le=(0,X.useCallback)((e,t)=>{T(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),fe=(0,X.useCallback)((e,t)=>{T(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]),pe=(0,X.useCallback)(()=>{D(e=>[...e,{key:``,value:``}])},[]),me=(0,X.useCallback)(e=>{D(t=>t.filter((t,n)=>n!==e))},[]),he=(0,X.useCallback)((e,t)=>{D(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),ge=(0,X.useCallback)((e,t)=>{D(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]);function _e(e){let t={};for(let{key:n,value:r}of e)n.trim()&&(t[n.trim()]=r);return Object.keys(t).length>0?t:void 0}function ve(){let e=_e(w);if(c===`remote`){let t=_e(E);return{url:_.trim(),transport:S,...t?{headers:t}:{},...e?{env:e}:{}}}let t=h.split(`
3
3
  `).map(e=>e.trim()).filter(Boolean);return{command:p.trim(),args:t,...e?{env:e}:{}}}let ye=JSON.stringify({name:u.trim(),type:c,config:ve()}),be=async()=>{B(null);let t=u.trim();if(!t){B(`Server name is required`);return}if(c===`remote`){if(!_.trim()){B(`Server URL is required`);return}try{new URL(_.trim())}catch{B(`Server URL must be a valid URL`);return}}else if(!p.trim()){B(`Command is required`);return}k(!0);try{if(!e)throw Error(`No project path`);await Z(e,G||t,ve()),H({title:`Success`,description:s?`MCP server configuration saved`:`MCP server added`}),a()}catch(e){B(e instanceof Error?e.message:`Failed to save server`)}finally{k(!1)}},xe=async()=>{if(e){I(!0);try{await ue(e,G),H({title:`Success`,description:`MCP server removed`}),a()}catch(e){B(e instanceof Error?e.message:`Failed to delete server`)}finally{I(!1)}}},Se=s?ye!==ae:u.trim()!==``||p.trim()!==``||h.trim()!==``||_.trim()!==``||w.length>0||E.length>0;return U?(0,Q.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Q.jsx)(`p`,{className:d.bodyMuted,children:`Loading server configuration...`})}):(0,Q.jsx)(ee,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)(te,{title:s?u:`Add MCP Server`,description:s?`Edit MCP Server configuration.`:`Configure a new MCP Server.`}),(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(j,{title:`Server name`,description:s?`Server name cannot be changed`:void 0,children:(0,Q.jsx)(y,{id:`server-name`,placeholder:`e.g. filesystem`,value:u,onChange:e=>f(e.target.value),disabled:s})}),(0,Q.jsxs)(re,{value:c,onValueChange:e=>l(e),className:`w-full`,children:[(0,Q.jsxs)(ne,{className:`grid w-full grid-cols-2`,children:[(0,Q.jsx)(K,{value:`local`,children:`Local (stdio)`}),(0,Q.jsx)(K,{value:`remote`,children:`Remote (HTTP/SSE)`})]}),(0,Q.jsxs)(q,{value:`local`,className:`space-y-6 mt-6`,children:[(0,Q.jsx)(j,{title:`Command`,children:(0,Q.jsx)(y,{id:`server-command`,placeholder:`e.g. npx`,value:p,onChange:e=>m(e.target.value)})}),(0,Q.jsx)(j,{title:`Arguments`,description:`One argument per line`,children:(0,Q.jsx)(V,{id:`server-args`,placeholder:`-y
4
4
  @modelcontextprotocol/server-filesystem
@@ -1,4 +1,4 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Ba as n,Ea as r,Fr as i,Ir as a,Jr as o,Lt as s,Mi as c,Nr as l,P as u,Pr as d,R as f,St as p,Xi as m,Xr as ee,_t as te,en as h,ls as g,os as _,qr as v,ss as y,xn as b}from"./dialogs-config-BEazgV7k.js";import{n as x,t as S}from"./react-vendor-iDwBzcYF.js";import{A as ne,C,D as w,E as re,F as ie,M as ae,N as oe,O as se,P as ce,S as T,T as E,b as D,j as le,k as O,x as ue,y as k}from"./history-view-BMVTxWTg.js";import{A as de,I as A,P as j,R as M,j as fe}from"./index-B4PyD4Io.js";import{t as N}from"./skeleton-6mGMglV0.js";import{t as pe}from"./use-deferred-search-DGJskNBr.js";import{i as me,n as he,r as P,t as F}from"./settings-list-owWkHWxE.js";import{t as I}from"./mcp-server-card-ChdAZekt.js";import{i as L,n as R,r as z,t as ge}from"./slug-utils-BT1eqWhW.js";var B=y(),V=e(g(),1),H=_(),U=V.forwardRef((e,t)=>{let n=(0,B.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=c(`peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,H.jsx)(x,{className:c(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`)}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,H.jsx)(S,{className:a,...i,ref:t,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});U.displayName=S.displayName;function _e({threadId:e,onRuleCreated:t}){let[n,r]=(0,V.useState)(``),[i,a]=(0,V.useState)(``),[o,s]=(0,V.useState)(!1),[l,u]=(0,V.useState)(!1),d=z(n),f=R(d),p=async()=>{if(!(!f||!e)){u(!0);try{let n=`---
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Ba as n,Ea as r,Fr as i,Ir as a,Jr as o,Lt as s,Mi as c,Nr as l,P as u,Pr as d,R as f,St as p,Xi as m,Xr as ee,_t as te,en as h,ls as g,os as _,qr as v,ss as y,xn as b}from"./dialogs-config-BEazgV7k.js";import{n as x,t as S}from"./react-vendor-iDwBzcYF.js";import{A as ne,C,D as w,E as re,F as ie,M as ae,N as oe,O as se,P as ce,S as T,T as E,b as D,j as le,k as O,x as ue,y as k}from"./history-view-BMVTxWTg.js";import{A as de,I as A,P as j,R as M,j as fe}from"./index-_SOdLUMq.js";import{t as N}from"./skeleton-6mGMglV0.js";import{t as pe}from"./use-deferred-search-DGJskNBr.js";import{i as me,n as he,r as P,t as F}from"./settings-list-owWkHWxE.js";import{t as I}from"./mcp-server-card-ChdAZekt.js";import{i as L,n as R,r as z,t as ge}from"./slug-utils-BT1eqWhW.js";var B=y(),V=e(g(),1),H=_(),U=V.forwardRef((e,t)=>{let n=(0,B.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=c(`peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,H.jsx)(x,{className:c(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`)}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,H.jsx)(S,{className:a,...i,ref:t,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});U.displayName=S.displayName;function _e({threadId:e,onRuleCreated:t}){let[n,r]=(0,V.useState)(``),[i,a]=(0,V.useState)(``),[o,s]=(0,V.useState)(!1),[l,u]=(0,V.useState)(!1),d=z(n),f=R(d),p=async()=>{if(!(!f||!e)){u(!0);try{let n=`---
2
2
  description: ${i.trim()}
3
3
  alwaysApply: ${o}
4
4
  ---
@@ -1,3 +1,3 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$r as t,$t as n,Ai as r,Ar as i,Do as a,Ea as o,F as s,Fr as c,Gr as l,Ir as u,Jr as d,Li as f,Lt as p,Mi as m,Mr as h,Mt as g,Nr as _,P as v,Pr as y,Qr as b,Qt as x,R as S,Sr as C,St as w,Un as T,Vn as E,Xa as D,Xi as O,Xr as k,Zr as A,ba as j,br as M,ei as N,jt as P,k as F,lr as I,ls as L,mr as ee,nt as R,os as te,qa as ne,qr as z,ss as B,tt as re,uo as V,ur as H,vt as ie,xn as ae}from"./dialogs-config-BEazgV7k.js";import{A as oe,C as se,D as ce,E as le,F as ue,M as de,N as fe,O as pe,P as me,S as he,T as ge,b as U,d as _e,f as ve,g as ye,h as be,j as xe,k as Se,l as Ce,p as we,x as Te,y as Ee}from"./history-view-BMVTxWTg.js";import{d as De}from"./onboarding-Bi5MieW-.js";import{A as Oe,I as ke,M as Ae,P as W,R as je,j as Me}from"./index-B4PyD4Io.js";import{t as G}from"./skeleton-6mGMglV0.js";import{t as Ne}from"./use-deferred-search-DGJskNBr.js";import{a as Pe,n as Fe,r as Ie,t as Le}from"./settings-list-owWkHWxE.js";import{t as Re}from"./mcp-server-card-ChdAZekt.js";import{i as K,n as ze,r as q,t as Be}from"./slug-utils-BT1eqWhW.js";var J=e(L(),1),Y=te();function Ve({threadId:e,onSkillCreated:t}){let[n,r]=(0,J.useState)(``),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(!1),c=q(n),l=ze(c),u=async()=>{if(!(!l||!i.trim()||!e)){s(!0);try{let n=await F(e,c,i.trim());W({title:`Skill created`,description:`Skill '${c}' was created successfully.`}),r(``),a(``),t?.(n.path,`SKILL.md`)}catch(e){W({title:`Error`,description:e instanceof Error?e.message:`Failed to create skill`,variant:`destructive`})}finally{s(!1)}}};return e?(0,Y.jsx)(ce,{children:(0,Y.jsxs)(Ee,{children:[(0,Y.jsx)(he,{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,Y.jsxs)(`div`,{className:`space-y-6`,children:[(0,Y.jsxs)(U,{title:`Skill Name`,children:[(0,Y.jsx)(z,{id:`skillName`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Code Review`,disabled:o}),n?(0,Y.jsxs)(`p`,{className:m(O.caption,`mt-2`),children:[`Folder name: `,(0,Y.jsx)(`span`,{className:`font-mono`,children:c||`...`})]}):null]}),(0,Y.jsx)(U,{title:`Description`,children:(0,Y.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,Y.jsx)(K,{onContinue:()=>void u(),disabled:!l||!i.trim(),creating:o})]})]})}):(0,Y.jsx)(ge,{title:`No thread selected`,children:`Please select a thread to add a skill.`})}function X(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(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$r as t,$t as n,Ai as r,Ar as i,Do as a,Ea as o,F as s,Fr as c,Gr as l,Ir as u,Jr as d,Li as f,Lt as p,Mi as m,Mr as h,Mt as g,Nr as _,P as v,Pr as y,Qr as b,Qt as x,R as S,Sr as C,St as w,Un as T,Vn as E,Xa as D,Xi as O,Xr as k,Zr as A,ba as j,br as M,ei as N,jt as P,k as F,lr as I,ls as L,mr as ee,nt as R,os as te,qa as ne,qr as z,ss as B,tt as re,uo as V,ur as H,vt as ie,xn as ae}from"./dialogs-config-BEazgV7k.js";import{A as oe,C as se,D as ce,E as le,F as ue,M as de,N as fe,O as pe,P as me,S as he,T as ge,b as U,d as _e,f as ve,g as ye,h as be,j as xe,k as Se,l as Ce,p as we,x as Te,y as Ee}from"./history-view-BMVTxWTg.js";import{d as De}from"./onboarding-Bi5MieW-.js";import{A as Oe,I as ke,M as Ae,P as W,R as je,j as Me}from"./index-_SOdLUMq.js";import{t as G}from"./skeleton-6mGMglV0.js";import{t as Ne}from"./use-deferred-search-DGJskNBr.js";import{a as Pe,n as Fe,r as Ie,t as Le}from"./settings-list-owWkHWxE.js";import{t as Re}from"./mcp-server-card-ChdAZekt.js";import{i as K,n as ze,r as q,t as Be}from"./slug-utils-BT1eqWhW.js";var J=e(L(),1),Y=te();function Ve({threadId:e,onSkillCreated:t}){let[n,r]=(0,J.useState)(``),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(!1),c=q(n),l=ze(c),u=async()=>{if(!(!l||!i.trim()||!e)){s(!0);try{let n=await F(e,c,i.trim());W({title:`Skill created`,description:`Skill '${c}' was created successfully.`}),r(``),a(``),t?.(n.path,`SKILL.md`)}catch(e){W({title:`Error`,description:e instanceof Error?e.message:`Failed to create skill`,variant:`destructive`})}finally{s(!1)}}};return e?(0,Y.jsx)(ce,{children:(0,Y.jsxs)(Ee,{children:[(0,Y.jsx)(he,{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,Y.jsxs)(`div`,{className:`space-y-6`,children:[(0,Y.jsxs)(U,{title:`Skill Name`,children:[(0,Y.jsx)(z,{id:`skillName`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Code Review`,disabled:o}),n?(0,Y.jsxs)(`p`,{className:m(O.caption,`mt-2`),children:[`Folder name: `,(0,Y.jsx)(`span`,{className:`font-mono`,children:c||`...`})]}):null]}),(0,Y.jsx)(U,{title:`Description`,children:(0,Y.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,Y.jsx)(K,{onContinue:()=>void u(),disabled:!l||!i.trim(),creating:o})]})]})}):(0,Y.jsx)(ge,{title:`No thread selected`,children:`Please select a thread to add a skill.`})}function X(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
2
  `)}function Z(e){return e.endsWith(`.md`)||e.endsWith(`.mdx`)}function He(e){return e.includes(`SKILL.md`)?`SKILL.md`:e[0]??`SKILL.md`}function Q(e,t){let n=e?.sourceId??t;if(!(!n||n==="default"))return n}function Ue({open:e,onOpenChange:n,skill:i,catalogSourceId:o,onInstall:s}){let[c,l]=(0,J.useState)([]),[u,f]=(0,J.useState)(null),[p,h]=(0,J.useState)(``),[g,_]=(0,J.useState)(!1),[v,y]=(0,J.useState)(!1),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(!1),T=Q(i,o),E=!!T;(0,J.useEffect)(()=>{if(!e||!i)return;let t=i,n=Q(t,o),r=!1;async function a(){_(!0),S(null),l([]),f(null),h(``);try{if(n){let e=await R(n,t.id);if(r)return;l(e.files),f(He(e.files))}else{if(r)return;l([`SKILL.md`]),f(`SKILL.md`),h(X(t))}}catch(e){if(r)return;S(e instanceof Error?e.message:`Failed to load skill files`)}finally{r||_(!1)}}return a(),()=>{r=!0}},[e,i,o]),(0,J.useEffect)(()=>{if(!e||!i||!u||!E||!T)return;let t=i,n=u,r=!1;async function a(){y(!0),S(null);try{let e=await re(T,t.id,n);if(r)return;h(e.content)}catch(e){if(r)return;S(e instanceof Error?e.message:`Failed to load file`),h(``)}finally{r||y(!1)}}return a(),()=>{r=!0}},[e,i,u,E,T]);let D=(0,J.useCallback)(async()=>{if(!i)return;let e=T?{...i,sourceId:T}:i;w(!0);try{await s(e),n(!1)}finally{w(!1)}},[i,T,s,n]),j=g||E&&v,M=u?Z(u):!1,P=(0,J.useMemo)(()=>c.map(e=>(0,Y.jsxs)(De,{selected:e===u,onClick:()=>f(e),className:`gap-2 cursor-pointer`,children:[(0,Y.jsx)(a,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:m(O.caption,`truncate`),children:e})]},e)),[c,u]);return(0,Y.jsx)(d,{open:e,onOpenChange:n,children:(0,Y.jsxs)(k,{className:`flex max-h-[90vh] max-w-5xl flex-col gap-0 overflow-hidden p-0`,children:[(0,Y.jsxs)(t,{className:`border-b border-border px-6 py-4`,children:[(0,Y.jsx)(N,{children:i?.name??`Review skill`}),i?.description?(0,Y.jsx)(A,{children:i.description}):null]}),(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,Y.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,Y.jsx)(`div`,{className:m(O.labelMuted,`px-3 py-2`),children:`Files`}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-1 pb-2`,children:g?(0,Y.jsx)(Ce,{className:`py-8`,label:`Loading files...`}):c.length===0?(0,Y.jsx)(`p`,{className:m(O.caption,`px-3 py-2 text-muted-foreground`),children:`No files found.`}):P})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-4`,children:x?(0,Y.jsx)(`p`,{className:m(O.body,`text-destructive`),children:x}):j?(0,Y.jsx)(Ce,{className:`py-12`,label:`Loading preview...`}):M?(0,Y.jsx)(Ae,{content:p,enableMermaid:!1}):(0,Y.jsx)(`pre`,{className:m(O.caption,`overflow-x-auto whitespace-pre-wrap font-mono`),children:p})})]}),(0,Y.jsxs)(b,{className:`border-t border-border px-6 py-4 sm:justify-between`,children:[(0,Y.jsx)(r,{type:`button`,variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Y.jsx)(r,{type:`button`,onClick:()=>void D(),disabled:C||!i,children:C?`Installing...`:`Install`})]})]})})}var We=B(),$=new Map;function Ge(e){let t=$.get(e);if(t)return t;let n=P(e).finally(()=>{$.delete(e)});return $.set(e,n),n}function Ke(e,t){return t.map(t=>({...t,sourceId:t.sourceId??e}))}function qe(){let e=(0,We.c)(18),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,J.useState)(t),[a,o]=(0,J.useState)(M),s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=[],e[1]=s):s=e[1];let[c,l]=(0,J.useState)(s),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(!1),m;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=async()=>{try{r(await g())}catch{r([])}},e[2]=m):m=e[2];let _=m,v,y;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>{(async function(){let e=ee();if(e.length>0)try{await x(e),I()}catch{}await _()})()},y=[_],e[3]=v,e[4]=y):(v=e[3],y=e[4]),(0,J.useEffect)(v,y);let b;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{o(e),i(e)},e[5]=b):b=e[5];let S=b,w;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>{r(t=>[...t.filter(t=>t.id!==e.id),e].sort(Ye)),S(e.id)},e[6]=w):w=e[6];let T=w,E;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{r(t=>t.map(t=>t.id===e.id?e:t).sort(Je)),H(e.id)},e[7]=E):E=e[7];let D=E,O;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>{r(t=>t.filter(t=>t.id!==e)),H(e),o(t=>t===e?(i(`default`),`default`):t)},e[8]=O):O=e[8];let k=O,A,j;e[9]===a?(A=e[10],j=e[11]):(j=()=>{if(a==="default"){l([]),d(!1),p(!1);return}let e=C(a);e?.skills?(l(Ke(a,e.skills)),d(!1)):(l([]),d(!0));let t=!1;return p(!!e?.skills),Ge(a).then(e=>{if(t)return;let n=Ke(a,e);l(n),h(a,{fetchedAt:Date.now(),skills:n})}).catch(n=>{t||(e?.skills||l([]),W({title:`Error`,description:n instanceof Error?n.message:`Failed to load skill catalog`,variant:`destructive`}))}).finally(()=>{t||(d(!1),p(!1))}),()=>{t=!0}},A=[a],e[9]=a,e[10]=A,e[11]=j),(0,J.useEffect)(j,A);let N;return e[12]!==c||e[13]!==u||e[14]!==f||e[15]!==a||e[16]!==n?(N={sources:n,selectedSourceId:a,setSelectedSourceId:S,addSource:T,updateSource:D,removeSource:k,reloadSources:_,catalogSkills:c,isLoadingCatalog:u,isRefreshingCatalog:f},e[12]=c,e[13]=u,e[14]=f,e[15]=a,e[16]=n,e[17]=N):N=e[17],N}function Je(e,t){return e.title.localeCompare(t.title)}function Ye(e,t){return e.title.localeCompare(t.title)}function Xe({open:e,onOpenChange:n,editingSource:i,onSourceAdded:a,onSourceUpdated:o,onSourceDeleted:c}){let[u,f]=(0,J.useState)(``),[p,h]=(0,J.useState)(``),[g,_]=(0,J.useState)(null),[v,y]=(0,J.useState)(!1),[x,S]=(0,J.useState)(!1),[C,w]=(0,J.useState)(!1),D=i!=null;function j(){f(``),h(``),_(null),y(!1),S(!1),w(!1)}function M(e){e||j(),n(e)}(0,J.useEffect)(()=>{if(e){if(i){f(i.title),h(i.url),_(null);return}f(``),h(``),_(null)}},[e,i]);async function P(){let e=u.trim(),t=p.trim();if(!e||!t){_(`Title and URL are required.`);return}y(!0),_(null);try{if(D&&i){let n=await E(i.id,e,t);o?.(n.source)}else a((await T(e,t)).source);M(!1)}catch(e){_(e instanceof Error?e.message:`Failed to verify skill source`)}finally{y(!1)}}async function F(){if(i){S(!0),_(null);try{await s(i.id),c?.(i.id),w(!1),M(!1)}catch(e){_(e instanceof Error?e.message:`Failed to delete skill source`),w(!1)}finally{S(!1)}}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(d,{open:e,onOpenChange:M,children:(0,Y.jsxs)(k,{className:`sm:max-w-lg`,children:[(0,Y.jsxs)(t,{children:[(0,Y.jsx)(N,{children:D?`Edit Skill Source`:`Add Skill Source`}),(0,Y.jsx)(A,{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,Y.jsxs)(`div`,{className:`grid gap-4 py-2`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Y.jsx)(l,{htmlFor:`skill-source-title`,children:`Title`}),(0,Y.jsx)(z,{id:`skill-source-title`,placeholder:`e.g. My Team Skills`,value:u,onChange:e=>f(e.target.value),disabled:v||x,autoFocus:!0})]}),(0,Y.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Y.jsx)(l,{htmlFor:`skill-source-url`,children:`URL`}),(0,Y.jsx)(z,{id:`skill-source-url`,placeholder:`https://github.com/org/repo or .../tree/main/skills`,value:p,onChange:e=>h(e.target.value),disabled:v||x})]}),g?(0,Y.jsx)(`p`,{className:m(O.caption,`text-destructive`),children:g}):null]}),(0,Y.jsxs)(b,{className:`flex-col-reverse gap-2 sm:flex-row sm:justify-between`,children:[D?(0,Y.jsx)(r,{type:`button`,variant:`destructive`,onClick:()=>w(!0),disabled:v||x,children:`Delete`}):(0,Y.jsx)(`div`,{className:`hidden sm:block`}),(0,Y.jsxs)(`div`,{className:`flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row`,children:[(0,Y.jsx)(r,{variant:`outline`,onClick:()=>M(!1),disabled:v||x,children:`Cancel`}),(0,Y.jsx)(r,{onClick:()=>void P(),disabled:v||x||!u.trim()||!p.trim(),children:v?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(V,{className:`mr-2 h-4 w-4 animate-spin`}),`Verifying...`]}):D?`Save Changes`:`Add Source`})]})]})]})}),(0,Y.jsx)(pe,{open:C,onOpenChange:w,children:(0,Y.jsxs)(xe,{children:[(0,Y.jsxs)(me,{children:[(0,Y.jsx)(ue,{children:`Delete Skill Source`}),(0,Y.jsxs)(de,{children:[`Are you sure you want to delete "`,i?.title,`"? This removes the source from your list but does not uninstall skills you already added.`]})]}),(0,Y.jsxs)(fe,{children:[(0,Y.jsx)(oe,{disabled:x,children:`Cancel`}),(0,Y.jsx)(Se,{onClick:()=>void F(),disabled:x,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:x?`Deleting...`:`Delete`})]})]})})]})}function Ze(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(...Ze(n.children))}return t}function Qe(){let e=je(e=>e.selectedProjectId),t=je(e=>e.selectedThreadId),{setActiveMainTab:i}=Me(),{setPendingExplorerPath:a,triggerExplorerRefresh:s,setExplorerClearPath:l}=Oe(),[h,g]=(0,J.useState)([]),[b,x]=(0,J.useState)(!1),[C,T]=(0,J.useState)(!1),[E,A]=(0,J.useState)(null),[M,N]=(0,J.useState)(!1),[P,F]=(0,J.useState)([]),[I,L]=(0,J.useState)(new Set),[ee,R]=(0,J.useState)(null),[te,z]=(0,J.useState)(!1),{query:B,setQuery:re,deferredQuery:V}=Ne(),{sources:H,selectedSourceId:U,setSelectedSourceId:Ee,addSource:De,updateSource:ke,removeSource:Ae,catalogSkills:K,isLoadingCatalog:ze}=qe(),q=U==="default",X=(0,J.useMemo)(()=>f(U)?H.find(e=>e.id===U)??null:null,[U,H]),Z=(0,J.useCallback)(async()=>{if(e){x(!0);try{let n=Ze(await w(e));if(t)try{let e=Ze(await p(t)),r=new Set(n.map(e=>e.path));for(let t of e)r.has(t.path)||n.push(t)}catch{}n.sort((e,t)=>e.name.localeCompare(t.name)),g(n),L(new Set(n.map(e=>`${e.path}/SKILL.md`)))}catch{g([]),L(new Set)}finally{x(!1)}}},[e,t]);(0,J.useEffect)(()=>{Z()},[Z]),(0,J.useEffect)(()=>{ie().then(F).catch(()=>F([]))},[]);let He=(0,J.useCallback)(async n=>{if(!e)return;let r=n.name,i=n.path;N(!0);try{try{await v(e,i)}catch{if(t)await S(t,i);else throw Error(`No thread selected to delete from`)}l(i),s(),L(e=>{let t=new Set(e);return t.delete(`${i}/SKILL.md`),t}),W({title:`Skill removed`,description:r}),A(null),await Z()}catch(e){W({title:`Error`,description:e instanceof Error?e.message:`Failed to remove skill`,variant:`destructive`})}finally{N(!1)}},[e,t,Z,s,l]),Q=(0,J.useCallback)(e=>{a(`${e}/SKILL.md`),i(`explorer`)},[a,i]),We=(0,J.useCallback)(async e=>{let r=`.agents/skills/${e.id}/SKILL.md`;if(!t||I.has(r))return;let i=e.sourceId??(U==="default"?void 0:U);try{if(i)await n(t,i,e.id,`.agents/skills/${e.id}`);else{let n=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.allowedTools&&n.push(`allowed-tools: ${e.allowedTools}`),e.license&&n.push(`license: ${e.license}`),n.push(`---`,``,e.instructions??``),await ae(t,r,n.join(`
3
3
  `))}L(e=>new Set(e).add(r)),s(),Z(),W({title:`Skill installed`,description:e.name})}catch(e){throw W({title:`Error`,description:e instanceof Error?e.message:`Failed to install skill`,variant:`destructive`}),e}},[t,U,I,s,Z]),$=(0,J.useMemo)(()=>V.trim()?P.filter(e=>e.name.toLowerCase().includes(V.toLowerCase())||e.description.toLowerCase().includes(V.toLowerCase())):P,[P,V]),Ge=(0,J.useMemo)(()=>V.trim()?K.filter(e=>e.name.toLowerCase().includes(V.toLowerCase())||e.description.toLowerCase().includes(V.toLowerCase())):K,[K,V]),Ke=q?P.length===0:ze&&K.length===0;return e?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ce,{children:(0,Y.jsxs)(le,{children:[(0,Y.jsx)(he,{title:`Skills`,description:`Manage agent skills. Skills are reusable instruction sets that guide agent behavior.`,action:(0,Y.jsx)(r,{onClick:()=>T(!0),disabled:!t,children:`Add Skill`})}),!t&&(0,Y.jsx)(Te,{children:`Select a thread to add or install skills.`}),(0,Y.jsx)(se,{title:`Installed`}),b?(0,Y.jsxs)(`div`,{className:`space-y-3 mb-8`,children:[(0,Y.jsx)(G,{className:`h-12 w-full`}),(0,Y.jsx)(G,{className:`h-12 w-full`})]}):h.length===0?(0,Y.jsx)(Le,{icon:j,title:`No skills installed`,description:`Add skills to extend agent capabilities with reusable instructions.`}):(0,Y.jsx)(`div`,{className:`mb-8 overflow-hidden rounded-md border border-border`,children:h.map((e,t)=>(0,Y.jsxs)(`div`,{className:m(`group grid min-h-13 grid-cols-[minmax(0,1fr)_1.75rem] items-center gap-3 px-3 py-3 hover:bg-muted/30`,t>0&&`border-t border-border`),children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>Q(e.path),className:m(O.body,`truncate text-left`),children:e.name}),(0,Y.jsx)(c,{children:(0,Y.jsxs)(_,{children:[(0,Y.jsx)(u,{asChild:!0,children:(0,Y.jsx)(r,{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:()=>A(e),"aria-label":`Delete ${e.name}`,children:(0,Y.jsx)(o,{className:`h-4 w-4`})})}),(0,Y.jsx)(y,{children:`Remove this skill from the project`})]})})]},e.id))}),(0,Y.jsx)(se,{title:`Available`,className:`mb-0`}),(0,Y.jsx)(Pe,{search:{placeholder:`Search available skills...`,value:B,onChange:re},trailing:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(_e,{value:U,onValueChange:Ee,children:[(0,Y.jsx)(be,{className:`w-full min-w-0`,"aria-label":`Skill source`,children:(0,Y.jsx)(ye,{placeholder:`Default`})}),(0,Y.jsxs)(ve,{children:[(0,Y.jsx)(we,{value:`default`,children:`Default`}),H.map(e=>(0,Y.jsx)(we,{value:e.id,children:e.title},e.id))]})]}),(0,Y.jsx)(c,{children:(0,Y.jsxs)(_,{children:[(0,Y.jsx)(u,{asChild:!0,children:(0,Y.jsx)(r,{type:`button`,variant:`outline`,size:`icon`,className:`shrink-0`,onClick:()=>z(!0),"aria-label":X?`Edit skill source`:`Add skill source`,children:X?(0,Y.jsx)(D,{className:`h-4 w-4`}):(0,Y.jsx)(ne,{className:`h-4 w-4`})})}),(0,Y.jsx)(y,{children:X?`Edit this custom skill source`:`Add a custom skill source`})]})})]})}),Ke?q?(0,Y.jsxs)(`div`,{className:`space-y-3`,children:[(0,Y.jsx)(G,{className:`h-20 w-full`}),(0,Y.jsx)(G,{className:`h-20 w-full`})]}):(0,Y.jsx)(Ce,{className:`py-12`,label:`Loading skills...`}):q?$.length===0?(0,Y.jsx)(Ie,{searchQuery:B,emptyLabel:`No available skills found.`}):(0,Y.jsx)(Fe,{children:$.map(e=>{let t=`.agents/skills/${e.id}/SKILL.md`,n=I.has(t);return(0,Y.jsx)(Re,{name:Be(e.name),description:e.description,installed:n,onClick:()=>{n||R(e)},showInstalledControls:!1},e.id)})}):Ge.length===0?(0,Y.jsx)(Ie,{searchQuery:B,emptyLabel:`No available skills found.`}):(0,Y.jsx)(Fe,{children:Ge.map(e=>{let t=`.agents/skills/${e.id}/SKILL.md`,n=I.has(t);return(0,Y.jsx)(Re,{name:Be(e.name),description:e.description,installed:n,onClick:()=>{n||R({...e,sourceId:e.sourceId??U})},showInstalledControls:!1},e.id)})})]})}),(0,Y.jsx)(Ue,{open:ee!==null,onOpenChange:e=>{e||R(null)},skill:ee,catalogSourceId:q?void 0:U,onInstall:We}),(0,Y.jsx)(Xe,{open:te,onOpenChange:z,editingSource:X,onSourceAdded:e=>{De(e),W({title:`Skill source added`,description:`${e.title} is now available in the source list.`})},onSourceUpdated:e=>{ke(e),W({title:`Skill source updated`,description:`${e.title} has been saved.`})},onSourceDeleted:e=>{Ae(e),W({title:`Skill source removed`,description:`The custom source has been deleted.`})}}),(0,Y.jsx)(d,{open:C,onOpenChange:T,children:(0,Y.jsx)(k,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,Y.jsx)(Ve,{threadId:t,onSkillCreated:()=>{T(!1),Z(),s()}})})}),(0,Y.jsx)(pe,{open:E!==null,onOpenChange:e=>!e&&A(null),children:(0,Y.jsxs)(xe,{children:[(0,Y.jsxs)(me,{children:[(0,Y.jsx)(ue,{children:`Delete Skill`}),(0,Y.jsxs)(de,{children:[`Are you sure you want to delete the skill "`,E?.name,`"? This action cannot be undone.`]})]}),(0,Y.jsxs)(fe,{children:[(0,Y.jsx)(oe,{children:`Cancel`}),(0,Y.jsx)(Se,{onClick:()=>E&&void He(E),disabled:M,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:M?`Deleting...`:`Delete`})]})]})})]}):(0,Y.jsx)(ge,{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{Ai as t,E as n,Ea as r,Fr as i,Gr as a,I as o,Ir as s,Jr as c,Mi as l,Nr as u,Nt as d,Oa as f,Pr as p,Xi as m,Xr as h,en as g,ls as _,os as v,qr as y,yt as b}from"./dialogs-config-BEazgV7k.js";import{A as ee,C as x,D as S,E as te,F as C,M as w,N as T,O as ne,P as E,S as D,T as O,b as k,j as re,k as ie,x as ae,y as A}from"./history-view-BMVTxWTg.js";import{A as j,P as M,R as N,j as oe}from"./index-B4PyD4Io.js";import{t as P}from"./skeleton-6mGMglV0.js";import{n as F,t as I}from"./radio-group-n9qyUxmu.js";import{i as L,n as se,r as ce,t as le}from"./settings-list-owWkHWxE.js";import{t as ue}from"./mcp-server-card-ChdAZekt.js";import{i as R,n as z,r as B}from"./slug-utils-BT1eqWhW.js";var V=e(_(),1),H=v();function de({projectId:e,threadId:t,onCommandCreated:r}){let[i,o]=(0,V.useState)(``),[s,c]=(0,V.useState)(``),[u,d]=(0,V.useState)(``),[f,p]=(0,V.useState)(`default`),[h,g]=(0,V.useState)(!1),_=B(i),v=z(_),b=async()=>{if(!(!v||!e)){g(!0);try{await n(_,``,{description:s.trim()||void 0,argumentHint:u.trim()||void 0,mode:f===`plan`?`plan`:void 0},`project`,t??void 0),M({title:`Command created`,description:`Command '/${_}' was created successfully.`}),o(``),c(``),d(``),p(`default`),r?.(_)}catch(e){M({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)(A,{children:[(0,H.jsx)(D,{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)(k,{title:`Command Name`,children:[(0,H.jsx)(y,{id:`commandName`,value:i,onChange:e=>o(e.target.value),placeholder:`e.g. review`,disabled:h}),i?(0,H.jsxs)(`p`,{className:l(m.caption,`mt-2`),children:[`Command: `,(0,H.jsxs)(`span`,{className:`font-mono`,children:[`/`,_||`...`]})]}):null]}),(0,H.jsx)(k,{title:`Description`,children:(0,H.jsx)(y,{id:`commandDescription`,value:s,onChange:e=>c(e.target.value),placeholder:`Brief description shown in autocomplete`,disabled:h})}),(0,H.jsx)(k,{title:`Argument Hint`,description:`Shows after the command name to guide users what to type`,children:(0,H.jsx)(y,{id:`argumentHint`,value:u,onChange:e=>d(e.target.value),placeholder:`e.g. <focus-area> or <branch-name>`,disabled:h})}),(0,H.jsx)(k,{title:`Mode`,description:f==="default"?`Standard chat mode`:`Activates plan mode when this command is used`,children:(0,H.jsxs)(I,{value:f,onValueChange:e=>p(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)(a,{htmlFor:`mode-default`,className:l(m.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)(a,{htmlFor:`mode-plan`,className:l(m.labelNormal,`cursor-pointer`),children:`Plan`})]})]})}),(0,H.jsx)(R,{onContinue:()=>void b(),disabled:!v,creating:h})]})]})}):(0,H.jsx)(O,{title:`No project selected`,children:`Please select a project to add a slash command.`})}function U(){let e=N(e=>e.selectedProjectId),a=N(e=>e.selectedThreadId),{setActiveMainTab:_}=oe(),{setPendingExplorerPath:v,triggerExplorerRefresh:y,setExplorerClearPath:k}=j(),[A,F]=(0,V.useState)([]),[I,R]=(0,V.useState)(!1),[z,B]=(0,V.useState)(!1),[U,W]=(0,V.useState)(null),[G,K]=(0,V.useState)(!1),[q,J]=(0,V.useState)([]),[Y,X]=(0,V.useState)(new Map),[Z,fe]=(0,V.useState)(``),Q=(0,V.useCallback)(async()=>{if(a){R(!0);try{let e=await d(a);F(e.filter(e=>!e.isBuiltIn)),X(new Map(e.map(e=>[e.name,e.filePath])))}catch{F([]),X(new Map)}finally{R(!1)}}},[a]);(0,V.useEffect)(()=>{Q()},[Q]),(0,V.useEffect)(()=>{b().then(J).catch(()=>J([]))},[]);let pe=(0,V.useCallback)(async e=>{K(!0);try{await o(e.filePath),k(e.filePath),y(),X(t=>{let n=new Map(t);return n.delete(e.name),n}),M({title:`Command removed`,description:`/${e.name}`}),W(null),await Q()}catch(e){M({title:`Error`,description:e instanceof Error?e.message:`Failed to remove command`,variant:`destructive`})}finally{K(!1)}},[Q,y,k]),me=(0,V.useCallback)(e=>{v(e),_(`explorer`)},[v,_]),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(!(!a||Y.has(e.name)))try{if(e.gitHubRepo&&e.gitHubFolder){let t=`.agents/commands`;await g(a,e.gitHubRepo,e.gitHubFolder,t);let n=`${t}/${e.name}.md`;X(t=>new Map(t).set(e.name,n))}else{let t=await n(e.name,e.content,{description:e.description,argumentHint:e.argumentHint},`project`,a);X(n=>new Map(n).set(e.name,t.filePath))}y(),Q(),M({title:`Command installed`,description:`/${e.name}`})}catch(e){M({title:`Error`,description:e instanceof Error?e.message:`Failed to install command`,variant:`destructive`})}},[a,Y,y,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)(D,{title:`Slash Commands`,description:`Manage slash commands. Commands are quick actions available via / in chat.`,action:(0,H.jsx)(t,{onClick:()=>B(!0),disabled:!a,children:`Add Command`})}),!a&&(0,H.jsx)(ae,{children:`Select a thread to add or install slash commands.`}),(0,H.jsx)(x,{title:`Installed`}),I?(0,H.jsxs)(`div`,{className:`space-y-3 mb-8`,children:[(0,H.jsx)(P,{className:`h-12 w-full`}),(0,H.jsx)(P,{className:`h-12 w-full`})]}):A.length===0?(0,H.jsx)(le,{icon:f,title:`No slash commands installed`,description:`Add slash commands to create quick actions in chat.`}):(0,H.jsx)(`div`,{className:`mb-8 overflow-hidden rounded-md border border-border`,children:A.map((e,n)=>(0,H.jsxs)(`div`,{className:l(`group grid min-h-13 grid-cols-[minmax(0,1fr)_auto_1.75rem] items-center gap-3 px-3 py-3 hover:bg-muted/30`,n>0&&`border-t border-border`),children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>me(e.filePath),className:`min-w-0 text-left`,children:[(0,H.jsxs)(`div`,{className:l(m.body,`truncate`),children:[`/`,e.name]}),(0,H.jsx)(`div`,{className:l(m.compact,`truncate text-muted-foreground`),children:he(e)})]}),e.metadata?.mode?(0,H.jsx)(`span`,{className:l(m.compact,`bg-muted px-1.5 py-0.5 rounded flex-shrink-0`),children:e.metadata.mode}):(0,H.jsx)(`div`,{}),(0,H.jsx)(i,{children:(0,H.jsxs)(u,{children:[(0,H.jsx)(s,{asChild:!0,children:(0,H.jsx)(t,{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)(r,{className:`h-4 w-4`})})}),(0,H.jsx)(p,{children:`Remove this slash command from the project`})]})})]},e.filePath))}),(0,H.jsx)(x,{title:`Available`,className:`mb-0`}),(0,H.jsx)(L,{placeholder:`Search available commands...`,value:Z,onChange:fe}),q.length===0?(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(P,{className:`h-20 w-full`}),(0,H.jsx)(P,{className:`h-20 w-full`})]}):$.length===0?(0,H.jsx)(ce,{searchQuery:Z,emptyLabel:`No available commands found.`}):(0,H.jsx)(se,{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)(c,{open:z,onOpenChange:B,children:(0,H.jsx)(h,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,H.jsx)(de,{projectId:e,threadId:a,onCommandCreated:()=>{B(!1),Q(),y()}})})}),(0,H.jsx)(ne,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,H.jsxs)(re,{children:[(0,H.jsxs)(E,{children:[(0,H.jsx)(C,{children:`Delete Slash Command`}),(0,H.jsxs)(w,{children:[`Are you sure you want to delete "/`,U?.name,`"? This action cannot be undone.`]})]}),(0,H.jsxs)(T,{children:[(0,H.jsx)(ee,{children:`Cancel`}),(0,H.jsx)(ie,{onClick:()=>U&&void pe(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,H.jsx)(O,{children:`Select a project to manage slash commands.`})}export{U as SettingsSlashCommandsView,U as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,E as n,Ea as r,Fr as i,Gr as a,I as o,Ir as s,Jr as c,Mi as l,Nr as u,Nt as d,Oa as f,Pr as p,Xi as m,Xr as h,en as g,ls as _,os as v,qr as y,yt as b}from"./dialogs-config-BEazgV7k.js";import{A as ee,C as x,D as S,E as te,F as C,M as w,N as T,O as ne,P as E,S as D,T as O,b as k,j as re,k as ie,x as ae,y as A}from"./history-view-BMVTxWTg.js";import{A as j,P as M,R as N,j as oe}from"./index-_SOdLUMq.js";import{t as P}from"./skeleton-6mGMglV0.js";import{n as F,t as I}from"./radio-group-n9qyUxmu.js";import{i as L,n as se,r as ce,t as le}from"./settings-list-owWkHWxE.js";import{t as ue}from"./mcp-server-card-ChdAZekt.js";import{i as R,n as z,r as B}from"./slug-utils-BT1eqWhW.js";var V=e(_(),1),H=v();function de({projectId:e,threadId:t,onCommandCreated:r}){let[i,o]=(0,V.useState)(``),[s,c]=(0,V.useState)(``),[u,d]=(0,V.useState)(``),[f,p]=(0,V.useState)(`default`),[h,g]=(0,V.useState)(!1),_=B(i),v=z(_),b=async()=>{if(!(!v||!e)){g(!0);try{await n(_,``,{description:s.trim()||void 0,argumentHint:u.trim()||void 0,mode:f===`plan`?`plan`:void 0},`project`,t??void 0),M({title:`Command created`,description:`Command '/${_}' was created successfully.`}),o(``),c(``),d(``),p(`default`),r?.(_)}catch(e){M({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)(A,{children:[(0,H.jsx)(D,{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)(k,{title:`Command Name`,children:[(0,H.jsx)(y,{id:`commandName`,value:i,onChange:e=>o(e.target.value),placeholder:`e.g. review`,disabled:h}),i?(0,H.jsxs)(`p`,{className:l(m.caption,`mt-2`),children:[`Command: `,(0,H.jsxs)(`span`,{className:`font-mono`,children:[`/`,_||`...`]})]}):null]}),(0,H.jsx)(k,{title:`Description`,children:(0,H.jsx)(y,{id:`commandDescription`,value:s,onChange:e=>c(e.target.value),placeholder:`Brief description shown in autocomplete`,disabled:h})}),(0,H.jsx)(k,{title:`Argument Hint`,description:`Shows after the command name to guide users what to type`,children:(0,H.jsx)(y,{id:`argumentHint`,value:u,onChange:e=>d(e.target.value),placeholder:`e.g. <focus-area> or <branch-name>`,disabled:h})}),(0,H.jsx)(k,{title:`Mode`,description:f==="default"?`Standard chat mode`:`Activates plan mode when this command is used`,children:(0,H.jsxs)(I,{value:f,onValueChange:e=>p(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)(a,{htmlFor:`mode-default`,className:l(m.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)(a,{htmlFor:`mode-plan`,className:l(m.labelNormal,`cursor-pointer`),children:`Plan`})]})]})}),(0,H.jsx)(R,{onContinue:()=>void b(),disabled:!v,creating:h})]})]})}):(0,H.jsx)(O,{title:`No project selected`,children:`Please select a project to add a slash command.`})}function U(){let e=N(e=>e.selectedProjectId),a=N(e=>e.selectedThreadId),{setActiveMainTab:_}=oe(),{setPendingExplorerPath:v,triggerExplorerRefresh:y,setExplorerClearPath:k}=j(),[A,F]=(0,V.useState)([]),[I,R]=(0,V.useState)(!1),[z,B]=(0,V.useState)(!1),[U,W]=(0,V.useState)(null),[G,K]=(0,V.useState)(!1),[q,J]=(0,V.useState)([]),[Y,X]=(0,V.useState)(new Map),[Z,fe]=(0,V.useState)(``),Q=(0,V.useCallback)(async()=>{if(a){R(!0);try{let e=await d(a);F(e.filter(e=>!e.isBuiltIn)),X(new Map(e.map(e=>[e.name,e.filePath])))}catch{F([]),X(new Map)}finally{R(!1)}}},[a]);(0,V.useEffect)(()=>{Q()},[Q]),(0,V.useEffect)(()=>{b().then(J).catch(()=>J([]))},[]);let pe=(0,V.useCallback)(async e=>{K(!0);try{await o(e.filePath),k(e.filePath),y(),X(t=>{let n=new Map(t);return n.delete(e.name),n}),M({title:`Command removed`,description:`/${e.name}`}),W(null),await Q()}catch(e){M({title:`Error`,description:e instanceof Error?e.message:`Failed to remove command`,variant:`destructive`})}finally{K(!1)}},[Q,y,k]),me=(0,V.useCallback)(e=>{v(e),_(`explorer`)},[v,_]),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(!(!a||Y.has(e.name)))try{if(e.gitHubRepo&&e.gitHubFolder){let t=`.agents/commands`;await g(a,e.gitHubRepo,e.gitHubFolder,t);let n=`${t}/${e.name}.md`;X(t=>new Map(t).set(e.name,n))}else{let t=await n(e.name,e.content,{description:e.description,argumentHint:e.argumentHint},`project`,a);X(n=>new Map(n).set(e.name,t.filePath))}y(),Q(),M({title:`Command installed`,description:`/${e.name}`})}catch(e){M({title:`Error`,description:e instanceof Error?e.message:`Failed to install command`,variant:`destructive`})}},[a,Y,y,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)(D,{title:`Slash Commands`,description:`Manage slash commands. Commands are quick actions available via / in chat.`,action:(0,H.jsx)(t,{onClick:()=>B(!0),disabled:!a,children:`Add Command`})}),!a&&(0,H.jsx)(ae,{children:`Select a thread to add or install slash commands.`}),(0,H.jsx)(x,{title:`Installed`}),I?(0,H.jsxs)(`div`,{className:`space-y-3 mb-8`,children:[(0,H.jsx)(P,{className:`h-12 w-full`}),(0,H.jsx)(P,{className:`h-12 w-full`})]}):A.length===0?(0,H.jsx)(le,{icon:f,title:`No slash commands installed`,description:`Add slash commands to create quick actions in chat.`}):(0,H.jsx)(`div`,{className:`mb-8 overflow-hidden rounded-md border border-border`,children:A.map((e,n)=>(0,H.jsxs)(`div`,{className:l(`group grid min-h-13 grid-cols-[minmax(0,1fr)_auto_1.75rem] items-center gap-3 px-3 py-3 hover:bg-muted/30`,n>0&&`border-t border-border`),children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>me(e.filePath),className:`min-w-0 text-left`,children:[(0,H.jsxs)(`div`,{className:l(m.body,`truncate`),children:[`/`,e.name]}),(0,H.jsx)(`div`,{className:l(m.compact,`truncate text-muted-foreground`),children:he(e)})]}),e.metadata?.mode?(0,H.jsx)(`span`,{className:l(m.compact,`bg-muted px-1.5 py-0.5 rounded flex-shrink-0`),children:e.metadata.mode}):(0,H.jsx)(`div`,{}),(0,H.jsx)(i,{children:(0,H.jsxs)(u,{children:[(0,H.jsx)(s,{asChild:!0,children:(0,H.jsx)(t,{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)(r,{className:`h-4 w-4`})})}),(0,H.jsx)(p,{children:`Remove this slash command from the project`})]})})]},e.filePath))}),(0,H.jsx)(x,{title:`Available`,className:`mb-0`}),(0,H.jsx)(L,{placeholder:`Search available commands...`,value:Z,onChange:fe}),q.length===0?(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(P,{className:`h-20 w-full`}),(0,H.jsx)(P,{className:`h-20 w-full`})]}):$.length===0?(0,H.jsx)(ce,{searchQuery:Z,emptyLabel:`No available commands found.`}):(0,H.jsx)(se,{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)(c,{open:z,onOpenChange:B,children:(0,H.jsx)(h,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,H.jsx)(de,{projectId:e,threadId:a,onCommandCreated:()=>{B(!1),Q(),y()}})})}),(0,H.jsx)(ne,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,H.jsxs)(re,{children:[(0,H.jsxs)(E,{children:[(0,H.jsx)(C,{children:`Delete Slash Command`}),(0,H.jsxs)(w,{children:[`Are you sure you want to delete "/`,U?.name,`"? This action cannot be undone.`]})]}),(0,H.jsxs)(T,{children:[(0,H.jsx)(ee,{children:`Cancel`}),(0,H.jsx)(ie,{onClick:()=>U&&void pe(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,H.jsx)(O,{children:`Select a project to manage slash commands.`})}export{U as SettingsSlashCommandsView,U as default};
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Ea as n,Fr as r,Ir as i,Jr as a,Lt as o,Mi as s,Nr as c,O as l,P as u,Pr as d,R as f,St as p,Xi as m,Xr as h,en as ee,ht as te,ls as g,os as _,qr as v,xa as y,xn as ne}from"./dialogs-config-BEazgV7k.js";import{A as re,C as b,D as x,E as ie,F as ae,M as oe,N as S,O as C,P as w,S as T,T as E,b as D,j as se,k as ce,x as le,y as O}from"./history-view-BMVTxWTg.js";import{A as ue,I as k,P as A,R as j,j as de}from"./index-B4PyD4Io.js";import{t as M}from"./skeleton-6mGMglV0.js";import{i as fe,n as pe,r as me,t as N}from"./settings-list-owWkHWxE.js";import{t as P}from"./mcp-server-card-ChdAZekt.js";import{i as F,n as I,r as L}from"./slug-utils-BT1eqWhW.js";var R=e(g(),1),z=_();function he({threadId:e,onAgentCreated:t}){let[n,r]=(0,R.useState)(``),[i,a]=(0,R.useState)(``),[o,c]=(0,R.useState)(``),[u,d]=(0,R.useState)(!1),f=L(n),p=I(f),h=async()=>{if(!(!p||!i.trim()||!e)){d(!0);try{let n=await l(e,f,i.trim(),o.trim()||void 0);A({title:`Agent created`,description:`Agent '${f}' was created successfully.`}),r(``),a(``),c(``),t?.(n.path,`AGENTS.md`)}catch(e){A({title:`Error`,description:e instanceof Error?e.message:`Failed to create agent`,variant:`destructive`})}finally{d(!1)}}};return e?(0,z.jsx)(x,{children:(0,z.jsxs)(O,{children:[(0,z.jsx)(T,{title:`Add Agent`,description:`Create a new agent. The agent will be saved as an AGENTS.md file in the .agents folder.`}),(0,z.jsxs)(`div`,{className:`space-y-6`,children:[(0,z.jsxs)(D,{title:`Agent Name`,children:[(0,z.jsx)(v,{id:`agentName`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Code Reviewer`,disabled:u}),n?(0,z.jsxs)(`p`,{className:s(m.caption,`mt-2`),children:[`Folder name: `,(0,z.jsx)(`span`,{className:`font-mono`,children:f||`...`})]}):null]}),(0,z.jsx)(D,{title:`Description`,children:(0,z.jsx)(k,{id:`agentDescription`,value:i,onChange:e=>a(e.target.value),placeholder:`Describe the agent's purpose and behavior...`,className:`resize-none min-h-[120px]`,disabled:u})}),(0,z.jsx)(D,{title:`Tools`,description:`Optional space-separated list of tools this agent can use`,children:(0,z.jsx)(v,{id:`agentTools`,value:o,onChange:e=>c(e.target.value),placeholder:`e.g. read grep glob`,disabled:u})}),(0,z.jsx)(F,{onContinue:()=>void h(),disabled:!p||!i.trim(),creating:u})]})]})}):(0,z.jsx)(E,{title:`No thread selected`,children:`Please select a thread to add an agent.`})}function B(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(...B(n.children));return t}function V(){let e=j(e=>e.selectedProjectId),l=j(e=>e.selectedThreadId),{setActiveMainTab:g}=de(),{setPendingExplorerPath:_,triggerExplorerRefresh:v,setExplorerClearPath:D}=ue(),[O,k]=(0,R.useState)([]),[F,I]=(0,R.useState)(!1),[L,V]=(0,R.useState)(!1),[H,U]=(0,R.useState)(null),[W,G]=(0,R.useState)(!1),[K,q]=(0,R.useState)([]),[J,Y]=(0,R.useState)(new Set),[X,ge]=(0,R.useState)(``),Z=(0,R.useCallback)(async()=>{if(e){I(!0);try{let t=B(await p(e));if(l)try{let e=B(await o(l)),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)),k(t),Y(new Set(t.map(e=>`${e.path}/AGENT.md`)))}catch{k([]),Y(new Set)}finally{I(!1)}}},[e,l]);(0,R.useEffect)(()=>{Z()},[Z]),(0,R.useEffect)(()=>{te().then(q).catch(()=>q([]))},[]);let _e=(0,R.useCallback)(async t=>{if(!e)return;let n=t.name,r=t.path;G(!0);try{try{await u(e,r)}catch{if(l)await f(l,r);else throw Error(`No thread selected to delete from`)}D(r),v(),Y(e=>{let t=new Set(e);return t.delete(`${r}/AGENT.md`),t}),A({title:`Agent removed`,description:n}),U(null),await Z()}catch(e){A({title:`Error`,description:e instanceof Error?e.message:`Failed to remove agent`,variant:`destructive`})}finally{G(!1)}},[e,l,Z,v,D]),Q=(0,R.useCallback)(e=>{_(`${e}/AGENT.md`),g(`explorer`)},[_,g]),ve=(0,R.useCallback)(async e=>{let t=`.agents/agents/${e.id}/AGENT.md`;if(!(!l||J.has(t)))try{if(e.gitHubRepo&&e.gitHubFolder)await ee(l,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 ne(l,t,n.join(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Ea as n,Fr as r,Ir as i,Jr as a,Lt as o,Mi as s,Nr as c,O as l,P as u,Pr as d,R as f,St as p,Xi as m,Xr as h,en as ee,ht as te,ls as g,os as _,qr as v,xa as y,xn as ne}from"./dialogs-config-BEazgV7k.js";import{A as re,C as b,D as x,E as ie,F as ae,M as oe,N as S,O as C,P as w,S as T,T as E,b as D,j as se,k as ce,x as le,y as O}from"./history-view-BMVTxWTg.js";import{A as ue,I as k,P as A,R as j,j as de}from"./index-_SOdLUMq.js";import{t as M}from"./skeleton-6mGMglV0.js";import{i as fe,n as pe,r as me,t as N}from"./settings-list-owWkHWxE.js";import{t as P}from"./mcp-server-card-ChdAZekt.js";import{i as F,n as I,r as L}from"./slug-utils-BT1eqWhW.js";var R=e(g(),1),z=_();function he({threadId:e,onAgentCreated:t}){let[n,r]=(0,R.useState)(``),[i,a]=(0,R.useState)(``),[o,c]=(0,R.useState)(``),[u,d]=(0,R.useState)(!1),f=L(n),p=I(f),h=async()=>{if(!(!p||!i.trim()||!e)){d(!0);try{let n=await l(e,f,i.trim(),o.trim()||void 0);A({title:`Agent created`,description:`Agent '${f}' was created successfully.`}),r(``),a(``),c(``),t?.(n.path,`AGENTS.md`)}catch(e){A({title:`Error`,description:e instanceof Error?e.message:`Failed to create agent`,variant:`destructive`})}finally{d(!1)}}};return e?(0,z.jsx)(x,{children:(0,z.jsxs)(O,{children:[(0,z.jsx)(T,{title:`Add Agent`,description:`Create a new agent. The agent will be saved as an AGENTS.md file in the .agents folder.`}),(0,z.jsxs)(`div`,{className:`space-y-6`,children:[(0,z.jsxs)(D,{title:`Agent Name`,children:[(0,z.jsx)(v,{id:`agentName`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Code Reviewer`,disabled:u}),n?(0,z.jsxs)(`p`,{className:s(m.caption,`mt-2`),children:[`Folder name: `,(0,z.jsx)(`span`,{className:`font-mono`,children:f||`...`})]}):null]}),(0,z.jsx)(D,{title:`Description`,children:(0,z.jsx)(k,{id:`agentDescription`,value:i,onChange:e=>a(e.target.value),placeholder:`Describe the agent's purpose and behavior...`,className:`resize-none min-h-[120px]`,disabled:u})}),(0,z.jsx)(D,{title:`Tools`,description:`Optional space-separated list of tools this agent can use`,children:(0,z.jsx)(v,{id:`agentTools`,value:o,onChange:e=>c(e.target.value),placeholder:`e.g. read grep glob`,disabled:u})}),(0,z.jsx)(F,{onContinue:()=>void h(),disabled:!p||!i.trim(),creating:u})]})]})}):(0,z.jsx)(E,{title:`No thread selected`,children:`Please select a thread to add an agent.`})}function B(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(...B(n.children));return t}function V(){let e=j(e=>e.selectedProjectId),l=j(e=>e.selectedThreadId),{setActiveMainTab:g}=de(),{setPendingExplorerPath:_,triggerExplorerRefresh:v,setExplorerClearPath:D}=ue(),[O,k]=(0,R.useState)([]),[F,I]=(0,R.useState)(!1),[L,V]=(0,R.useState)(!1),[H,U]=(0,R.useState)(null),[W,G]=(0,R.useState)(!1),[K,q]=(0,R.useState)([]),[J,Y]=(0,R.useState)(new Set),[X,ge]=(0,R.useState)(``),Z=(0,R.useCallback)(async()=>{if(e){I(!0);try{let t=B(await p(e));if(l)try{let e=B(await o(l)),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)),k(t),Y(new Set(t.map(e=>`${e.path}/AGENT.md`)))}catch{k([]),Y(new Set)}finally{I(!1)}}},[e,l]);(0,R.useEffect)(()=>{Z()},[Z]),(0,R.useEffect)(()=>{te().then(q).catch(()=>q([]))},[]);let _e=(0,R.useCallback)(async t=>{if(!e)return;let n=t.name,r=t.path;G(!0);try{try{await u(e,r)}catch{if(l)await f(l,r);else throw Error(`No thread selected to delete from`)}D(r),v(),Y(e=>{let t=new Set(e);return t.delete(`${r}/AGENT.md`),t}),A({title:`Agent removed`,description:n}),U(null),await Z()}catch(e){A({title:`Error`,description:e instanceof Error?e.message:`Failed to remove agent`,variant:`destructive`})}finally{G(!1)}},[e,l,Z,v,D]),Q=(0,R.useCallback)(e=>{_(`${e}/AGENT.md`),g(`explorer`)},[_,g]),ve=(0,R.useCallback)(async e=>{let t=`.agents/agents/${e.id}/AGENT.md`;if(!(!l||J.has(t)))try{if(e.gitHubRepo&&e.gitHubFolder)await ee(l,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 ne(l,t,n.join(`
2
2
  `))}Y(e=>new Set(e).add(t)),v(),Z(),A({title:`Agent installed`,description:e.name})}catch(e){A({title:`Error`,description:e instanceof Error?e.message:`Failed to install agent`,variant:`destructive`})}},[l,J,v,Z]),$=X.trim()?K.filter(e=>e.name.toLowerCase().includes(X.toLowerCase())||e.description.toLowerCase().includes(X.toLowerCase())):K;return e?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(x,{children:(0,z.jsxs)(ie,{children:[(0,z.jsx)(T,{title:`Subagents`,description:`Manage subagents. Subagents are specialized agents for focused tasks.`,action:(0,z.jsx)(t,{onClick:()=>V(!0),disabled:!l,children:`Add Subagent`})}),!l&&(0,z.jsx)(le,{children:`Select a thread to add or install subagents.`}),(0,z.jsx)(b,{title:`Installed`}),F?(0,z.jsxs)(`div`,{className:`space-y-3 mb-8`,children:[(0,z.jsx)(M,{className:`h-12 w-full`}),(0,z.jsx)(M,{className:`h-12 w-full`})]}):O.length===0?(0,z.jsx)(N,{icon:y,title:`No subagents installed`,description:`Add subagents for specialized, focused tasks.`}):(0,z.jsx)(`div`,{className:`mb-8 overflow-hidden rounded-md border border-border`,children:O.map((e,a)=>(0,z.jsxs)(`div`,{className:s(`group grid min-h-13 grid-cols-[minmax(0,1fr)_1.75rem] items-center gap-3 px-3 py-3 hover:bg-muted/30`,a>0&&`border-t border-border`),children:[(0,z.jsx)(`button`,{type:`button`,onClick:()=>Q(e.path),className:s(m.body,`truncate text-left`),children:e.name}),(0,z.jsx)(r,{children:(0,z.jsxs)(c,{children:[(0,z.jsx)(i,{asChild:!0,children:(0,z.jsx)(t,{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:()=>U(e),"aria-label":`Delete ${e.name}`,children:(0,z.jsx)(n,{className:`h-4 w-4`})})}),(0,z.jsx)(d,{children:`Remove this subagent from the project`})]})})]},e.id))}),(0,z.jsx)(b,{title:`Available`,className:`mb-0`}),(0,z.jsx)(fe,{placeholder:`Search available subagents...`,value:X,onChange:ge}),K.length===0?(0,z.jsxs)(`div`,{className:`space-y-3`,children:[(0,z.jsx)(M,{className:`h-20 w-full`}),(0,z.jsx)(M,{className:`h-20 w-full`})]}):$.length===0?(0,z.jsx)(me,{searchQuery:X,emptyLabel:`No available subagents found.`}):(0,z.jsx)(pe,{children:$.map(e=>{let t=`.agents/agents/${e.id}/AGENT.md`,n=J.has(t);return(0,z.jsx)(P,{name:e.name,description:e.description,installed:n,onClick:()=>{n||ve(e)},showInstalledControls:!1},e.id)})})]})}),(0,z.jsx)(a,{open:L,onOpenChange:V,children:(0,z.jsx)(h,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,z.jsx)(he,{threadId:l,onAgentCreated:()=>{V(!1),Z(),v()}})})}),(0,z.jsx)(C,{open:H!==null,onOpenChange:e=>!e&&U(null),children:(0,z.jsxs)(se,{children:[(0,z.jsxs)(w,{children:[(0,z.jsx)(ae,{children:`Delete Subagent`}),(0,z.jsxs)(oe,{children:[`Are you sure you want to delete the subagent "`,H?.name,`"? This action cannot be undone.`]})]}),(0,z.jsxs)(S,{children:[(0,z.jsx)(re,{children:`Cancel`}),(0,z.jsx)(ce,{onClick:()=>H&&void _e(H),disabled:W,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:W?`Deleting...`:`Delete`})]})]})})]}):(0,z.jsx)(E,{children:`Select a project to manage subagents.`})}export{V as SettingsSubagentsView,V as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Gr as n,In as r,Mi as i,Tt as a,Xi as o,ls as s,os as c,tn as l,uo as u}from"./dialogs-config-BEazgV7k.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-BMVTxWTg.js";import{a as C}from"./onboarding-Bi5MieW-.js";import{I as w,P as T,R as E}from"./index-B4PyD4Io.js";var D=e(s(),1),O=c();function k(){let e=E(e=>e.selectedProjectId),[s,c]=(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),a(e).then(e=>{let t=e.useCustomSystemPrompt;c(e.generatedPrompt),P(t),I(e.customSystemPrompt),M(!t),A(t?e.customSystemPrompt:e.generatedPrompt)}).catch(()=>{c(``),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(s),M(!0)}function K(e){if(!e){M(!1);return}if(k===s){G();return}H(!0)}function q(){G(),H(!1)}function J(){H(!1)}async function Y(){if(e){if(!j&&!k.trim()){T({title:`System prompt required`,description:`Enter a system prompt or enable Generated.`,variant:`destructive`});return}B(!0);try{await r(e,{customSystemPrompt:j?null:k.trim(),useCustomSystemPrompt:!j}),l(),P(!j),I(j?``:k.trim()),T({title:`System prompt settings saved`})}catch(e){T({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)(t,{onClick:Y,disabled:L||z||!U(),children:z?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(u,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`})}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,O.jsx)(C,{id:`use-generated-prompt`,checked:j,onCheckedChange:e=>K(e===!0),disabled:L||z}),(0,O.jsx)(n,{htmlFor:`use-generated-prompt`,className:i(o.labelNormal,`cursor-pointer`),children:`Generated`})]}),L?(0,O.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,O.jsx)(u,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,O.jsx)(w,{value:k,onChange:e=>W(e.target.value),className:i(o.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
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Gr as n,In as r,Mi as i,Tt as a,Xi as o,ls as s,os as c,tn as l,uo as u}from"./dialogs-config-BEazgV7k.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-BMVTxWTg.js";import{a as C}from"./onboarding-Bi5MieW-.js";import{I as w,P as T,R as E}from"./index-_SOdLUMq.js";var D=e(s(),1),O=c();function k(){let e=E(e=>e.selectedProjectId),[s,c]=(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),a(e).then(e=>{let t=e.useCustomSystemPrompt;c(e.generatedPrompt),P(t),I(e.customSystemPrompt),M(!t),A(t?e.customSystemPrompt:e.generatedPrompt)}).catch(()=>{c(``),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(s),M(!0)}function K(e){if(!e){M(!1);return}if(k===s){G();return}H(!0)}function q(){G(),H(!1)}function J(){H(!1)}async function Y(){if(e){if(!j&&!k.trim()){T({title:`System prompt required`,description:`Enter a system prompt or enable Generated.`,variant:`destructive`});return}B(!0);try{await r(e,{customSystemPrompt:j?null:k.trim(),useCustomSystemPrompt:!j}),l(),P(!j),I(j?``:k.trim()),T({title:`System prompt settings saved`})}catch(e){T({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)(t,{onClick:Y,disabled:L||z||!U(),children:z?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(u,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`})}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,O.jsx)(C,{id:`use-generated-prompt`,checked:j,onCheckedChange:e=>K(e===!0),disabled:L||z}),(0,O.jsx)(n,{htmlFor:`use-generated-prompt`,className:i(o.labelNormal,`cursor-pointer`),children:`Generated`})]}),L?(0,O.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,O.jsx)(u,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,O.jsx)(w,{value:k,onChange:e=>W(e.target.value),className:i(o.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-D94zYQNc.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-B4PyD4Io.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-BMVTxWTg.js","assets/dialogs-config-BEazgV7k.js","assets/onboarding-Bi5MieW-.js","assets/vosk-speech-CgILeNJR.js","assets/react-vendor-iDwBzcYF.js","assets/utils-CECQ_-6N.js","assets/index-HzthG2_q.css","assets/project-settings-view-DHZVnkug.js","assets/radio-group-n9qyUxmu.js","assets/providers-list-view-Dgid2Wui.js","assets/model-star-rating-BzpXBjSo.js","assets/skeleton-6mGMglV0.js","assets/tabs-iUSYYupj.js","assets/use-deferred-search-DGJskNBr.js","assets/settings-models-view-BAxf3eJq.js","assets/settings-models-skeleton-Cse6L-Nd.js","assets/settings-list-owWkHWxE.js","assets/settings-mcp-servers-view-DsUxcHD0.js","assets/mcp-server-card-ChdAZekt.js","assets/settings-skills-view-DD_0AweF.js","assets/slug-utils-BT1eqWhW.js","assets/settings-rules-view-BPKmp2c-.js","assets/settings-slash-commands-view-CSEjoSTd.js","assets/settings-subagents-view-Bs5ftymi.js","assets/settings-instructions-view-DG6YpJy-.js","assets/settings-system-prompt-view-BNhTFs0x.js","assets/account-view-XO30M3P0.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Ba as n,Et as r,Fa as i,La as a,Ma as o,Mi as s,Oa as c,Qo as l,Sa as u,Xi as d,Yi as f,ba as p,eo as m,es as h,fn as g,ho as _,ls as v,os as y,ss as b,tn as x,wo as S,xa as ee,zo as C}from"./dialogs-config-BEazgV7k.js";import{Ft as te,It as ne,Pt as re}from"./react-vendor-iDwBzcYF.js";import{r as w}from"./monaco-CZnIWXyV.js";import{D as T,E,T as D}from"./history-view-BMVTxWTg.js";import{d as O,l as k}from"./onboarding-Bi5MieW-.js";import{B as A,L as j,N as M,R as N,d as ie,l as P,u as F,y as I}from"./index-B4PyD4Io.js";import{t as L}from"./settings-models-skeleton-Cse6L-Nd.js";var R=b(),z=e(v(),1),B=y(),ae=(0,z.forwardRef)(function(e,t){let n=(0,R.c)(28),{sidebar:r,children:i,defaultSidebarSize:a,minSidebarSize:o,maxSidebarSize:c,minContentSize:l,collapsible:u,collapsedSize:d,className:f,onCollapse:p,onExpand:m,isMobile:h,mobileShowSidebar:g}=e,_=a===void 0?25:a,v=o===void 0?20:o,y=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,te=g===void 0?!0:g,ne=C&&!te,re=C&&te,w=`h-full ${ee}`,T=C?100:_,E=C?50:v,D=C?100:y,O=ne&&`hidden`,k;n[0]===O?k=n[1]:(k=s(`border-r border-transparent`,O),n[0]=O,n[1]=k);let A;n[2]!==S||n[3]!==x||n[4]!==p||n[5]!==m||n[6]!==t||n[7]!==r||n[8]!==T||n[9]!==E||n[10]!==D||n[11]!==k?(A=(0,B.jsx)(F,{ref:t,defaultSize:T,minSize:E,maxSize:D,collapsible:x,collapsedSize:S,onCollapse:p,onExpand:m,className:k,children:r}),n[2]=S,n[3]=x,n[4]=p,n[5]=m,n[6]=t,n[7]=r,n[8]=T,n[9]=E,n[10]=D,n[11]=k,n[12]=A):A=n[12];let j;n[13]===C?j=n[14]:(j=!C&&(0,B.jsx)(P,{withHandle:!0,className:`ml-[-40px]`}),n[13]=C,n[14]=j);let M=re&&`hidden`,N;n[15]===M?N=n[16]:(N=s(`overflow-hidden`,M),n[15]=M,n[16]=N);let I;n[17]!==i||n[18]!==b||n[19]!==N?(I=(0,B.jsx)(F,{minSize:b,className:N,children:i}),n[17]=i,n[18]=b,n[19]=N,n[20]=I):I=n[20];let L;n[21]!==A||n[22]!==j||n[23]!==I?(L=(0,B.jsxs)(ie,{direction:`horizontal`,className:`h-full`,children:[A,j,I]}),n[21]=A,n[22]=j,n[23]=I,n[24]=L):L=n[24];let z;return n[25]!==w||n[26]!==L?(z=(0,B.jsx)(`div`,{className:w,children:L}),n[25]=w,n[26]=L,n[27]=z):z=n[27],z}),oe=[{id:`providers`,label:`Providers`,icon:(0,B.jsx)(C,{className:`h-4 w-4`}),route:`/settings/providers`},{id:`models`,label:`Models`,icon:(0,B.jsx)(l,{className:`h-4 w-4`}),route:`/settings/models`},{id:`skills`,label:`Skills`,icon:(0,B.jsx)(p,{className:`h-4 w-4`}),route:`/settings/skills`},{id:`rules`,label:`Rules`,icon:(0,B.jsx)(n,{className:`h-4 w-4`}),route:`/settings/rules`},{id:`slash-commands`,label:`Slash Commands`,icon:(0,B.jsx)(c,{className:`h-4 w-4`}),route:`/settings/slash-commands`},{id:`subagents`,label:`Subagents`,icon:(0,B.jsx)(ee,{className:`h-4 w-4`}),route:`/settings/subagents`},{id:`instructions`,label:`Instructions`,icon:(0,B.jsx)(h,{className:`h-4 w-4`}),route:`/settings/instructions`},{id:`system-prompt`,label:`System Prompt`,icon:(0,B.jsx)(o,{className:`h-4 w-4`}),route:`/settings/system-prompt`},{id:`mcp-servers`,label:`MCP Servers`,icon:(0,B.jsx)(a,{className:`h-4 w-4`}),route:`/settings/mcp-servers`},{id:`general`,label:`General`,icon:(0,B.jsx)(i,{className:`h-4 w-4`}),route:`/settings/general`},{id:`history`,label:`History`,icon:(0,B.jsx)(_,{className:`h-4 w-4`}),route:`/settings/history`},{id:`account`,label:`Account`,icon:(0,B.jsx)(u,{className:`h-4 w-4`}),route:`/settings/account`}];function V(e){let t=[...oe];if(!e)return t;let n=t.findIndex(e=>e.id===`skills`);return t.splice(n,0,{id:`project`,label:`Project`,icon:(0,B.jsx)(S,{className:`h-4 w-4`}),route:`/settings/project/${e}`}),t}function se(e){let t=(0,R.c)(21),{className:n,selectedProjectId:r,onResetOnboarding:i,onNavItemSelect:a}=e,o=te(),s=re(),c=(0,z.useRef)(0),l=(0,z.useRef)(null),u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>()=>{l.current&&clearTimeout(l.current)},d=[],t[0]=u,t[1]=d):(u=t[0],d=t[1]),(0,z.useEffect)(u,d);let f=I(),p;t[2]===r?p=t[3]:(p=V(r),t[2]=r,t[3]=p);let m=p,h;t[4]!==f||t[5]!==m?(h=f?m.filter(ce):m,t[4]=f,t[5]=m,t[6]=h):h=t[6];let g=h,_;t[7]!==s.pathname||t[8]!==g?(_=function(){let e=s.pathname;if(e.startsWith(`/settings/project/`))return`project`;for(let t of g)if(e.startsWith(t.route))return t.id;return`general`}(),t[7]=s.pathname,t[8]=g,t[9]=_):_=t[9];let v=_,y,b;if(t[10]!==v||t[11]!==n||t[12]!==g||t[13]!==o||t[14]!==a||t[15]!==i){let e=function(e){e.id===`general`&&i&&(l.current&&clearTimeout(l.current),c.current+=1,c.current>=3?(c.current=0,i()):l.current=setTimeout(()=>{c.current=0},1500)),a?.(),o(e.route)};y=`space-y-1${n?` ${n}`:``}`,b=g.map((t,n)=>(0,B.jsxs)(z.Fragment,{children:[(0,B.jsx)(O,{selected:v===t.id,asChild:!0,children:(0,B.jsx)(`button`,{className:`justify-start`,onClick:()=>e(t),children:(0,B.jsxs)(`span`,{className:`flex items-center gap-2`,children:[t.icon,(0,B.jsx)(`span`,{children:t.label})]})})}),(t.id===`models`||t.id===`mcp-servers`||n===g.length-1)&&(0,B.jsx)(k,{className:`my-2 bg-sidebar-border`})]},t.id)),t[10]=v,t[11]=n,t[12]=g,t[13]=o,t[14]=a,t[15]=i,t[16]=y,t[17]=b}else y=t[16],b=t[17];let x;return t[18]!==y||t[19]!==b?(x=(0,B.jsx)(`div`,{className:y,children:b}),t[18]=y,t[19]=b,t[20]=x):x=t[20],x}function ce(e){return e.id!==`account`}var le=(0,z.lazy)(()=>w(()=>import(`./settings-general-view-D94zYQNc.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),ue=(0,z.lazy)(()=>w(()=>import(`./project-settings-view-DHZVnkug.js`),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11,13]))),de=(0,z.lazy)(()=>w(()=>import(`./providers-list-view-Dgid2Wui.js`),__vite__mapDeps([14,1,5,6,7,15,16,17,9,3,4,18]))),fe=(0,z.lazy)(()=>w(()=>import(`./settings-models-view-BAxf3eJq.js`),__vite__mapDeps([19,1,5,6,7,15,20,16,21,17,9,3,4,18]))),pe=(0,z.lazy)(()=>w(()=>import(`./settings-mcp-servers-view-DsUxcHD0.js`),__vite__mapDeps([22,1,2,3,4,5,6,7,8,9,10,11,23,21,16,17]))),me=(0,z.lazy)(()=>w(()=>import(`./settings-skills-view-DD_0AweF.js`),__vite__mapDeps([24,1,2,3,4,5,6,7,8,9,10,11,23,25,21,16,18]))),he=(0,z.lazy)(()=>w(()=>import(`./settings-rules-view-BPKmp2c-.js`),__vite__mapDeps([26,1,2,3,4,5,6,7,8,9,10,11,23,25,21,16,18]))),ge=(0,z.lazy)(()=>w(()=>import(`./settings-slash-commands-view-CSEjoSTd.js`),__vite__mapDeps([27,1,2,3,4,5,6,7,8,9,10,11,23,25,13,21,16]))),_e=(0,z.lazy)(()=>w(()=>import(`./settings-subagents-view-Bs5ftymi.js`),__vite__mapDeps([28,1,2,3,4,5,6,7,8,9,10,11,23,25,21,16]))),ve=(0,z.lazy)(()=>w(()=>import(`./settings-instructions-view-DG6YpJy-.js`),__vite__mapDeps([29,1,2,3,4,5,6,7,8,9,10,11]))),ye=(0,z.lazy)(()=>w(()=>import(`./settings-system-prompt-view-BNhTFs0x.js`),__vite__mapDeps([30,1,2,3,4,5,6,7,8,9,10,11]))),be=(0,z.lazy)(()=>w(()=>import(`./account-view-XO30M3P0.js`),__vite__mapDeps([31,1,2,3,4,5,6,7,8,9,10,11,16]))),xe=(0,z.lazy)(()=>w(()=>import(`./history-view-BMVTxWTg.js`).then(e=>e.t),__vite__mapDeps([5,1,6]))),Se=[`general`,`providers`,`models`,`skills`,`rules`,`slash-commands`,`subagents`,`instructions`,`system-prompt`,`mcp-servers`,`history`,`account`];function H(e){let t=(0,R.c)(2),{title:n}=e,r;return t[0]===n?r=t[1]:(r=(0,B.jsx)(D,{title:n,children:`Content coming soon...`}),t[0]=n,t[1]=r),r}function Ce(){let e=(0,R.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,B.jsxs)(`div`,{className:`mb-6`,children:[(0,B.jsx)(`div`,{className:`h-8 w-32 bg-muted rounded animate-pulse mb-2`}),(0,B.jsx)(`div`,{className:`h-4 w-64 bg-muted rounded animate-pulse`})]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,B.jsx)(`div`,{className:`mb-6`,children:(0,B.jsx)(`div`,{className:`h-10 w-full bg-muted rounded animate-pulse`})}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,B.jsx)(`div`,{className:`h-4 w-36 bg-muted rounded animate-pulse mb-3`}),e[2]=r):r=e[2];let i,a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,B.jsxs)(`div`,{children:[r,(0,B.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,B.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,B.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`})]})]}),a=(0,B.jsx)(`div`,{className:`h-4 w-40 bg-muted rounded animate-pulse mb-3`}),e[3]=i,e[4]=a):(i=e[3],a=e[4]);let o;return e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,B.jsx)(T,{children:(0,B.jsxs)(E,{children:[t,n,(0,B.jsxs)(`div`,{className:`space-y-8`,children:[i,(0,B.jsxs)(`div`,{children:[a,(0,B.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,B.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,B.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,B.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,B.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`})]})]})]})]})}),e[5]=o):o=e[5],o}function we(e){return e.startsWith(`/settings/general`)?`general`:e.startsWith(`/settings/providers`)?`providers`:e.startsWith(`/settings/models`)?`models`:e.startsWith(`/settings/skills`)?`skills`:e.startsWith(`/settings/rules`)?`rules`:e.startsWith(`/settings/slash-commands`)?`slash-commands`:e.startsWith(`/settings/subagents`)?`subagents`:e.startsWith(`/settings/instructions`)?`instructions`:e.startsWith(`/settings/system-prompt`)?`system-prompt`:e.startsWith(`/settings/mcp-servers`)?`mcp-servers`:e.startsWith(`/settings/history`)?`history`:e.startsWith(`/settings/account`)?`account`:`general`}function Te(e){let t=e.match(/^\/settings\/providers\/([^/]+)$/);return t?decodeURIComponent(t[1]):null}function U(){let e=(0,R.c)(62),{tab:n,projectId:i}=ne(),a=te(),o=re(),c=j(),l=N(Oe),u=N(De),p;e[0]!==o.pathname||e[1]!==i?(p=!!i&&o.pathname.startsWith(`/settings/project/`),e[0]=o.pathname,e[1]=i,e[2]=p):p=e[2];let h=p,_;e[3]===o.pathname?_=e[4]:(_=Te(o.pathname),e[3]=o.pathname,e[4]=_);let v=_!==null,y;if(e[5]!==o.pathname||e[6]!==o.search||e[7]!==n){let t=new URLSearchParams(o.search).get(`tab`);y=t&&Se.includes(t)?t:n&&Se.includes(n)?n:we(o.pathname),e[5]=o.pathname,e[6]=o.search,e[7]=n,e[8]=y}else y=e[8];let b=y,S=I(),[ee,C]=(0,z.useState)(!1),[w,T]=(0,z.useState)(!0),[E,D]=(0,z.useState)(0),O=(0,z.useRef)(null),k;bb0:{if(h){k=`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),k=t}let ie=k,P;e[11]===S?P=e[12]:(P=()=>{S&&T(!1)},e[11]=S,e[12]=P);let F=P,V;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{T(!0)},e[13]=V):V=e[13];let ce=V,U;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(U=async()=>{try{await g(),D(Ee)}catch(e){console.error(`Failed to reset onboarding:`,e)}},e[14]=U):U=e[14];let ke=U,W;e[15]===a?W=e[16]:(W=()=>{a(`/`)},e[15]=a,e[16]=W);let Ae=W,G;e[17]===l?G=e[18]:(G=l?{type:`project`,id:l}:void 0,e[17]=l,e[18]=G);let je=G,K;e[19]===a?K=e[20]:(K=()=>{a(`/settings/general`)},e[19]=a,e[20]=K);let Me=K,q;e[21]!==c||e[22]!==i?(q=async()=>{x(i);try{let e=await r();c({type:A.SetProjects,projects:e.projects})}catch(e){let t=e;throw console.error(`Failed to refresh projects after settings update:`,t),t}},e[21]=c,e[22]=i,e[23]=q):q=e[23];let Ne=q,Pe,Fe;e[24]!==S||e[25]!==o.pathname||e[26]!==a?(Pe=()=>{(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})},Fe=[o.pathname,a,S],e[24]=S,e[25]=o.pathname,e[26]=a,e[27]=Pe,e[28]=Fe):(Pe=e[27],Fe=e[28]),(0,z.useEffect)(Pe,Fe);let J;e[29]!==Ae||e[30]!==F||e[31]!==l?(J=()=>(0,B.jsx)(M,{onTitleClose:Ae,subtitle:`Settings`,children:(0,B.jsx)(`div`,{className:`px-2 py-2`,children:(0,B.jsx)(se,{selectedProjectId:l,onResetOnboarding:ke,onNavItemSelect:F})})}),e[29]=Ae,e[30]=F,e[31]=l,e[32]=J):J=e[32];let Ie=J,Le;e[33]!==b||e[34]!==Me||e[35]!==Ne||e[36]!==je||e[37]!==h||e[38]!==E||e[39]!==i||e[40]!==u?(Le=()=>{if(h&&i)return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Project Settings`}),children:(0,B.jsx)(ue,{projectId:i,onProjectUpdated:Ne})});switch(b){case`general`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`General`}),children:(0,B.jsx)(le,{onboardingResetSignal:E})});case`providers`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(Ce,{}),children:(0,B.jsx)(de,{})});case`models`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(L,{}),children:(0,B.jsx)(fe,{})});case`skills`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Skills`}),children:(0,B.jsx)(me,{})});case`rules`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Rules`}),children:(0,B.jsx)(he,{})});case`slash-commands`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Slash Commands`}),children:(0,B.jsx)(ge,{})});case`subagents`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Subagents`}),children:(0,B.jsx)(_e,{})});case`instructions`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Instructions`}),children:(0,B.jsx)(ve,{})});case`system-prompt`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`System Prompt`}),children:(0,B.jsx)(ye,{})});case`mcp-servers`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`MCP Servers`}),children:(0,B.jsx)(pe,{})});case`history`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`History`}),children:(0,B.jsx)(xe,{isOpen:!0,onClose:Me,initialFilter:je,projects:u,inline:!0})});case`account`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Account`}),children:(0,B.jsx)(be,{})});default:return(0,B.jsx)(H,{title:`Settings`})}},e[33]=b,e[34]=Me,e[35]=Ne,e[36]=je,e[37]=h,e[38]=E,e[39]=i,e[40]=u,e[41]=Le):Le=e[41];let Re=Le,ze,Be;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>C(!0),Be=()=>C(!1),e[42]=ze,e[43]=Be):(ze=e[42],Be=e[43]);let Y;e[44]===Ie?Y=e[45]:(Y=Ie(),e[44]=Ie,e[45]=Y);let Ve=`flex-1 overflow-auto ${ee&&!S?`ml-[40px]`:``}`,X;e[46]!==ie||e[47]!==S||e[48]!==v||e[49]!==w?(X=S&&!w&&!v?(0,B.jsx)(`div`,{className:s(f.settingsPage,`pb-0`),children:(0,B.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-center gap-2`,children:[(0,B.jsxs)(t,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground`,onClick:ce,children:[(0,B.jsx)(m,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Show settings menu`})]}),(0,B.jsx)(`span`,{className:s(d.sectionTitle,`truncate text-foreground`),children:ie})]})}):null,e[46]=ie,e[47]=S,e[48]=v,e[49]=w,e[50]=X):X=e[50];let Z;e[51]===Re?Z=e[52]:(Z=Re(),e[51]=Re,e[52]=Z);let Q;e[53]!==Ve||e[54]!==X||e[55]!==Z?(Q=(0,B.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,B.jsxs)(`div`,{className:Ve,children:[X,Z]})}),e[53]=Ve,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,B.jsx)(ae,{ref:O,collapsible:!0,isMobile:S,mobileShowSidebar:w,onCollapse:ze,onExpand:Be,sidebar:Y,children:Q}),e[57]=S,e[58]=w,e[59]=Y,e[60]=Q,e[61]=$):$=e[61],$}function Ee(e){return e+1}function De(e){return e.projects}function Oe(e){return e.selectedProjectId}export{U as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/settings-general-view-Vwi9J6Tn.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-_SOdLUMq.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-BMVTxWTg.js","assets/dialogs-config-BEazgV7k.js","assets/onboarding-Bi5MieW-.js","assets/vosk-speech-CgILeNJR.js","assets/react-vendor-iDwBzcYF.js","assets/utils-CECQ_-6N.js","assets/index-C7FLshNp.css","assets/project-settings-view-CHV6lJG4.js","assets/radio-group-n9qyUxmu.js","assets/providers-list-view-Dgid2Wui.js","assets/model-star-rating-BzpXBjSo.js","assets/skeleton-6mGMglV0.js","assets/tabs-iUSYYupj.js","assets/use-deferred-search-DGJskNBr.js","assets/settings-models-view-BAxf3eJq.js","assets/settings-models-skeleton-Cse6L-Nd.js","assets/settings-list-owWkHWxE.js","assets/settings-mcp-servers-view-CCXW_uet.js","assets/mcp-server-card-ChdAZekt.js","assets/settings-skills-view-DaqOna-w.js","assets/slug-utils-BT1eqWhW.js","assets/settings-rules-view-D3KLTKVZ.js","assets/settings-slash-commands-view-CN8_DTYX.js","assets/settings-subagents-view-BIejA-ck.js","assets/settings-instructions-view-8YIr0PO3.js","assets/settings-system-prompt-view-B1vc2cgC.js","assets/account-view-DxHV7OtO.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Ba as n,Et as r,Fa as i,La as a,Ma as o,Mi as s,Oa as c,Qo as l,Sa as u,Xi as d,Yi as f,ba as p,eo as m,es as h,fn as g,ho as _,ls as v,os as y,ss as b,tn as x,wo as S,xa as ee,zo as C}from"./dialogs-config-BEazgV7k.js";import{Ft as te,It as ne,Pt as re}from"./react-vendor-iDwBzcYF.js";import{r as w}from"./monaco-CZnIWXyV.js";import{D as T,E,T as D}from"./history-view-BMVTxWTg.js";import{d as O,l as k}from"./onboarding-Bi5MieW-.js";import{B as A,L as j,N as M,R as N,d as ie,l as P,u as F,y as I}from"./index-_SOdLUMq.js";import{t as L}from"./settings-models-skeleton-Cse6L-Nd.js";var R=b(),z=e(v(),1),B=y(),ae=(0,z.forwardRef)(function(e,t){let n=(0,R.c)(28),{sidebar:r,children:i,defaultSidebarSize:a,minSidebarSize:o,maxSidebarSize:c,minContentSize:l,collapsible:u,collapsedSize:d,className:f,onCollapse:p,onExpand:m,isMobile:h,mobileShowSidebar:g}=e,_=a===void 0?25:a,v=o===void 0?20:o,y=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,te=g===void 0?!0:g,ne=C&&!te,re=C&&te,w=`h-full ${ee}`,T=C?100:_,E=C?50:v,D=C?100:y,O=ne&&`hidden`,k;n[0]===O?k=n[1]:(k=s(`border-r border-transparent`,O),n[0]=O,n[1]=k);let A;n[2]!==S||n[3]!==x||n[4]!==p||n[5]!==m||n[6]!==t||n[7]!==r||n[8]!==T||n[9]!==E||n[10]!==D||n[11]!==k?(A=(0,B.jsx)(F,{ref:t,defaultSize:T,minSize:E,maxSize:D,collapsible:x,collapsedSize:S,onCollapse:p,onExpand:m,className:k,children:r}),n[2]=S,n[3]=x,n[4]=p,n[5]=m,n[6]=t,n[7]=r,n[8]=T,n[9]=E,n[10]=D,n[11]=k,n[12]=A):A=n[12];let j;n[13]===C?j=n[14]:(j=!C&&(0,B.jsx)(P,{withHandle:!0,className:`ml-[-40px]`}),n[13]=C,n[14]=j);let M=re&&`hidden`,N;n[15]===M?N=n[16]:(N=s(`overflow-hidden`,M),n[15]=M,n[16]=N);let I;n[17]!==i||n[18]!==b||n[19]!==N?(I=(0,B.jsx)(F,{minSize:b,className:N,children:i}),n[17]=i,n[18]=b,n[19]=N,n[20]=I):I=n[20];let L;n[21]!==A||n[22]!==j||n[23]!==I?(L=(0,B.jsxs)(ie,{direction:`horizontal`,className:`h-full`,children:[A,j,I]}),n[21]=A,n[22]=j,n[23]=I,n[24]=L):L=n[24];let z;return n[25]!==w||n[26]!==L?(z=(0,B.jsx)(`div`,{className:w,children:L}),n[25]=w,n[26]=L,n[27]=z):z=n[27],z}),oe=[{id:`providers`,label:`Providers`,icon:(0,B.jsx)(C,{className:`h-4 w-4`}),route:`/settings/providers`},{id:`models`,label:`Models`,icon:(0,B.jsx)(l,{className:`h-4 w-4`}),route:`/settings/models`},{id:`skills`,label:`Skills`,icon:(0,B.jsx)(p,{className:`h-4 w-4`}),route:`/settings/skills`},{id:`rules`,label:`Rules`,icon:(0,B.jsx)(n,{className:`h-4 w-4`}),route:`/settings/rules`},{id:`slash-commands`,label:`Slash Commands`,icon:(0,B.jsx)(c,{className:`h-4 w-4`}),route:`/settings/slash-commands`},{id:`subagents`,label:`Subagents`,icon:(0,B.jsx)(ee,{className:`h-4 w-4`}),route:`/settings/subagents`},{id:`instructions`,label:`Instructions`,icon:(0,B.jsx)(h,{className:`h-4 w-4`}),route:`/settings/instructions`},{id:`system-prompt`,label:`System Prompt`,icon:(0,B.jsx)(o,{className:`h-4 w-4`}),route:`/settings/system-prompt`},{id:`mcp-servers`,label:`MCP Servers`,icon:(0,B.jsx)(a,{className:`h-4 w-4`}),route:`/settings/mcp-servers`},{id:`general`,label:`General`,icon:(0,B.jsx)(i,{className:`h-4 w-4`}),route:`/settings/general`},{id:`history`,label:`History`,icon:(0,B.jsx)(_,{className:`h-4 w-4`}),route:`/settings/history`},{id:`account`,label:`Account`,icon:(0,B.jsx)(u,{className:`h-4 w-4`}),route:`/settings/account`}];function V(e){let t=[...oe];if(!e)return t;let n=t.findIndex(e=>e.id===`skills`);return t.splice(n,0,{id:`project`,label:`Project`,icon:(0,B.jsx)(S,{className:`h-4 w-4`}),route:`/settings/project/${e}`}),t}function se(e){let t=(0,R.c)(21),{className:n,selectedProjectId:r,onResetOnboarding:i,onNavItemSelect:a}=e,o=te(),s=re(),c=(0,z.useRef)(0),l=(0,z.useRef)(null),u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>()=>{l.current&&clearTimeout(l.current)},d=[],t[0]=u,t[1]=d):(u=t[0],d=t[1]),(0,z.useEffect)(u,d);let f=I(),p;t[2]===r?p=t[3]:(p=V(r),t[2]=r,t[3]=p);let m=p,h;t[4]!==f||t[5]!==m?(h=f?m.filter(ce):m,t[4]=f,t[5]=m,t[6]=h):h=t[6];let g=h,_;t[7]!==s.pathname||t[8]!==g?(_=function(){let e=s.pathname;if(e.startsWith(`/settings/project/`))return`project`;for(let t of g)if(e.startsWith(t.route))return t.id;return`general`}(),t[7]=s.pathname,t[8]=g,t[9]=_):_=t[9];let v=_,y,b;if(t[10]!==v||t[11]!==n||t[12]!==g||t[13]!==o||t[14]!==a||t[15]!==i){let e=function(e){e.id===`general`&&i&&(l.current&&clearTimeout(l.current),c.current+=1,c.current>=3?(c.current=0,i()):l.current=setTimeout(()=>{c.current=0},1500)),a?.(),o(e.route)};y=`space-y-1${n?` ${n}`:``}`,b=g.map((t,n)=>(0,B.jsxs)(z.Fragment,{children:[(0,B.jsx)(O,{selected:v===t.id,asChild:!0,children:(0,B.jsx)(`button`,{className:`justify-start`,onClick:()=>e(t),children:(0,B.jsxs)(`span`,{className:`flex items-center gap-2`,children:[t.icon,(0,B.jsx)(`span`,{children:t.label})]})})}),(t.id===`models`||t.id===`mcp-servers`||n===g.length-1)&&(0,B.jsx)(k,{className:`my-2 bg-sidebar-border`})]},t.id)),t[10]=v,t[11]=n,t[12]=g,t[13]=o,t[14]=a,t[15]=i,t[16]=y,t[17]=b}else y=t[16],b=t[17];let x;return t[18]!==y||t[19]!==b?(x=(0,B.jsx)(`div`,{className:y,children:b}),t[18]=y,t[19]=b,t[20]=x):x=t[20],x}function ce(e){return e.id!==`account`}var le=(0,z.lazy)(()=>w(()=>import(`./settings-general-view-Vwi9J6Tn.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),ue=(0,z.lazy)(()=>w(()=>import(`./project-settings-view-CHV6lJG4.js`),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11,13]))),de=(0,z.lazy)(()=>w(()=>import(`./providers-list-view-Dgid2Wui.js`),__vite__mapDeps([14,1,5,6,7,15,16,17,9,3,4,18]))),fe=(0,z.lazy)(()=>w(()=>import(`./settings-models-view-BAxf3eJq.js`),__vite__mapDeps([19,1,5,6,7,15,20,16,21,17,9,3,4,18]))),pe=(0,z.lazy)(()=>w(()=>import(`./settings-mcp-servers-view-CCXW_uet.js`),__vite__mapDeps([22,1,2,3,4,5,6,7,8,9,10,11,23,21,16,17]))),me=(0,z.lazy)(()=>w(()=>import(`./settings-skills-view-DaqOna-w.js`),__vite__mapDeps([24,1,2,3,4,5,6,7,8,9,10,11,23,25,21,16,18]))),he=(0,z.lazy)(()=>w(()=>import(`./settings-rules-view-D3KLTKVZ.js`),__vite__mapDeps([26,1,2,3,4,5,6,7,8,9,10,11,23,25,21,16,18]))),ge=(0,z.lazy)(()=>w(()=>import(`./settings-slash-commands-view-CN8_DTYX.js`),__vite__mapDeps([27,1,2,3,4,5,6,7,8,9,10,11,23,25,13,21,16]))),_e=(0,z.lazy)(()=>w(()=>import(`./settings-subagents-view-BIejA-ck.js`),__vite__mapDeps([28,1,2,3,4,5,6,7,8,9,10,11,23,25,21,16]))),ve=(0,z.lazy)(()=>w(()=>import(`./settings-instructions-view-8YIr0PO3.js`),__vite__mapDeps([29,1,2,3,4,5,6,7,8,9,10,11]))),ye=(0,z.lazy)(()=>w(()=>import(`./settings-system-prompt-view-B1vc2cgC.js`),__vite__mapDeps([30,1,2,3,4,5,6,7,8,9,10,11]))),be=(0,z.lazy)(()=>w(()=>import(`./account-view-DxHV7OtO.js`),__vite__mapDeps([31,1,2,3,4,5,6,7,8,9,10,11,16]))),xe=(0,z.lazy)(()=>w(()=>import(`./history-view-BMVTxWTg.js`).then(e=>e.t),__vite__mapDeps([5,1,6]))),Se=[`general`,`providers`,`models`,`skills`,`rules`,`slash-commands`,`subagents`,`instructions`,`system-prompt`,`mcp-servers`,`history`,`account`];function H(e){let t=(0,R.c)(2),{title:n}=e,r;return t[0]===n?r=t[1]:(r=(0,B.jsx)(D,{title:n,children:`Content coming soon...`}),t[0]=n,t[1]=r),r}function Ce(){let e=(0,R.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,B.jsxs)(`div`,{className:`mb-6`,children:[(0,B.jsx)(`div`,{className:`h-8 w-32 bg-muted rounded animate-pulse mb-2`}),(0,B.jsx)(`div`,{className:`h-4 w-64 bg-muted rounded animate-pulse`})]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,B.jsx)(`div`,{className:`mb-6`,children:(0,B.jsx)(`div`,{className:`h-10 w-full bg-muted rounded animate-pulse`})}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,B.jsx)(`div`,{className:`h-4 w-36 bg-muted rounded animate-pulse mb-3`}),e[2]=r):r=e[2];let i,a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,B.jsxs)(`div`,{children:[r,(0,B.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,B.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,B.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`})]})]}),a=(0,B.jsx)(`div`,{className:`h-4 w-40 bg-muted rounded animate-pulse mb-3`}),e[3]=i,e[4]=a):(i=e[3],a=e[4]);let o;return e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,B.jsx)(T,{children:(0,B.jsxs)(E,{children:[t,n,(0,B.jsxs)(`div`,{className:`space-y-8`,children:[i,(0,B.jsxs)(`div`,{children:[a,(0,B.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,B.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,B.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,B.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,B.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`})]})]})]})]})}),e[5]=o):o=e[5],o}function we(e){return e.startsWith(`/settings/general`)?`general`:e.startsWith(`/settings/providers`)?`providers`:e.startsWith(`/settings/models`)?`models`:e.startsWith(`/settings/skills`)?`skills`:e.startsWith(`/settings/rules`)?`rules`:e.startsWith(`/settings/slash-commands`)?`slash-commands`:e.startsWith(`/settings/subagents`)?`subagents`:e.startsWith(`/settings/instructions`)?`instructions`:e.startsWith(`/settings/system-prompt`)?`system-prompt`:e.startsWith(`/settings/mcp-servers`)?`mcp-servers`:e.startsWith(`/settings/history`)?`history`:e.startsWith(`/settings/account`)?`account`:`general`}function Te(e){let t=e.match(/^\/settings\/providers\/([^/]+)$/);return t?decodeURIComponent(t[1]):null}function U(){let e=(0,R.c)(62),{tab:n,projectId:i}=ne(),a=te(),o=re(),c=j(),l=N(Oe),u=N(De),p;e[0]!==o.pathname||e[1]!==i?(p=!!i&&o.pathname.startsWith(`/settings/project/`),e[0]=o.pathname,e[1]=i,e[2]=p):p=e[2];let h=p,_;e[3]===o.pathname?_=e[4]:(_=Te(o.pathname),e[3]=o.pathname,e[4]=_);let v=_!==null,y;if(e[5]!==o.pathname||e[6]!==o.search||e[7]!==n){let t=new URLSearchParams(o.search).get(`tab`);y=t&&Se.includes(t)?t:n&&Se.includes(n)?n:we(o.pathname),e[5]=o.pathname,e[6]=o.search,e[7]=n,e[8]=y}else y=e[8];let b=y,S=I(),[ee,C]=(0,z.useState)(!1),[w,T]=(0,z.useState)(!0),[E,D]=(0,z.useState)(0),O=(0,z.useRef)(null),k;bb0:{if(h){k=`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),k=t}let ie=k,P;e[11]===S?P=e[12]:(P=()=>{S&&T(!1)},e[11]=S,e[12]=P);let F=P,V;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{T(!0)},e[13]=V):V=e[13];let ce=V,U;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(U=async()=>{try{await g(),D(Ee)}catch(e){console.error(`Failed to reset onboarding:`,e)}},e[14]=U):U=e[14];let ke=U,W;e[15]===a?W=e[16]:(W=()=>{a(`/`)},e[15]=a,e[16]=W);let Ae=W,G;e[17]===l?G=e[18]:(G=l?{type:`project`,id:l}:void 0,e[17]=l,e[18]=G);let je=G,K;e[19]===a?K=e[20]:(K=()=>{a(`/settings/general`)},e[19]=a,e[20]=K);let Me=K,q;e[21]!==c||e[22]!==i?(q=async()=>{x(i);try{let e=await r();c({type:A.SetProjects,projects:e.projects})}catch(e){let t=e;throw console.error(`Failed to refresh projects after settings update:`,t),t}},e[21]=c,e[22]=i,e[23]=q):q=e[23];let Ne=q,Pe,Fe;e[24]!==S||e[25]!==o.pathname||e[26]!==a?(Pe=()=>{(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})},Fe=[o.pathname,a,S],e[24]=S,e[25]=o.pathname,e[26]=a,e[27]=Pe,e[28]=Fe):(Pe=e[27],Fe=e[28]),(0,z.useEffect)(Pe,Fe);let J;e[29]!==Ae||e[30]!==F||e[31]!==l?(J=()=>(0,B.jsx)(M,{onTitleClose:Ae,subtitle:`Settings`,children:(0,B.jsx)(`div`,{className:`px-2 py-2`,children:(0,B.jsx)(se,{selectedProjectId:l,onResetOnboarding:ke,onNavItemSelect:F})})}),e[29]=Ae,e[30]=F,e[31]=l,e[32]=J):J=e[32];let Ie=J,Le;e[33]!==b||e[34]!==Me||e[35]!==Ne||e[36]!==je||e[37]!==h||e[38]!==E||e[39]!==i||e[40]!==u?(Le=()=>{if(h&&i)return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Project Settings`}),children:(0,B.jsx)(ue,{projectId:i,onProjectUpdated:Ne})});switch(b){case`general`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`General`}),children:(0,B.jsx)(le,{onboardingResetSignal:E})});case`providers`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(Ce,{}),children:(0,B.jsx)(de,{})});case`models`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(L,{}),children:(0,B.jsx)(fe,{})});case`skills`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Skills`}),children:(0,B.jsx)(me,{})});case`rules`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Rules`}),children:(0,B.jsx)(he,{})});case`slash-commands`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Slash Commands`}),children:(0,B.jsx)(ge,{})});case`subagents`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Subagents`}),children:(0,B.jsx)(_e,{})});case`instructions`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Instructions`}),children:(0,B.jsx)(ve,{})});case`system-prompt`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`System Prompt`}),children:(0,B.jsx)(ye,{})});case`mcp-servers`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`MCP Servers`}),children:(0,B.jsx)(pe,{})});case`history`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`History`}),children:(0,B.jsx)(xe,{isOpen:!0,onClose:Me,initialFilter:je,projects:u,inline:!0})});case`account`:return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(H,{title:`Account`}),children:(0,B.jsx)(be,{})});default:return(0,B.jsx)(H,{title:`Settings`})}},e[33]=b,e[34]=Me,e[35]=Ne,e[36]=je,e[37]=h,e[38]=E,e[39]=i,e[40]=u,e[41]=Le):Le=e[41];let Re=Le,ze,Be;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>C(!0),Be=()=>C(!1),e[42]=ze,e[43]=Be):(ze=e[42],Be=e[43]);let Y;e[44]===Ie?Y=e[45]:(Y=Ie(),e[44]=Ie,e[45]=Y);let Ve=`flex-1 overflow-auto ${ee&&!S?`ml-[40px]`:``}`,X;e[46]!==ie||e[47]!==S||e[48]!==v||e[49]!==w?(X=S&&!w&&!v?(0,B.jsx)(`div`,{className:s(f.settingsPage,`pb-0`),children:(0,B.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-center gap-2`,children:[(0,B.jsxs)(t,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground`,onClick:ce,children:[(0,B.jsx)(m,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Show settings menu`})]}),(0,B.jsx)(`span`,{className:s(d.sectionTitle,`truncate text-foreground`),children:ie})]})}):null,e[46]=ie,e[47]=S,e[48]=v,e[49]=w,e[50]=X):X=e[50];let Z;e[51]===Re?Z=e[52]:(Z=Re(),e[51]=Re,e[52]=Z);let Q;e[53]!==Ve||e[54]!==X||e[55]!==Z?(Q=(0,B.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,B.jsxs)(`div`,{className:Ve,children:[X,Z]})}),e[53]=Ve,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,B.jsx)(ae,{ref:O,collapsible:!0,isMobile:S,mobileShowSidebar:w,onCollapse:ze,onExpand:Be,sidebar:Y,children:Q}),e[57]=S,e[58]=w,e[59]=Y,e[60]=Q,e[61]=$):$=e[61],$}function Ee(e){return e+1}function De(e){return e.projects}function Oe(e){return e.selectedProjectId}export{U as default};