tarsk 0.5.64 → 0.5.65
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/{browser-tab-D-Lv93tm.js → browser-tab-hcbTzpVn.js} +1 -1
- package/dist/public/assets/{commit-dialog-CoiwuVLU.js → commit-dialog-DK-NP7EN.js} +1 -1
- package/dist/public/assets/{conversation-history-view-C1Wu4_VR.js → conversation-history-view-YGPt-fC9.js} +1 -1
- package/dist/public/assets/{create-project-dialog-DfvqFmmy.js → create-project-dialog-DW4oGrl2.js} +1 -1
- package/dist/public/assets/{create-repo-dialog-wIb4blPC.js → create-repo-dialog-BFBOFZ2W.js} +1 -1
- package/dist/public/assets/{diff-view-P5m6sKUJ.js → diff-view-Cy5PjlG_.js} +1 -1
- package/dist/public/assets/{explorer-tab-view-B6z1DZzq.js → explorer-tab-view-D6t9Ce05.js} +2 -2
- package/dist/public/assets/{explorer-tree-BK2uuzSQ.js → explorer-tree-BCs2U0De.js} +1 -1
- package/dist/public/assets/{explorer-view-D5F0ifAy.js → explorer-view-CxN4GRyn.js} +1 -1
- package/dist/public/assets/{git-ops-button-sVka4_mz.js → git-ops-button-DO1ng45p.js} +2 -2
- package/dist/public/assets/{index-zVJV2Bjj.js → index-B7qJtiRL.js} +8 -8
- package/dist/public/assets/{index-zilB0ZSo.css → index-GYexJ6QO.css} +1 -1
- package/dist/public/assets/{project-settings-view-Dte7mVE6.js → project-settings-view-DKkLgg3C.js} +1 -1
- package/dist/public/assets/{project-tools-view-BOszAFSe.js → project-tools-view-C44y08lY.js} +1 -1
- package/dist/public/assets/{providers-list-view-B1qojjPs.js → providers-list-view-BEXiqKg8.js} +1 -1
- package/dist/public/assets/pull-request-dialog-BOl1VloY.js +1 -0
- package/dist/public/assets/{settings-general-view-DCRKEVJG.js → settings-general-view-LnCQ2zkv.js} +1 -1
- package/dist/public/assets/{settings-instructions-view-C3WTfmcU.js → settings-instructions-view-B7lADJZh.js} +1 -1
- package/dist/public/assets/{settings-mcp-servers-view-B9H8QqOa.js → settings-mcp-servers-view-CN7JO2UD.js} +1 -1
- package/dist/public/assets/{settings-models-view-D0QpnAvv.js → settings-models-view-CswWfeDN.js} +1 -1
- package/dist/public/assets/{settings-rules-view-CbjVigsB.js → settings-rules-view-__5f33ot.js} +1 -1
- package/dist/public/assets/{settings-skills-view-BGztTaqQ.js → settings-skills-view-Dvfrl9kz.js} +1 -1
- package/dist/public/assets/{settings-slash-commands-view-DHsB_RxG.js → settings-slash-commands-view-B1pO-Yie.js} +1 -1
- package/dist/public/assets/{settings-storage-view-CAFIGn34.js → settings-storage-view-CHpGieRu.js} +1 -1
- package/dist/public/assets/{settings-subagents-view-5V5RzBgw.js → settings-subagents-view-CFggo62r.js} +1 -1
- package/dist/public/assets/{settings-system-prompt-view-BiGYDmSw.js → settings-system-prompt-view-BWD6RrX8.js} +1 -1
- package/dist/public/assets/{settings-view-CAvpL6Tc.js → settings-view-ZgVxZhur.js} +2 -2
- package/dist/public/assets/{tasks-view-C6z5quOD.js → tasks-view-4yyCDYbV.js} +1 -1
- package/dist/public/assets/{use-installed-ai-files-CQzyZpa8.js → use-installed-ai-files-CZIOFhcX.js} +1 -1
- package/dist/public/assets/{web-CzV4mQzJ.js → web-CxBqU2BU.js} +1 -1
- package/dist/public/assets/{web-g0yy51Pa.js → web-D8z4Nni0.js} +1 -1
- package/dist/public/assets/{web-B_HK2K2n.js → web-DTwF_7w-.js} +1 -1
- package/dist/public/assets/{web-C8pB6Hir.js → web-Q-tJsXNN.js} +1 -1
- package/dist/public/index.html +2 -2
- package/package.json +1 -1
- package/dist/public/assets/pull-request-dialog-D_KiLAdI.js +0 -1
package/dist/public/assets/{project-settings-view-Dte7mVE6.js → project-settings-view-DKkLgg3C.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,Fr as n,Mt as r,Ti as i,ei as a,i as o,mt as s}from"./interactive-WtOIgeV4.js";import{Wt as c}from"./react-vendor-wGLyNWf9.js";import{Ci as l,Di as u,Ei as d,b as ee,bi as te,dt as ne,it as re,lt as ie,mt as f,or as ae,rt as oe,st as se,tt as p,ut as ce,wi as le,wo as m,x as h,xa as g}from"./onboarding-dbhmRuxw.js";import{t as _}from"./use-toast-BFQ85Ly5.js";import{K as v,c as ue,i as de,rt as fe}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,Fr as n,Mt as r,Ti as i,ei as a,i as o,mt as s}from"./interactive-WtOIgeV4.js";import{Wt as c}from"./react-vendor-wGLyNWf9.js";import{Ci as l,Di as u,Ei as d,b as ee,bi as te,dt as ne,it as re,lt as ie,mt as f,or as ae,rt as oe,st as se,tt as p,ut as ce,wi as le,wo as m,x as h,xa as g}from"./onboarding-dbhmRuxw.js";import{t as _}from"./use-toast-BFQ85Ly5.js";import{K as v,c as ue,i as de,rt as fe}from"./index-B7qJtiRL.js";import{i as pe}from"./commit-method-fields-DG3NtLE2.js";import{a as me,n as he,r as ge,t as _e}from"./context-menu-M5y1Qb8G.js";import{t as ve}from"./use-settings-page-loading-BC_wP7pl.js";var y=e(i(),1),b=t();function ye(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>t(r),r.onerror=()=>n(Error(`The selected file is not a readable image.`)),r.src=e})}function x({projectId:e,onProjectUpdated:t}){let i=c(),x=de(),[S,C]=(0,y.useState)(``),[w,T]=(0,y.useState)(``),[E,D]=(0,y.useState)(``),[O,k]=(0,y.useState)(a.PullRequest),[A,j]=(0,y.useState)(``),[M,N]=(0,y.useState)(!1),[P,F]=(0,y.useState)(!1),[I,L]=(0,y.useState)(!0),[be,R]=(0,y.useState)(``),[xe,z]=(0,y.useState)(``),[Se,B]=(0,y.useState)(``),[Ce,V]=(0,y.useState)(``),[we,H]=(0,y.useState)(a.PullRequest),[U,W]=(0,y.useState)(!0),[G,K]=(0,y.useState)([]),[Te,q]=(0,y.useState)(!0),[Ee,De]=(0,y.useState)([]),[J,Oe]=(0,y.useState)(!0),[ke,Ae]=(0,y.useState)(!0),[Y,X]=(0,y.useState)(null),[je,Me]=(0,y.useState)(null),[Ne,Pe]=(0,y.useState)(null),Z=(0,y.useRef)(null),Q=(0,y.useCallback)(async()=>{if(!e){L(!1);return}L(!0);try{let t=await ae(e),n=t.name??``,r=t.setupScript??``,i=t.validationScript??``,o=t.runCommand??``,s=t.commitMethod??a.PullRequest,c=t.allowAllCommands!==!1,l=t.allowedCommandPatterns??[],u=t.useBuiltInBrowser!==!1,d=t.projectIcon??null;Pe(t.projectPath??null),C(n),T(r),j(i),D(o),k(s),W(c),K(l),Oe(u),X(d),R(n),z(r),B(i),V(o),H(s),q(c),De(l),Ae(u),Me(d)}catch(e){_({title:`Error`,description:e instanceof Error?e.message:`Failed to load project settings`,variant:`destructive`})}finally{L(!1)}},[e]);(0,y.useLayoutEffect)(()=>{e&&L(!0)},[e]),(0,y.useEffect)(()=>{Q()},[Q]);let Fe=ve(e,[I]);function Ie(e){k(e)}async function $(e){try{let t=await ye(e),n=document.createElement(`canvas`);n.width=256,n.height=256;let r=n.getContext(`2d`);if(!r)throw Error(`Could not prepare image conversion`);r.imageSmoothingEnabled=!0,r.imageSmoothingQuality=`high`;let i=Math.max(256/t.naturalWidth,256/t.naturalHeight),a=t.naturalWidth*i,o=t.naturalHeight*i;r.drawImage(t,(256-a)/2,(256-o)/2,a,o),X(n.toDataURL(`image/png`))}catch(e){_({title:`Could not use image`,description:e instanceof Error?e.message:`The selected file could not be read.`,variant:`destructive`})}}async function Le(e){let t=e.target.files?.[0];if(e.target.value=``,!t)return;let n=URL.createObjectURL(t);try{await $(n)}finally{URL.revokeObjectURL(n)}}return(0,y.useEffect)(()=>{if(!g())return;function e(e){let t=e.detail.dataUrl;$(t)}return window.addEventListener(`tarsk:project-icon-selected`,e),()=>{window.removeEventListener(`tarsk:project-icon-selected`,e)}}),e?(0,b.jsxs)(se,{loading:Fe,children:[(0,b.jsxs)(f,{className:`shrink-0`,children:[(0,b.jsx)(oe,{title:`Project Settings`,description:`Configure settings for your project.`,action:(0,b.jsx)(m,{onClick:async()=>{if(e){N(!0);try{S!==be&&await le(e,S),w!==xe&&await d(e,w.trim()||null,!1),A!==Se&&await l(e,{validationScript:A.trim()||null}),E!==Ce&&await u(e,E.trim()||null),O!==we&&await l(e,{commitMethod:O}),(U!==Te||JSON.stringify(G)!==JSON.stringify(Ee))&&await l(e,{allowAllCommands:U,allowedCommandPatterns:G}),J!==ke&&await l(e,{useBuiltInBrowser:J}),Y!==je&&await l(e,{projectIcon:Y}),R(S),z(w),B(A),V(E),H(O),q(U),De(G),Ae(J),Me(Y),t&&await t(),await Q(),i(`/`)}catch(e){_({title:`Error`,description:e instanceof Error?e.message:`Failed to save settings`,variant:`destructive`})}finally{N(!1)}}},disabled:M||I,children:M?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(s,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`}),sticky:!1}),(0,b.jsx)(ne,{className:`max-w-none pt-6`,children:(0,b.jsxs)(ie,{children:[(0,b.jsx)(p,{title:`Project Name`,children:(0,b.jsx)(h,{id:`projectName`,value:S,onChange:e=>C(e.target.value),placeholder:`Enter project name`,disabled:I})}),(0,b.jsx)(p,{title:`Setup Script`,description:`This script runs automatically after cloning the repo for new threads.`,children:(0,b.jsx)(v,{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,b.jsx)(p,{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,b.jsx)(v,{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,b.jsx)(p,{title:`Run Command`,description:`The command to start the dev server. Leave empty to disable run functionality.`,children:(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsx)(h,{id:`runCommand`,value:E,onChange:e=>D(e.target.value),placeholder:`e.g. npm run dev`,className:`font-mono pr-28`,disabled:I}),(0,b.jsx)(m,{variant:`ghost`,size:`sm`,className:`absolute right-1 top-1 h-8`,onClick:async()=>{if(e){F(!0);try{let t=await te(e);t.runCommand?(D(t.runCommand),_({title:`Success`,description:`Suggested: ${t.runCommand}`})):_({title:`No command found`,description:`Could not detect a dev script in package.json`})}catch(e){_({title:`Error`,description:e instanceof Error?e.message:`Failed to suggest command`,variant:`destructive`})}finally{F(!1)}}},disabled:P||I,children:P?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(s,{className:`h-3 w-3 animate-spin`}),`Suggesting...`]}):`Suggest`})]})}),(0,b.jsx)(p,{title:`Commit Method`,description:O===a.PullRequest?`Feature branches are created and pull requests can be created.`:`Commits are made directly to the main branch without feature branches.`,controlLayout:`row-end`,action:(0,b.jsx)(pe,{commitMethod:O,onCommitMethodChange:Ie,disabled:I})}),(0,b.jsx)(p,{title:`Confirm Commands`,description:`When enabled, the agent asks for approval before running bash commands, skill scripts, and browser shell calls.`,controlLayout:`row-end`,action:(0,b.jsx)(fe,{value:!U,onChange:e=>W(!e),disabled:I,ariaLabel:`Confirm Commands`}),children:!U&&G.length>0&&(0,b.jsxs)(`div`,{className:`space-y-2 mt-3`,children:[(0,b.jsx)(ee,{children:`Allowed command patterns`}),(0,b.jsx)(`ul`,{className:`space-y-1`,children:G.map(e=>(0,b.jsxs)(`li`,{className:`flex items-center justify-between rounded-md border border-border px-3 py-2`,children:[(0,b.jsx)(`code`,{className:o(n.mono,n.bodyMuted),children:e}),(0,b.jsx)(m,{type:`button`,variant:`ghost`,size:`sm`,disabled:I||M,onClick:()=>K(t=>t.filter(t=>t!==e)),children:`Remove`})]},e))})]})}),(0,b.jsx)(p,{title:`Built-in Browser`,description:`When enabled, Tarsk shows the Browser tab and opens detected dev URLs in the app. When disabled, the tab is hidden and URLs open in your system browser.`,controlLayout:`row-end`,action:(0,b.jsx)(fe,{value:J,onChange:Oe,disabled:I||M,ariaLabel:`Built-in Browser`})}),(0,b.jsx)(p,{title:`Project Icon`,description:`Choose an image to use for this project on the Projects page. It will be center-cropped to a 256×256 PNG.`,controlLayout:`row-end`,action:(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`input`,{ref:Z,type:`file`,accept:`image/*`,className:`sr-only`,onChange:Le,disabled:I||M}),(0,b.jsxs)(_e,{children:[(0,b.jsx)(me,{asChild:!0,children:(0,b.jsx)(`button`,{type:`button`,className:`flex h-8 w-8 items-center justify-center overflow-hidden rounded-md border border-border bg-muted/40 outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>{g()&&Ne?ue(Ne):Z.current?.click()},disabled:I||M,"aria-label":Y?`Change project icon`:`Choose project icon`,children:Y?(0,b.jsx)(`img`,{src:Y,alt:``,className:`h-full w-full object-cover`}):(0,b.jsx)(r,{className:`h-4 w-4 text-muted-foreground`,strokeWidth:1.5})})}),Y&&(0,b.jsx)(he,{children:(0,b.jsx)(ge,{disabled:I||M,onSelect:()=>X(null),children:`Remove`})})]})]})})]})})]}),(0,b.jsxs)(f,{className:`shrink-0 rounded-none border-t border-table-border pt-6 mt-8`,children:[(0,b.jsx)(re,{title:`Delete Project`}),(0,b.jsxs)(`div`,{className:`flex flex-col items-start gap-4`,children:[(0,b.jsx)(`div`,{className:`min-w-0`,children:(0,b.jsx)(`p`,{className:o(n.bodyMuted),children:`Permanently removes the project, its threads, and all associated storage. This action cannot be undone.`})}),(0,b.jsx)(m,{type:`button`,variant:`destructive`,disabled:I||M,onClick:()=>{e&&x({id:e,name:S})},children:`Delete Project`})]})]})]},e):(0,b.jsx)(ce,{title:`No project selected`,children:`Please select a project from the sidebar to view its settings.`})}export{x as default};
|
package/dist/public/assets/{project-tools-view-BOszAFSe.js → project-tools-view-C44y08lY.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,Fr as n,Ti as r,Tr as i,i as a,mt as o,wi as s}from"./interactive-WtOIgeV4.js";import{Wt as c}from"./react-vendor-wGLyNWf9.js";import{Ci as l,dt as u,mt as d,or as f,rt as p,st as m,tt as h,ut as g,wo as _}from"./onboarding-dbhmRuxw.js";import{t as v}from"./use-toast-BFQ85Ly5.js";import{rt as y}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,Fr as n,Ti as r,Tr as i,i as a,mt as o,wi as s}from"./interactive-WtOIgeV4.js";import{Wt as c}from"./react-vendor-wGLyNWf9.js";import{Ci as l,dt as u,mt as d,or as f,rt as p,st as m,tt as h,ut as g,wo as _}from"./onboarding-dbhmRuxw.js";import{t as v}from"./use-toast-BFQ85Ly5.js";import{rt as y}from"./index-B7qJtiRL.js";import{t as b}from"./use-settings-page-loading-BC_wP7pl.js";var x=e(r(),1),S=s(),C=t(),w=i(),T=Math.ceil(w.length/2),E=[w.slice(0,T),w.slice(T)];function D(e){let t=(0,S.c)(14),{tool:r,enabled:i,disabled:o,onToggle:s}=e,c;t[0]!==s||t[1]!==r.name?(c=e=>s(r.name,e),t[0]=s,t[1]=r.name,t[2]=c):c=t[2];let l;t[3]!==o||t[4]!==i||t[5]!==c||t[6]!==r.displayName?(l=(0,C.jsx)(y,{value:i,onChange:c,disabled:o,ariaLabel:r.displayName}),t[3]=o,t[4]=i,t[5]=c,t[6]=r.displayName,t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=a(n.body,`truncate`),t[8]=u):u=t[8];let d;t[9]===r.displayName?d=t[10]:(d=(0,C.jsx)(`span`,{className:u,children:r.displayName}),t[9]=r.displayName,t[10]=d);let f;return t[11]!==l||t[12]!==d?(f=(0,C.jsxs)(`div`,{className:`grid min-h-10 grid-cols-[auto_minmax(0,1fr)] items-center gap-3 px-3 py-2`,children:[l,d]}),t[11]=l,t[12]=d,t[13]=f):f=t[13],f}function O(e){let t=(0,S.c)(13),{tools:n,disabledTools:r,disabled:i,forceEnabledTools:a,onToggle:o}=e,s;if(t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==o||t[4]!==n){let e;t[6]!==i||t[7]!==r||t[8]!==a||t[9]!==o?(e=e=>(0,C.jsx)(D,{tool:e,enabled:!r.includes(e.name),disabled:i||a.has(e.name),onToggle:o},e.name),t[6]=i,t[7]=r,t[8]=a,t[9]=o,t[10]=e):e=t[10],s=n.map(e),t[0]=i,t[1]=r,t[2]=a,t[3]=o,t[4]=n,t[5]=s}else s=t[5];let c;return t[11]===s?c=t[12]:(c=(0,C.jsx)(`div`,{className:`divide-y divide-table-border`,children:s}),t[11]=s,t[12]=c),c}function k(e){let t=(0,S.c)(23),{disabledTools:n,onChange:r,disabled:i,forceEnabledTools:a}=e,o=i===void 0?!1:i,s;t[0]===a?s=t[1]:(s=new Set((a??[]).map(A)),t[0]=a,t[1]=s);let c=s,l;t[2]!==n||t[3]!==c||t[4]!==r?(l=function(e,t){let i=e.toLowerCase();if(!(c.has(i)&&!t)){if(t){r(n.filter(e=>e!==i));return}n.includes(i)||r([...n,i].sort())}},t[2]=n,t[3]=c,t[4]=r,t[5]=l):l=t[5];let u=l,d;t[6]!==o||t[7]!==n||t[8]!==c||t[9]!==u?(d=w.map(e=>(0,C.jsx)(D,{tool:e,enabled:!n.includes(e.name),disabled:o||c.has(e.name),onToggle:u},e.name)),t[6]=o,t[7]=n,t[8]=c,t[9]=u,t[10]=d):d=t[10];let f;t[11]===d?f=t[12]:(f=(0,C.jsx)(`div`,{className:`divide-y divide-table-border @md/settings-page:hidden`,children:d}),t[11]=d,t[12]=f);let p;t[13]!==o||t[14]!==n||t[15]!==c||t[16]!==u?(p=E.map((e,t)=>(0,C.jsx)(O,{tools:e,disabledTools:n,disabled:o,forceEnabledTools:c,onToggle:u},t)),t[13]=o,t[14]=n,t[15]=c,t[16]=u,t[17]=p):p=t[17];let m;t[18]===p?m=t[19]:(m=(0,C.jsx)(`div`,{className:`hidden @md/settings-page:grid @md/settings-page:grid-cols-2 divide-x divide-table-border`,children:p}),t[18]=p,t[19]=m);let h;return t[20]!==f||t[21]!==m?(h=(0,C.jsxs)(C.Fragment,{children:[f,m]}),t[20]=f,t[21]=m,t[22]=h):h=t[22],h}function A(e){return e.toLowerCase()}function j({projectId:e,onProjectUpdated:t}){let n=c(),[r,i]=(0,x.useState)([]),[a,s]=(0,x.useState)([]),[S,w]=(0,x.useState)(!1),[T,E]=(0,x.useState)(!1),[D,O]=(0,x.useState)(!0),[A,j]=(0,x.useState)(!1),M=(0,x.useCallback)(async()=>{if(!e){O(!1);return}O(!0);try{let t=await f(e),n=t.disabledTools??[],r=t.smartJsEnabled===!0;i(n),s(n),w(r),E(r)}catch(e){v({title:`Error`,description:e instanceof Error?e.message:`Failed to load tools settings`,variant:`destructive`})}finally{O(!1)}},[e]);(0,x.useLayoutEffect)(()=>{e&&O(!0)},[e]),(0,x.useEffect)(()=>{M()},[M]);let N=b(e,[D]);function P(){return JSON.stringify([...r].sort())!==JSON.stringify([...a].sort())}function F(){return P()||S!==T}async function I(){if(!(!e||!F())){j(!0);try{let i={};P()&&(i.disabledTools=r.length>0?r:null),S!==T&&(i.smartJsEnabled=S),await l(e,i),s(r),E(S),t&&await t(),await M(),n(`/`)}catch(e){v({title:`Error`,description:e instanceof Error?e.message:`Failed to save tools settings`,variant:`destructive`})}finally{j(!1)}}}function L(e){w(e),e&&i(e=>e.filter(e=>e!==`run_js`))}return e?(0,C.jsx)(m,{loading:N,children:(0,C.jsxs)(d,{className:`shrink-0`,children:[(0,C.jsx)(p,{title:`Tools`,description:`Control which tools the agent can use in this project. Disabled tools are hidden from the agent.`,action:(0,C.jsx)(_,{onClick:()=>void I(),disabled:A||D,children:A?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(o,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`}),sticky:!1}),(0,C.jsxs)(u,{className:`max-w-none pt-6`,children:[(0,C.jsx)(h,{title:`Smart JS`,description:`When enabled, the agent orchestrates tools by writing JavaScript for Run JS (except Ask, Write, and Subagent). Other tools stay available through callTool inside the worker.`,controlLayout:`row-end`,action:(0,C.jsx)(y,{value:S,onChange:L,disabled:D||A,ariaLabel:`Smart JS`})}),(0,C.jsx)(`div`,{className:`mt-8`,children:(0,C.jsx)(k,{disabledTools:r,onChange:i,disabled:D||A,forceEnabledTools:S?[`run_js`]:void 0})})]})]})}):(0,C.jsx)(g,{title:`No project selected`,children:`Please select a project from the sidebar to configure tools.`})}export{j as default};
|
package/dist/public/assets/{providers-list-view-B1qojjPs.js → providers-list-view-BEXiqKg8.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,Fr as n,G as r,Jn as i,Pr as a,Ti as o,Xt as s,Zt as c,a as l,br as u,f as d,i as f,mt as p,pn as m,wi as h,yt as g,z as _}from"./interactive-WtOIgeV4.js";import{Gt as v,Wt as y}from"./react-vendor-wGLyNWf9.js";import{An as b,Ct as x,Dn as S,Eo as C,Nn as ee,On as w,Pn as T,St as E,Tt as te,Un as ne,Wr as re,bt as D,c as O,ct as k,d as A,dt as ie,hr as j,i as M,kn as ae,l as oe,lt as se,mt as N,n as ce,ni as P,nt as le,pr as ue,ri as de,rt as F,s as I,u as L,ut as fe,w as pe,wo as R,wt as z,x as B}from"./onboarding-dbhmRuxw.js";import{n as me,q as he}from"./store-CSyJjyNs.js";import{n as V,t as H}from"./use-suspense-resource-rX-GqyWi.js";import{D as U,E as ge,O as W,T as _e}from"./index-zVJV2Bjj.js";import{t as G}from"./async-error-boundary-B0tQed36.js";import{o as K}from"./settings-list-C5MACtux.js";import{t as q}from"./use-deferred-search-DXrcdbyC.js";import{n as J,r as Y,t as X}from"./model-list-controls-oiBE9X9_.js";var Z=h(),Q=e(o(),1),$=t(),ve=C(f(n.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 ye(e){let t=(0,Z.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=f(ve({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,$.jsx)(`div`,{className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}var be=i(`app.use-provider-details.hook`);function xe(e,t,n){return n?e.find(e=>e.slug===n)??null:t?e.find(e=>e.name===t)??null:null}function Se({selectedProviderName:e=null,selectedProviderSlug:t=null,providerData:n}){let r=me(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)([]),[_,v]=(0,Q.useState)(new Set),[y,x]=(0,Q.useState)(new Set),[C,E]=(0,Q.useState)(new Map),{query:te,setQuery:ne,deferredQuery:D}=q(),[O,k]=(0,Q.useState)(`alphabetical`),[A,ie]=(0,Q.useState)(`all`),[se,N]=(0,Q.useState)(!1),[le,F]=(0,Q.useState)(``),[I,L]=(0,Q.useState)(``),[fe,R]=(0,Q.useState)(``),[z,B]=(0,Q.useState)(`coding`),[V,H]=(0,Q.useState)([]),[U,ge]=(0,Q.useState)(new Set),[W,_e]=(0,Q.useState)(new Set),[G,K]=(0,Q.useState)(new Map),[J,Y]=(0,Q.useState)({}),X=e=>pe(e.id);(0,Q.useEffect)(()=>{(async()=>{if(m(``),n&&(t&&n.slug===t||e&&n.name===e)){a(n),R(n.apiKey??``),s(n.apiKey??``),Y(n.envValues??{}),ye(n.slug),Z(n.slug);return}try{let n=xe(await j(),e,t);a(n),R(n?.apiKey??``),s(n?.apiKey??``),Y(n?.envValues??{}),n&&(ye(n.slug),Z(n.slug))}catch(e){m(e instanceof Error?e.message:`Failed to load providers`)}})()},[e,t,n]);let Z=async e=>{f(null);try{let t=await ue(e);t.status===`success`&&f(t.balance)}catch(t){be.error(`Failed to load balance for ${e}:`,t)}};function $(){g([]),H([]),v(new Set),x(new Set),ge(new Set),_e(new Set),E(new Map),K(new Map)}function ve(e){return e instanceof Error?e.message:`Failed to load models from local API`}let ye=async e=>{l(!0),L(``),ne(``),k(`alphabetical`),ie(`all`),B(`coding`);try{let[t,n]=await Promise.all([T(e),ee(e)]);g(t.models),H(n.models);let r=new Set(t.enabledModelIds);v(r),x(r);let i=new Set(n.enabledModelIds);ge(i),_e(i),E(new Map),K(new Map)}catch(t){be.error(`Failed to load models for ${e}:`,t),$(),L(ve(t))}finally{l(!1)}};async function Se(e){l(!0),L(``);try{await re(e),await ye(e)}catch(t){be.error(`Failed to refresh models for ${e}:`,t),$(),L(ve(t)),l(!1)}}let Ce=(e,t)=>{i?.name===e&&(s(t),Te(t))},we=(e,t)=>{Y(n=>({...n,[e]:t})),i&&(async()=>{try{await P({[e]:t}),r({type:he.ConfigUpdated}),F(`${oe(e)} saved successfully`),setTimeout(()=>F(``),3e3)}catch(e){F(e instanceof Error?e.message:`Failed to save provider settings`);return}u(i.slug)&&e===`LOCAL_API_URL`&&t.trim()&&await Se(i.slug)})()},Te=async e=>{if(!(!i||e===fe))try{await de(i.slug,e),r({type:he.ConfigUpdated}),R(e),F(`API key saved successfully`),setTimeout(()=>F(``),3e3)}catch(e){F(e instanceof Error?e.message:`Failed to save API key`)}},Ee=(e,t)=>{t===`image`?K(t=>{let n=new Map(t),r=U.has(e),i=n.has(e),a=n.get(e),o=!(i?a:r);return o===r?n.delete(e):n.set(e,o),De(e,(n.has(e)?n.get(e):r)??!1,`image`),n}):E(t=>{let n=M(t,e,_);return De(e,(n.has(e)?n.get(e):_.has(e))??!1,`coding`),n})},De=async(e,t,n=`coding`)=>{if(i)try{n===`image`?(t?(await ae(i.slug,e),ge(t=>new Set([...t,e]))):(await S(i.slug,e),ge(t=>{let n=new Set(t);return n.delete(e),n})),K(t=>{let n=new Map(t);return n.delete(e),n})):(t?(await b(i.slug,e),v(t=>new Set([...t,e]))):(await w(i.slug,e),v(t=>{let n=new Set(t);return n.delete(e),n})),E(t=>{let n=new Map(t);return n.delete(e),n})),r({type:he.ConfigUpdated}),F(`Model preferences saved successfully`),setTimeout(()=>F(``),3e3)}catch(e){F(e instanceof Error?e.message:`Failed to save model changes`)}};async function Oe(e,t=`coding`){let n=t===`image`?V:h,r=t===`image`?U:_;(t===`image`?K:E)(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 De(i.id,e,t)}let ke=o!==void 0&&o.trim().length>0;return{selectedProvider:i,error:p,balance:d,displayApiKey:o,showApiKey:se,setShowApiKey:N,providerEnvValues:J,modelsLoading:c,modelsError:I,saveStatus:le,modelTab:z,setModelTab:B,modelSearchQuery:te,setModelSearchQuery:ne,modelSortBy:O,setModelSortBy:k,modelFilter:A,setModelFilter:ie,availableModels:h,enabledModelIds:_,pendingChanges:C,filteredAndSortedModels:(0,Q.useMemo)(()=>ce({models:h,query:D,sortBy:O,getDisplayName:X,freeOnly:A===`free`,groupByProvider:!0,getPriority:e=>+!y.has(e.id)}),[h,D,A,y,O,X]),availableImageModels:V,enabledImageModelIds:U,pendingImageChanges:G,filteredAndSortedImageModels:(0,Q.useMemo)(()=>ce({models:V,query:D,sortBy:O===`coding-index`||O===`intelligence-by-price`?`alphabetical`:O,getDisplayName:X,freeOnly:A===`free`,groupByProvider:!0,getPriority:e=>+!W.has(e.id)}),[V,D,A,W,O,X]),hasApiKey:ke,getModelDisplayName:X,handleUpdateKeyLocal:Ce,handleUpdateProviderEnv:we,refreshLocalProviderModels:Se,handleToggleModel:Ee,handleToggleAllModels:Oe}}function Ce(e){let t=(0,Z.c)(7),{provider:r,onBack:i}=e;if(!i&&!r.url)return null;let a;t[0]===r.url?a=t[1]:(a=r.url?(0,$.jsx)(O,{url:r.url,className:f(n.compact,`p-3`)}):null,t[0]=r.url,t[1]=a);let o;t[2]===i?o=t[3]:(o=i?(0,$.jsxs)(R,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:i,children:[(0,$.jsx)(d,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Close provider details`})]}):null,t[2]=i,t[3]=o);let s;return t[4]!==a||t[5]!==o?(s=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6],s}function we(e){let t=(0,Z.c)(6),{balance:r}=e;if(r===null)return null;let i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=f(n.compact,`inline-flex shrink-0 items-center gap-1.5 font-medium`),a=(0,$.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-green-500`}),t[0]=i,t[1]=a):(i=t[0],a=t[1]);let o;t[2]===r?o=t[3]:(o=l(r),t[2]=r,t[3]=o);let s;return t[4]===o?s=t[5]:(s=(0,$.jsxs)(`span`,{className:i,children:[a,`$`,o,` balance`]}),t[4]=o,t[5]=s),s}function Te(e){let t=(0,Z.c)(8),{title:r,tooltip:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=f(n.label,`cursor-help`),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,$.jsx)(te,{asChild:!0,children:(0,$.jsx)(`span`,{className:a,children:r})}),t[1]=r,t[2]=o);let s;t[3]===i?s=t[4]:(s=(0,$.jsx)(x,{children:i}),t[3]=i,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,$.jsx)(z,{children:(0,$.jsxs)(E,{children:[o,s]})}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function Ee(e){let t=(0,Z.c)(10),{provider:n,displayApiKey:i,showApiKey:a,onToggleShowApiKey:o,onUpdateKey:l,providerEnvValues:d,onUpdateEnv:f,modelsLoading:m,onRefreshModels:h}=e,_;return t[0]!==i||t[1]!==m||t[2]!==h||t[3]!==o||t[4]!==f||t[5]!==l||t[6]!==n||t[7]!==d||t[8]!==a?(_=(0,$.jsx)($.Fragment,{children:n.authType===`APIKey`?(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(se,{children:[(0,$.jsx)(k,{label:(0,$.jsx)(Te,{title:`API Key`,tooltip:`Your API key is stored locally and never shared.`}),control:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(g,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(B,{type:a?`text`:`password`,placeholder:n.keyName||`Enter API Key`,className:`pl-10 pr-10`,value:i,onChange:e=>{l(n.name,e.target.value)}}),(0,$.jsx)(R,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:o,disabled:!i,children:a?(0,$.jsx)(c,{className:`h-4 w-4 text-muted-foreground`}):(0,$.jsx)(s,{className:`h-4 w-4 text-muted-foreground`})})]})}),L(n).map(e=>(0,$.jsx)(k,{label:(0,$.jsx)(Te,{title:oe(e),tooltip:e}),control:u(n.slug)&&e===`LOCAL_API_URL`?(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(B,{id:e,value:d[e]??``,onChange:t=>f(e,t.target.value),placeholder:n.api,className:`pr-10`,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`}),(0,$.jsx)(z,{children:(0,$.jsxs)(E,{children:[(0,$.jsx)(te,{asChild:!0,children:(0,$.jsx)(R,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:()=>{h(n.slug)},disabled:m,children:m?(0,$.jsx)(p,{className:`h-4 w-4 animate-spin text-muted-foreground`}):(0,$.jsx)(r,{className:`h-4 w-4 text-muted-foreground`})})}),(0,$.jsx)(x,{children:`Refresh models`})]})})]}):(0,$.jsx)(B,{id:e,value:d[e]??``,onChange:t=>f(e,t.target.value),placeholder:e,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`})},e))]})}):(0,$.jsxs)(`div`,{className:`space-y-2 text-center`,children:[(0,$.jsx)(le,{className:`mb-0`,children:`This provider uses OAuth for authentication.`}),(0,$.jsxs)(R,{variant:`outline`,size:`sm`,disabled:!0,children:[`Sign in with `,n.name]})]})}),t[0]=i,t[1]=m,t[2]=h,t[3]=o,t[4]=f,t[5]=l,t[6]=n,t[7]=d,t[8]=a,t[9]=_):_=t[9],_}function De(e){let t=(0,Z.c)(22),{tab:r,model:i,displayName:a,willBeEnabled:o,hasApiKey:s,showStarRating:c,onToggle:u}=e,d=i.pricing,p=r===`image`?`image-${i.id}`:i.id,m=i.id,h=!s&&`opacity-25`,g;t[0]===h?g=t[1]:(g=f(`flex cursor-default items-center space-x-3 p-3 transition-colors hover:bg-muted/30`,h),t[0]=h,t[1]=g);let _=!s,v=o??!1,y;t[2]!==i.id||t[3]!==u?(y=()=>u(i.id),t[2]=i.id,t[3]=u,t[4]=y):y=t[4];let b;t[5]!==p||t[6]!==_||t[7]!==v||t[8]!==y?(b=(0,$.jsx)(I,{id:p,disabled:_,checked:v,onCheckedChange:y,className:`mt-0`}),t[5]=p,t[6]=_,t[7]=v,t[8]=y,t[9]=b):b=t[9];let x;t[10]!==p||t[11]!==a||t[12]!==i.coding_index||t[13]!==d||t[14]!==c||t[15]!==r?(x=r===`coding`?(0,$.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,$.jsx)(`label`,{htmlFor:p,className:f(n.body,`leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:a})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[c&&(0,$.jsx)(Y,{codingIndex:i.coding_index,modelName:a}),d&&(0,$.jsx)(`span`,{className:f(n.caption,`whitespace-nowrap`),children:(d.prompt??0)===0&&(d.completion??0)===0?``:`$${l(d.prompt??0)} in | $${l(d.completion??0)} out`})]})]}):(0,$.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,$.jsx)(`label`,{htmlFor:p,className:f(n.label,`leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:a})}),d&&(0,$.jsx)(`span`,{className:f(n.caption,`whitespace-nowrap flex-shrink-0`),children:(d.prompt??0)===0&&(d.completion??0)===0?``:`$${l(d.prompt??0)} in | $${l(d.completion??0)} out`})]}),t[10]=p,t[11]=a,t[12]=i.coding_index,t[13]=d,t[14]=c,t[15]=r,t[16]=x):x=t[16];let S;return t[17]!==i.id||t[18]!==g||t[19]!==b||t[20]!==x?(S=(0,$.jsxs)(`div`,{className:g,children:[b,x]},m),t[17]=i.id,t[18]=g,t[19]=b,t[20]=x,t[21]=S):S=t[21],S}function Oe(e){let t=(0,Z.c)(13),{tab:r,models:i,filteredModels:o,modelsLoading:s,modelsError:c,hasApiKey:l,enabledModelIds:u,pendingChanges:d,modelSortBy:m,getModelDisplayName:h,onToggleModel:g}=e,_=r===`coding`,v=_?c?`No models loaded.`:`No models available for this provider.`:`No image models available for this provider.`,y;return t[0]!==v||t[1]!==u||t[2]!==o||t[3]!==h||t[4]!==l||t[5]!==_||t[6]!==m||t[7]!==i||t[8]!==s||t[9]!==g||t[10]!==d||t[11]!==r?(y=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:s?(0,$.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,$.jsx)(p,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):i.length===0?(0,$.jsx)(`div`,{className:`text-center py-8`,children:(0,$.jsx)(`p`,{className:n.bodyMuted,children:v})}):(0,$.jsx)(z,{children:(0,$.jsx)(`div`,{className:f(`grid grid-cols-1 gap-0`,a.tableWrapper),children:o.length===0?(0,$.jsx)(`div`,{className:`text-center py-8`,children:(0,$.jsx)(`p`,{className:n.bodyMuted,children:`No models matching your filters.`})}):o.map(e=>{let t=u.has(e.id),n=d.has(e.id),i=d.get(e.id),a=(n?i:t)??!1;return(0,$.jsx)(De,{tab:r,model:e,displayName:h(e),willBeEnabled:a,hasApiKey:l,showStarRating:_&&(m===`coding-index`||m===`intelligence-by-price`),onToggle:e=>g(e,r)},e.id)})})})}),t[0]=v,t[1]=u,t[2]=o,t[3]=h,t[4]=l,t[5]=_,t[6]=m,t[7]=i,t[8]=s,t[9]=g,t[10]=d,t[11]=r,t[12]=y):y=t[12],y}function ke(e){let t=(0,Z.c)(22),{tab:n,showImageTab:r,modelsLoading:i,models:a,hasApiKey:o,enabledModelIds:s,pendingChanges:c,modelSearchQuery:l,onModelSearchQueryChange:u,modelSortBy:d,onModelSortByChange:p,onToggleAllModels:m}=e,h=n===`coding`,g=h?`select-all-models`:`select-all-image-models`,v=!i&&a.length>0,y=v&&!o&&`opacity-25`,b;t[0]===y?b=t[1]:(b=f(`flex flex-col gap-2 md:flex-row md:items-center`,y),t[0]=y,t[1]=b);let x;t[2]===r?x=t[3]:(x=r?(0,$.jsxs)(U,{className:`w-fit shrink-0 self-start`,children:[(0,$.jsx)(W,{value:`coding`,children:`Coding`}),(0,$.jsx)(W,{value:`image`,children:`Image`})]}):null,t[2]=r,t[3]=x);let S;t[4]!==s||t[5]!==o||t[6]!==h||t[7]!==l||t[8]!==d||t[9]!==a||t[10]!==u||t[11]!==p||t[12]!==m||t[13]!==c||t[14]!==g||t[15]!==v||t[16]!==n?(S=v?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`relative w-full md:w-52 flex-shrink-0`,children:[(0,$.jsx)(_,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,$.jsx)(B,{placeholder:`Search`,className:`pl-10 h-8`,value:l,onChange:e=>u(e.target.value),disabled:!o})]}),(0,$.jsxs)(`div`,{className:`flex flex-shrink-0 items-center gap-2 self-end md:ml-auto md:self-auto`,children:[(0,$.jsx)(X,{id:g,disabled:!o,checked:a.every(e=>{let t=c.has(e.id),n=c.get(e.id);return t?n:s.has(e.id)}),onChange:e=>{m(e,n)}}),(0,$.jsx)(J,{sortBy:d,showCodingIndex:h,showIntelligenceByPrice:h,onSortByChange:p})]})]}):null,t[4]=s,t[5]=o,t[6]=h,t[7]=l,t[8]=d,t[9]=a,t[10]=u,t[11]=p,t[12]=m,t[13]=c,t[14]=g,t[15]=v,t[16]=n,t[17]=S):S=t[17];let C;return t[18]!==b||t[19]!==x||t[20]!==S?(C=(0,$.jsxs)(`div`,{className:b,children:[x,S]}),t[18]=b,t[19]=x,t[20]=S,t[21]=C):C=t[21],C}function Ae(e){let t=(0,Z.c)(10),{title:n,description:r,action:i,tableHeader:a,children:o}=e,s;t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==n?(s=(0,$.jsx)(F,{title:n,description:r,action:i,sticky:!1,tableHeader:a}),t[0]=i,t[1]=r,t[2]=a,t[3]=n,t[4]=s):s=t[4];let c;t[5]===o?c=t[6]:(c=(0,$.jsx)(`div`,{className:`px-6 pb-6`,children:o}),t[5]=o,t[6]=c);let l;return t[7]!==s||t[8]!==c?(l=(0,$.jsxs)(N,{className:`shrink-0`,children:[s,c]}),t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function je(e){let t=(0,Z.c)(111),{selectedProviderName:n,selectedProviderSlug:r,providerData:i,onBack:a,className:o}=e,s=n===void 0?null:n,c=r===void 0?null:r,l;t[0]!==i||t[1]!==s||t[2]!==c?(l={selectedProviderName:s,selectedProviderSlug:c,providerData:i},t[0]=i,t[1]=s,t[2]=c,t[3]=l):l=t[3];let{selectedProvider:u,error:d,balance:p,displayApiKey:h,showApiKey:g,setShowApiKey:_,providerEnvValues:v,modelsLoading:y,modelsError:b,saveStatus:x,modelTab:S,setModelTab:C,modelSearchQuery:ee,setModelSearchQuery:w,modelSortBy:T,setModelSortBy:E,availableModels:te,enabledModelIds:ne,pendingChanges:re,filteredAndSortedModels:D,availableImageModels:O,enabledImageModelIds:k,pendingImageChanges:A,filteredAndSortedImageModels:ie,hasApiKey:j,getModelDisplayName:M,handleUpdateKeyLocal:ae,handleUpdateProviderEnv:oe,refreshLocalProviderModels:se,handleToggleModel:N,handleToggleAllModels:ce}=Se(l);if(d){let e;t[4]===o?e=t[5]:(e=f(`flex h-full min-h-0 flex-col items-center justify-center gap-4 p-6`,o),t[4]=o,t[5]=e);let n;t[6]===d?n=t[7]:(n=(0,$.jsx)(le,{variant:`error`,className:`mb-0`,children:d}),t[6]=d,t[7]=n);let r;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(R,{variant:`outline`,size:`sm`,onClick:Me,children:`Retry`}),t[8]=r):r=t[8];let i;return t[9]!==e||t[10]!==n?(i=(0,$.jsxs)(`div`,{className:e,children:[n,r]}),t[9]=e,t[10]=n,t[11]=i):i=t[11],i}if(!u){let e;t[12]===o?e=t[13]:(e=f(`flex h-full min-h-0 items-center justify-center`,o),t[12]=o,t[13]=e);let n=s||c?`Provider not found`:`Select a Provider`,r;t[14]===a?r=t[15]:(r=a?(0,$.jsxs)(R,{variant:`outline`,size:`sm`,onClick:a,children:[(0,$.jsx)(m,{className:`h-4 w-4 mr-1`}),`Back to Providers`]}):void 0,t[14]=a,t[15]=r);let i=a?`This provider could not be found.`:`Choose a provider from the list to configure its settings.`,l;t[16]!==n||t[17]!==r||t[18]!==i?(l=(0,$.jsx)(fe,{title:n,action:r,children:i}),t[16]=n,t[17]=r,t[18]=i,t[19]=l):l=t[19];let u;return t[20]!==e||t[21]!==l?(u=(0,$.jsx)(`div`,{className:e,children:l}),t[20]=e,t[21]=l,t[22]=u):u=t[22],u}let P;t[23]===o?P=t[24]:(P=f(`h-full min-h-0`,o),t[23]=o,t[24]=P);let ue;t[25]!==a||t[26]!==u?(ue=(0,$.jsx)(Ce,{provider:u,onBack:a}),t[25]=a,t[26]=u,t[27]=ue):ue=t[27];let de;t[28]!==_||t[29]!==g?(de=()=>_(!g),t[28]=_,t[29]=g,t[30]=de):de=t[30];let F;t[31]!==h||t[32]!==ae||t[33]!==oe||t[34]!==y||t[35]!==v||t[36]!==se||t[37]!==u||t[38]!==g||t[39]!==de?(F=(0,$.jsx)(`div`,{className:`pt-6`,children:(0,$.jsx)(Ee,{provider:u,displayApiKey:h,showApiKey:g,onToggleShowApiKey:de,onUpdateKey:ae,providerEnvValues:v,onUpdateEnv:oe,modelsLoading:y,onRefreshModels:se})}),t[31]=h,t[32]=ae,t[33]=oe,t[34]=y,t[35]=v,t[36]=se,t[37]=u,t[38]=g,t[39]=de,t[40]=F):F=t[40];let I;t[41]!==u.name||t[42]!==ue||t[43]!==F?(I=(0,$.jsx)(Ae,{title:u.name,description:`Configure API keys and connection settings for this provider.`,action:ue,children:F}),t[41]=u.name,t[42]=ue,t[43]=F,t[44]=I):I=t[44];let L;t[45]!==w||t[46]!==E||t[47]!==C?(L=e=>{C(e),w(``),E(`alphabetical`)},t[45]=w,t[46]=E,t[47]=C,t[48]=L):L=t[48];let pe;t[49]===p?pe=t[50]:(pe=(0,$.jsx)(we,{balance:p}),t[49]=p,t[50]=pe);let z;t[51]===u.name?z=t[52]:(z=u.name.toLowerCase(),t[51]=u.name,t[52]=z);let B=z===`openrouter`,me=S===`coding`?te:O,he=S===`coding`?ne:k,V=S===`coding`?re:A,H;t[53]!==ce||t[54]!==j||t[55]!==ee||t[56]!==T||t[57]!==S||t[58]!==y||t[59]!==w||t[60]!==E||t[61]!==B||t[62]!==me||t[63]!==he||t[64]!==V?(H=(0,$.jsx)(ke,{tab:S,showImageTab:B,modelsLoading:y,models:me,hasApiKey:j,enabledModelIds:he,pendingChanges:V,modelSearchQuery:ee,onModelSearchQueryChange:w,modelSortBy:T,onModelSortByChange:E,onToggleAllModels:ce}),t[53]=ce,t[54]=j,t[55]=ee,t[56]=T,t[57]=S,t[58]=y,t[59]=w,t[60]=E,t[61]=B,t[62]=me,t[63]=he,t[64]=V,t[65]=H):H=t[65];let U;t[66]===b?U=t[67]:(U=b?(0,$.jsx)(le,{variant:`error`,className:`mb-4`,children:b}):null,t[66]=b,t[67]=U);let W;t[68]!==te||t[69]!==ne||t[70]!==D||t[71]!==M||t[72]!==N||t[73]!==j||t[74]!==T||t[75]!==b||t[76]!==y||t[77]!==re||t[78]!==u?(W=(0,$.jsx)(ge,{value:`coding`,children:(0,$.jsx)(Oe,{tab:`coding`,provider:u,models:te,filteredModels:D,modelsLoading:y,modelsError:b,hasApiKey:j,enabledModelIds:ne,pendingChanges:re,modelSortBy:T,getModelDisplayName:M,onToggleModel:N})}),t[68]=te,t[69]=ne,t[70]=D,t[71]=M,t[72]=N,t[73]=j,t[74]=T,t[75]=b,t[76]=y,t[77]=re,t[78]=u,t[79]=W):W=t[79];let G;t[80]!==O||t[81]!==k||t[82]!==ie||t[83]!==M||t[84]!==N||t[85]!==j||t[86]!==T||t[87]!==b||t[88]!==y||t[89]!==A||t[90]!==u?(G=(0,$.jsx)(ge,{value:`image`,children:(0,$.jsx)(Oe,{tab:`image`,provider:u,models:O,filteredModels:ie,modelsLoading:y,modelsError:b,hasApiKey:j,enabledModelIds:k,pendingChanges:A,modelSortBy:T,getModelDisplayName:M,onToggleModel:N})}),t[80]=O,t[81]=k,t[82]=ie,t[83]=M,t[84]=N,t[85]=j,t[86]=T,t[87]=b,t[88]=y,t[89]=A,t[90]=u,t[91]=G):G=t[91];let K;t[92]===x?K=t[93]:(K=x?(0,$.jsx)(le,{variant:x.includes(`error`)||x.includes(`Failed`)?`error`:`success`,className:`mt-4`,children:x}):null,t[92]=x,t[93]=K);let q;t[94]!==pe||t[95]!==H||t[96]!==U||t[97]!==W||t[98]!==G||t[99]!==K?(q=(0,$.jsxs)(Ae,{title:`Models`,description:`Enable coding and image models for this provider.`,action:pe,tableHeader:H,children:[U,W,G,K]}),t[94]=pe,t[95]=H,t[96]=U,t[97]=W,t[98]=G,t[99]=K,t[100]=q):q=t[100];let J;t[101]!==S||t[102]!==q||t[103]!==L?(J=(0,$.jsx)(_e,{value:S,onValueChange:L,children:q}),t[101]=S,t[102]=q,t[103]=L,t[104]=J):J=t[104];let Y;t[105]!==J||t[106]!==I?(Y=(0,$.jsx)(`div`,{className:`frosted-scrollbar h-full min-h-0 overflow-auto`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[I,J]})}),t[105]=J,t[106]=I,t[107]=Y):Y=t[107];let X;return t[108]!==Y||t[109]!==P?(X=(0,$.jsx)(`div`,{className:P,children:Y}),t[108]=Y,t[109]=P,t[110]=X):X=t[110],X}function Me(){return window.location.reload()}function Ne(e){return`providers:list:${e}`}async function Pe(){let[e,t]=await Promise.all([j(),ne().catch(()=>({}))]),n={};for(let[e,r]of Object.entries(t))n[e]=r.length;return{providers:e,enabledModelCounts:n}}var Fe=`grid min-h-10 grid-cols-[minmax(0,1fr)_auto] items-center gap-3 px-3 py-2 hover:bg-muted/30 cursor-pointer`,Ie=`[&>*+*]:border-t [&>*+*]:border-table-border`;function Le(e){let t=(0,Z.c)(9),{title:n,description:r,action:i,children:a}=e,o;t[0]!==i||t[1]!==r||t[2]!==n?(o=(0,$.jsx)(F,{title:n,description:r,action:i,sticky:!1}),t[0]=i,t[1]=r,t[2]=n,t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=(0,$.jsx)(ie,{className:`pt-6`,children:a}),t[4]=a,t[5]=s);let c;return t[6]!==o||t[7]!==s?(c=(0,$.jsxs)(N,{className:`shrink-0`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function Re(e){let t=(0,Z.c)(33),{loadVersion:r,onProviderClick:i}=e,{query:a,setQuery:o,deferredQuery:s}=q(),c;t[0]===r?c=t[1]:(c=Ne(r),t[0]=r,t[1]=c);let{providers:l,enabledModelCounts:u}=H(c,Pe),d;if(t[2]!==s||t[3]!==u||t[4]!==l){let e;t[6]===s?e=t[7]:(e=e=>{let t=s.toLowerCase();return e.name.toLowerCase().includes(t)},t[6]=s,t[7]=e);let n;t[8]===u?n=t[9]:(n=(e,t)=>{let n=(u[e.slug]??0)>0,r=(u[t.slug]??0)>0;return n&&!r?-1:!n&&r?1:e.name.localeCompare(t.name)},t[8]=u,t[9]=n),d=l.filter(Ve).filter(e).sort(n),t[2]=s,t[3]=u,t[4]=l,t[5]=d}else d=t[5];let p=d,m;if(t[10]!==s||t[11]!==l){let e;t[13]===s?e=t[14]:(e=e=>{let t=s.toLowerCase();return e.name.toLowerCase().includes(t)},t[13]=s,t[14]=e),m=l.filter(Be).filter(e).sort(ze),t[10]=s,t[11]=l,t[12]=m}else m=t[12];let h=m,g;t[15]!==a||t[16]!==o?(g=(0,$.jsx)(K,{placeholder:`Search`,value:a,onChange:o,className:`mb-0 w-64`}),t[15]=a,t[16]=o,t[17]=g):g=t[17];let _;t[18]!==p||t[19]!==u||t[20]!==i||t[21]!==a?(_=p.length===0?(0,$.jsx)(`p`,{className:f(n.bodyMuted,`py-4`),children:a?`No connected providers match your search.`:`No providers connected yet. Add an API key to get started.`}):(0,$.jsx)(`div`,{className:Ie,children:p.map(e=>(0,$.jsx)(Je,{provider:e,modelCount:u[e.slug]??0,onClick:i},e.name))}),t[18]=p,t[19]=u,t[20]=i,t[21]=a,t[22]=_):_=t[22];let v;t[23]!==g||t[24]!==_?(v=(0,$.jsx)(Le,{title:`Connected Providers`,description:`Providers you've connected with an API key or environment variable.`,action:g,children:_}),t[23]=g,t[24]=_,t[25]=v):v=t[25];let y;t[26]!==h||t[27]!==i||t[28]!==a?(y=(0,$.jsx)(Le,{title:`Available Providers`,description:`Connect additional providers by adding your API key.`,children:h.length===0?(0,$.jsx)(`p`,{className:f(n.bodyMuted,`py-4`),children:a?`No available providers match your search.`:`All providers are connected.`}):(0,$.jsx)(`div`,{className:Ie,children:h.map(e=>(0,$.jsx)(Ye,{provider:e,onClick:i},e.name))})}),t[26]=h,t[27]=i,t[28]=a,t[29]=y):y=t[29];let b;return t[30]!==v||t[31]!==y?(b=(0,$.jsx)(`div`,{className:`frosted-scrollbar h-full min-h-0 overflow-auto`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[v,y]})}),t[30]=v,t[31]=y,t[32]=b):b=t[32],b}function ze(e,t){return e.name.localeCompare(t.name)}function Be(e){return!e.apiKey}function Ve(e){return e.apiKey}function He(){let e=(0,Z.c)(21),t=y(),{providerSlug:n}=v(),[r,i]=(0,Q.useState)(0),a=(0,Q.useRef)(n),o,s;e[0]!==r||e[1]!==n?(o=()=>{a.current&&!n&&(V(Ne(r)),i(Ke)),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,Q.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`),V(Ne(r)),i(Ge)},e[6]=r,e[7]=t,e[8]=u):u=e[8];let d=u,f;e[9]===r?f=e[10]:(f=function(){V(Ne(r)),i(We)},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,$.jsx)(je,{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,$.jsx)(D,{label:`Loading providers...`,size:`lg`}),e[14]=m):m=e[14];let h;e[15]!==l||e[16]!==r?(h=(0,$.jsx)(Q.Suspense,{fallback:m,children:(0,$.jsx)(Re,{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,$.jsx)(`div`,{className:`h-full min-h-0`,children:(0,$.jsx)(G,{fallbackTitle:`Failed to load providers`,onRetry:p,renderFallback:Ue,children:h})}),e[18]=p,e[19]=h,e[20]=g):g=e[20],g}function Ue(e,t){return(0,$.jsx)(`div`,{className:`frosted-scrollbar h-full min-h-0 overflow-auto`,children:(0,$.jsxs)(N,{className:`shrink-0`,children:[(0,$.jsx)(F,{title:`Providers`,description:`Manage your AI provider connections and API keys.`,sticky:!1}),(0,$.jsx)(`div`,{className:`flex items-center justify-center px-6 pb-6 pt-6`,children:(0,$.jsxs)(`div`,{className:`max-w-md text-center`,children:[(0,$.jsx)(le,{variant:`error`,className:`mb-4`,children:e.message}),(0,$.jsx)(R,{variant:`outline`,size:`sm`,onClick:t,children:`Retry`})]})})]})})}function We(e){return e+1}function Ge(e){return e+1}function Ke(e){return e+1}function qe(e,t){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())}function Je(e){let t=(0,Z.c)(25),{provider:r,modelCount:i,onClick:a}=e,o;t[0]!==a||t[1]!==r?(o=function(){a(r)},t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]===s?c=t[4]:(c=e=>qe(e,s),t[3]=s,t[4]=c);let l;t[5]===r?l=t[6]:(l=(0,$.jsx)(A,{provider:r}),t[5]=r,t[6]=l);let u;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=f(n.label,`truncate leading-normal`),t[7]=u):u=t[7];let d;t[8]===r.name?d=t[9]:(d=(0,$.jsx)(`span`,{className:u,children:r.name}),t[8]=r.name,t[9]=d);let p;t[10]!==l||t[11]!==d?(p=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[l,d]}),t[10]=l,t[11]=d,t[12]=p):p=t[12];let m;t[13]===r.isEnv?m=t[14]:(m=r.isEnv?(0,$.jsx)(ye,{variant:`secondary`,className:f(n.compact,`px-2 py-0.5`),children:`Environment`}):(0,$.jsx)(ye,{variant:`secondary`,className:f(n.compact,`px-2 py-0.5`),children:`API Key`}),t[13]=r.isEnv,t[14]=m);let h;t[15]===i?h=t[16]:(h=i>0&&(0,$.jsxs)(ye,{variant:`default`,className:f(n.compact,`px-2 py-0.5`),children:[i,` `,i===1?`Model`:`Models`]}),t[15]=i,t[16]=h);let g;t[17]!==m||t[18]!==h?(g=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5`,children:[m,h]}),t[17]=m,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==s||t[21]!==c||t[22]!==p||t[23]!==g?(_=(0,$.jsxs)(`div`,{className:Fe,role:`button`,tabIndex:0,onClick:s,onKeyDown:c,children:[p,g]}),t[20]=s,t[21]=c,t[22]=p,t[23]=g,t[24]=_):_=t[24],_}function Ye(e){let t=(0,Z.c)(18),{provider:r,onClick:i}=e,a;t[0]!==i||t[1]!==r?(a=function(){i(r)},t[0]=i,t[1]=r,t[2]=a):a=t[2];let o=a,s;t[3]===o?s=t[4]:(s=e=>qe(e,o),t[3]=o,t[4]=s);let c;t[5]===r?c=t[6]:(c=(0,$.jsx)(A,{provider:r}),t[5]=r,t[6]=c);let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=f(n.label,`truncate leading-normal`),t[7]=l):l=t[7];let u;t[8]===r.name?u=t[9]:(u=(0,$.jsx)(`span`,{className:l,children:r.name}),t[8]=r.name,t[9]=u);let d;t[10]!==c||t[11]!==u?(d=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[c,u]}),t[10]=c,t[11]=u,t[12]=d):d=t[12];let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`span`,{className:f(n.compact,`shrink-0 text-muted-foreground`),children:`Configure`}),t[13]=p):p=t[13];let m;return t[14]!==o||t[15]!==s||t[16]!==d?(m=(0,$.jsxs)(`div`,{className:Fe,role:`button`,tabIndex:0,onClick:o,onKeyDown:s,children:[d,p]}),t[14]=o,t[15]=s,t[16]=d,t[17]=m):m=t[17],m}export{He as ProvidersListView,He as default};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,Fr as n,G as r,Jn as i,Pr as a,Ti as o,Xt as s,Zt as c,a as l,br as u,f as d,i as f,mt as p,pn as m,wi as h,yt as g,z as _}from"./interactive-WtOIgeV4.js";import{Gt as v,Wt as y}from"./react-vendor-wGLyNWf9.js";import{An as b,Ct as x,Dn as S,Eo as C,Nn as ee,On as w,Pn as T,St as E,Tt as te,Un as ne,Wr as re,bt as D,c as O,ct as k,d as A,dt as ie,hr as j,i as M,kn as ae,l as oe,lt as se,mt as N,n as ce,ni as P,nt as le,pr as ue,ri as de,rt as F,s as I,u as L,ut as fe,w as pe,wo as R,wt as z,x as B}from"./onboarding-dbhmRuxw.js";import{n as me,q as he}from"./store-CSyJjyNs.js";import{n as V,t as H}from"./use-suspense-resource-rX-GqyWi.js";import{D as U,E as ge,O as W,T as _e}from"./index-B7qJtiRL.js";import{t as G}from"./async-error-boundary-B0tQed36.js";import{o as K}from"./settings-list-C5MACtux.js";import{t as q}from"./use-deferred-search-DXrcdbyC.js";import{n as J,r as Y,t as X}from"./model-list-controls-oiBE9X9_.js";var Z=h(),Q=e(o(),1),$=t(),ve=C(f(n.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 ye(e){let t=(0,Z.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=f(ve({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,$.jsx)(`div`,{className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}var be=i(`app.use-provider-details.hook`);function xe(e,t,n){return n?e.find(e=>e.slug===n)??null:t?e.find(e=>e.name===t)??null:null}function Se({selectedProviderName:e=null,selectedProviderSlug:t=null,providerData:n}){let r=me(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)([]),[_,v]=(0,Q.useState)(new Set),[y,x]=(0,Q.useState)(new Set),[C,E]=(0,Q.useState)(new Map),{query:te,setQuery:ne,deferredQuery:D}=q(),[O,k]=(0,Q.useState)(`alphabetical`),[A,ie]=(0,Q.useState)(`all`),[se,N]=(0,Q.useState)(!1),[le,F]=(0,Q.useState)(``),[I,L]=(0,Q.useState)(``),[fe,R]=(0,Q.useState)(``),[z,B]=(0,Q.useState)(`coding`),[V,H]=(0,Q.useState)([]),[U,ge]=(0,Q.useState)(new Set),[W,_e]=(0,Q.useState)(new Set),[G,K]=(0,Q.useState)(new Map),[J,Y]=(0,Q.useState)({}),X=e=>pe(e.id);(0,Q.useEffect)(()=>{(async()=>{if(m(``),n&&(t&&n.slug===t||e&&n.name===e)){a(n),R(n.apiKey??``),s(n.apiKey??``),Y(n.envValues??{}),ye(n.slug),Z(n.slug);return}try{let n=xe(await j(),e,t);a(n),R(n?.apiKey??``),s(n?.apiKey??``),Y(n?.envValues??{}),n&&(ye(n.slug),Z(n.slug))}catch(e){m(e instanceof Error?e.message:`Failed to load providers`)}})()},[e,t,n]);let Z=async e=>{f(null);try{let t=await ue(e);t.status===`success`&&f(t.balance)}catch(t){be.error(`Failed to load balance for ${e}:`,t)}};function $(){g([]),H([]),v(new Set),x(new Set),ge(new Set),_e(new Set),E(new Map),K(new Map)}function ve(e){return e instanceof Error?e.message:`Failed to load models from local API`}let ye=async e=>{l(!0),L(``),ne(``),k(`alphabetical`),ie(`all`),B(`coding`);try{let[t,n]=await Promise.all([T(e),ee(e)]);g(t.models),H(n.models);let r=new Set(t.enabledModelIds);v(r),x(r);let i=new Set(n.enabledModelIds);ge(i),_e(i),E(new Map),K(new Map)}catch(t){be.error(`Failed to load models for ${e}:`,t),$(),L(ve(t))}finally{l(!1)}};async function Se(e){l(!0),L(``);try{await re(e),await ye(e)}catch(t){be.error(`Failed to refresh models for ${e}:`,t),$(),L(ve(t)),l(!1)}}let Ce=(e,t)=>{i?.name===e&&(s(t),Te(t))},we=(e,t)=>{Y(n=>({...n,[e]:t})),i&&(async()=>{try{await P({[e]:t}),r({type:he.ConfigUpdated}),F(`${oe(e)} saved successfully`),setTimeout(()=>F(``),3e3)}catch(e){F(e instanceof Error?e.message:`Failed to save provider settings`);return}u(i.slug)&&e===`LOCAL_API_URL`&&t.trim()&&await Se(i.slug)})()},Te=async e=>{if(!(!i||e===fe))try{await de(i.slug,e),r({type:he.ConfigUpdated}),R(e),F(`API key saved successfully`),setTimeout(()=>F(``),3e3)}catch(e){F(e instanceof Error?e.message:`Failed to save API key`)}},Ee=(e,t)=>{t===`image`?K(t=>{let n=new Map(t),r=U.has(e),i=n.has(e),a=n.get(e),o=!(i?a:r);return o===r?n.delete(e):n.set(e,o),De(e,(n.has(e)?n.get(e):r)??!1,`image`),n}):E(t=>{let n=M(t,e,_);return De(e,(n.has(e)?n.get(e):_.has(e))??!1,`coding`),n})},De=async(e,t,n=`coding`)=>{if(i)try{n===`image`?(t?(await ae(i.slug,e),ge(t=>new Set([...t,e]))):(await S(i.slug,e),ge(t=>{let n=new Set(t);return n.delete(e),n})),K(t=>{let n=new Map(t);return n.delete(e),n})):(t?(await b(i.slug,e),v(t=>new Set([...t,e]))):(await w(i.slug,e),v(t=>{let n=new Set(t);return n.delete(e),n})),E(t=>{let n=new Map(t);return n.delete(e),n})),r({type:he.ConfigUpdated}),F(`Model preferences saved successfully`),setTimeout(()=>F(``),3e3)}catch(e){F(e instanceof Error?e.message:`Failed to save model changes`)}};async function Oe(e,t=`coding`){let n=t===`image`?V:h,r=t===`image`?U:_;(t===`image`?K:E)(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 De(i.id,e,t)}let ke=o!==void 0&&o.trim().length>0;return{selectedProvider:i,error:p,balance:d,displayApiKey:o,showApiKey:se,setShowApiKey:N,providerEnvValues:J,modelsLoading:c,modelsError:I,saveStatus:le,modelTab:z,setModelTab:B,modelSearchQuery:te,setModelSearchQuery:ne,modelSortBy:O,setModelSortBy:k,modelFilter:A,setModelFilter:ie,availableModels:h,enabledModelIds:_,pendingChanges:C,filteredAndSortedModels:(0,Q.useMemo)(()=>ce({models:h,query:D,sortBy:O,getDisplayName:X,freeOnly:A===`free`,groupByProvider:!0,getPriority:e=>+!y.has(e.id)}),[h,D,A,y,O,X]),availableImageModels:V,enabledImageModelIds:U,pendingImageChanges:G,filteredAndSortedImageModels:(0,Q.useMemo)(()=>ce({models:V,query:D,sortBy:O===`coding-index`||O===`intelligence-by-price`?`alphabetical`:O,getDisplayName:X,freeOnly:A===`free`,groupByProvider:!0,getPriority:e=>+!W.has(e.id)}),[V,D,A,W,O,X]),hasApiKey:ke,getModelDisplayName:X,handleUpdateKeyLocal:Ce,handleUpdateProviderEnv:we,refreshLocalProviderModels:Se,handleToggleModel:Ee,handleToggleAllModels:Oe}}function Ce(e){let t=(0,Z.c)(7),{provider:r,onBack:i}=e;if(!i&&!r.url)return null;let a;t[0]===r.url?a=t[1]:(a=r.url?(0,$.jsx)(O,{url:r.url,className:f(n.compact,`p-3`)}):null,t[0]=r.url,t[1]=a);let o;t[2]===i?o=t[3]:(o=i?(0,$.jsxs)(R,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:i,children:[(0,$.jsx)(d,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Close provider details`})]}):null,t[2]=i,t[3]=o);let s;return t[4]!==a||t[5]!==o?(s=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6],s}function we(e){let t=(0,Z.c)(6),{balance:r}=e;if(r===null)return null;let i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=f(n.compact,`inline-flex shrink-0 items-center gap-1.5 font-medium`),a=(0,$.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-green-500`}),t[0]=i,t[1]=a):(i=t[0],a=t[1]);let o;t[2]===r?o=t[3]:(o=l(r),t[2]=r,t[3]=o);let s;return t[4]===o?s=t[5]:(s=(0,$.jsxs)(`span`,{className:i,children:[a,`$`,o,` balance`]}),t[4]=o,t[5]=s),s}function Te(e){let t=(0,Z.c)(8),{title:r,tooltip:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=f(n.label,`cursor-help`),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,$.jsx)(te,{asChild:!0,children:(0,$.jsx)(`span`,{className:a,children:r})}),t[1]=r,t[2]=o);let s;t[3]===i?s=t[4]:(s=(0,$.jsx)(x,{children:i}),t[3]=i,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,$.jsx)(z,{children:(0,$.jsxs)(E,{children:[o,s]})}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function Ee(e){let t=(0,Z.c)(10),{provider:n,displayApiKey:i,showApiKey:a,onToggleShowApiKey:o,onUpdateKey:l,providerEnvValues:d,onUpdateEnv:f,modelsLoading:m,onRefreshModels:h}=e,_;return t[0]!==i||t[1]!==m||t[2]!==h||t[3]!==o||t[4]!==f||t[5]!==l||t[6]!==n||t[7]!==d||t[8]!==a?(_=(0,$.jsx)($.Fragment,{children:n.authType===`APIKey`?(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(se,{children:[(0,$.jsx)(k,{label:(0,$.jsx)(Te,{title:`API Key`,tooltip:`Your API key is stored locally and never shared.`}),control:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(g,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(B,{type:a?`text`:`password`,placeholder:n.keyName||`Enter API Key`,className:`pl-10 pr-10`,value:i,onChange:e=>{l(n.name,e.target.value)}}),(0,$.jsx)(R,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:o,disabled:!i,children:a?(0,$.jsx)(c,{className:`h-4 w-4 text-muted-foreground`}):(0,$.jsx)(s,{className:`h-4 w-4 text-muted-foreground`})})]})}),L(n).map(e=>(0,$.jsx)(k,{label:(0,$.jsx)(Te,{title:oe(e),tooltip:e}),control:u(n.slug)&&e===`LOCAL_API_URL`?(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(B,{id:e,value:d[e]??``,onChange:t=>f(e,t.target.value),placeholder:n.api,className:`pr-10`,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`}),(0,$.jsx)(z,{children:(0,$.jsxs)(E,{children:[(0,$.jsx)(te,{asChild:!0,children:(0,$.jsx)(R,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:()=>{h(n.slug)},disabled:m,children:m?(0,$.jsx)(p,{className:`h-4 w-4 animate-spin text-muted-foreground`}):(0,$.jsx)(r,{className:`h-4 w-4 text-muted-foreground`})})}),(0,$.jsx)(x,{children:`Refresh models`})]})})]}):(0,$.jsx)(B,{id:e,value:d[e]??``,onChange:t=>f(e,t.target.value),placeholder:e,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`})},e))]})}):(0,$.jsxs)(`div`,{className:`space-y-2 text-center`,children:[(0,$.jsx)(le,{className:`mb-0`,children:`This provider uses OAuth for authentication.`}),(0,$.jsxs)(R,{variant:`outline`,size:`sm`,disabled:!0,children:[`Sign in with `,n.name]})]})}),t[0]=i,t[1]=m,t[2]=h,t[3]=o,t[4]=f,t[5]=l,t[6]=n,t[7]=d,t[8]=a,t[9]=_):_=t[9],_}function De(e){let t=(0,Z.c)(22),{tab:r,model:i,displayName:a,willBeEnabled:o,hasApiKey:s,showStarRating:c,onToggle:u}=e,d=i.pricing,p=r===`image`?`image-${i.id}`:i.id,m=i.id,h=!s&&`opacity-25`,g;t[0]===h?g=t[1]:(g=f(`flex cursor-default items-center space-x-3 p-3 transition-colors hover:bg-muted/30`,h),t[0]=h,t[1]=g);let _=!s,v=o??!1,y;t[2]!==i.id||t[3]!==u?(y=()=>u(i.id),t[2]=i.id,t[3]=u,t[4]=y):y=t[4];let b;t[5]!==p||t[6]!==_||t[7]!==v||t[8]!==y?(b=(0,$.jsx)(I,{id:p,disabled:_,checked:v,onCheckedChange:y,className:`mt-0`}),t[5]=p,t[6]=_,t[7]=v,t[8]=y,t[9]=b):b=t[9];let x;t[10]!==p||t[11]!==a||t[12]!==i.coding_index||t[13]!==d||t[14]!==c||t[15]!==r?(x=r===`coding`?(0,$.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,$.jsx)(`label`,{htmlFor:p,className:f(n.body,`leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:a})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[c&&(0,$.jsx)(Y,{codingIndex:i.coding_index,modelName:a}),d&&(0,$.jsx)(`span`,{className:f(n.caption,`whitespace-nowrap`),children:(d.prompt??0)===0&&(d.completion??0)===0?``:`$${l(d.prompt??0)} in | $${l(d.completion??0)} out`})]})]}):(0,$.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,$.jsx)(`label`,{htmlFor:p,className:f(n.label,`leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:a})}),d&&(0,$.jsx)(`span`,{className:f(n.caption,`whitespace-nowrap flex-shrink-0`),children:(d.prompt??0)===0&&(d.completion??0)===0?``:`$${l(d.prompt??0)} in | $${l(d.completion??0)} out`})]}),t[10]=p,t[11]=a,t[12]=i.coding_index,t[13]=d,t[14]=c,t[15]=r,t[16]=x):x=t[16];let S;return t[17]!==i.id||t[18]!==g||t[19]!==b||t[20]!==x?(S=(0,$.jsxs)(`div`,{className:g,children:[b,x]},m),t[17]=i.id,t[18]=g,t[19]=b,t[20]=x,t[21]=S):S=t[21],S}function Oe(e){let t=(0,Z.c)(13),{tab:r,models:i,filteredModels:o,modelsLoading:s,modelsError:c,hasApiKey:l,enabledModelIds:u,pendingChanges:d,modelSortBy:m,getModelDisplayName:h,onToggleModel:g}=e,_=r===`coding`,v=_?c?`No models loaded.`:`No models available for this provider.`:`No image models available for this provider.`,y;return t[0]!==v||t[1]!==u||t[2]!==o||t[3]!==h||t[4]!==l||t[5]!==_||t[6]!==m||t[7]!==i||t[8]!==s||t[9]!==g||t[10]!==d||t[11]!==r?(y=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:s?(0,$.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,$.jsx)(p,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):i.length===0?(0,$.jsx)(`div`,{className:`text-center py-8`,children:(0,$.jsx)(`p`,{className:n.bodyMuted,children:v})}):(0,$.jsx)(z,{children:(0,$.jsx)(`div`,{className:f(`grid grid-cols-1 gap-0`,a.tableWrapper),children:o.length===0?(0,$.jsx)(`div`,{className:`text-center py-8`,children:(0,$.jsx)(`p`,{className:n.bodyMuted,children:`No models matching your filters.`})}):o.map(e=>{let t=u.has(e.id),n=d.has(e.id),i=d.get(e.id),a=(n?i:t)??!1;return(0,$.jsx)(De,{tab:r,model:e,displayName:h(e),willBeEnabled:a,hasApiKey:l,showStarRating:_&&(m===`coding-index`||m===`intelligence-by-price`),onToggle:e=>g(e,r)},e.id)})})})}),t[0]=v,t[1]=u,t[2]=o,t[3]=h,t[4]=l,t[5]=_,t[6]=m,t[7]=i,t[8]=s,t[9]=g,t[10]=d,t[11]=r,t[12]=y):y=t[12],y}function ke(e){let t=(0,Z.c)(22),{tab:n,showImageTab:r,modelsLoading:i,models:a,hasApiKey:o,enabledModelIds:s,pendingChanges:c,modelSearchQuery:l,onModelSearchQueryChange:u,modelSortBy:d,onModelSortByChange:p,onToggleAllModels:m}=e,h=n===`coding`,g=h?`select-all-models`:`select-all-image-models`,v=!i&&a.length>0,y=v&&!o&&`opacity-25`,b;t[0]===y?b=t[1]:(b=f(`flex flex-col gap-2 md:flex-row md:items-center`,y),t[0]=y,t[1]=b);let x;t[2]===r?x=t[3]:(x=r?(0,$.jsxs)(U,{className:`w-fit shrink-0 self-start`,children:[(0,$.jsx)(W,{value:`coding`,children:`Coding`}),(0,$.jsx)(W,{value:`image`,children:`Image`})]}):null,t[2]=r,t[3]=x);let S;t[4]!==s||t[5]!==o||t[6]!==h||t[7]!==l||t[8]!==d||t[9]!==a||t[10]!==u||t[11]!==p||t[12]!==m||t[13]!==c||t[14]!==g||t[15]!==v||t[16]!==n?(S=v?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`relative w-full md:w-52 flex-shrink-0`,children:[(0,$.jsx)(_,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,$.jsx)(B,{placeholder:`Search`,className:`pl-10 h-8`,value:l,onChange:e=>u(e.target.value),disabled:!o})]}),(0,$.jsxs)(`div`,{className:`flex flex-shrink-0 items-center gap-2 self-end md:ml-auto md:self-auto`,children:[(0,$.jsx)(X,{id:g,disabled:!o,checked:a.every(e=>{let t=c.has(e.id),n=c.get(e.id);return t?n:s.has(e.id)}),onChange:e=>{m(e,n)}}),(0,$.jsx)(J,{sortBy:d,showCodingIndex:h,showIntelligenceByPrice:h,onSortByChange:p})]})]}):null,t[4]=s,t[5]=o,t[6]=h,t[7]=l,t[8]=d,t[9]=a,t[10]=u,t[11]=p,t[12]=m,t[13]=c,t[14]=g,t[15]=v,t[16]=n,t[17]=S):S=t[17];let C;return t[18]!==b||t[19]!==x||t[20]!==S?(C=(0,$.jsxs)(`div`,{className:b,children:[x,S]}),t[18]=b,t[19]=x,t[20]=S,t[21]=C):C=t[21],C}function Ae(e){let t=(0,Z.c)(10),{title:n,description:r,action:i,tableHeader:a,children:o}=e,s;t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==n?(s=(0,$.jsx)(F,{title:n,description:r,action:i,sticky:!1,tableHeader:a}),t[0]=i,t[1]=r,t[2]=a,t[3]=n,t[4]=s):s=t[4];let c;t[5]===o?c=t[6]:(c=(0,$.jsx)(`div`,{className:`px-6 pb-6`,children:o}),t[5]=o,t[6]=c);let l;return t[7]!==s||t[8]!==c?(l=(0,$.jsxs)(N,{className:`shrink-0`,children:[s,c]}),t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function je(e){let t=(0,Z.c)(111),{selectedProviderName:n,selectedProviderSlug:r,providerData:i,onBack:a,className:o}=e,s=n===void 0?null:n,c=r===void 0?null:r,l;t[0]!==i||t[1]!==s||t[2]!==c?(l={selectedProviderName:s,selectedProviderSlug:c,providerData:i},t[0]=i,t[1]=s,t[2]=c,t[3]=l):l=t[3];let{selectedProvider:u,error:d,balance:p,displayApiKey:h,showApiKey:g,setShowApiKey:_,providerEnvValues:v,modelsLoading:y,modelsError:b,saveStatus:x,modelTab:S,setModelTab:C,modelSearchQuery:ee,setModelSearchQuery:w,modelSortBy:T,setModelSortBy:E,availableModels:te,enabledModelIds:ne,pendingChanges:re,filteredAndSortedModels:D,availableImageModels:O,enabledImageModelIds:k,pendingImageChanges:A,filteredAndSortedImageModels:ie,hasApiKey:j,getModelDisplayName:M,handleUpdateKeyLocal:ae,handleUpdateProviderEnv:oe,refreshLocalProviderModels:se,handleToggleModel:N,handleToggleAllModels:ce}=Se(l);if(d){let e;t[4]===o?e=t[5]:(e=f(`flex h-full min-h-0 flex-col items-center justify-center gap-4 p-6`,o),t[4]=o,t[5]=e);let n;t[6]===d?n=t[7]:(n=(0,$.jsx)(le,{variant:`error`,className:`mb-0`,children:d}),t[6]=d,t[7]=n);let r;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(R,{variant:`outline`,size:`sm`,onClick:Me,children:`Retry`}),t[8]=r):r=t[8];let i;return t[9]!==e||t[10]!==n?(i=(0,$.jsxs)(`div`,{className:e,children:[n,r]}),t[9]=e,t[10]=n,t[11]=i):i=t[11],i}if(!u){let e;t[12]===o?e=t[13]:(e=f(`flex h-full min-h-0 items-center justify-center`,o),t[12]=o,t[13]=e);let n=s||c?`Provider not found`:`Select a Provider`,r;t[14]===a?r=t[15]:(r=a?(0,$.jsxs)(R,{variant:`outline`,size:`sm`,onClick:a,children:[(0,$.jsx)(m,{className:`h-4 w-4 mr-1`}),`Back to Providers`]}):void 0,t[14]=a,t[15]=r);let i=a?`This provider could not be found.`:`Choose a provider from the list to configure its settings.`,l;t[16]!==n||t[17]!==r||t[18]!==i?(l=(0,$.jsx)(fe,{title:n,action:r,children:i}),t[16]=n,t[17]=r,t[18]=i,t[19]=l):l=t[19];let u;return t[20]!==e||t[21]!==l?(u=(0,$.jsx)(`div`,{className:e,children:l}),t[20]=e,t[21]=l,t[22]=u):u=t[22],u}let P;t[23]===o?P=t[24]:(P=f(`h-full min-h-0`,o),t[23]=o,t[24]=P);let ue;t[25]!==a||t[26]!==u?(ue=(0,$.jsx)(Ce,{provider:u,onBack:a}),t[25]=a,t[26]=u,t[27]=ue):ue=t[27];let de;t[28]!==_||t[29]!==g?(de=()=>_(!g),t[28]=_,t[29]=g,t[30]=de):de=t[30];let F;t[31]!==h||t[32]!==ae||t[33]!==oe||t[34]!==y||t[35]!==v||t[36]!==se||t[37]!==u||t[38]!==g||t[39]!==de?(F=(0,$.jsx)(`div`,{className:`pt-6`,children:(0,$.jsx)(Ee,{provider:u,displayApiKey:h,showApiKey:g,onToggleShowApiKey:de,onUpdateKey:ae,providerEnvValues:v,onUpdateEnv:oe,modelsLoading:y,onRefreshModels:se})}),t[31]=h,t[32]=ae,t[33]=oe,t[34]=y,t[35]=v,t[36]=se,t[37]=u,t[38]=g,t[39]=de,t[40]=F):F=t[40];let I;t[41]!==u.name||t[42]!==ue||t[43]!==F?(I=(0,$.jsx)(Ae,{title:u.name,description:`Configure API keys and connection settings for this provider.`,action:ue,children:F}),t[41]=u.name,t[42]=ue,t[43]=F,t[44]=I):I=t[44];let L;t[45]!==w||t[46]!==E||t[47]!==C?(L=e=>{C(e),w(``),E(`alphabetical`)},t[45]=w,t[46]=E,t[47]=C,t[48]=L):L=t[48];let pe;t[49]===p?pe=t[50]:(pe=(0,$.jsx)(we,{balance:p}),t[49]=p,t[50]=pe);let z;t[51]===u.name?z=t[52]:(z=u.name.toLowerCase(),t[51]=u.name,t[52]=z);let B=z===`openrouter`,me=S===`coding`?te:O,he=S===`coding`?ne:k,V=S===`coding`?re:A,H;t[53]!==ce||t[54]!==j||t[55]!==ee||t[56]!==T||t[57]!==S||t[58]!==y||t[59]!==w||t[60]!==E||t[61]!==B||t[62]!==me||t[63]!==he||t[64]!==V?(H=(0,$.jsx)(ke,{tab:S,showImageTab:B,modelsLoading:y,models:me,hasApiKey:j,enabledModelIds:he,pendingChanges:V,modelSearchQuery:ee,onModelSearchQueryChange:w,modelSortBy:T,onModelSortByChange:E,onToggleAllModels:ce}),t[53]=ce,t[54]=j,t[55]=ee,t[56]=T,t[57]=S,t[58]=y,t[59]=w,t[60]=E,t[61]=B,t[62]=me,t[63]=he,t[64]=V,t[65]=H):H=t[65];let U;t[66]===b?U=t[67]:(U=b?(0,$.jsx)(le,{variant:`error`,className:`mb-4`,children:b}):null,t[66]=b,t[67]=U);let W;t[68]!==te||t[69]!==ne||t[70]!==D||t[71]!==M||t[72]!==N||t[73]!==j||t[74]!==T||t[75]!==b||t[76]!==y||t[77]!==re||t[78]!==u?(W=(0,$.jsx)(ge,{value:`coding`,children:(0,$.jsx)(Oe,{tab:`coding`,provider:u,models:te,filteredModels:D,modelsLoading:y,modelsError:b,hasApiKey:j,enabledModelIds:ne,pendingChanges:re,modelSortBy:T,getModelDisplayName:M,onToggleModel:N})}),t[68]=te,t[69]=ne,t[70]=D,t[71]=M,t[72]=N,t[73]=j,t[74]=T,t[75]=b,t[76]=y,t[77]=re,t[78]=u,t[79]=W):W=t[79];let G;t[80]!==O||t[81]!==k||t[82]!==ie||t[83]!==M||t[84]!==N||t[85]!==j||t[86]!==T||t[87]!==b||t[88]!==y||t[89]!==A||t[90]!==u?(G=(0,$.jsx)(ge,{value:`image`,children:(0,$.jsx)(Oe,{tab:`image`,provider:u,models:O,filteredModels:ie,modelsLoading:y,modelsError:b,hasApiKey:j,enabledModelIds:k,pendingChanges:A,modelSortBy:T,getModelDisplayName:M,onToggleModel:N})}),t[80]=O,t[81]=k,t[82]=ie,t[83]=M,t[84]=N,t[85]=j,t[86]=T,t[87]=b,t[88]=y,t[89]=A,t[90]=u,t[91]=G):G=t[91];let K;t[92]===x?K=t[93]:(K=x?(0,$.jsx)(le,{variant:x.includes(`error`)||x.includes(`Failed`)?`error`:`success`,className:`mt-4`,children:x}):null,t[92]=x,t[93]=K);let q;t[94]!==pe||t[95]!==H||t[96]!==U||t[97]!==W||t[98]!==G||t[99]!==K?(q=(0,$.jsxs)(Ae,{title:`Models`,description:`Enable coding and image models for this provider.`,action:pe,tableHeader:H,children:[U,W,G,K]}),t[94]=pe,t[95]=H,t[96]=U,t[97]=W,t[98]=G,t[99]=K,t[100]=q):q=t[100];let J;t[101]!==S||t[102]!==q||t[103]!==L?(J=(0,$.jsx)(_e,{value:S,onValueChange:L,children:q}),t[101]=S,t[102]=q,t[103]=L,t[104]=J):J=t[104];let Y;t[105]!==J||t[106]!==I?(Y=(0,$.jsx)(`div`,{className:`frosted-scrollbar h-full min-h-0 overflow-auto`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[I,J]})}),t[105]=J,t[106]=I,t[107]=Y):Y=t[107];let X;return t[108]!==Y||t[109]!==P?(X=(0,$.jsx)(`div`,{className:P,children:Y}),t[108]=Y,t[109]=P,t[110]=X):X=t[110],X}function Me(){return window.location.reload()}function Ne(e){return`providers:list:${e}`}async function Pe(){let[e,t]=await Promise.all([j(),ne().catch(()=>({}))]),n={};for(let[e,r]of Object.entries(t))n[e]=r.length;return{providers:e,enabledModelCounts:n}}var Fe=`grid min-h-10 grid-cols-[minmax(0,1fr)_auto] items-center gap-3 px-3 py-2 hover:bg-muted/30 cursor-pointer`,Ie=`[&>*+*]:border-t [&>*+*]:border-table-border`;function Le(e){let t=(0,Z.c)(9),{title:n,description:r,action:i,children:a}=e,o;t[0]!==i||t[1]!==r||t[2]!==n?(o=(0,$.jsx)(F,{title:n,description:r,action:i,sticky:!1}),t[0]=i,t[1]=r,t[2]=n,t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=(0,$.jsx)(ie,{className:`pt-6`,children:a}),t[4]=a,t[5]=s);let c;return t[6]!==o||t[7]!==s?(c=(0,$.jsxs)(N,{className:`shrink-0`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function Re(e){let t=(0,Z.c)(33),{loadVersion:r,onProviderClick:i}=e,{query:a,setQuery:o,deferredQuery:s}=q(),c;t[0]===r?c=t[1]:(c=Ne(r),t[0]=r,t[1]=c);let{providers:l,enabledModelCounts:u}=H(c,Pe),d;if(t[2]!==s||t[3]!==u||t[4]!==l){let e;t[6]===s?e=t[7]:(e=e=>{let t=s.toLowerCase();return e.name.toLowerCase().includes(t)},t[6]=s,t[7]=e);let n;t[8]===u?n=t[9]:(n=(e,t)=>{let n=(u[e.slug]??0)>0,r=(u[t.slug]??0)>0;return n&&!r?-1:!n&&r?1:e.name.localeCompare(t.name)},t[8]=u,t[9]=n),d=l.filter(Ve).filter(e).sort(n),t[2]=s,t[3]=u,t[4]=l,t[5]=d}else d=t[5];let p=d,m;if(t[10]!==s||t[11]!==l){let e;t[13]===s?e=t[14]:(e=e=>{let t=s.toLowerCase();return e.name.toLowerCase().includes(t)},t[13]=s,t[14]=e),m=l.filter(Be).filter(e).sort(ze),t[10]=s,t[11]=l,t[12]=m}else m=t[12];let h=m,g;t[15]!==a||t[16]!==o?(g=(0,$.jsx)(K,{placeholder:`Search`,value:a,onChange:o,className:`mb-0 w-64`}),t[15]=a,t[16]=o,t[17]=g):g=t[17];let _;t[18]!==p||t[19]!==u||t[20]!==i||t[21]!==a?(_=p.length===0?(0,$.jsx)(`p`,{className:f(n.bodyMuted,`py-4`),children:a?`No connected providers match your search.`:`No providers connected yet. Add an API key to get started.`}):(0,$.jsx)(`div`,{className:Ie,children:p.map(e=>(0,$.jsx)(Je,{provider:e,modelCount:u[e.slug]??0,onClick:i},e.name))}),t[18]=p,t[19]=u,t[20]=i,t[21]=a,t[22]=_):_=t[22];let v;t[23]!==g||t[24]!==_?(v=(0,$.jsx)(Le,{title:`Connected Providers`,description:`Providers you've connected with an API key or environment variable.`,action:g,children:_}),t[23]=g,t[24]=_,t[25]=v):v=t[25];let y;t[26]!==h||t[27]!==i||t[28]!==a?(y=(0,$.jsx)(Le,{title:`Available Providers`,description:`Connect additional providers by adding your API key.`,children:h.length===0?(0,$.jsx)(`p`,{className:f(n.bodyMuted,`py-4`),children:a?`No available providers match your search.`:`All providers are connected.`}):(0,$.jsx)(`div`,{className:Ie,children:h.map(e=>(0,$.jsx)(Ye,{provider:e,onClick:i},e.name))})}),t[26]=h,t[27]=i,t[28]=a,t[29]=y):y=t[29];let b;return t[30]!==v||t[31]!==y?(b=(0,$.jsx)(`div`,{className:`frosted-scrollbar h-full min-h-0 overflow-auto`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[v,y]})}),t[30]=v,t[31]=y,t[32]=b):b=t[32],b}function ze(e,t){return e.name.localeCompare(t.name)}function Be(e){return!e.apiKey}function Ve(e){return e.apiKey}function He(){let e=(0,Z.c)(21),t=y(),{providerSlug:n}=v(),[r,i]=(0,Q.useState)(0),a=(0,Q.useRef)(n),o,s;e[0]!==r||e[1]!==n?(o=()=>{a.current&&!n&&(V(Ne(r)),i(Ke)),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,Q.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`),V(Ne(r)),i(Ge)},e[6]=r,e[7]=t,e[8]=u):u=e[8];let d=u,f;e[9]===r?f=e[10]:(f=function(){V(Ne(r)),i(We)},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,$.jsx)(je,{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,$.jsx)(D,{label:`Loading providers...`,size:`lg`}),e[14]=m):m=e[14];let h;e[15]!==l||e[16]!==r?(h=(0,$.jsx)(Q.Suspense,{fallback:m,children:(0,$.jsx)(Re,{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,$.jsx)(`div`,{className:`h-full min-h-0`,children:(0,$.jsx)(G,{fallbackTitle:`Failed to load providers`,onRetry:p,renderFallback:Ue,children:h})}),e[18]=p,e[19]=h,e[20]=g):g=e[20],g}function Ue(e,t){return(0,$.jsx)(`div`,{className:`frosted-scrollbar h-full min-h-0 overflow-auto`,children:(0,$.jsxs)(N,{className:`shrink-0`,children:[(0,$.jsx)(F,{title:`Providers`,description:`Manage your AI provider connections and API keys.`,sticky:!1}),(0,$.jsx)(`div`,{className:`flex items-center justify-center px-6 pb-6 pt-6`,children:(0,$.jsxs)(`div`,{className:`max-w-md text-center`,children:[(0,$.jsx)(le,{variant:`error`,className:`mb-4`,children:e.message}),(0,$.jsx)(R,{variant:`outline`,size:`sm`,onClick:t,children:`Retry`})]})})]})})}function We(e){return e+1}function Ge(e){return e+1}function Ke(e){return e+1}function qe(e,t){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())}function Je(e){let t=(0,Z.c)(25),{provider:r,modelCount:i,onClick:a}=e,o;t[0]!==a||t[1]!==r?(o=function(){a(r)},t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]===s?c=t[4]:(c=e=>qe(e,s),t[3]=s,t[4]=c);let l;t[5]===r?l=t[6]:(l=(0,$.jsx)(A,{provider:r}),t[5]=r,t[6]=l);let u;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=f(n.label,`truncate leading-normal`),t[7]=u):u=t[7];let d;t[8]===r.name?d=t[9]:(d=(0,$.jsx)(`span`,{className:u,children:r.name}),t[8]=r.name,t[9]=d);let p;t[10]!==l||t[11]!==d?(p=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[l,d]}),t[10]=l,t[11]=d,t[12]=p):p=t[12];let m;t[13]===r.isEnv?m=t[14]:(m=r.isEnv?(0,$.jsx)(ye,{variant:`secondary`,className:f(n.compact,`px-2 py-0.5`),children:`Environment`}):(0,$.jsx)(ye,{variant:`secondary`,className:f(n.compact,`px-2 py-0.5`),children:`API Key`}),t[13]=r.isEnv,t[14]=m);let h;t[15]===i?h=t[16]:(h=i>0&&(0,$.jsxs)(ye,{variant:`default`,className:f(n.compact,`px-2 py-0.5`),children:[i,` `,i===1?`Model`:`Models`]}),t[15]=i,t[16]=h);let g;t[17]!==m||t[18]!==h?(g=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5`,children:[m,h]}),t[17]=m,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==s||t[21]!==c||t[22]!==p||t[23]!==g?(_=(0,$.jsxs)(`div`,{className:Fe,role:`button`,tabIndex:0,onClick:s,onKeyDown:c,children:[p,g]}),t[20]=s,t[21]=c,t[22]=p,t[23]=g,t[24]=_):_=t[24],_}function Ye(e){let t=(0,Z.c)(18),{provider:r,onClick:i}=e,a;t[0]!==i||t[1]!==r?(a=function(){i(r)},t[0]=i,t[1]=r,t[2]=a):a=t[2];let o=a,s;t[3]===o?s=t[4]:(s=e=>qe(e,o),t[3]=o,t[4]=s);let c;t[5]===r?c=t[6]:(c=(0,$.jsx)(A,{provider:r}),t[5]=r,t[6]=c);let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=f(n.label,`truncate leading-normal`),t[7]=l):l=t[7];let u;t[8]===r.name?u=t[9]:(u=(0,$.jsx)(`span`,{className:l,children:r.name}),t[8]=r.name,t[9]=u);let d;t[10]!==c||t[11]!==u?(d=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[c,u]}),t[10]=c,t[11]=u,t[12]=d):d=t[12];let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`span`,{className:f(n.compact,`shrink-0 text-muted-foreground`),children:`Configure`}),t[13]=p):p=t[13];let m;return t[14]!==o||t[15]!==s||t[16]!==d?(m=(0,$.jsxs)(`div`,{className:Fe,role:`button`,tabIndex:0,onClick:o,onKeyDown:s,children:[d,p]}),t[14]=o,t[15]=s,t[16]=d,t[17]=m):m=t[17],m}export{He as ProvidersListView,He as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ci as e,Fr as t,O as ee,wi as n}from"./interactive-WtOIgeV4.js";import{A as te,Ct as ne,D as re,O as ie,St as ae,T as oe,Tt as se,b as r,j as ce,k as le,s as i,wo as ue,wt as de,x as fe}from"./onboarding-dbhmRuxw.js";import{K as pe,xt as a}from"./index-B7qJtiRL.js";var me=n(),o=e();function s(e){let n=(0,me.c)(71),{open:s,onOpenChange:c,prTitle:l,onPrTitleChange:u,prDescription:d,onPrDescriptionChange:f,isGeneratingPRInfo:p,isLoading:m,onGeneratePRInfo:h,onCreatePR:g,currentBranch:_,autoGeneratePRInfo:v,onAutoGeneratePRInfoChange:y,createBranchAfterPR:b,onCreateBranchAfterPRChange:x}=e,S;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,o.jsx)(ce,{children:`Create Pull Request`}),n[0]=S):S=n[0];let C;n[1]===_?C=n[2]:(C=(0,o.jsxs)(te,{children:[S,(0,o.jsxs)(ie,{children:[`Create a pull request for branch `,_]})]}),n[1]=_,n[2]=C);let w;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,o.jsx)(r,{htmlFor:`pr-title`,children:`Title`}),n[3]=w):w=n[3];let T=_||`Enter PR title...`,E;n[4]===u?E=n[5]:(E=e=>u(e.target.value),n[4]=u,n[5]=E);let D;n[6]!==p||n[7]!==l||n[8]!==T||n[9]!==E?(D=(0,o.jsxs)(`div`,{className:`grid gap-2`,children:[w,(0,o.jsx)(fe,{id:`pr-title`,placeholder:T,value:l,onChange:E,disabled:p})]}),n[6]=p,n[7]=l,n[8]=T,n[9]=E,n[10]=D):D=n[10];let O;n[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,o.jsx)(r,{htmlFor:`pr-description`,children:`Description`}),n[11]=O):O=n[11];let k;n[12]===f?k=n[13]:(k=e=>f(e.target.value),n[12]=f,n[13]=k);let A;n[14]!==p||n[15]!==d||n[16]!==k?(A=(0,o.jsx)(pe,{id:`pr-description`,placeholder:`Enter PR description...`,value:d,onChange:k,disabled:p,className:`pr-10 h-full min-h-[14rem] resize-none`}),n[14]=p,n[15]=d,n[16]=k,n[17]=A):A=n[17];let j=p||m,M;n[18]===p?M=n[19]:(M=p?(0,o.jsx)(a,{}):(0,o.jsx)(ee,{className:`h-3.5 w-3.5`}),n[18]=p,n[19]=M);let N;n[20]!==h||n[21]!==j||n[22]!==M?(N=(0,o.jsx)(se,{asChild:!0,children:(0,o.jsx)(ue,{type:`button`,variant:`ghost`,size:`icon`,className:`absolute top-2 right-2 h-6 w-6`,onClick:h,disabled:j,children:M})}),n[20]=h,n[21]=j,n[22]=M,n[23]=N):N=n[23];let P=p?`Generating PR description...`:`Generate PR title and description with AI`,F;n[24]===P?F=n[25]:(F=(0,o.jsx)(ne,{children:P}),n[24]=P,n[25]=F);let I;n[26]!==N||n[27]!==F?(I=(0,o.jsx)(de,{children:(0,o.jsxs)(ae,{children:[N,F]})}),n[26]=N,n[27]=F,n[28]=I):I=n[28];let L;n[29]!==I||n[30]!==A?(L=(0,o.jsxs)(`div`,{className:`grid gap-2 flex-1 min-h-0`,children:[O,(0,o.jsxs)(`div`,{className:`relative flex-1 min-h-0`,children:[A,I]})]}),n[29]=I,n[30]=A,n[31]=L):L=n[31];let R;n[32]!==L||n[33]!==D?(R=(0,o.jsxs)(`div`,{className:`grid gap-4 py-4 flex-1 min-h-0`,children:[D,L]}),n[32]=L,n[33]=D,n[34]=R):R=n[34];let z;n[35]===y?z=n[36]:(z=e=>y(e===!0),n[35]=y,n[36]=z);let B;n[37]!==v||n[38]!==z?(B=(0,o.jsx)(i,{id:`auto-generate-pr`,checked:v,onCheckedChange:z}),n[37]=v,n[38]=z,n[39]=B):B=n[39];let V;n[40]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,o.jsx)(r,{htmlFor:`auto-generate-pr`,className:t.labelNormal,children:`Auto generate PR title and description`}),n[40]=V):V=n[40];let H;n[41]===B?H=n[42]:(H=(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[B,V]}),n[41]=B,n[42]=H);let U;n[43]===x?U=n[44]:(U=e=>x(e===!0),n[43]=x,n[44]=U);let W;n[45]!==b||n[46]!==U?(W=(0,o.jsx)(i,{id:`create-branch-after-pr`,checked:b,onCheckedChange:U}),n[45]=b,n[46]=U,n[47]=W):W=n[47];let G;n[48]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,o.jsx)(r,{htmlFor:`create-branch-after-pr`,className:t.labelNormal,children:`Stack the next PR on this branch`}),n[48]=G):G=n[48];let K;n[49]===W?K=n[50]:(K=(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[W,G]}),n[49]=W,n[50]=K);let q;n[51]!==H||n[52]!==K?(q=(0,o.jsxs)(`div`,{className:`mr-auto grid gap-2`,children:[H,K]}),n[51]=H,n[52]=K,n[53]=q):q=n[53];let J=m||p,Y;n[54]===m?Y=n[55]:(Y=m?(0,o.jsxs)(o.Fragment,{children:[`Create PR`,(0,o.jsx)(a,{size:`sm`})]}):`Create PR`,n[54]=m,n[55]=Y);let X;n[56]!==g||n[57]!==J||n[58]!==Y?(X=(0,o.jsx)(ue,{className:`ml-auto`,onClick:g,disabled:J,children:Y}),n[56]=g,n[57]=J,n[58]=Y,n[59]=X):X=n[59];let Z;n[60]!==q||n[61]!==X?(Z=(0,o.jsxs)(le,{className:`w-full items-end gap-4`,children:[q,X]}),n[60]=q,n[61]=X,n[62]=Z):Z=n[62];let Q;n[63]!==R||n[64]!==C||n[65]!==Z?(Q=(0,o.jsxs)(re,{className:`flex max-w-2xl flex-col max-md:top-[max(1rem,env(safe-area-inset-top,0px))] max-md:max-h-[calc(100dvh-2rem)] max-md:translate-y-0 max-md:overflow-y-auto max-md:data-[state=closed]:slide-out-to-top max-md:data-[state=open]:slide-in-from-top max-md:data-[state=closed]:slide-out-to-left-0 max-md:data-[state=open]:slide-in-from-left-0 max-md:data-[state=closed]:zoom-out-100 max-md:data-[state=open]:zoom-in-100 md:h-[min(36rem,85dvh)]`,children:[C,R,Z]}),n[63]=R,n[64]=C,n[65]=Z,n[66]=Q):Q=n[66];let $;return n[67]!==c||n[68]!==s||n[69]!==Q?($=(0,o.jsx)(oe,{open:s,onOpenChange:c,children:Q}),n[67]=c,n[68]=s,n[69]=Q,n[70]=$):$=n[70],$}export{s as PullRequestDialog};
|
package/dist/public/assets/{settings-general-view-DCRKEVJG.js → settings-general-view-LnCQ2zkv.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,En as n,Fr as r,Jn as i,T as a,Ti as o,U as s,at as c,bt as l,hn as u,i as d,in as f,ln as p,mt as m,ot as h,sn as g,un as _,w as v,wi as ee}from"./interactive-WtOIgeV4.js";import{c as y,l as b,o as te,s as ne,u as re}from"./react-vendor-wGLyNWf9.js";import{Ct as ie,Qa as x,Si as S,St as ae,Tt as oe,Vn as C,_a as w,a as se,dt as ce,lt as le,mt as ue,o as de,pa as T,rt as fe,st as pe,tt as E,vo as me,wo as he,x as ge}from"./onboarding-dbhmRuxw.js";import{t as _e}from"./use-toast-BFQ85Ly5.js";import{n as ve}from"./utils-Rlf65JHq.js";import{U as ye,n as be,nt as xe,r as Se,rt as Ce,t as we,tt as Te,w as Ee}from"./index-zVJV2Bjj.js";import{t as De}from"./use-settings-page-loading-BC_wP7pl.js";import{t as D}from"./is-macos-client-BIb4ZSEa.js";var Oe=ee(),O=e(o(),1),k=t(),ke=O.forwardRef((e,t)=>{let n=(0,Oe.c)(22),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,valueTooltip:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let[o,s]=O.useState(!1),[c,l]=O.useState(!1),u,f;n[4]===c?(u=n[5],f=n[6]):(u=()=>{if(!c)return;let e=function(){l(!1)};return document.addEventListener(`pointerup`,e),()=>{document.removeEventListener(`pointerup`,e)}},f=[c],n[4]=c,n[5]=u,n[6]=f),O.useEffect(u,f);let p;n[7]===a?p=n[8]:(p=(0,k.jsx)(b,{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`,onPointerDown:()=>{a!=null&&(l(!0),s(!0))}}),n[7]=a,n[8]=p);let m=p,h;n[9]===r?h=n[10]:(h=d(`relative flex w-full touch-none select-none items-center`,r),n[9]=r,n[10]=h);let g;n[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,k.jsx)(re,{className:`relative h-2 w-full grow overflow-hidden rounded-full bg-secondary`,children:(0,k.jsx)(ne,{className:`absolute h-full bg-primary`})}),n[11]=g):g=n[11];let _;n[12]!==c||n[13]!==o||n[14]!==m||n[15]!==a?(_=a==null?m:(0,k.jsxs)(ae,{open:o||c,onOpenChange:s,children:[(0,k.jsx)(oe,{asChild:!0,children:m}),(0,k.jsx)(ie,{side:`top`,children:a})]}),n[12]=c,n[13]=o,n[14]=m,n[15]=a,n[16]=_):_=n[16];let v;return n[17]!==i||n[18]!==t||n[19]!==h||n[20]!==_?(v=(0,k.jsxs)(y,{ref:t,className:h,...i,children:[g,_]}),n[17]=i,n[18]=t,n[19]=h,n[20]=_,n[21]=v):v=n[21],v});ke.displayName=y.displayName;var Ae=i(`app.use-maximum-turn-count.hook`),A=100;function je(){let[e,t]=(0,O.useState)(A),[n,r]=(0,O.useState)(A.toString()),[i,a]=(0,O.useState)(!0),[o,s]=(0,O.useState)(!1);(0,O.useEffect)(()=>{let e=!1;async function n(){try{let n=await C();e||(t(n.maximumTurnCount),r(n.maximumTurnCount.toString()))}catch(e){Ae.error(`Failed to load maximum turn count:`,e)}finally{e||a(!1)}}return n(),()=>{e=!0}},[]);function c(e){r(e)}async function l(e){s(!0);try{let n=await S({maximumTurnCount:e});t(n.maximumTurnCount),r(n.maximumTurnCount.toString())}catch(e){throw Ae.error(`Failed to update maximum turn count:`,e),e}finally{s(!1)}}function u(){r(e.toString())}return{defaultMaximumTurnCount:A,draftMaximumTurnCount:n,isLoading:i,isSaving:o,maximumTurnCount:e,resetDraftMaximumTurnCount:u,setDraftMaximumTurnCount:c,updateMaximumTurnCount:l}}var j=i(`app.use-screen-recording-permission.hook`),M={isMacOS:!1,granted:!1,available:!1,message:``};function Me(){return{...M,isMacOS:D()}}function Ne(){let[e,t]=(0,O.useState)(Me),[n,r]=(0,O.useState)(!0),[i,a]=(0,O.useState)(null),[o,s]=(0,O.useState)(!1),[c,l]=(0,O.useState)(null),u=(0,O.useCallback)(async()=>{r(!0),a(null);try{t(await T(`api/system-permissions/screen-recording`))}catch(e){a(e instanceof Error?e.message:`Failed to check screen recording permission`),t(e=>({...M,isMacOS:e?.isMacOS??D(),message:`Unable to check permission status.`}))}finally{r(!1)}},[]);return(0,O.useEffect)(()=>{u()},[u]),{status:e,isLoading:n,error:i,isOpeningSettings:o,openSettingsError:c,refresh:u,openSystemSettings:(0,O.useCallback)(async()=>{s(!0),l(null);try{let e=await w(`api/system-permissions/screen-recording/open-settings`,{});if(!e.success){let t=e.message||`Failed to open System Settings`;j.error(`[useScreenRecordingPermission] ${t}`,e.error),l(t)}}catch(e){let t=e instanceof Error?e.message:`Failed to open System Settings`;j.error(`[useScreenRecordingPermission] Error opening System Settings:`,e),l(t)}finally{s(!1)}},[])}}var Pe=i(`app.use-server-bind-mode.hook`),Fe=`local`,N=`tarsk-server-bind-mode-changed`;function Ie(e){me(e)}function P(){if(typeof window>`u`)return!1;try{return sessionStorage.getItem(N)===`true`}catch{return!1}}function F(e){if(!(typeof window>`u`))try{e?sessionStorage.setItem(N,`true`):sessionStorage.removeItem(N)}catch{}}function Le(){let[e,t]=(0,O.useState)(()=>x()?.serverBindMode??Fe),[n,r]=(0,O.useState)(null),[i,a]=(0,O.useState)(()=>x()?.networkAddresses??[]),[o,s]=(0,O.useState)(()=>x()===null),[c,l]=(0,O.useState)(!1),[u,d]=(0,O.useState)(P);(0,O.useEffect)(()=>{let e=!1;async function n(){try{let n=await C();e||(t(n.serverBindMode),r(n.serverBindMode),a(n.networkAddresses),Ie({networkAddresses:n.networkAddresses,serverBindMode:n.serverBindMode}))}catch(e){Pe.error(`Failed to load server bind mode:`,e)}finally{e||s(!1)}}return n(),()=>{e=!0}},[]);async function f(e){l(!0);try{let n=await S({serverBindMode:e});t(n.serverBindMode),a(n.networkAddresses),Ie({networkAddresses:n.networkAddresses,serverBindMode:n.serverBindMode}),d(!0),F(!0)}catch(e){throw Pe.error(`Failed to update server bind mode:`,e),e}finally{l(!1)}}let p=n!==null&&e!==n;return{defaultServerBindMode:Fe,hasServerBindModeChanged:p,isLoading:o,isSaving:c,needsRestart:p||u,networkAddresses:i,serverBindMode:e,updateServerBindMode:f}}var I=i(`app.use-logging.hook`);function Re(){let[e,t]=(0,O.useState)(!1),[n,r]=(0,O.useState)(null),[i,a]=(0,O.useState)(!1),[o,s]=(0,O.useState)(null),[c,l]=(0,O.useState)(!0),[u,d]=(0,O.useState)(!1);(0,O.useEffect)(()=>{let e=!1;async function n(){try{let n=await C();e||(t(n.loggingEnabled),r(n.fileLoggingPath),a(n.betterStackEnvConfigured),s(n.betterStackIngestingHost))}catch(e){I.error(`Failed to load logging setting:`,e)}finally{e||l(!1)}}return n(),()=>{e=!0}},[]);async function f(e){d(!0);try{let n=await S({loggingEnabled:e});t(n.loggingEnabled),r(n.fileLoggingPath),a(n.betterStackEnvConfigured),s(n.betterStackIngestingHost)}catch(e){throw I.error(`Failed to update logging setting:`,e),e}finally{d(!1)}}return{ingestingHost:o,isEnabled:e,isEnvConfigured:i,isLoading:c,isSaving:u,logPath:n,updateIsEnabled:f}}var ze=[{value:`light`,label:`Light`,icon:v},{value:`dark`,label:`Dark`,icon:c},{value:`system`,label:`System`,icon:a}],Be=[{value:`image`,label:`Image`,icon:l},{value:`background`,label:`Background`,icon:n}],Ve=`flex h-7 w-7 min-h-0 min-w-0 items-center justify-center rounded-full border-0 bg-background p-0 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm hover:bg-background hover:text-muted-foreground data-[state=on]:hover:bg-foreground data-[state=on]:hover:text-background`,He=`inline-flex h-auto w-fit justify-start rounded-full border-0 bg-background p-1 text-muted-foreground`,Ue=[`462`,`8100`].includes(typeof document<`u`?document.location.port:``)?`462`:`641`,We=600;function Ge(e){let t=(0,Oe.c)(224),{onboardingResetSignal:n}=e,i=n===void 0?0:n,[a,o]=(0,O.useState)(!1),{theme:c,setTheme:l}=ve(),{scale:v,updateScale:ee,min:y,max:b}=Se(),{opacity:ne,updateOpacity:re,min:x,max:S}=be(),{mode:C,color:w,updateMode:T,updateColor:me}=ye(),{color:D,updateColor:Ae,resetColor:A}=we(),{defaultMaximumTurnCount:j,draftMaximumTurnCount:M,isLoading:Me,isSaving:Pe,resetDraftMaximumTurnCount:Fe,setDraftMaximumTurnCount:N,updateMaximumTurnCount:Ie}=je(),{status:P,isLoading:F,isOpeningSettings:I,openSettingsError:Ge,refresh:Ye,openSystemSettings:Xe}=Ne(),{isLoading:Ze,isSaving:Qe,needsRestart:L,networkAddresses:R,serverBindMode:z,updateServerBindMode:$e}=Le(),{isEnabled:et,isLoading:tt,isSaving:nt,updateIsEnabled:rt}=Te(),{isEnabled:it,isLoading:at,isSaving:ot,updateIsEnabled:st}=Ee(),{isEnabled:ct,isSupported:lt,isHealthy:B,statusMessage:ut,isLoading:V,isSaving:dt,updateIsEnabled:ft}=xe(),{isEnabled:H,logPath:U,isEnvConfigured:pt,ingestingHost:mt,isLoading:ht,isSaving:gt,updateIsEnabled:_t}=Re(),vt;t[0]!==ht||t[1]!==Me||t[2]!==F||t[3]!==V||t[4]!==Ze||t[5]!==at||t[6]!==tt?(vt=[Me,F,Ze,tt,at,V,ht],t[0]=ht,t[1]=Me,t[2]=F,t[3]=V,t[4]=Ze,t[5]=at,t[6]=tt,t[7]=vt):vt=t[7];let yt=De(`general`,vt),bt,xt;t[8]===i?(bt=t[9],xt=t[10]):(bt=()=>{if(i===0)return;o(!0);let e=setTimeout(()=>{o(!1)},We);return()=>{clearTimeout(e)}},xt=[i],t[8]=i,t[9]=bt,t[10]=xt),(0,O.useEffect)(bt,xt);let St;t[11]===N?St=t[12]:(St=function(e){N(e.target.value)},t[11]=N,t[12]=St);let Ct=St,wt;t[13]!==j||t[14]!==M||t[15]!==Fe||t[16]!==Ie?(wt=async function(){let e=Number.parseInt(M,10),t=Number.isFinite(e)&&e>0?e:j;try{await Ie(t)}catch{Fe()}},t[13]=j,t[14]=M,t[15]=Fe,t[16]=Ie,t[17]=wt):wt=t[17];let Tt=wt,Et;t[18]===ee?Et=t[19]:(Et=function(e){e.length>0&&ee(e[0])},t[18]=ee,t[19]=Et);let Dt=Et,Ot;t[20]===re?Ot=t[21]:(Ot=function(e){e.length>0&&re(e[0])},t[20]=re,t[21]=Ot);let kt=Ot,At;t[22]===U?At=t[23]:(At=async function(){if(U)try{await navigator.clipboard.writeText(U),_e({title:`Copied`,description:`Log file path copied to clipboard.`})}catch(e){let t=e;_e({title:`Copy failed`,description:t instanceof Error?t.message:`Could not copy the log file path.`,variant:`destructive`})}},t[22]=U,t[23]=At);let jt=At,[Mt,Nt]=(0,O.useState)(!1),W,G,K;t[24]!==R||t[25]!==z?(W=async function(){if(G)try{await navigator.clipboard.writeText(G),Nt(!0),_e({title:`Copied`,description:`Network URL copied to clipboard.`}),window.setTimeout(()=>{Nt(!1)},1500)}catch(e){let t=e;_e({title:`Copy failed`,description:t instanceof Error?t.message:`Could not copy the network URL.`,variant:`destructive`})}},K=z===`network`&&R.length>0,G=K?`http://${R[0]}:${Ue}`:null,t[24]=R,t[25]=z,t[26]=W,t[27]=G,t[28]=K):(W=t[26],G=t[27],K=t[28]);let Pt=K&&G,Ft=a&&`animate-headline-reset`,q;t[29]===Ft?q=t[30]:(q=d(Ft),t[29]=Ft,t[30]=q);let J;t[31]===q?J=t[32]:(J=(0,k.jsx)(fe,{title:`Appearance`,titleClassName:q,className:`[&>div:first-child]:py-2`,sticky:!1}),t[31]=q,t[32]=J);let Y;t[33]===y?Y=t[34]:(Y=(0,k.jsxs)(`span`,{className:`${r.bodyMuted} w-8 shrink-0 text-right`,children:[y,`%`]}),t[33]=y,t[34]=Y);let X;t[35]===v?X=t[36]:(X=[v],t[35]=v,t[36]=X);let It=`${v}%`,Z;t[37]!==Dt||t[38]!==b||t[39]!==y||t[40]!==X||t[41]!==It?(Z=(0,k.jsx)(ke,{value:X,min:y,max:b,step:5,onValueChange:Dt,"aria-label":`Font size`,valueTooltip:It}),t[37]=Dt,t[38]=b,t[39]=y,t[40]=X,t[41]=It,t[42]=Z):Z=t[42];let Lt;t[43]===b?Lt=t[44]:(Lt=(0,k.jsxs)(`span`,{className:`${r.bodyMuted} w-9 shrink-0`,children:[b,`%`]}),t[43]=b,t[44]=Lt);let Rt;t[45]!==Y||t[46]!==Z||t[47]!==Lt?(Rt=(0,k.jsx)(E,{title:`Font Size`,description:`Adjust the text size across the entire application.`,children:(0,k.jsxs)(`div`,{className:`ml-auto flex w-1/2 items-center gap-3`,children:[Y,Z,Lt]})}),t[45]=Y,t[46]=Z,t[47]=Lt,t[48]=Rt):Rt=t[48];let zt;t[49]===x?zt=t[50]:(zt=(0,k.jsxs)(`span`,{className:`${r.bodyMuted} w-8 shrink-0 text-right`,children:[x,`%`]}),t[49]=x,t[50]=zt);let Bt;t[51]===ne?Bt=t[52]:(Bt=[ne],t[51]=ne,t[52]=Bt);let Vt=`${ne}%`,Ht;t[53]!==S||t[54]!==x||t[55]!==kt||t[56]!==Bt||t[57]!==Vt?(Ht=(0,k.jsx)(ke,{value:Bt,min:x,max:S,step:5,onValueChange:kt,"aria-label":`Panel opacity`,valueTooltip:Vt}),t[53]=S,t[54]=x,t[55]=kt,t[56]=Bt,t[57]=Vt,t[58]=Ht):Ht=t[58];let Ut;t[59]===S?Ut=t[60]:(Ut=(0,k.jsxs)(`span`,{className:`${r.bodyMuted} w-9 shrink-0`,children:[S,`%`]}),t[59]=S,t[60]=Ut);let Wt;t[61]!==zt||t[62]!==Ht||t[63]!==Ut?(Wt=(0,k.jsx)(E,{title:`Panel Opacity`,description:`Adjust how opaque the frosted panels are over the wallpaper.`,children:(0,k.jsxs)(`div`,{className:`ml-auto flex w-1/2 items-center gap-3`,children:[zt,Ht,Ut]})}),t[61]=zt,t[62]=Ht,t[63]=Ut,t[64]=Wt):Wt=t[64];let Gt;t[65]===l?Gt=t[66]:(Gt=e=>{(e===`light`||e===`dark`||e===`system`)&&l(e)},t[65]=l,t[66]=Gt);let Kt;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Kt=ze.map(Je),t[67]=Kt):Kt=t[67];let qt;t[68]!==Gt||t[69]!==c?(qt=(0,k.jsx)(E,{title:`Appearance`,description:`Choose your preferred color scheme.`,controlLayout:`row-end`,action:(0,k.jsx)(se,{type:`single`,value:c,onValueChange:Gt,"aria-label":`Appearance`,className:He,children:Kt})}),t[68]=Gt,t[69]=c,t[70]=qt):qt=t[70];let Jt;t[71]===T?Jt=t[72]:(Jt=e=>{(e===`image`||e===`background`||e===`color`)&&T(e)},t[71]=T,t[72]=Jt);let Yt;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(Yt=Be.map(qe),t[73]=Yt):Yt=t[73];let Xt;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(Xt=d(Ve,`relative overflow-hidden`),t[74]=Xt):Xt=t[74];let Zt;t[75]===w?Zt=t[76]:(Zt=(0,k.jsx)(`span`,{className:`pointer-events-none h-4 w-4 rounded-full border border-black/25 dark:border-white/25`,style:{backgroundColor:w},"aria-hidden":`true`}),t[75]=w,t[76]=Zt);let Qt;t[77]===T?Qt=t[78]:(Qt=()=>{T(`color`)},t[77]=T,t[78]=Qt);let $t;t[79]!==me||t[80]!==T?($t=e=>{me(e.target.value),T(`color`)},t[79]=me,t[80]=T,t[81]=$t):$t=t[81];let en;t[82]!==Qt||t[83]!==$t||t[84]!==w?(en=(0,k.jsx)(`input`,{type:`color`,value:w,"aria-label":`Choose wallpaper color`,className:`absolute inset-0 cursor-pointer opacity-0`,onPointerDown:Qt,onChange:$t}),t[82]=Qt,t[83]=$t,t[84]=w,t[85]=en):en=t[85];let tn;t[86]!==Zt||t[87]!==en?(tn=(0,k.jsxs)(de,{value:`color`,"aria-label":`Custom color`,className:Xt,children:[Zt,en]}),t[86]=Zt,t[87]=en,t[88]=tn):tn=t[88];let nn;t[89]!==Jt||t[90]!==tn||t[91]!==C?(nn=(0,k.jsx)(E,{title:`Wallpaper`,description:`Choose a scenic image, the theme background, or a custom color.`,controlLayout:`row-end`,action:(0,k.jsxs)(se,{type:`single`,value:C,onValueChange:Jt,"aria-label":`Wallpaper`,className:He,children:[Yt,tn]})}),t[89]=Jt,t[90]=tn,t[91]=C,t[92]=nn):nn=t[92];let rn;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(rn=d(Ve,`relative cursor-pointer overflow-hidden`),t[93]=rn):rn=t[93];let an;t[94]===D?an=t[95]:(an=(0,k.jsx)(`span`,{className:`pointer-events-none h-4 w-4 rounded-full border border-black/25 dark:border-white/25`,style:{backgroundColor:D},"aria-hidden":`true`}),t[94]=D,t[95]=an);let on;t[96]===Ae?on=t[97]:(on=e=>{Ae(e.target.value)},t[96]=Ae,t[97]=on);let sn;t[98]!==D||t[99]!==on?(sn=(0,k.jsx)(`input`,{type:`color`,value:D,"aria-label":`Primary color`,className:`absolute inset-0 cursor-pointer opacity-0`,onChange:on}),t[98]=D,t[99]=on,t[100]=sn):sn=t[100];let cn;t[101]!==an||t[102]!==sn?(cn=(0,k.jsx)(`div`,{className:He,children:(0,k.jsxs)(`label`,{className:rn,children:[an,sn]})}),t[101]=an,t[102]=sn,t[103]=cn):cn=t[103];let ln;t[104]!==A||t[105]!==cn?(ln=(0,k.jsx)(E,{title:`Primary Color`,description:`Choose the primary accent color used across the app. Click the label to reset to default.`,controlLayout:`row-end`,onTitleClick:A,action:cn}),t[104]=A,t[105]=cn,t[106]=ln):ln=t[106];let un;t[107]!==Rt||t[108]!==Wt||t[109]!==qt||t[110]!==nn||t[111]!==ln?(un=(0,k.jsx)(ce,{className:`max-w-none pt-0`,children:(0,k.jsxs)(le,{children:[Rt,Wt,qt,nn,ln]})}),t[107]=Rt,t[108]=Wt,t[109]=qt,t[110]=nn,t[111]=ln,t[112]=un):un=t[112];let dn;t[113]!==J||t[114]!==un?(dn=(0,k.jsxs)(ue,{className:`shrink-0`,children:[J,un]}),t[113]=J,t[114]=un,t[115]=dn):dn=t[115];let fn;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(fn=(0,k.jsx)(fe,{title:`Settings`,className:`[&>div:first-child]:py-2`,sticky:!1}),t[116]=fn):fn=t[116];let pn=`Set how many turns a long-running agent chat can take before Tarsk asks whether to continue. Default: ${j} turns.`,mn;t[117]===Tt?mn=t[118]:(mn=()=>{Tt()},t[117]=Tt,t[118]=mn);let hn=Me||Pe,gn;t[119]!==M||t[120]!==Ct||t[121]!==mn||t[122]!==hn?(gn=(0,k.jsx)(ge,{type:`number`,min:1,step:1,value:M,onChange:Ct,onBlur:mn,disabled:hn,"aria-label":`Maximum turn count`,className:`w-28 text-right font-mono tabular-nums flex-shrink-0`}),t[119]=M,t[120]=Ct,t[121]=mn,t[122]=hn,t[123]=gn):gn=t[123];let _n;t[124]!==pn||t[125]!==gn?(_n=(0,k.jsx)(E,{title:`Maximum Turn Count`,description:pn,controlLayout:`row-end`,action:gn}),t[124]=pn,t[125]=gn,t[126]=_n):_n=t[126];let vn;t[127]===rt?vn=t[128]:(vn=e=>{rt(e)},t[127]=rt,t[128]=vn);let yn=tt||nt,bn;t[129]!==vn||t[130]!==yn||t[131]!==et?(bn=(0,k.jsx)(E,{title:`AI Voice Cleanup`,description:`After stopping voice recording, run the transcription through AI to remove filler words, false starts, and repetitions.`,controlLayout:`row-end`,action:(0,k.jsx)(Ce,{value:et,onChange:vn,disabled:yn,ariaLabel:`AI Voice Cleanup`})}),t[129]=vn,t[130]=yn,t[131]=et,t[132]=bn):bn=t[132];let xn;t[133]===st?xn=t[134]:(xn=e=>{st(e)},t[133]=st,t[134]=xn);let Sn=at||ot,Cn;t[135]!==it||t[136]!==xn||t[137]!==Sn?(Cn=(0,k.jsx)(E,{title:`Spend`,description:`Show an estimated spend counter in the chat header.`,controlLayout:`row-end`,action:(0,k.jsx)(Ce,{value:it,onChange:xn,disabled:Sn,ariaLabel:`Spend`})}),t[135]=it,t[136]=xn,t[137]=Sn,t[138]=Cn):Cn=t[138];let wn;t[139]!==I||t[140]!==F||t[141]!==Xe||t[142]!==Ye||t[143]!==Ge||t[144]!==P?.granted||t[145]!==P?.isMacOS||t[146]!==P?.message?(wn=P?.isMacOS&&(0,k.jsx)(E,{title:`Screen & Audio Recording`,description:`Tarsk needs this macOS permission to capture screen content for browser tools and screen sharing features.`,controlLayout:`row-end`,action:(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!F&&P?.granted?(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(p,{className:`h-4 w-4 text-green-500`}),(0,k.jsx)(`span`,{className:d(r.body,`text-green-600 dark:text-green-400`),children:`Permission granted`})]}):F?null:(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(g,{className:`h-4 w-4 text-amber-500`}),(0,k.jsx)(`span`,{className:d(r.body,`text-amber-600 dark:text-amber-400`),children:`Permission not granted`})]}),(0,k.jsxs)(he,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7 shrink-0 rounded-full border-0 bg-background hover:bg-background hover:text-foreground`,onClick:()=>void Ye(),disabled:F,children:[F?(0,k.jsx)(m,{className:`h-3.5 w-3.5 animate-spin`}):(0,k.jsx)(s,{className:`h-3.5 w-3.5`}),(0,k.jsx)(`span`,{className:`sr-only`,children:`Refresh permission status`})]})]}),children:!F&&!P?.granted?(0,k.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,k.jsx)(`p`,{className:r.bodyMuted,children:P?.message??`Tarsk needs Screen & Audio Recording permission to use browser tools.`}),(0,k.jsx)(he,{size:`sm`,onClick:()=>void Xe(),disabled:I,className:`w-fit`,children:I?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m,{className:`h-4 w-4 mr-2 animate-spin`}),`Opening Settings...`]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(h,{className:`h-4 w-4 mr-2`}),`Open System Settings`]})}),Ge&&(0,k.jsxs)(`div`,{className:`flex items-start gap-2 p-3 rounded-md bg-destructive/10 text-destructive`,children:[(0,k.jsx)(_,{className:`h-4 w-4 mt-0.5 flex-shrink-0`}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,k.jsx)(`p`,{className:r.body,children:`Failed to open System Settings`}),(0,k.jsx)(`p`,{className:r.bodyMuted,children:Ge}),(0,k.jsxs)(`p`,{className:r.bodyMuted,children:[`Please open it manually:`,` `,(0,k.jsx)(`strong`,{children:`System Settings > Privacy & Security > Screen & System Audio Recording`})]})]})]})]}):null}),t[139]=I,t[140]=F,t[141]=Xe,t[142]=Ye,t[143]=Ge,t[144]=P?.granted,t[145]=P?.isMacOS,t[146]=P?.message,t[147]=wn):wn=t[147];let Tn;t[148]!==V||t[149]!==dt||t[150]!==ct||t[151]!==B||t[152]!==ut||t[153]!==lt||t[154]!==ft?(Tn=lt&&(0,k.jsx)(E,{title:`Sandbox`,description:`Sandbox tools like bash and skill script execution to allow running and testing code safely without risking your system, files, or data.`,controlLayout:`row-end`,action:(0,k.jsx)(Ce,{value:ct&&B,onChange:e=>{e&&!B||ft(e).catch(Ke)},disabled:V||dt,disableOn:!B,ariaLabel:`Sandbox`}),children:!V&&!B?(0,k.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,k.jsx)(g,{className:`h-4 w-4 mt-0.5 shrink-0`}),(0,k.jsx)(`p`,{className:r.bodyMuted,children:ut||`Seatbelt sandbox failed its health check and cannot be enabled.`})]}):null}),t[148]=V,t[149]=dt,t[150]=ct,t[151]=B,t[152]=ut,t[153]=lt,t[154]=ft,t[155]=Tn):Tn=t[155];let En;t[156]===_t?En=t[157]:(En=e=>{_t(e)},t[156]=_t,t[157]=En);let Dn=ht||gt,Q;t[158]!==H||t[159]!==En||t[160]!==Dn?(Q=(0,k.jsx)(oe,{asChild:!0,children:(0,k.jsx)(`span`,{className:`inline-flex`,children:(0,k.jsx)(Ce,{value:H,onChange:En,disabled:Dn,ariaLabel:`Logging`})})}),t[158]=H,t[159]=En,t[160]=Dn,t[161]=Q):Q=t[161];let On=H&&U?`max-w-sm cursor-pointer`:`max-w-sm`,kn;t[162]!==jt||t[163]!==H||t[164]!==U?(kn=H&&U?()=>void jt():void 0,t[162]=jt,t[163]=H,t[164]=U,t[165]=kn):kn=t[165];let An;t[166]!==H||t[167]!==U?(An=H&&U?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`p`,{children:`Click to copy log file path`}),(0,k.jsx)(`p`,{className:d(r.mono,`mt-1 break-all`),children:U})]}):(0,k.jsx)(`p`,{children:`Enable logging to write to a local file.`}),t[166]=H,t[167]=U,t[168]=An):An=t[168];let jn;t[169]!==On||t[170]!==kn||t[171]!==An?(jn=(0,k.jsx)(ie,{className:On,onClick:kn,children:An}),t[169]=On,t[170]=kn,t[171]=An,t[172]=jn):jn=t[172];let Mn;t[173]!==Q||t[174]!==jn?(Mn=(0,k.jsxs)(ae,{children:[Q,jn]}),t[173]=Q,t[174]=jn,t[175]=Mn):Mn=t[175];let Nn;t[176]!==mt||t[177]!==pt||t[178]!==H?(Nn=H&&pt&&mt&&(0,k.jsxs)(`p`,{className:`${r.bodyMuted} mt-3`,children:[`Also sending logs to Better Stack at`,` `,(0,k.jsx)(`span`,{className:r.mono,children:mt})]}),t[176]=mt,t[177]=pt,t[178]=H,t[179]=Nn):Nn=t[179];let Pn;t[180]!==Mn||t[181]!==Nn?(Pn=(0,k.jsx)(E,{title:`Logging`,description:`Write verbose application logs to a local file. When Better Stack environment variables are configured, logs are sent there too.`,controlLayout:`row-end`,action:Mn,children:Nn}),t[180]=Mn,t[181]=Nn,t[182]=Pn):Pn=t[182];let Fn=z===`network`,In;t[183]===$e?In=t[184]:(In=e=>{$e(e?`network`:`local`)},t[183]=$e,t[184]=In);let Ln=Ze||Qe,Rn;t[185]!==Fn||t[186]!==In||t[187]!==Ln?(Rn=(0,k.jsx)(Ce,{value:Fn,onChange:In,disabled:Ln,ariaLabel:`Mobile & Network Access`}),t[185]=Fn,t[186]=In,t[187]=Ln,t[188]=Rn):Rn=t[188];let zn;t[189]!==Mt||t[190]!==W||t[191]!==G||t[192]!==L||t[193]!==K?(zn=K&&G&&(0,k.jsxs)(`div`,{className:`mt-3`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsxs)(`p`,{className:r.bodyMuted,children:[`Available on the network at:`,` `,(0,k.jsx)(`span`,{className:r.mono,children:G})]}),(0,k.jsxs)(ae,{children:[(0,k.jsx)(oe,{asChild:!0,children:(0,k.jsxs)(`button`,{type:`button`,onClick:()=>void W(),className:`inline-flex h-7 w-7 items-center justify-center rounded-md border border-border bg-background/90 text-foreground shadow-sm transition-colors hover:bg-background`,children:[Mt?(0,k.jsx)(u,{className:`h-3.5 w-3.5 text-green-500`}):(0,k.jsx)(f,{className:`h-3.5 w-3.5`}),(0,k.jsx)(`span`,{className:`sr-only`,children:`Copy network URL`})]})}),(0,k.jsx)(ie,{children:Mt?`Copied!`:`Copy to clipboard`})]})]}),L&&(0,k.jsx)(`p`,{className:`${r.bodyMuted} mt-1`,children:`You will need to restart for this setting to take effect.`})]}),t[189]=Mt,t[190]=W,t[191]=G,t[192]=L,t[193]=K,t[194]=zn):zn=t[194];let Bn;t[195]!==R||t[196]!==z?(Bn=z===`network`&&R.length===0&&(0,k.jsx)(`p`,{className:`${r.bodyMuted} mt-3`,children:`No network IP addresses were detected on this computer.`}),t[195]=R,t[196]=z,t[197]=Bn):Bn=t[197];let Vn;t[198]!==L||t[199]!==z?(Vn=L&&z===`local`&&(0,k.jsx)(`p`,{className:`${r.bodyMuted} mt-3`,children:`You will need to restart for this setting to take effect.`}),t[198]=L,t[199]=z,t[200]=Vn):Vn=t[200];let Hn;t[201]!==Rn||t[202]!==zn||t[203]!==Bn||t[204]!==Vn?(Hn=(0,k.jsxs)(E,{title:`Mobile & Network Access`,description:`Allow the Tarsk mobile app or other web browsers to access Tarsk on the wifi network.`,controlLayout:`row-end`,action:Rn,children:[zn,Bn,Vn]}),t[201]=Rn,t[202]=zn,t[203]=Bn,t[204]=Vn,t[205]=Hn):Hn=t[205];let Un;t[206]!==_n||t[207]!==bn||t[208]!==Cn||t[209]!==wn||t[210]!==Tn||t[211]!==Pn||t[212]!==Hn?(Un=(0,k.jsxs)(ue,{className:`shrink-0`,children:[fn,(0,k.jsx)(ce,{className:`max-w-none pt-0`,children:(0,k.jsxs)(le,{children:[_n,bn,Cn,wn,Tn,Pn,Hn]})})]}),t[206]=_n,t[207]=bn,t[208]=Cn,t[209]=wn,t[210]=Tn,t[211]=Pn,t[212]=Hn,t[213]=Un):Un=t[213];let $;t[214]!==G||t[215]!==Pt?($=Pt?(0,k.jsxs)(ue,{className:`shrink-0`,children:[(0,k.jsx)(fe,{title:`Mobile App`,description:`Scan this code with the Tarsk mobile app to connect on your Wi-Fi network.`,sticky:!1}),(0,k.jsx)(`div`,{className:`flex flex-col items-center px-6 pb-6 pt-6`,children:(0,k.jsx)(`div`,{className:`rounded-lg bg-background p-3`,children:(0,k.jsx)(te,{value:G,size:128,bgColor:`hsl(var(--background))`,fgColor:`hsl(var(--foreground))`,level:`M`})})})]}):null,t[214]=G,t[215]=Pt,t[216]=$):$=t[216];let Wn;t[217]!==dn||t[218]!==Un||t[219]!==$?(Wn=(0,k.jsxs)(`div`,{className:`divide-y divide-table-border [&>*]:rounded-none`,children:[dn,Un,$]}),t[217]=dn,t[218]=Un,t[219]=$,t[220]=Wn):Wn=t[220];let Gn;return t[221]!==yt||t[222]!==Wn?(Gn=(0,k.jsx)(pe,{loading:yt,children:Wn}),t[221]=yt,t[222]=Wn,t[223]=Gn):Gn=t[223],Gn}function Ke(){}function qe(e){let t=e.icon;return(0,k.jsx)(de,{value:e.value,"aria-label":e.label,className:Ve,children:(0,k.jsx)(t,{className:`h-4 w-4`,"aria-hidden":`true`})},e.value)}function Je(e){let t=e.icon;return(0,k.jsx)(de,{value:e.value,"aria-label":e.label,className:Ve,children:(0,k.jsx)(t,{className:`h-4 w-4`,"aria-hidden":`true`})},e.value)}export{Ge as default};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,En as n,Fr as r,Jn as i,T as a,Ti as o,U as s,at as c,bt as l,hn as u,i as d,in as f,ln as p,mt as m,ot as h,sn as g,un as _,w as v,wi as ee}from"./interactive-WtOIgeV4.js";import{c as y,l as b,o as te,s as ne,u as re}from"./react-vendor-wGLyNWf9.js";import{Ct as ie,Qa as x,Si as S,St as ae,Tt as oe,Vn as C,_a as w,a as se,dt as ce,lt as le,mt as ue,o as de,pa as T,rt as fe,st as pe,tt as E,vo as me,wo as he,x as ge}from"./onboarding-dbhmRuxw.js";import{t as _e}from"./use-toast-BFQ85Ly5.js";import{n as ve}from"./utils-Rlf65JHq.js";import{U as ye,n as be,nt as xe,r as Se,rt as Ce,t as we,tt as Te,w as Ee}from"./index-B7qJtiRL.js";import{t as De}from"./use-settings-page-loading-BC_wP7pl.js";import{t as D}from"./is-macos-client-BIb4ZSEa.js";var Oe=ee(),O=e(o(),1),k=t(),ke=O.forwardRef((e,t)=>{let n=(0,Oe.c)(22),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,valueTooltip:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let[o,s]=O.useState(!1),[c,l]=O.useState(!1),u,f;n[4]===c?(u=n[5],f=n[6]):(u=()=>{if(!c)return;let e=function(){l(!1)};return document.addEventListener(`pointerup`,e),()=>{document.removeEventListener(`pointerup`,e)}},f=[c],n[4]=c,n[5]=u,n[6]=f),O.useEffect(u,f);let p;n[7]===a?p=n[8]:(p=(0,k.jsx)(b,{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`,onPointerDown:()=>{a!=null&&(l(!0),s(!0))}}),n[7]=a,n[8]=p);let m=p,h;n[9]===r?h=n[10]:(h=d(`relative flex w-full touch-none select-none items-center`,r),n[9]=r,n[10]=h);let g;n[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,k.jsx)(re,{className:`relative h-2 w-full grow overflow-hidden rounded-full bg-secondary`,children:(0,k.jsx)(ne,{className:`absolute h-full bg-primary`})}),n[11]=g):g=n[11];let _;n[12]!==c||n[13]!==o||n[14]!==m||n[15]!==a?(_=a==null?m:(0,k.jsxs)(ae,{open:o||c,onOpenChange:s,children:[(0,k.jsx)(oe,{asChild:!0,children:m}),(0,k.jsx)(ie,{side:`top`,children:a})]}),n[12]=c,n[13]=o,n[14]=m,n[15]=a,n[16]=_):_=n[16];let v;return n[17]!==i||n[18]!==t||n[19]!==h||n[20]!==_?(v=(0,k.jsxs)(y,{ref:t,className:h,...i,children:[g,_]}),n[17]=i,n[18]=t,n[19]=h,n[20]=_,n[21]=v):v=n[21],v});ke.displayName=y.displayName;var Ae=i(`app.use-maximum-turn-count.hook`),A=100;function je(){let[e,t]=(0,O.useState)(A),[n,r]=(0,O.useState)(A.toString()),[i,a]=(0,O.useState)(!0),[o,s]=(0,O.useState)(!1);(0,O.useEffect)(()=>{let e=!1;async function n(){try{let n=await C();e||(t(n.maximumTurnCount),r(n.maximumTurnCount.toString()))}catch(e){Ae.error(`Failed to load maximum turn count:`,e)}finally{e||a(!1)}}return n(),()=>{e=!0}},[]);function c(e){r(e)}async function l(e){s(!0);try{let n=await S({maximumTurnCount:e});t(n.maximumTurnCount),r(n.maximumTurnCount.toString())}catch(e){throw Ae.error(`Failed to update maximum turn count:`,e),e}finally{s(!1)}}function u(){r(e.toString())}return{defaultMaximumTurnCount:A,draftMaximumTurnCount:n,isLoading:i,isSaving:o,maximumTurnCount:e,resetDraftMaximumTurnCount:u,setDraftMaximumTurnCount:c,updateMaximumTurnCount:l}}var j=i(`app.use-screen-recording-permission.hook`),M={isMacOS:!1,granted:!1,available:!1,message:``};function Me(){return{...M,isMacOS:D()}}function Ne(){let[e,t]=(0,O.useState)(Me),[n,r]=(0,O.useState)(!0),[i,a]=(0,O.useState)(null),[o,s]=(0,O.useState)(!1),[c,l]=(0,O.useState)(null),u=(0,O.useCallback)(async()=>{r(!0),a(null);try{t(await T(`api/system-permissions/screen-recording`))}catch(e){a(e instanceof Error?e.message:`Failed to check screen recording permission`),t(e=>({...M,isMacOS:e?.isMacOS??D(),message:`Unable to check permission status.`}))}finally{r(!1)}},[]);return(0,O.useEffect)(()=>{u()},[u]),{status:e,isLoading:n,error:i,isOpeningSettings:o,openSettingsError:c,refresh:u,openSystemSettings:(0,O.useCallback)(async()=>{s(!0),l(null);try{let e=await w(`api/system-permissions/screen-recording/open-settings`,{});if(!e.success){let t=e.message||`Failed to open System Settings`;j.error(`[useScreenRecordingPermission] ${t}`,e.error),l(t)}}catch(e){let t=e instanceof Error?e.message:`Failed to open System Settings`;j.error(`[useScreenRecordingPermission] Error opening System Settings:`,e),l(t)}finally{s(!1)}},[])}}var Pe=i(`app.use-server-bind-mode.hook`),Fe=`local`,N=`tarsk-server-bind-mode-changed`;function Ie(e){me(e)}function P(){if(typeof window>`u`)return!1;try{return sessionStorage.getItem(N)===`true`}catch{return!1}}function F(e){if(!(typeof window>`u`))try{e?sessionStorage.setItem(N,`true`):sessionStorage.removeItem(N)}catch{}}function Le(){let[e,t]=(0,O.useState)(()=>x()?.serverBindMode??Fe),[n,r]=(0,O.useState)(null),[i,a]=(0,O.useState)(()=>x()?.networkAddresses??[]),[o,s]=(0,O.useState)(()=>x()===null),[c,l]=(0,O.useState)(!1),[u,d]=(0,O.useState)(P);(0,O.useEffect)(()=>{let e=!1;async function n(){try{let n=await C();e||(t(n.serverBindMode),r(n.serverBindMode),a(n.networkAddresses),Ie({networkAddresses:n.networkAddresses,serverBindMode:n.serverBindMode}))}catch(e){Pe.error(`Failed to load server bind mode:`,e)}finally{e||s(!1)}}return n(),()=>{e=!0}},[]);async function f(e){l(!0);try{let n=await S({serverBindMode:e});t(n.serverBindMode),a(n.networkAddresses),Ie({networkAddresses:n.networkAddresses,serverBindMode:n.serverBindMode}),d(!0),F(!0)}catch(e){throw Pe.error(`Failed to update server bind mode:`,e),e}finally{l(!1)}}let p=n!==null&&e!==n;return{defaultServerBindMode:Fe,hasServerBindModeChanged:p,isLoading:o,isSaving:c,needsRestart:p||u,networkAddresses:i,serverBindMode:e,updateServerBindMode:f}}var I=i(`app.use-logging.hook`);function Re(){let[e,t]=(0,O.useState)(!1),[n,r]=(0,O.useState)(null),[i,a]=(0,O.useState)(!1),[o,s]=(0,O.useState)(null),[c,l]=(0,O.useState)(!0),[u,d]=(0,O.useState)(!1);(0,O.useEffect)(()=>{let e=!1;async function n(){try{let n=await C();e||(t(n.loggingEnabled),r(n.fileLoggingPath),a(n.betterStackEnvConfigured),s(n.betterStackIngestingHost))}catch(e){I.error(`Failed to load logging setting:`,e)}finally{e||l(!1)}}return n(),()=>{e=!0}},[]);async function f(e){d(!0);try{let n=await S({loggingEnabled:e});t(n.loggingEnabled),r(n.fileLoggingPath),a(n.betterStackEnvConfigured),s(n.betterStackIngestingHost)}catch(e){throw I.error(`Failed to update logging setting:`,e),e}finally{d(!1)}}return{ingestingHost:o,isEnabled:e,isEnvConfigured:i,isLoading:c,isSaving:u,logPath:n,updateIsEnabled:f}}var ze=[{value:`light`,label:`Light`,icon:v},{value:`dark`,label:`Dark`,icon:c},{value:`system`,label:`System`,icon:a}],Be=[{value:`image`,label:`Image`,icon:l},{value:`background`,label:`Background`,icon:n}],Ve=`flex h-7 w-7 min-h-0 min-w-0 items-center justify-center rounded-full border-0 bg-background p-0 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm hover:bg-background hover:text-muted-foreground data-[state=on]:hover:bg-foreground data-[state=on]:hover:text-background`,He=`inline-flex h-auto w-fit justify-start rounded-full border-0 bg-background p-1 text-muted-foreground`,Ue=[`462`,`8100`].includes(typeof document<`u`?document.location.port:``)?`462`:`641`,We=600;function Ge(e){let t=(0,Oe.c)(224),{onboardingResetSignal:n}=e,i=n===void 0?0:n,[a,o]=(0,O.useState)(!1),{theme:c,setTheme:l}=ve(),{scale:v,updateScale:ee,min:y,max:b}=Se(),{opacity:ne,updateOpacity:re,min:x,max:S}=be(),{mode:C,color:w,updateMode:T,updateColor:me}=ye(),{color:D,updateColor:Ae,resetColor:A}=we(),{defaultMaximumTurnCount:j,draftMaximumTurnCount:M,isLoading:Me,isSaving:Pe,resetDraftMaximumTurnCount:Fe,setDraftMaximumTurnCount:N,updateMaximumTurnCount:Ie}=je(),{status:P,isLoading:F,isOpeningSettings:I,openSettingsError:Ge,refresh:Ye,openSystemSettings:Xe}=Ne(),{isLoading:Ze,isSaving:Qe,needsRestart:L,networkAddresses:R,serverBindMode:z,updateServerBindMode:$e}=Le(),{isEnabled:et,isLoading:tt,isSaving:nt,updateIsEnabled:rt}=Te(),{isEnabled:it,isLoading:at,isSaving:ot,updateIsEnabled:st}=Ee(),{isEnabled:ct,isSupported:lt,isHealthy:B,statusMessage:ut,isLoading:V,isSaving:dt,updateIsEnabled:ft}=xe(),{isEnabled:H,logPath:U,isEnvConfigured:pt,ingestingHost:mt,isLoading:ht,isSaving:gt,updateIsEnabled:_t}=Re(),vt;t[0]!==ht||t[1]!==Me||t[2]!==F||t[3]!==V||t[4]!==Ze||t[5]!==at||t[6]!==tt?(vt=[Me,F,Ze,tt,at,V,ht],t[0]=ht,t[1]=Me,t[2]=F,t[3]=V,t[4]=Ze,t[5]=at,t[6]=tt,t[7]=vt):vt=t[7];let yt=De(`general`,vt),bt,xt;t[8]===i?(bt=t[9],xt=t[10]):(bt=()=>{if(i===0)return;o(!0);let e=setTimeout(()=>{o(!1)},We);return()=>{clearTimeout(e)}},xt=[i],t[8]=i,t[9]=bt,t[10]=xt),(0,O.useEffect)(bt,xt);let St;t[11]===N?St=t[12]:(St=function(e){N(e.target.value)},t[11]=N,t[12]=St);let Ct=St,wt;t[13]!==j||t[14]!==M||t[15]!==Fe||t[16]!==Ie?(wt=async function(){let e=Number.parseInt(M,10),t=Number.isFinite(e)&&e>0?e:j;try{await Ie(t)}catch{Fe()}},t[13]=j,t[14]=M,t[15]=Fe,t[16]=Ie,t[17]=wt):wt=t[17];let Tt=wt,Et;t[18]===ee?Et=t[19]:(Et=function(e){e.length>0&&ee(e[0])},t[18]=ee,t[19]=Et);let Dt=Et,Ot;t[20]===re?Ot=t[21]:(Ot=function(e){e.length>0&&re(e[0])},t[20]=re,t[21]=Ot);let kt=Ot,At;t[22]===U?At=t[23]:(At=async function(){if(U)try{await navigator.clipboard.writeText(U),_e({title:`Copied`,description:`Log file path copied to clipboard.`})}catch(e){let t=e;_e({title:`Copy failed`,description:t instanceof Error?t.message:`Could not copy the log file path.`,variant:`destructive`})}},t[22]=U,t[23]=At);let jt=At,[Mt,Nt]=(0,O.useState)(!1),W,G,K;t[24]!==R||t[25]!==z?(W=async function(){if(G)try{await navigator.clipboard.writeText(G),Nt(!0),_e({title:`Copied`,description:`Network URL copied to clipboard.`}),window.setTimeout(()=>{Nt(!1)},1500)}catch(e){let t=e;_e({title:`Copy failed`,description:t instanceof Error?t.message:`Could not copy the network URL.`,variant:`destructive`})}},K=z===`network`&&R.length>0,G=K?`http://${R[0]}:${Ue}`:null,t[24]=R,t[25]=z,t[26]=W,t[27]=G,t[28]=K):(W=t[26],G=t[27],K=t[28]);let Pt=K&&G,Ft=a&&`animate-headline-reset`,q;t[29]===Ft?q=t[30]:(q=d(Ft),t[29]=Ft,t[30]=q);let J;t[31]===q?J=t[32]:(J=(0,k.jsx)(fe,{title:`Appearance`,titleClassName:q,className:`[&>div:first-child]:py-2`,sticky:!1}),t[31]=q,t[32]=J);let Y;t[33]===y?Y=t[34]:(Y=(0,k.jsxs)(`span`,{className:`${r.bodyMuted} w-8 shrink-0 text-right`,children:[y,`%`]}),t[33]=y,t[34]=Y);let X;t[35]===v?X=t[36]:(X=[v],t[35]=v,t[36]=X);let It=`${v}%`,Z;t[37]!==Dt||t[38]!==b||t[39]!==y||t[40]!==X||t[41]!==It?(Z=(0,k.jsx)(ke,{value:X,min:y,max:b,step:5,onValueChange:Dt,"aria-label":`Font size`,valueTooltip:It}),t[37]=Dt,t[38]=b,t[39]=y,t[40]=X,t[41]=It,t[42]=Z):Z=t[42];let Lt;t[43]===b?Lt=t[44]:(Lt=(0,k.jsxs)(`span`,{className:`${r.bodyMuted} w-9 shrink-0`,children:[b,`%`]}),t[43]=b,t[44]=Lt);let Rt;t[45]!==Y||t[46]!==Z||t[47]!==Lt?(Rt=(0,k.jsx)(E,{title:`Font Size`,description:`Adjust the text size across the entire application.`,children:(0,k.jsxs)(`div`,{className:`ml-auto flex w-1/2 items-center gap-3`,children:[Y,Z,Lt]})}),t[45]=Y,t[46]=Z,t[47]=Lt,t[48]=Rt):Rt=t[48];let zt;t[49]===x?zt=t[50]:(zt=(0,k.jsxs)(`span`,{className:`${r.bodyMuted} w-8 shrink-0 text-right`,children:[x,`%`]}),t[49]=x,t[50]=zt);let Bt;t[51]===ne?Bt=t[52]:(Bt=[ne],t[51]=ne,t[52]=Bt);let Vt=`${ne}%`,Ht;t[53]!==S||t[54]!==x||t[55]!==kt||t[56]!==Bt||t[57]!==Vt?(Ht=(0,k.jsx)(ke,{value:Bt,min:x,max:S,step:5,onValueChange:kt,"aria-label":`Panel opacity`,valueTooltip:Vt}),t[53]=S,t[54]=x,t[55]=kt,t[56]=Bt,t[57]=Vt,t[58]=Ht):Ht=t[58];let Ut;t[59]===S?Ut=t[60]:(Ut=(0,k.jsxs)(`span`,{className:`${r.bodyMuted} w-9 shrink-0`,children:[S,`%`]}),t[59]=S,t[60]=Ut);let Wt;t[61]!==zt||t[62]!==Ht||t[63]!==Ut?(Wt=(0,k.jsx)(E,{title:`Panel Opacity`,description:`Adjust how opaque the frosted panels are over the wallpaper.`,children:(0,k.jsxs)(`div`,{className:`ml-auto flex w-1/2 items-center gap-3`,children:[zt,Ht,Ut]})}),t[61]=zt,t[62]=Ht,t[63]=Ut,t[64]=Wt):Wt=t[64];let Gt;t[65]===l?Gt=t[66]:(Gt=e=>{(e===`light`||e===`dark`||e===`system`)&&l(e)},t[65]=l,t[66]=Gt);let Kt;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(Kt=ze.map(Je),t[67]=Kt):Kt=t[67];let qt;t[68]!==Gt||t[69]!==c?(qt=(0,k.jsx)(E,{title:`Appearance`,description:`Choose your preferred color scheme.`,controlLayout:`row-end`,action:(0,k.jsx)(se,{type:`single`,value:c,onValueChange:Gt,"aria-label":`Appearance`,className:He,children:Kt})}),t[68]=Gt,t[69]=c,t[70]=qt):qt=t[70];let Jt;t[71]===T?Jt=t[72]:(Jt=e=>{(e===`image`||e===`background`||e===`color`)&&T(e)},t[71]=T,t[72]=Jt);let Yt;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(Yt=Be.map(qe),t[73]=Yt):Yt=t[73];let Xt;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(Xt=d(Ve,`relative overflow-hidden`),t[74]=Xt):Xt=t[74];let Zt;t[75]===w?Zt=t[76]:(Zt=(0,k.jsx)(`span`,{className:`pointer-events-none h-4 w-4 rounded-full border border-black/25 dark:border-white/25`,style:{backgroundColor:w},"aria-hidden":`true`}),t[75]=w,t[76]=Zt);let Qt;t[77]===T?Qt=t[78]:(Qt=()=>{T(`color`)},t[77]=T,t[78]=Qt);let $t;t[79]!==me||t[80]!==T?($t=e=>{me(e.target.value),T(`color`)},t[79]=me,t[80]=T,t[81]=$t):$t=t[81];let en;t[82]!==Qt||t[83]!==$t||t[84]!==w?(en=(0,k.jsx)(`input`,{type:`color`,value:w,"aria-label":`Choose wallpaper color`,className:`absolute inset-0 cursor-pointer opacity-0`,onPointerDown:Qt,onChange:$t}),t[82]=Qt,t[83]=$t,t[84]=w,t[85]=en):en=t[85];let tn;t[86]!==Zt||t[87]!==en?(tn=(0,k.jsxs)(de,{value:`color`,"aria-label":`Custom color`,className:Xt,children:[Zt,en]}),t[86]=Zt,t[87]=en,t[88]=tn):tn=t[88];let nn;t[89]!==Jt||t[90]!==tn||t[91]!==C?(nn=(0,k.jsx)(E,{title:`Wallpaper`,description:`Choose a scenic image, the theme background, or a custom color.`,controlLayout:`row-end`,action:(0,k.jsxs)(se,{type:`single`,value:C,onValueChange:Jt,"aria-label":`Wallpaper`,className:He,children:[Yt,tn]})}),t[89]=Jt,t[90]=tn,t[91]=C,t[92]=nn):nn=t[92];let rn;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(rn=d(Ve,`relative cursor-pointer overflow-hidden`),t[93]=rn):rn=t[93];let an;t[94]===D?an=t[95]:(an=(0,k.jsx)(`span`,{className:`pointer-events-none h-4 w-4 rounded-full border border-black/25 dark:border-white/25`,style:{backgroundColor:D},"aria-hidden":`true`}),t[94]=D,t[95]=an);let on;t[96]===Ae?on=t[97]:(on=e=>{Ae(e.target.value)},t[96]=Ae,t[97]=on);let sn;t[98]!==D||t[99]!==on?(sn=(0,k.jsx)(`input`,{type:`color`,value:D,"aria-label":`Primary color`,className:`absolute inset-0 cursor-pointer opacity-0`,onChange:on}),t[98]=D,t[99]=on,t[100]=sn):sn=t[100];let cn;t[101]!==an||t[102]!==sn?(cn=(0,k.jsx)(`div`,{className:He,children:(0,k.jsxs)(`label`,{className:rn,children:[an,sn]})}),t[101]=an,t[102]=sn,t[103]=cn):cn=t[103];let ln;t[104]!==A||t[105]!==cn?(ln=(0,k.jsx)(E,{title:`Primary Color`,description:`Choose the primary accent color used across the app. Click the label to reset to default.`,controlLayout:`row-end`,onTitleClick:A,action:cn}),t[104]=A,t[105]=cn,t[106]=ln):ln=t[106];let un;t[107]!==Rt||t[108]!==Wt||t[109]!==qt||t[110]!==nn||t[111]!==ln?(un=(0,k.jsx)(ce,{className:`max-w-none pt-0`,children:(0,k.jsxs)(le,{children:[Rt,Wt,qt,nn,ln]})}),t[107]=Rt,t[108]=Wt,t[109]=qt,t[110]=nn,t[111]=ln,t[112]=un):un=t[112];let dn;t[113]!==J||t[114]!==un?(dn=(0,k.jsxs)(ue,{className:`shrink-0`,children:[J,un]}),t[113]=J,t[114]=un,t[115]=dn):dn=t[115];let fn;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(fn=(0,k.jsx)(fe,{title:`Settings`,className:`[&>div:first-child]:py-2`,sticky:!1}),t[116]=fn):fn=t[116];let pn=`Set how many turns a long-running agent chat can take before Tarsk asks whether to continue. Default: ${j} turns.`,mn;t[117]===Tt?mn=t[118]:(mn=()=>{Tt()},t[117]=Tt,t[118]=mn);let hn=Me||Pe,gn;t[119]!==M||t[120]!==Ct||t[121]!==mn||t[122]!==hn?(gn=(0,k.jsx)(ge,{type:`number`,min:1,step:1,value:M,onChange:Ct,onBlur:mn,disabled:hn,"aria-label":`Maximum turn count`,className:`w-28 text-right font-mono tabular-nums flex-shrink-0`}),t[119]=M,t[120]=Ct,t[121]=mn,t[122]=hn,t[123]=gn):gn=t[123];let _n;t[124]!==pn||t[125]!==gn?(_n=(0,k.jsx)(E,{title:`Maximum Turn Count`,description:pn,controlLayout:`row-end`,action:gn}),t[124]=pn,t[125]=gn,t[126]=_n):_n=t[126];let vn;t[127]===rt?vn=t[128]:(vn=e=>{rt(e)},t[127]=rt,t[128]=vn);let yn=tt||nt,bn;t[129]!==vn||t[130]!==yn||t[131]!==et?(bn=(0,k.jsx)(E,{title:`AI Voice Cleanup`,description:`After stopping voice recording, run the transcription through AI to remove filler words, false starts, and repetitions.`,controlLayout:`row-end`,action:(0,k.jsx)(Ce,{value:et,onChange:vn,disabled:yn,ariaLabel:`AI Voice Cleanup`})}),t[129]=vn,t[130]=yn,t[131]=et,t[132]=bn):bn=t[132];let xn;t[133]===st?xn=t[134]:(xn=e=>{st(e)},t[133]=st,t[134]=xn);let Sn=at||ot,Cn;t[135]!==it||t[136]!==xn||t[137]!==Sn?(Cn=(0,k.jsx)(E,{title:`Spend`,description:`Show an estimated spend counter in the chat header.`,controlLayout:`row-end`,action:(0,k.jsx)(Ce,{value:it,onChange:xn,disabled:Sn,ariaLabel:`Spend`})}),t[135]=it,t[136]=xn,t[137]=Sn,t[138]=Cn):Cn=t[138];let wn;t[139]!==I||t[140]!==F||t[141]!==Xe||t[142]!==Ye||t[143]!==Ge||t[144]!==P?.granted||t[145]!==P?.isMacOS||t[146]!==P?.message?(wn=P?.isMacOS&&(0,k.jsx)(E,{title:`Screen & Audio Recording`,description:`Tarsk needs this macOS permission to capture screen content for browser tools and screen sharing features.`,controlLayout:`row-end`,action:(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!F&&P?.granted?(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(p,{className:`h-4 w-4 text-green-500`}),(0,k.jsx)(`span`,{className:d(r.body,`text-green-600 dark:text-green-400`),children:`Permission granted`})]}):F?null:(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(g,{className:`h-4 w-4 text-amber-500`}),(0,k.jsx)(`span`,{className:d(r.body,`text-amber-600 dark:text-amber-400`),children:`Permission not granted`})]}),(0,k.jsxs)(he,{variant:`ghost`,size:`icon-sm`,className:`h-7 w-7 shrink-0 rounded-full border-0 bg-background hover:bg-background hover:text-foreground`,onClick:()=>void Ye(),disabled:F,children:[F?(0,k.jsx)(m,{className:`h-3.5 w-3.5 animate-spin`}):(0,k.jsx)(s,{className:`h-3.5 w-3.5`}),(0,k.jsx)(`span`,{className:`sr-only`,children:`Refresh permission status`})]})]}),children:!F&&!P?.granted?(0,k.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,k.jsx)(`p`,{className:r.bodyMuted,children:P?.message??`Tarsk needs Screen & Audio Recording permission to use browser tools.`}),(0,k.jsx)(he,{size:`sm`,onClick:()=>void Xe(),disabled:I,className:`w-fit`,children:I?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(m,{className:`h-4 w-4 mr-2 animate-spin`}),`Opening Settings...`]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(h,{className:`h-4 w-4 mr-2`}),`Open System Settings`]})}),Ge&&(0,k.jsxs)(`div`,{className:`flex items-start gap-2 p-3 rounded-md bg-destructive/10 text-destructive`,children:[(0,k.jsx)(_,{className:`h-4 w-4 mt-0.5 flex-shrink-0`}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,k.jsx)(`p`,{className:r.body,children:`Failed to open System Settings`}),(0,k.jsx)(`p`,{className:r.bodyMuted,children:Ge}),(0,k.jsxs)(`p`,{className:r.bodyMuted,children:[`Please open it manually:`,` `,(0,k.jsx)(`strong`,{children:`System Settings > Privacy & Security > Screen & System Audio Recording`})]})]})]})]}):null}),t[139]=I,t[140]=F,t[141]=Xe,t[142]=Ye,t[143]=Ge,t[144]=P?.granted,t[145]=P?.isMacOS,t[146]=P?.message,t[147]=wn):wn=t[147];let Tn;t[148]!==V||t[149]!==dt||t[150]!==ct||t[151]!==B||t[152]!==ut||t[153]!==lt||t[154]!==ft?(Tn=lt&&(0,k.jsx)(E,{title:`Sandbox`,description:`Sandbox tools like bash and skill script execution to allow running and testing code safely without risking your system, files, or data.`,controlLayout:`row-end`,action:(0,k.jsx)(Ce,{value:ct&&B,onChange:e=>{e&&!B||ft(e).catch(Ke)},disabled:V||dt,disableOn:!B,ariaLabel:`Sandbox`}),children:!V&&!B?(0,k.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,k.jsx)(g,{className:`h-4 w-4 mt-0.5 shrink-0`}),(0,k.jsx)(`p`,{className:r.bodyMuted,children:ut||`Seatbelt sandbox failed its health check and cannot be enabled.`})]}):null}),t[148]=V,t[149]=dt,t[150]=ct,t[151]=B,t[152]=ut,t[153]=lt,t[154]=ft,t[155]=Tn):Tn=t[155];let En;t[156]===_t?En=t[157]:(En=e=>{_t(e)},t[156]=_t,t[157]=En);let Dn=ht||gt,Q;t[158]!==H||t[159]!==En||t[160]!==Dn?(Q=(0,k.jsx)(oe,{asChild:!0,children:(0,k.jsx)(`span`,{className:`inline-flex`,children:(0,k.jsx)(Ce,{value:H,onChange:En,disabled:Dn,ariaLabel:`Logging`})})}),t[158]=H,t[159]=En,t[160]=Dn,t[161]=Q):Q=t[161];let On=H&&U?`max-w-sm cursor-pointer`:`max-w-sm`,kn;t[162]!==jt||t[163]!==H||t[164]!==U?(kn=H&&U?()=>void jt():void 0,t[162]=jt,t[163]=H,t[164]=U,t[165]=kn):kn=t[165];let An;t[166]!==H||t[167]!==U?(An=H&&U?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`p`,{children:`Click to copy log file path`}),(0,k.jsx)(`p`,{className:d(r.mono,`mt-1 break-all`),children:U})]}):(0,k.jsx)(`p`,{children:`Enable logging to write to a local file.`}),t[166]=H,t[167]=U,t[168]=An):An=t[168];let jn;t[169]!==On||t[170]!==kn||t[171]!==An?(jn=(0,k.jsx)(ie,{className:On,onClick:kn,children:An}),t[169]=On,t[170]=kn,t[171]=An,t[172]=jn):jn=t[172];let Mn;t[173]!==Q||t[174]!==jn?(Mn=(0,k.jsxs)(ae,{children:[Q,jn]}),t[173]=Q,t[174]=jn,t[175]=Mn):Mn=t[175];let Nn;t[176]!==mt||t[177]!==pt||t[178]!==H?(Nn=H&&pt&&mt&&(0,k.jsxs)(`p`,{className:`${r.bodyMuted} mt-3`,children:[`Also sending logs to Better Stack at`,` `,(0,k.jsx)(`span`,{className:r.mono,children:mt})]}),t[176]=mt,t[177]=pt,t[178]=H,t[179]=Nn):Nn=t[179];let Pn;t[180]!==Mn||t[181]!==Nn?(Pn=(0,k.jsx)(E,{title:`Logging`,description:`Write verbose application logs to a local file. When Better Stack environment variables are configured, logs are sent there too.`,controlLayout:`row-end`,action:Mn,children:Nn}),t[180]=Mn,t[181]=Nn,t[182]=Pn):Pn=t[182];let Fn=z===`network`,In;t[183]===$e?In=t[184]:(In=e=>{$e(e?`network`:`local`)},t[183]=$e,t[184]=In);let Ln=Ze||Qe,Rn;t[185]!==Fn||t[186]!==In||t[187]!==Ln?(Rn=(0,k.jsx)(Ce,{value:Fn,onChange:In,disabled:Ln,ariaLabel:`Mobile & Network Access`}),t[185]=Fn,t[186]=In,t[187]=Ln,t[188]=Rn):Rn=t[188];let zn;t[189]!==Mt||t[190]!==W||t[191]!==G||t[192]!==L||t[193]!==K?(zn=K&&G&&(0,k.jsxs)(`div`,{className:`mt-3`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsxs)(`p`,{className:r.bodyMuted,children:[`Available on the network at:`,` `,(0,k.jsx)(`span`,{className:r.mono,children:G})]}),(0,k.jsxs)(ae,{children:[(0,k.jsx)(oe,{asChild:!0,children:(0,k.jsxs)(`button`,{type:`button`,onClick:()=>void W(),className:`inline-flex h-7 w-7 items-center justify-center rounded-md border border-border bg-background/90 text-foreground shadow-sm transition-colors hover:bg-background`,children:[Mt?(0,k.jsx)(u,{className:`h-3.5 w-3.5 text-green-500`}):(0,k.jsx)(f,{className:`h-3.5 w-3.5`}),(0,k.jsx)(`span`,{className:`sr-only`,children:`Copy network URL`})]})}),(0,k.jsx)(ie,{children:Mt?`Copied!`:`Copy to clipboard`})]})]}),L&&(0,k.jsx)(`p`,{className:`${r.bodyMuted} mt-1`,children:`You will need to restart for this setting to take effect.`})]}),t[189]=Mt,t[190]=W,t[191]=G,t[192]=L,t[193]=K,t[194]=zn):zn=t[194];let Bn;t[195]!==R||t[196]!==z?(Bn=z===`network`&&R.length===0&&(0,k.jsx)(`p`,{className:`${r.bodyMuted} mt-3`,children:`No network IP addresses were detected on this computer.`}),t[195]=R,t[196]=z,t[197]=Bn):Bn=t[197];let Vn;t[198]!==L||t[199]!==z?(Vn=L&&z===`local`&&(0,k.jsx)(`p`,{className:`${r.bodyMuted} mt-3`,children:`You will need to restart for this setting to take effect.`}),t[198]=L,t[199]=z,t[200]=Vn):Vn=t[200];let Hn;t[201]!==Rn||t[202]!==zn||t[203]!==Bn||t[204]!==Vn?(Hn=(0,k.jsxs)(E,{title:`Mobile & Network Access`,description:`Allow the Tarsk mobile app or other web browsers to access Tarsk on the wifi network.`,controlLayout:`row-end`,action:Rn,children:[zn,Bn,Vn]}),t[201]=Rn,t[202]=zn,t[203]=Bn,t[204]=Vn,t[205]=Hn):Hn=t[205];let Un;t[206]!==_n||t[207]!==bn||t[208]!==Cn||t[209]!==wn||t[210]!==Tn||t[211]!==Pn||t[212]!==Hn?(Un=(0,k.jsxs)(ue,{className:`shrink-0`,children:[fn,(0,k.jsx)(ce,{className:`max-w-none pt-0`,children:(0,k.jsxs)(le,{children:[_n,bn,Cn,wn,Tn,Pn,Hn]})})]}),t[206]=_n,t[207]=bn,t[208]=Cn,t[209]=wn,t[210]=Tn,t[211]=Pn,t[212]=Hn,t[213]=Un):Un=t[213];let $;t[214]!==G||t[215]!==Pt?($=Pt?(0,k.jsxs)(ue,{className:`shrink-0`,children:[(0,k.jsx)(fe,{title:`Mobile App`,description:`Scan this code with the Tarsk mobile app to connect on your Wi-Fi network.`,sticky:!1}),(0,k.jsx)(`div`,{className:`flex flex-col items-center px-6 pb-6 pt-6`,children:(0,k.jsx)(`div`,{className:`rounded-lg bg-background p-3`,children:(0,k.jsx)(te,{value:G,size:128,bgColor:`hsl(var(--background))`,fgColor:`hsl(var(--foreground))`,level:`M`})})})]}):null,t[214]=G,t[215]=Pt,t[216]=$):$=t[216];let Wn;t[217]!==dn||t[218]!==Un||t[219]!==$?(Wn=(0,k.jsxs)(`div`,{className:`divide-y divide-table-border [&>*]:rounded-none`,children:[dn,Un,$]}),t[217]=dn,t[218]=Un,t[219]=$,t[220]=Wn):Wn=t[220];let Gn;return t[221]!==yt||t[222]!==Wn?(Gn=(0,k.jsx)(pe,{loading:yt,children:Wn}),t[221]=yt,t[222]=Wn,t[223]=Gn):Gn=t[223],Gn}function Ke(){}function qe(e){let t=e.icon;return(0,k.jsx)(de,{value:e.value,"aria-label":e.label,className:Ve,children:(0,k.jsx)(t,{className:`h-4 w-4`,"aria-hidden":`true`})},e.value)}function Je(e){let t=e.icon;return(0,k.jsx)(de,{value:e.value,"aria-label":e.label,className:Ve,children:(0,k.jsx)(t,{className:`h-4 w-4`,"aria-hidden":`true`})},e.value)}export{Ge as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,Fr as n,Ti as r,i,mt as a}from"./interactive-WtOIgeV4.js";import{Tr as o,at as s,dt as c,ii as l,ot as u,rt as d,ut as f,wo as p}from"./onboarding-dbhmRuxw.js";import{r as m}from"./store-CSyJjyNs.js";import{t as h}from"./use-toast-BFQ85Ly5.js";import{K as g}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,Fr as n,Ti as r,i,mt as a}from"./interactive-WtOIgeV4.js";import{Tr as o,at as s,dt as c,ii as l,ot as u,rt as d,ut as f,wo as p}from"./onboarding-dbhmRuxw.js";import{r as m}from"./store-CSyJjyNs.js";import{t as h}from"./use-toast-BFQ85Ly5.js";import{K as g}from"./index-B7qJtiRL.js";import{t as _}from"./use-settings-page-loading-BC_wP7pl.js";var v=e(r(),1),y=t();function b(){let e=m(e=>e.selectedThreadId),[t,r]=(0,v.useState)(``),[b,x]=(0,v.useState)(!0),[S,C]=(0,v.useState)(!1);(0,v.useLayoutEffect)(()=>{e&&x(!0)},[e]),(0,v.useEffect)(()=>{if(!e){x(!1);return}x(!0),o(e,`AGENTS.md`).then(e=>r(e.content)).catch(()=>r(``)).finally(()=>x(!1))},[e]);let w=_(e,[b]);async function T(){if(e){C(!0);try{await l(e,`AGENTS.md`,t),h({title:`Instructions saved`})}catch(e){h({title:`Error`,description:e instanceof Error?e.message:`Failed to save instructions`,variant:`destructive`})}finally{C(!1)}}}return e?(0,y.jsx)(u,{loading:w,children:(0,y.jsx)(s,{children:(0,y.jsxs)(c,{className:`w-full flex-1 flex flex-col min-h-0 pt-0`,children:[(0,y.jsx)(d,{title:`Instructions`,description:`Agent context and coding guidelines, stored in AGENTS.md.`,sticky:!1,action:(0,y.jsx)(p,{onClick:T,disabled:S,children:S?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`})}),(0,y.jsx)(g,{value:t,onChange:e=>r(e.target.value),className:i(n.mono,`frosted-scrollbar flex-1 min-h-0 resize-none`),placeholder:`Add instructions for your agent in AGENTS.md...`,disabled:S})]})})}):(0,y.jsx)(f,{children:`Select a thread to edit instructions.`})}export{b as SettingsInstructionsView,b as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,Fr as n,L as r,Ti as i,Y as a,f as o,i as s,y as c}from"./interactive-WtOIgeV4.js";import{Ct as l,D as u,Jr as ee,Qt as d,St as f,T as p,Tt as te,_ as m,dt as h,er as g,et as ne,h as _,m as re,mt as v,p as y,pt as ie,rt as b,st as x,tt as S,ut as C,v as w,wo as T,wt as E,x as D}from"./onboarding-dbhmRuxw.js";import{r as O}from"./store-CSyJjyNs.js";import{t as k}from"./use-toast-BFQ85Ly5.js";import{n as ae}from"./explorer-tab-context-8bs_tiCO.js";import{D as oe,E as A,K as j,O as M,St as N,T as se,b as P,v as ce,x as le,y as F}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,Fr as n,L as r,Ti as i,Y as a,f as o,i as s,y as c}from"./interactive-WtOIgeV4.js";import{Ct as l,D as u,Jr as ee,Qt as d,St as f,T as p,Tt as te,_ as m,dt as h,er as g,et as ne,h as _,m as re,mt as v,p as y,pt as ie,rt as b,st as x,tt as S,ut as C,v as w,wo as T,wt as E,x as D}from"./onboarding-dbhmRuxw.js";import{r as O}from"./store-CSyJjyNs.js";import{t as k}from"./use-toast-BFQ85Ly5.js";import{n as ae}from"./explorer-tab-context-8bs_tiCO.js";import{D as oe,E as A,K as j,O as M,St as N,T as se,b as P,v as ce,x as le,y as F}from"./index-B7qJtiRL.js";import{t as I}from"./delete-confirm-dialog-Dy0dOtPe.js";import{t as L}from"./use-settings-page-loading-BC_wP7pl.js";import{a as R,i as z,n as B,o as V}from"./settings-list-C5MACtux.js";import{t as H}from"./mcp-server-card-V4Ddsgv3.js";var U=e(i(),1),W=t();function G(e){return e?.url?`remote`:`local`}function K(e){return Object.entries(e??{}).map(([e,t])=>({key:e,value:t}))}function q({projectPath:e,serverName:t,initialName:r,initialConfig:i,onBack:s}){let{installedServers:c}=le(e),l=!!t,[u,ee]=(0,U.useState)(`local`),[d,f]=(0,U.useState)(``),[p,te]=(0,U.useState)(``),[h,g]=(0,U.useState)(``),[v,x]=(0,U.useState)(``),[C,E]=(0,U.useState)(`sse`),[O,ae]=(0,U.useState)(``),[N,P]=(0,U.useState)(``),[I,L]=(0,U.useState)(``),[R,z]=(0,U.useState)([]),[B,V]=(0,U.useState)([]),[H,q]=(0,U.useState)(!1),[J,ue]=(0,U.useState)(!1),[Y,X]=(0,U.useState)(null),[de,Z]=(0,U.useState)(l),[fe,Q]=(0,U.useState)(``),[$,pe]=(0,U.useState)(``);function me(e,t){let n=G(t);ee(n),f(e),te(t.command??``),g((t.args??[]).join(`
|
|
2
2
|
`)),x(t.url??``),E(t.transport??`sse`),ae(t.oauth?.clientId??``),P(t.oauth?.clientSecret??``),L(t.oauth?.callbackPort===void 0?``:String(t.oauth.callbackPort)),z(K(t.env)),V(K(t.headers)),Q(e),pe(JSON.stringify({name:e,type:n,config:t}))}(0,U.useEffect)(()=>{if(l&&t){let e=c.find(e=>e.name===t);e&&(me(e.name,e.config),Z(!1))}else i&&me(r??``,i),Z(!1)},[c,t,l,i,r]);let he=(0,U.useCallback)(()=>{z(e=>[...e,{key:``,value:``}])},[]),ge=(0,U.useCallback)(e=>{z(t=>t.filter((t,n)=>n!==e))},[]),_e=(0,U.useCallback)((e,t)=>{z(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),ve=(0,U.useCallback)((e,t)=>{z(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]),ye=(0,U.useCallback)(()=>{V(e=>[...e,{key:``,value:``}])},[]),be=(0,U.useCallback)(e=>{V(t=>t.filter((t,n)=>n!==e))},[]),xe=(0,U.useCallback)((e,t)=>{V(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),Se=(0,U.useCallback)((e,t)=>{V(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]);function Ce(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 we(){let e=Ce(R);if(u===`remote`){let t=Ce(B),n=O.trim(),r=N.trim(),i=I.trim(),a=i?Number.parseInt(i,10):void 0,o=n||r||a?{...n?{clientId:n}:{},...r?{clientSecret:r}:{},...a&&Number.isInteger(a)&&a>0?{callbackPort:a}:{}}:void 0;return{url:v.trim(),transport:C,...t?{headers:t}:{},...e?{env:e}:{},...o&&Object.keys(o).length>0?{oauth:o}:{}}}let t=h.split(`
|
|
3
3
|
`).map(e=>e.trim()).filter(Boolean);return{command:p.trim(),args:t,...e?{env:e}:{}}}let Te=JSON.stringify({name:d.trim(),type:u,config:we()}),Ee=async()=>{X(null);let t=d.trim();if(!t){X(`Server name is required`);return}if(u===`remote`){if(!v.trim()){X(`Server URL is required`);return}try{new URL(v.trim())}catch{X(`Server URL must be a valid URL`);return}if(I.trim()){let e=Number.parseInt(I.trim(),10);if(!Number.isInteger(e)||e<=0){X(`OAuth callback port must be a positive integer`);return}}if(N.trim()&&!O.trim()){X(`OAuth client ID is required when a client secret is set`);return}}else if(!p.trim()){X(`Command is required`);return}q(!0);try{if(!e)throw Error(`No project path`);await F(e,fe||t,we()),k({title:`Success`,description:l?`MCP server configuration saved`:`MCP server added`}),s()}catch(e){X(e instanceof Error?e.message:`Failed to save server`)}finally{q(!1)}},De=async()=>{if(e){ue(!0);try{await ce(e,fe),k({title:`Success`,description:`MCP server removed`}),s()}catch(e){X(e instanceof Error?e.message:`Failed to delete server`)}finally{ue(!1)}}},Oe=l?Te!==$:d.trim()!==``||p.trim()!==``||h.trim()!==``||v.trim()!==``||O.trim()!==``||N.trim()!==``||I.trim()!==``||R.length>0||B.length>0;return de?(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,W.jsx)(`p`,{className:n.bodyMuted,children:`Loading server configuration...`})}):(0,W.jsx)(ie,{children:(0,W.jsxs)(ne,{children:[(0,W.jsx)(b,{title:l?d:`Add MCP Server`,description:l?`Edit MCP Server configuration.`:`Configure a new MCP Server.`,sticky:!0,className:`pr-10`}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(S,{title:`Server name`,description:l?`Server name cannot be changed`:void 0,controlLayout:`stack`,className:`pt-6`,children:(0,W.jsx)(D,{id:`server-name`,placeholder:`e.g. filesystem`,value:d,onChange:e=>f(e.target.value),disabled:l})}),(0,W.jsxs)(se,{value:u,onValueChange:e=>ee(e),className:`w-full pt-6`,children:[(0,W.jsxs)(oe,{className:`grid w-full grid-cols-2`,children:[(0,W.jsx)(M,{value:`local`,children:`Local (stdio)`}),(0,W.jsx)(M,{value:`remote`,children:`Remote (HTTP/SSE)`})]}),(0,W.jsxs)(A,{value:`local`,children:[(0,W.jsx)(S,{title:`Command`,controlLayout:`stack`,className:`pt-6`,children:(0,W.jsx)(D,{id:`server-command`,placeholder:`e.g. npx`,value:p,onChange:e=>te(e.target.value)})}),(0,W.jsx)(S,{title:`Arguments`,description:`One argument per line`,controlLayout:`stack`,className:`pt-6`,children:(0,W.jsx)(j,{id:`server-args`,placeholder:`-y
|
|
4
4
|
@modelcontextprotocol/server-filesystem
|
package/dist/public/assets/{settings-models-view-D0QpnAvv.js → settings-models-view-CswWfeDN.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,Fr as n,Ti as r,a as i,i as a,wi as o}from"./interactive-WtOIgeV4.js";import{An as s,Dn as c,Mn as l,On as u,a as d,bt as f,d as p,dt as m,hr as h,kn as g,mt as _,n as v,nt as y,o as b,rt as x,s as S,st as ee,ut as C,w as te,wo as w,wt as T}from"./onboarding-dbhmRuxw.js";import{n as E,q as D}from"./store-CSyJjyNs.js";import{n as O,t as k}from"./use-suspense-resource-rX-GqyWi.js";import{E as A,T as j}from"./index-zVJV2Bjj.js";import{a as M,i as N,n as P,r as F,t as I}from"./table-CYWF-RhQ.js";import{n as L,t as ne}from"./commit-method-fields-DG3NtLE2.js";import{t as R}from"./async-error-boundary-B0tQed36.js";import{o as re,s as z}from"./settings-list-C5MACtux.js";import{t as ie}from"./use-deferred-search-DXrcdbyC.js";import{n as ae,r as B,t as V}from"./model-list-controls-oiBE9X9_.js";var H=e(r(),1),U=o();function W(e){return`settings-models:coding:${e}`}function G(e){return`settings-models:image:${e}`}async function K(){let e=(await h()).filter(e=>e.apiKey),t=await l(`coding`),n={},r={};for(let i of e){let e=t[i.slug];n[i.slug]=e?.models??[],r[i.slug]=new Set(e?.enabledModelIds??[])}return{providers:e,allModels:n,enabledModelIds:r}}async function q(e){let t=e.filter(e=>e.name.toLowerCase()===`openrouter`),n=await l(`image`),r={},i={};for(let e of t){let t=n[e.slug];r[e.slug]=t?.models??[],i[e.slug]=new Set(t?.enabledModelIds??[])}return{allImageModels:r,enabledImageModelIds:i}}var J=t(),Y=`table-fixed`,oe=`h-9`,se=a(n.body,`py-1.5`),ce=`w-10 py-1.5`,le=`w-24 py-1.5 text-right`,ue=a(n.body,`w-20 py-1.5 text-right text-muted-foreground tabular-nums`),de=a(n.body,`w-48 py-1.5 text-right text-muted-foreground whitespace-nowrap tabular-nums`),fe=`h-9 w-24 bg-transparent py-2 text-right`,pe=`h-9 w-20 bg-transparent py-2 text-right`,me=`h-9 w-48 bg-transparent py-2 text-right`;function he(e){return!e||(e.prompt??0)===0&&(e.completion??0)===0?``:`$${i(e.prompt??0)} in | $${i(e.completion??0)} out`}function ge(e){return e==null||!Number.isFinite(e)||e<=0?``:e>=100?Math.round(e).toLocaleString():e.toFixed(1)}function X(e){let t=(0,U.c)(9),{showIntelligence:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=a(`w-full caption-bottom`,Y,n.body),t[0]=i):i=t[0];let o,s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,J.jsx)(N,{className:`h-9 w-10 bg-transparent py-2`}),s=(0,J.jsx)(N,{className:`h-9 bg-transparent py-2`,children:`Model`}),t[1]=o,t[2]=s):(o=t[1],s=t[2]);let c;t[3]===r?c=t[4]:(c=r?(0,J.jsx)(N,{className:fe,children:`Intelligence`}):null,t[3]=r,t[4]=c);let l,u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,J.jsx)(N,{className:pe,children:`TPS`}),u=(0,J.jsx)(N,{className:me,children:`Pricing`}),t[5]=l,t[6]=u):(l=t[5],u=t[6]);let d;return t[7]===c?d=t[8]:(d=(0,J.jsx)(`table`,{className:i,children:(0,J.jsx)(`thead`,{className:`[&_tr]:border-b [&_tr]:border-table-border`,children:(0,J.jsxs)(`tr`,{children:[o,s,c,l,u]})})}),t[7]=c,t[8]=d),d}function Z(e){let t=(0,U.c)(15),{models:r,enabledIds:i,checkboxIdPrefix:o,showIntelligence:s,getModelDisplayName:c,onToggleModel:l}=e,u;if(t[0]!==o||t[1]!==i||t[2]!==c||t[3]!==r||t[4]!==l||t[5]!==s){let e;t[7]!==o||t[8]!==i||t[9]!==c||t[10]!==l||t[11]!==s?(e=e=>{let t=`${o}${e.id}`;return(0,J.jsxs)(M,{className:oe,children:[(0,J.jsx)(F,{className:ce,children:(0,J.jsx)(S,{id:t,checked:i.has(e.id),onCheckedChange:()=>l(e.id),className:`mt-0`})}),(0,J.jsx)(F,{className:se,children:(0,J.jsx)(`label`,{htmlFor:t,className:a(n.body,`cursor-pointer truncate peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),children:c(e)})}),s?(0,J.jsx)(F,{className:le,children:(0,J.jsx)(`div`,{className:`flex justify-end`,children:(0,J.jsx)(B,{codingIndex:e.coding_index,modelName:c(e)})})}):null,(0,J.jsx)(F,{className:ue,children:ge(e.avgTPS)}),(0,J.jsx)(F,{className:de,children:he(e.pricing)})]},e.id)},t[7]=o,t[8]=i,t[9]=c,t[10]=l,t[11]=s,t[12]=e):e=t[12],u=r.map(e),t[0]=o,t[1]=i,t[2]=c,t[3]=r,t[4]=l,t[5]=s,t[6]=u}else u=t[6];let d;return t[13]===u?d=t[14]:(d=(0,J.jsx)(I,{className:Y,children:(0,J.jsx)(P,{children:u})}),t[13]=u,t[14]=d),d}function Q(e){let t=(0,U.c)(25),{providerName:r,providerSlug:i,action:o,tableHeader:s,children:c}=e,l;t[0]!==r||t[1]!==i?(l=(0,J.jsx)(p,{provider:{name:r,slug:i}}),t[0]=r,t[1]=i,t[2]=l):l=t[2];let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=a(n.pageTitle,`truncate`),t[3]=u):u=t[3];let d;t[4]===r?d=t[5]:(d=(0,J.jsx)(`h2`,{className:u,children:r}),t[4]=r,t[5]=d);let f;t[6]!==l||t[7]!==d?(f=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[l,d]}),t[6]=l,t[7]=d,t[8]=f):f=t[8];let m;t[9]===o?m=t[10]:(m=o?(0,J.jsx)(`div`,{className:`electrobun-webkit-app-region-no-drag shrink-0`,children:o}):null,t[9]=o,t[10]=m);let h;t[11]!==f||t[12]!==m?(h=(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-divider px-6 py-4 electrobun-webkit-app-region-drag`,children:[f,m]}),t[11]=f,t[12]=m,t[13]=h):h=t[13];let g;t[14]===s?g=t[15]:(g=s?(0,J.jsx)(`div`,{className:`electrobun-webkit-app-region-no-drag px-6 pb-2 pt-4`,children:s}):null,t[14]=s,t[15]=g);let v=s?`pt-0`:`pt-6`,y;t[16]===v?y=t[17]:(y=a(`px-6 pb-6`,v),t[16]=v,t[17]=y);let b;t[18]!==c||t[19]!==y?(b=(0,J.jsx)(`div`,{className:y,children:c}),t[18]=c,t[19]=y,t[20]=b):b=t[20];let x;return t[21]!==b||t[22]!==h||t[23]!==g?(x=(0,J.jsxs)(_,{className:`shrink-0`,children:[h,g,b]}),t[21]=b,t[22]=h,t[23]=g,t[24]=x):x=t[24],x}function _e({providers:e,globalSearchQuery:t,modelSortBy:n,filterAndSortModels:r,getModelDisplayName:i,onSaveStatus:a}){let o=E(),s=k(G(0),()=>q(e)),[l]=(0,H.useState)(s.allImageModels),[u,d]=(0,H.useState)(s.enabledImageModelIds);async function f(e,t){try{u[e]?.has(t)?(await c(e,t),d(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await g(e,t),d(n=>({...n,[e]:new Set([...n[e]||[],t])}))),o({type:D.ConfigUpdated}),a(`Model preferences saved successfully`)}catch(e){a(e instanceof Error?e.message:`Failed to save model changes`)}}async function p(e,t){let n=l[e],r=u[e];if(n)for(let i of n)r?.has(i.id)!==t&&await f(e,i.id)}return(0,J.jsx)(J.Fragment,{children:e.filter(e=>e.name.toLowerCase()===`openrouter`).map(e=>{let a=l[e.slug]||[],o=u[e.slug]||new Set,s=r(a,o,n);return s.length===0&&t?null:(0,J.jsx)(Q,{providerName:e.name,providerSlug:e.slug,action:s.length>0?(0,J.jsx)(V,{id:`select-all-image-${e.slug}`,checked:s.every(e=>o.has(e.id)),onChange:t=>void p(e.slug,t)}):null,tableHeader:s.length>0?(0,J.jsx)(X,{showIntelligence:!1}):void 0,children:s.length===0?(0,J.jsx)(z,{message:t?`No models matching your search.`:`No image models available for this provider.`}):(0,J.jsx)(T,{children:(0,J.jsx)(Z,{models:s,enabledIds:o,checkboxIdPrefix:`image-`,showIntelligence:!1,getModelDisplayName:i,onToggleModel:t=>void f(e.slug,t)})})},e.slug)})})}function ve({loadVersion:e}){let t=E(),r=k(W(e),()=>K()),i=r.providers,[o]=(0,H.useState)(r.allModels),[c,l]=(0,H.useState)(r.enabledModelIds),[p,h]=(0,H.useState)(`coding`),{query:g,setQuery:S,deferredQuery:w}=ie(),[O,M]=(0,H.useState)(`alphabetical`),[N,P]=(0,H.useState)(``),F=e=>te(e.id),I=async(e,n)=>{try{c[e]?.has(n)?(await u(e,n),l(t=>{let r=new Set(t[e]??[]);return r.delete(n),{...t,[e]:r}})):(await s(e,n),l(t=>({...t,[e]:new Set([...t[e]||[],n])}))),t({type:D.ConfigUpdated}),P(`Model preferences saved successfully`),setTimeout(()=>P(``),3e3)}catch(e){P(e instanceof Error?e.message:`Failed to save model changes`)}},R=async(e,t)=>{let n=o[e],r=c[e];if(n)for(let i of n)r?.has(i.id)!==t&&await I(e,i.id)},B=(e,t,n)=>v({models:e,query:w,sortBy:n,getDisplayName:F,getPriority:e=>+!t.has(e.id)});if(i.length===0)return(0,J.jsx)(C,{title:`No providers configured`,children:`Configure a provider with an API key to view available models.`});let U=i.some(e=>e.name.toLowerCase()===`openrouter`);return(0,J.jsx)(ee,{loading:!1,children:(0,J.jsxs)(j,{value:p,className:`flex flex-col gap-2.5`,children:[(0,J.jsxs)(_,{className:`shrink-0`,children:[(0,J.jsx)(x,{title:`Models`,description:`View and manage available models from your configured providers.`,action:(0,J.jsx)(re,{placeholder:`Search`,value:g,onChange:S,className:`mb-0 w-64`}),sticky:!1}),(0,J.jsx)(m,{className:`max-w-none pt-6`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[U?(0,J.jsxs)(d,{type:`single`,value:p,onValueChange:e=>{(e===`coding`||e===`image`)&&(h(e),S(``))},"aria-label":`Model type`,className:a(ne,`shrink-0`),children:[(0,J.jsx)(b,{value:`coding`,"aria-label":`Coding`,className:a(n.body,L),children:`Coding`}),(0,J.jsx)(b,{value:`image`,"aria-label":`Image`,className:a(n.body,L),children:`Image`})]}):null,N?(0,J.jsx)(y,{variant:N.includes(`error`)||N.includes(`Failed`)?`error`:`success`,className:`mb-0 shrink-0`,children:N}):null,(0,J.jsx)(`div`,{className:`ml-auto shrink-0`,children:(0,J.jsx)(ae,{sortBy:O,showCodingIndex:p===`coding`,showIntelligenceByPrice:p===`coding`,onSortByChange:M})})]})})]}),(0,J.jsx)(A,{value:`coding`,className:`mt-0 flex flex-col gap-2.5`,children:i.map(e=>{let t=o[e.slug]||[],n=c[e.slug]||new Set,r=B(t,n,O);return r.length===0&&g?null:(0,J.jsx)(Q,{providerName:e.name,providerSlug:e.slug,action:r.length>0?(0,J.jsx)(V,{id:`select-all-${e.slug}`,checked:r.every(e=>n.has(e.id)),onChange:t=>void R(e.slug,t)}):null,tableHeader:r.length>0?(0,J.jsx)(X,{showIntelligence:O===`coding-index`||O===`intelligence-by-price`}):void 0,children:r.length===0?(0,J.jsx)(z,{message:g?`No models matching your search.`:`No models available for this provider.`}):(0,J.jsx)(T,{children:(0,J.jsx)(Z,{models:r,enabledIds:n,checkboxIdPrefix:``,showIntelligence:O===`coding-index`||O===`intelligence-by-price`,getModelDisplayName:F,onToggleModel:t=>void I(e.slug,t)})})},e.slug)})}),(0,J.jsx)(A,{value:`image`,className:`mt-0 flex flex-col gap-2.5`,children:p===`image`?(0,J.jsx)(H.Suspense,{fallback:(0,J.jsx)(f,{className:`py-12`,size:`sm`}),children:(0,J.jsx)(_e,{providers:i,globalSearchQuery:g,modelSortBy:O,filterAndSortModels:B,getModelDisplayName:F,onSaveStatus:e=>{P(e),e.includes(`Failed`)||setTimeout(()=>P(``),3e3)}})}):null})]})})}function $(){let e=(0,U.c)(8),[t,n]=(0,H.useState)(0),r;e[0]===t?r=e[1]:(r=function(){O(W(t)),n(be)},e[0]=t,e[1]=r);let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,J.jsx)(f,{label:`Loading models...`,size:`lg`}),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)(ve,{loadVersion:t},t)}),e[3]=t,e[4]=o);let s;return e[5]!==i||e[6]!==o?(s=(0,J.jsx)(`div`,{className:`h-full min-h-0`,children:(0,J.jsx)(R,{fallbackTitle:`Failed to load models`,onRetry:i,renderFallback:ye,children:o})}),e[5]=i,e[6]=o,e[7]=s):s=e[7],s}function ye(e,t){return(0,J.jsx)(C,{title:`Failed to load models`,action:(0,J.jsx)(w,{variant:`outline`,onClick:t,children:`Retry`}),children:e.message})}function be(e){return e+1}export{$ as SettingsModelsView,$ as default};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,Fr as n,Ti as r,a as i,i as a,wi as o}from"./interactive-WtOIgeV4.js";import{An as s,Dn as c,Mn as l,On as u,a as d,bt as f,d as p,dt as m,hr as h,kn as g,mt as _,n as v,nt as y,o as b,rt as x,s as S,st as ee,ut as C,w as te,wo as w,wt as T}from"./onboarding-dbhmRuxw.js";import{n as E,q as D}from"./store-CSyJjyNs.js";import{n as O,t as k}from"./use-suspense-resource-rX-GqyWi.js";import{E as A,T as j}from"./index-B7qJtiRL.js";import{a as M,i as N,n as P,r as F,t as I}from"./table-CYWF-RhQ.js";import{n as L,t as ne}from"./commit-method-fields-DG3NtLE2.js";import{t as R}from"./async-error-boundary-B0tQed36.js";import{o as re,s as z}from"./settings-list-C5MACtux.js";import{t as ie}from"./use-deferred-search-DXrcdbyC.js";import{n as ae,r as B,t as V}from"./model-list-controls-oiBE9X9_.js";var H=e(r(),1),U=o();function W(e){return`settings-models:coding:${e}`}function G(e){return`settings-models:image:${e}`}async function K(){let e=(await h()).filter(e=>e.apiKey),t=await l(`coding`),n={},r={};for(let i of e){let e=t[i.slug];n[i.slug]=e?.models??[],r[i.slug]=new Set(e?.enabledModelIds??[])}return{providers:e,allModels:n,enabledModelIds:r}}async function q(e){let t=e.filter(e=>e.name.toLowerCase()===`openrouter`),n=await l(`image`),r={},i={};for(let e of t){let t=n[e.slug];r[e.slug]=t?.models??[],i[e.slug]=new Set(t?.enabledModelIds??[])}return{allImageModels:r,enabledImageModelIds:i}}var J=t(),Y=`table-fixed`,oe=`h-9`,se=a(n.body,`py-1.5`),ce=`w-10 py-1.5`,le=`w-24 py-1.5 text-right`,ue=a(n.body,`w-20 py-1.5 text-right text-muted-foreground tabular-nums`),de=a(n.body,`w-48 py-1.5 text-right text-muted-foreground whitespace-nowrap tabular-nums`),fe=`h-9 w-24 bg-transparent py-2 text-right`,pe=`h-9 w-20 bg-transparent py-2 text-right`,me=`h-9 w-48 bg-transparent py-2 text-right`;function he(e){return!e||(e.prompt??0)===0&&(e.completion??0)===0?``:`$${i(e.prompt??0)} in | $${i(e.completion??0)} out`}function ge(e){return e==null||!Number.isFinite(e)||e<=0?``:e>=100?Math.round(e).toLocaleString():e.toFixed(1)}function X(e){let t=(0,U.c)(9),{showIntelligence:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=a(`w-full caption-bottom`,Y,n.body),t[0]=i):i=t[0];let o,s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,J.jsx)(N,{className:`h-9 w-10 bg-transparent py-2`}),s=(0,J.jsx)(N,{className:`h-9 bg-transparent py-2`,children:`Model`}),t[1]=o,t[2]=s):(o=t[1],s=t[2]);let c;t[3]===r?c=t[4]:(c=r?(0,J.jsx)(N,{className:fe,children:`Intelligence`}):null,t[3]=r,t[4]=c);let l,u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,J.jsx)(N,{className:pe,children:`TPS`}),u=(0,J.jsx)(N,{className:me,children:`Pricing`}),t[5]=l,t[6]=u):(l=t[5],u=t[6]);let d;return t[7]===c?d=t[8]:(d=(0,J.jsx)(`table`,{className:i,children:(0,J.jsx)(`thead`,{className:`[&_tr]:border-b [&_tr]:border-table-border`,children:(0,J.jsxs)(`tr`,{children:[o,s,c,l,u]})})}),t[7]=c,t[8]=d),d}function Z(e){let t=(0,U.c)(15),{models:r,enabledIds:i,checkboxIdPrefix:o,showIntelligence:s,getModelDisplayName:c,onToggleModel:l}=e,u;if(t[0]!==o||t[1]!==i||t[2]!==c||t[3]!==r||t[4]!==l||t[5]!==s){let e;t[7]!==o||t[8]!==i||t[9]!==c||t[10]!==l||t[11]!==s?(e=e=>{let t=`${o}${e.id}`;return(0,J.jsxs)(M,{className:oe,children:[(0,J.jsx)(F,{className:ce,children:(0,J.jsx)(S,{id:t,checked:i.has(e.id),onCheckedChange:()=>l(e.id),className:`mt-0`})}),(0,J.jsx)(F,{className:se,children:(0,J.jsx)(`label`,{htmlFor:t,className:a(n.body,`cursor-pointer truncate peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),children:c(e)})}),s?(0,J.jsx)(F,{className:le,children:(0,J.jsx)(`div`,{className:`flex justify-end`,children:(0,J.jsx)(B,{codingIndex:e.coding_index,modelName:c(e)})})}):null,(0,J.jsx)(F,{className:ue,children:ge(e.avgTPS)}),(0,J.jsx)(F,{className:de,children:he(e.pricing)})]},e.id)},t[7]=o,t[8]=i,t[9]=c,t[10]=l,t[11]=s,t[12]=e):e=t[12],u=r.map(e),t[0]=o,t[1]=i,t[2]=c,t[3]=r,t[4]=l,t[5]=s,t[6]=u}else u=t[6];let d;return t[13]===u?d=t[14]:(d=(0,J.jsx)(I,{className:Y,children:(0,J.jsx)(P,{children:u})}),t[13]=u,t[14]=d),d}function Q(e){let t=(0,U.c)(25),{providerName:r,providerSlug:i,action:o,tableHeader:s,children:c}=e,l;t[0]!==r||t[1]!==i?(l=(0,J.jsx)(p,{provider:{name:r,slug:i}}),t[0]=r,t[1]=i,t[2]=l):l=t[2];let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=a(n.pageTitle,`truncate`),t[3]=u):u=t[3];let d;t[4]===r?d=t[5]:(d=(0,J.jsx)(`h2`,{className:u,children:r}),t[4]=r,t[5]=d);let f;t[6]!==l||t[7]!==d?(f=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[l,d]}),t[6]=l,t[7]=d,t[8]=f):f=t[8];let m;t[9]===o?m=t[10]:(m=o?(0,J.jsx)(`div`,{className:`electrobun-webkit-app-region-no-drag shrink-0`,children:o}):null,t[9]=o,t[10]=m);let h;t[11]!==f||t[12]!==m?(h=(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-divider px-6 py-4 electrobun-webkit-app-region-drag`,children:[f,m]}),t[11]=f,t[12]=m,t[13]=h):h=t[13];let g;t[14]===s?g=t[15]:(g=s?(0,J.jsx)(`div`,{className:`electrobun-webkit-app-region-no-drag px-6 pb-2 pt-4`,children:s}):null,t[14]=s,t[15]=g);let v=s?`pt-0`:`pt-6`,y;t[16]===v?y=t[17]:(y=a(`px-6 pb-6`,v),t[16]=v,t[17]=y);let b;t[18]!==c||t[19]!==y?(b=(0,J.jsx)(`div`,{className:y,children:c}),t[18]=c,t[19]=y,t[20]=b):b=t[20];let x;return t[21]!==b||t[22]!==h||t[23]!==g?(x=(0,J.jsxs)(_,{className:`shrink-0`,children:[h,g,b]}),t[21]=b,t[22]=h,t[23]=g,t[24]=x):x=t[24],x}function _e({providers:e,globalSearchQuery:t,modelSortBy:n,filterAndSortModels:r,getModelDisplayName:i,onSaveStatus:a}){let o=E(),s=k(G(0),()=>q(e)),[l]=(0,H.useState)(s.allImageModels),[u,d]=(0,H.useState)(s.enabledImageModelIds);async function f(e,t){try{u[e]?.has(t)?(await c(e,t),d(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await g(e,t),d(n=>({...n,[e]:new Set([...n[e]||[],t])}))),o({type:D.ConfigUpdated}),a(`Model preferences saved successfully`)}catch(e){a(e instanceof Error?e.message:`Failed to save model changes`)}}async function p(e,t){let n=l[e],r=u[e];if(n)for(let i of n)r?.has(i.id)!==t&&await f(e,i.id)}return(0,J.jsx)(J.Fragment,{children:e.filter(e=>e.name.toLowerCase()===`openrouter`).map(e=>{let a=l[e.slug]||[],o=u[e.slug]||new Set,s=r(a,o,n);return s.length===0&&t?null:(0,J.jsx)(Q,{providerName:e.name,providerSlug:e.slug,action:s.length>0?(0,J.jsx)(V,{id:`select-all-image-${e.slug}`,checked:s.every(e=>o.has(e.id)),onChange:t=>void p(e.slug,t)}):null,tableHeader:s.length>0?(0,J.jsx)(X,{showIntelligence:!1}):void 0,children:s.length===0?(0,J.jsx)(z,{message:t?`No models matching your search.`:`No image models available for this provider.`}):(0,J.jsx)(T,{children:(0,J.jsx)(Z,{models:s,enabledIds:o,checkboxIdPrefix:`image-`,showIntelligence:!1,getModelDisplayName:i,onToggleModel:t=>void f(e.slug,t)})})},e.slug)})})}function ve({loadVersion:e}){let t=E(),r=k(W(e),()=>K()),i=r.providers,[o]=(0,H.useState)(r.allModels),[c,l]=(0,H.useState)(r.enabledModelIds),[p,h]=(0,H.useState)(`coding`),{query:g,setQuery:S,deferredQuery:w}=ie(),[O,M]=(0,H.useState)(`alphabetical`),[N,P]=(0,H.useState)(``),F=e=>te(e.id),I=async(e,n)=>{try{c[e]?.has(n)?(await u(e,n),l(t=>{let r=new Set(t[e]??[]);return r.delete(n),{...t,[e]:r}})):(await s(e,n),l(t=>({...t,[e]:new Set([...t[e]||[],n])}))),t({type:D.ConfigUpdated}),P(`Model preferences saved successfully`),setTimeout(()=>P(``),3e3)}catch(e){P(e instanceof Error?e.message:`Failed to save model changes`)}},R=async(e,t)=>{let n=o[e],r=c[e];if(n)for(let i of n)r?.has(i.id)!==t&&await I(e,i.id)},B=(e,t,n)=>v({models:e,query:w,sortBy:n,getDisplayName:F,getPriority:e=>+!t.has(e.id)});if(i.length===0)return(0,J.jsx)(C,{title:`No providers configured`,children:`Configure a provider with an API key to view available models.`});let U=i.some(e=>e.name.toLowerCase()===`openrouter`);return(0,J.jsx)(ee,{loading:!1,children:(0,J.jsxs)(j,{value:p,className:`flex flex-col gap-2.5`,children:[(0,J.jsxs)(_,{className:`shrink-0`,children:[(0,J.jsx)(x,{title:`Models`,description:`View and manage available models from your configured providers.`,action:(0,J.jsx)(re,{placeholder:`Search`,value:g,onChange:S,className:`mb-0 w-64`}),sticky:!1}),(0,J.jsx)(m,{className:`max-w-none pt-6`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[U?(0,J.jsxs)(d,{type:`single`,value:p,onValueChange:e=>{(e===`coding`||e===`image`)&&(h(e),S(``))},"aria-label":`Model type`,className:a(ne,`shrink-0`),children:[(0,J.jsx)(b,{value:`coding`,"aria-label":`Coding`,className:a(n.body,L),children:`Coding`}),(0,J.jsx)(b,{value:`image`,"aria-label":`Image`,className:a(n.body,L),children:`Image`})]}):null,N?(0,J.jsx)(y,{variant:N.includes(`error`)||N.includes(`Failed`)?`error`:`success`,className:`mb-0 shrink-0`,children:N}):null,(0,J.jsx)(`div`,{className:`ml-auto shrink-0`,children:(0,J.jsx)(ae,{sortBy:O,showCodingIndex:p===`coding`,showIntelligenceByPrice:p===`coding`,onSortByChange:M})})]})})]}),(0,J.jsx)(A,{value:`coding`,className:`mt-0 flex flex-col gap-2.5`,children:i.map(e=>{let t=o[e.slug]||[],n=c[e.slug]||new Set,r=B(t,n,O);return r.length===0&&g?null:(0,J.jsx)(Q,{providerName:e.name,providerSlug:e.slug,action:r.length>0?(0,J.jsx)(V,{id:`select-all-${e.slug}`,checked:r.every(e=>n.has(e.id)),onChange:t=>void R(e.slug,t)}):null,tableHeader:r.length>0?(0,J.jsx)(X,{showIntelligence:O===`coding-index`||O===`intelligence-by-price`}):void 0,children:r.length===0?(0,J.jsx)(z,{message:g?`No models matching your search.`:`No models available for this provider.`}):(0,J.jsx)(T,{children:(0,J.jsx)(Z,{models:r,enabledIds:n,checkboxIdPrefix:``,showIntelligence:O===`coding-index`||O===`intelligence-by-price`,getModelDisplayName:F,onToggleModel:t=>void I(e.slug,t)})})},e.slug)})}),(0,J.jsx)(A,{value:`image`,className:`mt-0 flex flex-col gap-2.5`,children:p===`image`?(0,J.jsx)(H.Suspense,{fallback:(0,J.jsx)(f,{className:`py-12`,size:`sm`}),children:(0,J.jsx)(_e,{providers:i,globalSearchQuery:g,modelSortBy:O,filterAndSortModels:B,getModelDisplayName:F,onSaveStatus:e=>{P(e),e.includes(`Failed`)||setTimeout(()=>P(``),3e3)}})}):null})]})})}function $(){let e=(0,U.c)(8),[t,n]=(0,H.useState)(0),r;e[0]===t?r=e[1]:(r=function(){O(W(t)),n(be)},e[0]=t,e[1]=r);let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,J.jsx)(f,{label:`Loading models...`,size:`lg`}),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)(ve,{loadVersion:t},t)}),e[3]=t,e[4]=o);let s;return e[5]!==i||e[6]!==o?(s=(0,J.jsx)(`div`,{className:`h-full min-h-0`,children:(0,J.jsx)(R,{fallbackTitle:`Failed to load models`,onRetry:i,renderFallback:ye,children:o})}),e[5]=i,e[6]=o,e[7]=s):s=e[7],s}function ye(e,t){return(0,J.jsx)(C,{title:`Failed to load models`,action:(0,J.jsx)(w,{variant:`outline`,onClick:t,children:`Retry`}),children:e.message})}function be(e){return e+1}export{$ as SettingsModelsView,$ as default};
|
package/dist/public/assets/{settings-rules-view-CbjVigsB.js → settings-rules-view-__5f33ot.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{B as t,Ci as n,Fr as r,Ti as i,i as a,wi as o}from"./interactive-WtOIgeV4.js";import{a as s,i as c}from"./react-vendor-wGLyNWf9.js";import{D as l,Pi as u,T as d,Vi as f,dt as p,et as m,ii as h,mt as g,nt as _,pt as v,rt as y,st as b,tt as x,ut as S,wo as C,x as w}from"./onboarding-dbhmRuxw.js";import{t as T}from"./use-toast-BFQ85Ly5.js";import{K as E}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{B as t,Ci as n,Fr as r,Ti as i,i as a,wi as o}from"./interactive-WtOIgeV4.js";import{a as s,i as c}from"./react-vendor-wGLyNWf9.js";import{D as l,Pi as u,T as d,Vi as f,dt as p,et as m,ii as h,mt as g,nt as _,pt as v,rt as y,st as b,tt as x,ut as S,wo as C,x as w}from"./onboarding-dbhmRuxw.js";import{t as T}from"./use-toast-BFQ85Ly5.js";import{K as E}from"./index-B7qJtiRL.js";import{t as D}from"./delete-confirm-dialog-Dy0dOtPe.js";import{t as O}from"./use-settings-page-loading-BC_wP7pl.js";import{a as k,i as A,o as j,r as M}from"./settings-list-C5MACtux.js";import{t as N}from"./use-deferred-search-DXrcdbyC.js";import{t as P}from"./mcp-server-card-V4Ddsgv3.js";import{i as F,n as I,r as L,t as R}from"./slug-utils-C5rnmMMP.js";import{t as z}from"./use-installed-ai-files-CZIOFhcX.js";var B=o(),V=e(i(),1),H=n(),U=V.forwardRef((e,t)=>{let n=(0,B.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let o;n[3]===r?o=n[4]:(o=a(`peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,r),n[3]=r,n[4]=o);let l;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,H.jsx)(s,{className:a(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`)}),n[5]=l):l=n[5];let u;return n[6]!==i||n[7]!==t||n[8]!==o?(u=(0,H.jsx)(c,{className:o,...i,ref:t,children:l}),n[6]=i,n[7]=t,n[8]=o,n[9]=u):u=n[9],u});U.displayName=c.displayName;function W({threadId:e,onRuleCreated:t}){let[n,i]=(0,V.useState)(``),[o,s]=(0,V.useState)(``),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(!1),f=L(n),p=I(f),g=async()=>{if(!(!p||!e)){d(!0);try{let n=`---
|
|
2
2
|
description: ${o.trim()}
|
|
3
3
|
alwaysApply: ${c}
|
|
4
4
|
---
|
package/dist/public/assets/{settings-skills-view-BGztTaqQ.js → settings-skills-view-Dvfrl9kz.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,Fr as n,Ft as r,Q as i,Ti as a,Y as o,er as s,i as c,m as l,mt as u,wi as d}from"./interactive-WtOIgeV4.js";import{A as f,Ai as p,Bi as m,Ct as h,D as g,Fa as _,Fi as v,Hi as y,Li as b,Mi as x,O as S,Pa as C,Ri as w,St as T,T as E,Tt as D,Ua as O,Ui as k,Za as A,_ as j,_o as M,b as N,bo as P,bt as F,dt as ee,eo as te,et as I,f as L,h as ne,hn as re,ii as ie,j as R,ji as z,k as B,m as ae,mt as oe,nt as se,p as ce,pt as le,rt as V,st as ue,tt as H,ut as de,v as fe,wo as U,wt as pe,x as W,zi as me}from"./onboarding-dbhmRuxw.js";import{t as G}from"./use-toast-BFQ85Ly5.js";import{a as K,c as he,i as q,n as J,o as ge,r as _e,s as Y,t as X}from"./alert-dialog-Ge-FFGao.js";import{K as ve,Tt as ye}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,Fr as n,Ft as r,Q as i,Ti as a,Y as o,er as s,i as c,m as l,mt as u,wi as d}from"./interactive-WtOIgeV4.js";import{A as f,Ai as p,Bi as m,Ct as h,D as g,Fa as _,Fi as v,Hi as y,Li as b,Mi as x,O as S,Pa as C,Ri as w,St as T,T as E,Tt as D,Ua as O,Ui as k,Za as A,_ as j,_o as M,b as N,bo as P,bt as F,dt as ee,eo as te,et as I,f as L,h as ne,hn as re,ii as ie,j as R,ji as z,k as B,m as ae,mt as oe,nt as se,p as ce,pt as le,rt as V,st as ue,tt as H,ut as de,v as fe,wo as U,wt as pe,x as W,zi as me}from"./onboarding-dbhmRuxw.js";import{t as G}from"./use-toast-BFQ85Ly5.js";import{a as K,c as he,i as q,n as J,o as ge,r as _e,s as Y,t as X}from"./alert-dialog-Ge-FFGao.js";import{K as ve,Tt as ye}from"./index-B7qJtiRL.js";import{t as be}from"./delete-confirm-dialog-Dy0dOtPe.js";import{t as xe}from"./use-settings-page-loading-BC_wP7pl.js";import{a as Se,i as Ce,o as we,r as Te}from"./settings-list-C5MACtux.js";import{t as Ee}from"./use-deferred-search-DXrcdbyC.js";import{t as De}from"./mcp-server-card-V4Ddsgv3.js";import{i as Oe,n as ke,r as Ae,t as je}from"./slug-utils-C5rnmMMP.js";import{t as Me}from"./use-installed-ai-files-CZIOFhcX.js";var Z=e(a(),1),Q=t();function Ne({threadId:e,onSkillCreated:t}){let[r,i]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(``),[s,l]=(0,Z.useState)(!1),u=Ae(r),d=ke(u),f=async()=>{if(!(!d||!a.trim()||!e)){l(!0);try{let n=await re(e,u,a.trim());G({title:`Skill created`,description:`Skill '${u}' was created successfully.`}),i(``),o(``),t?.(n.path,`SKILL.md`)}catch(e){G({title:`Error`,description:e instanceof Error?e.message:`Failed to create skill`,variant:`destructive`})}finally{l(!1)}}};return e?(0,Q.jsx)(le,{children:(0,Q.jsxs)(I,{children:[(0,Q.jsx)(V,{title:`Add Skill`,description:`Saved as SKILL.md in .agents/skills.`,sticky:!0,className:`pr-10`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(H,{title:`Skill Name`,controlLayout:`stack`,className:`pt-6`,children:[(0,Q.jsx)(W,{id:`skillName`,value:r,onChange:e=>i(e.target.value),placeholder:`e.g. Code Review`,disabled:s}),r?(0,Q.jsxs)(`p`,{className:c(n.caption,`mt-2`),children:[`Folder name: `,(0,Q.jsx)(`span`,{className:`font-mono`,children:u||`...`})]}):null]}),(0,Q.jsx)(H,{title:`Description`,controlLayout:`stack`,className:`pt-6`,children:(0,Q.jsx)(ve,{id:`skillDescription`,value:a,onChange:e=>o(e.target.value),placeholder:`Describe when Tarsk should apply this skill`,className:`resize-none min-h-[120px]`,disabled:s})}),(0,Q.jsx)(Oe,{onContinue:()=>void f(),disabled:!d||!a.trim(),creating:s})]})]})}):(0,Q.jsx)(de,{title:`No thread selected`,children:`Please select a thread to add a skill.`})}function Pe(e){let t=[`---`,`name: ${e.id}`,`description: ${e.description}`];return e.allowedTools&&t.push(`allowed-tools: ${e.allowedTools}`),e.license&&t.push(`license: ${e.license}`),t.push(`---`,``,e.instructions??``),t.join(`
|
|
2
2
|
`)}function Fe(e){return e.endsWith(`.md`)||e.endsWith(`.mdx`)}function Ie(e){return e.includes(`SKILL.md`)?`SKILL.md`:e[0]??`SKILL.md`}function Le(e,t){let n=e?.sourceId??t;if(!(!n||n==="default"))return n}function Re({open:e,onOpenChange:t,skill:i,catalogSourceId:a,onInstall:o}){let[s,l]=(0,Z.useState)([]),[u,d]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(``),[h,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(!1),[b,C]=(0,Z.useState)(null),[w,T]=(0,Z.useState)(!1),D=Le(i,a),O=!!D;(0,Z.useEffect)(()=>{if(!e||!i)return;let t=i,n=Le(t,a),r=!1;async function o(){_(!0),C(null),l([]),d(null),m(``);try{if(n){let e=await x(n,t.id);if(r)return;l(e.files),d(Ie(e.files))}else{if(r)return;l([`SKILL.md`]),d(`SKILL.md`),m(Pe(t))}}catch(e){if(r)return;C(e instanceof Error?e.message:`Failed to load skill files`)}finally{r||_(!1)}}return o(),()=>{r=!0}},[e,i,a]),(0,Z.useEffect)(()=>{if(!e||!i||!u||!O||!D)return;let t=i,n=u,r=!1;async function a(){y(!0),C(null);try{let e=await z(D,t.id,n);if(r)return;m(e.content)}catch(e){if(r)return;C(e instanceof Error?e.message:`Failed to load file`),m(``)}finally{r||y(!1)}}return a(),()=>{r=!0}},[e,i,u,O,D]);let k=(0,Z.useCallback)(async()=>{if(!i)return;let e=D?{...i,sourceId:D}:i;T(!0);try{await o(e),t(!1)}finally{T(!1)}},[i,D,o,t]),A=h||O&&v,j=u?Fe(u):!1,M=(0,Z.useMemo)(()=>s.map(e=>(0,Q.jsxs)(L,{selected:e===u,onClick:()=>d(e),className:`gap-2 cursor-pointer`,children:[(0,Q.jsx)(r,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsx)(`span`,{className:c(n.caption,`truncate`),children:e})]},e)),[s,u]);return(0,Q.jsx)(E,{open:e,onOpenChange:t,children:(0,Q.jsxs)(g,{className:`flex max-h-[90vh] max-w-5xl flex-col gap-0 overflow-hidden p-0`,children:[(0,Q.jsxs)(f,{className:`border-b border-border px-6 py-4`,children:[(0,Q.jsx)(R,{children:i?.name??`Review skill`}),i?.description?(0,Q.jsx)(S,{children:i.description}):null]}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,Q.jsxs)(`div`,{className:`flex max-h-40 shrink-0 flex-col border-b border-border sm:max-h-none sm:w-56 sm:border-b-0 sm:border-r`,children:[(0,Q.jsx)(`div`,{className:c(n.labelMuted,`px-3 py-2`),children:`Files`}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-1 pb-2`,children:h?(0,Q.jsx)(F,{className:`py-8`,label:`Loading files...`}):s.length===0?(0,Q.jsx)(`p`,{className:c(n.caption,`px-3 py-2 text-muted-foreground`),children:`No files found.`}):M})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-4`,children:b?(0,Q.jsx)(`p`,{className:c(n.body,`text-destructive`),children:b}):A?(0,Q.jsx)(F,{className:`py-12`,label:`Loading preview...`}):j?(0,Q.jsx)(ye,{content:p,enableMermaid:!1}):(0,Q.jsx)(`pre`,{className:c(n.caption,`overflow-x-auto whitespace-pre-wrap font-mono`),children:p})})]}),(0,Q.jsxs)(B,{className:`border-t border-border px-6 py-4 sm:justify-between`,children:[(0,Q.jsx)(U,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(U,{type:`button`,onClick:()=>void k(),disabled:w||!i,children:w?`Installing...`:`Install`})]})]})})}var ze=d(),$=new Map;function Be(e){let t=$.get(e);if(t)return t;let n=b(e).finally(()=>{$.delete(e)});return $.set(e,n),n}function Ve(e,t){return t.map(t=>({...t,sourceId:t.sourceId??e}))}function He(){let e=(0,ze.c)(18),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,Z.useState)(t),[i,a]=(0,Z.useState)(A),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],e[1]=o):o=e[1];let[s,c]=(0,Z.useState)(o),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(!1),p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=async()=>{try{r(await w())}catch{r([])}},e[2]=p):p=e[2];let m=p,h,g;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{(async function(){let e=O();if(e.length>0)try{await me(e),C()}catch{}await m()})()},g=[m],e[3]=h,e[4]=g):(h=e[3],g=e[4]),(0,Z.useEffect)(h,g);let v;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{a(e),M(e)},e[5]=v):v=e[5];let y=v,b;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{r(t=>[...t.filter(t=>t.id!==e.id),e].sort(We)),y(e.id)},e[6]=b):b=e[6];let x=b,S;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{r(t=>t.map(t=>t.id===e.id?e:t).sort(Ue)),_(e.id)},e[7]=S):S=e[7];let T=S,E;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{r(t=>t.filter(t=>t.id!==e)),_(e),a(t=>t===e?(M(`default`),`default`):t)},e[8]=E):E=e[8];let D=E,k,j;e[9]===i?(k=e[10],j=e[11]):(j=()=>{if(i==="default"){c([]),u(!1),f(!1);return}let e=te(i);e?.skills?(c(Ve(i,e.skills)),u(!1)):(c([]),u(!0));let t=!1;return f(!!e?.skills),Be(i).then(e=>{if(t)return;let n=Ve(i,e);c(n),P(i,{fetchedAt:Date.now(),skills:n})}).catch(n=>{t||(e?.skills||c([]),G({title:`Error`,description:n instanceof Error?n.message:`Failed to load skill catalog`,variant:`destructive`}))}).finally(()=>{t||(u(!1),f(!1))}),()=>{t=!0}},k=[i],e[9]=i,e[10]=k,e[11]=j),(0,Z.useEffect)(j,k);let N;return e[12]!==s||e[13]!==l||e[14]!==d||e[15]!==i||e[16]!==n?(N={sources:n,selectedSourceId:i,setSelectedSourceId:y,addSource:x,updateSource:T,removeSource:D,reloadSources:m,catalogSkills:s,isLoadingCatalog:l,isRefreshingCatalog:d},e[12]=s,e[13]=l,e[14]=d,e[15]=i,e[16]=n,e[17]=N):N=e[17],N}function Ue(e,t){return e.title.localeCompare(t.title)}function We(e,t){return e.title.localeCompare(t.title)}function Ge({open:e,onOpenChange:t,editingSource:r,onSourceAdded:i,onSourceUpdated:a,onSourceDeleted:o}){let[s,l]=(0,Z.useState)(``),[d,m]=(0,Z.useState)(``),[h,_]=(0,Z.useState)(null),[v,b]=(0,Z.useState)(!1),[x,C]=(0,Z.useState)(!1),[w,T]=(0,Z.useState)(!1),D=r!=null;function O(){l(``),m(``),_(null),b(!1),C(!1),T(!1)}function A(e){e||O(),t(e)}(0,Z.useEffect)(()=>{if(e){if(r){l(r.title),m(r.url),_(null);return}l(``),m(``),_(null)}},[e,r]);async function j(){let e=s.trim(),t=d.trim();if(!e||!t){_(`Title and URL are required.`);return}b(!0),_(null);try{if(D&&r){let n=await y(r.id,e,t);a?.(n.source)}else i((await k(e,t)).source);A(!1)}catch(e){_(e instanceof Error?e.message:`Failed to verify skill source`)}finally{b(!1)}}async function M(){if(r){C(!0),_(null);try{await p(r.id),o?.(r.id),T(!1),A(!1)}catch(e){_(e instanceof Error?e.message:`Failed to delete skill source`),T(!1)}finally{C(!1)}}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(E,{open:e,onOpenChange:A,children:(0,Q.jsxs)(g,{className:`sm:max-w-lg`,children:[(0,Q.jsxs)(f,{children:[(0,Q.jsx)(R,{children:D?`Edit Skill Source`:`Add Skill Source`}),(0,Q.jsx)(S,{children:D?`Update the title or GitHub skills folder URL for this custom source.`:`Add a GitHub skills folder URL. The source is verified by loading at least one skill from the repository.`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 py-2`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(N,{htmlFor:`skill-source-title`,children:`Title`}),(0,Q.jsx)(W,{id:`skill-source-title`,placeholder:`e.g. My Team Skills`,value:s,onChange:e=>l(e.target.value),disabled:v||x,autoFocus:!0})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(N,{htmlFor:`skill-source-url`,children:`URL`}),(0,Q.jsx)(W,{id:`skill-source-url`,placeholder:`https://github.com/org/repo or .../tree/main/skills`,value:d,onChange:e=>m(e.target.value),disabled:v||x})]}),h?(0,Q.jsx)(`p`,{className:c(n.caption,`text-destructive`),children:h}):null]}),(0,Q.jsxs)(B,{className:`flex-col-reverse gap-2 sm:flex-row sm:justify-between`,children:[D?(0,Q.jsx)(U,{type:`button`,variant:`destructive`,onClick:()=>T(!0),disabled:v||x,children:`Delete`}):(0,Q.jsx)(`div`,{className:`hidden sm:block`}),(0,Q.jsxs)(`div`,{className:`flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row`,children:[(0,Q.jsx)(U,{variant:`outline`,onClick:()=>A(!1),disabled:v||x,children:`Cancel`}),(0,Q.jsx)(U,{onClick:()=>void j(),disabled:v||x||!s.trim()||!d.trim(),children:v?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(u,{className:`mr-2 h-4 w-4 animate-spin`}),`Verifying...`]}):D?`Save Changes`:`Add Source`})]})]})]})}),(0,Q.jsx)(X,{open:w,onOpenChange:T,children:(0,Q.jsxs)(q,{children:[(0,Q.jsxs)(Y,{children:[(0,Q.jsx)(he,{children:`Delete Skill Source`}),(0,Q.jsxs)(K,{children:[`Are you sure you want to delete "`,r?.title,`"? This removes the source from your list but does not uninstall skills you already added.`]})]}),(0,Q.jsxs)(ge,{children:[(0,Q.jsx)(_e,{disabled:x,children:`Cancel`}),(0,Q.jsx)(J,{onClick:()=>void M(),disabled:x,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:x?`Deleting...`:`Delete`})]})]})})]})}function Ke(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(...Ke(n.children))}return t}function qe(){let{selectedProjectId:e,selectedThreadId:t,items:r,loading:a,deleteConfirm:u,setDeleteConfirm:d,deleting:f,installedFilePaths:p,setInstalledFilePaths:_,loadItems:y,handleDelete:b,handleOpenInExplorer:x,triggerExplorerRefresh:S}=Me({findItems:Ke,installedPathSuffix:`/SKILL.md`,explorerPathSuffix:`/SKILL.md`,sortByName:!0,removedToastTitle:`Skill removed`}),[C,w]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)([]),[A,M]=(0,Z.useState)(!0),[N,P]=(0,Z.useState)(null),[te,I]=(0,Z.useState)(!1),{query:L,setQuery:re,deferredQuery:R}=Ee(),{sources:z,selectedSourceId:B,setSelectedSourceId:le,addSource:H,updateSource:W,removeSource:me,catalogSkills:K,isLoadingCatalog:he}=He(),q=B==="default",J=(0,Z.useMemo)(()=>s(B)?z.find(e=>e.id===B)??null:null,[B,z]);(0,Z.useEffect)(()=>{M(!0),v().then(k).catch(()=>k([])).finally(()=>M(!1))},[]);let ge=xe(e?`${e}:${t??``}`:null,[a,A]),_e=(0,Z.useCallback)(async e=>{let n=`.agents/skills/${e.id}/SKILL.md`;if(!t||p.has(n))return;let r=e.sourceId??(B==="default"?void 0:B);try{if(r)await m(t,r,e.id,`.agents/skills/${e.id}`);else{let r=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.allowedTools&&r.push(`allowed-tools: ${e.allowedTools}`),e.license&&r.push(`license: ${e.license}`),r.push(`---`,``,e.instructions??``),await ie(t,n,r.join(`
|
|
3
3
|
`))}_(e=>new Set(e).add(n)),S(),y(),G({title:`Skill installed`,description:e.name})}catch(e){throw G({title:`Error`,description:e instanceof Error?e.message:`Failed to install skill`,variant:`destructive`}),e}},[t,B,p,S,y]),Y=(0,Z.useMemo)(()=>R.trim()?O.filter(e=>e.name.toLowerCase().includes(R.toLowerCase())||e.description.toLowerCase().includes(R.toLowerCase())):O,[O,R]),X=(0,Z.useMemo)(()=>R.trim()?K.filter(e=>e.name.toLowerCase().includes(R.toLowerCase())||e.description.toLowerCase().includes(R.toLowerCase())):K,[K,R]),ve=!q&&he&&K.length===0;return e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(ue,{loading:ge,children:[(0,Q.jsxs)(oe,{className:`shrink-0`,children:[(0,Q.jsx)(V,{title:`Installed Skills`,description:`Reusable instruction sets that guide agent behavior in this project.`,action:(0,Q.jsx)(U,{onClick:()=>w(!0),disabled:!t,children:`Add Skill`}),sticky:!1}),(0,Q.jsxs)(ee,{className:`pt-6`,children:[!t&&(0,Q.jsx)(se,{children:`Select a thread to add or install skills.`}),(0,Q.jsx)(Te,{showHeader:!1,compact:!0,loading:!1,items:r,emptyState:{icon:l,title:`No skills installed`,description:`Add skills to extend agent capabilities with reusable instructions.`},getKey:e=>e.id,renderContent:e=>(0,Q.jsx)(`span`,{className:c(n.body,`truncate text-left`),children:e.name}),onItemClick:e=>x(e.path),itemClickLabel:e=>`Open ${e.name} in Files`,onDelete:d,deleteAriaLabel:e=>`Delete ${e.name}`,deleteTooltip:`Remove this skill from the project`})]})]}),(0,Q.jsxs)(oe,{className:`shrink-0`,children:[(0,Q.jsx)(V,{title:`Available Skills`,description:`Browse and install skills from the catalog.`,action:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(we,{placeholder:`Search`,value:L,onChange:re,className:`mb-0 w-64`}),(0,Q.jsxs)(ce,{value:B,onValueChange:le,children:[(0,Q.jsx)(j,{className:`w-40`,"aria-label":`Skill source`,children:(0,Q.jsx)(fe,{placeholder:`Default`})}),(0,Q.jsxs)(ae,{children:[(0,Q.jsx)(ne,{value:`default`,children:`Default`}),z.map(e=>(0,Q.jsx)(ne,{value:e.id,children:e.title},e.id))]})]}),(0,Q.jsx)(pe,{children:(0,Q.jsxs)(T,{children:[(0,Q.jsx)(D,{asChild:!0,children:(0,Q.jsx)(U,{type:`button`,variant:`outline`,size:`icon`,className:`shrink-0`,onClick:()=>I(!0),"aria-label":J?`Edit skill source`:`Add skill source`,children:J?(0,Q.jsx)(i,{className:`h-4 w-4`}):(0,Q.jsx)(o,{className:`h-4 w-4`})})}),(0,Q.jsx)(h,{children:J?`Edit this custom skill source`:`Add a custom skill source`})]})})]}),sticky:!1}),(0,Q.jsx)(ee,{className:`pt-6`,children:ve?(0,Q.jsx)(F,{className:`py-12`,label:`Loading skills...`}):q?Y.length===0?(0,Q.jsx)(Se,{searchQuery:L,emptyLabel:`No available skills found.`}):(0,Q.jsx)(Ce,{children:Y.map(e=>{let t=`.agents/skills/${e.id}/SKILL.md`,n=p.has(t);return(0,Q.jsx)(De,{className:`bg-background hover:bg-background`,name:je(e.name),description:e.description,installed:n,onClick:()=>{n||P(e)},showInstalledControls:!1},e.id)})}):X.length===0?(0,Q.jsx)(Se,{searchQuery:L,emptyLabel:`No available skills found.`}):(0,Q.jsx)(Ce,{children:X.map(e=>{let t=`.agents/skills/${e.id}/SKILL.md`,n=p.has(t);return(0,Q.jsx)(De,{className:`bg-background hover:bg-background`,name:je(e.name),description:e.description,installed:n,onClick:()=>{n||P({...e,sourceId:e.sourceId??B})},showInstalledControls:!1},e.id)})})})]})]}),(0,Q.jsx)(Re,{open:N!==null,onOpenChange:e=>{e||P(null)},skill:N,catalogSourceId:q?void 0:B,onInstall:_e}),(0,Q.jsx)(Ge,{open:te,onOpenChange:I,editingSource:J,onSourceAdded:e=>{H(e),G({title:`Skill source added`,description:`${e.title} is now available in the source list.`})},onSourceUpdated:e=>{W(e),G({title:`Skill source updated`,description:`${e.title} has been saved.`})},onSourceDeleted:e=>{me(e),G({title:`Skill source removed`,description:`The custom source has been deleted.`})}}),(0,Q.jsx)(E,{open:C,onOpenChange:w,children:(0,Q.jsx)(g,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,Q.jsx)(Ne,{threadId:t,onSkillCreated:()=>{w(!1),y(),S()}})})}),(0,Q.jsx)(be,{open:u!==null,onOpenChange:e=>!e&&d(null),title:`Delete Skill`,description:`Are you sure you want to delete the skill "${u?.name}"? This action cannot be undone.`,onConfirm:()=>{u&&b(u)},confirming:f})]}):(0,Q.jsx)(de,{children:`Select a project to manage skills.`})}export{qe as SettingsSkillsView,qe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,Fr as n,Ti as r,i,on as a,wi as o,x as s}from"./interactive-WtOIgeV4.js";import{n as c,r as l,t as u}from"./react-vendor-wGLyNWf9.js";import{Cn as d,D as f,Ii as p,T as m,Vi as h,b as g,dt as _,et as v,fn as y,mt as b,nt as x,pt as S,rt as C,st as w,tt as T,ut as E,wo as ee,x as D,xr as te}from"./onboarding-dbhmRuxw.js";import{r as O}from"./store-CSyJjyNs.js";import{t as k}from"./use-toast-BFQ85Ly5.js";import{n as A}from"./explorer-tab-context-8bs_tiCO.js";import{St as j}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ci as t,Fr as n,Ti as r,i,on as a,wi as o,x as s}from"./interactive-WtOIgeV4.js";import{n as c,r as l,t as u}from"./react-vendor-wGLyNWf9.js";import{Cn as d,D as f,Ii as p,T as m,Vi as h,b as g,dt as _,et as v,fn as y,mt as b,nt as x,pt as S,rt as C,st as w,tt as T,ut as E,wo as ee,x as D,xr as te}from"./onboarding-dbhmRuxw.js";import{r as O}from"./store-CSyJjyNs.js";import{t as k}from"./use-toast-BFQ85Ly5.js";import{n as A}from"./explorer-tab-context-8bs_tiCO.js";import{St as j}from"./index-B7qJtiRL.js";import{t as M}from"./delete-confirm-dialog-Dy0dOtPe.js";import{t as N}from"./use-settings-page-loading-BC_wP7pl.js";import{a as P,i as F,o as I,r as L}from"./settings-list-C5MACtux.js";import{t as R}from"./mcp-server-card-V4Ddsgv3.js";import{i as z,n as B,r as V}from"./slug-utils-C5rnmMMP.js";var H=o(),U=e(r(),1),W=t(),G=U.forwardRef((e,t)=>{let n=(0,H.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`grid gap-2`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,W.jsx)(l,{className:o,...a,ref:t}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});G.displayName=l.displayName;var K=U.forwardRef((e,t)=>{let n=(0,H.c)(10),r,o;n[0]===e?(r=n[1],o=n[2]):({className:r,...o}=e,n[0]=e,n[1]=r,n[2]=o);let s;n[3]===r?s=n[4]:(s=i(`aspect-square h-4 w-4 rounded-full border border-brand text-brand ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,r),n[3]=r,n[4]=s);let l;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,W.jsx)(u,{className:`flex items-center justify-center`,children:(0,W.jsx)(a,{className:`h-2.5 w-2.5 fill-current text-current`})}),n[5]=l):l=n[5];let d;return n[6]!==o||n[7]!==t||n[8]!==s?(d=(0,W.jsx)(c,{ref:t,className:s,...o,children:l}),n[6]=o,n[7]=t,n[8]=s,n[9]=d):d=n[9],d});K.displayName=c.displayName;function q({projectId:e,threadId:t,onCommandCreated:r}){let[a,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(``),[d,f]=(0,U.useState)(`default`),[p,m]=(0,U.useState)(!1),h=V(a),_=B(h),b=async()=>{if(!(!_||!e)){m(!0);try{await y(h,``,{description:s.trim()||void 0,argumentHint:l.trim()||void 0,mode:d===`plan`?`plan`:void 0},`project`,t??void 0),k({title:`Command created`,description:`Command '/${h}' was created successfully.`}),o(``),c(``),u(``),f(`default`),r?.(h)}catch(e){k({title:`Error`,description:e instanceof Error?e.message:`Failed to create command`,variant:`destructive`})}finally{m(!1)}}};return e?(0,W.jsx)(S,{children:(0,W.jsxs)(v,{children:[(0,W.jsx)(C,{title:`Add Slash Command`,description:`Saved as a .md file in ~/.agents/commands.`,sticky:!0,className:`pr-10`}),(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(T,{title:`Command Name`,controlLayout:`stack`,className:`pt-6`,children:[(0,W.jsx)(D,{id:`commandName`,value:a,onChange:e=>o(e.target.value),placeholder:`e.g. review`,disabled:p}),a?(0,W.jsxs)(`p`,{className:i(n.caption,`mt-2`),children:[`Command: `,(0,W.jsxs)(`span`,{className:`font-mono`,children:[`/`,h||`...`]})]}):null]}),(0,W.jsx)(T,{title:`Description`,controlLayout:`stack`,className:`pt-6`,children:(0,W.jsx)(D,{id:`commandDescription`,value:s,onChange:e=>c(e.target.value),placeholder:`Brief description shown in autocomplete`,disabled:p})}),(0,W.jsx)(T,{title:`Argument Hint`,description:`Shows after the command name to guide users what to type`,controlLayout:`stack`,className:`pt-6`,children:(0,W.jsx)(D,{id:`argumentHint`,value:l,onChange:e=>u(e.target.value),placeholder:`e.g. <focus-area> or <branch-name>`,disabled:p})}),(0,W.jsx)(T,{title:`Mode`,description:d==="default"?`Standard chat mode`:`Activates plan mode when this command is used`,controlLayout:`stack`,className:`pt-6`,children:(0,W.jsxs)(G,{value:d,onValueChange:e=>f(e),className:`flex gap-4`,disabled:p,children:[(0,W.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,W.jsx)(K,{value:`default`,id:`mode-default`}),(0,W.jsx)(g,{htmlFor:`mode-default`,className:i(n.labelNormal,`cursor-pointer`),children:`Default`})]}),(0,W.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,W.jsx)(K,{value:`plan`,id:`mode-plan`}),(0,W.jsx)(g,{htmlFor:`mode-plan`,className:i(n.labelNormal,`cursor-pointer`),children:`Plan`})]})]})}),(0,W.jsx)(z,{onContinue:()=>void b(),disabled:!_,creating:p})]})]})}):(0,W.jsx)(E,{title:`No project selected`,children:`Please select a project to add a slash command.`})}function J(){let e=O(e=>e.selectedProjectId),t=O(e=>e.selectedThreadId),{openChatDockPanel:r}=j(),{setPendingExplorerPath:a,triggerExplorerRefresh:o,setExplorerClearPath:c}=A(),[l,u]=(0,U.useState)([]),[g,v]=(0,U.useState)(!0),[S,T]=(0,U.useState)(!1),[D,z]=(0,U.useState)(null),[B,V]=(0,U.useState)(!1),[H,G]=(0,U.useState)([]),[K,J]=(0,U.useState)(!0),[Y,X]=(0,U.useState)(new Map),[Z,ne]=(0,U.useState)(``),Q=(0,U.useCallback)(async()=>{if(!t){v(!1),u([]),X(new Map);return}v(!0);try{let e=await te(t);u(e.filter(e=>!e.isBuiltIn)),X(new Map(e.map(e=>[e.name,e.filePath])))}catch{u([]),X(new Map)}finally{v(!1)}},[t]);(0,U.useLayoutEffect)(()=>{t&&v(!0)},[e,t]),(0,U.useEffect)(()=>{Q()},[Q]),(0,U.useEffect)(()=>{J(!0),p().then(G).catch(()=>G([])).finally(()=>J(!1))},[]);let re=N(e?`${e}:${t??``}`:null,[g,K]),ie=(0,U.useCallback)(async e=>{V(!0);try{await d(e.filePath),c(e.filePath),o(),X(t=>{let n=new Map(t);return n.delete(e.name),n}),k({title:`Command removed`,description:`/${e.name}`}),z(null),await Q()}catch(e){k({title:`Error`,description:e instanceof Error?e.message:`Failed to remove command`,variant:`destructive`})}finally{V(!1)}},[Q,o,c]),ae=(0,U.useCallback)(e=>{a(e),r(`explorer`)},[a,r]),oe=(0,U.useCallback)(e=>{let t=e.metadata?.description?.trim();return t&&t.length>0?t:`No description`},[]),se=(0,U.useCallback)(async e=>{if(!(!t||Y.has(e.name)))try{if(e.gitHubRepo&&e.gitHubFolder){let n=`.agents/commands`;await h(t,e.gitHubRepo,e.gitHubFolder,n);let r=`${n}/${e.name}.md`;X(t=>new Map(t).set(e.name,r))}else{let n=await y(e.name,e.content,{description:e.description,argumentHint:e.argumentHint},`project`,t);X(t=>new Map(t).set(e.name,n.filePath))}o(),Q(),k({title:`Command installed`,description:`/${e.name}`})}catch(e){k({title:`Error`,description:e instanceof Error?e.message:`Failed to install command`,variant:`destructive`})}},[t,Y,o,Q]),$=Z.trim()?H.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):H;return e?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(w,{loading:re,children:[(0,W.jsxs)(b,{className:`shrink-0`,children:[(0,W.jsx)(C,{title:`Installed Slash Commands`,description:`Project slash commands you run with / in chat.`,action:(0,W.jsx)(ee,{onClick:()=>T(!0),disabled:!t,children:`Add Command`}),sticky:!1}),(0,W.jsxs)(_,{className:`pt-6`,children:[!t&&(0,W.jsx)(x,{children:`Select a thread to add or install slash commands.`}),(0,W.jsx)(L,{showHeader:!1,loading:!1,items:l,emptyState:{icon:s,title:`No slash commands installed`,description:`Add slash commands to create quick actions in chat.`},getKey:e=>e.filePath,columnsClassName:`grid-cols-[minmax(0,1fr)_auto_1.75rem]`,renderContent:e=>(0,W.jsxs)(`div`,{className:`min-w-0 text-left`,children:[(0,W.jsxs)(`div`,{className:i(n.body,`truncate`),children:[`/`,e.name]}),(0,W.jsx)(`div`,{className:i(n.compact,`truncate text-muted-foreground`),children:oe(e)})]}),renderMiddle:e=>e.metadata?.mode?(0,W.jsx)(`span`,{className:i(n.compact,`bg-muted px-1.5 py-0.5 rounded flex-shrink-0`),children:e.metadata.mode}):(0,W.jsx)(`div`,{}),onItemClick:e=>ae(e.filePath),itemClickLabel:e=>`Open /${e.name} in Files`,onDelete:z,deleteAriaLabel:e=>`Delete /${e.name}`,deleteTooltip:`Remove this slash command from the project`})]})]}),(0,W.jsxs)(b,{className:`shrink-0`,children:[(0,W.jsx)(C,{title:`Available Slash Commands`,description:`Browse and install slash commands from the catalog.`,action:(0,W.jsx)(I,{placeholder:`Search`,value:Z,onChange:ne,className:`mb-0 w-64`}),sticky:!1}),(0,W.jsx)(_,{className:`pt-6`,children:$.length===0?(0,W.jsx)(P,{searchQuery:Z,emptyLabel:`No available commands found.`}):(0,W.jsx)(F,{children:$.map(e=>{let t=Y.has(e.name);return(0,W.jsx)(R,{className:`bg-background hover:bg-background`,name:`/${e.name}`,description:e.description,installed:t,onClick:()=>{t||se(e)},showInstalledControls:!1},e.id)})})})]})]}),(0,W.jsx)(m,{open:S,onOpenChange:T,children:(0,W.jsx)(f,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,W.jsx)(q,{projectId:e,threadId:t,onCommandCreated:()=>{T(!1),Q(),o()}})})}),(0,W.jsx)(M,{open:D!==null,onOpenChange:e=>!e&&z(null),title:`Delete Slash Command`,description:`Are you sure you want to delete "/${D?.name}"? This action cannot be undone.`,onConfirm:()=>{D&&ie(D)},confirming:B})]}):(0,W.jsx)(E,{children:`Select a project to manage slash commands.`})}export{J as SettingsSlashCommandsView,J as default};
|