tarsk 0.5.37 → 0.5.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/public/assets/{account-view-Cn4P1srV.js → account-view-BT90zNSx.js} +1 -1
- package/dist/public/assets/{browser-tab-DeoHDVON.js → browser-tab-Bp486a9f.js} +1 -1
- package/dist/public/assets/{commit-dialog-CWb_KVrD.js → commit-dialog-90PGbqs8.js} +1 -1
- package/dist/public/assets/{create-repo-dialog-BCPrWkIv.js → create-repo-dialog-BkUdww3q.js} +1 -1
- package/dist/public/assets/{diff-view-DL3hFREY.js → diff-view-B4G8vqZa.js} +1 -1
- package/dist/public/assets/{explorer-tab-view-DAs4rpHu.js → explorer-tab-view-DEQFid8r.js} +2 -2
- package/dist/public/assets/{explorer-tree-BV1LcznV.js → explorer-tree-CPHGgahA.js} +1 -1
- package/dist/public/assets/{explorer-view-BGSxs_-F.js → explorer-view-BTvhSMDQ.js} +1 -1
- package/dist/public/assets/{git-ops-button-DZzOCOr8.js → git-ops-button-BnVMlOO3.js} +2 -2
- package/dist/public/assets/index-DjD2SPNZ.js +65 -0
- package/dist/public/assets/{project-settings-view-B7RBOfiB.js → project-settings-view-ZJjQbFbQ.js} +1 -1
- package/dist/public/assets/providers-list-view-BH13AB_H.js +1 -0
- package/dist/public/assets/{pull-request-dialog-BIRSLJAA.js → pull-request-dialog-ZzVXh6M9.js} +1 -1
- package/dist/public/assets/{settings-general-view-CH-51vI0.js → settings-general-view-C8muiP_K.js} +1 -1
- package/dist/public/assets/{settings-instructions-view-D9HZldUk.js → settings-instructions-view-CV7lRPuw.js} +1 -1
- package/dist/public/assets/{settings-mcp-servers-view-o2gqb0qo.js → settings-mcp-servers-view-3gN9ly3z.js} +1 -1
- package/dist/public/assets/{settings-models-view-m-MDG6JH.js → settings-models-view-CAMouMhE.js} +1 -1
- package/dist/public/assets/{settings-rules-view-tG9JJQzK.js → settings-rules-view-BnazfbJb.js} +1 -1
- package/dist/public/assets/{settings-skills-view-DLyWp1pq.js → settings-skills-view-DpzKFcpf.js} +1 -1
- package/dist/public/assets/{settings-slash-commands-view-B7OCA_J1.js → settings-slash-commands-view-Drje2Dl4.js} +1 -1
- package/dist/public/assets/{settings-subagents-view-CSkVwd-J.js → settings-subagents-view-D05kHO1W.js} +1 -1
- package/dist/public/assets/{settings-system-prompt-view-Br6r4RXb.js → settings-system-prompt-view-DQmSdSnp.js} +1 -1
- package/dist/public/assets/settings-view-B6e0GfSv.js +2 -0
- package/dist/public/assets/{terminal-panel-D3Ru16FT.js → terminal-panel-BzCO142Q.js} +1 -1
- package/dist/public/index.html +1 -1
- package/package.json +1 -1
- package/dist/public/assets/index-CbJ3v0Sr.js +0 -65
- package/dist/public/assets/providers-list-view-BQFttbEU.js +0 -1
- package/dist/public/assets/settings-view-rUCFRiPR.js +0 -2
package/dist/public/assets/{project-settings-view-B7RBOfiB.js → project-settings-view-ZJjQbFbQ.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dn as t,Ea as n,Er as r,Fi as i,Ii as a,On as o,Sn as s,Tn as c,_t as ee,ci as l,ji as u,ki as d,ua as te,ui as f,wi as p,wn as m,wr as h,xn as ne,xo as g,yt as re}from"./dialogs-config-DZKtVbNK.js";import{ct as ie}from"./react-vendor-Ba8DSNiO.js";import{n as ae}from"./onboarding-CxtzQldG.js";import{D as oe,E as se,S as ce,T as le,b as _}from"./history-view-jX3PPID6.js";import{E as v,O as y}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dn as t,Ea as n,Er as r,Fi as i,Ii as a,On as o,Sn as s,Tn as c,_t as ee,ci as l,ji as u,ki as d,ua as te,ui as f,wi as p,wn as m,wr as h,xn as ne,xo as g,yt as re}from"./dialogs-config-DZKtVbNK.js";import{ct as ie}from"./react-vendor-Ba8DSNiO.js";import{n as ae}from"./onboarding-CxtzQldG.js";import{D as oe,E as se,S as ce,T as le,b as _}from"./history-view-jX3PPID6.js";import{E as v,O as y}from"./index-DjD2SPNZ.js";import{n as ue,t as de}from"./radio-group-Bd8YbtFD.js";var b=e(g(),1),x=u();function S({projectId:e,onProjectUpdated:u}){let g=ie(),[S,C]=(0,b.useState)(``),[w,T]=(0,b.useState)(``),[E,D]=(0,b.useState)(``),[O,k]=(0,b.useState)(d.PullRequest),[A,j]=(0,b.useState)(``),[M,N]=(0,b.useState)(!1),[P,F]=(0,b.useState)(!1),[I,L]=(0,b.useState)(!1),[fe,R]=(0,b.useState)(``),[pe,z]=(0,b.useState)(``),[me,B]=(0,b.useState)(``),[he,V]=(0,b.useState)(``),[ge,H]=(0,b.useState)(d.PullRequest),[U,W]=(0,b.useState)(!0),[G,K]=(0,b.useState)([]),[_e,q]=(0,b.useState)(!0),[ve,J]=(0,b.useState)([]),[Y,X]=(0,b.useState)([]),[Z,Q]=(0,b.useState)([]),$=(0,b.useCallback)(async()=>{if(e){L(!0);try{let t=await ee(e),n=await re(e),r=t.name??``,i=t.setupScript??``,a=t.validationScript??``,o=t.runCommand??``,s=t.commitMethod??d.PullRequest,c=t.allowAllCommands!==!1,l=t.allowedCommandPatterns??[],u=n.vars.map(e=>({name:e.name,value:``,hasExistingValue:e.hasValue}));C(r),T(i),j(a),D(o),k(s),W(c),K(l),X(u),R(r),z(i),B(a),V(o),H(s),q(c),J(l),Q(u)}catch(e){v({title:`Error`,description:e instanceof Error?e.message:`Failed to load project settings`,variant:`destructive`})}finally{L(!1)}}},[e]);(0,b.useEffect)(()=>{$()},[$]);function ye(){X(e=>[...e,{name:``,value:``,hasExistingValue:!1}])}function be(e,t){X(n=>n.map((n,r)=>r===e?{...n,name:t.toUpperCase()}:n))}function xe(e,t){X(n=>n.map((n,r)=>r===e?{...n,value:t}:n))}function Se(e){X(t=>t.filter((t,n)=>n!==e))}function Ce(){if(Y.length!==Z.length)return!0;for(let e=0;e<Y.length;e+=1){let t=Y[e],n=Z[e];if(!n||t.name!==n.name||t.value!==n.value||t.hasExistingValue!==n.hasExistingValue)return!0}return!1}return e?(0,x.jsx)(oe,{children:(0,x.jsxs)(se,{children:[(0,x.jsx)(ce,{title:`Project Settings`,description:`Configure settings for your project.`,action:(0,x.jsx)(l,{onClick:async()=>{if(e){N(!0);try{if(S!==fe&&await c(e,S),w!==pe&&await t(e,w.trim()||null,!1),A!==me&&await m(e,{validationScript:A.trim()||null}),E!==he&&await o(e,E.trim()||null),O!==ge&&await m(e,{commitMethod:O}),(U!==_e||JSON.stringify(G)!==JSON.stringify(ve))&&await m(e,{allowAllCommands:U,allowedCommandPatterns:G}),Ce()){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 s(e,t.map(e=>({name:e.name,value:e.value.trim()||void 0})))}R(S),z(w),B(A),V(E),H(O),q(U),J(G),Q(Y.map(e=>({...e,value:``}))),u&&await u(),await $(),v({title:`Success`,description:`Project settings saved`}),g(`/`)}catch(e){v({title:`Error`,description:e instanceof Error?e.message:`Failed to save settings`,variant:`destructive`})}finally{N(!1)}}},disabled:M||I,children:M?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(n,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):I?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(n,{className:`mr-2 h-4 w-4 animate-spin`}),`Loading...`]}):`Save`})}),(0,x.jsxs)(`div`,{className:`space-y-6`,children:[(0,x.jsx)(_,{title:`Project Name`,children:(0,x.jsx)(r,{id:`projectName`,value:S,onChange:e=>C(e.target.value),placeholder:`Enter project name`,disabled:I})}),(0,x.jsx)(_,{title:`Setup Script`,description:`This script runs automatically after cloning the repo for new threads.`,children:(0,x.jsx)(y,{id:`setupScript`,value:w,onChange:e=>T(e.target.value),placeholder:`e.g. npm install`,className:`font-mono min-h-[80px] resize-none`,disabled:I})}),(0,x.jsx)(_,{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,x.jsx)(y,{id:`validationScript`,value:A,onChange:e=>j(e.target.value),placeholder:`e.g. npm run lint && npm test`,className:`font-mono min-h-[80px] resize-none`,disabled:I})}),(0,x.jsx)(_,{title:`Run Command`,description:`The command to start the dev server. Leave empty to disable run functionality.`,action:(0,x.jsx)(l,{variant:`ghost`,size:`sm`,onClick:async()=>{if(e){F(!0);try{let t=await ne(e);t.runCommand?(D(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{F(!1)}}},disabled:P||I,children:P?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(n,{className:`h-3 w-3 animate-spin`}),`Suggesting...`]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(i,{className:`h-3 w-3`}),`Suggest`]})}),children:(0,x.jsx)(r,{id:`runCommand`,value:E,onChange:e=>D(e.target.value),placeholder:`e.g. npm run dev`,className:`font-mono`,disabled:I})}),(0,x.jsx)(_,{title:`Commit Method`,description:O===d.PullRequest?`Feature branches are created and pull requests can be created.`:`Commits are made directly to the main branch without feature branches.`,children:(0,x.jsxs)(de,{value:O,onValueChange:e=>k(e),className:`flex gap-4`,disabled:I,children:[(0,x.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,x.jsx)(ue,{value:d.PullRequest,id:`commit-pr`}),(0,x.jsx)(h,{htmlFor:`commit-pr`,className:f(p.labelNormal,`cursor-pointer`),children:`Pull Requests`})]}),(0,x.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,x.jsx)(ue,{value:d.Direct,id:`commit-direct`}),(0,x.jsx)(h,{htmlFor:`commit-direct`,className:f(p.labelNormal,`cursor-pointer`),children:`Direct Commits`})]})]})}),(0,x.jsxs)(_,{title:`Confirm Commands`,description:`When checked, the agent asks for approval before running bash commands, skill scripts, and browser shell calls.`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(ae,{id:`confirmCommands`,checked:!U,onCheckedChange:e=>W(e!==!0),disabled:I}),(0,x.jsx)(h,{htmlFor:`confirmCommands`,className:p.labelNormal,children:`Require approval for bash commands, skill scripts, and browser shell calls`})]}),!U&&G.length>0&&(0,x.jsxs)(`div`,{className:`space-y-2 mt-3`,children:[(0,x.jsx)(h,{children:`Allowed command patterns`}),(0,x.jsx)(`ul`,{className:`space-y-1`,children:G.map(e=>(0,x.jsxs)(`li`,{className:`flex items-center justify-between rounded-md border border-border px-3 py-2`,children:[(0,x.jsx)(`code`,{className:f(p.mono,p.bodyMuted),children:e}),(0,x.jsx)(l,{type:`button`,variant:`ghost`,size:`sm`,disabled:I||M,onClick:()=>K(t=>t.filter(t=>t!==e)),children:`Remove`})]},e))})]})]}),(0,x.jsx)(_,{title:`Environment Variables`,description:`Stored encrypted in the Tarsk database and injected when the agent runs bash commands or MCP tools.`,action:(0,x.jsxs)(l,{variant:`ghost`,size:`sm`,onClick:ye,disabled:I,children:[(0,x.jsx)(te,{className:`h-3 w-3 mr-1`}),`Add variable`]}),children:Y.length===0?(0,x.jsx)(`p`,{className:p.caption,children:`No environment variables configured`}):(0,x.jsx)(`div`,{className:`flex flex-col gap-2`,children:Y.map((e,t)=>(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(r,{placeholder:`API_KEY`,value:e.name,onChange:e=>be(t,e.target.value),className:`font-mono w-[35%]`,disabled:I}),(0,x.jsx)(r,{type:`password`,placeholder:e.hasExistingValue?`••••••••`:`value`,value:e.value,onChange:e=>xe(t,e.target.value),className:`font-mono flex-1`,disabled:I}),(0,x.jsx)(l,{variant:`ghost`,size:`icon`,onClick:()=>Se(t),className:`h-9 w-9 flex-shrink-0`,disabled:I||M,children:(0,x.jsx)(a,{className:`h-3.5 w-3.5`})})]},t))})})]})]})}):(0,x.jsx)(le,{title:`No project selected`,children:`Please select a project from the sidebar to view its settings.`})}export{S as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$t as t,B as n,Ct as r,Ea as i,Er as a,H as o,Ja as s,Ji as c,Ka as l,Pa as u,Q as d,Qa as f,Tt as p,U as m,V as h,W as g,Xa as _,aa as v,ci as y,cn as b,co as x,di as S,fo as C,fr as w,hr as T,ji as ee,ka as te,la as ne,mi as E,mr as D,pr as O,qa as re,ra as ie,sn as ae,ui as k,vi as oe,vo as se,wi as A,wt as ce,xo as j,yo as M,z as le}from"./dialogs-config-DZKtVbNK.js";import{ct as ue,lt as de}from"./react-vendor-Ba8DSNiO.js";import{a as fe,i as pe,n as me,r as he,s as ge}from"./onboarding-CxtzQldG.js";import{C as N,D as _e,E as ve,S as ye,T as be,a as xe,b as Se,i as Ce,n as P,o as we,r as F,x as I}from"./history-view-jX3PPID6.js";import{c as Te,l as Ee,o as De,s as Oe}from"./index-DjD2SPNZ.js";import{t as L}from"./skeleton-qzmFgKhS.js";var R=M(),z=e(j(),1),B=ee(),ke=E(k(A.compact,`inline-flex items-center rounded-full border px-2.5 py-0.5 font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`),{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function V(e){let t=(0,R.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==i?(a=k(ke({variant:i}),n),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==a?(o=(0,B.jsx)(`div`,{className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}function Ae(e,t,n){return n?e.find(e=>e.slug===n)??null:t?e.find(e=>e.name===t)??null:null}function H({selectedProviderName:e=null,selectedProviderSlug:s=null,providerData:u,onBack:d,className:f}){let[C,ee]=(0,z.useState)(null),[E,ce]=(0,z.useState)(``),[j,M]=(0,z.useState)(!1),[ue,de]=(0,z.useState)(null),[xe,Ce]=(0,z.useState)(``),[P,we]=(0,z.useState)([]),[F,L]=(0,z.useState)(new Set),[R,ke]=(0,z.useState)(new Set),[V,H]=(0,z.useState)(new Map),[U,W]=(0,z.useState)(``),[G,K]=(0,z.useState)(`alphabetical`),[je,Me]=(0,z.useState)(`all`),[Ne,Pe]=(0,z.useState)(!1),[q,J]=(0,z.useState)(``),[Fe,Y]=(0,z.useState)(``),[Ie,Le]=(0,z.useState)(``),[Re,ze]=(0,z.useState)(`coding`),[X,Be]=(0,z.useState)([]),[Ve,He]=(0,z.useState)(new Set),[Ue,We]=(0,z.useState)(new Set),[Ge,Z]=(0,z.useState)(new Map),[Ke,qe]=(0,z.useState)({}),Q=e=>ge(e.id);(0,z.useEffect)(()=>{(async()=>{if(Ce(``),u&&(s&&u.slug===s||e&&u.name===e)){ee(u),Le(u.apiKey??``),ce(u.apiKey??``),qe(u.envValues??{}),Ze(u.slug),Je(u.slug);return}try{let t=Ae(await p(),e,s);ee(t),Le(t?.apiKey??``),ce(t?.apiKey??``),qe(t?.envValues??{}),t&&(Ze(t.slug),Je(t.slug))}catch(e){Ce(e instanceof Error?e.message:`Failed to load providers`)}})()},[e,s,u]);let Je=async e=>{de(null);try{let t=await r(e);t.status===`success`&&de(t.balance)}catch(t){console.error(`Failed to load balance for ${e}:`,t)}};function Ye(){we([]),Be([]),L(new Set),ke(new Set),He(new Set),We(new Set),H(new Map),Z(new Map)}function Xe(e){return e instanceof Error?e.message:`Failed to load models from local API`}let Ze=async e=>{M(!0),Y(``),W(``),K(`alphabetical`),Me(`all`),ze(`coding`);try{let[t,n]=await Promise.all([g(e),m(e)]);we(t.models),Be(n.models);let r=new Set(t.enabledModelIds);L(r),ke(r);let i=new Set(n.enabledModelIds);He(i),We(i),H(new Map),Z(new Map)}catch(t){console.error(`Failed to load models for ${e}:`,t),Ye(),Y(Xe(t))}finally{M(!1)}};async function Qe(e){M(!0),Y(``);try{await t(e),await Ze(e)}catch(t){console.error(`Failed to refresh models for ${e}:`,t),Ye(),Y(Xe(t)),M(!1)}}let $e=(e,t)=>{C?.name===e&&(ce(t),tt(t))},et=(e,t)=>{qe(n=>({...n,[e]:t})),C&&(async()=>{try{await ae({[e]:t}),J(`${pe(e)} saved successfully`),setTimeout(()=>J(``),3e3)}catch(e){J(e instanceof Error?e.message:`Failed to save provider settings`);return}oe(C.slug)&&e===`LOCAL_API_URL`&&t.trim()&&await Qe(C.slug)})()},tt=async e=>{if(!(!C||e===Ie))try{await b(C.slug,e),Le(e),J(`API key saved successfully`),setTimeout(()=>J(``),3e3)}catch(e){J(e instanceof Error?e.message:`Failed to save API key`)}},nt=(e,t)=>{t===`image`?Z(t=>{let n=new Map(t),r=Ve.has(e),i=n.has(e),a=n.get(e),o=!(i?a:r);return o===r?n.delete(e):n.set(e,o),rt(e,(n.has(e)?n.get(e):r)??!1,`image`),n}):H(t=>{let n=new Map(t),r=F.has(e),i=n.has(e),a=n.get(e),o=!(i?a:r);return o===r?n.delete(e):n.set(e,o),rt(e,(n.has(e)?n.get(e):r)??!1,`coding`),n})},rt=async(e,t,r=`coding`)=>{if(C)try{r===`image`?(t?(await h(C.slug,e),He(t=>new Set([...t,e]))):(await le(C.slug,e),He(t=>{let n=new Set(t);return n.delete(e),n})),Z(t=>{let n=new Map(t);return n.delete(e),n})):(t?(await o(C.slug,e),L(t=>new Set([...t,e]))):(await n(C.slug,e),L(t=>{let n=new Set(t);return n.delete(e),n})),H(t=>{let n=new Map(t);return n.delete(e),n})),J(`Model preferences saved successfully`),setTimeout(()=>J(``),3e3)}catch(e){J(e instanceof Error?e.message:`Failed to save model changes`)}};async function it(e,t=`coding`){let n=t===`image`?X:P,r=t===`image`?Ve:F;(t===`image`?Z:H)(t=>{let i=new Map(t);for(let t of n)r.has(t.id)===e?i.delete(t.id):i.set(t.id,e);return i});for(let i of n)r.has(i.id)!==e&&await rt(i.id,e,t)}let $=E!==void 0&&E.trim().length>0,at=e=>e.pricing?((e.pricing.prompt??0)+(e.pricing.completion??0))/2:null,ot=e=>e?e<20?1:e<30?2:e<40?3:e<50?4:5:0,st=({codingIndex:e,modelName:t})=>{let n=ot(e);return n===0?null:(0,B.jsx)(D,{children:(0,B.jsxs)(w,{children:[(0,B.jsx)(T,{asChild:!0,children:(0,B.jsx)(`div`,{className:`flex items-center gap-0.5`,children:[1,2,3,4,5].map(e=>(0,B.jsx)(c,{className:`h-3 w-3 ${e<=n?`fill-yellow-400 text-yellow-400`:`text-gray-300`}`},e))})}),(0,B.jsx)(O,{children:(0,B.jsxs)(`p`,{className:A.body,children:[t,` was indexed `,e,` for coding intelligence`]})})]})})},ct=P.filter(e=>{let t=U.toLowerCase(),n=Q(e),r=e.name.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||n.toLowerCase().includes(t);if(je===`free`){let t=e.pricing?.prompt===0&&e.pricing?.completion===0;return r&&t}return r}).sort((e,t)=>{let n=(e.provider??``).toLowerCase(),r=(t.provider??``).toLowerCase();if(n!==r)return n.localeCompare(r);let i=+!R.has(e.id),a=+!R.has(t.id);if(i!==a)return i-a;if(G===`price-low`){let n=!!e.pricing;return n===!!t.pricing?!e.pricing||!t.pricing?0:((e.pricing.prompt??0)+(e.pricing.completion??0))/2-((t.pricing.prompt??0)+(t.pricing.completion??0))/2:n?-1:1}if(G===`price-high`){let n=!!e.pricing;if(n!==!!t.pricing)return n?-1:1;if(!e.pricing||!t.pricing)return 0;let r=((e.pricing.prompt??0)+(e.pricing.completion??0))/2;return((t.pricing.prompt??0)+(t.pricing.completion??0))/2-r}if(G===`coding-index`){let n=e.coding_index!==void 0&&e.coding_index!==null;return n===(t.coding_index!==void 0&&t.coding_index!==null)?!e.coding_index||!t.coding_index?0:t.coding_index-e.coding_index:n?-1:1}if(G===`intelligence-by-price`){let n=ot(e.coding_index),r=ot(t.coding_index),i=n>0;if(i!==r>0)return i?-1:1;if(r!==n)return r-n;let a=at(e),o=at(t),s=a!==null;return s===(o!==null)?a===null||o===null?0:a-o:s?-1:1}return Q(e).localeCompare(Q(t))}),lt=X.filter(e=>{let t=U.toLowerCase(),n=Q(e),r=e.name.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||n.toLowerCase().includes(t);if(je===`free`){let t=e.pricing?.prompt===0&&e.pricing?.completion===0;return r&&t}return r}).sort((e,t)=>{let n=(e.provider??``).toLowerCase(),r=(t.provider??``).toLowerCase();if(n!==r)return n.localeCompare(r);let i=+!Ue.has(e.id),a=+!Ue.has(t.id);if(i!==a)return i-a;if(G===`price-low`){let n=!!e.pricing;return n===!!t.pricing?!e.pricing||!t.pricing?0:((e.pricing.prompt??0)+(e.pricing.completion??0))/2-((t.pricing.prompt??0)+(t.pricing.completion??0))/2:n?-1:1}if(G===`price-high`){let n=!!e.pricing;return n===!!t.pricing?!e.pricing||!t.pricing?0:((t.pricing.prompt??0)+(t.pricing.completion??0))/2-((e.pricing.prompt??0)+(e.pricing.completion??0))/2:n?-1:1}return Q(e).localeCompare(Q(t))});return xe?(0,B.jsxs)(`div`,{className:k(`flex flex-1 flex-col items-center justify-center gap-4 p-6`,f),children:[(0,B.jsx)(I,{variant:`error`,className:`mb-0`,children:xe}),(0,B.jsx)(y,{variant:`outline`,size:`sm`,onClick:()=>window.location.reload(),children:`Retry`})]}):C?(0,B.jsx)(_e,{className:f,children:(0,B.jsxs)(ve,{children:[d?(0,B.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-center gap-2`,children:[(0,B.jsxs)(y,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground`,onClick:d,children:[(0,B.jsx)(x,{className:`h-4 w-4`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Back to providers`})]}),(0,B.jsx)(`button`,{type:`button`,className:k(A.sectionTitle,`min-w-0 flex-1 truncate border-0 bg-transparent p-0 text-left text-foreground cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-sm`),onClick:d,children:`Providers`})]}):null,(0,B.jsx)(ye,{title:C.name,description:`Configure API keys and models for this provider.`}),(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between min-h-[20px]`,children:[(0,B.jsx)(`div`,{className:`flex items-center gap-2`,children:ue===null?(0,B.jsx)(`div`,{className:`h-[20px] w-[1px]`}):(0,B.jsxs)(`span`,{className:k(A.compact,`font-medium text-green-600 bg-green-50 px-2.5 py-1 rounded-full border border-green-100 flex items-center gap-1.5`),children:[(0,B.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-green-500`}),`$`,S(ue),` `,`balance`]})}),C.url?(0,B.jsx)(he,{url:C.url,className:k(A.compact,`p-3`)}):(0,B.jsx)(`div`,{className:`h-[20px] w-[1px]`})]})}),(0,B.jsx)(Se,{title:`API Key`,description:`Your API key is stored locally and never shared.`,children:C.authType===`APIKey`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(te,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,B.jsx)(a,{type:Ne?`text`:`password`,placeholder:C.keyName||`Enter API Key`,className:`pl-10 pr-10`,value:E,onChange:e=>{$e(C.name,e.target.value)}}),(0,B.jsx)(y,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:()=>Pe(!Ne),disabled:!E,children:Ne?(0,B.jsx)(re,{className:`h-4 w-4 text-muted-foreground`}):(0,B.jsx)(l,{className:`h-4 w-4 text-muted-foreground`})})]}),(0,B.jsx)(`div`,{className:`space-y-4 mt-4`,children:fe(C).map(e=>(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(D,{children:(0,B.jsxs)(w,{children:[(0,B.jsx)(T,{asChild:!0,children:(0,B.jsx)(`span`,{className:k(A.label,`cursor-help`),children:pe(e)})}),(0,B.jsx)(O,{children:e})]})}),oe(C.slug)&&e===`LOCAL_API_URL`?(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(a,{id:e,value:Ke[e]??``,onChange:t=>et(e,t.target.value),placeholder:C.api,className:`pr-10`,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`}),(0,B.jsx)(D,{children:(0,B.jsxs)(w,{children:[(0,B.jsx)(T,{asChild:!0,children:(0,B.jsx)(y,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:()=>{Qe(C.slug)},disabled:j,children:j?(0,B.jsx)(i,{className:`h-4 w-4 animate-spin text-muted-foreground`}):(0,B.jsx)(ne,{className:`h-4 w-4 text-muted-foreground`})})}),(0,B.jsx)(O,{children:`Refresh models`})]})})]}):(0,B.jsx)(a,{id:e,value:Ke[e]??``,onChange:t=>et(e,t.target.value),placeholder:e,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`})]},e))})]}):(0,B.jsxs)(`div`,{className:`space-y-2 text-center`,children:[(0,B.jsx)(I,{className:`mb-0`,children:`This provider uses OAuth for authentication.`}),(0,B.jsxs)(y,{variant:`outline`,size:`sm`,disabled:!0,children:[`Sign in with `,C.name]})]})}),(0,B.jsx)(N,{title:`Models`}),Fe?(0,B.jsx)(I,{variant:`error`,className:`mb-4`,children:Fe}):null,(0,B.jsxs)(De,{value:Re,onValueChange:e=>{ze(e),W(``),K(`alphabetical`)},children:[(0,B.jsxs)(Te,{className:`mb-4`,children:[(0,B.jsx)(Ee,{value:`coding`,children:`Coding`}),C?.name.toLowerCase()===`openrouter`&&(0,B.jsx)(Ee,{value:`image`,children:`Image`})]}),(0,B.jsx)(Oe,{value:`coding`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[!j&&P.length>0&&(0,B.jsxs)(`div`,{className:k(`flex flex-col gap-3 md:flex-row md:items-center md:justify-between`,!$&&`opacity-25`),children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,B.jsx)(me,{id:`select-all-models`,disabled:!$,checked:P.every(e=>{let t=V.has(e.id),n=V.get(e.id);return t?n:F.has(e.id)}),onCheckedChange:e=>{it(e===!0,`coding`)}}),(0,B.jsx)(`label`,{htmlFor:`select-all-models`,className:k(A.body,`whitespace-nowrap`,$?`cursor-pointer`:`cursor-not-allowed`),children:`Select all models`})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-2 md:flex-row md:items-center md:flex-1 md:min-w-0 md:justify-end`,children:[(0,B.jsxs)(`div`,{className:`relative w-full md:w-52 flex-shrink-0`,children:[(0,B.jsx)(ie,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,B.jsx)(a,{placeholder:`Search models...`,className:`pl-10 h-8`,value:U,onChange:e=>W(e.target.value),disabled:!$})]}),(0,B.jsx)(D,{children:(0,B.jsxs)(`div`,{className:`flex items-center self-end rounded-md border border-border p-0.5 flex-shrink-0 md:self-auto`,children:[(0,B.jsxs)(w,{children:[(0,B.jsx)(T,{asChild:!0,children:(0,B.jsx)(y,{type:`button`,variant:G===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>K(`alphabetical`),children:(0,B.jsx)(se,{className:`h-4 w-4`})})}),(0,B.jsx)(O,{children:`Sort A–Z`})]}),(0,B.jsxs)(w,{children:[(0,B.jsx)(T,{asChild:!0,children:(0,B.jsx)(y,{type:`button`,variant:G===`price-low`||G===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>K(`price-low`),children:(0,B.jsx)(_,{className:`h-4 w-4`})})}),(0,B.jsx)(O,{children:`Sort by price`})]}),(0,B.jsxs)(w,{children:[(0,B.jsx)(T,{asChild:!0,children:(0,B.jsx)(y,{type:`button`,variant:G===`coding-index`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>K(`coding-index`),children:(0,B.jsx)(c,{className:`h-4 w-4`})})}),(0,B.jsx)(O,{children:`Sort by coding intelligence`})]}),(0,B.jsxs)(w,{children:[(0,B.jsx)(T,{asChild:!0,children:(0,B.jsx)(y,{type:`button`,variant:G===`intelligence-by-price`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>K(`intelligence-by-price`),children:(0,B.jsx)(v,{className:`h-4 w-4`})})}),(0,B.jsx)(O,{children:`Sort by price/intelligence`})]})]})})]})]}),j?(0,B.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,B.jsx)(i,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):P.length===0?(0,B.jsx)(`div`,{className:`text-center py-8`,children:(0,B.jsx)(`p`,{className:A.bodyMuted,children:Fe?`No models loaded.`:`No models available for this provider.`})}):(0,B.jsx)(D,{children:(0,B.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:ct.length===0?(0,B.jsx)(`div`,{className:`text-center py-8`,children:(0,B.jsx)(`p`,{className:A.bodyMuted,children:`No models matching your filters.`})}):ct.map(e=>{let t=F.has(e.id),n=V.has(e.id),r=V.get(e.id),i=n?r:t,a=e.pricing;return(0,B.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0 ${$?``:`opacity-25`}`,children:[(0,B.jsx)(me,{id:e.id,disabled:!$,checked:i??!1,onCheckedChange:()=>nt(e.id,`coding`),className:`mt-0`}),(0,B.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,B.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,B.jsx)(`label`,{htmlFor:e.id,className:k(A.body,`leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:Q(e)})}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(G===`coding-index`||G===`intelligence-by-price`)&&(0,B.jsx)(st,{codingIndex:e.coding_index,modelName:Q(e)}),a&&(0,B.jsx)(`span`,{className:k(A.caption,`whitespace-nowrap`),children:(a.prompt??0)===0&&(a.completion??0)===0?``:`$${S(a.prompt??0)} in | $${S(a.completion??0)} out`})]})]})]},e.id)})})})]})}),(0,B.jsx)(Oe,{value:`image`,children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[!j&&X.length>0&&(0,B.jsxs)(`div`,{className:k(`flex flex-col gap-3 md:flex-row md:items-center md:justify-between`,!$&&`opacity-25`),children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,B.jsx)(me,{id:`select-all-image-models`,disabled:!$,checked:X.every(e=>{let t=Ge.has(e.id),n=Ge.get(e.id);return t?n:Ve.has(e.id)}),onCheckedChange:e=>{it(e===!0,`image`)}}),(0,B.jsx)(`label`,{htmlFor:`select-all-image-models`,className:k(A.body,`whitespace-nowrap`,$?`cursor-pointer`:`cursor-not-allowed`),children:`Select all models`})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-2 md:flex-row md:items-center md:flex-1 md:min-w-0 md:justify-end`,children:[(0,B.jsxs)(`div`,{className:`relative w-full md:w-52 flex-shrink-0`,children:[(0,B.jsx)(ie,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,B.jsx)(a,{placeholder:`Search models...`,className:`pl-10 h-8`,value:U,onChange:e=>W(e.target.value),disabled:!$})]}),(0,B.jsx)(D,{children:(0,B.jsxs)(`div`,{className:`flex items-center self-end rounded-md border border-border p-0.5 flex-shrink-0 md:self-auto`,children:[(0,B.jsxs)(w,{children:[(0,B.jsx)(T,{asChild:!0,children:(0,B.jsx)(y,{type:`button`,variant:G===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>K(`alphabetical`),children:(0,B.jsx)(se,{className:`h-4 w-4`})})}),(0,B.jsx)(O,{children:`Sort A–Z`})]}),(0,B.jsxs)(w,{children:[(0,B.jsx)(T,{asChild:!0,children:(0,B.jsx)(y,{type:`button`,variant:G===`price-low`||G===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>K(`price-low`),children:(0,B.jsx)(_,{className:`h-4 w-4`})})}),(0,B.jsx)(O,{children:`Sort by price`})]})]})})]})]}),j?(0,B.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,B.jsx)(i,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):X.length===0?(0,B.jsx)(`div`,{className:`text-center py-8`,children:(0,B.jsx)(`p`,{className:A.bodyMuted,children:`No image models available for this provider.`})}):(0,B.jsx)(D,{children:(0,B.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:lt.length===0?(0,B.jsx)(`div`,{className:`text-center py-8`,children:(0,B.jsx)(`p`,{className:A.bodyMuted,children:`No models matching your filters.`})}):lt.map(e=>{let t=Ve.has(e.id),n=Ge.has(e.id),r=Ge.get(e.id),i=n?r:t,a=e.pricing;return(0,B.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0 ${$?``:`opacity-25`}`,children:[(0,B.jsx)(me,{id:`image-${e.id}`,disabled:!$,checked:i??!1,onCheckedChange:()=>nt(e.id,`image`),className:`mt-0`}),(0,B.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,B.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,B.jsx)(`label`,{htmlFor:`image-${e.id}`,className:k(A.label,`leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:Q(e)})}),a&&(0,B.jsx)(`span`,{className:k(A.caption,`whitespace-nowrap flex-shrink-0`),children:(a.prompt??0)===0&&(a.completion??0)===0?``:`$${S(a.prompt??0)} in | $${S(a.completion??0)} out`})]})]},e.id)})})})]})})]}),q?(0,B.jsx)(I,{variant:q.includes(`error`)||q.includes(`Failed`)?`error`:`success`,children:q}):null]})]})}):(0,B.jsx)(`div`,{className:k(`flex flex-1 items-center justify-center`,f),children:(0,B.jsx)(be,{title:e||s?`Provider not found`:`Select a Provider`,action:d?(0,B.jsxs)(y,{variant:`outline`,size:`sm`,onClick:d,children:[(0,B.jsx)(x,{className:`h-4 w-4 mr-1`}),`Back to Providers`]}):void 0,children:d?`This provider could not be found.`:`Choose a provider from the list to configure its settings.`})})}function U(e){return`providers:list:${e}`}async function W(){let[e,t]=await Promise.all([p(),d().catch(()=>({}))]),n={};for(let[e,r]of Object.entries(t))n[e]=r.length;return{providers:e,enabledModelCounts:n}}function G(){let e=(0,R.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,B.jsx)(ye,{title:`Providers`,description:`Manage your AI provider connections and API keys.`}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,B.jsx)(N,{title:`Connected Providers`}),e[1]=n):n=e[1];let r,i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,B.jsxs)(`div`,{children:[n,(0,B.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,B.jsx)(L,{className:`h-24 rounded-lg`}),(0,B.jsx)(L,{className:`h-24 rounded-lg`})]})]}),i=(0,B.jsx)(N,{title:`Available Providers`}),e[2]=r,e[3]=i):(r=e[2],i=e[3]);let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,B.jsx)(_e,{children:(0,B.jsxs)(ve,{children:[t,(0,B.jsxs)(`div`,{className:`space-y-8`,children:[r,(0,B.jsxs)(`div`,{children:[i,(0,B.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,B.jsx)(L,{className:`h-24 rounded-lg`}),(0,B.jsx)(L,{className:`h-24 rounded-lg`}),(0,B.jsx)(L,{className:`h-24 rounded-lg`}),(0,B.jsx)(L,{className:`h-24 rounded-lg`})]})]})]})]})}),e[4]=a):a=e[4],a}function K(e){let t=(0,R.c)(40),{loadVersion:n,onProviderClick:r}=e,[i,o]=(0,z.useState)(``),s;t[0]===n?s=t[1]:(s=U(n),t[0]=n,t[1]=s);let{providers:c,enabledModelCounts:l}=xe(s,W),u,d,f,p,m,h,g;if(t[2]!==l||t[3]!==r||t[4]!==c||t[5]!==i){let e;t[13]===i?e=t[14]:(e=e=>{let t=i.toLowerCase();return e.name.toLowerCase().includes(t)},t[13]=i,t[14]=e);let n;t[15]===l?n=t[16]:(n=(e,t)=>{let n=(l[e.slug]??0)>0,r=(l[t.slug]??0)>0;return n&&!r?-1:!n&&r?1:e.name.localeCompare(t.name)},t[15]=l,t[16]=n);let s=c.filter(Ne).filter(e).sort(n),_;t[17]===i?_=t[18]:(_=e=>{let t=i.toLowerCase();return e.name.toLowerCase().includes(t)},t[17]=i,t[18]=_);let v=c.filter(Me).filter(_).sort(je);d=_e,u=ve,t[19]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,B.jsx)(ye,{title:`Providers`,description:`Manage your AI provider connections and API keys.`}),t[19]=m):m=t[19];let y;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,B.jsx)(ie,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),t[20]=y):y=t[20];let b;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>o(e.target.value),t[21]=b):b=t[21],t[22]===i?h=t[23]:(h=(0,B.jsx)(`div`,{className:`mb-6`,children:(0,B.jsxs)(`div`,{className:`relative`,children:[y,(0,B.jsx)(a,{placeholder:`Search providers...`,className:`pl-10`,value:i,onChange:b})]})}),t[22]=i,t[23]=h),f=`space-y-8`;let x;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,B.jsx)(N,{title:`Connected Providers`}),t[24]=x):x=t[24];let S=s.length===0?(0,B.jsx)(`p`,{className:k(A.bodyMuted,`py-4`),children:i?`No connected providers match your search.`:`No providers connected yet. Add an API key to get started.`}):(0,B.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:s.map(e=>(0,B.jsx)(Ie,{provider:e,isConnected:!0,modelCount:l[e.slug]??0,onClick:r},e.name))});t[25]===S?p=t[26]:(p=(0,B.jsxs)(`section`,{children:[x,S]}),t[25]=S,t[26]=p);let C;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,B.jsx)(N,{title:`Available Providers`}),t[27]=C):C=t[27],g=(0,B.jsxs)(`section`,{children:[C,v.length===0?(0,B.jsx)(`p`,{className:k(A.bodyMuted,`py-4`),children:i?`No available providers match your search.`:`All providers are connected.`}):(0,B.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:v.map(e=>(0,B.jsx)(Ie,{provider:e,modelCount:l[e.slug]??0,onClick:r},e.name))})]}),t[2]=l,t[3]=r,t[4]=c,t[5]=i,t[6]=u,t[7]=d,t[8]=f,t[9]=p,t[10]=m,t[11]=h,t[12]=g}else u=t[6],d=t[7],f=t[8],p=t[9],m=t[10],h=t[11],g=t[12];let _;t[28]!==f||t[29]!==p||t[30]!==g?(_=(0,B.jsxs)(`div`,{className:f,children:[p,g]}),t[28]=f,t[29]=p,t[30]=g,t[31]=_):_=t[31];let v;t[32]!==u||t[33]!==m||t[34]!==h||t[35]!==_?(v=(0,B.jsxs)(u,{children:[m,h,_]}),t[32]=u,t[33]=m,t[34]=h,t[35]=_,t[36]=v):v=t[36];let y;return t[37]!==d||t[38]!==v?(y=(0,B.jsx)(d,{children:v}),t[37]=d,t[38]=v,t[39]=y):y=t[39],y}function je(e,t){return e.name.localeCompare(t.name)}function Me(e){return!e.apiKey}function Ne(e){return e.apiKey}function Pe(){let e=(0,R.c)(21),t=ue(),{providerSlug:n}=de(),[r,i]=(0,z.useState)(0),a=(0,z.useRef)(n),o,s;e[0]!==r||e[1]!==n?(o=()=>{a.current&&!n&&(we(U(r)),i(Y)),a.current=n},s=[n,r],e[0]=r,e[1]=n,e[2]=o,e[3]=s):(o=e[2],s=e[3]),(0,z.useEffect)(o,s);let c;e[4]===t?c=e[5]:(c=e=>{t(`/settings/providers/${encodeURIComponent(e.slug)}`)},e[4]=t,e[5]=c);let l=c,u;e[6]!==r||e[7]!==t?(u=()=>{t(`/settings/providers`),we(U(r)),i(Fe)},e[6]=r,e[7]=t,e[8]=u):u=e[8];let d=u,f;e[9]===r?f=e[10]:(f=function(){we(U(r)),i(J)},e[9]=r,e[10]=f);let p=f;if(n){let t=decodeURIComponent(n),r;return e[11]!==d||e[12]!==t?(r=(0,B.jsx)(H,{selectedProviderSlug:t,onBack:d}),e[11]=d,e[12]=t,e[13]=r):r=e[13],r}let m;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,B.jsx)(G,{}),e[14]=m):m=e[14];let h;e[15]!==l||e[16]!==r?(h=(0,B.jsx)(z.Suspense,{fallback:m,children:(0,B.jsx)(K,{loadVersion:r,onProviderClick:l},r)}),e[15]=l,e[16]=r,e[17]=h):h=e[17];let g;return e[18]!==p||e[19]!==h?(g=(0,B.jsx)(P,{fallbackTitle:`Failed to load providers`,onRetry:p,renderFallback:q,children:h}),e[18]=p,e[19]=h,e[20]=g):g=e[20],g}function q(e,t){return(0,B.jsx)(_e,{children:(0,B.jsxs)(ve,{children:[(0,B.jsx)(ye,{title:`Providers`,description:`Manage your AI provider connections and API keys.`}),(0,B.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-16`,children:(0,B.jsxs)(`div`,{className:`text-center max-w-md`,children:[(0,B.jsx)(I,{variant:`error`,className:`mb-4`,children:e.message}),(0,B.jsx)(y,{variant:`outline`,size:`sm`,onClick:t,children:`Retry`})]})})]})})}function J(e){return e+1}function Fe(e){return e+1}function Y(e){return e+1}function Ie(e){let t=(0,R.c)(28),{provider:n,isConnected:r,modelCount:i,onClick:a}=e,o=r===void 0?!1:r,c=i===void 0?0:i,[l,d]=(0,z.useState)(!1),p;t[0]!==a||t[1]!==n?(p=()=>a(n),t[0]=a,t[1]=n,t[2]=p):p=t[2];let m;t[3]!==l||t[4]!==n.name||t[5]!==n.slug?(m=(0,B.jsx)(`div`,{className:`flex-shrink-0 h-10 w-10 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:l?(0,B.jsx)(f,{className:`h-5 w-5 text-muted-foreground`}):(0,B.jsx)(`img`,{src:ce(n.slug),alt:`${n.name} logo`,className:`h-6 w-6 dark:invert`,onError:()=>d(!0)})}),t[3]=l,t[4]=n.name,t[5]=n.slug,t[6]=m):m=t[6];let h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=k(A.label,`truncate`),t[7]=h):h=t[7];let g;t[8]===n.name?g=t[9]:(g=(0,B.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,B.jsx)(`span`,{className:h,children:n.name})}),t[8]=n.name,t[9]=g);let _;t[10]===o?_=t[11]:(_=!o&&(0,B.jsxs)(`div`,{className:k(A.compact,`flex items-center gap-1 text-muted-foreground mt-0.5`),children:[(0,B.jsx)(s,{className:`h-3 w-3`}),(0,B.jsx)(`span`,{children:`Click to configure`})]}),t[10]=o,t[11]=_);let v;t[12]!==g||t[13]!==_?(v=(0,B.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[g,_]}),t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==m||t[16]!==v?(y=(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[m,v]}),t[15]=m,t[16]=v,t[17]=y):y=t[17];let b;t[18]!==o||t[19]!==c||t[20]!==n.isEnv?(b=o&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[n.isEnv?(0,B.jsxs)(V,{variant:`secondary`,className:k(A.compact,`gap-1 px-2 py-0.5`),children:[(0,B.jsx)(u,{className:`h-3 w-3`}),`Environment`]}):(0,B.jsxs)(V,{variant:`secondary`,className:k(A.compact,`gap-1 px-2 py-0.5`),children:[(0,B.jsx)(te,{className:`h-3 w-3`}),`API Key`]}),c>0&&(0,B.jsxs)(V,{variant:`default`,className:k(A.compact,`gap-1 px-2 py-0.5`),children:[(0,B.jsx)(C,{className:`h-3 w-3`}),c,` `,c===1?`Model`:`Models`]})]}),t[18]=o,t[19]=c,t[20]=n.isEnv,t[21]=b):b=t[21];let x;t[22]!==b||t[23]!==y?(x=(0,B.jsxs)(Ce,{className:`p-4 flex flex-col gap-3`,children:[y,b]}),t[22]=b,t[23]=y,t[24]=x):x=t[24];let S;return t[25]!==x||t[26]!==p?(S=(0,B.jsx)(F,{className:`cursor-pointer transition-all hover:border-primary/50 hover:shadow-md`,onClick:p,children:x}),t[25]=x,t[26]=p,t[27]=S):S=t[27],S}export{Pe as ProvidersListView,Pe as default};
|
package/dist/public/assets/{pull-request-dialog-BIRSLJAA.js → pull-request-dialog-ZzVXh6M9.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ar as e,Dr as ee,Ea as t,Er as te,Mr as ne,Or as n,Xi as re,ci as r,fr as i,hr as a,ji as o,jr as ie,kr as ae,mr as s,pr as c,wi as l,wr as u,yo as d}from"./dialogs-config-DZKtVbNK.js";import{n as oe}from"./onboarding-CxtzQldG.js";import{O as se}from"./index-
|
|
1
|
+
import{Ar as e,Dr as ee,Ea as t,Er as te,Mr as ne,Or as n,Xi as re,ci as r,fr as i,hr as a,ji as o,jr as ie,kr as ae,mr as s,pr as c,wi as l,wr as u,yo as d}from"./dialogs-config-DZKtVbNK.js";import{n as oe}from"./onboarding-CxtzQldG.js";import{O as se}from"./index-DjD2SPNZ.js";var ce=d(),f=o();function p(o){let d=(0,ce.c)(62),{open:p,onOpenChange:m,prTitle:h,onPrTitleChange:g,prDescription:_,onPrDescriptionChange:v,isGeneratingPRInfo:y,isLoading:b,onGeneratePRInfo:x,onCreatePR:S,currentBranch:C,autoGeneratePRInfo:w,onAutoGeneratePRInfoChange:T}=o,E;d[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,f.jsx)(ne,{children:`Create Pull Request`}),d[0]=E):E=d[0];let D;d[1]===C?D=d[2]:(D=(0,f.jsxs)(ie,{children:[E,(0,f.jsxs)(ae,{children:[`Create a pull request for branch `,C]})]}),d[1]=C,d[2]=D);let O;d[3]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,f.jsx)(u,{htmlFor:`pr-title`,children:`Title (optional)`}),d[3]=O):O=d[3];let k=C||`Enter PR title...`,A;d[4]===g?A=d[5]:(A=e=>g(e.target.value),d[4]=g,d[5]=A);let j;d[6]!==h||d[7]!==k||d[8]!==A?(j=(0,f.jsxs)(`div`,{className:`grid gap-2`,children:[O,(0,f.jsx)(te,{id:`pr-title`,placeholder:k,value:h,onChange:A})]}),d[6]=h,d[7]=k,d[8]=A,d[9]=j):j=d[9];let M;d[10]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,f.jsx)(u,{htmlFor:`pr-description`,children:`Description (optional)`}),d[10]=M):M=d[10];let N;d[11]===v?N=d[12]:(N=e=>v(e.target.value),d[11]=v,d[12]=N);let P;d[13]!==_||d[14]!==N?(P=(0,f.jsx)(se,{id:`pr-description`,placeholder:`Enter PR description...`,value:_,onChange:N,rows:4,className:`pr-10`}),d[13]=_,d[14]=N,d[15]=P):P=d[15];let F=y||b,I;d[16]===y?I=d[17]:(I=y?(0,f.jsx)(t,{className:`h-3.5 w-3.5 animate-spin`}):(0,f.jsx)(re,{className:`h-3.5 w-3.5`}),d[16]=y,d[17]=I);let L;d[18]!==x||d[19]!==F||d[20]!==I?(L=(0,f.jsx)(a,{asChild:!0,children:(0,f.jsx)(r,{type:`button`,variant:`ghost`,size:`icon`,className:`absolute top-2 right-2 h-6 w-6`,onClick:x,disabled:F,children:I})}),d[18]=x,d[19]=F,d[20]=I,d[21]=L):L=d[21];let R=y?`Generating PR description...`:`Generate PR title and description with AI`,z;d[22]===R?z=d[23]:(z=(0,f.jsx)(c,{children:R}),d[22]=R,d[23]=z);let B;d[24]!==L||d[25]!==z?(B=(0,f.jsx)(s,{children:(0,f.jsxs)(i,{children:[L,z]})}),d[24]=L,d[25]=z,d[26]=B):B=d[26];let V;d[27]!==B||d[28]!==P?(V=(0,f.jsxs)(`div`,{className:`grid gap-2`,children:[M,(0,f.jsxs)(`div`,{className:`relative`,children:[P,B]})]}),d[27]=B,d[28]=P,d[29]=V):V=d[29];let H;d[30]===T?H=d[31]:(H=e=>T(e===!0),d[30]=T,d[31]=H);let U;d[32]!==w||d[33]!==H?(U=(0,f.jsx)(oe,{id:`auto-generate-pr`,checked:w,onCheckedChange:H}),d[32]=w,d[33]=H,d[34]=U):U=d[34];let W;d[35]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,f.jsx)(u,{htmlFor:`auto-generate-pr`,className:l.labelNormal,children:`Auto generate PR title and description`}),d[35]=W):W=d[35];let G;d[36]===U?G=d[37]:(G=(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[U,W]}),d[36]=U,d[37]=G);let K;d[38]!==V||d[39]!==G||d[40]!==j?(K=(0,f.jsxs)(`div`,{className:`grid gap-4 py-4`,children:[j,V,G]}),d[38]=V,d[39]=G,d[40]=j,d[41]=K):K=d[41];let q;d[42]===m?q=d[43]:(q=()=>m(!1),d[42]=m,d[43]=q);let J;d[44]!==b||d[45]!==q?(J=(0,f.jsx)(r,{variant:`outline`,onClick:q,disabled:b,children:`Cancel`}),d[44]=b,d[45]=q,d[46]=J):J=d[46];let Y=b?`Creating...`:`Create PR`,X;d[47]!==b||d[48]!==S||d[49]!==Y?(X=(0,f.jsx)(r,{onClick:S,disabled:b,children:Y}),d[47]=b,d[48]=S,d[49]=Y,d[50]=X):X=d[50];let Z;d[51]!==J||d[52]!==X?(Z=(0,f.jsxs)(e,{children:[J,X]}),d[51]=J,d[52]=X,d[53]=Z):Z=d[53];let Q;d[54]!==D||d[55]!==K||d[56]!==Z?(Q=(0,f.jsxs)(n,{children:[D,K,Z]}),d[54]=D,d[55]=K,d[56]=Z,d[57]=Q):Q=d[57];let $;return d[58]!==m||d[59]!==p||d[60]!==Q?($=(0,f.jsx)(ee,{open:p,onOpenChange:m,children:Q}),d[58]=m,d[59]=p,d[60]=Q,d[61]=$):$=d[61],$}export{p as PullRequestDialog};
|
package/dist/public/assets/{settings-general-view-CH-51vI0.js → settings-general-view-C8muiP_K.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Cn as t,Er as n,X as r,ci as i,dr as a,ji as o,n as s,r as c,rr as l,sa as ee,ui as u,wi as d,xo as te,yo as ne}from"./dialogs-config-DZKtVbNK.js";import{a as f,i as p,o as m,r as h}from"./react-vendor-Ba8DSNiO.js";import{D as re,E as ie,S as ae,b as g}from"./history-view-jX3PPID6.js";import{t as oe}from"./index-CbJ3v0Sr.js";var se=ne(),_=e(te(),1),v=o(),ce=_.forwardRef((e,t)=>{let n=(0,se.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=u(`relative flex w-full touch-none select-none items-center`,r),n[3]=r,n[4]=a);let o,s;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,v.jsx)(m,{className:`relative h-2 w-full grow overflow-hidden rounded-full bg-secondary`,children:(0,v.jsx)(h,{className:`absolute h-full bg-primary`})}),s=(0,v.jsx)(f,{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]=o,n[6]=s):(o=n[5],s=n[6]);let c;return n[7]!==i||n[8]!==t||n[9]!==a?(c=(0,v.jsxs)(p,{ref:t,className:a,...i,children:[o,s]}),n[7]=i,n[8]=t,n[9]=a,n[10]=c):c=n[10],c});ce.displayName=p.displayName;var y=50;function le(){let[e,n]=(0,_.useState)(y),[i,a]=(0,_.useState)(y.toString()),[o,s]=(0,_.useState)(!0),[c,l]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let e=!1;async function t(){try{let t=await r();e||(n(t.maximumTurnCount),a(t.maximumTurnCount.toString()))}catch(e){console.error(`Failed to load maximum turn count:`,e)}finally{e||s(!1)}}return t(),()=>{e=!0}},[]);function ee(e){a(e)}async function u(e){l(!0);try{let r=await t({maximumTurnCount:e});n(r.maximumTurnCount),a(r.maximumTurnCount.toString())}catch(e){throw console.error(`Failed to update maximum turn count:`,e),e}finally{l(!1)}}function d(){a(e.toString())}return{defaultMaximumTurnCount:y,draftMaximumTurnCount:i,isLoading:o,isSaving:c,maximumTurnCount:e,resetDraftMaximumTurnCount:d,setDraftMaximumTurnCount:ee,updateMaximumTurnCount:u}}var ue=`local`;function de(){let[e,n]=(0,_.useState)(ue),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(!0),[ee,u]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let e=!1;async function t(){try{let t=await r();e||(n(t.serverBindMode),a(t.serverBindMode),s(t.networkAddresses))}catch(e){console.error(`Failed to load server bind mode:`,e)}finally{e||l(!1)}}return t(),()=>{e=!0}},[]);async function d(e){u(!0);try{let r=await t({serverBindMode:e});n(r.serverBindMode),s(r.networkAddresses)}catch(e){throw console.error(`Failed to update server bind mode:`,e),e}finally{u(!1)}}return{defaultServerBindMode:ue,hasServerBindModeChanged:i!==null&&e!==i,isLoading:c,isSaving:ee,networkAddresses:o,serverBindMode:e,updateServerBindMode:d}}var fe=`default`;function pe(){let e=(0,se.c)(3),[t,n]=(0,_.useState)(me),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=e=>{n(e),a(e)},e[0]=r):r=e[0];let i=r,o;return e[1]===t?o=e[2]:(o={voiceModel:t,updateVoiceModel:i,defaultVoiceModel:fe},e[1]=t,e[2]=o),o}function me(){return l(fe)}var he=[{value:`default`,label:`Standard`},{value:`tiny`,label:`Tiny`}],ge=[{value:`local`,label:`Local`},{value:`network`,label:`Network`}],_e=[`462`,`8100`].includes(typeof document<`u`?document.location.port:``)?`462`:`641`,ve=600;function ye(e){let t=(0,se.c)(94),{onboardingResetSignal:r}=e,a=r===void 0?0:r,[o,c]=(0,_.useState)(!1),{scale:l,updateScale:te,resetScale:ne,min:f,max:p,default:m}=oe(),{defaultMaximumTurnCount:h,draftMaximumTurnCount:y,isLoading:ue,isSaving:fe,resetDraftMaximumTurnCount:me,setDraftMaximumTurnCount:ye,updateMaximumTurnCount:Ce}=le(),{voiceModel:we,updateVoiceModel:Te}=pe(),{hasServerBindModeChanged:Ee,isLoading:De,isSaving:Oe,networkAddresses:b,serverBindMode:x,updateServerBindMode:ke}=de(),S,C;t[0]===a?(S=t[1],C=t[2]):(S=()=>{if(a===0)return;c(!0);let e=setTimeout(()=>{c(!1)},ve);return()=>{clearTimeout(e)}},C=[a],t[0]=a,t[1]=S,t[2]=C),(0,_.useEffect)(S,C);let w;t[3]===ye?w=t[4]:(w=function(e){ye(e.target.value)},t[3]=ye,t[4]=w);let Ae=w,T;t[5]!==h||t[6]!==y||t[7]!==me||t[8]!==Ce?(T=async function(){let e=Number.parseInt(y,10),t=Number.isFinite(e)&&e>0?e:h;try{await Ce(t)}catch{me()}},t[5]=h,t[6]=y,t[7]=me,t[8]=Ce,t[9]=T):T=t[9];let je=T,E;t[10]===te?E=t[11]:(E=function(e){e.length>0&&te(e[0])},t[10]=te,t[11]=E);let Me=E,Ne=o&&`animate-headline-reset`,D;t[12]===Ne?D=t[13]:(D=u(Ne),t[12]=Ne,t[13]=D);let O;t[14]===D?O=t[15]:(O=(0,v.jsx)(ae,{title:`General`,description:`Customize the appearance and behavior of Tarsk.`,titleClassName:D}),t[14]=D,t[15]=O);let Pe,Fe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,v.jsx)(ee,{className:`h-3.5 w-3.5`}),Fe=(0,v.jsx)(`span`,{className:`sr-only`,children:`Reset font size to default`}),t[16]=Pe,t[17]=Fe):(Pe=t[16],Fe=t[17]);let k;t[18]===ne?k=t[19]:(k=(0,v.jsxs)(i,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:ne,children:[Pe,Fe]}),t[18]=ne,t[19]=k);let A;t[20]===l?A=t[21]:(A=(0,v.jsxs)(`span`,{className:`${d.mono} tabular-nums w-12 text-right`,children:[l,`%`]}),t[20]=l,t[21]=A);let j;t[22]!==k||t[23]!==A?(j=(0,v.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[k,A]}),t[22]=k,t[23]=A,t[24]=j):j=t[24];let M;t[25]===f?M=t[26]:(M=(0,v.jsxs)(`span`,{className:`${d.bodyMuted} w-8 text-right`,children:[f,`%`]}),t[25]=f,t[26]=M);let N;t[27]===l?N=t[28]:(N=[l],t[27]=l,t[28]=N);let P;t[29]!==Me||t[30]!==p||t[31]!==f||t[32]!==N?(P=(0,v.jsx)(ce,{value:N,min:f,max:p,step:5,onValueChange:Me,"aria-label":`Font size`}),t[29]=Me,t[30]=p,t[31]=f,t[32]=N,t[33]=P):P=t[33];let F;t[34]===p?F=t[35]:(F=(0,v.jsxs)(`span`,{className:`${d.bodyMuted} w-9`,children:[p,`%`]}),t[34]=p,t[35]=F);let I;t[36]!==M||t[37]!==P||t[38]!==F?(I=(0,v.jsxs)(`div`,{className:`flex items-center gap-3`,children:[M,P,F]}),t[36]=M,t[37]=P,t[38]=F,t[39]=I):I=t[39];let L;t[40]!==m||t[41]!==l?(L=l!==m&&(0,v.jsxs)(`p`,{className:`${d.bodyMuted} mt-2`,children:[`Font size has been changed from the default (`,m,`%).`]}),t[40]=m,t[41]=l,t[42]=L):L=t[42];let R;t[43]!==j||t[44]!==I||t[45]!==L?(R=(0,v.jsxs)(g,{title:`Font Size`,description:`Adjust the text size across the entire application.`,action:j,children:[I,L]}),t[43]=j,t[44]=I,t[45]=L,t[46]=R):R=t[46];let z;t[47]===je?z=t[48]:(z=()=>{je()},t[47]=je,t[48]=z);let Ie=ue||fe,B;t[49]!==y||t[50]!==Ae||t[51]!==z||t[52]!==Ie?(B=(0,v.jsx)(n,{type:`number`,min:1,step:1,value:y,onChange:Ae,onBlur:z,disabled:Ie,"aria-label":`Maximum turn count`,className:`w-28 text-right font-mono tabular-nums flex-shrink-0`}),t[49]=y,t[50]=Ae,t[51]=z,t[52]=Ie,t[53]=B):B=t[53];let V;t[54]===h?V=t[55]:(V=(0,v.jsxs)(`p`,{className:d.bodyMuted,children:[`Default: `,h,` turns.`]}),t[54]=h,t[55]=V);let H;t[56]!==B||t[57]!==V?(H=(0,v.jsx)(g,{title:`Maximum Turn Count`,description:`Set how many turns a long-running agent chat can take before Tarsk asks whether to continue.`,action:B,children:V}),t[56]=B,t[57]=V,t[58]=H):H=t[58];let U;t[59]===Te?U=t[60]:(U=e=>{(e==="default"||e===`tiny`)&&Te(e)},t[59]=Te,t[60]=U);let W;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(W=he.map(Se),t[61]=W):W=t[61];let G;t[62]!==U||t[63]!==we?(G=(0,v.jsx)(g,{title:`Voice Model`,description:`Choose which voice-to-text model Tarsk downloads and caches for speech input.`,children:(0,v.jsx)(s,{type:`single`,value:we,onValueChange:U,"aria-label":`Voice model`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:W})}),t[62]=U,t[63]=we,t[64]=G):G=t[64];let Le=x===`network`?`Tarsk accepts connections from other devices on your network such as the Tarsk mobile app.`:`Tarsk only accepts connections from this computer at http://localhost:${_e}.`,Re=De||Oe,K;t[65]===ke?K=t[66]:(K=e=>{(e===`local`||e===`network`)&&ke(e)},t[65]=ke,t[66]=K);let ze;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ze=ge.map(xe),t[67]=ze):ze=t[67];let q;t[68]!==x||t[69]!==Re||t[70]!==K?(q=(0,v.jsx)(s,{type:`single`,value:x,disabled:Re,onValueChange:K,"aria-label":`Server bind mode`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:ze}),t[68]=x,t[69]=Re,t[70]=K,t[71]=q):q=t[71];let J;t[72]!==b||t[73]!==x?(J=x===`network`&&b.length>0&&(0,v.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[(0,v.jsx)(`p`,{className:d.bodyMuted,children:`Available on your network:`}),(0,v.jsx)(`ul`,{className:`${d.mono} space-y-1`,children:b.map(be)})]}),t[72]=b,t[73]=x,t[74]=J):J=t[74];let Y;t[75]!==b||t[76]!==x?(Y=x===`network`&&b.length===0&&(0,v.jsx)(`p`,{className:`${d.bodyMuted} mt-3`,children:`No network IP addresses were detected on this computer.`}),t[75]=b,t[76]=x,t[77]=Y):Y=t[77];let X;t[78]===Ee?X=t[79]:(X=Ee&&(0,v.jsx)(`p`,{className:`${d.bodyMuted} mt-3`,children:`Restart Tarsk for this change to take effect.`}),t[78]=Ee,t[79]=X);let Z;t[80]!==Le||t[81]!==q||t[82]!==J||t[83]!==Y||t[84]!==X?(Z=(0,v.jsxs)(g,{title:`Local`,description:Le,children:[q,J,Y,X]}),t[80]=Le,t[81]=q,t[82]=J,t[83]=Y,t[84]=X,t[85]=Z):Z=t[85];let Q;t[86]!==R||t[87]!==H||t[88]!==G||t[89]!==Z?(Q=(0,v.jsxs)(`div`,{className:`space-y-8`,children:[R,H,G,Z]}),t[86]=R,t[87]=H,t[88]=G,t[89]=Z,t[90]=Q):Q=t[90];let $;return t[91]!==Q||t[92]!==O?($=(0,v.jsx)(re,{children:(0,v.jsxs)(ie,{children:[O,Q]})}),t[91]=Q,t[92]=O,t[93]=$):$=t[93],$}function be(e){return(0,v.jsxs)(`li`,{children:[`http://`,e,`:`,_e]},e)}function xe(e){return(0,v.jsx)(c,{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 Se(e){return(0,v.jsx)(c,{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{ye as default};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Cn as t,Er as n,X as r,ci as i,dr as a,ji as o,n as s,r as c,rr as l,sa as ee,ui as u,wi as d,xo as te,yo as ne}from"./dialogs-config-DZKtVbNK.js";import{a as f,i as p,o as m,r as h}from"./react-vendor-Ba8DSNiO.js";import{D as re,E as ie,S as ae,b as g}from"./history-view-jX3PPID6.js";import{t as oe}from"./index-DjD2SPNZ.js";var se=ne(),_=e(te(),1),v=o(),ce=_.forwardRef((e,t)=>{let n=(0,se.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=u(`relative flex w-full touch-none select-none items-center`,r),n[3]=r,n[4]=a);let o,s;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,v.jsx)(m,{className:`relative h-2 w-full grow overflow-hidden rounded-full bg-secondary`,children:(0,v.jsx)(h,{className:`absolute h-full bg-primary`})}),s=(0,v.jsx)(f,{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]=o,n[6]=s):(o=n[5],s=n[6]);let c;return n[7]!==i||n[8]!==t||n[9]!==a?(c=(0,v.jsxs)(p,{ref:t,className:a,...i,children:[o,s]}),n[7]=i,n[8]=t,n[9]=a,n[10]=c):c=n[10],c});ce.displayName=p.displayName;var y=50;function le(){let[e,n]=(0,_.useState)(y),[i,a]=(0,_.useState)(y.toString()),[o,s]=(0,_.useState)(!0),[c,l]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let e=!1;async function t(){try{let t=await r();e||(n(t.maximumTurnCount),a(t.maximumTurnCount.toString()))}catch(e){console.error(`Failed to load maximum turn count:`,e)}finally{e||s(!1)}}return t(),()=>{e=!0}},[]);function ee(e){a(e)}async function u(e){l(!0);try{let r=await t({maximumTurnCount:e});n(r.maximumTurnCount),a(r.maximumTurnCount.toString())}catch(e){throw console.error(`Failed to update maximum turn count:`,e),e}finally{l(!1)}}function d(){a(e.toString())}return{defaultMaximumTurnCount:y,draftMaximumTurnCount:i,isLoading:o,isSaving:c,maximumTurnCount:e,resetDraftMaximumTurnCount:d,setDraftMaximumTurnCount:ee,updateMaximumTurnCount:u}}var ue=`local`;function de(){let[e,n]=(0,_.useState)(ue),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(!0),[ee,u]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let e=!1;async function t(){try{let t=await r();e||(n(t.serverBindMode),a(t.serverBindMode),s(t.networkAddresses))}catch(e){console.error(`Failed to load server bind mode:`,e)}finally{e||l(!1)}}return t(),()=>{e=!0}},[]);async function d(e){u(!0);try{let r=await t({serverBindMode:e});n(r.serverBindMode),s(r.networkAddresses)}catch(e){throw console.error(`Failed to update server bind mode:`,e),e}finally{u(!1)}}return{defaultServerBindMode:ue,hasServerBindModeChanged:i!==null&&e!==i,isLoading:c,isSaving:ee,networkAddresses:o,serverBindMode:e,updateServerBindMode:d}}var fe=`default`;function pe(){let e=(0,se.c)(3),[t,n]=(0,_.useState)(me),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=e=>{n(e),a(e)},e[0]=r):r=e[0];let i=r,o;return e[1]===t?o=e[2]:(o={voiceModel:t,updateVoiceModel:i,defaultVoiceModel:fe},e[1]=t,e[2]=o),o}function me(){return l(fe)}var he=[{value:`default`,label:`Standard`},{value:`tiny`,label:`Tiny`}],ge=[{value:`local`,label:`Local`},{value:`network`,label:`Network`}],_e=[`462`,`8100`].includes(typeof document<`u`?document.location.port:``)?`462`:`641`,ve=600;function ye(e){let t=(0,se.c)(94),{onboardingResetSignal:r}=e,a=r===void 0?0:r,[o,c]=(0,_.useState)(!1),{scale:l,updateScale:te,resetScale:ne,min:f,max:p,default:m}=oe(),{defaultMaximumTurnCount:h,draftMaximumTurnCount:y,isLoading:ue,isSaving:fe,resetDraftMaximumTurnCount:me,setDraftMaximumTurnCount:ye,updateMaximumTurnCount:Ce}=le(),{voiceModel:we,updateVoiceModel:Te}=pe(),{hasServerBindModeChanged:Ee,isLoading:De,isSaving:Oe,networkAddresses:b,serverBindMode:x,updateServerBindMode:ke}=de(),S,C;t[0]===a?(S=t[1],C=t[2]):(S=()=>{if(a===0)return;c(!0);let e=setTimeout(()=>{c(!1)},ve);return()=>{clearTimeout(e)}},C=[a],t[0]=a,t[1]=S,t[2]=C),(0,_.useEffect)(S,C);let w;t[3]===ye?w=t[4]:(w=function(e){ye(e.target.value)},t[3]=ye,t[4]=w);let Ae=w,T;t[5]!==h||t[6]!==y||t[7]!==me||t[8]!==Ce?(T=async function(){let e=Number.parseInt(y,10),t=Number.isFinite(e)&&e>0?e:h;try{await Ce(t)}catch{me()}},t[5]=h,t[6]=y,t[7]=me,t[8]=Ce,t[9]=T):T=t[9];let je=T,E;t[10]===te?E=t[11]:(E=function(e){e.length>0&&te(e[0])},t[10]=te,t[11]=E);let Me=E,Ne=o&&`animate-headline-reset`,D;t[12]===Ne?D=t[13]:(D=u(Ne),t[12]=Ne,t[13]=D);let O;t[14]===D?O=t[15]:(O=(0,v.jsx)(ae,{title:`General`,description:`Customize the appearance and behavior of Tarsk.`,titleClassName:D}),t[14]=D,t[15]=O);let Pe,Fe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,v.jsx)(ee,{className:`h-3.5 w-3.5`}),Fe=(0,v.jsx)(`span`,{className:`sr-only`,children:`Reset font size to default`}),t[16]=Pe,t[17]=Fe):(Pe=t[16],Fe=t[17]);let k;t[18]===ne?k=t[19]:(k=(0,v.jsxs)(i,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:ne,children:[Pe,Fe]}),t[18]=ne,t[19]=k);let A;t[20]===l?A=t[21]:(A=(0,v.jsxs)(`span`,{className:`${d.mono} tabular-nums w-12 text-right`,children:[l,`%`]}),t[20]=l,t[21]=A);let j;t[22]!==k||t[23]!==A?(j=(0,v.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[k,A]}),t[22]=k,t[23]=A,t[24]=j):j=t[24];let M;t[25]===f?M=t[26]:(M=(0,v.jsxs)(`span`,{className:`${d.bodyMuted} w-8 text-right`,children:[f,`%`]}),t[25]=f,t[26]=M);let N;t[27]===l?N=t[28]:(N=[l],t[27]=l,t[28]=N);let P;t[29]!==Me||t[30]!==p||t[31]!==f||t[32]!==N?(P=(0,v.jsx)(ce,{value:N,min:f,max:p,step:5,onValueChange:Me,"aria-label":`Font size`}),t[29]=Me,t[30]=p,t[31]=f,t[32]=N,t[33]=P):P=t[33];let F;t[34]===p?F=t[35]:(F=(0,v.jsxs)(`span`,{className:`${d.bodyMuted} w-9`,children:[p,`%`]}),t[34]=p,t[35]=F);let I;t[36]!==M||t[37]!==P||t[38]!==F?(I=(0,v.jsxs)(`div`,{className:`flex items-center gap-3`,children:[M,P,F]}),t[36]=M,t[37]=P,t[38]=F,t[39]=I):I=t[39];let L;t[40]!==m||t[41]!==l?(L=l!==m&&(0,v.jsxs)(`p`,{className:`${d.bodyMuted} mt-2`,children:[`Font size has been changed from the default (`,m,`%).`]}),t[40]=m,t[41]=l,t[42]=L):L=t[42];let R;t[43]!==j||t[44]!==I||t[45]!==L?(R=(0,v.jsxs)(g,{title:`Font Size`,description:`Adjust the text size across the entire application.`,action:j,children:[I,L]}),t[43]=j,t[44]=I,t[45]=L,t[46]=R):R=t[46];let z;t[47]===je?z=t[48]:(z=()=>{je()},t[47]=je,t[48]=z);let Ie=ue||fe,B;t[49]!==y||t[50]!==Ae||t[51]!==z||t[52]!==Ie?(B=(0,v.jsx)(n,{type:`number`,min:1,step:1,value:y,onChange:Ae,onBlur:z,disabled:Ie,"aria-label":`Maximum turn count`,className:`w-28 text-right font-mono tabular-nums flex-shrink-0`}),t[49]=y,t[50]=Ae,t[51]=z,t[52]=Ie,t[53]=B):B=t[53];let V;t[54]===h?V=t[55]:(V=(0,v.jsxs)(`p`,{className:d.bodyMuted,children:[`Default: `,h,` turns.`]}),t[54]=h,t[55]=V);let H;t[56]!==B||t[57]!==V?(H=(0,v.jsx)(g,{title:`Maximum Turn Count`,description:`Set how many turns a long-running agent chat can take before Tarsk asks whether to continue.`,action:B,children:V}),t[56]=B,t[57]=V,t[58]=H):H=t[58];let U;t[59]===Te?U=t[60]:(U=e=>{(e==="default"||e===`tiny`)&&Te(e)},t[59]=Te,t[60]=U);let W;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(W=he.map(Se),t[61]=W):W=t[61];let G;t[62]!==U||t[63]!==we?(G=(0,v.jsx)(g,{title:`Voice Model`,description:`Choose which voice-to-text model Tarsk downloads and caches for speech input.`,children:(0,v.jsx)(s,{type:`single`,value:we,onValueChange:U,"aria-label":`Voice model`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:W})}),t[62]=U,t[63]=we,t[64]=G):G=t[64];let Le=x===`network`?`Tarsk accepts connections from other devices on your network such as the Tarsk mobile app.`:`Tarsk only accepts connections from this computer at http://localhost:${_e}.`,Re=De||Oe,K;t[65]===ke?K=t[66]:(K=e=>{(e===`local`||e===`network`)&&ke(e)},t[65]=ke,t[66]=K);let ze;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ze=ge.map(xe),t[67]=ze):ze=t[67];let q;t[68]!==x||t[69]!==Re||t[70]!==K?(q=(0,v.jsx)(s,{type:`single`,value:x,disabled:Re,onValueChange:K,"aria-label":`Server bind mode`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:ze}),t[68]=x,t[69]=Re,t[70]=K,t[71]=q):q=t[71];let J;t[72]!==b||t[73]!==x?(J=x===`network`&&b.length>0&&(0,v.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[(0,v.jsx)(`p`,{className:d.bodyMuted,children:`Available on your network:`}),(0,v.jsx)(`ul`,{className:`${d.mono} space-y-1`,children:b.map(be)})]}),t[72]=b,t[73]=x,t[74]=J):J=t[74];let Y;t[75]!==b||t[76]!==x?(Y=x===`network`&&b.length===0&&(0,v.jsx)(`p`,{className:`${d.bodyMuted} mt-3`,children:`No network IP addresses were detected on this computer.`}),t[75]=b,t[76]=x,t[77]=Y):Y=t[77];let X;t[78]===Ee?X=t[79]:(X=Ee&&(0,v.jsx)(`p`,{className:`${d.bodyMuted} mt-3`,children:`Restart Tarsk for this change to take effect.`}),t[78]=Ee,t[79]=X);let Z;t[80]!==Le||t[81]!==q||t[82]!==J||t[83]!==Y||t[84]!==X?(Z=(0,v.jsxs)(g,{title:`Local`,description:Le,children:[q,J,Y,X]}),t[80]=Le,t[81]=q,t[82]=J,t[83]=Y,t[84]=X,t[85]=Z):Z=t[85];let Q;t[86]!==R||t[87]!==H||t[88]!==G||t[89]!==Z?(Q=(0,v.jsxs)(`div`,{className:`space-y-8`,children:[R,H,G,Z]}),t[86]=R,t[87]=H,t[88]=G,t[89]=Z,t[90]=Q):Q=t[90];let $;return t[91]!==Q||t[92]!==O?($=(0,v.jsx)(re,{children:(0,v.jsxs)(ie,{children:[O,Q]})}),t[91]=Q,t[92]=O,t[93]=$):$=t[93],$}function be(e){return(0,v.jsxs)(`li`,{children:[`http://`,e,`:`,_e]},e)}function xe(e){return(0,v.jsx)(c,{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 Se(e){return(0,v.jsx)(c,{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{ye as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{At as t,Ea as n,ci as r,ji as i,ln as a,ui as o,wi as s,xo as c}from"./dialogs-config-DZKtVbNK.js";import{E as l,S as u,T as d,w as f}from"./history-view-jX3PPID6.js";import{E as p,O as m,j as h}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{At as t,Ea as n,ci as r,ji as i,ln as a,ui as o,wi as s,xo as c}from"./dialogs-config-DZKtVbNK.js";import{E as l,S as u,T as d,w as f}from"./history-view-jX3PPID6.js";import{E as p,O as m,j as h}from"./index-DjD2SPNZ.js";var g=e(c(),1),_=i();function v(){let e=h(e=>e.selectedThreadId),[i,c]=(0,g.useState)(``),[v,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(!1);(0,g.useEffect)(()=>{e&&(y(!0),t(e,`AGENTS.md`).then(e=>c(e.content)).catch(()=>c(``)).finally(()=>y(!1)))},[e]);async function S(){if(e){x(!0);try{await a(e,`AGENTS.md`,i),p({title:`Instructions saved`})}catch(e){p({title:`Error`,description:e instanceof Error?e.message:`Failed to save instructions`,variant:`destructive`})}finally{x(!1)}}}return e?(0,_.jsx)(f,{children:(0,_.jsxs)(l,{className:`w-full flex-1 flex flex-col min-h-0`,children:[(0,_.jsx)(u,{title:`Instructions`,description:`Add context like coding guidelines and expectations. Stored in AGENTS.md file.`,action:(0,_.jsx)(r,{onClick:S,disabled:v||b,children:b?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(n,{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)(n,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,_.jsx)(m,{value:i,onChange:e=>c(e.target.value),className:o(s.mono,`flex-1 min-h-0 resize-none`),placeholder:`Add instructions for your agent in AGENTS.md...`,disabled:b})]})}):(0,_.jsx)(d,{children:`Select a thread to edit instructions.`})}export{v as SettingsInstructionsView,v as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dr as t,Er as n,Ii as r,M as i,Or as a,Ui as o,Wa as s,ci as c,ct as l,fa as u,ft as d,ji as f,on as p,ta as m,ua as h,wi as g,xo as _,yo as v}from"./dialogs-config-DZKtVbNK.js";import{A as y,C as b,D as ee,E as x,F as S,I as C,M as w,N as T,P as E,S as te,T as D,b as O,d as k,f as A,g as j,h as M,j as N,k as P,p as F,y as I}from"./history-view-jX3PPID6.js";import{C as L,E as R,O as z,c as ne,j as B,l as V,o as re,s as H}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dr as t,Er as n,Ii as r,M as i,Or as a,Ui as o,Wa as s,ci as c,ct as l,fa as u,ft as d,ji as f,on as p,ta as m,ua as h,wi as g,xo as _,yo as v}from"./dialogs-config-DZKtVbNK.js";import{A as y,C as b,D as ee,E as x,F as S,I as C,M as w,N as T,P as E,S as te,T as D,b as O,d as k,f as A,g as j,h as M,j as N,k as P,p as F,y as I}from"./history-view-jX3PPID6.js";import{C as L,E as R,O as z,c as ne,j as B,l as V,o as re,s as H}from"./index-DjD2SPNZ.js";import{t as U}from"./skeleton-qzmFgKhS.js";import{a as W,i as ie,n as G,r as K,t as ae}from"./settings-list-CKPEGohm.js";import{t as oe}from"./mcp-server-card-CTCrhFIS.js";var q=v(),J=e(_(),1);function se(e){let[t,n]=(0,J.useState)([]),[r,i]=(0,J.useState)(!1),a=(0,J.useCallback)(async()=>{if(e){i(!0);try{let t=await l(e);n(Object.entries(t.servers??{}).map(([e,t])=>({name:e,config:t})))}catch{n([])}finally{i(!1)}}},[e]);return(0,J.useEffect)(()=>{a()},[a]),{installedServers:t,loadingConfig:r,loadInstalledServers:a}}function Y(){let e=(0,q.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,J.useState)(t),i,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{d().then(r).catch(()=>r([]))},a=[],e[1]=i,e[2]=a):(i=e[1],a=e[2]),(0,J.useEffect)(i,a);let o;return e[3]===n?o=e[4]:(o={popularServers:n},e[3]=n,e[4]=o),o}async function X(e,t,n){await p(e,t,n)}async function ce(e,t){await i(e,t)}var Z=f();function le(e){return e?.url?`remote`:`local`}function ue(e){return Object.entries(e??{}).map(([e,t])=>({key:e,value:t}))}function Q({projectPath:e,serverName:t,initialName:i,initialConfig:a,onBack:o}){let{installedServers:s}=se(e),l=!!t,[u,d]=(0,J.useState)(`local`),[f,p]=(0,J.useState)(``),[m,_]=(0,J.useState)(``),[v,y]=(0,J.useState)(``),[b,x]=(0,J.useState)(``),[S,C]=(0,J.useState)(`sse`),[w,T]=(0,J.useState)([]),[E,D]=(0,J.useState)([]),[N,P]=(0,J.useState)(!1),[L,B]=(0,J.useState)(!1),[U,W]=(0,J.useState)(null),[ie,G]=(0,J.useState)(l),[K,ae]=(0,J.useState)(``),[oe,q]=(0,J.useState)(``);function Y(e,t){let n=le(t);d(n),p(e),_(t.command??``),y((t.args??[]).join(`
|
|
2
2
|
`)),x(t.url??``),C(t.transport??`sse`),T(ue(t.env)),D(ue(t.headers)),ae(e),q(JSON.stringify({name:e,type:n,config:t}))}(0,J.useEffect)(()=>{if(l&&t){let e=s.find(e=>e.name===t);e&&(Y(e.name,e.config),G(!1))}else a&&Y(i??``,a),G(!1)},[s,t,l,a,i]);let Q=(0,J.useCallback)(()=>{T(e=>[...e,{key:``,value:``}])},[]),$=(0,J.useCallback)(e=>{T(t=>t.filter((t,n)=>n!==e))},[]),de=(0,J.useCallback)((e,t)=>{T(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),fe=(0,J.useCallback)((e,t)=>{T(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]),pe=(0,J.useCallback)(()=>{D(e=>[...e,{key:``,value:``}])},[]),me=(0,J.useCallback)(e=>{D(t=>t.filter((t,n)=>n!==e))},[]),he=(0,J.useCallback)((e,t)=>{D(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),ge=(0,J.useCallback)((e,t)=>{D(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]);function _e(e){let t={};for(let{key:n,value:r}of e)n.trim()&&(t[n.trim()]=r);return Object.keys(t).length>0?t:void 0}function ve(){let e=_e(w);if(u===`remote`){let t=_e(E);return{url:b.trim(),transport:S,...t?{headers:t}:{},...e?{env:e}:{}}}let t=v.split(`
|
|
3
3
|
`).map(e=>e.trim()).filter(Boolean);return{command:m.trim(),args:t,...e?{env:e}:{}}}let ye=JSON.stringify({name:f.trim(),type:u,config:ve()}),be=async()=>{W(null);let t=f.trim();if(!t){W(`Server name is required`);return}if(u===`remote`){if(!b.trim()){W(`Server URL is required`);return}try{new URL(b.trim())}catch{W(`Server URL must be a valid URL`);return}}else if(!m.trim()){W(`Command is required`);return}P(!0);try{if(!e)throw Error(`No project path`);await X(e,K||t,ve()),R({title:`Success`,description:l?`MCP server configuration saved`:`MCP server added`}),o()}catch(e){W(e instanceof Error?e.message:`Failed to save server`)}finally{P(!1)}},xe=async()=>{if(e){B(!0);try{await ce(e,K),R({title:`Success`,description:`MCP server removed`}),o()}catch(e){W(e instanceof Error?e.message:`Failed to delete server`)}finally{B(!1)}}},Se=l?ye!==oe:f.trim()!==``||m.trim()!==``||v.trim()!==``||b.trim()!==``||w.length>0||E.length>0;return ie?(0,Z.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Z.jsx)(`p`,{className:g.bodyMuted,children:`Loading server configuration...`})}):(0,Z.jsx)(ee,{children:(0,Z.jsxs)(I,{children:[(0,Z.jsx)(te,{title:l?f:`Add MCP Server`,description:l?`Edit MCP Server configuration.`:`Configure a new MCP Server.`}),(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsx)(O,{title:`Server name`,description:l?`Server name cannot be changed`:void 0,children:(0,Z.jsx)(n,{id:`server-name`,placeholder:`e.g. filesystem`,value:f,onChange:e=>p(e.target.value),disabled:l})}),(0,Z.jsxs)(re,{value:u,onValueChange:e=>d(e),className:`w-full`,children:[(0,Z.jsxs)(ne,{className:`grid w-full grid-cols-2`,children:[(0,Z.jsx)(V,{value:`local`,children:`Local (stdio)`}),(0,Z.jsx)(V,{value:`remote`,children:`Remote (HTTP/SSE)`})]}),(0,Z.jsxs)(H,{value:`local`,className:`space-y-6 mt-6`,children:[(0,Z.jsx)(O,{title:`Command`,children:(0,Z.jsx)(n,{id:`server-command`,placeholder:`e.g. npx`,value:m,onChange:e=>_(e.target.value)})}),(0,Z.jsx)(O,{title:`Arguments`,description:`One argument per line`,children:(0,Z.jsx)(z,{id:`server-args`,placeholder:`-y
|
|
4
4
|
@modelcontextprotocol/server-filesystem
|
package/dist/public/assets/{settings-models-view-m-MDG6JH.js → settings-models-view-CAMouMhE.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{B as t,H as n,Ji as r,Tt as i,U as a,V as o,W as s,Xa as c,ci as l,di as u,fr as d,hr as f,ji as p,mr as m,pr as h,ui as g,vo as _,wi as v,wt as y,xo as b,yo as x,z as S}from"./dialogs-config-DZKtVbNK.js";import{n as C,s as w}from"./onboarding-CxtzQldG.js";import{C as T,D as E,E as D,S as O,T as k,a as A,l as j,n as M,o as N,x as P}from"./history-view-jX3PPID6.js";import{c as F,l as I,o as L,s as R}from"./index-CbJ3v0Sr.js";import{a as z,o as B}from"./settings-list-CKPEGohm.js";import{t as V}from"./settings-models-skeleton-l966LEN8.js";var H=e(b(),1),U=x();function W(e){return`settings-models:coding:${e}`}function G(e){return`settings-models:image:${e}`}async function K(){let e=(await i()).filter(e=>e.apiKey),t={};e.forEach(e=>{t[e.slug]=`alphabetical`});let n={},r={};return await Promise.all(e.map(async e=>{try{let t=await s(e.slug);n[e.slug]=t.models,r[e.slug]=new Set(t.enabledModelIds)}catch(t){console.error(`Failed to load models for ${e.slug}:`,t),n[e.slug]=[],r[e.slug]=new Set}})),{providers:e,allModels:n,enabledModelIds:r,providerSortOptions:t}}async function q(e){let t=e.filter(e=>e.name.toLowerCase()===`openrouter`),n={},r={};return await Promise.all(t.map(async e=>{try{let t=await a(e.slug);n[e.slug]=t.models,r[e.slug]=new Set(t.enabledModelIds)}catch(t){console.error(`Failed to load image models for ${e.slug}:`,t),n[e.slug]=[],r[e.slug]=new Set}})),{allImageModels:n,enabledImageModelIds:r}}var J=p();function ee({providers:e,globalSearchQuery:t,providerSortOptions:n,setProviderSortOptions:r,filterAndSortModels:i,getModelDisplayName:a,onSaveStatus:s}){let p=A(G(0),()=>q(e)),[b]=(0,H.useState)(p.allImageModels),[x,w]=(0,H.useState)(p.enabledImageModelIds);async function E(e,t){try{x[e]?.has(t)?(await S(e,t),w(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await o(e,t),w(n=>({...n,[e]:new Set([...n[e]||[],t])}))),s(`Model preferences saved successfully`)}catch(e){s(e instanceof Error?e.message:`Failed to save model changes`)}}async function D(e,t){let n=b[e],r=x[e];if(n)for(let i of n)r?.has(i.id)!==t&&await E(e,i.id)}return(0,J.jsx)(`div`,{className:`space-y-6`,children:e.filter(e=>e.name.toLowerCase()===`openrouter`).map(e=>{let o=b[e.slug]||[],s=x[e.slug]||new Set,p=n[e.slug]||`alphabetical`,S=i(o,s,p);return S.length===0&&t?null:(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:(0,J.jsx)(`img`,{src:y(e.slug),alt:`${e.name} logo`,className:`h-5 w-5 dark:invert`,onError:e=>{e.target.style.display=`none`;let t=e.target.parentElement;t&&(t.classList.remove(`overflow-hidden`),t.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-muted-foreground"><path d="M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5"/><path d="M8.5 8.5a2.5 2.5 0 0 0 0 5"/><path d="M15.5 15.5a2.5 2.5 0 0 0 0-5"/></svg>`)}})}),(0,J.jsx)(T,{title:e.name,className:`mb-0`})]}),S.length>0&&(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(C,{id:`select-all-image-${e.slug}`,checked:S.every(e=>s.has(e.id)),onCheckedChange:t=>void D(e.slug,t===!0)}),(0,J.jsx)(`label`,{htmlFor:`select-all-image-${e.slug}`,className:g(v.body,`cursor-pointer whitespace-nowrap`),children:`Select all models`})]}),(0,J.jsx)(m,{children:(0,J.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{asChild:!0,children:(0,J.jsx)(l,{type:`button`,variant:p===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>r(t=>({...t,[e.slug]:`alphabetical`})),children:(0,J.jsx)(_,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort A–Z`})]}),(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{asChild:!0,children:(0,J.jsx)(l,{type:`button`,variant:p===`price-low`||p===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>r(t=>({...t,[e.slug]:`price-low`})),children:(0,J.jsx)(c,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort by price`})]})]})})]}),S.length===0?(0,J.jsx)(B,{message:t?`No models matching your search.`:`No image models available for this provider.`}):(0,J.jsx)(m,{children:(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:S.map(t=>{let n=s.has(t.id),r=t.pricing;return(0,J.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0`,children:[(0,J.jsx)(C,{id:`image-${t.id}`,checked:n,onCheckedChange:()=>void E(e.slug,t.id),className:`mt-0`}),(0,J.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,J.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,J.jsx)(`label`,{htmlFor:`image-${t.id}`,className:g(v.label,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:a(t)})}),r&&(0,J.jsx)(`span`,{className:g(v.compact,`text-muted-foreground whitespace-nowrap flex-shrink-0`),children:(r.prompt??0)===0&&(r.completion??0)===0?``:`$${u(r.prompt??0)} in | $${u(r.completion??0)} out`})]})]},t.id)})})})]},e.slug)})})}function Y({loadVersion:e}){let i=A(W(e),()=>K()),a=i.providers,[o]=(0,H.useState)(i.allModels),[s,p]=(0,H.useState)(i.enabledModelIds),[b,x]=(0,H.useState)(`coding`),[S,M]=(0,H.useState)(``),[N,V]=(0,H.useState)(i.providerSortOptions),[U,G]=(0,H.useState)(``),q=e=>w(e.id),Y=async(e,r)=>{try{s[e]?.has(r)?(await t(e,r),p(t=>{let n=new Set(t[e]??[]);return n.delete(r),{...t,[e]:n}})):(await n(e,r),p(t=>({...t,[e]:new Set([...t[e]||[],r])}))),G(`Model preferences saved successfully`),setTimeout(()=>G(``),3e3)}catch(e){G(e instanceof Error?e.message:`Failed to save model changes`)}},X=async(e,t)=>{let n=o[e],r=s[e];if(n)for(let i of n)r?.has(i.id)!==t&&await Y(e,i.id)},Z=e=>e?e<20?1:e<30?2:e<40?3:e<50?4:5:0,Q=({codingIndex:e,modelName:t})=>{let n=Z(e);return n===0?null:(0,J.jsx)(m,{children:(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{asChild:!0,children:(0,J.jsx)(`div`,{className:`flex items-center gap-0.5`,children:[1,2,3,4,5].map(e=>(0,J.jsx)(r,{className:`h-3 w-3 ${e<=n?`fill-yellow-400 text-yellow-400`:`text-gray-300`}`},e))})}),(0,J.jsx)(h,{children:(0,J.jsxs)(`p`,{className:v.body,children:[t,` was indexed `,e,` for coding intelligence`]})})]})})},$=(e,t,n)=>{let r=S.toLowerCase();return e.filter(e=>{let t=q(e);return e.name.toLowerCase().includes(r)||e.id.toLowerCase().includes(r)||t.toLowerCase().includes(r)}).sort((e,r)=>{let i=+!t.has(e.id),a=+!t.has(r.id);if(i!==a)return i-a;if(n===`price-low`){let t=!!e.pricing;return t===!!r.pricing?!e.pricing||!r.pricing?0:((e.pricing.prompt??0)+(e.pricing.completion??0))/2-((r.pricing.prompt??0)+(r.pricing.completion??0))/2:t?-1:1}if(n===`price-high`){let t=!!e.pricing;if(t!==!!r.pricing)return t?-1:1;if(!e.pricing||!r.pricing)return 0;let n=((e.pricing.prompt??0)+(e.pricing.completion??0))/2;return((r.pricing.prompt??0)+(r.pricing.completion??0))/2-n}if(n===`coding-index`){let t=e.coding_index!==void 0&&e.coding_index!==null;return t===(r.coding_index!==void 0&&r.coding_index!==null)?e.coding_index==null||r.coding_index==null?0:r.coding_index-e.coding_index:t?-1:1}return q(e).localeCompare(q(r))})};return a.length===0?(0,J.jsx)(k,{title:`No providers configured`,children:`Configure a provider with an API key to view available models.`}):(0,J.jsx)(E,{children:(0,J.jsxs)(D,{children:[(0,J.jsx)(O,{title:`Models`,description:`View and manage available models from your configured providers.`}),(0,J.jsxs)(`div`,{className:`space-y-6`,children:[(0,J.jsx)(z,{placeholder:`Search models across all providers...`,value:S,onChange:M}),(0,J.jsxs)(L,{value:b,onValueChange:e=>{x(e),M(``)},children:[(0,J.jsxs)(F,{className:`mb-4`,children:[(0,J.jsx)(I,{value:`coding`,children:`Coding`}),a.some(e=>e.name.toLowerCase()===`openrouter`)&&(0,J.jsx)(I,{value:`image`,children:`Image`})]}),(0,J.jsx)(R,{value:`coding`,children:(0,J.jsx)(`div`,{className:`space-y-6`,children:a.map(e=>{let t=o[e.slug]||[],n=s[e.slug]||new Set,i=N[e.slug]||`alphabetical`,a=$(t,n,i);return a.length===0&&S?null:(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:(0,J.jsx)(`img`,{src:y(e.slug),alt:`${e.name} logo`,className:`h-5 w-5 dark:invert`,onError:e=>{e.target.style.display=`none`;let t=e.target.parentElement;t&&(t.classList.remove(`overflow-hidden`),t.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-muted-foreground"><path d="M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5"/><path d="M8.5 8.5a2.5 2.5 0 0 0 0 5"/><path d="M15.5 15.5a2.5 2.5 0 0 0 0-5"/></svg>`)}})}),(0,J.jsx)(T,{title:e.name,className:`mb-0`})]}),a.length>0&&(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(C,{id:`select-all-${e.slug}`,checked:a.every(e=>n.has(e.id)),onCheckedChange:t=>X(e.slug,t===!0)}),(0,J.jsx)(`label`,{htmlFor:`select-all-${e.slug}`,className:g(v.body,`cursor-pointer whitespace-nowrap`),children:`Select all models`})]}),(0,J.jsx)(m,{children:(0,J.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{asChild:!0,children:(0,J.jsx)(l,{type:`button`,variant:i===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(t=>({...t,[e.slug]:`alphabetical`})),children:(0,J.jsx)(_,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort A–Z`})]}),(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{asChild:!0,children:(0,J.jsx)(l,{type:`button`,variant:i===`price-low`||i===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(t=>({...t,[e.slug]:`price-low`})),children:(0,J.jsx)(c,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort by price`})]}),(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{asChild:!0,children:(0,J.jsx)(l,{type:`button`,variant:i===`coding-index`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(t=>({...t,[e.slug]:`coding-index`})),children:(0,J.jsx)(r,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort by coding intelligence`})]})]})})]}),a.length===0?(0,J.jsx)(B,{message:S?`No models matching your search.`:`No models available for this provider.`}):(0,J.jsx)(m,{children:(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:a.map(t=>{let r=n.has(t.id),a=t.pricing;return(0,J.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0`,children:[(0,J.jsx)(C,{id:t.id,checked:r,onCheckedChange:()=>Y(e.slug,t.id),className:`mt-0`}),(0,J.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,J.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,J.jsx)(`label`,{htmlFor:t.id,className:g(v.body,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:q(t)})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[i===`coding-index`&&(0,J.jsx)(Q,{codingIndex:t.coding_index,modelName:q(t)}),a&&(0,J.jsx)(`span`,{className:g(v.compact,`text-muted-foreground whitespace-nowrap`),children:(a.prompt??0)===0&&(a.completion??0)===0?``:`$${u(a.prompt??0)} in | $${u(a.completion??0)} out`})]})]})]},t.id)})})})]},e.slug)})})}),(0,J.jsx)(R,{value:`image`,children:b===`image`?(0,J.jsx)(H.Suspense,{fallback:(0,J.jsx)(j,{className:`py-12`,size:`sm`}),children:(0,J.jsx)(ee,{providers:a,globalSearchQuery:S,providerSortOptions:N,setProviderSortOptions:V,filterAndSortModels:$,getModelDisplayName:q,onSaveStatus:e=>{G(e),e.includes(`Failed`)||setTimeout(()=>G(``),3e3)}})}):null})]}),U&&(0,J.jsx)(P,{variant:U.includes(`error`)||U.includes(`Failed`)?`error`:`success`,className:`mb-0`,children:U})]})]})})}function X(){let e=(0,U.c)(8),[t,n]=(0,H.useState)(0),r;e[0]===t?r=e[1]:(r=function(){N(W(t)),n(Q)},e[0]=t,e[1]=r);let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,J.jsx)(V,{}),e[2]=a):a=e[2];let o;e[3]===t?o=e[4]:(o=(0,J.jsx)(H.Suspense,{fallback:a,children:(0,J.jsx)(Y,{loadVersion:t},t)}),e[3]=t,e[4]=o);let s;return e[5]!==i||e[6]!==o?(s=(0,J.jsx)(M,{fallbackTitle:`Failed to load models`,onRetry:i,renderFallback:Z,children:o}),e[5]=i,e[6]=o,e[7]=s):s=e[7],s}function Z(e,t){return(0,J.jsx)(k,{title:`Failed to load models`,action:(0,J.jsx)(l,{variant:`outline`,onClick:t,children:`Retry`}),children:e.message})}function Q(e){return e+1}export{X as SettingsModelsView,X as default};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{B as t,H as n,Ji as r,Tt as i,U as a,V as o,W as s,Xa as c,ci as l,di as u,fr as d,hr as f,ji as p,mr as m,pr as h,ui as g,vo as _,wi as v,wt as y,xo as b,yo as x,z as S}from"./dialogs-config-DZKtVbNK.js";import{n as C,s as w}from"./onboarding-CxtzQldG.js";import{C as T,D as E,E as D,S as O,T as k,a as A,l as j,n as M,o as N,x as P}from"./history-view-jX3PPID6.js";import{c as F,l as I,o as L,s as R}from"./index-DjD2SPNZ.js";import{a as z,o as B}from"./settings-list-CKPEGohm.js";import{t as V}from"./settings-models-skeleton-l966LEN8.js";var H=e(b(),1),U=x();function W(e){return`settings-models:coding:${e}`}function G(e){return`settings-models:image:${e}`}async function K(){let e=(await i()).filter(e=>e.apiKey),t={};e.forEach(e=>{t[e.slug]=`alphabetical`});let n={},r={};return await Promise.all(e.map(async e=>{try{let t=await s(e.slug);n[e.slug]=t.models,r[e.slug]=new Set(t.enabledModelIds)}catch(t){console.error(`Failed to load models for ${e.slug}:`,t),n[e.slug]=[],r[e.slug]=new Set}})),{providers:e,allModels:n,enabledModelIds:r,providerSortOptions:t}}async function q(e){let t=e.filter(e=>e.name.toLowerCase()===`openrouter`),n={},r={};return await Promise.all(t.map(async e=>{try{let t=await a(e.slug);n[e.slug]=t.models,r[e.slug]=new Set(t.enabledModelIds)}catch(t){console.error(`Failed to load image models for ${e.slug}:`,t),n[e.slug]=[],r[e.slug]=new Set}})),{allImageModels:n,enabledImageModelIds:r}}var J=p();function ee({providers:e,globalSearchQuery:t,providerSortOptions:n,setProviderSortOptions:r,filterAndSortModels:i,getModelDisplayName:a,onSaveStatus:s}){let p=A(G(0),()=>q(e)),[b]=(0,H.useState)(p.allImageModels),[x,w]=(0,H.useState)(p.enabledImageModelIds);async function E(e,t){try{x[e]?.has(t)?(await S(e,t),w(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await o(e,t),w(n=>({...n,[e]:new Set([...n[e]||[],t])}))),s(`Model preferences saved successfully`)}catch(e){s(e instanceof Error?e.message:`Failed to save model changes`)}}async function D(e,t){let n=b[e],r=x[e];if(n)for(let i of n)r?.has(i.id)!==t&&await E(e,i.id)}return(0,J.jsx)(`div`,{className:`space-y-6`,children:e.filter(e=>e.name.toLowerCase()===`openrouter`).map(e=>{let o=b[e.slug]||[],s=x[e.slug]||new Set,p=n[e.slug]||`alphabetical`,S=i(o,s,p);return S.length===0&&t?null:(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:(0,J.jsx)(`img`,{src:y(e.slug),alt:`${e.name} logo`,className:`h-5 w-5 dark:invert`,onError:e=>{e.target.style.display=`none`;let t=e.target.parentElement;t&&(t.classList.remove(`overflow-hidden`),t.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-muted-foreground"><path d="M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5"/><path d="M8.5 8.5a2.5 2.5 0 0 0 0 5"/><path d="M15.5 15.5a2.5 2.5 0 0 0 0-5"/></svg>`)}})}),(0,J.jsx)(T,{title:e.name,className:`mb-0`})]}),S.length>0&&(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(C,{id:`select-all-image-${e.slug}`,checked:S.every(e=>s.has(e.id)),onCheckedChange:t=>void D(e.slug,t===!0)}),(0,J.jsx)(`label`,{htmlFor:`select-all-image-${e.slug}`,className:g(v.body,`cursor-pointer whitespace-nowrap`),children:`Select all models`})]}),(0,J.jsx)(m,{children:(0,J.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{asChild:!0,children:(0,J.jsx)(l,{type:`button`,variant:p===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>r(t=>({...t,[e.slug]:`alphabetical`})),children:(0,J.jsx)(_,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort A–Z`})]}),(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{asChild:!0,children:(0,J.jsx)(l,{type:`button`,variant:p===`price-low`||p===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>r(t=>({...t,[e.slug]:`price-low`})),children:(0,J.jsx)(c,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort by price`})]})]})})]}),S.length===0?(0,J.jsx)(B,{message:t?`No models matching your search.`:`No image models available for this provider.`}):(0,J.jsx)(m,{children:(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:S.map(t=>{let n=s.has(t.id),r=t.pricing;return(0,J.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0`,children:[(0,J.jsx)(C,{id:`image-${t.id}`,checked:n,onCheckedChange:()=>void E(e.slug,t.id),className:`mt-0`}),(0,J.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,J.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,J.jsx)(`label`,{htmlFor:`image-${t.id}`,className:g(v.label,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:a(t)})}),r&&(0,J.jsx)(`span`,{className:g(v.compact,`text-muted-foreground whitespace-nowrap flex-shrink-0`),children:(r.prompt??0)===0&&(r.completion??0)===0?``:`$${u(r.prompt??0)} in | $${u(r.completion??0)} out`})]})]},t.id)})})})]},e.slug)})})}function Y({loadVersion:e}){let i=A(W(e),()=>K()),a=i.providers,[o]=(0,H.useState)(i.allModels),[s,p]=(0,H.useState)(i.enabledModelIds),[b,x]=(0,H.useState)(`coding`),[S,M]=(0,H.useState)(``),[N,V]=(0,H.useState)(i.providerSortOptions),[U,G]=(0,H.useState)(``),q=e=>w(e.id),Y=async(e,r)=>{try{s[e]?.has(r)?(await t(e,r),p(t=>{let n=new Set(t[e]??[]);return n.delete(r),{...t,[e]:n}})):(await n(e,r),p(t=>({...t,[e]:new Set([...t[e]||[],r])}))),G(`Model preferences saved successfully`),setTimeout(()=>G(``),3e3)}catch(e){G(e instanceof Error?e.message:`Failed to save model changes`)}},X=async(e,t)=>{let n=o[e],r=s[e];if(n)for(let i of n)r?.has(i.id)!==t&&await Y(e,i.id)},Z=e=>e?e<20?1:e<30?2:e<40?3:e<50?4:5:0,Q=({codingIndex:e,modelName:t})=>{let n=Z(e);return n===0?null:(0,J.jsx)(m,{children:(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{asChild:!0,children:(0,J.jsx)(`div`,{className:`flex items-center gap-0.5`,children:[1,2,3,4,5].map(e=>(0,J.jsx)(r,{className:`h-3 w-3 ${e<=n?`fill-yellow-400 text-yellow-400`:`text-gray-300`}`},e))})}),(0,J.jsx)(h,{children:(0,J.jsxs)(`p`,{className:v.body,children:[t,` was indexed `,e,` for coding intelligence`]})})]})})},$=(e,t,n)=>{let r=S.toLowerCase();return e.filter(e=>{let t=q(e);return e.name.toLowerCase().includes(r)||e.id.toLowerCase().includes(r)||t.toLowerCase().includes(r)}).sort((e,r)=>{let i=+!t.has(e.id),a=+!t.has(r.id);if(i!==a)return i-a;if(n===`price-low`){let t=!!e.pricing;return t===!!r.pricing?!e.pricing||!r.pricing?0:((e.pricing.prompt??0)+(e.pricing.completion??0))/2-((r.pricing.prompt??0)+(r.pricing.completion??0))/2:t?-1:1}if(n===`price-high`){let t=!!e.pricing;if(t!==!!r.pricing)return t?-1:1;if(!e.pricing||!r.pricing)return 0;let n=((e.pricing.prompt??0)+(e.pricing.completion??0))/2;return((r.pricing.prompt??0)+(r.pricing.completion??0))/2-n}if(n===`coding-index`){let t=e.coding_index!==void 0&&e.coding_index!==null;return t===(r.coding_index!==void 0&&r.coding_index!==null)?e.coding_index==null||r.coding_index==null?0:r.coding_index-e.coding_index:t?-1:1}return q(e).localeCompare(q(r))})};return a.length===0?(0,J.jsx)(k,{title:`No providers configured`,children:`Configure a provider with an API key to view available models.`}):(0,J.jsx)(E,{children:(0,J.jsxs)(D,{children:[(0,J.jsx)(O,{title:`Models`,description:`View and manage available models from your configured providers.`}),(0,J.jsxs)(`div`,{className:`space-y-6`,children:[(0,J.jsx)(z,{placeholder:`Search models across all providers...`,value:S,onChange:M}),(0,J.jsxs)(L,{value:b,onValueChange:e=>{x(e),M(``)},children:[(0,J.jsxs)(F,{className:`mb-4`,children:[(0,J.jsx)(I,{value:`coding`,children:`Coding`}),a.some(e=>e.name.toLowerCase()===`openrouter`)&&(0,J.jsx)(I,{value:`image`,children:`Image`})]}),(0,J.jsx)(R,{value:`coding`,children:(0,J.jsx)(`div`,{className:`space-y-6`,children:a.map(e=>{let t=o[e.slug]||[],n=s[e.slug]||new Set,i=N[e.slug]||`alphabetical`,a=$(t,n,i);return a.length===0&&S?null:(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:(0,J.jsx)(`img`,{src:y(e.slug),alt:`${e.name} logo`,className:`h-5 w-5 dark:invert`,onError:e=>{e.target.style.display=`none`;let t=e.target.parentElement;t&&(t.classList.remove(`overflow-hidden`),t.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-muted-foreground"><path d="M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5"/><path d="M8.5 8.5a2.5 2.5 0 0 0 0 5"/><path d="M15.5 15.5a2.5 2.5 0 0 0 0-5"/></svg>`)}})}),(0,J.jsx)(T,{title:e.name,className:`mb-0`})]}),a.length>0&&(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(C,{id:`select-all-${e.slug}`,checked:a.every(e=>n.has(e.id)),onCheckedChange:t=>X(e.slug,t===!0)}),(0,J.jsx)(`label`,{htmlFor:`select-all-${e.slug}`,className:g(v.body,`cursor-pointer whitespace-nowrap`),children:`Select all models`})]}),(0,J.jsx)(m,{children:(0,J.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{asChild:!0,children:(0,J.jsx)(l,{type:`button`,variant:i===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(t=>({...t,[e.slug]:`alphabetical`})),children:(0,J.jsx)(_,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort A–Z`})]}),(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{asChild:!0,children:(0,J.jsx)(l,{type:`button`,variant:i===`price-low`||i===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(t=>({...t,[e.slug]:`price-low`})),children:(0,J.jsx)(c,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort by price`})]}),(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{asChild:!0,children:(0,J.jsx)(l,{type:`button`,variant:i===`coding-index`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(t=>({...t,[e.slug]:`coding-index`})),children:(0,J.jsx)(r,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort by coding intelligence`})]})]})})]}),a.length===0?(0,J.jsx)(B,{message:S?`No models matching your search.`:`No models available for this provider.`}):(0,J.jsx)(m,{children:(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:a.map(t=>{let r=n.has(t.id),a=t.pricing;return(0,J.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0`,children:[(0,J.jsx)(C,{id:t.id,checked:r,onCheckedChange:()=>Y(e.slug,t.id),className:`mt-0`}),(0,J.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,J.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,J.jsx)(`label`,{htmlFor:t.id,className:g(v.body,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:q(t)})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[i===`coding-index`&&(0,J.jsx)(Q,{codingIndex:t.coding_index,modelName:q(t)}),a&&(0,J.jsx)(`span`,{className:g(v.compact,`text-muted-foreground whitespace-nowrap`),children:(a.prompt??0)===0&&(a.completion??0)===0?``:`$${u(a.prompt??0)} in | $${u(a.completion??0)} out`})]})]})]},t.id)})})})]},e.slug)})})}),(0,J.jsx)(R,{value:`image`,children:b===`image`?(0,J.jsx)(H.Suspense,{fallback:(0,J.jsx)(j,{className:`py-12`,size:`sm`}),children:(0,J.jsx)(ee,{providers:a,globalSearchQuery:S,providerSortOptions:N,setProviderSortOptions:V,filterAndSortModels:$,getModelDisplayName:q,onSaveStatus:e=>{G(e),e.includes(`Failed`)||setTimeout(()=>G(``),3e3)}})}):null})]}),U&&(0,J.jsx)(P,{variant:U.includes(`error`)||U.includes(`Failed`)?`error`:`success`,className:`mb-0`,children:U})]})]})})}function X(){let e=(0,U.c)(8),[t,n]=(0,H.useState)(0),r;e[0]===t?r=e[1]:(r=function(){N(W(t)),n(Q)},e[0]=t,e[1]=r);let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,J.jsx)(V,{}),e[2]=a):a=e[2];let o;e[3]===t?o=e[4]:(o=(0,J.jsx)(H.Suspense,{fallback:a,children:(0,J.jsx)(Y,{loadVersion:t},t)}),e[3]=t,e[4]=o);let s;return e[5]!==i||e[6]!==o?(s=(0,J.jsx)(M,{fallbackTitle:`Failed to load models`,onRetry:i,renderFallback:Z,children:o}),e[5]=i,e[6]=o,e[7]=s):s=e[7],s}function Z(e,t){return(0,J.jsx)(k,{title:`Failed to load models`,action:(0,J.jsx)(l,{variant:`outline`,onClick:t,children:`Retry`}),children:e.message})}function Q(e){return e+1}export{X as SettingsModelsView,X as default};
|
package/dist/public/assets/{settings-rules-view-tG9JJQzK.js → settings-rules-view-BnazfbJb.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dr as t,Ea as n,Er as r,Gt as i,L as a,Or as o,P as s,Ui as c,Wa as l,ci as u,ia as d,ji as f,jt as p,ln as m,pt as h,so as g,ui as _,vt as ee,wi as v,xo as y,yo as b}from"./dialogs-config-DZKtVbNK.js";import{n as x,t as S}from"./react-vendor-Ba8DSNiO.js";import{A as te,C,D as w,E as ne,F as T,I as re,M as ie,N as ae,P as oe,S as E,T as D,b as O,j as k,k as A,x as j,y as M}from"./history-view-jX3PPID6.js";import{C as se,E as N,O as P,j as F}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dr as t,Ea as n,Er as r,Gt as i,L as a,Or as o,P as s,Ui as c,Wa as l,ci as u,ia as d,ji as f,jt as p,ln as m,pt as h,so as g,ui as _,vt as ee,wi as v,xo as y,yo as b}from"./dialogs-config-DZKtVbNK.js";import{n as x,t as S}from"./react-vendor-Ba8DSNiO.js";import{A as te,C,D as w,E as ne,F as T,I as re,M as ie,N as ae,P as oe,S as E,T as D,b as O,j as k,k as A,x as j,y as M}from"./history-view-jX3PPID6.js";import{C as se,E as N,O as P,j as F}from"./index-DjD2SPNZ.js";import{t as I}from"./skeleton-qzmFgKhS.js";import{a as ce,i as le,n as L,r as R,t as z}from"./settings-list-CKPEGohm.js";import{t as B}from"./mcp-server-card-CTCrhFIS.js";var V=b(),H=e(y(),1),U=f(),W=H.forwardRef((e,t)=>{let n=(0,V.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=_(`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,U.jsx)(x,{className:_(`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,U.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});W.displayName=S.displayName;function ue({threadId:e,onRuleCreated:t}){let[i,a]=(0,H.useState)(``),[o,s]=(0,H.useState)(``),[c,l]=(0,H.useState)(!1),[d,f]=(0,H.useState)(!1),p=i.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),h=p.length>0&&p.length<=64;return e?(0,U.jsx)(w,{children:(0,U.jsxs)(M,{children:[(0,U.jsx)(E,{title:`Add Rule`,description:`Create a new agent rule. The rule will be saved as a .md file in the .agents/rules folder.`}),(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsxs)(O,{title:`Rule Name`,children:[(0,U.jsx)(r,{id:`ruleName`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g. Code Style Guide`,disabled:d}),i?(0,U.jsxs)(`p`,{className:_(v.caption,`mt-2`),children:[`File name: `,(0,U.jsxs)(`span`,{className:`font-mono`,children:[p||`...`,`.md`]})]}):null]}),(0,U.jsx)(O,{title:`Description`,children:(0,U.jsx)(P,{id:`ruleDescription`,value:o,onChange:e=>s(e.target.value),placeholder:`Describe when Tarsk should apply this rule...`,className:`resize-none min-h-[120px]`,disabled:d})}),(0,U.jsx)(O,{title:`Always Apply`,description:c?`This rule will be automatically added to context for all conversations.`:`Only the rule description will be added to context, allowing the agent to read the rule file when needed.`,action:(0,U.jsx)(W,{id:`alwaysApply`,checked:c,onCheckedChange:l,disabled:d})}),(0,U.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,U.jsx)(u,{onClick:async()=>{if(!(!h||!e)){f(!0);try{let n=`---
|
|
2
2
|
description: ${o.trim()}
|
|
3
3
|
alwaysApply: ${c}
|
|
4
4
|
---
|
package/dist/public/assets/{settings-skills-view-DLyWp1pq.js → settings-skills-view-DpzKFcpf.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dr as t,Ea as n,Er as r,Gt as i,L as a,Li as o,Or as s,P as c,Ui as l,Wa as u,ci as d,ji as f,jt as p,k as m,ln as ee,mt as te,so as h,ui as g,vt as ne,wi as _,xo as v}from"./dialogs-config-DZKtVbNK.js";import{A as y,C as b,D as x,E as S,F as C,I as re,M as ie,N as ae,P as oe,S as w,T,b as E,j as se,k as ce,x as le,y as D}from"./history-view-jX3PPID6.js";import{C as O,E as k,O as A,j}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dr as t,Ea as n,Er as r,Gt as i,L as a,Li as o,Or as s,P as c,Ui as l,Wa as u,ci as d,ji as f,jt as p,k as m,ln as ee,mt as te,so as h,ui as g,vt as ne,wi as _,xo as v}from"./dialogs-config-DZKtVbNK.js";import{A as y,C as b,D as x,E as S,F as C,I as re,M as ie,N as ae,P as oe,S as w,T,b as E,j as se,k as ce,x as le,y as D}from"./history-view-jX3PPID6.js";import{C as O,E as k,O as A,j}from"./index-DjD2SPNZ.js";import{t as M}from"./skeleton-qzmFgKhS.js";import{a as N,i as P,n as F,r as I,t as L}from"./settings-list-CKPEGohm.js";import{t as R}from"./mcp-server-card-CTCrhFIS.js";var z=e(v(),1),B=f();function V({threadId:e,onSkillCreated:t}){let[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(!1),u=i.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),f=u.length>0&&u.length<=64;return e?(0,B.jsx)(x,{children:(0,B.jsxs)(D,{children:[(0,B.jsx)(w,{title:`Add Skill`,description:`Create a new agent skill. The skill will be saved as a SKILL.md file in the .agents/skills folder.`}),(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(E,{title:`Skill Name`,children:[(0,B.jsx)(r,{id:`skillName`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g. Code Review`,disabled:c}),i?(0,B.jsxs)(`p`,{className:g(_.caption,`mt-2`),children:[`Folder name: `,(0,B.jsx)(`span`,{className:`font-mono`,children:u||`...`})]}):null]}),(0,B.jsx)(E,{title:`Description`,children:(0,B.jsx)(A,{id:`skillDescription`,value:o,onChange:e=>s(e.target.value),placeholder:`Describe when Tarsk should apply this skill`,className:`resize-none min-h-[120px]`,disabled:c})}),(0,B.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,B.jsx)(d,{onClick:async()=>{if(!(!f||!o.trim()||!e)){l(!0);try{let n=await m(e,u,o.trim());k({title:`Skill created`,description:`Skill '${u}' was created successfully.`}),a(``),s(``),t?.(n.path,`SKILL.md`)}catch(e){k({title:`Error`,description:e instanceof Error?e.message:`Failed to create skill`,variant:`destructive`})}finally{l(!1)}}},disabled:!f||!o.trim()||c,children:c?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(n,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,B.jsxs)(B.Fragment,{children:[`Continue`,(0,B.jsx)(h,{className:`ml-2 h-4 w-4`})]})})})]})]})}):(0,B.jsx)(T,{title:`No thread selected`,children:`Please select a thread to add a skill.`})}function H(e){let t=[];for(let n of e){if(n.path===`.agents/skills`&&n.type===`folder`&&n.children)for(let e of n.children)e.type===`folder`&&t.push(e);n.children&&n.children.length>0&&t.push(...H(n.children))}return t}function U(){let e=j(e=>e.selectedProjectId),n=j(e=>e.selectedThreadId),{setActiveMainTab:r,setPendingExplorerPath:f,triggerExplorerRefresh:m,setExplorerClearPath:h}=O(),[g,_]=(0,z.useState)([]),[v,E]=(0,z.useState)(!1),[D,A]=(0,z.useState)(!1),[U,W]=(0,z.useState)(null),[G,K]=(0,z.useState)(!1),[q,J]=(0,z.useState)([]),[Y,X]=(0,z.useState)(new Set),[Z,ue]=(0,z.useState)(``),Q=(0,z.useCallback)(async()=>{if(e){E(!0);try{let t=H(await ne(e));if(n)try{let e=H(await p(n)),r=new Set(t.map(e=>e.path));for(let n of e)r.has(n.path)||t.push(n)}catch{}_(t),X(new Set(t.map(e=>`${e.path}/SKILL.md`)))}catch{_([]),X(new Set)}finally{E(!1)}}},[e,n]);(0,z.useEffect)(()=>{Q()},[Q]),(0,z.useEffect)(()=>{te().then(J).catch(()=>J([]))},[]);let de=(0,z.useCallback)(async t=>{if(!e)return;let r=t.name,i=t.path;K(!0);try{try{await c(e,i)}catch{if(n)await a(n,i);else throw Error(`No thread selected to delete from`)}h(i),m(),X(e=>{let t=new Set(e);return t.delete(`${i}/SKILL.md`),t}),k({title:`Skill removed`,description:r}),W(null),await Q()}catch(e){k({title:`Error`,description:e instanceof Error?e.message:`Failed to remove skill`,variant:`destructive`})}finally{K(!1)}},[e,n,Q,m,h]),fe=(0,z.useCallback)(e=>{f(`${e}/SKILL.md`),r(`explorer`)},[f,r]),pe=(0,z.useCallback)(async e=>{let t=`.agents/skills/${e.id}/SKILL.md`;if(!(!n||Y.has(t)))try{if(e.gitHubRepo&&e.gitHubFolder)await i(n,e.gitHubRepo,e.gitHubFolder,`.agents/skills/${e.id}`);else{let r=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.allowedTools&&r.push(`allowed-tools: ${e.allowedTools}`),e.license&&r.push(`license: ${e.license}`),r.push(`---`,``,e.instructions),await ee(n,t,r.join(`
|
|
2
2
|
`))}X(e=>new Set(e).add(t)),m(),Q(),k({title:`Skill installed`,description:e.name})}catch(e){k({title:`Error`,description:e instanceof Error?e.message:`Failed to install skill`,variant:`destructive`})}},[n,Y,m,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(x,{children:(0,B.jsxs)(S,{children:[(0,B.jsx)(w,{title:`Skills`,description:`Manage agent skills. Skills are reusable instruction sets that guide agent behavior.`,action:(0,B.jsx)(d,{onClick:()=>A(!0),disabled:!n,children:`Add Skill`})}),!n&&(0,B.jsx)(le,{children:`Select a thread to add or install skills.`}),(0,B.jsx)(b,{title:`Installed`}),v?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(M,{className:`h-20 w-full`}),(0,B.jsx)(M,{className:`h-20 w-full`})]}):g.length===0?(0,B.jsx)(L,{icon:o,title:`No skills installed`,description:`Add skills to extend agent capabilities with reusable instructions.`}):(0,B.jsx)(`div`,{className:`space-y-3 mb-8`,children:g.map(e=>(0,B.jsx)(F,{title:e.name,subtitle:e.path,subtitleMono:!0,actions:[{label:`View in explorer`,icon:(0,B.jsx)(u,{className:`h-4 w-4`}),onClick:()=>fe(e.path)},{label:`Delete skill`,icon:(0,B.jsx)(l,{className:`h-4 w-4`}),onClick:()=>W(e),destructive:!0}]},e.id))}),(0,B.jsx)(b,{title:`Available`,className:`mb-0`}),(0,B.jsx)(N,{placeholder:`Search available skills...`,value:Z,onChange:ue}),q.length===0?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(M,{className:`h-20 w-full`}),(0,B.jsx)(M,{className:`h-20 w-full`})]}):$.length===0?(0,B.jsx)(P,{searchQuery:Z,emptyLabel:`No available skills found.`}):(0,B.jsx)(I,{children:$.map(e=>{let t=`.agents/skills/${e.id}/SKILL.md`,n=Y.has(t);return(0,B.jsx)(R,{name:e.name,description:e.description,installed:n,onClick:()=>{n||pe(e)},showInstalledControls:!1},e.id)})})]})}),(0,B.jsx)(t,{open:D,onOpenChange:A,children:(0,B.jsx)(s,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,B.jsx)(V,{threadId:n,onSkillCreated:()=>{A(!1),Q(),m()}})})}),(0,B.jsx)(ce,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,B.jsxs)(ie,{children:[(0,B.jsxs)(C,{children:[(0,B.jsx)(re,{children:`Delete Skill`}),(0,B.jsxs)(ae,{children:[`Are you sure you want to delete the skill "`,U?.name,`"? This action cannot be undone.`]})]}),(0,B.jsxs)(oe,{children:[(0,B.jsx)(se,{children:`Cancel`}),(0,B.jsx)(y,{onClick:()=>U&&void de(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,B.jsx)(T,{children:`Select a project to manage skills.`})}export{U as SettingsSkillsView,U as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dr as t,Dt as n,E as r,Ea as i,Er as a,F as o,Gi as s,Gt as c,Or as l,Ui as u,Wa as d,ci as f,ht as p,ji as m,so as h,ui as g,wi as _,wr as v,xo as y}from"./dialogs-config-DZKtVbNK.js";import{A as b,C as x,D as S,E as C,F as ee,I as te,M as ne,N as w,P as T,S as E,T as D,b as O,j as re,k,x as A,y as j}from"./history-view-jX3PPID6.js";import{C as M,E as N,j as P}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dr as t,Dt as n,E as r,Ea as i,Er as a,F as o,Gi as s,Gt as c,Or as l,Ui as u,Wa as d,ci as f,ht as p,ji as m,so as h,ui as g,wi as _,wr as v,xo as y}from"./dialogs-config-DZKtVbNK.js";import{A as b,C as x,D as S,E as C,F as ee,I as te,M as ne,N as w,P as T,S as E,T as D,b as O,j as re,k,x as A,y as j}from"./history-view-jX3PPID6.js";import{C as M,E as N,j as P}from"./index-DjD2SPNZ.js";import{t as F}from"./skeleton-qzmFgKhS.js";import{n as I,t as L}from"./radio-group-Bd8YbtFD.js";import{a as ie,i as ae,n as oe,r as se,t as R}from"./settings-list-CKPEGohm.js";import{t as ce}from"./mcp-server-card-CTCrhFIS.js";var z=e(y(),1),B=m();function V({projectId:e,threadId:t,onCommandCreated:n}){let[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(``),[p,m]=(0,z.useState)(`default`),[y,b]=(0,z.useState)(!1),x=o.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),C=x.length>0&&x.length<=64;return e?(0,B.jsx)(S,{children:(0,B.jsxs)(j,{children:[(0,B.jsx)(E,{title:`Add Slash Command`,description:`Create a new slash command. The command will be saved as a .md file in the ~/.agents/commands folder.`}),(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(O,{title:`Command Name`,children:[(0,B.jsx)(a,{id:`commandName`,value:o,onChange:e=>s(e.target.value),placeholder:`e.g. review`,disabled:y}),o?(0,B.jsxs)(`p`,{className:g(_.caption,`mt-2`),children:[`Command: `,(0,B.jsxs)(`span`,{className:`font-mono`,children:[`/`,x||`...`]})]}):null]}),(0,B.jsx)(O,{title:`Description`,children:(0,B.jsx)(a,{id:`commandDescription`,value:c,onChange:e=>l(e.target.value),placeholder:`Brief description shown in autocomplete`,disabled:y})}),(0,B.jsx)(O,{title:`Argument Hint`,description:`Shows after the command name to guide users what to type`,children:(0,B.jsx)(a,{id:`argumentHint`,value:u,onChange:e=>d(e.target.value),placeholder:`e.g. <focus-area> or <branch-name>`,disabled:y})}),(0,B.jsx)(O,{title:`Mode`,description:p==="default"?`Standard chat mode`:`Activates plan mode when this command is used`,children:(0,B.jsxs)(L,{value:p,onValueChange:e=>m(e),className:`flex gap-4`,disabled:y,children:[(0,B.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,B.jsx)(I,{value:`default`,id:`mode-default`}),(0,B.jsx)(v,{htmlFor:`mode-default`,className:g(_.labelNormal,`cursor-pointer`),children:`Default`})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,B.jsx)(I,{value:`plan`,id:`mode-plan`}),(0,B.jsx)(v,{htmlFor:`mode-plan`,className:g(_.labelNormal,`cursor-pointer`),children:`Plan`})]})]})}),(0,B.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,B.jsx)(f,{onClick:async()=>{if(!(!C||!e)){b(!0);try{await r(x,``,{description:c.trim()||void 0,argumentHint:u.trim()||void 0,mode:p===`plan`?`plan`:void 0},`project`,t??void 0),N({title:`Command created`,description:`Command '/${x}' was created successfully.`}),s(``),l(``),d(``),m(`default`),n?.(x)}catch(e){N({title:`Error`,description:e instanceof Error?e.message:`Failed to create command`,variant:`destructive`})}finally{b(!1)}}},disabled:!C||y,children:y?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(i,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,B.jsxs)(B.Fragment,{children:[`Continue`,(0,B.jsx)(h,{className:`ml-2 h-4 w-4`})]})})})]})]})}):(0,B.jsx)(D,{title:`No project selected`,children:`Please select a project to add a slash command.`})}function H(){let e=P(e=>e.selectedProjectId),i=P(e=>e.selectedThreadId),{setActiveMainTab:a,setPendingExplorerPath:m,triggerExplorerRefresh:h,setExplorerClearPath:v}=M(),[y,O]=(0,z.useState)([]),[j,I]=(0,z.useState)(!1),[L,H]=(0,z.useState)(!1),[U,W]=(0,z.useState)(null),[G,K]=(0,z.useState)(!1),[q,J]=(0,z.useState)([]),[Y,X]=(0,z.useState)(new Map),[Z,le]=(0,z.useState)(``),Q=(0,z.useCallback)(async()=>{if(i){I(!0);try{let e=await n(i);O(e.filter(e=>!e.isBuiltIn)),X(new Map(e.map(e=>[e.name,e.filePath])))}catch{O([]),X(new Map)}finally{I(!1)}}},[i]);(0,z.useEffect)(()=>{Q()},[Q]),(0,z.useEffect)(()=>{p().then(J).catch(()=>J([]))},[]);let ue=(0,z.useCallback)(async e=>{K(!0);try{await o(e.filePath),v(e.filePath),h(),X(t=>{let n=new Map(t);return n.delete(e.name),n}),N({title:`Command removed`,description:`/${e.name}`}),W(null),await Q()}catch(e){N({title:`Error`,description:e instanceof Error?e.message:`Failed to remove command`,variant:`destructive`})}finally{K(!1)}},[Q,h,v]),de=(0,z.useCallback)(e=>{m(e),a(`explorer`)},[m,a]),fe=(0,z.useCallback)(async e=>{if(!(!i||Y.has(e.name)))try{if(e.gitHubRepo&&e.gitHubFolder){let t=`.agents/commands`;await c(i,e.gitHubRepo,e.gitHubFolder,t);let n=`${t}/${e.name}.md`;X(t=>new Map(t).set(e.name,n))}else{let t=await r(e.name,e.content,{description:e.description,argumentHint:e.argumentHint},`project`,i);X(n=>new Map(n).set(e.name,t.filePath))}h(),Q(),N({title:`Command installed`,description:`/${e.name}`})}catch(e){N({title:`Error`,description:e instanceof Error?e.message:`Failed to install command`,variant:`destructive`})}},[i,Y,h,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(S,{children:(0,B.jsxs)(C,{children:[(0,B.jsx)(E,{title:`Slash Commands`,description:`Manage slash commands. Commands are quick actions available via / in chat.`,action:(0,B.jsx)(f,{onClick:()=>H(!0),disabled:!i,children:`Add Command`})}),!i&&(0,B.jsx)(A,{children:`Select a thread to add or install slash commands.`}),(0,B.jsx)(x,{title:`Installed`}),j?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(F,{className:`h-20 w-full`}),(0,B.jsx)(F,{className:`h-20 w-full`})]}):y.length===0?(0,B.jsx)(R,{icon:s,title:`No slash commands installed`,description:`Add slash commands to create quick actions in chat.`}):(0,B.jsx)(`div`,{className:`space-y-3 mb-8`,children:y.map(e=>(0,B.jsx)(oe,{title:`/${e.name}`,subtitle:e.metadata?.description||`No description`,badge:e.metadata?.mode?(0,B.jsx)(`span`,{className:g(_.compact,`bg-muted px-1.5 py-0.5 rounded flex-shrink-0`),children:e.metadata.mode}):void 0,actions:[{label:`View in explorer`,icon:(0,B.jsx)(d,{className:`h-4 w-4`}),onClick:()=>de(e.filePath)},{label:`Delete command`,icon:(0,B.jsx)(u,{className:`h-4 w-4`}),onClick:()=>W(e),destructive:!0}]},e.filePath))}),(0,B.jsx)(x,{title:`Available`,className:`mb-0`}),(0,B.jsx)(ie,{placeholder:`Search available commands...`,value:Z,onChange:le}),q.length===0?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(F,{className:`h-20 w-full`}),(0,B.jsx)(F,{className:`h-20 w-full`})]}):$.length===0?(0,B.jsx)(ae,{searchQuery:Z,emptyLabel:`No available commands found.`}):(0,B.jsx)(se,{children:$.map(e=>{let t=Y.has(e.name);return(0,B.jsx)(ce,{name:`/${e.name}`,description:e.description,installed:t,onClick:()=>{t||fe(e)},showInstalledControls:!1},e.id)})})]})}),(0,B.jsx)(t,{open:L,onOpenChange:H,children:(0,B.jsx)(l,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,B.jsx)(V,{projectId:e,threadId:i,onCommandCreated:()=>{H(!1),Q(),h()}})})}),(0,B.jsx)(k,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,B.jsxs)(ne,{children:[(0,B.jsxs)(ee,{children:[(0,B.jsx)(te,{children:`Delete Slash Command`}),(0,B.jsxs)(w,{children:[`Are you sure you want to delete "/`,U?.name,`"? This action cannot be undone.`]})]}),(0,B.jsxs)(T,{children:[(0,B.jsx)(re,{children:`Cancel`}),(0,B.jsx)(b,{onClick:()=>U&&void ue(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,B.jsx)(D,{children:`Select a project to manage slash commands.`})}export{H as SettingsSlashCommandsView,H as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dr as t,Ea as n,Er as r,Gt as i,L as a,O as o,Or as s,P as c,Ri as l,Ui as u,Wa as d,ci as f,dt as p,ji as m,jt as h,ln as ee,so as g,ui as _,vt as v,wi as y,xo as b}from"./dialogs-config-DZKtVbNK.js";import{A as te,C as x,D as S,E as C,F as w,I as ne,M as re,N as ie,P as ae,S as T,T as E,b as D,j as O,k as oe,x as k,y as A}from"./history-view-jX3PPID6.js";import{C as se,E as j,O as M,j as N}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dr as t,Ea as n,Er as r,Gt as i,L as a,O as o,Or as s,P as c,Ri as l,Ui as u,Wa as d,ci as f,dt as p,ji as m,jt as h,ln as ee,so as g,ui as _,vt as v,wi as y,xo as b}from"./dialogs-config-DZKtVbNK.js";import{A as te,C as x,D as S,E as C,F as w,I as ne,M as re,N as ie,P as ae,S as T,T as E,b as D,j as O,k as oe,x as k,y as A}from"./history-view-jX3PPID6.js";import{C as se,E as j,O as M,j as N}from"./index-DjD2SPNZ.js";import{t as P}from"./skeleton-qzmFgKhS.js";import{a as ce,i as le,n as F,r as I,t as L}from"./settings-list-CKPEGohm.js";import{t as R}from"./mcp-server-card-CTCrhFIS.js";var z=e(b(),1),B=m();function V({threadId:e,onAgentCreated:t}){let[i,a]=(0,z.useState)(``),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(``),[d,p]=(0,z.useState)(!1),m=i.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),h=m.length>0&&m.length<=64;return e?(0,B.jsx)(S,{children:(0,B.jsxs)(A,{children:[(0,B.jsx)(T,{title:`Add Agent`,description:`Create a new subagent. The agent will be saved as an AGENT.md file in the .agents/agents folder.`}),(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(D,{title:`Agent Name`,children:[(0,B.jsx)(r,{id:`agentName`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g. Security Reviewer`,disabled:d}),i?(0,B.jsxs)(`p`,{className:_(y.caption,`mt-2`),children:[`Folder name: `,(0,B.jsx)(`span`,{className:`font-mono`,children:m||`...`})]}):null]}),(0,B.jsx)(D,{title:`Description`,children:(0,B.jsx)(M,{id:`agentDescription`,value:s,onChange:e=>c(e.target.value),placeholder:`Describe what this agent does and when it should be invoked`,className:`resize-none min-h-[120px]`,disabled:d})}),(0,B.jsx)(D,{title:`Allowed Tools`,description:`Space-separated list of tools this agent can use. Leave empty to allow all coding tools.`,children:(0,B.jsx)(r,{id:`agentTools`,value:l,onChange:e=>u(e.target.value),placeholder:`e.g. read grep glob`,disabled:d})}),(0,B.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,B.jsx)(f,{onClick:async()=>{if(!(!h||!s.trim()||!e)){p(!0);try{let n=await o(e,m,s.trim(),l.trim()||void 0);j({title:`Agent created`,description:`Agent '${m}' was created successfully.`}),a(``),c(``),u(``),t?.(n.path,`AGENT.md`)}catch(e){j({title:`Error`,description:e instanceof Error?e.message:`Failed to create agent`,variant:`destructive`})}finally{p(!1)}}},disabled:!h||!s.trim()||d,children:d?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(n,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,B.jsxs)(B.Fragment,{children:[`Continue`,(0,B.jsx)(g,{className:`ml-2 h-4 w-4`})]})})})]})]})}):(0,B.jsx)(E,{title:`No thread selected`,children:`Please select a thread to add an agent.`})}function H(e){let t=[];for(let n of e)n.path.startsWith(`.agents/agents/`)&&n.type===`folder`&&t.push(n),n.children&&n.children.length>0&&t.push(...H(n.children));return t}function U(){let e=N(e=>e.selectedProjectId),n=N(e=>e.selectedThreadId),{setActiveMainTab:r,setPendingExplorerPath:o,triggerExplorerRefresh:m,setExplorerClearPath:g}=se(),[_,y]=(0,z.useState)([]),[b,D]=(0,z.useState)(!1),[A,M]=(0,z.useState)(!1),[U,W]=(0,z.useState)(null),[G,K]=(0,z.useState)(!1),[q,J]=(0,z.useState)([]),[Y,X]=(0,z.useState)(new Set),[Z,ue]=(0,z.useState)(``),Q=(0,z.useCallback)(async()=>{if(e){D(!0);try{let t=H(await v(e));if(n)try{let e=H(await h(n)),r=new Set(t.map(e=>e.path));for(let n of e)r.has(n.path)||t.push(n)}catch{}y(t),X(new Set(t.map(e=>`${e.path}/AGENT.md`)))}catch{y([]),X(new Set)}finally{D(!1)}}},[e,n]);(0,z.useEffect)(()=>{Q()},[Q]),(0,z.useEffect)(()=>{p().then(J).catch(()=>J([]))},[]);let de=(0,z.useCallback)(async t=>{if(!e)return;let r=t.name,i=t.path;K(!0);try{try{await c(e,i)}catch{if(n)await a(n,i);else throw Error(`No thread selected to delete from`)}g(i),m(),X(e=>{let t=new Set(e);return t.delete(`${i}/AGENT.md`),t}),j({title:`Agent removed`,description:r}),W(null),await Q()}catch(e){j({title:`Error`,description:e instanceof Error?e.message:`Failed to remove agent`,variant:`destructive`})}finally{K(!1)}},[e,n,Q,m,g]),fe=(0,z.useCallback)(e=>{o(`${e}/AGENT.md`),r(`explorer`)},[o,r]),pe=(0,z.useCallback)(async e=>{let t=`.agents/agents/${e.id}/AGENT.md`;if(!(!n||Y.has(t)))try{if(e.gitHubRepo&&e.gitHubFolder)await i(n,e.gitHubRepo,e.gitHubFolder,`.agents/agents/${e.id}`);else{let r=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.tools&&r.push(`tools: ${e.tools}`),r.push(`---`,``,e.systemPrompt),await ee(n,t,r.join(`
|
|
2
2
|
`))}X(e=>new Set(e).add(t)),m(),Q(),j({title:`Agent installed`,description:e.name})}catch(e){j({title:`Error`,description:e instanceof Error?e.message:`Failed to install agent`,variant:`destructive`})}},[n,Y,m,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(S,{children:(0,B.jsxs)(C,{children:[(0,B.jsx)(T,{title:`Subagents`,description:`Manage subagents. Subagents are specialized agents for focused tasks.`,action:(0,B.jsx)(f,{onClick:()=>M(!0),disabled:!n,children:`Add Subagent`})}),!n&&(0,B.jsx)(k,{children:`Select a thread to add or install subagents.`}),(0,B.jsx)(x,{title:`Installed`}),b?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(P,{className:`h-20 w-full`}),(0,B.jsx)(P,{className:`h-20 w-full`})]}):_.length===0?(0,B.jsx)(L,{icon:l,title:`No subagents installed`,description:`Add subagents for specialized, focused tasks.`}):(0,B.jsx)(`div`,{className:`space-y-3 mb-8`,children:_.map(e=>(0,B.jsx)(F,{title:e.name,subtitle:e.path,subtitleMono:!0,actions:[{label:`View in explorer`,icon:(0,B.jsx)(d,{className:`h-4 w-4`}),onClick:()=>fe(e.path)},{label:`Delete agent`,icon:(0,B.jsx)(u,{className:`h-4 w-4`}),onClick:()=>W(e),destructive:!0}]},e.id))}),(0,B.jsx)(x,{title:`Available`,className:`mb-0`}),(0,B.jsx)(ce,{placeholder:`Search available subagents...`,value:Z,onChange:ue}),q.length===0?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(P,{className:`h-20 w-full`}),(0,B.jsx)(P,{className:`h-20 w-full`})]}):$.length===0?(0,B.jsx)(le,{searchQuery:Z,emptyLabel:`No available subagents found.`}):(0,B.jsx)(I,{children:$.map(e=>{let t=`.agents/agents/${e.id}/AGENT.md`,n=Y.has(t);return(0,B.jsx)(R,{name:e.name,description:e.description,installed:n,onClick:()=>{n||pe(e)},showInstalledControls:!1},e.id)})})]})}),(0,B.jsx)(t,{open:A,onOpenChange:M,children:(0,B.jsx)(s,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,B.jsx)(V,{threadId:n,onAgentCreated:()=>{M(!1),Q(),m()}})})}),(0,B.jsx)(oe,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,B.jsxs)(re,{children:[(0,B.jsxs)(w,{children:[(0,B.jsx)(ne,{children:`Delete Subagent`}),(0,B.jsxs)(ie,{children:[`Are you sure you want to delete the subagent "`,U?.name,`"? This action cannot be undone.`]})]}),(0,B.jsxs)(ae,{children:[(0,B.jsx)(O,{children:`Cancel`}),(0,B.jsx)(te,{onClick:()=>U&&void de(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,B.jsx)(E,{children:`Select a project to manage subagents.`})}export{U as SettingsSubagentsView,U as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ea as t,Kt as n,ci as r,ji as i,ui as a,wi as o,wn as s,wr as c,xo as l,xt as u}from"./dialogs-config-DZKtVbNK.js";import{n as d}from"./onboarding-CxtzQldG.js";import{A as f,E as p,F as m,I as h,M as g,N as _,P as v,S as y,T as b,j as x,k as S,w as C}from"./history-view-jX3PPID6.js";import{E as w,O as T,j as E}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ea as t,Kt as n,ci as r,ji as i,ui as a,wi as o,wn as s,wr as c,xo as l,xt as u}from"./dialogs-config-DZKtVbNK.js";import{n as d}from"./onboarding-CxtzQldG.js";import{A as f,E as p,F as m,I as h,M as g,N as _,P as v,S as y,T as b,j as x,k as S,w as C}from"./history-view-jX3PPID6.js";import{E as w,O as T,j as E}from"./index-DjD2SPNZ.js";var D=e(l(),1),O=i();function k(){let e=E(e=>e.selectedProjectId),[i,l]=(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),u(e).then(e=>{let t=e.useCustomSystemPrompt;l(e.generatedPrompt),P(t),I(e.customSystemPrompt),M(!t),A(t?e.customSystemPrompt:e.generatedPrompt)}).catch(()=>{l(``),A(``),M(!0),P(!1),I(``)}).finally(()=>R(!1)))},[e]);function U(){return j?N:k.trim()!==F.trim()}function W(e){A(e),j&&M(!1)}function G(){A(i),M(!0)}function K(e){if(!e){M(!1);return}if(k===i){G();return}H(!0)}function q(){G(),H(!1)}function J(){H(!1)}async function Y(){if(e){if(!j&&!k.trim()){w({title:`System prompt required`,description:`Enter a system prompt or enable Generated.`,variant:`destructive`});return}B(!0);try{await s(e,{customSystemPrompt:j?null:k.trim(),useCustomSystemPrompt:!j}),n(),P(!j),I(j?``:k.trim()),w({title:`System prompt settings saved`})}catch(e){w({title:`Error`,description:e instanceof Error?e.message:`Failed to save system prompt settings`,variant:`destructive`})}finally{B(!1)}}}return e?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(C,{children:(0,O.jsxs)(p,{className:`w-full flex-1 flex flex-col min-h-0`,children:[(0,O.jsx)(y,{title:`System Prompt`,description:`View the default system prompt or override it for this project. Instructions, rules, and other context are added separately at runtime.`,action:(0,O.jsx)(r,{onClick:Y,disabled:L||z||!U(),children:z?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(t,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`})}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,O.jsx)(d,{id:`use-generated-prompt`,checked:j,onCheckedChange:e=>K(e===!0),disabled:L||z}),(0,O.jsx)(c,{htmlFor:`use-generated-prompt`,className:a(o.labelNormal,`cursor-pointer`),children:`Generated`})]}),L?(0,O.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,O.jsx)(t,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,O.jsx)(T,{value:k,onChange:e=>W(e.target.value),className:a(o.mono,`flex-1 min-h-0 resize-none`),placeholder:`System prompt will appear here...`,disabled:z})]})}),(0,O.jsx)(S,{open:V,onOpenChange:H,children:(0,O.jsxs)(g,{children:[(0,O.jsxs)(m,{children:[(0,O.jsx)(h,{children:`Overwrite custom system prompt?`}),(0,O.jsx)(_,{children:`This will replace your custom system prompt with the generated default. You can save the change after confirming.`})]}),(0,O.jsxs)(v,{children:[(0,O.jsx)(x,{onClick:J,children:`No`}),(0,O.jsx)(f,{onClick:q,children:`Yes`})]})]})})]}):(0,O.jsx)(b,{children:`Select a project to edit the system prompt.`})}export{k as SettingsSystemPromptView,k as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/settings-general-view-C8muiP_K.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-DjD2SPNZ.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-jX3PPID6.js","assets/dialogs-config-DZKtVbNK.js","assets/onboarding-CxtzQldG.js","assets/whisper-wasm-EGutPGND.js","assets/react-vendor-Ba8DSNiO.js","assets/utils-BlXPFbY9.js","assets/index-jIBJk8xl.css","assets/project-settings-view-ZJjQbFbQ.js","assets/radio-group-Bd8YbtFD.js","assets/providers-list-view-BH13AB_H.js","assets/skeleton-qzmFgKhS.js","assets/settings-models-view-CAMouMhE.js","assets/settings-models-skeleton-l966LEN8.js","assets/settings-list-CKPEGohm.js","assets/settings-mcp-servers-view-3gN9ly3z.js","assets/mcp-server-card-CTCrhFIS.js","assets/settings-skills-view-DpzKFcpf.js","assets/settings-rules-view-BnazfbJb.js","assets/settings-slash-commands-view-Drje2Dl4.js","assets/settings-subagents-view-D05kHO1W.js","assets/settings-instructions-view-CV7lRPuw.js","assets/settings-system-prompt-view-DQmSdSnp.js","assets/account-view-BT90zNSx.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$i as t,Ba as n,Ci as r,Gi as i,Kt as a,Li as o,Qa as s,Ri as c,St as l,Xi as u,ci as d,do as f,en as p,ha as m,ia as h,ja as g,ji as _,po as v,ta as y,ui as b,wi as ee,xo as x,yo as te,zi as S}from"./dialogs-config-DZKtVbNK.js";import{ct as ne,lt as re,st as ie}from"./react-vendor-Ba8DSNiO.js";import{r as C}from"./monaco-CZnIWXyV.js";import{c as w,o as T}from"./onboarding-CxtzQldG.js";import{D as E,E as D,T as O}from"./history-view-jX3PPID6.js";import{A as k,T as A,i as ae,j,k as M,n as N,p as P,r as F}from"./index-DjD2SPNZ.js";import{t as I}from"./settings-models-skeleton-l966LEN8.js";var L=te(),R=e(x(),1),z=_(),oe=(0,R.forwardRef)(function(e,t){let n=(0,L.c)(28),{sidebar:r,children:i,defaultSidebarSize:a,minSidebarSize:o,maxSidebarSize:s,minContentSize:c,collapsible:l,collapsedSize:u,className:d,onCollapse:f,onExpand:p,isMobile:m,mobileShowSidebar:h}=e,g=a===void 0?25:a,_=o===void 0?20:o,v=s===void 0?30:s,y=c===void 0?40:c,ee=l===void 0?!1:l,x=u===void 0?0:u,te=d===void 0?``:d,S=m===void 0?!1:m,ne=h===void 0?!0:h,re=S&&!ne,ie=S&&ne,C=`h-full ${te}`,w=S?100:g,T=S?50:_,E=S?100:v,D=re&&`hidden`,O;n[0]===D?O=n[1]:(O=b(`border-r border-transparent`,D),n[0]=D,n[1]=O);let k;n[2]!==x||n[3]!==ee||n[4]!==f||n[5]!==p||n[6]!==t||n[7]!==r||n[8]!==w||n[9]!==T||n[10]!==E||n[11]!==O?(k=(0,z.jsx)(F,{ref:t,defaultSize:w,minSize:T,maxSize:E,collapsible:ee,collapsedSize:x,onCollapse:f,onExpand:p,className:O,children:r}),n[2]=x,n[3]=ee,n[4]=f,n[5]=p,n[6]=t,n[7]=r,n[8]=w,n[9]=T,n[10]=E,n[11]=O,n[12]=k):k=n[12];let A;n[13]===S?A=n[14]:(A=!S&&(0,z.jsx)(N,{withHandle:!0,className:`ml-[-40px]`}),n[13]=S,n[14]=A);let j=ie&&`hidden`,M;n[15]===j?M=n[16]:(M=b(`overflow-hidden`,j),n[15]=j,n[16]=M);let P;n[17]!==i||n[18]!==y||n[19]!==M?(P=(0,z.jsx)(F,{minSize:y,className:M,children:i}),n[17]=i,n[18]=y,n[19]=M,n[20]=P):P=n[20];let I;n[21]!==k||n[22]!==A||n[23]!==P?(I=(0,z.jsxs)(ae,{direction:`horizontal`,className:`h-full`,children:[k,A,P]}),n[21]=k,n[22]=A,n[23]=P,n[24]=I):I=n[24];let R;return n[25]!==C||n[26]!==I?(R=(0,z.jsx)(`div`,{className:C,children:I}),n[25]=C,n[26]=I,n[27]=R):R=n[27],R}),se=[{id:`providers`,label:`Providers`,icon:(0,z.jsx)(s,{className:`h-4 w-4`}),route:`/settings/providers`},{id:`models`,label:`Models`,icon:(0,z.jsx)(f,{className:`h-4 w-4`}),route:`/settings/models`},{id:`skills`,label:`Skills`,icon:(0,z.jsx)(o,{className:`h-4 w-4`}),route:`/settings/skills`},{id:`rules`,label:`Rules`,icon:(0,z.jsx)(h,{className:`h-4 w-4`}),route:`/settings/rules`},{id:`slash-commands`,label:`Slash Commands`,icon:(0,z.jsx)(i,{className:`h-4 w-4`}),route:`/settings/slash-commands`},{id:`subagents`,label:`Subagents`,icon:(0,z.jsx)(c,{className:`h-4 w-4`}),route:`/settings/subagents`},{id:`instructions`,label:`Instructions`,icon:(0,z.jsx)(v,{className:`h-4 w-4`}),route:`/settings/instructions`},{id:`system-prompt`,label:`System Prompt`,icon:(0,z.jsx)(u,{className:`h-4 w-4`}),route:`/settings/system-prompt`},{id:`mcp-servers`,label:`MCP Servers`,icon:(0,z.jsx)(y,{className:`h-4 w-4`}),route:`/settings/mcp-servers`},{id:`general`,label:`General`,icon:(0,z.jsx)(t,{className:`h-4 w-4`}),route:`/settings/general`},{id:`history`,label:`History`,icon:(0,z.jsx)(g,{className:`h-4 w-4`}),route:`/settings/history`},{id:`account`,label:`Account`,icon:(0,z.jsx)(S,{className:`h-4 w-4`}),route:`/settings/account`}];function B(e){let t=[...se];if(!e)return t;let r=t.findIndex(e=>e.id===`skills`);return t.splice(r,0,{id:`project`,label:`Project`,icon:(0,z.jsx)(n,{className:`h-4 w-4`}),route:`/settings/project/${e}`}),t}function ce(e){let t=(0,L.c)(13),{className:n,selectedProjectId:r,onResetOnboarding:i,onNavItemSelect:a}=e,o=ne(),s=ie(),c=(0,R.useRef)(0),l=(0,R.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,R.useEffect)(u,d);let f,p;if(t[2]!==n||t[3]!==s.pathname||t[4]!==o||t[5]!==a||t[6]!==i||t[7]!==r){let e=B(r),u=function(){let t=s.pathname;if(t.startsWith(`/settings/project/`))return`project`;for(let n of e)if(t.startsWith(n.route))return n.id;return`general`}(),d=function(e){e.id===`general`&&i&&(l.current&&clearTimeout(l.current),c.current+=1,c.current>=3?(c.current=0,i()):l.current=setTimeout(()=>{c.current=0},1500)),a?.(),o(e.route)};f=`space-y-1${n?` ${n}`:``}`,p=e.map((t,n)=>(0,z.jsxs)(R.Fragment,{children:[(0,z.jsx)(w,{selected:u===t.id,asChild:!0,children:(0,z.jsx)(`button`,{className:`justify-start`,onClick:()=>d(t),children:(0,z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[t.icon,(0,z.jsx)(`span`,{children:t.label})]})})}),(t.id===`models`||t.id===`mcp-servers`||n===e.length-1)&&(0,z.jsx)(T,{className:`my-2 bg-sidebar-border`})]},t.id)),t[2]=n,t[3]=s.pathname,t[4]=o,t[5]=a,t[6]=i,t[7]=r,t[8]=f,t[9]=p}else f=t[8],p=t[9];let m;return t[10]!==f||t[11]!==p?(m=(0,z.jsx)(`div`,{className:f,children:p}),t[10]=f,t[11]=p,t[12]=m):m=t[12],m}var le=(0,R.lazy)(()=>C(()=>import(`./settings-general-view-C8muiP_K.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),ue=(0,R.lazy)(()=>C(()=>import(`./project-settings-view-ZJjQbFbQ.js`),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11,13]))),de=(0,R.lazy)(()=>C(()=>import(`./providers-list-view-BH13AB_H.js`),__vite__mapDeps([14,1,2,3,4,5,6,7,8,9,10,11,15]))),fe=(0,R.lazy)(()=>C(()=>import(`./settings-models-view-CAMouMhE.js`),__vite__mapDeps([16,1,2,3,4,5,6,7,8,9,10,11,17,15,18]))),pe=(0,R.lazy)(()=>C(()=>import(`./settings-mcp-servers-view-3gN9ly3z.js`),__vite__mapDeps([19,1,2,3,4,5,6,7,8,9,10,11,20,18,15]))),me=(0,R.lazy)(()=>C(()=>import(`./settings-skills-view-DpzKFcpf.js`),__vite__mapDeps([21,1,2,3,4,5,6,7,8,9,10,11,20,18,15]))),he=(0,R.lazy)(()=>C(()=>import(`./settings-rules-view-BnazfbJb.js`),__vite__mapDeps([22,1,2,3,4,5,6,7,8,9,10,11,20,18,15]))),ge=(0,R.lazy)(()=>C(()=>import(`./settings-slash-commands-view-Drje2Dl4.js`),__vite__mapDeps([23,1,2,3,4,5,6,7,8,9,10,11,20,13,18,15]))),_e=(0,R.lazy)(()=>C(()=>import(`./settings-subagents-view-D05kHO1W.js`),__vite__mapDeps([24,1,2,3,4,5,6,7,8,9,10,11,20,18,15]))),ve=(0,R.lazy)(()=>C(()=>import(`./settings-instructions-view-CV7lRPuw.js`),__vite__mapDeps([25,1,2,3,4,5,6,7,8,9,10,11]))),ye=(0,R.lazy)(()=>C(()=>import(`./settings-system-prompt-view-DQmSdSnp.js`),__vite__mapDeps([26,1,2,3,4,5,6,7,8,9,10,11]))),be=(0,R.lazy)(()=>C(()=>import(`./account-view-BT90zNSx.js`),__vite__mapDeps([27,1,2,3,4,5,6,7,8,9,10,11,15]))),xe=(0,R.lazy)(()=>C(()=>import(`./history-view-jX3PPID6.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 V(e){let t=(0,L.c)(2),{title:n}=e,r;return t[0]===n?r=t[1]:(r=(0,z.jsx)(O,{title:n,children:`Content coming soon...`}),t[0]=n,t[1]=r),r}function Ce(){let e=(0,L.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsxs)(`div`,{className:`mb-6`,children:[(0,z.jsx)(`div`,{className:`h-8 w-32 bg-muted rounded animate-pulse mb-2`}),(0,z.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,z.jsx)(`div`,{className:`mb-6`,children:(0,z.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,z.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,z.jsxs)(`div`,{children:[r,(0,z.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,z.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,z.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`})]})]}),a=(0,z.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,z.jsx)(E,{children:(0,z.jsxs)(D,{children:[t,n,(0,z.jsxs)(`div`,{className:`space-y-8`,children:[i,(0,z.jsxs)(`div`,{children:[a,(0,z.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,z.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,z.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,z.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,z.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 Ee(){let e=(0,L.c)(61),{tab:t,projectId:n}=re(),i=ne(),o=ie(),s=k(),c=j(ke),u=j(Oe),f;e[0]!==o.pathname||e[1]!==n?(f=!!n&&o.pathname.startsWith(`/settings/project/`),e[0]=o.pathname,e[1]=n,e[2]=f):f=e[2];let h=f,g;e[3]===o.pathname?g=e[4]:(g=Te(o.pathname),e[3]=o.pathname,e[4]=g);let _=g!==null,v;if(e[5]!==o.pathname||e[6]!==o.search||e[7]!==t){let n=new URLSearchParams(o.search).get(`tab`);v=n&&Se.includes(n)?n:t&&Se.includes(t)?t:we(o.pathname),e[5]=o.pathname,e[6]=o.search,e[7]=t,e[8]=v}else v=e[8];let y=v,x=P(),[te,S]=(0,R.useState)(!1),[C,w]=(0,R.useState)(!0),[T,E]=(0,R.useState)(0),D=(0,R.useRef)(null),O;bb0:{if(h){O=`Project`;break bb0}let t;e[9]===y?t=e[10]:(t=se.find(e=>e.id===y)?.label??`Settings`,e[9]=y,e[10]=t),O=t}let ae=O,N;e[11]===x?N=e[12]:(N=()=>{x&&w(!1)},e[11]=x,e[12]=N);let F=N,B;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>{w(!0)},e[13]=B):B=e[13];let Ee=B,H;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(H=async()=>{try{await p(),E(De)}catch(e){console.error(`Failed to reset onboarding:`,e)}},e[14]=H):H=e[14];let Ae=H,U;e[15]===i?U=e[16]:(U=()=>{i(`/`)},e[15]=i,e[16]=U);let je=U,W;e[17]===c?W=e[18]:(W=c?{type:`project`,id:c}:void 0,e[17]=c,e[18]=W);let Me=W,G;e[19]===i?G=e[20]:(G=()=>{i(`/settings/general`)},e[19]=i,e[20]=G);let Ne=G,K;e[21]!==s||e[22]!==n?(K=async()=>{a(n);try{let e=await l();s({type:M.SetProjects,projects:e.projects})}catch(e){let t=e;throw console.error(`Failed to refresh projects after settings update:`,t),t}},e[21]=s,e[22]=n,e[23]=K):K=e[23];let Pe=K,q,J;e[24]!==o.pathname||e[25]!==i?(q=()=>{(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)))&&i(`/settings/general`,{replace:!0})},J=[o.pathname,i],e[24]=o.pathname,e[25]=i,e[26]=q,e[27]=J):(q=e[26],J=e[27]),(0,R.useEffect)(q,J);let Y;e[28]!==je||e[29]!==F||e[30]!==c?(Y=()=>(0,z.jsx)(A,{onTitleClose:je,subtitle:`Settings`,children:(0,z.jsx)(`div`,{className:`px-2 py-2`,children:(0,z.jsx)(ce,{selectedProjectId:c,onResetOnboarding:Ae,onNavItemSelect:F})})}),e[28]=je,e[29]=F,e[30]=c,e[31]=Y):Y=e[31];let Fe=Y,Ie;e[32]!==y||e[33]!==Ne||e[34]!==Pe||e[35]!==Me||e[36]!==h||e[37]!==T||e[38]!==n||e[39]!==u?(Ie=()=>{if(h&&n)return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`Project Settings`}),children:(0,z.jsx)(ue,{projectId:n,onProjectUpdated:Pe})});switch(y){case`general`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`General`}),children:(0,z.jsx)(le,{onboardingResetSignal:T})});case`providers`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(Ce,{}),children:(0,z.jsx)(de,{})});case`models`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(I,{}),children:(0,z.jsx)(fe,{})});case`skills`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`Skills`}),children:(0,z.jsx)(me,{})});case`rules`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`Rules`}),children:(0,z.jsx)(he,{})});case`slash-commands`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`Slash Commands`}),children:(0,z.jsx)(ge,{})});case`subagents`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`Subagents`}),children:(0,z.jsx)(_e,{})});case`instructions`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`Instructions`}),children:(0,z.jsx)(ve,{})});case`system-prompt`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`System Prompt`}),children:(0,z.jsx)(ye,{})});case`mcp-servers`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`MCP Servers`}),children:(0,z.jsx)(pe,{})});case`history`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`History`}),children:(0,z.jsx)(xe,{isOpen:!0,onClose:Ne,initialFilter:Me,projects:u,inline:!0})});case`account`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`Account`}),children:(0,z.jsx)(be,{})});default:return(0,z.jsx)(V,{title:`Settings`})}},e[32]=y,e[33]=Ne,e[34]=Pe,e[35]=Me,e[36]=h,e[37]=T,e[38]=n,e[39]=u,e[40]=Ie):Ie=e[40];let Le=Ie,Re,ze;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Re=()=>S(!0),ze=()=>S(!1),e[41]=Re,e[42]=ze):(Re=e[41],ze=e[42]);let X;e[43]===Fe?X=e[44]:(X=Fe(),e[43]=Fe,e[44]=X);let Be=`flex-1 overflow-auto ${te&&!x?`ml-[40px]`:``}`,Z;e[45]!==ae||e[46]!==x||e[47]!==_||e[48]!==C?(Z=x&&!C&&!_?(0,z.jsx)(`div`,{className:b(r.settingsPage,`pb-0`),children:(0,z.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-center gap-2`,children:[(0,z.jsxs)(d,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground`,onClick:Ee,children:[(0,z.jsx)(m,{className:`h-4 w-4`}),(0,z.jsx)(`span`,{className:`sr-only`,children:`Show settings menu`})]}),(0,z.jsx)(`span`,{className:b(ee.sectionTitle,`truncate text-foreground`),children:ae})]})}):null,e[45]=ae,e[46]=x,e[47]=_,e[48]=C,e[49]=Z):Z=e[49];let Q;e[50]===Le?Q=e[51]:(Q=Le(),e[50]=Le,e[51]=Q);let $;e[52]!==Be||e[53]!==Z||e[54]!==Q?($=(0,z.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,z.jsxs)(`div`,{className:Be,children:[Z,Q]})}),e[52]=Be,e[53]=Z,e[54]=Q,e[55]=$):$=e[55];let Ve;return e[56]!==x||e[57]!==C||e[58]!==X||e[59]!==$?(Ve=(0,z.jsx)(oe,{ref:D,collapsible:!0,isMobile:x,mobileShowSidebar:C,onCollapse:Re,onExpand:ze,sidebar:X,children:$}),e[56]=x,e[57]=C,e[58]=X,e[59]=$,e[60]=Ve):Ve=e[60],Ve}function De(e){return e+1}function Oe(e){return e.projects}function ke(e){return e.selectedProjectId}export{Ee as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$a as t,ji as n,nn as r,so as i,xo as a}from"./dialogs-config-DZKtVbNK.js";import{C as o,M as s,S as c,j as l,k as u}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$a as t,ji as n,nn as r,so as i,xo as a}from"./dialogs-config-DZKtVbNK.js";import{C as o,M as s,S as c,j as l,k as u}from"./index-DjD2SPNZ.js";var d=e(a(),1),f=n();function p(){let e=l(e=>e.selectedProjectId),n=l(e=>e.selectedThreadId),a=l(e=>e.projects),{terminalState:p,dispatch:m}=s(n),{queuedCommand:h,queuedRelativeFolder:g,outputLines:_,history:v,historyIndex:y,cwd:b,isRunning:x}=p,[S,C]=(0,d.useState)(``),[w,T]=(0,d.useState)([]),E=a.flatMap(e=>e.threads).find(e=>e.threadId===n)?.path??null,D=!b||b===`.`||b===`./`?E:b,O=!D||D===E,{activeMainTab:k}=o(),A=(0,d.useRef)(null),j=(0,d.useRef)(null),M=(0,d.useRef)(0);(0,d.useEffect)(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[w]),(0,d.useEffect)(()=>{T(_),M.current=_.length},[n,_]),(0,d.useEffect)(()=>{if(_.length===0)T([]),M.current=0;else if(_.length>M.current){let e=_.slice(M.current);T(t=>[...t,...e]),M.current=_.length}},[_]),(0,d.useEffect)(()=>{x||j.current?.focus()},[x]),(0,d.useEffect)(()=>{k===`terminal`&&j.current?.focus()},[k]);let N=(0,d.useCallback)(async(t,i)=>{if(!(!e||!n||!t.trim())){m({type:u.AppendTerminalLine,line:{type:`input`,content:t}}),m({type:u.SetTerminalHistory,history:[t,...v.filter(e=>e!==t)].slice(0,50)}),m({type:u.SetTerminalHistoryIndex,index:-1}),C(``),m({type:u.SetTerminalRunning,isRunning:!0});try{let a=await r(e,n,t,i??void 0);if(!a){m({type:u.AppendTerminalLine,line:{type:`system`,content:`Command started but no output stream received.`}}),m({type:u.SetTerminalRunning,isRunning:!1});return}let o=a.getReader(),s=new TextDecoder,l=``;for(;;){let{done:e,value:t}=await o.read();if(e)break;l+=s.decode(t,{stream:!0});let n=l.split(`
|
|
2
2
|
`);l=n.pop()??``;for(let e of n)if(e.trim())try{let t=JSON.parse(e);typeof t==`string`?m({type:u.AppendTerminalLine,line:{type:`output`,content:c(t)}}):t.type===`error`?m({type:u.AppendTerminalLine,line:{type:`error`,content:c(t.message)}}):t.type===`cwd`&&m({type:u.SetTerminalCwd,cwd:t.path})}catch{m({type:u.AppendTerminalLine,line:{type:`output`,content:c(e)}})}}if(l.trim())try{let e=JSON.parse(l);typeof e==`string`?m({type:u.AppendTerminalLine,line:{type:`output`,content:c(e)}}):e.type===`error`?m({type:u.AppendTerminalLine,line:{type:`error`,content:c(e.message)}}):e.type===`cwd`&&m({type:u.SetTerminalCwd,cwd:e.path})}catch{m({type:u.AppendTerminalLine,line:{type:`output`,content:c(l)}})}}catch(e){m({type:u.AppendTerminalLine,line:{type:`error`,content:e instanceof Error?e.message:`Failed to run command`}})}finally{m({type:u.SetTerminalRunning,isRunning:!1})}}},[e,n,m,v]);return(0,d.useEffect)(()=>{h&&!x&&(N(h,g??void 0),m({type:u.ClearQueuedTerminalCommand}))},[h,g,x,m,N]),(0,f.jsxs)(`div`,{className:`flex flex-col h-full bg-neutral-950 text-neutral-200 font-mono text-sm overflow-hidden`,children:[(0,f.jsxs)(`div`,{ref:A,className:`flex-1 overflow-y-auto p-4 space-y-0.5 terminal-scrollbar`,onClick:e=>{e.target===e.currentTarget&&j.current?.focus()},children:[w.length===0&&!x&&(0,f.jsx)(`div`,{className:`text-neutral-600 italic text-xs`,children:`Enter your commands below...`}),w.map((e,t)=>(0,f.jsxs)(`div`,{className:`whitespace-pre-wrap break-all leading-6 ${e.type===`input`?`flex items-start gap-2 text-neutral-200`:e.type===`error`?`text-red-400`:e.type===`system`?`text-blue-400`:``}`,children:[e.type===`input`&&(0,f.jsx)(i,{className:`h-4 w-4 mt-1 shrink-0 text-blue-400/70`}),(0,f.jsx)(`span`,{children:e.content})]},t))]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 border-t border-white/5 bg-white/5`,children:[!O&&(0,f.jsx)(`span`,{className:`text-blue-400 text-xs font-bold whitespace-nowrap`,children:D.split(`/`).pop()}),(0,f.jsx)(i,{className:`h-4 w-4 text-blue-400 ${O?``:`-ml-1`}`}),(0,f.jsx)(`input`,{ref:j,type:`text`,className:`flex-1 bg-transparent border-none outline-none text-neutral-200 placeholder:text-neutral-700 h-6`,placeholder:x?`Running...`:`Type a command...`,value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{if(e.key===`Enter`)N(S);else if(e.key===`ArrowUp`){e.preventDefault();let t=y+1;t<v.length&&(m({type:u.SetTerminalHistoryIndex,index:t}),C(v[t]))}else if(e.key===`ArrowDown`){e.preventDefault();let t=y-1;t>=0?(m({type:u.SetTerminalHistoryIndex,index:t}),C(v[t])):(m({type:u.SetTerminalHistoryIndex,index:-1}),C(``))}},disabled:x}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1 px-1.5 py-0.5 rounded border border-white/10 bg-white/5`,children:[(0,f.jsx)(t,{className:`h-3 w-3 text-neutral-600`}),(0,f.jsx)(`span`,{className:`text-[10px] text-neutral-600 uppercase font-bold`,children:`Enter`})]})]})]})}export{p as TerminalPanel};
|
package/dist/public/index.html
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
<meta name="apple-mobile-web-app-title" content="Tarsk" />
|
|
23
23
|
|
|
24
24
|
<title>Tarsk</title>
|
|
25
|
-
<script type="module" crossorigin src="/assets/index-
|
|
25
|
+
<script type="module" crossorigin src="/assets/index-DjD2SPNZ.js"></script>
|
|
26
26
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
|
|
27
27
|
<link rel="modulepreload" crossorigin href="/assets/monaco-CZnIWXyV.js">
|
|
28
28
|
<link rel="modulepreload" crossorigin href="/assets/dialogs-config-DZKtVbNK.js">
|