ryco-cli 0.1.12 → 0.1.13
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/bin.cjs +1 -1
- package/dist/bin.mjs +1 -1
- package/dist/client/assets/{AccountSettings-C3v2klAG.js → AccountSettings-Be5_48k0.js} +1 -1
- package/dist/client/assets/{AiFocusSettings-BquKjnWf.js → AiFocusSettings-DIpQXLW2.js} +1 -1
- package/dist/client/assets/{BranchToolbar.logic-CmvD76Cw.js → BranchToolbar.logic-D7slG_zJ.js} +1 -1
- package/dist/client/assets/{ChatRightPanel-DVxRdZWT.js → ChatRightPanel-BIS1DPGa.js} +3 -3
- package/dist/client/assets/{ChatThreadRouteView-DlgAAOCp.js → ChatThreadRouteView-CocRstME.js} +1 -1
- package/dist/client/assets/{CommandPaletteDialog-BnJURcy7.js → CommandPaletteDialog-C5xAo65V.js} +1 -1
- package/dist/client/assets/{ConnectionsSettings-Ccn8q4fG.js → ConnectionsSettings-CXabxSaH.js} +1 -1
- package/dist/client/assets/{DiagnosticsSettings-QXpjXOrH.js → DiagnosticsSettings-CZ3vY43G.js} +1 -1
- package/dist/client/assets/{DraftChatThreadRouteView-DFMY6O91.js → DraftChatThreadRouteView-D8Bt3Qnq.js} +1 -1
- package/dist/client/assets/{HostedConnectionControls-BC4kVWTa.js → HostedConnectionControls-DxAXv0Hd.js} +1 -1
- package/dist/client/assets/{HostedHubRoot-pBGVub10.js → HostedHubRoot-Cc8GYcK6.js} +1 -1
- package/dist/client/assets/{HostedNativeAuthorizationRoute-Df0oSrLR.js → HostedNativeAuthorizationRoute-CTQe7Vjt.js} +1 -1
- package/dist/client/assets/{HostedRelayTrustNotice-ffS_O2AX.js → HostedRelayTrustNotice-BldMySVi.js} +1 -1
- package/dist/client/assets/{IntegrationsSettingsPanel-BHyy-VM0.js → IntegrationsSettingsPanel-D6f3KoqM.js} +1 -1
- package/dist/client/assets/{KeybindingsSettings-BfkONqmZ.js → KeybindingsSettings-D2bNQPI-.js} +1 -1
- package/dist/client/assets/{McpServersSettings-UthT1T80.js → McpServersSettings-B7YqVvV4.js} +1 -1
- package/dist/client/assets/{NewWorktreeDialog-DTZnArOC.js → NewWorktreeDialog-CKr2ioue.js} +1 -1
- package/dist/client/assets/{NoActiveThreadState-jcEAWu7N.js → NoActiveThreadState-BD-eNmfn.js} +1 -1
- package/dist/client/assets/{NodeSecuritySettings-DPqjRphc.js → NodeSecuritySettings-FWM_SeDi.js} +1 -1
- package/dist/client/assets/{OpinionatedPluginsSettings-BSy3F4v6.js → OpinionatedPluginsSettings-BtZQF4Ze.js} +1 -1
- package/dist/client/assets/{PhoneGetAppInterstitial-B2mrJtgM.js → PhoneGetAppInterstitial-CooQgpSw.js} +1 -1
- package/dist/client/assets/{PhoneHome-C-ttaKuE.js → PhoneHome-BtPE7bQn.js} +1 -1
- package/dist/client/assets/{PhoneSettingsSurface-CJddundi.js → PhoneSettingsSurface-tcFCccEL.js} +1 -1
- package/dist/client/assets/{ProjectFavicon-BhQnkxbx.js → ProjectFavicon-qZGdjYCM.js} +1 -1
- package/dist/client/assets/{ProviderModelPicker-COg6CGM4.js → ProviderModelPicker-D0w23uWo.js} +1 -1
- package/dist/client/assets/{ProvidersSettingsPanel-C3aPyCrN.js → ProvidersSettingsPanel-B3aBKY--.js} +1 -1
- package/dist/client/assets/{RootAppShell-3T2sBtpP.js → RootAppShell-C-0ChFVJ.js} +2 -2
- package/dist/client/assets/{SettingsDialog-krsStFrf.js → SettingsDialog-Bbuoh793.js} +1 -1
- package/dist/client/assets/{SettingsPanels-D8Xy3pPC.js → SettingsPanels-Dr4f2y9l.js} +1 -1
- package/dist/client/assets/{SourceControlSettings-KIx9EfEZ.js → SourceControlSettings-CkiYR4lR.js} +1 -1
- package/dist/client/assets/{StatisticsPage-C38pI2_b.js → StatisticsPage-Bjouapmf.js} +1 -1
- package/dist/client/assets/{StatisticsPanel-6sINT28-.js → StatisticsPanel-D_khPph6.js} +1 -1
- package/dist/client/assets/{ThreadStatusIndicators-CL0KGLlj.js → ThreadStatusIndicators-ZImeLExQ.js} +0 -0
- package/dist/client/assets/{ThreadTerminalDrawer-C4NJu8Qs.js → ThreadTerminalDrawer-DDHEuRGB.js} +1 -1
- package/dist/client/assets/{ThreadWorkspacePanel-D9qlHXCA.js → ThreadWorkspacePanel-QF3KwbGm.js} +1 -1
- package/dist/client/assets/{WorkItemsTab-BDAeQe4D.js → WorkItemsTab-AOVwVvb7.js} +1 -1
- package/dist/client/assets/{branding-DeKsIp6g.js → branding-BDfN6Spd.js} +1 -1
- package/dist/client/assets/{capabilities-BkVqeGLQ.js → capabilities-3zgirmmI.js} +1 -1
- package/dist/client/assets/{desktopUpdateAtoms-B9iJXSdW.js → desktopUpdateAtoms-CyfPW2jg.js} +1 -1
- package/dist/client/assets/{desktopWorkspace-B-cSBe8H.js → desktopWorkspace-DHUZEpfy.js} +1 -1
- package/dist/client/assets/{device-DfIh5pQV.js → device-B_qvyvtW.js} +1 -1
- package/dist/client/assets/{editorPreferences-0DWMgcci.js → editorPreferences-DHIJntKF.js} +1 -1
- package/dist/client/assets/{index-Bntnmu6O.js → index-CQmEMMQH.js} +1 -1
- package/dist/client/assets/{main-BjVnVob0.js → main-BKS5Nf2_.js} +2 -2
- package/dist/client/assets/primary-BzLEg2w1.js +2 -0
- package/dist/client/assets/{projectPaths-SSsIvt0g.js → projectPaths-BAd6NFcE.js} +1 -1
- package/dist/client/assets/{providerIconUtils-CzSa_16f.js → providerIconUtils-X0Z3EK-Q.js} +1 -1
- package/dist/client/assets/{runtime-DfGHeCnR.js → runtime-CXut_g4p.js} +1 -1
- package/dist/client/assets/{session-logic-wxhvMgEN.js → session-logic-GZix7S2I.js} +1 -1
- package/dist/client/assets/{sidebarProjectFolders-CGVDJ0ZT.js → sidebarProjectFolders-cnmz3B_-.js} +1 -1
- package/dist/client/assets/storeSelectors-DYekgeHu.js +1 -0
- package/dist/client/assets/{threadPriorityRefreshRuntime-tRDgvBzr.js → threadPriorityRefreshRuntime-Ct5pnIbX.js} +1 -1
- package/dist/client/assets/types-DYekgeHu.js +1 -0
- package/dist/client/assets/{useAtlassian-DC0XOw4u.js → useAtlassian-9-hy2f8z.js} +0 -0
- package/dist/client/assets/{useHandleNewThread-Bvz-DKgn.js → useHandleNewThread-DX2FtXcP.js} +1 -1
- package/dist/client/assets/{usePhoneThreadActions-CAgIq9aZ.js → usePhoneThreadActions-BEa3VzGG.js} +1 -1
- package/dist/client/assets/{useStatistics-CiLROMJP.js → useStatistics-CtunoTE-.js} +1 -1
- package/dist/client/assets/{useThreadActions-Vew3ScxG.js → useThreadActions-fN-Al13y.js} +1 -1
- package/dist/client/index.html +1 -1
- package/package.json +1 -1
- package/dist/client/assets/primary-OskAInOO.js +0 -2
- package/dist/client/assets/storeSelectors-Bpr2pdhU.js +0 -1
- package/dist/client/assets/types-Bpr2pdhU.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{Fr as r,d as i,t as a}from"./src-Vf4LVnMX.js";import{Rn as o,Xn as s,hn as c,zn as l}from"./runtime-DfGHeCnR.js";import{a as u}from"./primary-OskAInOO.js";import{It as d,Z as f}from"./composerDraftStore-CdJJZe42.js";import{f as p}from"./useRenderElement-DchFnsR8.js";import{t as m}from"./bot-DJp0cuhK.js";import{n as h}from"./loader-circle-CrtHFAvM.js";import{t as g}from"./chevron-right-BWYGybX9.js";import{i as _,o as v}from"./toast-CcSCAm4B.js";import{t as y}from"./key-round-CacMputS.js";import{t as b}from"./loader-zHASMrUy.js";import{t as x}from"./plus-B2h-VEqh.js";import{t as S}from"./refresh-cw-DopCMrtR.js";import{t as C}from"./save-Bh36JIv6.js";import{t as w}from"./shield-check-dQ-4cMKk.js";import{t as T}from"./trash-2-CM1zXPGb.js";import{t as E}from"./triangle-alert-RL_T3KLo.js";import{t as D}from"./unplug-Cw8iawyX.js";import{t as O}from"./wrench-D0IetWa1.js";import{t as k}from"./switch-BTGo9Yip.js";import{t as A}from"./input-CHEwW3oH.js";import{t as j}from"./button-BAbJxRzt.js";import{t as M}from"./toastHelpers-CSQRKo4F.js";import{t as N}from"./capabilities-BkVqeGLQ.js";import{t as P}from"./badge-CXw6fWrB.js";import"./providerModels-BJcfB_9E.js";import{r as F}from"./providerDriverMeta-I0TSo-QI.js";import{McpServersSettings as I}from"./McpServersSettings-UthT1T80.js";var L=()=>({integrations:[],topology:{available:!1,reason:`Not loaded.`},pairingCodes:{}}),R=(e,t)=>({integrations:t.integrations,topology:t.topology,pairingCodes:{}}),z=(e,t)=>({...e,integrations:[...e.integrations.filter(e=>e.integration.integrationId!==t.detail.integration.integrationId),t.detail],pairingCodes:{...e.pairingCodes,[t.detail.integration.integrationId]:t.pairingCode}}),B=(e,t)=>{let n={...e.pairingCodes};return delete n[t],{...e,integrations:e.integrations.filter(e=>e.integration.integrationId!==t),pairingCodes:n}},V=()=>({installations:[]}),H=e=>[...e].toSorted((e,t)=>e.driver.localeCompare(t.driver)||e.createdAt.localeCompare(t.createdAt)||e.installationId.localeCompare(t.installationId)),ee=(e,t)=>({installations:H(t.installations)}),U=(e,t)=>{let n=e.installations.find(e=>e.installationId===t.installation.installationId);return n&&n.revision>t.installation.revision?e:{installations:H([...e.installations.filter(e=>e.installationId!==t.installation.installationId),t.installation])}},W=p(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),G=p(`clipboard`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]),te=p(`link-2-off`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7`,key:`10o201`}],[`path`,{d:`M15 7h2a5 5 0 0 1 4 8`,key:`1d3206`}],[`line`,{x1:`8`,x2:`12`,y1:`12`,y2:`12`,key:`rvw6j4`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]),K=e(t(),1),ne=n(),re=[50,100,200,400],ie=e=>e instanceof Error&&e.message.trim()===`Agent Control is disabled.`,ae=e=>new Promise(t=>window.setTimeout(t,e));async function oe(e,t=ae){for(let n of re)try{return await e()}catch(e){if(!ie(e))throw e;await t(n)}return e()}var q=d(),se={codex:`Codex`,"claude-code":`Claude Code`,"claude-desktop":`Claude Desktop`,"generic-mcp":`Generic MCP`},ce=[{capability:i.externalListProjects,label:`List allowed projects`,description:`Discover only projects inside this integration's scope.`},{capability:i.externalCreateTask,label:`Request tasks`,description:`Submit one task to Ryco's normal approval queue.`},{capability:i.externalReadTask,label:`Read own tasks`,description:`Read or wait only for tasks created by this integration.`},{capability:i.externalReadAutomations,label:`Read automations`,description:`Read bounded schedules and run outcomes inside the selected project scope.`},{capability:i.externalManageAutomations,label:`Request automations`,description:`Propose schedule changes; each due run still requires separate approval.`},{capability:i.externalReadActivity,label:`Read activity`,description:`Read bounded payload-free project and provider event summaries.`},{capability:i.externalReadDiagnostics,label:`Read diagnostics`,description:`Read redacted count-only health summaries for allowed projects.`},{capability:i.externalSharedCheckout,label:`Request shared checkout`,description:`May request the local checkout; each request still needs approval.`},{capability:i.externalFullAccess,label:`Request full access`,description:`May request a full-access runtime; each request still needs approval.`}],J=()=>({displayName:``,clientKind:`codex`,scopeKind:`all`,projectIds:``,capabilities:[i.externalListProjects,i.externalCreateTask,i.externalReadTask],expiresAt:``,rateLimitPerMinute:`60`,activeTaskLimit:`1`});function Y(e,t){_.add(M({type:`error`,title:e,description:t instanceof Error?t.message:`The request failed.`}))}function le(e,t){return[e,...t.map(e=>JSON.stringify(e))].join(` `)}function X(e){return e===null?`Never`:new Date(e).toLocaleString()}function ue(e){let t=e.integration;return t.revokedAt===null?t.expiresAt!==null&&Date.parse(t.expiresAt)<=Date.now()?{label:`Expired`,variant:`error`}:t.pairingState===`paired`?{label:`Paired`,variant:`success`}:t.pairingState===`pending`?{label:`Pairing`,variant:`warning`}:{label:`Unpaired`,variant:`outline`}:{label:`Revoked`,variant:`error`}}function de(e){let t=e.integration;return{displayName:t.displayName,clientKind:t.clientKind,scopeKind:t.projectScope.kind,projectIds:t.projectScope.kind===`selected`?t.projectScope.projectIds.join(`, `):``,capabilities:t.capabilities,expiresAt:t.expiresAt===null?``:new Date(t.expiresAt).toISOString().slice(0,16),rateLimitPerMinute:String(t.rateLimitPerMinute),activeTaskLimit:String(t.activeTaskLimit)}}function Z(e){let t=e.projectIds.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>r.make(e)),n=e.scopeKind===`all`?{kind:`all`}:{kind:`selected`,projectIds:t},i=Number(e.rateLimitPerMinute),a=Number(e.activeTaskLimit);if(!e.displayName.trim())throw Error(`A display name is required.`);if(e.scopeKind===`selected`&&t.length===0)throw Error(`Enter at least one project ID for selected-project scope.`);if(!Number.isInteger(i)||i<1)throw Error(`Rate limit must be a positive whole number.`);if(!Number.isInteger(a)||a<1)throw Error(`Active-task limit must be a positive whole number.`);return{displayName:e.displayName.trim(),clientKind:e.clientKind,projectScope:n,capabilities:e.capabilities,expiresAt:e.expiresAt?new Date(e.expiresAt).toISOString():null,rateLimitPerMinute:i,activeTaskLimit:a}}function fe(e){let t=(0,ne.c)(85),{form:n,onChange:r,clientLocked:i}=e,a=i!==void 0&&i,o;t[0]!==n||t[1]!==r?(o=e=>r({...n,displayName:e.target.value}),t[0]=n,t[1]=r,t[2]=o):o=t[2];let s;t[3]!==n.displayName||t[4]!==o?(s=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Display name`,(0,q.jsx)(A,{value:n.displayName,placeholder:`Local Codex`,onChange:o})]}),t[3]=n.displayName,t[4]=o,t[5]=s):s=t[5];let c=n.clientKind,l;t[6]!==n||t[7]!==r?(l=e=>r({...n,clientKind:e.target.value}),t[6]=n,t[7]=r,t[8]=l):l=t[8];let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.entries(se).map(pe),t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==n.clientKind||t[12]!==l?(d=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Client`,(0,q.jsx)(`select`,{className:`h-9 rounded-lg border border-input bg-background px-3 text-sm`,value:c,disabled:a,onChange:l,children:u})]}),t[10]=a,t[11]=n.clientKind,t[12]=l,t[13]=d):d=t[13];let f;t[14]!==s||t[15]!==d?(f=(0,q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[s,d]}),t[14]=s,t[15]=d,t[16]=f):f=t[16];let p;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,q.jsx)(`legend`,{className:`text-xs font-medium`,children:`Project scope`}),t[17]=p):p=t[17];let m=n.scopeKind===`all`,h;t[18]!==n||t[19]!==r?(h=()=>r({...n,scopeKind:`all`}),t[18]=n,t[19]=r,t[20]=h):h=t[20];let g;t[21]!==m||t[22]!==h?(g=(0,q.jsx)(`input`,{type:`radio`,checked:m,onChange:h}),t[21]=m,t[22]=h,t[23]=g):g=t[23];let _;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,q.jsxs)(`span`,{children:[`All current and future projects`,(0,q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`The client can discover every project on this local Ryco instance.`})]}),t[24]=_):_=t[24];let v;t[25]===g?v=t[26]:(v=(0,q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[g,_]}),t[25]=g,t[26]=v);let y=n.scopeKind===`selected`,b;t[27]!==n||t[28]!==r?(b=()=>r({...n,scopeKind:`selected`}),t[27]=n,t[28]=r,t[29]=b):b=t[29];let x;t[30]!==y||t[31]!==b?(x=(0,q.jsx)(`input`,{type:`radio`,checked:y,onChange:b}),t[30]=y,t[31]=b,t[32]=x):x=t[32];let S=n.scopeKind!==`selected`,C;t[33]!==n||t[34]!==r?(C=e=>r({...n,projectIds:e.target.value}),t[33]=n,t[34]=r,t[35]=C):C=t[35];let w;t[36]!==n.projectIds||t[37]!==S||t[38]!==C?(w=(0,q.jsx)(A,{className:`mt-1.5`,value:n.projectIds,disabled:S,placeholder:`project-id-1, project-id-2`,"aria-label":`Selected project IDs`,onChange:C}),t[36]=n.projectIds,t[37]=S,t[38]=C,t[39]=w):w=t[39];let T;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,q.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:`Comma-separated stable project IDs. Unknown IDs remain inaccessible.`}),t[40]=T):T=t[40];let E;t[41]===w?E=t[42]:(E=(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Selected projects`,w,T]}),t[41]=w,t[42]=E);let D;t[43]!==x||t[44]!==E?(D=(0,q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[x,E]}),t[43]=x,t[44]=E,t[45]=D):D=t[45];let O;t[46]!==v||t[47]!==D?(O=(0,q.jsxs)(`fieldset`,{className:`grid gap-2`,children:[p,v,D]}),t[46]=v,t[47]=D,t[48]=O):O=t[48];let k;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,q.jsx)(`legend`,{className:`text-xs font-medium`,children:`Capability grants`}),t[49]=k):k=t[49];let j;t[50]!==n||t[51]!==r?(j=ce.map(e=>(0,q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:n.capabilities.includes(e.capability),onChange:t=>r({...n,capabilities:t.target.checked?[...n.capabilities,e.capability]:n.capabilities.filter(t=>t!==e.capability)})}),(0,q.jsxs)(`span`,{children:[e.label,(0,q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description})]})]},e.capability)),t[50]=n,t[51]=r,t[52]=j):j=t[52];let M;t[53]===j?M=t[54]:(M=(0,q.jsxs)(`fieldset`,{className:`grid gap-2`,children:[k,j]}),t[53]=j,t[54]=M);let N;t[55]!==n||t[56]!==r?(N=e=>r({...n,expiresAt:e.target.value}),t[55]=n,t[56]=r,t[57]=N):N=t[57];let P;t[58]!==n.expiresAt||t[59]!==N?(P=(0,q.jsx)(A,{type:`datetime-local`,value:n.expiresAt,onChange:N}),t[58]=n.expiresAt,t[59]=N,t[60]=P):P=t[60];let F;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,q.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`Empty means no expiry.`}),t[61]=F):F=t[61];let I;t[62]===P?I=t[63]:(I=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Expires`,P,F]}),t[62]=P,t[63]=I);let L;t[64]!==n||t[65]!==r?(L=e=>r({...n,rateLimitPerMinute:e.target.value}),t[64]=n,t[65]=r,t[66]=L):L=t[66];let R;t[67]!==n.rateLimitPerMinute||t[68]!==L?(R=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Requests per minute`,(0,q.jsx)(A,{type:`number`,min:1,max:600,value:n.rateLimitPerMinute,onChange:L})]}),t[67]=n.rateLimitPerMinute,t[68]=L,t[69]=R):R=t[69];let z;t[70]!==n||t[71]!==r?(z=e=>r({...n,activeTaskLimit:e.target.value}),t[70]=n,t[71]=r,t[72]=z):z=t[72];let B;t[73]!==n.activeTaskLimit||t[74]!==z?(B=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Concurrent active tasks`,(0,q.jsx)(A,{type:`number`,min:1,max:32,value:n.activeTaskLimit,onChange:z})]}),t[73]=n.activeTaskLimit,t[74]=z,t[75]=B):B=t[75];let V;t[76]!==I||t[77]!==R||t[78]!==B?(V=(0,q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[I,R,B]}),t[76]=I,t[77]=R,t[78]=B,t[79]=V):V=t[79];let H;return t[80]!==O||t[81]!==M||t[82]!==V||t[83]!==f?(H=(0,q.jsxs)(`div`,{className:`grid gap-4`,children:[f,O,M,V]}),t[80]=O,t[81]=M,t[82]=V,t[83]=f,t[84]=H):H=t[84],H}function pe(e){let[t,n]=e;return(0,q.jsx)(`option`,{value:t,children:n},t)}function me(){let e=s(),t=u(),n=e?.environmentId??t,[r,i]=(0,K.useState)(L),[a,o]=(0,K.useState)(J),[l,d]=(0,K.useState)(!1),[f,p]=(0,K.useState)(null),[m,g]=(0,K.useState)(null),[_,v]=(0,K.useState)(null),b=(0,K.useMemo)(()=>n===null?void 0:c(n)?.agentControl,[n]),E=(0,K.useCallback)(async()=>{if(b)try{let e=await oe(()=>b.listIntegrations());i(t=>R(t,e))}catch(e){Y(`Failed to load external integrations`,e)}},[b]);(0,K.useEffect)(()=>{E()},[E]);let D=(0,K.useCallback)(async(e,t)=>{await navigator.clipboard.writeText(t),v(e),window.setTimeout(()=>v(t=>t===e?null:t),1500)},[]),O=async()=>{if(b)try{g(`new`);let e=await b.createIntegration(Z(a));i(t=>z(t,e)),o(J()),d(!1)}catch(e){Y(`Failed to create integration`,e)}finally{g(null)}},k=async e=>{if(b)try{g(e.integration.integrationId);let t=Z(a);await b.updateIntegration({integrationId:e.integration.integrationId,...t}),p(null),await E()}catch(e){Y(`Failed to update integration`,e)}finally{g(null)}},A=async e=>{if(!b)return;let t=e.integration.integrationId;try{g(t);let e=await b.resumeIntegrationPairing({integrationId:t});i(t=>z(t,e))}catch(e){Y(`Failed to resume pairing`,e)}finally{g(null)}},M=async e=>{if(!b)return;let t=e.integration.integrationId;try{g(t),await b.revokeIntegration({integrationId:t}),await E()}catch(e){Y(`Failed to revoke integration`,e)}finally{g(null)}},N=async e=>{if(!b)return;let t=e.integration.integrationId;if(window.confirm(`Delete ${e.integration.displayName}? This cannot be undone.`))try{g(t),(await b.deleteIntegration({integrationId:t})).deleted&&i(e=>B(e,t))}catch(e){Y(`Failed to delete integration`,e)}finally{g(null)}};return(0,q.jsx)(`section`,{"data-testid":`external-integrations`,className:`border-b bg-muted/10 p-6 sm:p-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto grid w-full max-w-4xl gap-5`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,q.jsx)(w,{className:`size-3.5`}),`Agent Control`]}),(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`External integrations`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Pair a local MCP client with a revocable identity. Every task request waits in Ryco for explicit user approval before a thread is created.`})]}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(j,{size:`icon`,variant:`outline`,"aria-label":`Refresh integrations`,onClick:()=>void E(),children:(0,q.jsx)(S,{})}),(0,q.jsxs)(j,{disabled:!b||!r.topology.available,onClick:()=>{p(null),o(J()),d(e=>!e)},children:[(0,q.jsx)(x,{}),`New integration`]})]})]}),r.topology.available?null:(0,q.jsxs)(`div`,{className:`flex gap-3 rounded-xl border border-warning/30 bg-warning/8 p-4 text-sm`,children:[(0,q.jsx)(te,{className:`mt-0.5 size-4 shrink-0 text-warning-foreground`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`font-medium`,children:`Local pairing is unavailable`}),(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[r.topology.reason??`Ryco could not prove a direct loopback-only topology.`,` `,`External setup fails closed while Ryco is remotely exposed or Hub-connected.`]})]})]}),l?(0,q.jsxs)(`div`,{className:`grid gap-4 rounded-xl border bg-card p-4`,children:[(0,q.jsx)(fe,{form:a,onChange:o}),(0,q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,q.jsx)(j,{variant:`ghost`,onClick:()=>d(!1),children:`Cancel`}),(0,q.jsxs)(j,{disabled:m===`new`,onClick:()=>void O(),children:[(0,q.jsx)(y,{}),`Create and pair`]})]})]}):null,r.integrations.length===0&&!l?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-6 text-center text-sm text-muted-foreground`,children:`No external integrations are configured.`}):null,r.integrations.map(e=>{let t=e.integration,n=ue(e),i=r.pairingCodes[t.integrationId],s=le(e.setup.pairCommand.command,e.setup.pairCommand.args),c=f===t.integrationId;return(0,q.jsxs)(`article`,{className:`grid gap-4 rounded-xl border bg-card p-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h3`,{className:`font-semibold`,children:t.displayName}),(0,q.jsx)(P,{variant:n.variant,children:n.label}),(0,q.jsx)(P,{variant:`outline`,children:se[t.clientKind]})]}),(0,q.jsx)(`p`,{className:`mt-1 font-mono text-[11px] text-muted-foreground`,children:t.integrationId})]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>{p(c?null:t.integrationId),o(de(e))},children:c?`Close editor`:`Edit`}),(0,q.jsxs)(j,{size:`sm`,variant:`outline`,disabled:!r.topology.available||m===t.integrationId||t.revokedAt!==null,onClick:()=>void A(e),children:[(0,q.jsx)(y,{}),`Pair again`]}),(0,q.jsx)(j,{size:`sm`,variant:`outline`,disabled:m===t.integrationId||t.revokedAt!==null,onClick:()=>void M(e),children:`Revoke`}),(0,q.jsx)(j,{size:`icon-sm`,variant:`ghost`,"aria-label":`Delete ${t.displayName}`,disabled:m===t.integrationId,onClick:()=>void N(e),children:(0,q.jsx)(T,{})})]})]}),c?(0,q.jsxs)(`div`,{className:`grid gap-4 border-t pt-4`,children:[(0,q.jsx)(fe,{form:a,onChange:o}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsxs)(j,{disabled:m===t.integrationId,onClick:()=>void k(e),children:[(0,q.jsx)(C,{}),`Save changes`]})})]}):(0,q.jsxs)(`div`,{className:`grid gap-3 text-xs sm:grid-cols-2`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Project scope`}),(0,q.jsx)(`p`,{className:`mt-0.5 break-words font-medium`,children:t.projectScope.kind===`all`?`All current and future projects`:t.projectScope.projectIds.join(`, `)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Limits`}),(0,q.jsxs)(`p`,{className:`mt-0.5 font-medium`,children:[t.rateLimitPerMinute,`/minute · `,t.activeTaskCount,`/`,t.activeTaskLimit,` active`]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Expiry`}),(0,q.jsx)(`p`,{className:`mt-0.5 font-medium`,children:X(t.expiresAt)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Last used`}),(0,q.jsx)(`p`,{className:`mt-0.5 font-medium`,children:X(t.lastUsedAt)})]}),(0,q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Capabilities`}),(0,q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:t.capabilities.map(e=>(0,q.jsx)(P,{variant:`outline`,children:e},e))})]})]}),t.pairingState===`pending`?(0,q.jsxs)(`div`,{className:`grid gap-3 rounded-lg border bg-muted/20 p-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`text-sm font-medium`,children:`Finish pairing locally`}),(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Pairing code expires `,X(t.pairingCodeExpiresAt),`. The code is shown only for this ceremony; the generated MCP configuration never contains it.`]})]}),i?(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`code`,{"data-testid":`external-pairing-code`,className:`rounded bg-background px-3 py-2 font-mono text-sm tracking-[0.18em]`,children:i}),(0,q.jsxs)(j,{size:`sm`,variant:`outline`,onClick:()=>void D(`code-${t.integrationId}`,i),children:[_===`code-${t.integrationId}`?(0,q.jsx)(h,{}):(0,q.jsx)(G,{}),`Copy code`]})]}):(0,q.jsx)(`p`,{className:`text-xs text-warning-foreground`,children:`The pairing code is no longer displayed. Choose Pair again to generate a new one.`}),(0,q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium`,children:`Run this bridge command, then enter the code`}),(0,q.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,q.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded bg-background p-2 text-[11px]`,children:s}),(0,q.jsx)(j,{size:`icon-sm`,variant:`outline`,"aria-label":`Copy pairing command`,onClick:()=>void D(`pair-${t.integrationId}`,s),children:_===`pair-${t.integrationId}`?(0,q.jsx)(h,{}):(0,q.jsx)(G,{})})]})]}),(0,q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium`,children:`MCP configuration`}),(0,q.jsx)(`pre`,{"data-testid":`external-mcp-configuration`,className:`max-h-48 overflow-auto rounded bg-background p-3 text-[11px] leading-relaxed`,children:e.setup.configuration}),(0,q.jsxs)(j,{className:`justify-self-start`,size:`sm`,variant:`outline`,onClick:()=>void D(`config-${t.integrationId}`,e.setup.configuration),children:[_===`config-${t.integrationId}`?(0,q.jsx)(h,{}):(0,q.jsx)(G,{}),`Copy configuration`]})]})]}):null]},t.integrationId)})]})})}var he=[],ge=[];function _e(e){return e.displayName??F(e.driver)?.label??f(e.driver)}function Q(e){return e.providerDisplayName??F(e.driver)?.label??f(e.driver)}function ve(e){return e.driver===`codex`?`codex`:e.driver===`claudeAgent`?`claude-code`:`generic-mcp`}function ye(e){return{...J(),displayName:`${Q(e)} Agent Control`,clientKind:ve(e)}}function be(e,t){return e.filter(e=>e.workspaceId===t).toSorted((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0]}function xe(e){if(!e)return{label:`Not connected`,variant:`outline`};switch(e.state){case`connected`:return{label:`Connected`,variant:`success`};case`repair-needed`:return{label:`Needs repair`,variant:`error`};case`disconnected`:case`revoked`:return{label:`Disconnected`,variant:`outline`};case`disconnecting`:return{label:`Disconnecting`,variant:`warning`};case`planned`:case`credential-written`:case`provider-written`:case`verifying`:return{label:`Connecting`,variant:`warning`}}}function Se(e,t){_.add(M({type:`success`,title:e,description:t}))}function $(e,t){_.add(M({type:`error`,title:e,description:t instanceof Error?t.message:`The request failed.`}))}function Ce(){let e=s(),t=u(),n=e?.environmentId??t,[r,i]=(0,K.useState)(he),[a,o]=(0,K.useState)(ge),[l,d]=(0,K.useState)(V),[f,p]=(0,K.useState)(null),[h,g]=(0,K.useState)(!0),[_,y]=(0,K.useState)(null),[x,C]=(0,K.useState)(null),[w,T]=(0,K.useState)(J),k=(0,K.useMemo)(()=>n===null?void 0:c(n),[n]),A=k?.agentControl,M=k?.mcp,N=(0,K.useCallback)(async()=>{if(!A||!M){g(!1);return}try{let[e,t,n]=await oe(()=>Promise.all([M.listWorkspaces(),A.listMcpInstallations(),A.listIntegrations()]));i(e.providers),o(e.workspaces),d(e=>ee(e,t)),p(n.topology)}catch(e){$(`Failed to load Agent Control providers`,e)}finally{g(!1)}},[A,M]);(0,K.useEffect)(()=>{N()},[N]);let I=async(e,t)=>{if(A)try{y(e.id);let n=t?(()=>{let{clientKind:t,...n}=Z(w);return{workspaceId:e.id,...n}})():{workspaceId:e.id},r=await A.connectMcpInstallation(n);d(e=>U(e,r)),C(null),Se(`${Q(e)} connected`,`The credential was stored locally and was not shown to the browser.`)}catch(t){$(`Failed to connect ${Q(e)}`,t),await N()}finally{y(null)}},L=async(e,t)=>{if(A)try{y(e.id);let n=await A.repairMcpInstallation({installationId:t.installationId});d(e=>U(e,n)),Se(`${Q(e)} repaired`)}catch(t){$(`Failed to repair ${Q(e)}`,t),await N()}finally{y(null)}},R=async(e,t)=>{if(A&&window.confirm(`Disconnect Agent Control from ${Q(e)}?`))try{y(e.id);let n=await A.disconnectMcpInstallation({installationId:t.installationId});d(e=>U(e,n)),Se(`${Q(e)} disconnected`)}catch(t){$(`Failed to disconnect ${Q(e)}`,t),await N()}finally{y(null)}},z=a.filter(e=>e.capabilities.externalAgentControl===`available`);return(0,q.jsx)(`section`,{"data-testid":`agent-control-mcp-installations`,className:`border-b bg-muted/10 p-6 sm:p-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto grid w-full max-w-4xl gap-8`,children:[(0,q.jsxs)(`section`,{className:`grid gap-4`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,q.jsx)(m,{className:`size-3.5`}),`Ryco sessions`]}),(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`Automatic inside Ryco`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Supported sessions started by Ryco receive Agent Control automatically. There is nothing to install in those provider profiles.`})]}),h?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border p-4 text-sm text-muted-foreground`,children:[(0,q.jsx)(b,{className:`size-4 animate-spin`}),` Loading providers…`]}):r.length===0?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-4 text-sm text-muted-foreground`,children:`No configured provider instances were found.`}):(0,q.jsx)(`div`,{className:`divide-y overflow-hidden rounded-xl border bg-card`,children:r.map(e=>{let t=F(e.driver)?.icon??m,n=e.enabled&&e.capabilities.automaticAgentControl===`available`;return(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-4 py-3`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg border bg-background`,children:(0,q.jsx)(t,{className:`size-4 text-muted-foreground`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-sm font-medium`,children:_e(e)}),(0,q.jsx)(`p`,{className:`mt-0.5 font-mono text-[11px] text-muted-foreground`,children:e.instanceId}),(0,q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:n?`Available in every new Ryco-managed session.`:e.enabled?`This provider does not expose automatic Agent Control yet.`:`This provider instance is disabled.`})]})]}),(0,q.jsx)(P,{variant:n?`success`:`outline`,children:n?`Automatic`:e.enabled?`Unavailable`:`Disabled`})]},e.instanceId)})})]}),(0,q.jsxs)(`section`,{className:`grid gap-4`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,q.jsx)(W,{className:`size-3.5`}),`External agents`]}),(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`Connect an installed provider`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Ryco detects local provider profiles and writes their native MCP configuration. The default grants project listing and task request/read access, limited to 60 requests per minute and one active task. Every task still requires approval.`})]}),(0,q.jsx)(j,{size:`icon`,variant:`outline`,"aria-label":`Refresh Agent Control providers`,disabled:h,onClick:()=>void N(),children:(0,q.jsx)(S,{})})]}),f&&!f.available?(0,q.jsxs)(`div`,{className:`flex gap-3 rounded-xl border border-warning/30 bg-warning/8 p-4 text-sm`,children:[(0,q.jsx)(E,{className:`mt-0.5 size-4 shrink-0 text-warning-foreground`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`font-medium`,children:`Local installation is unavailable`}),(0,q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:f.reason??`Ryco could not prove a direct loopback-only topology.`})]})]}):null,!h&&(!A||!M)?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-4 text-sm text-muted-foreground`,children:`This Ryco environment does not expose provider MCP installation yet.`}):!h&&z.length===0?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-4 text-sm text-muted-foreground`,children:`No installable provider profiles were detected. Configure a supported provider instance first, then refresh.`}):(0,q.jsx)(`div`,{className:`grid gap-3`,children:z.map(e=>{let t=be(l.installations,e.id),n=xe(t),r=t?.state===`connected`,i=t?.state===`repair-needed`,a=_===e.id,o=x===e.id,s=F(e.driver)?.icon??W;return(0,q.jsxs)(`article`,{className:`grid gap-4 rounded-xl border bg-card p-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg border bg-background`,children:(0,q.jsx)(s,{className:`size-4 text-muted-foreground`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-semibold`,children:Q(e)}),(0,q.jsx)(P,{variant:n.variant,children:n.label})]}),(0,q.jsx)(`p`,{className:`mt-1 truncate font-mono text-[11px] text-muted-foreground`,children:e.displayPath}),(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[e.providerInstances.length,` configured provider`,e.providerInstances.length===1?` instance`:` instances`,t?` · MCP name ${t.serverName}`:``]})]})]}),(0,q.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2 sm:justify-end`,children:i&&t?(0,q.jsxs)(j,{size:`sm`,disabled:a||f?.available===!1,onClick:()=>void L(e,t),children:[a?(0,q.jsx)(b,{className:`animate-spin`}):(0,q.jsx)(O,{}),`Repair`]}):r&&t?(0,q.jsxs)(j,{size:`sm`,variant:`outline`,disabled:a,onClick:()=>void R(e,t),children:[a?(0,q.jsx)(b,{className:`animate-spin`}):(0,q.jsx)(D,{}),`Disconnect`]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(j,{size:`sm`,variant:`outline`,disabled:a||f?.available===!1,onClick:()=>{o?C(null):(T(ye(e)),C(e.id))},children:o?`Close`:`Customize`}),(0,q.jsxs)(j,{size:`sm`,disabled:a||f?.available===!1,onClick:()=>void I(e,!1),children:[a?(0,q.jsx)(b,{className:`animate-spin`}):(0,q.jsx)(v,{}),`Connect`]})]})})]}),t?.lastError?(0,q.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-3 text-xs text-destructive`,children:t.lastError}):null,t?.preservedUserChanges?(0,q.jsx)(`div`,{className:`rounded-lg border border-warning/30 bg-warning/8 p-3 text-xs text-warning-foreground`,children:`Ryco left this provider's MCP entry untouched because it had been edited after installation.`}):null,o?(0,q.jsxs)(`div`,{className:`grid gap-4 border-t pt-4`,children:[(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Customize the credential scope and limits before Ryco installs it. The provider profile is fixed to this detected workspace.`}),(0,q.jsx)(fe,{form:w,onChange:T,clientLocked:!0}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsxs)(j,{disabled:a||f?.available===!1,onClick:()=>void I(e,!0),children:[a?(0,q.jsx)(b,{className:`animate-spin`}):(0,q.jsx)(W,{}),`Connect with these permissions`]})})]}):null]},e.id)})})]})]})})}function we(){let e=(0,ne.c)(26),t=o(Te),{updateSettings:n}=l(),r=N(a.serverUpdateSettings),i,s,c;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,q.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Agent Control`}),s=(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`Private tools for every agent`}),c=(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Ryco sessions receive the tools automatically. Connect supported standalone provider profiles with one click. Every requested change still waits for explicit approval.`}),e[0]=i,e[1]=s,e[2]=c):(i=e[0],s=e[1],c=e[2]);let u=t?`Enabled. New Ryco-managed sessions receive Agent Control without changing the provider's global MCP configuration.`:`Disabled. Agent Control is unavailable to Ryco sessions and external clients.`,d;e[3]===u?d=e[4]:(d=(0,q.jsx)(`p`,{className:`mt-2 max-w-2xl text-xs leading-relaxed text-muted-foreground`,children:u}),e[3]=u,e[4]=d);let f;e[5]!==r.allowed||e[6]!==r.reason?(f=!r.allowed&&r.reason?(0,q.jsx)(`p`,{className:`mt-2 max-w-2xl text-xs leading-relaxed text-destructive`,children:r.reason}):null,e[5]=r.allowed,e[6]=r.reason,e[7]=f):f=e[7];let p;e[8]!==d||e[9]!==f?(p=(0,q.jsxs)(`div`,{children:[i,s,c,d,f]}),e[8]=d,e[9]=f,e[10]=p):p=e[10];let m=!r.allowed,h;e[11]===n?h=e[12]:(h=e=>n({agentControl:{enabled:!!e}}),e[11]=n,e[12]=h);let _;e[13]!==t||e[14]!==m||e[15]!==h?(_=(0,q.jsx)(k,{checked:t,disabled:m,onCheckedChange:h,"aria-label":`Enable Agent Control`}),e[13]=t,e[14]=m,e[15]=h,e[16]=_):_=e[16];let v;e[17]!==p||e[18]!==_?(v=(0,q.jsx)(`section`,{className:`border-b bg-muted/10 p-6 sm:p-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[p,_]})}),e[17]=p,e[18]=_,e[19]=v):v=e[19];let b;e[20]===t?b=e[21]:(b=t?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Ce,{}),(0,q.jsxs)(`details`,{className:`group border-b bg-muted/5`,children:[(0,q.jsxs)(`summary`,{className:`mx-auto flex w-full max-w-4xl cursor-pointer list-none items-center gap-3 px-6 py-5 sm:px-8 [&::-webkit-details-marker]:hidden`,children:[(0,q.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-lg border bg-background`,children:(0,q.jsx)(y,{className:`size-4 text-muted-foreground`})}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`block text-sm font-semibold`,children:`Advanced manual setup`}),(0,q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`Create a revocable pairing for another MCP client or a profile Ryco cannot detect.`})]}),(0,q.jsx)(g,{className:`size-4 text-muted-foreground transition-transform group-open:rotate-90`})]}),(0,q.jsx)(me,{})]})]}):null,e[20]=t,e[21]=b);let x;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,q.jsx)(I,{}),e[22]=x):x=e[22];let S;return e[23]!==v||e[24]!==b?(S=(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[v,b,x]}),e[23]=v,e[24]=b,e[25]=S):S=e[25],S}function Te(e){return e.agentControl.enabled}export{we as IntegrationsSettingsPanel};
|
|
1
|
+
import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{Fr as r,d as i,t as a}from"./src-Vf4LVnMX.js";import{Rn as o,Xn as s,hn as c,zn as l}from"./runtime-CXut_g4p.js";import{a as u}from"./primary-BzLEg2w1.js";import{It as d,Z as f}from"./composerDraftStore-CdJJZe42.js";import{f as p}from"./useRenderElement-DchFnsR8.js";import{t as m}from"./bot-DJp0cuhK.js";import{n as h}from"./loader-circle-CrtHFAvM.js";import{t as g}from"./chevron-right-BWYGybX9.js";import{i as _,o as v}from"./toast-CcSCAm4B.js";import{t as y}from"./key-round-CacMputS.js";import{t as b}from"./loader-zHASMrUy.js";import{t as x}from"./plus-B2h-VEqh.js";import{t as S}from"./refresh-cw-DopCMrtR.js";import{t as C}from"./save-Bh36JIv6.js";import{t as w}from"./shield-check-dQ-4cMKk.js";import{t as T}from"./trash-2-CM1zXPGb.js";import{t as E}from"./triangle-alert-RL_T3KLo.js";import{t as D}from"./unplug-Cw8iawyX.js";import{t as O}from"./wrench-D0IetWa1.js";import{t as k}from"./switch-BTGo9Yip.js";import{t as A}from"./input-CHEwW3oH.js";import{t as j}from"./button-BAbJxRzt.js";import{t as M}from"./toastHelpers-CSQRKo4F.js";import{t as N}from"./capabilities-3zgirmmI.js";import{t as P}from"./badge-CXw6fWrB.js";import"./providerModels-BJcfB_9E.js";import{r as F}from"./providerDriverMeta-I0TSo-QI.js";import{McpServersSettings as I}from"./McpServersSettings-B7YqVvV4.js";var L=()=>({integrations:[],topology:{available:!1,reason:`Not loaded.`},pairingCodes:{}}),R=(e,t)=>({integrations:t.integrations,topology:t.topology,pairingCodes:{}}),z=(e,t)=>({...e,integrations:[...e.integrations.filter(e=>e.integration.integrationId!==t.detail.integration.integrationId),t.detail],pairingCodes:{...e.pairingCodes,[t.detail.integration.integrationId]:t.pairingCode}}),B=(e,t)=>{let n={...e.pairingCodes};return delete n[t],{...e,integrations:e.integrations.filter(e=>e.integration.integrationId!==t),pairingCodes:n}},V=()=>({installations:[]}),H=e=>[...e].toSorted((e,t)=>e.driver.localeCompare(t.driver)||e.createdAt.localeCompare(t.createdAt)||e.installationId.localeCompare(t.installationId)),ee=(e,t)=>({installations:H(t.installations)}),U=(e,t)=>{let n=e.installations.find(e=>e.installationId===t.installation.installationId);return n&&n.revision>t.installation.revision?e:{installations:H([...e.installations.filter(e=>e.installationId!==t.installation.installationId),t.installation])}},W=p(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),G=p(`clipboard`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]),te=p(`link-2-off`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7`,key:`10o201`}],[`path`,{d:`M15 7h2a5 5 0 0 1 4 8`,key:`1d3206`}],[`line`,{x1:`8`,x2:`12`,y1:`12`,y2:`12`,key:`rvw6j4`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]),K=e(t(),1),ne=n(),re=[50,100,200,400],ie=e=>e instanceof Error&&e.message.trim()===`Agent Control is disabled.`,ae=e=>new Promise(t=>window.setTimeout(t,e));async function oe(e,t=ae){for(let n of re)try{return await e()}catch(e){if(!ie(e))throw e;await t(n)}return e()}var q=d(),se={codex:`Codex`,"claude-code":`Claude Code`,"claude-desktop":`Claude Desktop`,"generic-mcp":`Generic MCP`},ce=[{capability:i.externalListProjects,label:`List allowed projects`,description:`Discover only projects inside this integration's scope.`},{capability:i.externalCreateTask,label:`Request tasks`,description:`Submit one task to Ryco's normal approval queue.`},{capability:i.externalReadTask,label:`Read own tasks`,description:`Read or wait only for tasks created by this integration.`},{capability:i.externalReadAutomations,label:`Read automations`,description:`Read bounded schedules and run outcomes inside the selected project scope.`},{capability:i.externalManageAutomations,label:`Request automations`,description:`Propose schedule changes; each due run still requires separate approval.`},{capability:i.externalReadActivity,label:`Read activity`,description:`Read bounded payload-free project and provider event summaries.`},{capability:i.externalReadDiagnostics,label:`Read diagnostics`,description:`Read redacted count-only health summaries for allowed projects.`},{capability:i.externalSharedCheckout,label:`Request shared checkout`,description:`May request the local checkout; each request still needs approval.`},{capability:i.externalFullAccess,label:`Request full access`,description:`May request a full-access runtime; each request still needs approval.`}],J=()=>({displayName:``,clientKind:`codex`,scopeKind:`all`,projectIds:``,capabilities:[i.externalListProjects,i.externalCreateTask,i.externalReadTask],expiresAt:``,rateLimitPerMinute:`60`,activeTaskLimit:`1`});function Y(e,t){_.add(M({type:`error`,title:e,description:t instanceof Error?t.message:`The request failed.`}))}function le(e,t){return[e,...t.map(e=>JSON.stringify(e))].join(` `)}function X(e){return e===null?`Never`:new Date(e).toLocaleString()}function ue(e){let t=e.integration;return t.revokedAt===null?t.expiresAt!==null&&Date.parse(t.expiresAt)<=Date.now()?{label:`Expired`,variant:`error`}:t.pairingState===`paired`?{label:`Paired`,variant:`success`}:t.pairingState===`pending`?{label:`Pairing`,variant:`warning`}:{label:`Unpaired`,variant:`outline`}:{label:`Revoked`,variant:`error`}}function de(e){let t=e.integration;return{displayName:t.displayName,clientKind:t.clientKind,scopeKind:t.projectScope.kind,projectIds:t.projectScope.kind===`selected`?t.projectScope.projectIds.join(`, `):``,capabilities:t.capabilities,expiresAt:t.expiresAt===null?``:new Date(t.expiresAt).toISOString().slice(0,16),rateLimitPerMinute:String(t.rateLimitPerMinute),activeTaskLimit:String(t.activeTaskLimit)}}function Z(e){let t=e.projectIds.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>r.make(e)),n=e.scopeKind===`all`?{kind:`all`}:{kind:`selected`,projectIds:t},i=Number(e.rateLimitPerMinute),a=Number(e.activeTaskLimit);if(!e.displayName.trim())throw Error(`A display name is required.`);if(e.scopeKind===`selected`&&t.length===0)throw Error(`Enter at least one project ID for selected-project scope.`);if(!Number.isInteger(i)||i<1)throw Error(`Rate limit must be a positive whole number.`);if(!Number.isInteger(a)||a<1)throw Error(`Active-task limit must be a positive whole number.`);return{displayName:e.displayName.trim(),clientKind:e.clientKind,projectScope:n,capabilities:e.capabilities,expiresAt:e.expiresAt?new Date(e.expiresAt).toISOString():null,rateLimitPerMinute:i,activeTaskLimit:a}}function fe(e){let t=(0,ne.c)(85),{form:n,onChange:r,clientLocked:i}=e,a=i!==void 0&&i,o;t[0]!==n||t[1]!==r?(o=e=>r({...n,displayName:e.target.value}),t[0]=n,t[1]=r,t[2]=o):o=t[2];let s;t[3]!==n.displayName||t[4]!==o?(s=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Display name`,(0,q.jsx)(A,{value:n.displayName,placeholder:`Local Codex`,onChange:o})]}),t[3]=n.displayName,t[4]=o,t[5]=s):s=t[5];let c=n.clientKind,l;t[6]!==n||t[7]!==r?(l=e=>r({...n,clientKind:e.target.value}),t[6]=n,t[7]=r,t[8]=l):l=t[8];let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.entries(se).map(pe),t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==n.clientKind||t[12]!==l?(d=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Client`,(0,q.jsx)(`select`,{className:`h-9 rounded-lg border border-input bg-background px-3 text-sm`,value:c,disabled:a,onChange:l,children:u})]}),t[10]=a,t[11]=n.clientKind,t[12]=l,t[13]=d):d=t[13];let f;t[14]!==s||t[15]!==d?(f=(0,q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[s,d]}),t[14]=s,t[15]=d,t[16]=f):f=t[16];let p;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,q.jsx)(`legend`,{className:`text-xs font-medium`,children:`Project scope`}),t[17]=p):p=t[17];let m=n.scopeKind===`all`,h;t[18]!==n||t[19]!==r?(h=()=>r({...n,scopeKind:`all`}),t[18]=n,t[19]=r,t[20]=h):h=t[20];let g;t[21]!==m||t[22]!==h?(g=(0,q.jsx)(`input`,{type:`radio`,checked:m,onChange:h}),t[21]=m,t[22]=h,t[23]=g):g=t[23];let _;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,q.jsxs)(`span`,{children:[`All current and future projects`,(0,q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`The client can discover every project on this local Ryco instance.`})]}),t[24]=_):_=t[24];let v;t[25]===g?v=t[26]:(v=(0,q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[g,_]}),t[25]=g,t[26]=v);let y=n.scopeKind===`selected`,b;t[27]!==n||t[28]!==r?(b=()=>r({...n,scopeKind:`selected`}),t[27]=n,t[28]=r,t[29]=b):b=t[29];let x;t[30]!==y||t[31]!==b?(x=(0,q.jsx)(`input`,{type:`radio`,checked:y,onChange:b}),t[30]=y,t[31]=b,t[32]=x):x=t[32];let S=n.scopeKind!==`selected`,C;t[33]!==n||t[34]!==r?(C=e=>r({...n,projectIds:e.target.value}),t[33]=n,t[34]=r,t[35]=C):C=t[35];let w;t[36]!==n.projectIds||t[37]!==S||t[38]!==C?(w=(0,q.jsx)(A,{className:`mt-1.5`,value:n.projectIds,disabled:S,placeholder:`project-id-1, project-id-2`,"aria-label":`Selected project IDs`,onChange:C}),t[36]=n.projectIds,t[37]=S,t[38]=C,t[39]=w):w=t[39];let T;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,q.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:`Comma-separated stable project IDs. Unknown IDs remain inaccessible.`}),t[40]=T):T=t[40];let E;t[41]===w?E=t[42]:(E=(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Selected projects`,w,T]}),t[41]=w,t[42]=E);let D;t[43]!==x||t[44]!==E?(D=(0,q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[x,E]}),t[43]=x,t[44]=E,t[45]=D):D=t[45];let O;t[46]!==v||t[47]!==D?(O=(0,q.jsxs)(`fieldset`,{className:`grid gap-2`,children:[p,v,D]}),t[46]=v,t[47]=D,t[48]=O):O=t[48];let k;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,q.jsx)(`legend`,{className:`text-xs font-medium`,children:`Capability grants`}),t[49]=k):k=t[49];let j;t[50]!==n||t[51]!==r?(j=ce.map(e=>(0,q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:n.capabilities.includes(e.capability),onChange:t=>r({...n,capabilities:t.target.checked?[...n.capabilities,e.capability]:n.capabilities.filter(t=>t!==e.capability)})}),(0,q.jsxs)(`span`,{children:[e.label,(0,q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description})]})]},e.capability)),t[50]=n,t[51]=r,t[52]=j):j=t[52];let M;t[53]===j?M=t[54]:(M=(0,q.jsxs)(`fieldset`,{className:`grid gap-2`,children:[k,j]}),t[53]=j,t[54]=M);let N;t[55]!==n||t[56]!==r?(N=e=>r({...n,expiresAt:e.target.value}),t[55]=n,t[56]=r,t[57]=N):N=t[57];let P;t[58]!==n.expiresAt||t[59]!==N?(P=(0,q.jsx)(A,{type:`datetime-local`,value:n.expiresAt,onChange:N}),t[58]=n.expiresAt,t[59]=N,t[60]=P):P=t[60];let F;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,q.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`Empty means no expiry.`}),t[61]=F):F=t[61];let I;t[62]===P?I=t[63]:(I=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Expires`,P,F]}),t[62]=P,t[63]=I);let L;t[64]!==n||t[65]!==r?(L=e=>r({...n,rateLimitPerMinute:e.target.value}),t[64]=n,t[65]=r,t[66]=L):L=t[66];let R;t[67]!==n.rateLimitPerMinute||t[68]!==L?(R=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Requests per minute`,(0,q.jsx)(A,{type:`number`,min:1,max:600,value:n.rateLimitPerMinute,onChange:L})]}),t[67]=n.rateLimitPerMinute,t[68]=L,t[69]=R):R=t[69];let z;t[70]!==n||t[71]!==r?(z=e=>r({...n,activeTaskLimit:e.target.value}),t[70]=n,t[71]=r,t[72]=z):z=t[72];let B;t[73]!==n.activeTaskLimit||t[74]!==z?(B=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Concurrent active tasks`,(0,q.jsx)(A,{type:`number`,min:1,max:32,value:n.activeTaskLimit,onChange:z})]}),t[73]=n.activeTaskLimit,t[74]=z,t[75]=B):B=t[75];let V;t[76]!==I||t[77]!==R||t[78]!==B?(V=(0,q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[I,R,B]}),t[76]=I,t[77]=R,t[78]=B,t[79]=V):V=t[79];let H;return t[80]!==O||t[81]!==M||t[82]!==V||t[83]!==f?(H=(0,q.jsxs)(`div`,{className:`grid gap-4`,children:[f,O,M,V]}),t[80]=O,t[81]=M,t[82]=V,t[83]=f,t[84]=H):H=t[84],H}function pe(e){let[t,n]=e;return(0,q.jsx)(`option`,{value:t,children:n},t)}function me(){let e=s(),t=u(),n=e?.environmentId??t,[r,i]=(0,K.useState)(L),[a,o]=(0,K.useState)(J),[l,d]=(0,K.useState)(!1),[f,p]=(0,K.useState)(null),[m,g]=(0,K.useState)(null),[_,v]=(0,K.useState)(null),b=(0,K.useMemo)(()=>n===null?void 0:c(n)?.agentControl,[n]),E=(0,K.useCallback)(async()=>{if(b)try{let e=await oe(()=>b.listIntegrations());i(t=>R(t,e))}catch(e){Y(`Failed to load external integrations`,e)}},[b]);(0,K.useEffect)(()=>{E()},[E]);let D=(0,K.useCallback)(async(e,t)=>{await navigator.clipboard.writeText(t),v(e),window.setTimeout(()=>v(t=>t===e?null:t),1500)},[]),O=async()=>{if(b)try{g(`new`);let e=await b.createIntegration(Z(a));i(t=>z(t,e)),o(J()),d(!1)}catch(e){Y(`Failed to create integration`,e)}finally{g(null)}},k=async e=>{if(b)try{g(e.integration.integrationId);let t=Z(a);await b.updateIntegration({integrationId:e.integration.integrationId,...t}),p(null),await E()}catch(e){Y(`Failed to update integration`,e)}finally{g(null)}},A=async e=>{if(!b)return;let t=e.integration.integrationId;try{g(t);let e=await b.resumeIntegrationPairing({integrationId:t});i(t=>z(t,e))}catch(e){Y(`Failed to resume pairing`,e)}finally{g(null)}},M=async e=>{if(!b)return;let t=e.integration.integrationId;try{g(t),await b.revokeIntegration({integrationId:t}),await E()}catch(e){Y(`Failed to revoke integration`,e)}finally{g(null)}},N=async e=>{if(!b)return;let t=e.integration.integrationId;if(window.confirm(`Delete ${e.integration.displayName}? This cannot be undone.`))try{g(t),(await b.deleteIntegration({integrationId:t})).deleted&&i(e=>B(e,t))}catch(e){Y(`Failed to delete integration`,e)}finally{g(null)}};return(0,q.jsx)(`section`,{"data-testid":`external-integrations`,className:`border-b bg-muted/10 p-6 sm:p-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto grid w-full max-w-4xl gap-5`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,q.jsx)(w,{className:`size-3.5`}),`Agent Control`]}),(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`External integrations`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Pair a local MCP client with a revocable identity. Every task request waits in Ryco for explicit user approval before a thread is created.`})]}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(j,{size:`icon`,variant:`outline`,"aria-label":`Refresh integrations`,onClick:()=>void E(),children:(0,q.jsx)(S,{})}),(0,q.jsxs)(j,{disabled:!b||!r.topology.available,onClick:()=>{p(null),o(J()),d(e=>!e)},children:[(0,q.jsx)(x,{}),`New integration`]})]})]}),r.topology.available?null:(0,q.jsxs)(`div`,{className:`flex gap-3 rounded-xl border border-warning/30 bg-warning/8 p-4 text-sm`,children:[(0,q.jsx)(te,{className:`mt-0.5 size-4 shrink-0 text-warning-foreground`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`font-medium`,children:`Local pairing is unavailable`}),(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[r.topology.reason??`Ryco could not prove a direct loopback-only topology.`,` `,`External setup fails closed while Ryco is remotely exposed or Hub-connected.`]})]})]}),l?(0,q.jsxs)(`div`,{className:`grid gap-4 rounded-xl border bg-card p-4`,children:[(0,q.jsx)(fe,{form:a,onChange:o}),(0,q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,q.jsx)(j,{variant:`ghost`,onClick:()=>d(!1),children:`Cancel`}),(0,q.jsxs)(j,{disabled:m===`new`,onClick:()=>void O(),children:[(0,q.jsx)(y,{}),`Create and pair`]})]})]}):null,r.integrations.length===0&&!l?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-6 text-center text-sm text-muted-foreground`,children:`No external integrations are configured.`}):null,r.integrations.map(e=>{let t=e.integration,n=ue(e),i=r.pairingCodes[t.integrationId],s=le(e.setup.pairCommand.command,e.setup.pairCommand.args),c=f===t.integrationId;return(0,q.jsxs)(`article`,{className:`grid gap-4 rounded-xl border bg-card p-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h3`,{className:`font-semibold`,children:t.displayName}),(0,q.jsx)(P,{variant:n.variant,children:n.label}),(0,q.jsx)(P,{variant:`outline`,children:se[t.clientKind]})]}),(0,q.jsx)(`p`,{className:`mt-1 font-mono text-[11px] text-muted-foreground`,children:t.integrationId})]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>{p(c?null:t.integrationId),o(de(e))},children:c?`Close editor`:`Edit`}),(0,q.jsxs)(j,{size:`sm`,variant:`outline`,disabled:!r.topology.available||m===t.integrationId||t.revokedAt!==null,onClick:()=>void A(e),children:[(0,q.jsx)(y,{}),`Pair again`]}),(0,q.jsx)(j,{size:`sm`,variant:`outline`,disabled:m===t.integrationId||t.revokedAt!==null,onClick:()=>void M(e),children:`Revoke`}),(0,q.jsx)(j,{size:`icon-sm`,variant:`ghost`,"aria-label":`Delete ${t.displayName}`,disabled:m===t.integrationId,onClick:()=>void N(e),children:(0,q.jsx)(T,{})})]})]}),c?(0,q.jsxs)(`div`,{className:`grid gap-4 border-t pt-4`,children:[(0,q.jsx)(fe,{form:a,onChange:o}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsxs)(j,{disabled:m===t.integrationId,onClick:()=>void k(e),children:[(0,q.jsx)(C,{}),`Save changes`]})})]}):(0,q.jsxs)(`div`,{className:`grid gap-3 text-xs sm:grid-cols-2`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Project scope`}),(0,q.jsx)(`p`,{className:`mt-0.5 break-words font-medium`,children:t.projectScope.kind===`all`?`All current and future projects`:t.projectScope.projectIds.join(`, `)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Limits`}),(0,q.jsxs)(`p`,{className:`mt-0.5 font-medium`,children:[t.rateLimitPerMinute,`/minute · `,t.activeTaskCount,`/`,t.activeTaskLimit,` active`]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Expiry`}),(0,q.jsx)(`p`,{className:`mt-0.5 font-medium`,children:X(t.expiresAt)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Last used`}),(0,q.jsx)(`p`,{className:`mt-0.5 font-medium`,children:X(t.lastUsedAt)})]}),(0,q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Capabilities`}),(0,q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:t.capabilities.map(e=>(0,q.jsx)(P,{variant:`outline`,children:e},e))})]})]}),t.pairingState===`pending`?(0,q.jsxs)(`div`,{className:`grid gap-3 rounded-lg border bg-muted/20 p-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`text-sm font-medium`,children:`Finish pairing locally`}),(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Pairing code expires `,X(t.pairingCodeExpiresAt),`. The code is shown only for this ceremony; the generated MCP configuration never contains it.`]})]}),i?(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`code`,{"data-testid":`external-pairing-code`,className:`rounded bg-background px-3 py-2 font-mono text-sm tracking-[0.18em]`,children:i}),(0,q.jsxs)(j,{size:`sm`,variant:`outline`,onClick:()=>void D(`code-${t.integrationId}`,i),children:[_===`code-${t.integrationId}`?(0,q.jsx)(h,{}):(0,q.jsx)(G,{}),`Copy code`]})]}):(0,q.jsx)(`p`,{className:`text-xs text-warning-foreground`,children:`The pairing code is no longer displayed. Choose Pair again to generate a new one.`}),(0,q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium`,children:`Run this bridge command, then enter the code`}),(0,q.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,q.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded bg-background p-2 text-[11px]`,children:s}),(0,q.jsx)(j,{size:`icon-sm`,variant:`outline`,"aria-label":`Copy pairing command`,onClick:()=>void D(`pair-${t.integrationId}`,s),children:_===`pair-${t.integrationId}`?(0,q.jsx)(h,{}):(0,q.jsx)(G,{})})]})]}),(0,q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium`,children:`MCP configuration`}),(0,q.jsx)(`pre`,{"data-testid":`external-mcp-configuration`,className:`max-h-48 overflow-auto rounded bg-background p-3 text-[11px] leading-relaxed`,children:e.setup.configuration}),(0,q.jsxs)(j,{className:`justify-self-start`,size:`sm`,variant:`outline`,onClick:()=>void D(`config-${t.integrationId}`,e.setup.configuration),children:[_===`config-${t.integrationId}`?(0,q.jsx)(h,{}):(0,q.jsx)(G,{}),`Copy configuration`]})]})]}):null]},t.integrationId)})]})})}var he=[],ge=[];function _e(e){return e.displayName??F(e.driver)?.label??f(e.driver)}function Q(e){return e.providerDisplayName??F(e.driver)?.label??f(e.driver)}function ve(e){return e.driver===`codex`?`codex`:e.driver===`claudeAgent`?`claude-code`:`generic-mcp`}function ye(e){return{...J(),displayName:`${Q(e)} Agent Control`,clientKind:ve(e)}}function be(e,t){return e.filter(e=>e.workspaceId===t).toSorted((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0]}function xe(e){if(!e)return{label:`Not connected`,variant:`outline`};switch(e.state){case`connected`:return{label:`Connected`,variant:`success`};case`repair-needed`:return{label:`Needs repair`,variant:`error`};case`disconnected`:case`revoked`:return{label:`Disconnected`,variant:`outline`};case`disconnecting`:return{label:`Disconnecting`,variant:`warning`};case`planned`:case`credential-written`:case`provider-written`:case`verifying`:return{label:`Connecting`,variant:`warning`}}}function Se(e,t){_.add(M({type:`success`,title:e,description:t}))}function $(e,t){_.add(M({type:`error`,title:e,description:t instanceof Error?t.message:`The request failed.`}))}function Ce(){let e=s(),t=u(),n=e?.environmentId??t,[r,i]=(0,K.useState)(he),[a,o]=(0,K.useState)(ge),[l,d]=(0,K.useState)(V),[f,p]=(0,K.useState)(null),[h,g]=(0,K.useState)(!0),[_,y]=(0,K.useState)(null),[x,C]=(0,K.useState)(null),[w,T]=(0,K.useState)(J),k=(0,K.useMemo)(()=>n===null?void 0:c(n),[n]),A=k?.agentControl,M=k?.mcp,N=(0,K.useCallback)(async()=>{if(!A||!M){g(!1);return}try{let[e,t,n]=await oe(()=>Promise.all([M.listWorkspaces(),A.listMcpInstallations(),A.listIntegrations()]));i(e.providers),o(e.workspaces),d(e=>ee(e,t)),p(n.topology)}catch(e){$(`Failed to load Agent Control providers`,e)}finally{g(!1)}},[A,M]);(0,K.useEffect)(()=>{N()},[N]);let I=async(e,t)=>{if(A)try{y(e.id);let n=t?(()=>{let{clientKind:t,...n}=Z(w);return{workspaceId:e.id,...n}})():{workspaceId:e.id},r=await A.connectMcpInstallation(n);d(e=>U(e,r)),C(null),Se(`${Q(e)} connected`,`The credential was stored locally and was not shown to the browser.`)}catch(t){$(`Failed to connect ${Q(e)}`,t),await N()}finally{y(null)}},L=async(e,t)=>{if(A)try{y(e.id);let n=await A.repairMcpInstallation({installationId:t.installationId});d(e=>U(e,n)),Se(`${Q(e)} repaired`)}catch(t){$(`Failed to repair ${Q(e)}`,t),await N()}finally{y(null)}},R=async(e,t)=>{if(A&&window.confirm(`Disconnect Agent Control from ${Q(e)}?`))try{y(e.id);let n=await A.disconnectMcpInstallation({installationId:t.installationId});d(e=>U(e,n)),Se(`${Q(e)} disconnected`)}catch(t){$(`Failed to disconnect ${Q(e)}`,t),await N()}finally{y(null)}},z=a.filter(e=>e.capabilities.externalAgentControl===`available`);return(0,q.jsx)(`section`,{"data-testid":`agent-control-mcp-installations`,className:`border-b bg-muted/10 p-6 sm:p-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto grid w-full max-w-4xl gap-8`,children:[(0,q.jsxs)(`section`,{className:`grid gap-4`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,q.jsx)(m,{className:`size-3.5`}),`Ryco sessions`]}),(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`Automatic inside Ryco`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Supported sessions started by Ryco receive Agent Control automatically. There is nothing to install in those provider profiles.`})]}),h?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border p-4 text-sm text-muted-foreground`,children:[(0,q.jsx)(b,{className:`size-4 animate-spin`}),` Loading providers…`]}):r.length===0?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-4 text-sm text-muted-foreground`,children:`No configured provider instances were found.`}):(0,q.jsx)(`div`,{className:`divide-y overflow-hidden rounded-xl border bg-card`,children:r.map(e=>{let t=F(e.driver)?.icon??m,n=e.enabled&&e.capabilities.automaticAgentControl===`available`;return(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-4 py-3`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg border bg-background`,children:(0,q.jsx)(t,{className:`size-4 text-muted-foreground`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-sm font-medium`,children:_e(e)}),(0,q.jsx)(`p`,{className:`mt-0.5 font-mono text-[11px] text-muted-foreground`,children:e.instanceId}),(0,q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:n?`Available in every new Ryco-managed session.`:e.enabled?`This provider does not expose automatic Agent Control yet.`:`This provider instance is disabled.`})]})]}),(0,q.jsx)(P,{variant:n?`success`:`outline`,children:n?`Automatic`:e.enabled?`Unavailable`:`Disabled`})]},e.instanceId)})})]}),(0,q.jsxs)(`section`,{className:`grid gap-4`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,q.jsx)(W,{className:`size-3.5`}),`External agents`]}),(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`Connect an installed provider`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Ryco detects local provider profiles and writes their native MCP configuration. The default grants project listing and task request/read access, limited to 60 requests per minute and one active task. Every task still requires approval.`})]}),(0,q.jsx)(j,{size:`icon`,variant:`outline`,"aria-label":`Refresh Agent Control providers`,disabled:h,onClick:()=>void N(),children:(0,q.jsx)(S,{})})]}),f&&!f.available?(0,q.jsxs)(`div`,{className:`flex gap-3 rounded-xl border border-warning/30 bg-warning/8 p-4 text-sm`,children:[(0,q.jsx)(E,{className:`mt-0.5 size-4 shrink-0 text-warning-foreground`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`font-medium`,children:`Local installation is unavailable`}),(0,q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:f.reason??`Ryco could not prove a direct loopback-only topology.`})]})]}):null,!h&&(!A||!M)?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-4 text-sm text-muted-foreground`,children:`This Ryco environment does not expose provider MCP installation yet.`}):!h&&z.length===0?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-4 text-sm text-muted-foreground`,children:`No installable provider profiles were detected. Configure a supported provider instance first, then refresh.`}):(0,q.jsx)(`div`,{className:`grid gap-3`,children:z.map(e=>{let t=be(l.installations,e.id),n=xe(t),r=t?.state===`connected`,i=t?.state===`repair-needed`,a=_===e.id,o=x===e.id,s=F(e.driver)?.icon??W;return(0,q.jsxs)(`article`,{className:`grid gap-4 rounded-xl border bg-card p-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg border bg-background`,children:(0,q.jsx)(s,{className:`size-4 text-muted-foreground`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-semibold`,children:Q(e)}),(0,q.jsx)(P,{variant:n.variant,children:n.label})]}),(0,q.jsx)(`p`,{className:`mt-1 truncate font-mono text-[11px] text-muted-foreground`,children:e.displayPath}),(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[e.providerInstances.length,` configured provider`,e.providerInstances.length===1?` instance`:` instances`,t?` · MCP name ${t.serverName}`:``]})]})]}),(0,q.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2 sm:justify-end`,children:i&&t?(0,q.jsxs)(j,{size:`sm`,disabled:a||f?.available===!1,onClick:()=>void L(e,t),children:[a?(0,q.jsx)(b,{className:`animate-spin`}):(0,q.jsx)(O,{}),`Repair`]}):r&&t?(0,q.jsxs)(j,{size:`sm`,variant:`outline`,disabled:a,onClick:()=>void R(e,t),children:[a?(0,q.jsx)(b,{className:`animate-spin`}):(0,q.jsx)(D,{}),`Disconnect`]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(j,{size:`sm`,variant:`outline`,disabled:a||f?.available===!1,onClick:()=>{o?C(null):(T(ye(e)),C(e.id))},children:o?`Close`:`Customize`}),(0,q.jsxs)(j,{size:`sm`,disabled:a||f?.available===!1,onClick:()=>void I(e,!1),children:[a?(0,q.jsx)(b,{className:`animate-spin`}):(0,q.jsx)(v,{}),`Connect`]})]})})]}),t?.lastError?(0,q.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-3 text-xs text-destructive`,children:t.lastError}):null,t?.preservedUserChanges?(0,q.jsx)(`div`,{className:`rounded-lg border border-warning/30 bg-warning/8 p-3 text-xs text-warning-foreground`,children:`Ryco left this provider's MCP entry untouched because it had been edited after installation.`}):null,o?(0,q.jsxs)(`div`,{className:`grid gap-4 border-t pt-4`,children:[(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Customize the credential scope and limits before Ryco installs it. The provider profile is fixed to this detected workspace.`}),(0,q.jsx)(fe,{form:w,onChange:T,clientLocked:!0}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsxs)(j,{disabled:a||f?.available===!1,onClick:()=>void I(e,!0),children:[a?(0,q.jsx)(b,{className:`animate-spin`}):(0,q.jsx)(W,{}),`Connect with these permissions`]})})]}):null]},e.id)})})]})]})})}function we(){let e=(0,ne.c)(26),t=o(Te),{updateSettings:n}=l(),r=N(a.serverUpdateSettings),i,s,c;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,q.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Agent Control`}),s=(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`Private tools for every agent`}),c=(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Ryco sessions receive the tools automatically. Connect supported standalone provider profiles with one click. Every requested change still waits for explicit approval.`}),e[0]=i,e[1]=s,e[2]=c):(i=e[0],s=e[1],c=e[2]);let u=t?`Enabled. New Ryco-managed sessions receive Agent Control without changing the provider's global MCP configuration.`:`Disabled. Agent Control is unavailable to Ryco sessions and external clients.`,d;e[3]===u?d=e[4]:(d=(0,q.jsx)(`p`,{className:`mt-2 max-w-2xl text-xs leading-relaxed text-muted-foreground`,children:u}),e[3]=u,e[4]=d);let f;e[5]!==r.allowed||e[6]!==r.reason?(f=!r.allowed&&r.reason?(0,q.jsx)(`p`,{className:`mt-2 max-w-2xl text-xs leading-relaxed text-destructive`,children:r.reason}):null,e[5]=r.allowed,e[6]=r.reason,e[7]=f):f=e[7];let p;e[8]!==d||e[9]!==f?(p=(0,q.jsxs)(`div`,{children:[i,s,c,d,f]}),e[8]=d,e[9]=f,e[10]=p):p=e[10];let m=!r.allowed,h;e[11]===n?h=e[12]:(h=e=>n({agentControl:{enabled:!!e}}),e[11]=n,e[12]=h);let _;e[13]!==t||e[14]!==m||e[15]!==h?(_=(0,q.jsx)(k,{checked:t,disabled:m,onCheckedChange:h,"aria-label":`Enable Agent Control`}),e[13]=t,e[14]=m,e[15]=h,e[16]=_):_=e[16];let v;e[17]!==p||e[18]!==_?(v=(0,q.jsx)(`section`,{className:`border-b bg-muted/10 p-6 sm:p-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[p,_]})}),e[17]=p,e[18]=_,e[19]=v):v=e[19];let b;e[20]===t?b=e[21]:(b=t?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Ce,{}),(0,q.jsxs)(`details`,{className:`group border-b bg-muted/5`,children:[(0,q.jsxs)(`summary`,{className:`mx-auto flex w-full max-w-4xl cursor-pointer list-none items-center gap-3 px-6 py-5 sm:px-8 [&::-webkit-details-marker]:hidden`,children:[(0,q.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-lg border bg-background`,children:(0,q.jsx)(y,{className:`size-4 text-muted-foreground`})}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`block text-sm font-semibold`,children:`Advanced manual setup`}),(0,q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`Create a revocable pairing for another MCP client or a profile Ryco cannot detect.`})]}),(0,q.jsx)(g,{className:`size-4 text-muted-foreground transition-transform group-open:rotate-90`})]}),(0,q.jsx)(me,{})]})]}):null,e[20]=t,e[21]=b);let x;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,q.jsx)(I,{}),e[22]=x):x=e[22];let S;return e[23]!==v||e[24]!==b?(S=(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[v,b,x]}),e[23]=v,e[24]=b,e[25]=S):S=e[25],S}function Te(e){return e.agentControl.enabled}export{we as IntegrationsSettingsPanel};
|
package/dist/client/assets/{KeybindingsSettings-BfkONqmZ.js → KeybindingsSettings-D2bNQPI-.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{Bn as r,Ft as i,Jt as a,Vn as o,Wn as s,Xn as c,hn as l,xn as u}from"./runtime-DfGHeCnR.js";import{dt as d}from"./primary-OskAInOO.js";import{It as f}from"./composerDraftStore-CdJJZe42.js";import{i as p}from"./toast-CcSCAm4B.js";import{t as m}from"./keyboard-BqeRMHfL.js";import{t as h}from"./plus-B2h-VEqh.js";import{t as g}from"./search-BGQsenCM.js";import{t as _}from"./triangle-alert-RL_T3KLo.js";import{t as v}from"./undo-2-x37tfI3V.js";import{t as y}from"./x-C1Cemsov.js";import{t as b}from"./shallow-DWZCFNun.js";import{n as x,t as S}from"./utils-BofFIn5Y.js";import{i as C,n as w,t as T}from"./tooltip-C8sAONBj.js";import{t as E}from"./input-CHEwW3oH.js";import{t as D}from"./button-BAbJxRzt.js";import{t as O}from"./toastHelpers-CSQRKo4F.js";import{c as k,i as A,p as j,s as M}from"./menu-Dvxh8sD5.js";import{r as N}from"./editorPreferences-0DWMgcci.js";import{i as P,n as F,r as I}from"./settingsLayout-D8glO7f1.js";var L=e(t(),1),R=n(),z={terminal:{id:`terminal`,label:`Terminal`,sortWeight:10},workspace:{id:`workspace`,label:`Workspace`,sortWeight:20},diff:{id:`diff`,label:`Diff`,sortWeight:30},commandPalette:{id:`commandPalette`,label:`Command palette`,sortWeight:40},sidebar:{id:`sidebar`,label:`Sidebar`,sortWeight:50},chat:{id:`chat`,label:`Chat`,sortWeight:60},composer:{id:`composer`,label:`Composer`,sortWeight:70},editor:{id:`editor`,label:`Editor`,sortWeight:80},modelPicker:{id:`modelPicker`,label:`Model picker`,sortWeight:90},thread:{id:`thread`,label:`Threads`,sortWeight:100},script:{id:`script`,label:`Project scripts`,sortWeight:110}},B={"terminal.toggle":{title:`Toggle terminal drawer`,sortWeight:1},"terminal.split":{title:`Split terminal`,sortWeight:2},"terminal.new":{title:`New terminal`,sortWeight:3},"terminal.close":{title:`Close terminal`,sortWeight:4},"workspace.files":{title:`Open workspace files`,sortWeight:1},"workspace.review":{title:`Open workspace review`,sortWeight:2},"workspace.terminal":{title:`Open workspace terminal`,sortWeight:3},"workspace.simulator":{title:`Open iOS Simulator workspace`,sortWeight:4},"diff.toggle":{title:`Toggle diff view`,sortWeight:1},"commandPalette.toggle":{title:`Open command palette`,sortWeight:1},"sidebar.showInbox":{title:`Show Inbox sidebar`,sortWeight:1},"sidebar.showProjects":{title:`Show Projects sidebar`,sortWeight:2},"chat.new":{title:`New chat`,sortWeight:1},"chat.newLocal":{title:`New chat (local environment)`,sortWeight:2},"composer.stash":{title:`Stash prompt or open stash`,sortWeight:1},"editor.openFavorite":{title:`Open in preferred editor`,sortWeight:1},"modelPicker.toggle":{title:`Toggle model picker`,sortWeight:1},"modelPicker.jump.1":{title:`Pick model 1`,sortWeight:2},"modelPicker.jump.2":{title:`Pick model 2`,sortWeight:3},"modelPicker.jump.3":{title:`Pick model 3`,sortWeight:4},"modelPicker.jump.4":{title:`Pick model 4`,sortWeight:5},"modelPicker.jump.5":{title:`Pick model 5`,sortWeight:6},"modelPicker.jump.6":{title:`Pick model 6`,sortWeight:7},"modelPicker.jump.7":{title:`Pick model 7`,sortWeight:8},"modelPicker.jump.8":{title:`Pick model 8`,sortWeight:9},"modelPicker.jump.9":{title:`Pick model 9`,sortWeight:10},"thread.find":{title:`Find in current thread`,sortWeight:1},"thread.previous":{title:`Previous thread`,sortWeight:2},"thread.next":{title:`Next thread`,sortWeight:3},"thread.jump.1":{title:`Jump to thread 1`,sortWeight:4},"thread.jump.2":{title:`Jump to thread 2`,sortWeight:5},"thread.jump.3":{title:`Jump to thread 3`,sortWeight:6},"thread.jump.4":{title:`Jump to thread 4`,sortWeight:7},"thread.jump.5":{title:`Jump to thread 5`,sortWeight:8},"thread.jump.6":{title:`Jump to thread 6`,sortWeight:9},"thread.jump.7":{title:`Jump to thread 7`,sortWeight:10},"thread.jump.8":{title:`Jump to thread 8`,sortWeight:11},"thread.jump.9":{title:`Jump to thread 9`,sortWeight:12}};function V(e){let t=e.indexOf(`.`),n=t===-1?e:e.slice(0,t);return n===`script`?z.script:z[n]??z.script}function H(e,t){let n=V(e),r=B[e];if(r)return{category:n,title:r.title,sortWeight:r.sortWeight};let i=e.match(/^script\.([a-z0-9][a-z0-9-]*)\.run$/)?.[1]??e;return{category:n,title:t??`Run: ${i}`,sortWeight:100}}var U=[{id:`always`,label:`Always`,value:void 0},{id:`terminalFocus`,label:`Terminal focused`,value:`terminalFocus`},{id:`notTerminalFocus`,label:`Not in terminal`,value:`!terminalFocus`},{id:`terminalOpen`,label:`Terminal open`,value:`terminalOpen`},{id:`notTerminalOpen`,label:`Terminal not open`,value:`!terminalOpen`},{id:`modelPickerOpen`,label:`Model picker open`,value:`modelPickerOpen`},{id:`commandPaletteOpen`,label:`Command palette open`,value:`commandPaletteOpen`},{id:`composerFocus`,label:`Composer focused`,value:`composerFocus`},{id:`notComposerFocus`,label:`Not in composer`,value:`!composerFocus`}],W=new Map(U.map(e=>[e.value,e])),G=new Map(U.map(e=>[e.value===void 0?void 0:e.value.replace(/\s+/g,``),e]));function K(e){return e===void 0?W.get(void 0):W.get(e)||G.get(e.replace(/\s+/g,``))}function q(e){let t=K(e);return t?t.label:e??`Always`}function J(e){if(e)switch(e.type){case`identifier`:return e.name;case`not`:return`!${J(e.node)}`;case`and`:return`(${J(e.left)} && ${J(e.right)})`;case`or`:return`(${J(e.left)} || ${J(e.right)})`}}function ee(e,t){return(e===void 0?``:e.replace(/\s+/g,``))===(t===void 0?``:t.replace(/\s+/g,``))}function te(e,t){let n=e[t];if(!n)return[];let r=[];return e.forEach((e,i)=>{i!==t&&e.command!==n.command&&e.key===n.key&&ee(e.when,n.when)&&r.push({key:n.key,otherCommand:e.command,otherWhen:e.when})}),r}function ne(e){let t=new Map;return e.forEach((n,r)=>{let i=te(e,r);if(i.length===0)return;let a=e[r].command,o=t.get(a)??[];o.push(...i),t.set(a,o)}),t}function Y(e){return/mac|iphone|ipad|ipod/i.test(e)}var re=new Set([`control`,`shift`,`alt`,`altgraph`,`meta`,`os`,`hyper`,`super`,`fn`,`capslock`,`numlock`,`scrolllock`]),ie=new Set([`escape`,`tab`,`enter`]);function ae(e,t){let n=e.toLowerCase();if(n===` `||n===`spacebar`)return`space`;if(n===`esc`)return`escape`;if(n===`arrowup`)return`up`;if(n===`arrowdown`)return`down`;if(n===`arrowleft`)return`left`;if(n===`arrowright`)return`right`;if(t){let e=t.match(/^Digit(\d)$/);if(e)return e[1];if(t===`BracketLeft`)return`[`;if(t===`BracketRight`)return`]`}return n}function oe(e,t){let n=e.key.toLowerCase();if(re.has(n))return null;let r=Y(t?.platform??(typeof navigator<`u`?navigator.platform:``)),i=r?e.metaKey:e.ctrlKey;if(!(i||e.shiftKey||e.altKey||(r?e.ctrlKey:e.metaKey))&&ie.has(n))return null;let a=ae(e.key,e.code);return a.length===0?null:{key:a,modKey:i,metaKey:!r&&e.metaKey,ctrlKey:r&&e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey}}var se={mod:`⌘`,meta:`⌘`,cmd:`⌘`,ctrl:`⌃`,control:`⌃`,shift:`⇧`,alt:`⌥`,option:`⌥`},ce={mod:`Ctrl`,meta:`Meta`,cmd:`Meta`,ctrl:`Ctrl`,control:`Ctrl`,shift:`Shift`,alt:`Alt`,option:`Alt`},X={space:`Space`,enter:`Enter`,escape:`Esc`,up:`↑`,down:`↓`,left:`←`,right:`→`,tab:`Tab`,backspace:`⌫`,delete:`Del`};function le(e,t){let n=Y(t?.platform??(typeof navigator<`u`?navigator.platform:``))?se:ce,r=[];e.modKey&&r.push(n.mod),e.metaKey&&r.push(n.meta),e.ctrlKey&&r.push(n.ctrl),e.altKey&&r.push(n.alt),e.shiftKey&&r.push(n.shift);let i=X[e.key]??(e.key.length===1?e.key.toUpperCase():e.key);return r.push(i),r}function ue(e){let t=[];e.modKey&&t.push(`mod`),e.metaKey&&t.push(`meta`),e.ctrlKey&&t.push(`ctrl`),e.altKey&&t.push(`alt`),e.shiftKey&&t.push(`shift`);let n=e.key===` `?`space`:e.key;return t.push(n),t.join(`+`)}var Z=f(),de=[],fe=(()=>{let e=new Map;for(let t of d){let n=`${t.key}|${t.when??``}`,r=e.get(t.command)??new Set;r.add(n),e.set(t.command,r)}return e})(),Q=new Set(d.map(e=>e.command));function pe(e,t){return`${e.command}|${e.key}|${e.when??``}|${t}`}function me(e){return{key:ue(e.shortcut),command:e.command,when:J(e.whenAst)}}function $(e){return e.map((e,t)=>({...me(e),__id:pe(e,t)}))}function he(e){return e.map(({__id:e,...t})=>t)}function ge(e){return d.filter(t=>t.command===e).map(e=>Object.assign({},e))}function _e(e,t){if(!Q.has(e))return`custom`;let n=fe.get(e);if(!n)return`custom`;if(t.length!==n.size)return`modified`;for(let e of t){let t=`${e.key}|${e.when??``}`;if(!n.has(t))return`modified`}return`default`}function ve(e,t,n){return!n||[t.toLowerCase(),e.command.toLowerCase(),e.key.toLowerCase(),q(e.when).toLowerCase()].some(e=>e.includes(n))}function ye(){return Math.random().toString(36).slice(2)}function be(){let e=c(),t=o(),n=s(),d=r(),f=typeof navigator<`u`?navigator.platform:``,h=x(f),[y,S]=(0,L.useState)(!1),[C,w]=(0,L.useState)(null),T=!e||e.primary,k=e?l(e.environmentId)?.keybindings:u().keybindings,A=(0,L.useCallback)(()=>{if(!n)return;if(!T){w(`This file lives on ${e?.nodeLabel??`the selected node`} and cannot be opened in a local editor.`);return}w(null),S(!0);let t=N(d??[]);if(!t){w(`No available editors found.`),S(!1);return}u().shell.openInEditor(n,t).catch(e=>{w(e instanceof Error?e.message:`Unable to open keybindings file.`)}).finally(()=>{S(!1)})},[d,T,n,e?.nodeLabel]),j=a(b(i)),M=(0,L.useMemo)(()=>{let e=new Set,t=new Map;for(let n of j)for(let r of n.scripts){let n=`script.${r.id}.run`;e.add(n),t.has(n)||t.set(n,`Run: ${r.name}`)}return{commandList:Array.from(e),titles:t}},[j]),R=t?.keybindings??de,[B,V]=(0,L.useState)(()=>$(R)),[U,W]=(0,L.useState)(()=>JSON.stringify(he($(R)))),G=(0,L.useRef)(!1);(0,L.useEffect)(()=>{let e=JSON.stringify(he($(R)));e!==U&&(W(e),G.current||V($(R)))},[R,U]);let K=(0,L.useCallback)(async e=>{G.current=!0;try{if(!k)throw Error(`Keybinding settings are unavailable on this node.`);await k.replaceCustom({rules:he(e)})}catch(e){p.add(O({type:`error`,title:`Could not save keybindings`,description:e instanceof Error?e.message:`An unknown error occurred.`})),V($(R))}finally{G.current=!1}},[k,R]),q=(0,L.useCallback)((e,t)=>{V(n=>{let r=n.slice(),i=r[e];if(!i)return n;let a=ue(t);return a===i.key?n:(r[e]={...i,key:a,__id:i.__id},K(r),r)})},[K]),J=(0,L.useCallback)(e=>{V(t=>{let n={command:e,key:``,when:void 0,__id:`placeholder-${ye()}`},r=(()=>{let n=-1;return t.forEach((t,r)=>{t.command===e&&(n=r)}),n})();return r===-1?[...t,n]:[...t.slice(0,r+1),n,...t.slice(r+1)]})},[]),ee=(0,L.useCallback)(e=>{V(t=>{let n=t.slice();return n.splice(e,1),K(n),n})},[K]),te=(0,L.useCallback)((e,t)=>{V(n=>{let r=n.slice(),i=r[e];return!i||(i.when??void 0)===t?n:(r[e]={...i,when:t,__id:i.__id},K(r),r)})},[K]),Y=(0,L.useCallback)(e=>{V(t=>{let n=t[e];if(!n)return t;let r=n.command;if(!Q.has(r)){let n=t.slice();return n.splice(e,1),K(n),n}let i=ge(r),a=t.filter(e=>e.command!==r);for(let e of i)a.push({...e,__id:`default-${r}-${ye()}`});return K(a),a})},[K]),re=(0,L.useCallback)(e=>{V(t=>{let n=t.filter(t=>t.command!==e);if(Q.has(e))for(let t of ge(e))n.push({...t,__id:`default-${e}-${ye()}`});return K(n),n})},[K]),ie=(0,L.useCallback)(async()=>{V([]);try{if(!k)throw Error(`Keybinding settings are unavailable on this node.`);await k.replaceCustom({rules:[]})}catch(e){p.add(O({type:`error`,title:`Could not restore default keybindings`,description:e instanceof Error?e.message:`An unknown error occurred.`})),V($(R))}},[k,R]),ae=(0,L.useRef)(new Map),oe=(0,L.useCallback)(e=>{let t=ae.current.get(e);t&&(t.scrollIntoView({behavior:`smooth`,block:`center`}),t.dataset.flash=`true`,window.setTimeout(()=>{delete t.dataset.flash},1100))},[]),[se,ce]=(0,L.useState)(``),X=(0,L.useDeferredValue)(se.trim().toLowerCase()),le=(0,L.useMemo)(()=>ne(B),[B]),fe=(0,L.useMemo)(()=>{let e=new Map;B.forEach((t,n)=>{let r=e.get(t.command);r?r.push(n):e.set(t.command,[n])});let t=new Set([...e.keys(),...Q,...M.commandList]),n=new Map;for(let r of t){let t=e.get(r)??[],i=t.map(e=>B[e]).filter(Boolean),a=H(r,M.titles.get(r)),o=_e(r,i),s={key:``,command:r,when:void 0};if(!(X.length===0||ve(s,a.title,X)||i.some(e=>ve(e,a.title,X))))continue;let c={command:r,title:a.title,indicesInDraft:t,status:o},l=n.get(a.category.id);l?l.push(c):n.set(a.category.id,[c])}let r=[];for(let e of Object.values(z).toSorted((e,t)=>e.sortWeight-t.sortWeight)){let t=n.get(e.id);!t||t.length===0||(t.sort((e,t)=>{let n=H(e.command,M.titles.get(e.command)),r=H(t.command,M.titles.get(t.command));return n.sortWeight-r.sortWeight}),r.push({category:e,rows:t}))}return r},[B,X,M]),pe=fe.reduce((e,t)=>e+t.rows.length,0),me=(0,L.useMemo)(()=>({platform:f,draft:B,conflictsByCommand:le,onRebind:q,onAddBinding:J,onRemoveBinding:ee,onChangeWhen:te,onResetBinding:Y,onResetCommand:re,scrollToCommand:oe,rowRefs:ae}),[f,B,le,q,J,ee,te,Y,re,oe]),be=t?.issues.filter(e=>e.kind.startsWith(`keybindings.`))??[],Se=(d??[]).length>0;return(0,Z.jsxs)(F,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`span`,{className:`grid size-9 place-items-center rounded-lg bg-accent text-foreground/70`,children:(0,Z.jsx)(m,{className:`size-4`})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:`Keybindings`}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Click any shortcut and press a new combination to rebind. Press Esc to cancel, Backspace to clear.`})]})]}),(0,Z.jsxs)(D,{variant:`outline`,size:`xs`,onClick:()=>void ie(),disabled:B.length===0,children:[(0,Z.jsx)(v,{className:`size-3.5`}),`Restore defaults`]})]}),(0,Z.jsx)(P,{title:`Configuration file`,children:(0,Z.jsx)(I,{title:`Keybindings file`,description:"Open the persisted `keybindings.json` file to edit advanced bindings directly.",status:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`block break-all font-mono text-[11px] text-foreground`,children:n??`Resolving keybindings path...`}),C?(0,Z.jsx)(`span`,{className:`mt-1 block text-destructive`,children:C}):(0,Z.jsx)(`span`,{className:`mt-1 block`,children:T?Se?`Opens in your preferred editor.`:`No available editors found.`:`Stored on ${e?.nodeLabel??`the selected node`}; use an editor on that machine.`})]}),control:(0,Z.jsx)(D,{size:`xs`,variant:`outline`,disabled:!T||!n||!Se||y,onClick:A,children:y?`Opening...`:`Open file`})})}),be.length>0?(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-200`,children:[(0,Z.jsx)(_,{className:`mt-0.5 size-4 shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-0.5`,children:[be.map(e=>(0,Z.jsx)(`p`,{children:e.message},`${e.kind}-${e.message}`)),n?(0,Z.jsxs)(`p`,{className:`opacity-70`,children:[`Edit `,(0,Z.jsx)(`code`,{className:`rounded bg-amber-500/20 px-1`,children:n}),` `,`to resolve.`]}):null]})]}):null,(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(g,{className:`absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground/60`}),(0,Z.jsx)(E,{type:`search`,placeholder:`Search by command, shortcut, or when…`,className:`pl-9`,value:se,onChange:e=>ce(e.target.value)})]}),pe===0?(0,Z.jsx)(`div`,{className:`rounded-lg border border-dashed border-border/60 px-6 py-12 text-center text-sm text-muted-foreground`,children:`No commands match your search.`}):fe.map(e=>(0,Z.jsx)(P,{title:e.category.label,children:e.rows.map(e=>(0,Z.jsx)(xe,{row:e,context:me,isMac:h,scriptTitle:M.titles.get(e.command)},e.command))},e.category.id))]})}var xe=(0,L.memo)(function(e){let t=(0,R.c)(42),{row:n,context:r,isMac:i}=e,a;if(t[0]!==r||t[1]!==i||t[2]!==n.command||t[3]!==n.indicesInDraft||t[4]!==n.status||t[5]!==n.title){let e;t[7]===r.draft?e=t[8]:(e=e=>({index:e,rule:r.draft[e]}),t[7]=r.draft,t[8]=e);let o=n.indicesInDraft.map(e),s=r.conflictsByCommand.get(n.command)??[],c=s.slice(0,3),l=n.command,u;t[9]!==r.rowRefs.current||t[10]!==n.command?(u=e=>{r.rowRefs.current.set(n.command,e)},t[9]=r.rowRefs.current,t[10]=n.command,t[11]=u):u=t[11];let d;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(d=S(`group flex flex-col gap-2 border-t border-border/60 px-4 py-3 first:border-t-0 transition-colors data-[flash=true]:bg-amber-500/10 sm:px-5`),t[12]=d):d=t[12];let f;t[13]===n.title?f=t[14]:(f=(0,Z.jsx)(`span`,{className:`truncate text-[13px] font-medium tracking-tight text-foreground`,children:n.title}),t[13]=n.title,t[14]=f);let p;t[15]===n.status?p=t[16]:(p=(0,Z.jsx)(Se,{status:n.status}),t[15]=n.status,t[16]=p);let m;t[17]!==f||t[18]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f,p]}),t[17]=f,t[18]=p,t[19]=m):m=t[19];let g;t[20]===n.command?g=t[21]:(g=(0,Z.jsx)(`code`,{className:`block truncate text-[10px] text-muted-foreground/60`,children:n.command}),t[20]=n.command,t[21]=g);let _;t[22]!==m||t[23]!==g?(_=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[m,g]}),t[22]=m,t[23]=g,t[24]=_):_=t[24];let y=o.length===0?(0,Z.jsx)(we,{draftIndex:-1,rule:{command:n.command,key:``,when:void 0},context:r,isMac:i,isPrimary:!0,isPlaceholder:!0,onAddPlaceholder:()=>r.onAddBinding(n.command)},`placeholder`):o.map((e,t)=>{let{index:n,rule:a}=e;return(0,Z.jsx)(we,{draftIndex:n,rule:a,context:r,isMac:i,isPrimary:t===0,isPlaceholder:a.key.length===0},`${n}-${a.__id}`)}),b;t[25]!==r||t[26]!==n.command||t[27]!==n.title||t[28]!==o?(b=o.length>0?(0,Z.jsxs)(T,{children:[(0,Z.jsx)(C,{render:(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r.onAddBinding(n.command),className:`inline-flex size-6 items-center justify-center rounded-md border border-dashed border-border/60 text-muted-foreground/60 transition-colors hover:border-border hover:text-foreground`,"aria-label":`Add another shortcut for ${n.title}`,children:(0,Z.jsx)(h,{className:`size-3.5`})})}),(0,Z.jsx)(w,{side:`top`,children:`Add another shortcut`})]}):null,t[25]=r,t[26]=n.command,t[27]=n.title,t[28]=o,t[29]=b):b=t[29];let x;t[30]!==r||t[31]!==n.command||t[32]!==n.status||t[33]!==n.title?(x=n.status!=="default"&&Q.has(n.command)?(0,Z.jsxs)(T,{children:[(0,Z.jsx)(C,{render:(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r.onResetCommand(n.command),className:`inline-flex size-6 items-center justify-center rounded-md text-muted-foreground/50 transition-colors hover:text-foreground`,"aria-label":`Reset ${n.title} to default`,children:(0,Z.jsx)(v,{className:`size-3.5`})})}),(0,Z.jsx)(w,{side:`top`,children:`Reset to default`})]}):null,t[30]=r,t[31]=n.command,t[32]=n.status,t[33]=n.title,t[34]=x):x=t[34];let E;t[35]!==y||t[36]!==b||t[37]!==x?(E=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1.5`,children:[y,b,x]}),t[35]=y,t[36]=b,t[37]=x,t[38]=E):E=t[38];let D;t[39]!==_||t[40]!==E?(D=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[_,E]}),t[39]=_,t[40]=E,t[41]=D):D=t[41],a=(0,Z.jsxs)(`div`,{"data-keybinding-command":l,ref:u,className:d,children:[D,c.length>0?(0,Z.jsxs)(`div`,{className:`animate-in fade-in slide-in-from-top-1 flex flex-col gap-1 rounded-md border border-destructive/30 bg-destructive/10 px-2.5 py-1.5 text-[11px] text-destructive-foreground/90`,children:[c.map(e=>(0,Z.jsx)(Ce,{conflict:e,isMac:i,platform:r.platform,onSelect:()=>r.scrollToCommand(e.otherCommand)},`${e.key}-${e.otherCommand}`)),s.length>c.length?(0,Z.jsxs)(`span`,{className:`opacity-70`,children:[`+ `,s.length-c.length,` more`]}):null]}):null]}),t[0]=r,t[1]=i,t[2]=n.command,t[3]=n.indicesInDraft,t[4]=n.status,t[5]=n.title,t[6]=a}else a=t[6];return a});function Se(e){let t=(0,R.c)(5),{status:n}=e;if(n==="default")return null;let r=n===`modified`?`bg-amber-500/15 text-amber-300`:`bg-indigo-500/15 text-indigo-300`,i;t[0]===r?i=t[1]:(i=S(`rounded px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-[0.06em]`,r),t[0]=r,t[1]=i);let a=n===`modified`?`Modified`:`Custom`,o;return t[2]!==i||t[3]!==a?(o=(0,Z.jsx)(`span`,{className:i,children:a}),t[2]=i,t[3]=a,t[4]=o):o=t[4],o}function Ce(e){let t=(0,R.c)(27),{conflict:n,platform:r,isMac:i,onSelect:a}=e,o;t[0]===n.otherCommand?o=t[1]:(o=H(n.otherCommand),t[0]=n.otherCommand,t[1]=o);let s=o,c,l,u,d;if(t[2]!==n.key||t[3]!==i||t[4]!==r){let e=je(n.key),a=e?le(e,{platform:r}):[n.key];u=`flex flex-wrap items-center gap-1.5`,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(_,{className:`size-3 shrink-0 text-destructive`}),t[9]=d):d=t[9],c=`inline-flex items-center gap-0.5 font-mono`;let o;t[10]===i?o=t[11]:(o=e=>(0,Z.jsx)(De,{token:e,isMac:i},e),t[10]=i,t[11]=o),l=a.map(o),t[2]=n.key,t[3]=i,t[4]=r,t[5]=c,t[6]=l,t[7]=u,t[8]=d}else c=t[5],l=t[6],u=t[7],d=t[8];let f;t[12]!==c||t[13]!==l?(f=(0,Z.jsx)(`span`,{className:c,children:l}),t[12]=c,t[13]=l,t[14]=f):f=t[14];let p;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`span`,{children:`also bound to`}),t[15]=p):p=t[15];let m;t[16]!==s.title||t[17]!==a?(m=(0,Z.jsx)(`button`,{type:`button`,onClick:a,className:`rounded bg-destructive/20 px-1.5 py-0.5 font-medium text-destructive-foreground hover:bg-destructive/30`,children:s.title}),t[16]=s.title,t[17]=a,t[18]=m):m=t[18];let h;t[19]===n.otherWhen?h=t[20]:(h=n.otherWhen===void 0?null:(0,Z.jsxs)(`span`,{className:`opacity-70`,children:[`when `,(0,Z.jsx)(`code`,{className:`font-mono`,children:q(n.otherWhen)})]}),t[19]=n.otherWhen,t[20]=h);let g;return t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==m||t[25]!==h?(g=(0,Z.jsxs)(`div`,{className:u,children:[d,f,p,m,h]}),t[21]=u,t[22]=d,t[23]=f,t[24]=m,t[25]=h,t[26]=g):g=t[26],g}function we(e){let t=(0,R.c)(59),{draftIndex:n,rule:r,context:i,isMac:a,isPlaceholder:o,onAddPlaceholder:s}=e,[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(!1),f=(0,L.useRef)(null),p;bb0:{if(r.key.length===0){p=null;break bb0}let e;t[0]===r.key?e=t[1]:(e=je(r.key),t[0]=r.key,t[1]=e),p=e}let m=p,g=m?le(m,{platform:i.platform}):[],_;t[2]!==n||t[3]!==o||t[4]!==s?(_=()=>{if(o&&n===-1&&s){s(),setTimeout(Te,50);return}l(!0)},t[2]=n,t[3]=o,t[4]=s,t[5]=_):_=t[5];let v=_,b,x;t[6]!==i||t[7]!==n||t[8]!==c?(b=()=>{if(!c)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`&&!Ae(e)){l(!1);return}if(e.key===`Tab`&&!Ae(e)){l(!1);return}if(e.key===`Backspace`&&!Ae(e)){n>=0&&i.onRemoveBinding(n),l(!1);return}let t=oe(e,{platform:i.platform});t&&(n>=0&&i.onRebind(n,t),d(!0),l(!1),setTimeout(()=>d(!1),220))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},x=[c,n,i],t[6]=i,t[7]=n,t[8]=c,t[9]=b,t[10]=x):(b=t[9],x=t[10]),(0,L.useEffect)(b,x);let C,w;t[11]===c?(C=t[12],w=t[13]):(C=()=>{c&&f.current?.focus()},w=[c],t[11]=c,t[12]=C,t[13]=w),(0,L.useEffect)(C,w);let T;t[14]!==c||t[15]!==v?(T=e=>{c||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),v())},t[14]=c,t[15]=v,t[16]=T):T=t[16];let E=T,D;t[17]!==i||t[18]!==n?(D=()=>{n>=0&&i.onRemoveBinding(n)},t[17]=i,t[18]=n,t[19]=D):D=t[19];let O=D;if(o&&n===-1&&g.length===0){let e;t[20]===s?e=t[21]:(e=()=>s?.(),t[20]=s,t[21]=e);let n;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(h,{className:`size-3`}),t[22]=n):n=t[22];let r;return t[23]!==E||t[24]!==e?(r=(0,Z.jsxs)(`button`,{ref:f,type:`button`,onClick:e,onKeyDown:E,className:`inline-flex h-6 items-center gap-1 rounded-md border border-dashed border-border/60 bg-transparent px-2 text-[11px] text-muted-foreground/70 transition-colors hover:border-border hover:text-foreground`,children:[n,` No shortcut — click to set`]}),t[23]=E,t[24]=e,t[25]=r):r=t[25],r}let k=`Edit shortcut for ${r.command}`,A=g.length===0&&n>=0?`true`:void 0,j=c?`kb-chip-recording border-indigo-500/60 bg-indigo-500/15 text-indigo-100 shadow-[0_0_0_4px_rgba(99,102,241,0.18)]`:u?`border-emerald-500/50 bg-emerald-500/15 text-emerald-100`:`border-border bg-muted/60 text-foreground hover:bg-muted`,M;t[26]===j?M=t[27]:(M=S(`inline-flex h-6 items-center gap-1 rounded-md border px-2 font-mono text-[11px] transition-all duration-150`,j),t[26]=j,t[27]=M);let N;t[28]===c?N=t[29]:(N=c?{animation:`keybindings-pulse 1.4s ease-in-out infinite`}:{},t[28]=c,t[29]=N);let P=c?(0,Z.jsx)(`span`,{className:`text-[11px] tracking-[0.04em]`,children:`Press shortcut…`}):g.length===0?(0,Z.jsx)(`span`,{className:`text-muted-foreground/60`,children:`Click to set`}):g.map(e=>(0,Z.jsx)(De,{token:e,isMac:a},e)),F;t[30]!==c||t[31]!==r.when?(F=!c&&r.when!==void 0?(0,Z.jsx)(`span`,{className:`ml-1 hidden sm:inline`,children:`·`}):null,t[30]=c,t[31]=r.when,t[32]=F):F=t[32];let I;t[33]!==c||t[34]!==E||t[35]!==v||t[36]!==k||t[37]!==A||t[38]!==M||t[39]!==N||t[40]!==P||t[41]!==F?(I=(0,Z.jsxs)(`button`,{ref:f,type:`button`,"aria-pressed":c,"aria-label":k,"data-chip-pending-record":A,onClick:v,onKeyDown:E,className:M,style:N,children:[P,F]}),t[33]=c,t[34]=E,t[35]=v,t[36]=k,t[37]=A,t[38]=M,t[39]=N,t[40]=P,t[41]=F,t[42]=I):I=t[42];let z;t[43]!==i||t[44]!==n?(z=e=>i.onChangeWhen(n,e),t[43]=i,t[44]=n,t[45]=z):z=t[45];let B=n<0||c,V;t[46]!==r.when||t[47]!==z||t[48]!==B?(V=(0,Z.jsx)(Oe,{currentWhen:r.when,onChange:z,disabled:B}),t[46]=r.when,t[47]=z,t[48]=B,t[49]=V):V=t[49];let H;t[50]!==n||t[51]!==O||t[52]!==c?(H=n>=0&&!c?(0,Z.jsx)(`button`,{type:`button`,onClick:O,"aria-label":`Remove this shortcut`,className:`opacity-0 transition-opacity group-hover:opacity-100 focus:opacity-100`,children:(0,Z.jsx)(y,{className:`size-3 text-muted-foreground/60 hover:text-destructive`})}):null,t[50]=n,t[51]=O,t[52]=c,t[53]=H):H=t[53];let U;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(ke,{}),t[54]=U):U=t[54];let W;return t[55]!==I||t[56]!==V||t[57]!==H?(W=(0,Z.jsxs)(`span`,{className:`relative inline-flex items-center gap-1`,children:[I,V,H,U]}),t[55]=I,t[56]=V,t[57]=H,t[58]=W):W=t[58],W}function Te(){document.querySelectorAll(`[data-chip-pending-record="true"]`).forEach(Ee)}function Ee(e){e.click()}function De(e){let t=(0,R.c)(5),{token:n,isMac:r}=e,i=r&&n.length===1&&/[⌀-⏿←-⇿]/.test(n)?`bg-transparent`:`bg-foreground/10`,a;t[0]===i?a=t[1]:(a=S(`rounded px-1 leading-none`,i),t[0]=i,t[1]=a);let o;return t[2]!==a||t[3]!==n?(o=(0,Z.jsx)(`span`,{className:a,children:n}),t[2]=a,t[3]=n,t[4]=o):o=t[4],o}function Oe(e){let t=(0,R.c)(35),{currentWhen:n,onChange:r,disabled:i}=e,a;t[0]===n?a=t[1]:(a=K(n),t[0]=n,t[1]=a);let o=a,s,c,l,u,d,f,p;if(t[2]!==n||t[3]!==i){let e=q(n);c=A,s=j,l=`button`,u=i;let r=n===void 0&&`italic opacity-70`;t[11]===r?d=t[12]:(d=S(`inline-flex h-5 items-center gap-1 rounded bg-muted/40 px-1.5 text-[10px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,r),t[11]=r,t[12]=d),f=`When: ${e}`,p=n===void 0?`always`:e.toLowerCase(),t[2]=n,t[3]=i,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p}else s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10];let m;t[13]!==l||t[14]!==u||t[15]!==d||t[16]!==f||t[17]!==p?(m=(0,Z.jsx)(`button`,{type:l,disabled:u,className:d,"aria-label":f,children:p}),t[13]=l,t[14]=u,t[15]=d,t[16]=f,t[17]=p,t[18]=m):m=t[18];let h;t[19]!==s||t[20]!==m?(h=(0,Z.jsx)(s,{render:m}),t[19]=s,t[20]=m,t[21]=h):h=t[21];let g;t[22]!==n||t[23]!==o?(g=!o&&n!==void 0?(0,Z.jsxs)(`div`,{className:`px-2 py-1.5 text-[10px] text-muted-foreground`,children:[`Current: `,(0,Z.jsx)(`code`,{className:`font-mono`,children:n})]}):null,t[22]=n,t[23]=o,t[24]=g):g=t[24];let _;t[25]!==n||t[26]!==r?(_=U.map(e=>(0,Z.jsxs)(M,{onClick:()=>r(e.value),className:S(`flex items-center justify-between text-[12px]`,e.value===n&&`font-semibold text-foreground`),children:[(0,Z.jsx)(`span`,{children:e.label}),e.value===void 0?(0,Z.jsx)(`span`,{className:`text-[10px] text-muted-foreground/60`,children:`no condition`}):(0,Z.jsx)(`code`,{className:`text-[10px] font-mono text-muted-foreground/60`,children:e.value})]},e.id)),t[25]=n,t[26]=r,t[27]=_):_=t[27];let v;t[28]!==_||t[29]!==g?(v=(0,Z.jsxs)(k,{side:`bottom`,align:`end`,className:`min-w-[220px]`,children:[g,_]}),t[28]=_,t[29]=g,t[30]=v):v=t[30];let y;return t[31]!==c||t[32]!==v||t[33]!==h?(y=(0,Z.jsxs)(c,{children:[h,v]}),t[31]=c,t[32]=v,t[33]=h,t[34]=y):y=t[34],y}function ke(){let e=(0,R.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`style`,{children:`@keyframes keybindings-pulse {
|
|
1
|
+
import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{Bn as r,Ft as i,Jt as a,Vn as o,Wn as s,Xn as c,hn as l,xn as u}from"./runtime-CXut_g4p.js";import{dt as d}from"./primary-BzLEg2w1.js";import{It as f}from"./composerDraftStore-CdJJZe42.js";import{i as p}from"./toast-CcSCAm4B.js";import{t as m}from"./keyboard-BqeRMHfL.js";import{t as h}from"./plus-B2h-VEqh.js";import{t as g}from"./search-BGQsenCM.js";import{t as _}from"./triangle-alert-RL_T3KLo.js";import{t as v}from"./undo-2-x37tfI3V.js";import{t as y}from"./x-C1Cemsov.js";import{t as b}from"./shallow-DWZCFNun.js";import{n as x,t as S}from"./utils-BofFIn5Y.js";import{i as C,n as w,t as T}from"./tooltip-C8sAONBj.js";import{t as E}from"./input-CHEwW3oH.js";import{t as D}from"./button-BAbJxRzt.js";import{t as O}from"./toastHelpers-CSQRKo4F.js";import{c as k,i as A,p as j,s as M}from"./menu-Dvxh8sD5.js";import{r as N}from"./editorPreferences-DHIJntKF.js";import{i as P,n as F,r as I}from"./settingsLayout-D8glO7f1.js";var L=e(t(),1),R=n(),z={terminal:{id:`terminal`,label:`Terminal`,sortWeight:10},workspace:{id:`workspace`,label:`Workspace`,sortWeight:20},diff:{id:`diff`,label:`Diff`,sortWeight:30},commandPalette:{id:`commandPalette`,label:`Command palette`,sortWeight:40},sidebar:{id:`sidebar`,label:`Sidebar`,sortWeight:50},chat:{id:`chat`,label:`Chat`,sortWeight:60},composer:{id:`composer`,label:`Composer`,sortWeight:70},editor:{id:`editor`,label:`Editor`,sortWeight:80},modelPicker:{id:`modelPicker`,label:`Model picker`,sortWeight:90},thread:{id:`thread`,label:`Threads`,sortWeight:100},script:{id:`script`,label:`Project scripts`,sortWeight:110}},B={"terminal.toggle":{title:`Toggle terminal drawer`,sortWeight:1},"terminal.split":{title:`Split terminal`,sortWeight:2},"terminal.new":{title:`New terminal`,sortWeight:3},"terminal.close":{title:`Close terminal`,sortWeight:4},"workspace.files":{title:`Open workspace files`,sortWeight:1},"workspace.review":{title:`Open workspace review`,sortWeight:2},"workspace.terminal":{title:`Open workspace terminal`,sortWeight:3},"workspace.simulator":{title:`Open iOS Simulator workspace`,sortWeight:4},"diff.toggle":{title:`Toggle diff view`,sortWeight:1},"commandPalette.toggle":{title:`Open command palette`,sortWeight:1},"sidebar.showInbox":{title:`Show Inbox sidebar`,sortWeight:1},"sidebar.showProjects":{title:`Show Projects sidebar`,sortWeight:2},"chat.new":{title:`New chat`,sortWeight:1},"chat.newLocal":{title:`New chat (local environment)`,sortWeight:2},"composer.stash":{title:`Stash prompt or open stash`,sortWeight:1},"editor.openFavorite":{title:`Open in preferred editor`,sortWeight:1},"modelPicker.toggle":{title:`Toggle model picker`,sortWeight:1},"modelPicker.jump.1":{title:`Pick model 1`,sortWeight:2},"modelPicker.jump.2":{title:`Pick model 2`,sortWeight:3},"modelPicker.jump.3":{title:`Pick model 3`,sortWeight:4},"modelPicker.jump.4":{title:`Pick model 4`,sortWeight:5},"modelPicker.jump.5":{title:`Pick model 5`,sortWeight:6},"modelPicker.jump.6":{title:`Pick model 6`,sortWeight:7},"modelPicker.jump.7":{title:`Pick model 7`,sortWeight:8},"modelPicker.jump.8":{title:`Pick model 8`,sortWeight:9},"modelPicker.jump.9":{title:`Pick model 9`,sortWeight:10},"thread.find":{title:`Find in current thread`,sortWeight:1},"thread.previous":{title:`Previous thread`,sortWeight:2},"thread.next":{title:`Next thread`,sortWeight:3},"thread.jump.1":{title:`Jump to thread 1`,sortWeight:4},"thread.jump.2":{title:`Jump to thread 2`,sortWeight:5},"thread.jump.3":{title:`Jump to thread 3`,sortWeight:6},"thread.jump.4":{title:`Jump to thread 4`,sortWeight:7},"thread.jump.5":{title:`Jump to thread 5`,sortWeight:8},"thread.jump.6":{title:`Jump to thread 6`,sortWeight:9},"thread.jump.7":{title:`Jump to thread 7`,sortWeight:10},"thread.jump.8":{title:`Jump to thread 8`,sortWeight:11},"thread.jump.9":{title:`Jump to thread 9`,sortWeight:12}};function V(e){let t=e.indexOf(`.`),n=t===-1?e:e.slice(0,t);return n===`script`?z.script:z[n]??z.script}function H(e,t){let n=V(e),r=B[e];if(r)return{category:n,title:r.title,sortWeight:r.sortWeight};let i=e.match(/^script\.([a-z0-9][a-z0-9-]*)\.run$/)?.[1]??e;return{category:n,title:t??`Run: ${i}`,sortWeight:100}}var U=[{id:`always`,label:`Always`,value:void 0},{id:`terminalFocus`,label:`Terminal focused`,value:`terminalFocus`},{id:`notTerminalFocus`,label:`Not in terminal`,value:`!terminalFocus`},{id:`terminalOpen`,label:`Terminal open`,value:`terminalOpen`},{id:`notTerminalOpen`,label:`Terminal not open`,value:`!terminalOpen`},{id:`modelPickerOpen`,label:`Model picker open`,value:`modelPickerOpen`},{id:`commandPaletteOpen`,label:`Command palette open`,value:`commandPaletteOpen`},{id:`composerFocus`,label:`Composer focused`,value:`composerFocus`},{id:`notComposerFocus`,label:`Not in composer`,value:`!composerFocus`}],W=new Map(U.map(e=>[e.value,e])),G=new Map(U.map(e=>[e.value===void 0?void 0:e.value.replace(/\s+/g,``),e]));function K(e){return e===void 0?W.get(void 0):W.get(e)||G.get(e.replace(/\s+/g,``))}function q(e){let t=K(e);return t?t.label:e??`Always`}function J(e){if(e)switch(e.type){case`identifier`:return e.name;case`not`:return`!${J(e.node)}`;case`and`:return`(${J(e.left)} && ${J(e.right)})`;case`or`:return`(${J(e.left)} || ${J(e.right)})`}}function ee(e,t){return(e===void 0?``:e.replace(/\s+/g,``))===(t===void 0?``:t.replace(/\s+/g,``))}function te(e,t){let n=e[t];if(!n)return[];let r=[];return e.forEach((e,i)=>{i!==t&&e.command!==n.command&&e.key===n.key&&ee(e.when,n.when)&&r.push({key:n.key,otherCommand:e.command,otherWhen:e.when})}),r}function ne(e){let t=new Map;return e.forEach((n,r)=>{let i=te(e,r);if(i.length===0)return;let a=e[r].command,o=t.get(a)??[];o.push(...i),t.set(a,o)}),t}function Y(e){return/mac|iphone|ipad|ipod/i.test(e)}var re=new Set([`control`,`shift`,`alt`,`altgraph`,`meta`,`os`,`hyper`,`super`,`fn`,`capslock`,`numlock`,`scrolllock`]),ie=new Set([`escape`,`tab`,`enter`]);function ae(e,t){let n=e.toLowerCase();if(n===` `||n===`spacebar`)return`space`;if(n===`esc`)return`escape`;if(n===`arrowup`)return`up`;if(n===`arrowdown`)return`down`;if(n===`arrowleft`)return`left`;if(n===`arrowright`)return`right`;if(t){let e=t.match(/^Digit(\d)$/);if(e)return e[1];if(t===`BracketLeft`)return`[`;if(t===`BracketRight`)return`]`}return n}function oe(e,t){let n=e.key.toLowerCase();if(re.has(n))return null;let r=Y(t?.platform??(typeof navigator<`u`?navigator.platform:``)),i=r?e.metaKey:e.ctrlKey;if(!(i||e.shiftKey||e.altKey||(r?e.ctrlKey:e.metaKey))&&ie.has(n))return null;let a=ae(e.key,e.code);return a.length===0?null:{key:a,modKey:i,metaKey:!r&&e.metaKey,ctrlKey:r&&e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey}}var se={mod:`⌘`,meta:`⌘`,cmd:`⌘`,ctrl:`⌃`,control:`⌃`,shift:`⇧`,alt:`⌥`,option:`⌥`},ce={mod:`Ctrl`,meta:`Meta`,cmd:`Meta`,ctrl:`Ctrl`,control:`Ctrl`,shift:`Shift`,alt:`Alt`,option:`Alt`},X={space:`Space`,enter:`Enter`,escape:`Esc`,up:`↑`,down:`↓`,left:`←`,right:`→`,tab:`Tab`,backspace:`⌫`,delete:`Del`};function le(e,t){let n=Y(t?.platform??(typeof navigator<`u`?navigator.platform:``))?se:ce,r=[];e.modKey&&r.push(n.mod),e.metaKey&&r.push(n.meta),e.ctrlKey&&r.push(n.ctrl),e.altKey&&r.push(n.alt),e.shiftKey&&r.push(n.shift);let i=X[e.key]??(e.key.length===1?e.key.toUpperCase():e.key);return r.push(i),r}function ue(e){let t=[];e.modKey&&t.push(`mod`),e.metaKey&&t.push(`meta`),e.ctrlKey&&t.push(`ctrl`),e.altKey&&t.push(`alt`),e.shiftKey&&t.push(`shift`);let n=e.key===` `?`space`:e.key;return t.push(n),t.join(`+`)}var Z=f(),de=[],fe=(()=>{let e=new Map;for(let t of d){let n=`${t.key}|${t.when??``}`,r=e.get(t.command)??new Set;r.add(n),e.set(t.command,r)}return e})(),Q=new Set(d.map(e=>e.command));function pe(e,t){return`${e.command}|${e.key}|${e.when??``}|${t}`}function me(e){return{key:ue(e.shortcut),command:e.command,when:J(e.whenAst)}}function $(e){return e.map((e,t)=>({...me(e),__id:pe(e,t)}))}function he(e){return e.map(({__id:e,...t})=>t)}function ge(e){return d.filter(t=>t.command===e).map(e=>Object.assign({},e))}function _e(e,t){if(!Q.has(e))return`custom`;let n=fe.get(e);if(!n)return`custom`;if(t.length!==n.size)return`modified`;for(let e of t){let t=`${e.key}|${e.when??``}`;if(!n.has(t))return`modified`}return`default`}function ve(e,t,n){return!n||[t.toLowerCase(),e.command.toLowerCase(),e.key.toLowerCase(),q(e.when).toLowerCase()].some(e=>e.includes(n))}function ye(){return Math.random().toString(36).slice(2)}function be(){let e=c(),t=o(),n=s(),d=r(),f=typeof navigator<`u`?navigator.platform:``,h=x(f),[y,S]=(0,L.useState)(!1),[C,w]=(0,L.useState)(null),T=!e||e.primary,k=e?l(e.environmentId)?.keybindings:u().keybindings,A=(0,L.useCallback)(()=>{if(!n)return;if(!T){w(`This file lives on ${e?.nodeLabel??`the selected node`} and cannot be opened in a local editor.`);return}w(null),S(!0);let t=N(d??[]);if(!t){w(`No available editors found.`),S(!1);return}u().shell.openInEditor(n,t).catch(e=>{w(e instanceof Error?e.message:`Unable to open keybindings file.`)}).finally(()=>{S(!1)})},[d,T,n,e?.nodeLabel]),j=a(b(i)),M=(0,L.useMemo)(()=>{let e=new Set,t=new Map;for(let n of j)for(let r of n.scripts){let n=`script.${r.id}.run`;e.add(n),t.has(n)||t.set(n,`Run: ${r.name}`)}return{commandList:Array.from(e),titles:t}},[j]),R=t?.keybindings??de,[B,V]=(0,L.useState)(()=>$(R)),[U,W]=(0,L.useState)(()=>JSON.stringify(he($(R)))),G=(0,L.useRef)(!1);(0,L.useEffect)(()=>{let e=JSON.stringify(he($(R)));e!==U&&(W(e),G.current||V($(R)))},[R,U]);let K=(0,L.useCallback)(async e=>{G.current=!0;try{if(!k)throw Error(`Keybinding settings are unavailable on this node.`);await k.replaceCustom({rules:he(e)})}catch(e){p.add(O({type:`error`,title:`Could not save keybindings`,description:e instanceof Error?e.message:`An unknown error occurred.`})),V($(R))}finally{G.current=!1}},[k,R]),q=(0,L.useCallback)((e,t)=>{V(n=>{let r=n.slice(),i=r[e];if(!i)return n;let a=ue(t);return a===i.key?n:(r[e]={...i,key:a,__id:i.__id},K(r),r)})},[K]),J=(0,L.useCallback)(e=>{V(t=>{let n={command:e,key:``,when:void 0,__id:`placeholder-${ye()}`},r=(()=>{let n=-1;return t.forEach((t,r)=>{t.command===e&&(n=r)}),n})();return r===-1?[...t,n]:[...t.slice(0,r+1),n,...t.slice(r+1)]})},[]),ee=(0,L.useCallback)(e=>{V(t=>{let n=t.slice();return n.splice(e,1),K(n),n})},[K]),te=(0,L.useCallback)((e,t)=>{V(n=>{let r=n.slice(),i=r[e];return!i||(i.when??void 0)===t?n:(r[e]={...i,when:t,__id:i.__id},K(r),r)})},[K]),Y=(0,L.useCallback)(e=>{V(t=>{let n=t[e];if(!n)return t;let r=n.command;if(!Q.has(r)){let n=t.slice();return n.splice(e,1),K(n),n}let i=ge(r),a=t.filter(e=>e.command!==r);for(let e of i)a.push({...e,__id:`default-${r}-${ye()}`});return K(a),a})},[K]),re=(0,L.useCallback)(e=>{V(t=>{let n=t.filter(t=>t.command!==e);if(Q.has(e))for(let t of ge(e))n.push({...t,__id:`default-${e}-${ye()}`});return K(n),n})},[K]),ie=(0,L.useCallback)(async()=>{V([]);try{if(!k)throw Error(`Keybinding settings are unavailable on this node.`);await k.replaceCustom({rules:[]})}catch(e){p.add(O({type:`error`,title:`Could not restore default keybindings`,description:e instanceof Error?e.message:`An unknown error occurred.`})),V($(R))}},[k,R]),ae=(0,L.useRef)(new Map),oe=(0,L.useCallback)(e=>{let t=ae.current.get(e);t&&(t.scrollIntoView({behavior:`smooth`,block:`center`}),t.dataset.flash=`true`,window.setTimeout(()=>{delete t.dataset.flash},1100))},[]),[se,ce]=(0,L.useState)(``),X=(0,L.useDeferredValue)(se.trim().toLowerCase()),le=(0,L.useMemo)(()=>ne(B),[B]),fe=(0,L.useMemo)(()=>{let e=new Map;B.forEach((t,n)=>{let r=e.get(t.command);r?r.push(n):e.set(t.command,[n])});let t=new Set([...e.keys(),...Q,...M.commandList]),n=new Map;for(let r of t){let t=e.get(r)??[],i=t.map(e=>B[e]).filter(Boolean),a=H(r,M.titles.get(r)),o=_e(r,i),s={key:``,command:r,when:void 0};if(!(X.length===0||ve(s,a.title,X)||i.some(e=>ve(e,a.title,X))))continue;let c={command:r,title:a.title,indicesInDraft:t,status:o},l=n.get(a.category.id);l?l.push(c):n.set(a.category.id,[c])}let r=[];for(let e of Object.values(z).toSorted((e,t)=>e.sortWeight-t.sortWeight)){let t=n.get(e.id);!t||t.length===0||(t.sort((e,t)=>{let n=H(e.command,M.titles.get(e.command)),r=H(t.command,M.titles.get(t.command));return n.sortWeight-r.sortWeight}),r.push({category:e,rows:t}))}return r},[B,X,M]),pe=fe.reduce((e,t)=>e+t.rows.length,0),me=(0,L.useMemo)(()=>({platform:f,draft:B,conflictsByCommand:le,onRebind:q,onAddBinding:J,onRemoveBinding:ee,onChangeWhen:te,onResetBinding:Y,onResetCommand:re,scrollToCommand:oe,rowRefs:ae}),[f,B,le,q,J,ee,te,Y,re,oe]),be=t?.issues.filter(e=>e.kind.startsWith(`keybindings.`))??[],Se=(d??[]).length>0;return(0,Z.jsxs)(F,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`span`,{className:`grid size-9 place-items-center rounded-lg bg-accent text-foreground/70`,children:(0,Z.jsx)(m,{className:`size-4`})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:`Keybindings`}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Click any shortcut and press a new combination to rebind. Press Esc to cancel, Backspace to clear.`})]})]}),(0,Z.jsxs)(D,{variant:`outline`,size:`xs`,onClick:()=>void ie(),disabled:B.length===0,children:[(0,Z.jsx)(v,{className:`size-3.5`}),`Restore defaults`]})]}),(0,Z.jsx)(P,{title:`Configuration file`,children:(0,Z.jsx)(I,{title:`Keybindings file`,description:"Open the persisted `keybindings.json` file to edit advanced bindings directly.",status:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`block break-all font-mono text-[11px] text-foreground`,children:n??`Resolving keybindings path...`}),C?(0,Z.jsx)(`span`,{className:`mt-1 block text-destructive`,children:C}):(0,Z.jsx)(`span`,{className:`mt-1 block`,children:T?Se?`Opens in your preferred editor.`:`No available editors found.`:`Stored on ${e?.nodeLabel??`the selected node`}; use an editor on that machine.`})]}),control:(0,Z.jsx)(D,{size:`xs`,variant:`outline`,disabled:!T||!n||!Se||y,onClick:A,children:y?`Opening...`:`Open file`})})}),be.length>0?(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-200`,children:[(0,Z.jsx)(_,{className:`mt-0.5 size-4 shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-0.5`,children:[be.map(e=>(0,Z.jsx)(`p`,{children:e.message},`${e.kind}-${e.message}`)),n?(0,Z.jsxs)(`p`,{className:`opacity-70`,children:[`Edit `,(0,Z.jsx)(`code`,{className:`rounded bg-amber-500/20 px-1`,children:n}),` `,`to resolve.`]}):null]})]}):null,(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(g,{className:`absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground/60`}),(0,Z.jsx)(E,{type:`search`,placeholder:`Search by command, shortcut, or when…`,className:`pl-9`,value:se,onChange:e=>ce(e.target.value)})]}),pe===0?(0,Z.jsx)(`div`,{className:`rounded-lg border border-dashed border-border/60 px-6 py-12 text-center text-sm text-muted-foreground`,children:`No commands match your search.`}):fe.map(e=>(0,Z.jsx)(P,{title:e.category.label,children:e.rows.map(e=>(0,Z.jsx)(xe,{row:e,context:me,isMac:h,scriptTitle:M.titles.get(e.command)},e.command))},e.category.id))]})}var xe=(0,L.memo)(function(e){let t=(0,R.c)(42),{row:n,context:r,isMac:i}=e,a;if(t[0]!==r||t[1]!==i||t[2]!==n.command||t[3]!==n.indicesInDraft||t[4]!==n.status||t[5]!==n.title){let e;t[7]===r.draft?e=t[8]:(e=e=>({index:e,rule:r.draft[e]}),t[7]=r.draft,t[8]=e);let o=n.indicesInDraft.map(e),s=r.conflictsByCommand.get(n.command)??[],c=s.slice(0,3),l=n.command,u;t[9]!==r.rowRefs.current||t[10]!==n.command?(u=e=>{r.rowRefs.current.set(n.command,e)},t[9]=r.rowRefs.current,t[10]=n.command,t[11]=u):u=t[11];let d;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(d=S(`group flex flex-col gap-2 border-t border-border/60 px-4 py-3 first:border-t-0 transition-colors data-[flash=true]:bg-amber-500/10 sm:px-5`),t[12]=d):d=t[12];let f;t[13]===n.title?f=t[14]:(f=(0,Z.jsx)(`span`,{className:`truncate text-[13px] font-medium tracking-tight text-foreground`,children:n.title}),t[13]=n.title,t[14]=f);let p;t[15]===n.status?p=t[16]:(p=(0,Z.jsx)(Se,{status:n.status}),t[15]=n.status,t[16]=p);let m;t[17]!==f||t[18]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f,p]}),t[17]=f,t[18]=p,t[19]=m):m=t[19];let g;t[20]===n.command?g=t[21]:(g=(0,Z.jsx)(`code`,{className:`block truncate text-[10px] text-muted-foreground/60`,children:n.command}),t[20]=n.command,t[21]=g);let _;t[22]!==m||t[23]!==g?(_=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[m,g]}),t[22]=m,t[23]=g,t[24]=_):_=t[24];let y=o.length===0?(0,Z.jsx)(we,{draftIndex:-1,rule:{command:n.command,key:``,when:void 0},context:r,isMac:i,isPrimary:!0,isPlaceholder:!0,onAddPlaceholder:()=>r.onAddBinding(n.command)},`placeholder`):o.map((e,t)=>{let{index:n,rule:a}=e;return(0,Z.jsx)(we,{draftIndex:n,rule:a,context:r,isMac:i,isPrimary:t===0,isPlaceholder:a.key.length===0},`${n}-${a.__id}`)}),b;t[25]!==r||t[26]!==n.command||t[27]!==n.title||t[28]!==o?(b=o.length>0?(0,Z.jsxs)(T,{children:[(0,Z.jsx)(C,{render:(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r.onAddBinding(n.command),className:`inline-flex size-6 items-center justify-center rounded-md border border-dashed border-border/60 text-muted-foreground/60 transition-colors hover:border-border hover:text-foreground`,"aria-label":`Add another shortcut for ${n.title}`,children:(0,Z.jsx)(h,{className:`size-3.5`})})}),(0,Z.jsx)(w,{side:`top`,children:`Add another shortcut`})]}):null,t[25]=r,t[26]=n.command,t[27]=n.title,t[28]=o,t[29]=b):b=t[29];let x;t[30]!==r||t[31]!==n.command||t[32]!==n.status||t[33]!==n.title?(x=n.status!=="default"&&Q.has(n.command)?(0,Z.jsxs)(T,{children:[(0,Z.jsx)(C,{render:(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r.onResetCommand(n.command),className:`inline-flex size-6 items-center justify-center rounded-md text-muted-foreground/50 transition-colors hover:text-foreground`,"aria-label":`Reset ${n.title} to default`,children:(0,Z.jsx)(v,{className:`size-3.5`})})}),(0,Z.jsx)(w,{side:`top`,children:`Reset to default`})]}):null,t[30]=r,t[31]=n.command,t[32]=n.status,t[33]=n.title,t[34]=x):x=t[34];let E;t[35]!==y||t[36]!==b||t[37]!==x?(E=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1.5`,children:[y,b,x]}),t[35]=y,t[36]=b,t[37]=x,t[38]=E):E=t[38];let D;t[39]!==_||t[40]!==E?(D=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[_,E]}),t[39]=_,t[40]=E,t[41]=D):D=t[41],a=(0,Z.jsxs)(`div`,{"data-keybinding-command":l,ref:u,className:d,children:[D,c.length>0?(0,Z.jsxs)(`div`,{className:`animate-in fade-in slide-in-from-top-1 flex flex-col gap-1 rounded-md border border-destructive/30 bg-destructive/10 px-2.5 py-1.5 text-[11px] text-destructive-foreground/90`,children:[c.map(e=>(0,Z.jsx)(Ce,{conflict:e,isMac:i,platform:r.platform,onSelect:()=>r.scrollToCommand(e.otherCommand)},`${e.key}-${e.otherCommand}`)),s.length>c.length?(0,Z.jsxs)(`span`,{className:`opacity-70`,children:[`+ `,s.length-c.length,` more`]}):null]}):null]}),t[0]=r,t[1]=i,t[2]=n.command,t[3]=n.indicesInDraft,t[4]=n.status,t[5]=n.title,t[6]=a}else a=t[6];return a});function Se(e){let t=(0,R.c)(5),{status:n}=e;if(n==="default")return null;let r=n===`modified`?`bg-amber-500/15 text-amber-300`:`bg-indigo-500/15 text-indigo-300`,i;t[0]===r?i=t[1]:(i=S(`rounded px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-[0.06em]`,r),t[0]=r,t[1]=i);let a=n===`modified`?`Modified`:`Custom`,o;return t[2]!==i||t[3]!==a?(o=(0,Z.jsx)(`span`,{className:i,children:a}),t[2]=i,t[3]=a,t[4]=o):o=t[4],o}function Ce(e){let t=(0,R.c)(27),{conflict:n,platform:r,isMac:i,onSelect:a}=e,o;t[0]===n.otherCommand?o=t[1]:(o=H(n.otherCommand),t[0]=n.otherCommand,t[1]=o);let s=o,c,l,u,d;if(t[2]!==n.key||t[3]!==i||t[4]!==r){let e=je(n.key),a=e?le(e,{platform:r}):[n.key];u=`flex flex-wrap items-center gap-1.5`,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(_,{className:`size-3 shrink-0 text-destructive`}),t[9]=d):d=t[9],c=`inline-flex items-center gap-0.5 font-mono`;let o;t[10]===i?o=t[11]:(o=e=>(0,Z.jsx)(De,{token:e,isMac:i},e),t[10]=i,t[11]=o),l=a.map(o),t[2]=n.key,t[3]=i,t[4]=r,t[5]=c,t[6]=l,t[7]=u,t[8]=d}else c=t[5],l=t[6],u=t[7],d=t[8];let f;t[12]!==c||t[13]!==l?(f=(0,Z.jsx)(`span`,{className:c,children:l}),t[12]=c,t[13]=l,t[14]=f):f=t[14];let p;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`span`,{children:`also bound to`}),t[15]=p):p=t[15];let m;t[16]!==s.title||t[17]!==a?(m=(0,Z.jsx)(`button`,{type:`button`,onClick:a,className:`rounded bg-destructive/20 px-1.5 py-0.5 font-medium text-destructive-foreground hover:bg-destructive/30`,children:s.title}),t[16]=s.title,t[17]=a,t[18]=m):m=t[18];let h;t[19]===n.otherWhen?h=t[20]:(h=n.otherWhen===void 0?null:(0,Z.jsxs)(`span`,{className:`opacity-70`,children:[`when `,(0,Z.jsx)(`code`,{className:`font-mono`,children:q(n.otherWhen)})]}),t[19]=n.otherWhen,t[20]=h);let g;return t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==m||t[25]!==h?(g=(0,Z.jsxs)(`div`,{className:u,children:[d,f,p,m,h]}),t[21]=u,t[22]=d,t[23]=f,t[24]=m,t[25]=h,t[26]=g):g=t[26],g}function we(e){let t=(0,R.c)(59),{draftIndex:n,rule:r,context:i,isMac:a,isPlaceholder:o,onAddPlaceholder:s}=e,[c,l]=(0,L.useState)(!1),[u,d]=(0,L.useState)(!1),f=(0,L.useRef)(null),p;bb0:{if(r.key.length===0){p=null;break bb0}let e;t[0]===r.key?e=t[1]:(e=je(r.key),t[0]=r.key,t[1]=e),p=e}let m=p,g=m?le(m,{platform:i.platform}):[],_;t[2]!==n||t[3]!==o||t[4]!==s?(_=()=>{if(o&&n===-1&&s){s(),setTimeout(Te,50);return}l(!0)},t[2]=n,t[3]=o,t[4]=s,t[5]=_):_=t[5];let v=_,b,x;t[6]!==i||t[7]!==n||t[8]!==c?(b=()=>{if(!c)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`&&!Ae(e)){l(!1);return}if(e.key===`Tab`&&!Ae(e)){l(!1);return}if(e.key===`Backspace`&&!Ae(e)){n>=0&&i.onRemoveBinding(n),l(!1);return}let t=oe(e,{platform:i.platform});t&&(n>=0&&i.onRebind(n,t),d(!0),l(!1),setTimeout(()=>d(!1),220))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},x=[c,n,i],t[6]=i,t[7]=n,t[8]=c,t[9]=b,t[10]=x):(b=t[9],x=t[10]),(0,L.useEffect)(b,x);let C,w;t[11]===c?(C=t[12],w=t[13]):(C=()=>{c&&f.current?.focus()},w=[c],t[11]=c,t[12]=C,t[13]=w),(0,L.useEffect)(C,w);let T;t[14]!==c||t[15]!==v?(T=e=>{c||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),v())},t[14]=c,t[15]=v,t[16]=T):T=t[16];let E=T,D;t[17]!==i||t[18]!==n?(D=()=>{n>=0&&i.onRemoveBinding(n)},t[17]=i,t[18]=n,t[19]=D):D=t[19];let O=D;if(o&&n===-1&&g.length===0){let e;t[20]===s?e=t[21]:(e=()=>s?.(),t[20]=s,t[21]=e);let n;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(h,{className:`size-3`}),t[22]=n):n=t[22];let r;return t[23]!==E||t[24]!==e?(r=(0,Z.jsxs)(`button`,{ref:f,type:`button`,onClick:e,onKeyDown:E,className:`inline-flex h-6 items-center gap-1 rounded-md border border-dashed border-border/60 bg-transparent px-2 text-[11px] text-muted-foreground/70 transition-colors hover:border-border hover:text-foreground`,children:[n,` No shortcut — click to set`]}),t[23]=E,t[24]=e,t[25]=r):r=t[25],r}let k=`Edit shortcut for ${r.command}`,A=g.length===0&&n>=0?`true`:void 0,j=c?`kb-chip-recording border-indigo-500/60 bg-indigo-500/15 text-indigo-100 shadow-[0_0_0_4px_rgba(99,102,241,0.18)]`:u?`border-emerald-500/50 bg-emerald-500/15 text-emerald-100`:`border-border bg-muted/60 text-foreground hover:bg-muted`,M;t[26]===j?M=t[27]:(M=S(`inline-flex h-6 items-center gap-1 rounded-md border px-2 font-mono text-[11px] transition-all duration-150`,j),t[26]=j,t[27]=M);let N;t[28]===c?N=t[29]:(N=c?{animation:`keybindings-pulse 1.4s ease-in-out infinite`}:{},t[28]=c,t[29]=N);let P=c?(0,Z.jsx)(`span`,{className:`text-[11px] tracking-[0.04em]`,children:`Press shortcut…`}):g.length===0?(0,Z.jsx)(`span`,{className:`text-muted-foreground/60`,children:`Click to set`}):g.map(e=>(0,Z.jsx)(De,{token:e,isMac:a},e)),F;t[30]!==c||t[31]!==r.when?(F=!c&&r.when!==void 0?(0,Z.jsx)(`span`,{className:`ml-1 hidden sm:inline`,children:`·`}):null,t[30]=c,t[31]=r.when,t[32]=F):F=t[32];let I;t[33]!==c||t[34]!==E||t[35]!==v||t[36]!==k||t[37]!==A||t[38]!==M||t[39]!==N||t[40]!==P||t[41]!==F?(I=(0,Z.jsxs)(`button`,{ref:f,type:`button`,"aria-pressed":c,"aria-label":k,"data-chip-pending-record":A,onClick:v,onKeyDown:E,className:M,style:N,children:[P,F]}),t[33]=c,t[34]=E,t[35]=v,t[36]=k,t[37]=A,t[38]=M,t[39]=N,t[40]=P,t[41]=F,t[42]=I):I=t[42];let z;t[43]!==i||t[44]!==n?(z=e=>i.onChangeWhen(n,e),t[43]=i,t[44]=n,t[45]=z):z=t[45];let B=n<0||c,V;t[46]!==r.when||t[47]!==z||t[48]!==B?(V=(0,Z.jsx)(Oe,{currentWhen:r.when,onChange:z,disabled:B}),t[46]=r.when,t[47]=z,t[48]=B,t[49]=V):V=t[49];let H;t[50]!==n||t[51]!==O||t[52]!==c?(H=n>=0&&!c?(0,Z.jsx)(`button`,{type:`button`,onClick:O,"aria-label":`Remove this shortcut`,className:`opacity-0 transition-opacity group-hover:opacity-100 focus:opacity-100`,children:(0,Z.jsx)(y,{className:`size-3 text-muted-foreground/60 hover:text-destructive`})}):null,t[50]=n,t[51]=O,t[52]=c,t[53]=H):H=t[53];let U;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(ke,{}),t[54]=U):U=t[54];let W;return t[55]!==I||t[56]!==V||t[57]!==H?(W=(0,Z.jsxs)(`span`,{className:`relative inline-flex items-center gap-1`,children:[I,V,H,U]}),t[55]=I,t[56]=V,t[57]=H,t[58]=W):W=t[58],W}function Te(){document.querySelectorAll(`[data-chip-pending-record="true"]`).forEach(Ee)}function Ee(e){e.click()}function De(e){let t=(0,R.c)(5),{token:n,isMac:r}=e,i=r&&n.length===1&&/[⌀-⏿←-⇿]/.test(n)?`bg-transparent`:`bg-foreground/10`,a;t[0]===i?a=t[1]:(a=S(`rounded px-1 leading-none`,i),t[0]=i,t[1]=a);let o;return t[2]!==a||t[3]!==n?(o=(0,Z.jsx)(`span`,{className:a,children:n}),t[2]=a,t[3]=n,t[4]=o):o=t[4],o}function Oe(e){let t=(0,R.c)(35),{currentWhen:n,onChange:r,disabled:i}=e,a;t[0]===n?a=t[1]:(a=K(n),t[0]=n,t[1]=a);let o=a,s,c,l,u,d,f,p;if(t[2]!==n||t[3]!==i){let e=q(n);c=A,s=j,l=`button`,u=i;let r=n===void 0&&`italic opacity-70`;t[11]===r?d=t[12]:(d=S(`inline-flex h-5 items-center gap-1 rounded bg-muted/40 px-1.5 text-[10px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,r),t[11]=r,t[12]=d),f=`When: ${e}`,p=n===void 0?`always`:e.toLowerCase(),t[2]=n,t[3]=i,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p}else s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10];let m;t[13]!==l||t[14]!==u||t[15]!==d||t[16]!==f||t[17]!==p?(m=(0,Z.jsx)(`button`,{type:l,disabled:u,className:d,"aria-label":f,children:p}),t[13]=l,t[14]=u,t[15]=d,t[16]=f,t[17]=p,t[18]=m):m=t[18];let h;t[19]!==s||t[20]!==m?(h=(0,Z.jsx)(s,{render:m}),t[19]=s,t[20]=m,t[21]=h):h=t[21];let g;t[22]!==n||t[23]!==o?(g=!o&&n!==void 0?(0,Z.jsxs)(`div`,{className:`px-2 py-1.5 text-[10px] text-muted-foreground`,children:[`Current: `,(0,Z.jsx)(`code`,{className:`font-mono`,children:n})]}):null,t[22]=n,t[23]=o,t[24]=g):g=t[24];let _;t[25]!==n||t[26]!==r?(_=U.map(e=>(0,Z.jsxs)(M,{onClick:()=>r(e.value),className:S(`flex items-center justify-between text-[12px]`,e.value===n&&`font-semibold text-foreground`),children:[(0,Z.jsx)(`span`,{children:e.label}),e.value===void 0?(0,Z.jsx)(`span`,{className:`text-[10px] text-muted-foreground/60`,children:`no condition`}):(0,Z.jsx)(`code`,{className:`text-[10px] font-mono text-muted-foreground/60`,children:e.value})]},e.id)),t[25]=n,t[26]=r,t[27]=_):_=t[27];let v;t[28]!==_||t[29]!==g?(v=(0,Z.jsxs)(k,{side:`bottom`,align:`end`,className:`min-w-[220px]`,children:[g,_]}),t[28]=_,t[29]=g,t[30]=v):v=t[30];let y;return t[31]!==c||t[32]!==v||t[33]!==h?(y=(0,Z.jsxs)(c,{children:[h,v]}),t[31]=c,t[32]=v,t[33]=h,t[34]=y):y=t[34],y}function ke(){let e=(0,R.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`style`,{children:`@keyframes keybindings-pulse {
|
|
2
2
|
0%, 100% { box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15); }
|
|
3
3
|
50% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0.30); }
|
|
4
4
|
}
|
package/dist/client/assets/{McpServersSettings-UthT1T80.js → McpServersSettings-B7YqVvV4.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{_ as r,g as i}from"./src-Vf4LVnMX.js";import{Xn as a,hn as o,xn as s}from"./runtime-
|
|
1
|
+
import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./compiler-runtime-qmuS0Svy.js";import{_ as r,g as i}from"./src-Vf4LVnMX.js";import{Xn as a,hn as o,xn as s}from"./runtime-CXut_g4p.js";import{It as c,Z as l}from"./composerDraftStore-CdJJZe42.js";import{f as u}from"./useRenderElement-DchFnsR8.js";import{t as d}from"./chevron-down-B7C6FKzM.js";import{i as f,o as p}from"./toast-CcSCAm4B.js";import{t as m}from"./loader-zHASMrUy.js";import{t as h}from"./plus-B2h-VEqh.js";import{t as g}from"./refresh-cw-DopCMrtR.js";import{t as _}from"./save-Bh36JIv6.js";import{t as v}from"./server-JApJpgLa.js";import{t as y}from"./terminal-C_CyIsDD.js";import{t as ee}from"./trash-2-CM1zXPGb.js";import{t as b}from"./triangle-alert-RL_T3KLo.js";import{t as x}from"./wrench-D0IetWa1.js";import{t as te}from"./utils-BofFIn5Y.js";import{i as ne,n as re,t as ie}from"./tooltip-C8sAONBj.js";import{t as S}from"./switch-BTGo9Yip.js";import{t as C}from"./input-CHEwW3oH.js";import{t as w}from"./button-BAbJxRzt.js";import{t as T}from"./toastHelpers-CSQRKo4F.js";import{a as E,c as D,i as O,o as k,r as A,s as j,t as M}from"./dialog-DQsYchqu.js";import{t as N}from"./textarea-RFPODxWW.js";import{a as P,i as F,o as I,s as L,t as R}from"./select-BYbVr-yg.js";import{t as z}from"./badge-CXw6fWrB.js";import"./providerModels-BJcfB_9E.js";import{r as B}from"./providerDriverMeta-I0TSo-QI.js";var ae=u(`earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),oe=u(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),V=e(t(),1),H=n(),U=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function W(){return{name:``,transport:`stdio`,command:``,argsText:``,cwd:``,url:``,bearerTokenEnvVar:``,envText:``,envVarsText:``,httpHeadersText:``,envHttpHeadersText:``,enabled:!0,required:!1,startupTimeoutSec:``,toolTimeoutSec:``,enabledToolsText:``,disabledToolsText:``,oauthScopesText:``,secretFields:[],clearedSecretFields:[]}}function G(e){return e.join(`
|
|
2
2
|
`)}function K(e){return Object.entries(e).map(([e,t])=>`${e}=${t}`).join(`
|
|
3
3
|
`)}function q(e){let t=e.config;return{name:e.name,transport:t.transport===`http`?`http`:`stdio`,command:t.command??``,argsText:G(t.args),cwd:t.cwd??``,url:t.url??``,bearerTokenEnvVar:t.bearerTokenEnvVar??``,envText:K(t.env),envVarsText:G(t.envVars),httpHeadersText:K(t.httpHeaders),envHttpHeadersText:K(t.envHttpHeaders),enabled:t.enabled,required:t.required??!1,startupTimeoutSec:t.startupTimeoutSec?.toString()??``,toolTimeoutSec:t.toolTimeoutSec?.toString()??``,enabledToolsText:G(t.enabledTools),disabledToolsText:G(t.disabledTools),oauthScopesText:G(t.oauthScopes),secretFields:Object.entries(t.secretFields??{}).filter(([,e])=>e===`present`).map(([e])=>e).toSorted(),clearedSecretFields:[]}}function J(e){return e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e.length>0)}function se(e){let t={};for(let n of J(e)){let e=n.indexOf(`=`);if(e<=0)continue;let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();r.length>0&&(t[r]=i)}return t}function ce(e){let t=e.trim();if(!t)return;let n=Number(t);return Number.isFinite(n)&&n>0?n:NaN}function le(e){let t=e.name.trim();if(!U.test(t))return`Server name must start with a letter and use only letters, numbers, dashes, and underscores.`;if(e.transport===`stdio`&&e.command.trim().length===0)return`Stdio servers need a command.`;if(e.transport===`http`&&e.url.trim().length===0)return`HTTP servers need a URL.`;for(let[t,n]of[[`Startup timeout`,e.startupTimeoutSec],[`Tool timeout`,e.toolTimeoutSec]]){let e=ce(n);if(Number.isNaN(e))return`${t} must be a positive number.`}return null}function ue(e){let t=ce(e.startupTimeoutSec),n=ce(e.toolTimeoutSec);return{transport:e.transport,command:e.command.trim(),args:J(e.argsText),cwd:e.cwd.trim()||null,url:e.url.trim(),bearerTokenEnvVar:e.bearerTokenEnvVar.trim()||null,env:se(e.envText),envVars:J(e.envVarsText),httpHeaders:se(e.httpHeadersText),envHttpHeaders:se(e.envHttpHeadersText),enabled:e.enabled,required:e.required,...t===void 0||Number.isNaN(t)?{}:{startupTimeoutSec:t},...n===void 0||Number.isNaN(n)?{}:{toolTimeoutSec:n},enabledTools:J(e.enabledToolsText),disabledTools:J(e.disabledToolsText),oauthScopes:J(e.oauthScopesText)}}function de(e){return Object.fromEntries(e.secretFields.map(t=>[t,e.clearedSecretFields.includes(t)?{action:`clear`}:{action:`retain`}]))}function fe(e){let t=e.config;return t.transport===`http`?t.url||`HTTP`:t.transport===`stdio`?[t.command,...t.args].filter(Boolean).join(` `)||`stdio`:`Configured outside the known MCP schema`}var Y=c(),pe=[],me=[];function X(e){if(!e)throw Error(`MCP settings are unavailable before a backend is paired.`);return e}function Z(e,t){f.add(T({type:`error`,title:e,description:t instanceof Error?t.message:`An error occurred.`}))}function he(e){switch(e){case`user`:return`User config`;case`project`:return`Project`;case`system`:return`System`;case`managed`:return`Managed`;case`mixed`:return`Mixed`;case`unknown`:return`Unknown`}}function ge(e){return e.startupStatus===`failed`?`error`:e.startupStatus===`disabled`?`outline`:e.authStatus===`notLoggedIn`?`warning`:e.startupStatus===`ready`?`success`:`outline`}function _e(e){return e.startupStatus===`disabled`?`Disabled`:e.startupStatus===`failed`?`Failed`:e.authStatus===`notLoggedIn`?`Login needed`:e.startupStatus===`ready`?`Ready`:`Unknown`}function ve(e){return e.enabled?e.status===`managed`?`success`:e.status===`external`?`warning`:`outline`:`outline`}function ye(e){if(!e.enabled)return`Disabled`;switch(e.status){case`managed`:return`Managed`;case`external`:return`External config`;case`unsupported`:return`Not wired`}}function be(e){return e.displayName??B(e.driver)?.label??l(e.driver)}function xe(e){return e?e.providerDisplayName??B(e.driver)?.label??l(e.driver):`the provider`}function Q(e){let t=(0,H.c)(5),n;t[0]===e.label?n=t[1]:(n=(0,Y.jsx)(`span`,{children:e.label}),t[0]=e.label,t[1]=n);let r;return t[2]!==e.children||t[3]!==n?(r=(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium text-foreground/80`,children:[n,e.children]}),t[2]=e.children,t[3]=n,t[4]=r):r=t[4],r}function $(e){let t=(0,H.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Y.jsx)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground/70`,children:n}),t[0]=n,t[1]=r),r}function Se(e){let t=(0,H.c)(5),{value:n,onChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={value:`stdio`,label:`Stdio`,icon:y},t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=[i,{value:`http`,label:`HTTP`,icon:ae}],t[1]=a):a=t[1];let o;return t[2]!==r||t[3]!==n?(o=(0,Y.jsx)(`div`,{className:`grid grid-cols-2 rounded-lg border bg-muted/30 p-1`,children:a.map(e=>{let t=e.icon,i=n===e.value;return(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r(e.value),className:te(`flex h-8 items-center justify-center gap-2 rounded-md text-xs font-medium transition-colors`,i?`bg-background text-foreground shadow-xs`:`text-muted-foreground`),children:[(0,Y.jsx)(t,{className:`size-3.5`}),e.label]},e.value)})}),t[2]=r,t[3]=n,t[4]=o):o=t[4],o}function Ce({open:e,server:t,providerName:n,onOpenChange:r,onSubmit:i}){let[a,o]=(0,V.useState)(()=>W()),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(!1),d=t!==null;(0,V.useEffect)(()=>{e&&(o(t?q(t):W()),c(null))},[e,t]);let f=(e,t)=>{o(n=>({...n,[e]:t}))},p=async()=>{let e=le(a);if(e){c(e);return}u(!0);try{await i(a),r(!1)}catch(e){Z(`Failed to save MCP server`,e)}finally{u(!1)}};return(0,Y.jsx)(M,{open:e,onOpenChange:r,children:(0,Y.jsxs)(j,{className:`max-w-2xl`,bottomStickOnMobile:!1,children:[(0,Y.jsxs)(E,{children:[(0,Y.jsx)(D,{children:d?`Edit MCP server`:`Add MCP server`}),(0,Y.jsxs)(A,{children:[`Configuration is written through `,n,`'s native MCP management surface. Existing secret values are never loaded into this form and are retained unless you enter replacements with the same keys.`]})]}),(0,Y.jsxs)(k,{className:`space-y-5`,children:[(0,Y.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-[1fr_12rem]`,children:[(0,Y.jsx)(Q,{label:`Server name`,children:(0,Y.jsx)(C,{value:a.name,disabled:d,onChange:e=>f(`name`,e.target.value),placeholder:`github`,spellCheck:!1})}),(0,Y.jsx)(Q,{label:`Transport`,children:(0,Y.jsx)(Se,{value:a.transport,onChange:e=>f(`transport`,e)})})]}),a.transport===`stdio`?(0,Y.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Y.jsx)(Q,{label:`Command`,children:(0,Y.jsx)(C,{value:a.command,onChange:e=>f(`command`,e.target.value),placeholder:`npx`,spellCheck:!1})}),(0,Y.jsxs)(Q,{label:`Arguments`,children:[(0,Y.jsx)(N,{value:a.argsText,onChange:e=>f(`argsText`,e.target.value),placeholder:`-y
|
|
4
4
|
@modelcontextprotocol/server-filesystem
|