hmcp-web 0.2.4 → 0.2.5
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-ui/assets/{Activity-CQw7bFh4.js → Activity-CJfJp0fB.js} +1 -1
- package/dist-ui/assets/{Approvals-_rFRWRyy.js → Approvals-BhFnOJyz.js} +1 -1
- package/dist-ui/assets/{AttachApp-eNBD48eb.js → AttachApp-CuSl69fx.js} +1 -1
- package/dist-ui/assets/{Connections-_AV8r8_W.js → Connections-Cp8DIzBt.js} +1 -1
- package/dist-ui/assets/{PreApprovals-Bwrhm8hr.js → PreApprovals-DBqqV2f7.js} +1 -1
- package/dist-ui/assets/{Protection-CM1fEDmQ.js → Protection-DypDlImQ.js} +1 -1
- package/dist-ui/assets/{Safety-BbtS6-Sw.js → Safety-DIYb13J7.js} +1 -1
- package/dist-ui/assets/{Settings-BjarVZaa.js → Settings-DAI3wzcR.js} +1 -1
- package/dist-ui/assets/{StartPage-CUFNfiyY.js → StartPage-D3Q3ZPQL.js} +1 -1
- package/dist-ui/assets/{Suggestions-CfqM3_Ik.js → Suggestions-M3t7IPCO.js} +1 -1
- package/dist-ui/assets/{Tools-jM5XlNbn.js → Tools-B-M1k2c3.js} +1 -1
- package/dist-ui/assets/{connect-app-words-Dy16Vpfd.js → connect-app-words-B_5RQcK_.js} +1 -1
- package/dist-ui/assets/{index-DywhXnhV.js → index-2otwle61.js} +3 -3
- package/dist-ui/index.html +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,At as t,G as n,H as r,It as i,Mt as a,O as o,Ot as s,Pt as c,_ as l,_t as u,ht as d,kt as f,s as p,vt as m,x as h,xt as g,yt as _}from"./kit-BHB_ha4i.js";import{$n as v,Bn as y,Fn as b,Gn as x,Hn as S,In as C,Jn as ee,Kn as te,Ln as ne,Nn as w,Pn as re,Qn as ie,Rn as ae,Un as oe,Vn as se,Wn as ce,X as T,Xn as le,Yn as ue,Z as E,at as D,er as O,it as k,ot as de,qn as fe,st as A,tr as pe,zn as me}from"./index-DywhXnhV.js";import{o as he,r as j,s as ge,t as _e}from"./AttachApp-eNBD48eb.js";import{n as M,p as N,t as P}from"./connect-app-words-Dy16Vpfd.js";var F=i(),I=f(),L=[[`Runs freely`,`fill-allow`],[`Asks you first`,`fill-approve`],[`Blocked`,`fill-deny`]],R=[`Files`,`GitHub`,`Notion`,`and more…`];function z(){let e=(0,F.useId)(),t=`${e}-t`,n=`${e}-d`,r=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`title`,{id:t,children:`How hardened-mcp fits in`}),(0,I.jsx)(`desc`,{id:n,children:`Your AI app talks to hardened-mcp, the toolbox. The toolbox checks every action: it runs freely, asks you first, or is blocked. Then it passes allowed actions on to your servers, such as files, GitHub and Notion.`})]});return(0,I.jsxs)(`figure`,{className:`m-0 text-ink`,children:[(0,I.jsxs)(`svg`,{viewBox:`0 0 760 236`,role:`img`,"aria-labelledby":`${t} ${n}`,className:`hidden h-auto w-full sm:block`,children:[r,(0,I.jsx)(B,{id:e}),(0,I.jsx)(U,{x:8,y:58}),(0,I.jsx)(V,{x1:190,y1:118,x2:250,y2:118,id:e}),(0,I.jsx)(W,{x:258,y:20}),(0,I.jsx)(V,{x1:508,y1:118,x2:568,y2:118,id:e}),(0,I.jsx)(G,{x:576,y:34})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 320 560`,role:`img`,"aria-labelledby":`${t} ${n}`,className:`mx-auto block h-auto w-full max-w-[320px] sm:hidden`,children:[r,(0,I.jsx)(B,{id:e}),(0,I.jsx)(U,{x:68,y:4}),(0,I.jsx)(V,{x1:160,y1:126,x2:160,y2:160,id:e}),(0,I.jsx)(W,{x:35,y:168}),(0,I.jsx)(V,{x1:160,y1:364,x2:160,y2:398,id:e}),(0,I.jsx)(G,{x:68,y:406,compact:!0})]})]})}function B({id:e}){return(0,I.jsx)(`defs`,{children:(0,I.jsx)(`marker`,{id:`${e}-arrow`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto-start-reverse`,children:(0,I.jsx)(`path`,{d:`M1 1 9 5 1 9`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`})})})}function V({x1:e,y1:t,x2:n,y2:r,id:i}){return(0,I.jsx)(`line`,{x1:e,y1:t,x2:n,y2:r,className:`stroke-soft text-soft`,strokeWidth:`2`,strokeDasharray:`5 5`,markerEnd:`url(#${i}-arrow)`})}function H({x:e,y:t,children:n,size:r=15,weight:i=600,className:a=`fill-ink`,anchor:o=`middle`}){return(0,I.jsx)(`text`,{x:e,y:t,textAnchor:o,fontSize:r,fontWeight:i,className:a,style:{fontFamily:`var(--font-sans)`},children:n})}function U({x:e,y:t}){return(0,I.jsxs)(`g`,{transform:`translate(${e} ${t})`,children:[(0,I.jsx)(`rect`,{width:`184`,height:`120`,rx:`22`,className:`fill-surface stroke-line`,strokeWidth:`1.5`}),(0,I.jsxs)(`g`,{transform:`translate(76 18)`,className:`text-muted`,children:[(0,I.jsx)(`path`,{d:`M4 4h24a4 4 0 0 1 4 4v13a4 4 0 0 1-4 4H14l-7 6v-6H4a4 4 0 0 1-4-4V8a4 4 0 0 1 4-4z`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinejoin:`round`}),(0,I.jsx)(`circle`,{cx:`9`,cy:`14.5`,r:`1.8`,fill:`currentColor`}),(0,I.jsx)(`circle`,{cx:`16`,cy:`14.5`,r:`1.8`,fill:`currentColor`}),(0,I.jsx)(`circle`,{cx:`23`,cy:`14.5`,r:`1.8`,fill:`currentColor`})]}),(0,I.jsx)(H,{x:92,y:76,children:`Your AI app`}),(0,I.jsx)(H,{x:92,y:98,size:14,weight:500,className:`fill-soft`,children:`Claude, Cursor, VS Code…`})]})}function W({x:e,y:t}){return(0,I.jsxs)(`g`,{transform:`translate(${e} ${t})`,children:[(0,I.jsx)(`rect`,{width:`250`,height:`196`,rx:`26`,className:`fill-green-deep`}),(0,I.jsxs)(`g`,{transform:`translate(110 16)`,className:`text-white`,children:[(0,I.jsx)(`path`,{d:`M15 2 27 6.5v9.4c0 7-4.5 11.8-12 14.8C7.5 27.7 3 22.9 3 15.9V6.5z`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinejoin:`round`}),(0,I.jsx)(`path`,{d:`m9.5 16 4 4 7-8`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`})]}),(0,I.jsx)(H,{x:125,y:68,size:17,weight:700,className:`fill-white`,children:`hardened-mcp`}),(0,I.jsx)(H,{x:125,y:88,size:14,weight:500,className:`fill-on-hero-soft`,children:`the toolbox that checks every action`}),L.map(([e,t],n)=>(0,I.jsxs)(`g`,{transform:`translate(34 ${108+n*26})`,children:[(0,I.jsx)(`rect`,{width:`182`,height:`22`,rx:`11`,fill:`white`,fillOpacity:`0.12`}),(0,I.jsx)(`circle`,{cx:`14`,cy:`11`,r:`5`,className:t}),(0,I.jsx)(H,{x:28,y:15.5,size:14,weight:600,className:`fill-white`,anchor:`start`,children:e})]},e))]})}function G({x:e,y:t,compact:n}){return(0,I.jsxs)(`g`,{transform:`translate(${e} ${t})`,children:[(0,I.jsx)(`rect`,{width:`176`,height:n?150:168,rx:`22`,className:`fill-surface stroke-line`,strokeWidth:`1.5`}),(0,I.jsx)(H,{x:88,y:28,size:14.5,weight:700,className:`fill-soft`,children:`Your servers`}),R.map((e,t)=>(0,I.jsxs)(`g`,{transform:`translate(18 ${42+t*(n?26:30)})`,children:[(0,I.jsx)(`rect`,{width:`140`,height:`22`,rx:`7`,className:t===R.length-1?`fill-transparent`:`fill-sunken`}),t<R.length-1&&(0,I.jsx)(`circle`,{cx:`13`,cy:`11`,r:`3.5`,className:`fill-ok`}),(0,I.jsx)(H,{x:t<R.length-1?26:8,y:15.5,size:12.5,weight:500,className:`fill-muted`,anchor:`start`,children:e})]},e))]})}function K({text:e}){let t=e.split(/(`[^`]+`|\*\*[^*]+\*\*)/g).filter(Boolean);return(0,I.jsx)(I.Fragment,{children:t.map((e,t)=>e.startsWith("`")?(0,I.jsx)(`code`,{className:`mono rounded-md bg-sunken px-1.5 py-0.5 text-[12.5px] break-words text-ink`,children:e.slice(1,-1)},t):e.startsWith(`**`)?(0,I.jsx)(`strong`,{className:`font-semibold text-ink`,children:e.slice(2,-2)},t):(0,I.jsx)(`span`,{children:e},t))})}function q({children:e}){return(0,I.jsx)(`p`,{className:`max-w-2xl text-[15.5px] leading-relaxed text-muted`,children:e})}function J({icon:e,title:t,children:n}){return(0,I.jsxs)(`li`,{className:`flex gap-3`,children:[(0,I.jsx)(`span`,{className:`grid h-9 w-9 shrink-0 place-items-center rounded-full bg-ok-tint text-ok`,children:(0,I.jsx)(s,{name:e,size:17})}),(0,I.jsxs)(`span`,{className:`min-w-0 pt-0.5`,children:[(0,I.jsx)(`span`,{className:`block text-[15px] font-medium`,children:t}),(0,I.jsx)(`span`,{className:`mt-0.5 block text-[13.5px] leading-relaxed text-soft`,children:n})]})]})}function ve(){return(0,I.jsxs)(`div`,{className:`flex flex-col gap-7`,children:[(0,I.jsx)(q,{children:`hardened-mcp lets your AI app use tools, like your files, GitHub or Notion. It doesn't give the AI everything. You get a toolbox. Your AI app connects to it, and every action goes through it first. When protection is on, reading runs freely. Every change asks you first. Anything outside the folders and services you gave it is blocked. Everything is written down, so you can always see what your AI did.`}),(0,I.jsx)(`div`,{className:`rounded-[22px] bg-sunken/60 p-4 sm:p-6`,children:(0,I.jsx)(z,{})}),(0,I.jsxs)(`div`,{className:`grid gap-5 md:grid-cols-2`,children:[(0,I.jsxs)(`section`,{"aria-labelledby":`what-mcp`,className:`rounded-[18px] border border-line p-5`,children:[(0,I.jsxs)(`h2`,{id:`what-mcp`,className:`flex items-center gap-2 text-[16px] font-semibold`,children:[`What's an MCP server? `,(0,I.jsx)(l,{term:`mcp`})]}),(0,I.jsx)(`p`,{className:`mt-2 text-[14px] leading-relaxed text-muted`,children:`It's a small add-on that gives your AI app a set of tools: reading a folder, searching the web, opening an issue on GitHub. MCP is a shared standard, so any AI app can use any of them. In a minute you'll bring in the ones your AI app already has, or add your first one.`})]}),(0,I.jsxs)(`section`,{"aria-labelledby":`what-expect`,className:`rounded-[18px] border border-line p-5`,children:[(0,I.jsx)(`h2`,{id:`what-expect`,className:`text-[16px] font-semibold`,children:`What to expect`}),(0,I.jsxs)(`ul`,{className:`mt-3 flex flex-col gap-3`,children:[(0,I.jsx)(J,{icon:`clock`,title:`About 5 minutes`,children:`Seven short steps. You can skip any of them and come back later from Settings & help.`}),(0,I.jsx)(J,{icon:`lock`,title:`Nothing changes until you say so`,children:`Your AI apps keep working exactly as they do now until you choose to connect one.`}),(0,I.jsx)(J,{icon:`eye`,title:`It starts by watching`,children:`At first your toolbox lets everything run and writes down what it would have asked you about or blocked, so nothing you rely on breaks. In step 6 you choose whether to turn protection on straight away.`})]})]})]})]})}function Y(e,t){let n=t.find(t=>t.id===e),r=e===`node`?t.find(e=>e.id===`npx`):e===`uv`?t.find(e=>e.id===`uvx`):void 0;return!n?.found||r&&!r.found?{status:{tone:`neutral`,label:`Not installed`,icon:`minus`},check:n,state:`missing`}:n?.running===!1?{status:{tone:`warn`,label:`Installed, not running`,icon:`pause`},check:n,state:`stopped`}:{status:{tone:`ok`,label:`Ready`,icon:`check`},check:n,state:`ready`}}function ye({entries:e}){let i=p(()=>t.doctor(),[]),[a,o]=(0,F.useState)(!1),s=i.data,c=A(s?.platform),u=fe(e),f=()=>{o(!0),i.reload(),setTimeout(()=>o(!1),700)},m=s?de.map(e=>({rt:e,...Y(e,s.checks)})):[],h=m.filter(e=>e.state!==`ready`),g=m.some(e=>e.rt===`node`&&e.state===`ready`);return(0,I.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,I.jsxs)(q,{children:[`Most servers need a free helper program to run, such as Node.js. This looks for them on this computer. It only looks; it never installs or changes anything. `,(0,I.jsx)(l,{term:`machineCheck`})]}),i.error&&!s?(0,I.jsx)(r,{tone:`warn`,title:`The check couldn't run`,actions:(0,I.jsx)(d,{size:`sm`,icon:`refresh`,onClick:f,loading:a,children:`Check again`}),children:`You can skip this step. If a server needs something that's missing, it will tell you when you test it.`}):s?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(r,{tone:h.length===0?`ok`:g?`info`:`warn`,role:`status`,title:h.length===0?`Everything is ready`:g?`You're ready for your first server`:`Some servers need something installed first`,actions:(0,I.jsx)(d,{size:`sm`,icon:`refresh`,onClick:f,loading:a||i.loading,children:`Check again`}),children:h.length===0?`This computer has everything servers need.`:g?`Some servers need other helpers, listed below. You don't need them unless you add one of those servers.`:`That's fine. You can carry on and only install something when a server you want needs it.`}),(0,I.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":`What this computer has`,children:m.map(e=>(0,I.jsx)(X,{rt:e.rt,status:e.status,check:e.check,state:e.state,os:c,needs:u[e.rt]},e.rt))})]}):(0,I.jsx)(`div`,{className:`flex flex-col gap-3`,"aria-busy":`true`,"aria-label":`Checking your computer`,children:(0,I.jsx)(n,{height:64,lines:3})})]})}function X({rt:t,status:n,check:r,state:i,os:a,needs:s}){let c=k[t],[l,f]=(0,F.useState)(!1),[p,m]=(0,F.useState)(a),h=`install-${t}`;return(0,I.jsxs)(`li`,{className:`rounded-[18px] border border-line p-4`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,I.jsxs)(`div`,{className:`min-w-0 flex-1 basis-56`,children:[(0,I.jsx)(`p`,{className:`flex flex-wrap items-center gap-2 text-[15px] font-semibold`,children:c.name}),(0,I.jsx)(`p`,{className:`mt-0.5 text-[13.5px] text-soft`,children:c.why}),i!==`ready`&&s.length>0&&(0,I.jsxs)(`p`,{className:`mt-1.5 text-[13px] text-muted`,children:[(0,I.jsx)(`span`,{className:`font-medium`,children:`Needed by:`}),` `,s.join(`, `)]}),i===`ready`&&(r?.path||r?.version)&&(0,I.jsxs)(`details`,{className:`mt-1 text-[12px] text-soft`,children:[(0,I.jsx)(`summary`,{className:`cursor-pointer select-none`,children:`Details`}),r?.version&&(0,I.jsxs)(`span`,{className:`mono block`,children:[`Version `,r.version]}),r?.path&&(0,I.jsx)(`code`,{className:`mono block break-all`,children:r.path})]})]}),(0,I.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,I.jsx)(e,{tone:n.tone,icon:n.icon,children:n.label}),i!==`ready`&&(0,I.jsx)(d,{size:`sm`,variant:`ghost`,iconRight:`chevron`,"aria-expanded":l,"aria-controls":h,onClick:()=>f(!l),children:i===`stopped`?`How to start it`:`How to install it`})]})]}),l&&i!==`ready`&&(0,I.jsx)(`div`,{id:h,className:`mt-4 border-t border-faint pt-4`,children:i===`stopped`&&c.start?(0,I.jsx)(`p`,{className:`text-[14px] leading-relaxed text-muted`,children:(0,I.jsx)(K,{text:c.start[p]})}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(o,{size:`sm`,label:`Install steps for ${c.name}: choose your computer`,value:p,onChange:m,options:[`darwin`,`win32`,`linux`].map(e=>({value:e,label:D[e]}))}),(0,I.jsx)(`ol`,{className:`mt-4 flex flex-col gap-3`,children:c.steps[p].map((e,t)=>(0,I.jsxs)(`li`,{className:`flex gap-3`,children:[(0,I.jsx)(`span`,{className:`tnum grid h-6 w-6 shrink-0 place-items-center rounded-full bg-sunken text-[12px] font-bold text-muted`,children:t+1}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1 text-[14px] leading-relaxed text-muted`,children:[(0,I.jsx)(K,{text:e.text}),e.copy&&(0,I.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(`code`,{className:`mono min-w-0 rounded-lg bg-surface px-2.5 py-1.5 text-[12.5px] break-all text-ink`,children:e.copy}),(0,I.jsx)(E,{text:e.copy,label:`Copy`})]}),e.link&&(0,I.jsx)(`div`,{className:`mt-2`,children:(0,I.jsx)(u,{href:e.link.url,external:!0,size:`sm`,iconRight:`external`,children:e.link.label})})]})]},t))})]})})]})}function be({gatewayId:e,existing:t,added:n,entries:i,onAdded:a,onClosed:o}){let[s,c]=(0,F.useState)(n.length===0&&t.length===0),l=n.at(-1);return(0,I.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,I.jsxs)(q,{children:[`Pick a server to give your AI app its first tools. Each one comes with step-by-step instructions, and you can test it before anything is saved. If you're not sure, `,(0,I.jsx)(`strong`,{className:`font-semibold text-ink`,children:`Files on this computer`}),` `,`is a good first choice: it lets the AI read and edit files in one folder you choose, and nothing outside it.`]}),l&&(0,I.jsx)(r,{tone:`ok`,role:`status`,title:l.displayName?`${l.displayName} is in your toolbox`:`Added to your toolbox`,children:l.summary.length>0?(0,I.jsx)(`ul`,{className:`mt-1 list-disc pl-5`,children:l.summary.map(e=>(0,I.jsx)(`li`,{children:e},e))}):`It's saved in your toolbox.`}),!l&&t.length>0&&(0,I.jsxs)(r,{tone:`info`,title:`You already have servers`,children:[`Your toolbox has `,t.map(e=>oe(i,e)?.name??e).join(`, `),`. You can add another or carry on.`]}),s?(0,I.jsx)(he,{gatewayId:e,compact:!0,onDone:e=>{a(e),c(!1)},onCancel:n.length>0||t.length>0?()=>{c(!1),o?.()}:void 0}):(0,I.jsx)(`div`,{children:(0,I.jsx)(d,{icon:`plus`,onClick:()=>c(!0),children:`Add another server`})})]})}var Z=(e,t)=>`/tools?server=${encodeURIComponent(e)}&app=${encodeURIComponent(t)}`;function xe({gatewayId:e,onAttached:t,onConnected:n,onUndone:r,onNeedsServer:i,onAddServer:a,onProtect:o}){return(0,I.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,I.jsxs)(q,{children:[N,` `,(0,I.jsx)(l,{term:`toolbox`})]}),(0,I.jsxs)(`div`,{className:`rounded-[18px] bg-sunken/60 p-4 sm:p-5`,children:[(0,I.jsxs)(`p`,{className:`flex items-center gap-2 text-[15px] font-semibold`,children:[(0,I.jsx)(s,{name:`refresh`,size:17,className:`text-ok`}),`Restart your app once`]}),(0,I.jsx)(`p`,{className:`mt-1.5 text-[13.5px] leading-relaxed text-muted`,children:`Your AI app only looks for new tools when it starts. After connecting, quit it completely (not just close the window) and open it again. You only do this once: servers you add or change later appear on their own.`})]}),(0,I.jsx)(j,{newTab:!0,keep:!0,toolsHref:Z,protect:()=>({onClick:o}),addServer:{onClick:a},onConnected:n,onNeedsServer:i,onUndone:r}),(0,I.jsxs)(`details`,{className:`rounded-[18px] border border-line p-4`,children:[(0,I.jsx)(`summary`,{className:`cursor-pointer text-[14px] font-semibold select-none`,children:M}),(0,I.jsx)(`p`,{className:`mt-2 text-[13.5px] text-muted`,children:P}),(0,I.jsx)(`div`,{className:`mt-3`,children:e?(0,I.jsx)(_e,{gatewayId:e,compact:!0,onDone:t}):(0,I.jsx)(`p`,{className:`text-[13.5px] text-muted`,children:`These need a toolbox. Connect an app above, or add a server first.`})})]})]})}function Se({entries:e,servers:t,appLabel:n}){let{prompt:r,entry:i}=O(e,t),a=n??`your AI app`;return(0,I.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,I.jsxs)(q,{children:[`Open `,a,` and ask it something that uses your new tools`,i?` from ${i.name}`:``,`. Here's a good first one:`]}),(0,I.jsxs)(`figure`,{className:`m-0 rounded-[20px] border-[1.5px] border-primary/40 bg-ok-tint p-5`,children:[(0,I.jsxs)(`blockquote`,{className:`text-[17px] leading-relaxed font-medium text-ink`,children:[`“`,r,`”`]}),(0,I.jsx)(`figcaption`,{className:`mt-4`,children:(0,I.jsx)(E,{text:r,label:`Copy this`})})]}),(0,I.jsxs)(`section`,{"aria-labelledby":`what-see`,children:[(0,I.jsx)(`h2`,{id:`what-see`,className:`text-[16px] font-semibold`,children:`What you'll see`}),(0,I.jsxs)(`ol`,{className:`mt-3 flex flex-col gap-3`,children:[(0,I.jsx)(J,{icon:`check`,title:`Looking runs straight away`,children:`When the AI only reads something, it just happens. Every action is written down under Activity in this console.`}),(0,I.jsx)(J,{icon:`eye`,title:`At first, changes run too`,children:`A new toolbox starts by watching: everything runs, and Activity notes what would have asked you first or been blocked. In the next step you choose whether it should start protecting you.`}),(0,I.jsxs)(J,{icon:`clock`,title:`Once protection is on, every change asks you first`,children:[`If the AI wants to change something, it stops and tells you it's waiting. The request appears under`,` `,(0,I.jsx)(`strong`,{className:`font-semibold text-ink`,children:`Waiting for you`}),` in this console. Approve it or say no there. If you approve, the AI can try again and it goes ahead. Anything outside the folders and services you gave it is blocked.`]}),(0,I.jsxs)(J,{icon:`warning`,title:`If nothing happens`,children:[`Check that you quit `,a,` completely and opened it again. If a tool still doesn't show up, open Connections in this console: each server says whether it's working, and if not, why and how to fix it.`]})]}),(0,I.jsx)(`div`,{className:`mt-5`,children:(0,I.jsx)(u,{href:`/approvals`,external:!0,icon:`clock`,iconRight:`external`,children:`Open Waiting for you`})})]})]})}var Q=`Reading runs straight away. Every change asks you first, here in this console. Anything outside the folders and services you gave it is blocked.`;function Ce({gatewayId:t,onAddServer:i,applyRef:a}){let[o,s]=(0,F.useState)(`protect`),[l,u]=(0,F.useState)(!1),[f,m]=(0,F.useState)(null),[h,g]=(0,F.useState)(null),_=p(()=>t?c.protection(t):Promise.resolve(null),[t]),v=(0,F.useRef)(null),y=(0,F.useRef)(!1),b=_.data?.enforcement===`enforce`||h===`protect`,x=_.data&&!_.data.policyWrite.ok?_.data.policyWrite.why:null,S=async()=>{if(m(null),!t||b||h===`watch`)return!0;if(o===`watch`)return y.current=!0,g(`watch`),!0;if(!_.data)return!1;if(x)return m(x),!1;u(!0);try{return await c.setPolicySetting(t,`enforcement`,`enforce`,_.data.policyWrite.digest),y.current=!0,g(`protect`),_.reload(),!0}catch(e){return m(e.message||`Protection couldn't be turned on.`),!1}finally{u(!1)}};return a&&(a.current=S),(0,F.useEffect)(()=>()=>{a&&(a.current=null)},[a]),(0,F.useEffect)(()=>{y.current&&v.current?.focus()},[b,h]),t?_.loading&&!_.data?(0,I.jsx)(n,{height:180}):b?(0,I.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,I.jsx)(`div`,{ref:v,tabIndex:-1,className:`outline-none`,children:(0,I.jsxs)(r,{tone:`ok`,title:`Your toolbox is protecting you`,role:`status`,children:[Q,` Requests appear under `,(0,I.jsx)(`strong`,{className:`font-semibold`,children:`Waiting for you`}),`.`]})}),(0,I.jsxs)(`ul`,{className:`flex flex-col gap-3`,children:[(0,I.jsx)(J,{icon:`clock`,title:`When your AI asks for something`,children:`It stops and tells you it's waiting. Open this console, look at what it wants to do, and approve it or say no.`}),(0,I.jsxs)(J,{icon:`sliders`,title:`Too many questions?`,children:[`Under `,(0,I.jsx)(`strong`,{className:`font-semibold text-ink`,children:`Protection settings`}),` you can let a tool you trust run freely, or approve one for a while.`]})]})]}):h===`watch`?(0,I.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,I.jsx)(`div`,{ref:v,tabIndex:-1,className:`outline-none`,children:(0,I.jsx)(r,{tone:`warn`,title:`Your toolbox is only watching for now`,role:`status`,children:`Everything your AI does runs and is written down under Activity. Nothing asks you first and nothing is blocked, so you're not protected yet.`})}),(0,I.jsxs)(q,{children:[`When you're ready, turn protection on under `,(0,I.jsx)(`strong`,{className:`font-semibold text-ink`,children:`Protection settings`}),` `,`(one switch at the top), or come back to this guide from Settings & help.`]}),(0,I.jsx)(`div`,{children:(0,I.jsx)(d,{variant:`ghost`,onClick:()=>g(null),children:`Choose again`})})]}):(0,I.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,I.jsx)(q,{children:`Right now your toolbox only watches: everything your AI does runs, and is written down. Choose whether it should start protecting you now.`}),(0,I.jsx)(T,{label:`How careful should your toolbox be?`,value:o,onChange:s,options:[{value:`protect`,title:`Protect me now`,badge:(0,I.jsx)(e,{tone:`ok`,children:`Recommended`}),body:Q},{value:`watch`,title:`Watch for a few days first`,body:`Everything runs and is written down, and nothing asks you first. You can see what would have asked you, then turn protection on later. Until then, you're not protected.`}]}),x&&(0,I.jsx)(r,{tone:`warn`,title:`This toolbox's protection can't be changed from the console`,children:x}),f&&(0,I.jsx)(r,{tone:`danger`,role:`alert`,title:`Protection wasn't turned on`,children:f}),(0,I.jsx)(`div`,{children:(0,I.jsx)(d,{variant:`primary`,icon:o===`protect`?`shield-check`:`eye`,loading:l,disabled:!!x&&o===`protect`,onClick:()=>void S(),children:o===`protect`?`Turn on protection`:`Keep watching for now`})})]}):(0,I.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,I.jsx)(q,{children:`There's nothing to protect yet. Add a server first, then come back here.`}),(0,I.jsx)(`div`,{children:(0,I.jsx)(d,{icon:`plus`,onClick:i,children:`Add a server`})})]})}var $=[{href:`/approvals`,icon:`clock`,title:`Waiting for you`,body:`Requests that ask you first. Approve or say no.`},{href:`/tools`,icon:`tool`,title:`Tools`,body:`Every tool your AI can use, and what each one is allowed to do.`},{href:`/connections?add=server`,icon:`plus`,title:`Add more servers`,body:`GitHub, Notion, the web and more, with a guide for each.`},{href:`/protection`,icon:`sliders`,title:`Protection settings`,body:`Choose what runs freely, what asks you first, and what's blocked.`}];function we({gatewayId:e,onLeave:t}){let n=p(()=>e?c.protection(e):Promise.resolve(null),[e]),i=!!n.data&&n.data.enforcement!==`enforce`;return(0,I.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,I.jsx)(q,{children:`Your toolbox is set up. Here's where to go next.`}),i&&(0,I.jsxs)(r,{tone:`warn`,title:`Protection: off (only watching)`,children:[`Everything your AI does runs and is written down, and nothing asks you first. Turn protection on under`,` `,(0,I.jsx)(`strong`,{className:`font-semibold`,children:`Protection settings`}),` when you're ready.`]}),(0,I.jsx)(`ul`,{className:`grid gap-3 sm:grid-cols-2`,children:$.map(e=>(0,I.jsx)(`li`,{children:(0,I.jsxs)(`a`,{href:e.href,onClick:n=>{n.button!==0||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey||(n.preventDefault(),t(e.href))},className:_(`card card-link flex h-full gap-3.5 p-5`),children:[(0,I.jsx)(`span`,{className:`grid h-10 w-10 shrink-0 place-items-center rounded-full bg-ok-tint text-ok`,children:(0,I.jsx)(s,{name:e.icon,size:19})}),(0,I.jsxs)(`span`,{className:`min-w-0`,children:[(0,I.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[15.5px] font-semibold`,children:[e.title,(0,I.jsx)(s,{name:`arrow-right`,size:15,className:`text-soft`})]}),(0,I.jsx)(`span`,{className:`mt-0.5 block text-[13.5px] text-soft`,children:e.body})]})]})},e.href))}),(0,I.jsx)(r,{tone:`info`,title:`When you need to approve something, open the console`,children:`Approving requests and signing in to services happen here. Your servers keep working without the console open; anything that asks you first waits until you open it again.`})]})}function Te(){let[e,n]=(0,F.useState)(null),[r,i]=(0,F.useState)(`welcome`),[o,l]=(0,F.useState)(!1),[u,f]=(0,F.useState)(null),[p,oe]=(0,F.useState)([]),[T,E]=(0,F.useState)([]),[D,O]=(0,F.useState)(null),[k,de]=(0,F.useState)([]),[fe,A]=(0,F.useState)(!1),he=(0,F.useRef)(null),j=(0,F.useRef)(null),[_e,M]=(0,F.useState)(!1),N=(0,F.useRef)(!1),[P,L]=(0,F.useState)(w),[R,z]=(0,F.useState)(null),B=(0,F.useRef)(P);B.current=P;let V=(0,F.useRef)(null),[H,U]=(0,F.useState)(0),W=(0,F.useRef)(Promise.resolve()),G=(0,F.useRef)(re),K=(0,F.useCallback)((e,t={})=>c.servers().then(n=>{let r=n.filter(e=>e.ok),i=r.find(t=>t.id===e)??r.find(e=>e.id===`main`)??r[0],a=i?.upstreams??[];return t.isLive&&!t.isLive()||!i&&!t.clear||(f(i?.id??null),oe(a)),a}).catch(()=>null),[]);(0,F.useEffect)(()=>{let e=!0;return t.settings().then(ue,()=>(l(!0),re)).then(t=>{e&&(G.current=t,n(t),i(ie(t.onboarding)))}),K(null,{isLive:()=>e}),t.catalog().then(t=>e&&de(t.entries)).catch(()=>void 0),()=>{e=!1}},[K]);let q=(0,F.useCallback)(e=>{let r={...G.current,onboarding:e};G.current=r,n(r);let i=()=>t.saveSettings(r).then(()=>l(!1),()=>l(!0));return W.current=W.current.then(i,i),W.current},[]),J=()=>{let e=B.current;if(e.pending){let t=e.pending;E(e=>v({added:e,gatewayId:null},t).added),f(t.gatewayId)}e.state!==`idle`&&ge(),L(w)},Y=e=>{ce(r,P)?z(()=>e):e()},X=(e,t)=>{r===`server`&&e!==`server`&&(J(),A(!1)),N.current=!0,i(e),q(te(G.current.onboarding,e,t))},Z=async(e=`/`)=>{r===`server`&&J(),await q(S(G.current.onboarding)),g(e)};(0,F.useEffect)(()=>{if(r===`server`)return a(e=>L(t=>ae(t,e)))},[r]),(0,F.useEffect)(()=>{H&&V.current?.querySelector(`button`)?.focus()},[H]),(0,F.useEffect)(()=>{if(!N.current)return;he.current?.focus();let e=matchMedia(`(prefers-reduced-motion: reduce)`).matches;window.scrollTo({top:0,behavior:e?`auto`:`smooth`})},[r]),(0,F.useEffect)(()=>{let e=document.title;return document.title=`Step ${b.indexOf(r)+1} of ${b.length}: ${C[r]} – hardened-mcp`,()=>{document.title=e}},[r]);let Q=b.indexOf(r),$=e?.onboarding.done??[],Te=[...p,...pe(T,P.pending).map(e=>e.upstreamName)],De=ce(r,P);return(0,I.jsxs)(`div`,{className:`min-h-dvh bg-canvas text-ink`,children:[(0,I.jsx)(`header`,{className:`sticky top-0 z-20 border-b border-faint bg-canvas/95`,children:(0,I.jsxs)(`div`,{className:`mx-auto flex max-w-6xl items-center gap-3 px-4 py-3 sm:px-6`,children:[(0,I.jsx)(`span`,{className:`grid h-9 w-9 shrink-0 place-items-center rounded-xl bg-[#2a2623]`,children:(0,I.jsx)(`img`,{src:`/brand/mark.svg`,alt:``,width:24,height:24})}),(0,I.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`span`,{className:`block truncate text-[15px] font-semibold`,children:`Getting started`}),(0,I.jsx)(`span`,{className:`block text-[12.5px] text-soft`,children:`hardened-mcp`})]}),(0,I.jsx)(d,{variant:`ghost`,size:`sm`,iconRight:`arrow-right`,onClick:()=>Y(()=>void Z()),children:`Go to the console`})]})}),e?(0,I.jsxs)(`div`,{className:`mx-auto grid max-w-6xl gap-6 px-4 py-6 sm:px-6 lg:grid-cols-[240px_minmax(0,1fr)] lg:gap-10 lg:py-10`,children:[(0,I.jsxs)(`nav`,{"aria-label":`Guide steps`,className:`lg:sticky lg:top-24 lg:self-start`,children:[(0,I.jsxs)(`div`,{className:`lg:hidden`,children:[(0,I.jsxs)(`p`,{className:`text-[13px] font-semibold text-soft`,children:[`Step `,Q+1,` of `,b.length]}),(0,I.jsx)(`div`,{className:`mt-2 h-1.5 overflow-hidden rounded-full bg-line`,role:`progressbar`,"aria-label":`Progress through the guide`,"aria-valuemin":1,"aria-valuemax":b.length,"aria-valuenow":Q+1,children:(0,I.jsx)(`div`,{className:`h-full rounded-full bg-primary`,style:{width:`${(Q+1)/b.length*100}%`}})})]}),(0,I.jsx)(`ol`,{className:`hidden flex-col gap-1 lg:flex`,children:b.map((e,t)=>{let n=e===r,i=$.includes(e);return(0,I.jsx)(`li`,{children:(0,I.jsxs)(`button`,{type:`button`,onClick:()=>e===r?void 0:Y(()=>X(e)),"aria-current":n?`step`:void 0,className:_(`flex w-full items-center gap-3 rounded-2xl px-3 py-2.5 text-left text-[14px] transition-colors`,n?`bg-surface font-semibold shadow-[var(--shadow-sm)]`:`text-muted hover:bg-faint`),children:[(0,I.jsx)(`span`,{className:_(`tnum grid h-7 w-7 shrink-0 place-items-center rounded-full text-[12.5px] font-bold`,i?`bg-primary text-white`:n?`border-2 border-[var(--primary)] text-ink`:`border-[1.5px] border-line text-soft`),children:i?(0,I.jsx)(s,{name:`check`,size:14,strokeWidth:2.6}):t+1}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:C[e]}),i&&(0,I.jsx)(`span`,{className:`sr-only`,children:`(done)`})]})},e)})})]}),(0,I.jsxs)(`main`,{className:`min-w-0`,children:[(0,I.jsxs)(`article`,{className:`card p-5 sm:p-8`,"aria-labelledby":`start-step-h`,children:[(0,I.jsxs)(`p`,{className:`eyebrow text-soft`,children:[`Step `,Q+1,` · `,C[r]]}),(0,I.jsx)(`h1`,{id:`start-step-h`,ref:he,tabIndex:-1,className:`display mt-2 text-[28px] outline-none sm:text-[34px]`,children:ne[r]}),(0,I.jsxs)(`div`,{className:`mt-5`,children:[r===`welcome`&&(0,I.jsx)(ve,{}),r===`computer`&&(0,I.jsx)(ye,{entries:k}),r===`server`&&(0,I.jsx)(be,{gatewayId:u,existing:p,added:T,entries:k,onAdded:e=>{f(e.gatewayId),E(t=>pe(t,e)),L(w),U(e=>e+1)},onClosed:()=>L(w)}),r===`app`&&(0,I.jsx)(xe,{gatewayId:u,onAttached:e=>{O(e),U(e=>e+1)},onConnected:(e,t)=>{O({configPath:e.configPath,entryName:``,backupPath:e.backupPath,alreadyConnected:e.alreadyConnected,restartHint:e.restartHint,appLabel:t.label,scope:t.scope}),f(e.toolbox.id),A(!1),K(e.toolbox.id),y(e)&&q(x(G.current.onboarding,`server`)),U(e=>e+1)},onUndone:()=>{O(null),K(u,{clear:!0}).then(e=>{e&&q(me(G.current.onboarding,e.length))})},onNeedsServer:()=>A(!0),onAddServer:()=>{A(!0),X(`server`)},onProtect:()=>X(`protect`)}),r===`try`&&(0,I.jsx)(Se,{entries:k,servers:Te,appLabel:D?.appLabel??null}),r===`protect`&&(0,I.jsx)(Ce,{gatewayId:u,onAddServer:()=>X(`server`),applyRef:j}),r===`done`&&(0,I.jsx)(we,{gatewayId:u,onLeave:e=>void Z(e)})]}),(0,I.jsxs)(`footer`,{className:_(`mt-8 flex-wrap items-center gap-2 border-t border-faint pt-5`,De?`hidden`:`flex`),children:[Q>0&&(0,I.jsx)(d,{variant:`ghost`,icon:`arrow-left`,onClick:()=>X(le(r)),children:`Back`}),(0,I.jsx)(`span`,{className:`flex-1`}),r!==`done`&&(0,I.jsx)(d,{variant:`ghost`,onClick:()=>Y(()=>X(ee(r,$,!1))),children:`Skip for now`}),(0,I.jsx)(Ee,{buttonRef:V,step:r,ready:se(r,Te.length,!!D,P),busy:_e,onNext:async()=>{r===`protect`&&j.current&&(M(!0),!await j.current().finally(()=>M(!1)))||X(ee(r,$,fe),r)},onFinish:()=>void Z()})]})]}),(0,I.jsx)(h,{open:!!R,onClose:()=>z(null),title:`Leave without saving this server?`,description:`You're in the middle of setting up a server. If you leave now, it isn't added, and you'd start it again next time.`,footer:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(d,{variant:`ghost`,onClick:()=>{let e=R;z(null),e?.()},children:`Leave without saving`}),(0,I.jsx)(d,{variant:`primary`,onClick:()=>z(null),children:`Keep setting it up`})]})}),o&&(0,I.jsx)(`p`,{className:`mt-3 text-center text-[12.5px] text-soft`,role:`status`,children:`Your progress couldn't be saved, so the guide may start over next time. Everything you add is still saved.`})]})]}):(0,I.jsx)(`main`,{className:`flex min-h-[60dvh] items-center justify-center`,children:(0,I.jsxs)(`p`,{role:`status`,className:`flex items-center gap-3 text-soft`,children:[(0,I.jsx)(m,{}),` Getting things ready…`]})})]})}function Ee({buttonRef:e,step:t,ready:n,busy:r,onNext:i,onFinish:a}){if(t===`done`)return(0,I.jsx)(`span`,{ref:e,className:`contents`,children:(0,I.jsx)(d,{variant:`primary`,iconRight:`arrow-right`,onClick:a,children:`Go to the console`})});let o=t===`welcome`?`Let's start`:t===`try`?`I've tried it`:`Continue`,s=n?null:t===`server`?`Add a server first, or skip for now.`:`Connect an app first, or skip for now.`;return(0,I.jsxs)(I.Fragment,{children:[s&&(0,I.jsx)(`p`,{id:`start-continue-why`,className:`order-last basis-full text-right text-[13px] text-soft`,children:s}),(0,I.jsx)(`span`,{ref:e,className:`contents`,children:(0,I.jsx)(d,{variant:`primary`,iconRight:`arrow-right`,onClick:i,disabled:!n,loading:r,"aria-describedby":s?`start-continue-why`:void 0,children:o})})]})}export{Te as StartPage};
|
|
1
|
+
import{$ as e,At as t,G as n,H as r,It as i,Mt as a,O as o,Ot as s,Pt as c,_ as l,_t as u,ht as d,kt as f,s as p,vt as m,x as h,xt as g,yt as _}from"./kit-BHB_ha4i.js";import{$n as v,Bn as y,Fn as b,Gn as x,Hn as S,In as C,Jn as ee,Kn as te,Ln as ne,Nn as w,Pn as re,Qn as ie,Rn as ae,Un as oe,Vn as se,Wn as ce,X as T,Xn as le,Yn as ue,Z as E,at as D,er as O,it as k,ot as de,qn as fe,st as A,tr as pe,zn as me}from"./index-2otwle61.js";import{o as he,r as j,s as ge,t as _e}from"./AttachApp-CuSl69fx.js";import{n as M,p as N,t as P}from"./connect-app-words-B_5RQcK_.js";var F=i(),I=f(),L=[[`Runs freely`,`fill-allow`],[`Asks you first`,`fill-approve`],[`Blocked`,`fill-deny`]],R=[`Files`,`GitHub`,`Notion`,`and more…`];function z(){let e=(0,F.useId)(),t=`${e}-t`,n=`${e}-d`,r=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`title`,{id:t,children:`How hardened-mcp fits in`}),(0,I.jsx)(`desc`,{id:n,children:`Your AI app talks to hardened-mcp, the toolbox. The toolbox checks every action: it runs freely, asks you first, or is blocked. Then it passes allowed actions on to your servers, such as files, GitHub and Notion.`})]});return(0,I.jsxs)(`figure`,{className:`m-0 text-ink`,children:[(0,I.jsxs)(`svg`,{viewBox:`0 0 760 236`,role:`img`,"aria-labelledby":`${t} ${n}`,className:`hidden h-auto w-full sm:block`,children:[r,(0,I.jsx)(B,{id:e}),(0,I.jsx)(U,{x:8,y:58}),(0,I.jsx)(V,{x1:190,y1:118,x2:250,y2:118,id:e}),(0,I.jsx)(W,{x:258,y:20}),(0,I.jsx)(V,{x1:508,y1:118,x2:568,y2:118,id:e}),(0,I.jsx)(G,{x:576,y:34})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 320 560`,role:`img`,"aria-labelledby":`${t} ${n}`,className:`mx-auto block h-auto w-full max-w-[320px] sm:hidden`,children:[r,(0,I.jsx)(B,{id:e}),(0,I.jsx)(U,{x:68,y:4}),(0,I.jsx)(V,{x1:160,y1:126,x2:160,y2:160,id:e}),(0,I.jsx)(W,{x:35,y:168}),(0,I.jsx)(V,{x1:160,y1:364,x2:160,y2:398,id:e}),(0,I.jsx)(G,{x:68,y:406,compact:!0})]})]})}function B({id:e}){return(0,I.jsx)(`defs`,{children:(0,I.jsx)(`marker`,{id:`${e}-arrow`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto-start-reverse`,children:(0,I.jsx)(`path`,{d:`M1 1 9 5 1 9`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`})})})}function V({x1:e,y1:t,x2:n,y2:r,id:i}){return(0,I.jsx)(`line`,{x1:e,y1:t,x2:n,y2:r,className:`stroke-soft text-soft`,strokeWidth:`2`,strokeDasharray:`5 5`,markerEnd:`url(#${i}-arrow)`})}function H({x:e,y:t,children:n,size:r=15,weight:i=600,className:a=`fill-ink`,anchor:o=`middle`}){return(0,I.jsx)(`text`,{x:e,y:t,textAnchor:o,fontSize:r,fontWeight:i,className:a,style:{fontFamily:`var(--font-sans)`},children:n})}function U({x:e,y:t}){return(0,I.jsxs)(`g`,{transform:`translate(${e} ${t})`,children:[(0,I.jsx)(`rect`,{width:`184`,height:`120`,rx:`22`,className:`fill-surface stroke-line`,strokeWidth:`1.5`}),(0,I.jsxs)(`g`,{transform:`translate(76 18)`,className:`text-muted`,children:[(0,I.jsx)(`path`,{d:`M4 4h24a4 4 0 0 1 4 4v13a4 4 0 0 1-4 4H14l-7 6v-6H4a4 4 0 0 1-4-4V8a4 4 0 0 1 4-4z`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinejoin:`round`}),(0,I.jsx)(`circle`,{cx:`9`,cy:`14.5`,r:`1.8`,fill:`currentColor`}),(0,I.jsx)(`circle`,{cx:`16`,cy:`14.5`,r:`1.8`,fill:`currentColor`}),(0,I.jsx)(`circle`,{cx:`23`,cy:`14.5`,r:`1.8`,fill:`currentColor`})]}),(0,I.jsx)(H,{x:92,y:76,children:`Your AI app`}),(0,I.jsx)(H,{x:92,y:98,size:14,weight:500,className:`fill-soft`,children:`Claude, Cursor, VS Code…`})]})}function W({x:e,y:t}){return(0,I.jsxs)(`g`,{transform:`translate(${e} ${t})`,children:[(0,I.jsx)(`rect`,{width:`250`,height:`196`,rx:`26`,className:`fill-green-deep`}),(0,I.jsxs)(`g`,{transform:`translate(110 16)`,className:`text-white`,children:[(0,I.jsx)(`path`,{d:`M15 2 27 6.5v9.4c0 7-4.5 11.8-12 14.8C7.5 27.7 3 22.9 3 15.9V6.5z`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinejoin:`round`}),(0,I.jsx)(`path`,{d:`m9.5 16 4 4 7-8`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`})]}),(0,I.jsx)(H,{x:125,y:68,size:17,weight:700,className:`fill-white`,children:`hardened-mcp`}),(0,I.jsx)(H,{x:125,y:88,size:14,weight:500,className:`fill-on-hero-soft`,children:`the toolbox that checks every action`}),L.map(([e,t],n)=>(0,I.jsxs)(`g`,{transform:`translate(34 ${108+n*26})`,children:[(0,I.jsx)(`rect`,{width:`182`,height:`22`,rx:`11`,fill:`white`,fillOpacity:`0.12`}),(0,I.jsx)(`circle`,{cx:`14`,cy:`11`,r:`5`,className:t}),(0,I.jsx)(H,{x:28,y:15.5,size:14,weight:600,className:`fill-white`,anchor:`start`,children:e})]},e))]})}function G({x:e,y:t,compact:n}){return(0,I.jsxs)(`g`,{transform:`translate(${e} ${t})`,children:[(0,I.jsx)(`rect`,{width:`176`,height:n?150:168,rx:`22`,className:`fill-surface stroke-line`,strokeWidth:`1.5`}),(0,I.jsx)(H,{x:88,y:28,size:14.5,weight:700,className:`fill-soft`,children:`Your servers`}),R.map((e,t)=>(0,I.jsxs)(`g`,{transform:`translate(18 ${42+t*(n?26:30)})`,children:[(0,I.jsx)(`rect`,{width:`140`,height:`22`,rx:`7`,className:t===R.length-1?`fill-transparent`:`fill-sunken`}),t<R.length-1&&(0,I.jsx)(`circle`,{cx:`13`,cy:`11`,r:`3.5`,className:`fill-ok`}),(0,I.jsx)(H,{x:t<R.length-1?26:8,y:15.5,size:12.5,weight:500,className:`fill-muted`,anchor:`start`,children:e})]},e))]})}function K({text:e}){let t=e.split(/(`[^`]+`|\*\*[^*]+\*\*)/g).filter(Boolean);return(0,I.jsx)(I.Fragment,{children:t.map((e,t)=>e.startsWith("`")?(0,I.jsx)(`code`,{className:`mono rounded-md bg-sunken px-1.5 py-0.5 text-[12.5px] break-words text-ink`,children:e.slice(1,-1)},t):e.startsWith(`**`)?(0,I.jsx)(`strong`,{className:`font-semibold text-ink`,children:e.slice(2,-2)},t):(0,I.jsx)(`span`,{children:e},t))})}function q({children:e}){return(0,I.jsx)(`p`,{className:`max-w-2xl text-[15.5px] leading-relaxed text-muted`,children:e})}function J({icon:e,title:t,children:n}){return(0,I.jsxs)(`li`,{className:`flex gap-3`,children:[(0,I.jsx)(`span`,{className:`grid h-9 w-9 shrink-0 place-items-center rounded-full bg-ok-tint text-ok`,children:(0,I.jsx)(s,{name:e,size:17})}),(0,I.jsxs)(`span`,{className:`min-w-0 pt-0.5`,children:[(0,I.jsx)(`span`,{className:`block text-[15px] font-medium`,children:t}),(0,I.jsx)(`span`,{className:`mt-0.5 block text-[13.5px] leading-relaxed text-soft`,children:n})]})]})}function ve(){return(0,I.jsxs)(`div`,{className:`flex flex-col gap-7`,children:[(0,I.jsx)(q,{children:`hardened-mcp lets your AI app use tools, like your files, GitHub or Notion. It doesn't give the AI everything. You get a toolbox. Your AI app connects to it, and every action goes through it first. When protection is on, reading runs freely. Every change asks you first. Anything outside the folders and services you gave it is blocked. Everything is written down, so you can always see what your AI did.`}),(0,I.jsx)(`div`,{className:`rounded-[22px] bg-sunken/60 p-4 sm:p-6`,children:(0,I.jsx)(z,{})}),(0,I.jsxs)(`div`,{className:`grid gap-5 md:grid-cols-2`,children:[(0,I.jsxs)(`section`,{"aria-labelledby":`what-mcp`,className:`rounded-[18px] border border-line p-5`,children:[(0,I.jsxs)(`h2`,{id:`what-mcp`,className:`flex items-center gap-2 text-[16px] font-semibold`,children:[`What's an MCP server? `,(0,I.jsx)(l,{term:`mcp`})]}),(0,I.jsx)(`p`,{className:`mt-2 text-[14px] leading-relaxed text-muted`,children:`It's a small add-on that gives your AI app a set of tools: reading a folder, searching the web, opening an issue on GitHub. MCP is a shared standard, so any AI app can use any of them. In a minute you'll bring in the ones your AI app already has, or add your first one.`})]}),(0,I.jsxs)(`section`,{"aria-labelledby":`what-expect`,className:`rounded-[18px] border border-line p-5`,children:[(0,I.jsx)(`h2`,{id:`what-expect`,className:`text-[16px] font-semibold`,children:`What to expect`}),(0,I.jsxs)(`ul`,{className:`mt-3 flex flex-col gap-3`,children:[(0,I.jsx)(J,{icon:`clock`,title:`About 5 minutes`,children:`Seven short steps. You can skip any of them and come back later from Settings & help.`}),(0,I.jsx)(J,{icon:`lock`,title:`Nothing changes until you say so`,children:`Your AI apps keep working exactly as they do now until you choose to connect one.`}),(0,I.jsx)(J,{icon:`eye`,title:`It starts by watching`,children:`At first your toolbox lets everything run and writes down what it would have asked you about or blocked, so nothing you rely on breaks. In step 6 you choose whether to turn protection on straight away.`})]})]})]})]})}function Y(e,t){let n=t.find(t=>t.id===e),r=e===`node`?t.find(e=>e.id===`npx`):e===`uv`?t.find(e=>e.id===`uvx`):void 0;return!n?.found||r&&!r.found?{status:{tone:`neutral`,label:`Not installed`,icon:`minus`},check:n,state:`missing`}:n?.running===!1?{status:{tone:`warn`,label:`Installed, not running`,icon:`pause`},check:n,state:`stopped`}:{status:{tone:`ok`,label:`Ready`,icon:`check`},check:n,state:`ready`}}function ye({entries:e}){let i=p(()=>t.doctor(),[]),[a,o]=(0,F.useState)(!1),s=i.data,c=A(s?.platform),u=fe(e),f=()=>{o(!0),i.reload(),setTimeout(()=>o(!1),700)},m=s?de.map(e=>({rt:e,...Y(e,s.checks)})):[],h=m.filter(e=>e.state!==`ready`),g=m.some(e=>e.rt===`node`&&e.state===`ready`);return(0,I.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,I.jsxs)(q,{children:[`Most servers need a free helper program to run, such as Node.js. This looks for them on this computer. It only looks; it never installs or changes anything. `,(0,I.jsx)(l,{term:`machineCheck`})]}),i.error&&!s?(0,I.jsx)(r,{tone:`warn`,title:`The check couldn't run`,actions:(0,I.jsx)(d,{size:`sm`,icon:`refresh`,onClick:f,loading:a,children:`Check again`}),children:`You can skip this step. If a server needs something that's missing, it will tell you when you test it.`}):s?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(r,{tone:h.length===0?`ok`:g?`info`:`warn`,role:`status`,title:h.length===0?`Everything is ready`:g?`You're ready for your first server`:`Some servers need something installed first`,actions:(0,I.jsx)(d,{size:`sm`,icon:`refresh`,onClick:f,loading:a||i.loading,children:`Check again`}),children:h.length===0?`This computer has everything servers need.`:g?`Some servers need other helpers, listed below. You don't need them unless you add one of those servers.`:`That's fine. You can carry on and only install something when a server you want needs it.`}),(0,I.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":`What this computer has`,children:m.map(e=>(0,I.jsx)(X,{rt:e.rt,status:e.status,check:e.check,state:e.state,os:c,needs:u[e.rt]},e.rt))})]}):(0,I.jsx)(`div`,{className:`flex flex-col gap-3`,"aria-busy":`true`,"aria-label":`Checking your computer`,children:(0,I.jsx)(n,{height:64,lines:3})})]})}function X({rt:t,status:n,check:r,state:i,os:a,needs:s}){let c=k[t],[l,f]=(0,F.useState)(!1),[p,m]=(0,F.useState)(a),h=`install-${t}`;return(0,I.jsxs)(`li`,{className:`rounded-[18px] border border-line p-4`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,I.jsxs)(`div`,{className:`min-w-0 flex-1 basis-56`,children:[(0,I.jsx)(`p`,{className:`flex flex-wrap items-center gap-2 text-[15px] font-semibold`,children:c.name}),(0,I.jsx)(`p`,{className:`mt-0.5 text-[13.5px] text-soft`,children:c.why}),i!==`ready`&&s.length>0&&(0,I.jsxs)(`p`,{className:`mt-1.5 text-[13px] text-muted`,children:[(0,I.jsx)(`span`,{className:`font-medium`,children:`Needed by:`}),` `,s.join(`, `)]}),i===`ready`&&(r?.path||r?.version)&&(0,I.jsxs)(`details`,{className:`mt-1 text-[12px] text-soft`,children:[(0,I.jsx)(`summary`,{className:`cursor-pointer select-none`,children:`Details`}),r?.version&&(0,I.jsxs)(`span`,{className:`mono block`,children:[`Version `,r.version]}),r?.path&&(0,I.jsx)(`code`,{className:`mono block break-all`,children:r.path})]})]}),(0,I.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,I.jsx)(e,{tone:n.tone,icon:n.icon,children:n.label}),i!==`ready`&&(0,I.jsx)(d,{size:`sm`,variant:`ghost`,iconRight:`chevron`,"aria-expanded":l,"aria-controls":h,onClick:()=>f(!l),children:i===`stopped`?`How to start it`:`How to install it`})]})]}),l&&i!==`ready`&&(0,I.jsx)(`div`,{id:h,className:`mt-4 border-t border-faint pt-4`,children:i===`stopped`&&c.start?(0,I.jsx)(`p`,{className:`text-[14px] leading-relaxed text-muted`,children:(0,I.jsx)(K,{text:c.start[p]})}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(o,{size:`sm`,label:`Install steps for ${c.name}: choose your computer`,value:p,onChange:m,options:[`darwin`,`win32`,`linux`].map(e=>({value:e,label:D[e]}))}),(0,I.jsx)(`ol`,{className:`mt-4 flex flex-col gap-3`,children:c.steps[p].map((e,t)=>(0,I.jsxs)(`li`,{className:`flex gap-3`,children:[(0,I.jsx)(`span`,{className:`tnum grid h-6 w-6 shrink-0 place-items-center rounded-full bg-sunken text-[12px] font-bold text-muted`,children:t+1}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1 text-[14px] leading-relaxed text-muted`,children:[(0,I.jsx)(K,{text:e.text}),e.copy&&(0,I.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(`code`,{className:`mono min-w-0 rounded-lg bg-surface px-2.5 py-1.5 text-[12.5px] break-all text-ink`,children:e.copy}),(0,I.jsx)(E,{text:e.copy,label:`Copy`})]}),e.link&&(0,I.jsx)(`div`,{className:`mt-2`,children:(0,I.jsx)(u,{href:e.link.url,external:!0,size:`sm`,iconRight:`external`,children:e.link.label})})]})]},t))})]})})]})}function be({gatewayId:e,existing:t,added:n,entries:i,onAdded:a,onClosed:o}){let[s,c]=(0,F.useState)(n.length===0&&t.length===0),l=n.at(-1);return(0,I.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,I.jsxs)(q,{children:[`Pick a server to give your AI app its first tools. Each one comes with step-by-step instructions, and you can test it before anything is saved. If you're not sure, `,(0,I.jsx)(`strong`,{className:`font-semibold text-ink`,children:`Files on this computer`}),` `,`is a good first choice: it lets the AI read and edit files in one folder you choose, and nothing outside it.`]}),l&&(0,I.jsx)(r,{tone:`ok`,role:`status`,title:l.displayName?`${l.displayName} is in your toolbox`:`Added to your toolbox`,children:l.summary.length>0?(0,I.jsx)(`ul`,{className:`mt-1 list-disc pl-5`,children:l.summary.map(e=>(0,I.jsx)(`li`,{children:e},e))}):`It's saved in your toolbox.`}),!l&&t.length>0&&(0,I.jsxs)(r,{tone:`info`,title:`You already have servers`,children:[`Your toolbox has `,t.map(e=>oe(i,e)?.name??e).join(`, `),`. You can add another or carry on.`]}),s?(0,I.jsx)(he,{gatewayId:e,compact:!0,onDone:e=>{a(e),c(!1)},onCancel:n.length>0||t.length>0?()=>{c(!1),o?.()}:void 0}):(0,I.jsx)(`div`,{children:(0,I.jsx)(d,{icon:`plus`,onClick:()=>c(!0),children:`Add another server`})})]})}var Z=(e,t)=>`/tools?server=${encodeURIComponent(e)}&app=${encodeURIComponent(t)}`;function xe({gatewayId:e,onAttached:t,onConnected:n,onUndone:r,onNeedsServer:i,onAddServer:a,onProtect:o}){return(0,I.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,I.jsxs)(q,{children:[N,` `,(0,I.jsx)(l,{term:`toolbox`})]}),(0,I.jsxs)(`div`,{className:`rounded-[18px] bg-sunken/60 p-4 sm:p-5`,children:[(0,I.jsxs)(`p`,{className:`flex items-center gap-2 text-[15px] font-semibold`,children:[(0,I.jsx)(s,{name:`refresh`,size:17,className:`text-ok`}),`Restart your app once`]}),(0,I.jsx)(`p`,{className:`mt-1.5 text-[13.5px] leading-relaxed text-muted`,children:`Your AI app only looks for new tools when it starts. After connecting, quit it completely (not just close the window) and open it again. You only do this once: servers you add or change later appear on their own.`})]}),(0,I.jsx)(j,{newTab:!0,keep:!0,toolsHref:Z,protect:()=>({onClick:o}),addServer:{onClick:a},onConnected:n,onNeedsServer:i,onUndone:r}),(0,I.jsxs)(`details`,{className:`rounded-[18px] border border-line p-4`,children:[(0,I.jsx)(`summary`,{className:`cursor-pointer text-[14px] font-semibold select-none`,children:M}),(0,I.jsx)(`p`,{className:`mt-2 text-[13.5px] text-muted`,children:P}),(0,I.jsx)(`div`,{className:`mt-3`,children:e?(0,I.jsx)(_e,{gatewayId:e,compact:!0,onDone:t}):(0,I.jsx)(`p`,{className:`text-[13.5px] text-muted`,children:`These need a toolbox. Connect an app above, or add a server first.`})})]})]})}function Se({entries:e,servers:t,appLabel:n}){let{prompt:r,entry:i}=O(e,t),a=n??`your AI app`;return(0,I.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,I.jsxs)(q,{children:[`Open `,a,` and ask it something that uses your new tools`,i?` from ${i.name}`:``,`. Here's a good first one:`]}),(0,I.jsxs)(`figure`,{className:`m-0 rounded-[20px] border-[1.5px] border-primary/40 bg-ok-tint p-5`,children:[(0,I.jsxs)(`blockquote`,{className:`text-[17px] leading-relaxed font-medium text-ink`,children:[`“`,r,`”`]}),(0,I.jsx)(`figcaption`,{className:`mt-4`,children:(0,I.jsx)(E,{text:r,label:`Copy this`})})]}),(0,I.jsxs)(`section`,{"aria-labelledby":`what-see`,children:[(0,I.jsx)(`h2`,{id:`what-see`,className:`text-[16px] font-semibold`,children:`What you'll see`}),(0,I.jsxs)(`ol`,{className:`mt-3 flex flex-col gap-3`,children:[(0,I.jsx)(J,{icon:`check`,title:`Looking runs straight away`,children:`When the AI only reads something, it just happens. Every action is written down under Activity in this console.`}),(0,I.jsx)(J,{icon:`eye`,title:`At first, changes run too`,children:`A new toolbox starts by watching: everything runs, and Activity notes what would have asked you first or been blocked. In the next step you choose whether it should start protecting you.`}),(0,I.jsxs)(J,{icon:`clock`,title:`Once protection is on, every change asks you first`,children:[`If the AI wants to change something, it stops and tells you it's waiting. The request appears under`,` `,(0,I.jsx)(`strong`,{className:`font-semibold text-ink`,children:`Waiting for you`}),` in this console. Approve it or say no there. If you approve, the AI can try again and it goes ahead. Anything outside the folders and services you gave it is blocked.`]}),(0,I.jsxs)(J,{icon:`warning`,title:`If nothing happens`,children:[`Check that you quit `,a,` completely and opened it again. If a tool still doesn't show up, open Connections in this console: each server says whether it's working, and if not, why and how to fix it.`]})]}),(0,I.jsx)(`div`,{className:`mt-5`,children:(0,I.jsx)(u,{href:`/approvals`,external:!0,icon:`clock`,iconRight:`external`,children:`Open Waiting for you`})})]})]})}var Q=`Reading runs straight away. Every change asks you first, here in this console. Anything outside the folders and services you gave it is blocked.`;function Ce({gatewayId:t,onAddServer:i,applyRef:a}){let[o,s]=(0,F.useState)(`protect`),[l,u]=(0,F.useState)(!1),[f,m]=(0,F.useState)(null),[h,g]=(0,F.useState)(null),_=p(()=>t?c.protection(t):Promise.resolve(null),[t]),v=(0,F.useRef)(null),y=(0,F.useRef)(!1),b=_.data?.enforcement===`enforce`||h===`protect`,x=_.data&&!_.data.policyWrite.ok?_.data.policyWrite.why:null,S=async()=>{if(m(null),!t||b||h===`watch`)return!0;if(o===`watch`)return y.current=!0,g(`watch`),!0;if(!_.data)return!1;if(x)return m(x),!1;u(!0);try{return await c.setPolicySetting(t,`enforcement`,`enforce`,_.data.policyWrite.digest),y.current=!0,g(`protect`),_.reload(),!0}catch(e){return m(e.message||`Protection couldn't be turned on.`),!1}finally{u(!1)}};return a&&(a.current=S),(0,F.useEffect)(()=>()=>{a&&(a.current=null)},[a]),(0,F.useEffect)(()=>{y.current&&v.current?.focus()},[b,h]),t?_.loading&&!_.data?(0,I.jsx)(n,{height:180}):b?(0,I.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,I.jsx)(`div`,{ref:v,tabIndex:-1,className:`outline-none`,children:(0,I.jsxs)(r,{tone:`ok`,title:`Your toolbox is protecting you`,role:`status`,children:[Q,` Requests appear under `,(0,I.jsx)(`strong`,{className:`font-semibold`,children:`Waiting for you`}),`.`]})}),(0,I.jsxs)(`ul`,{className:`flex flex-col gap-3`,children:[(0,I.jsx)(J,{icon:`clock`,title:`When your AI asks for something`,children:`It stops and tells you it's waiting. Open this console, look at what it wants to do, and approve it or say no.`}),(0,I.jsxs)(J,{icon:`sliders`,title:`Too many questions?`,children:[`Under `,(0,I.jsx)(`strong`,{className:`font-semibold text-ink`,children:`Protection settings`}),` you can let a tool you trust run freely, or approve one for a while.`]})]})]}):h===`watch`?(0,I.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,I.jsx)(`div`,{ref:v,tabIndex:-1,className:`outline-none`,children:(0,I.jsx)(r,{tone:`warn`,title:`Your toolbox is only watching for now`,role:`status`,children:`Everything your AI does runs and is written down under Activity. Nothing asks you first and nothing is blocked, so you're not protected yet.`})}),(0,I.jsxs)(q,{children:[`When you're ready, turn protection on under `,(0,I.jsx)(`strong`,{className:`font-semibold text-ink`,children:`Protection settings`}),` `,`(one switch at the top), or come back to this guide from Settings & help.`]}),(0,I.jsx)(`div`,{children:(0,I.jsx)(d,{variant:`ghost`,onClick:()=>g(null),children:`Choose again`})})]}):(0,I.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,I.jsx)(q,{children:`Right now your toolbox only watches: everything your AI does runs, and is written down. Choose whether it should start protecting you now.`}),(0,I.jsx)(T,{label:`How careful should your toolbox be?`,value:o,onChange:s,options:[{value:`protect`,title:`Protect me now`,badge:(0,I.jsx)(e,{tone:`ok`,children:`Recommended`}),body:Q},{value:`watch`,title:`Watch for a few days first`,body:`Everything runs and is written down, and nothing asks you first. You can see what would have asked you, then turn protection on later. Until then, you're not protected.`}]}),x&&(0,I.jsx)(r,{tone:`warn`,title:`This toolbox's protection can't be changed from the console`,children:x}),f&&(0,I.jsx)(r,{tone:`danger`,role:`alert`,title:`Protection wasn't turned on`,children:f}),(0,I.jsx)(`div`,{children:(0,I.jsx)(d,{variant:`primary`,icon:o===`protect`?`shield-check`:`eye`,loading:l,disabled:!!x&&o===`protect`,onClick:()=>void S(),children:o===`protect`?`Turn on protection`:`Keep watching for now`})})]}):(0,I.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,I.jsx)(q,{children:`There's nothing to protect yet. Add a server first, then come back here.`}),(0,I.jsx)(`div`,{children:(0,I.jsx)(d,{icon:`plus`,onClick:i,children:`Add a server`})})]})}var $=[{href:`/approvals`,icon:`clock`,title:`Waiting for you`,body:`Requests that ask you first. Approve or say no.`},{href:`/tools`,icon:`tool`,title:`Tools`,body:`Every tool your AI can use, and what each one is allowed to do.`},{href:`/connections?add=server`,icon:`plus`,title:`Add more servers`,body:`GitHub, Notion, the web and more, with a guide for each.`},{href:`/protection`,icon:`sliders`,title:`Protection settings`,body:`Choose what runs freely, what asks you first, and what's blocked.`}];function we({gatewayId:e,onLeave:t}){let n=p(()=>e?c.protection(e):Promise.resolve(null),[e]),i=!!n.data&&n.data.enforcement!==`enforce`;return(0,I.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,I.jsx)(q,{children:`Your toolbox is set up. Here's where to go next.`}),i&&(0,I.jsxs)(r,{tone:`warn`,title:`Protection: off (only watching)`,children:[`Everything your AI does runs and is written down, and nothing asks you first. Turn protection on under`,` `,(0,I.jsx)(`strong`,{className:`font-semibold`,children:`Protection settings`}),` when you're ready.`]}),(0,I.jsx)(`ul`,{className:`grid gap-3 sm:grid-cols-2`,children:$.map(e=>(0,I.jsx)(`li`,{children:(0,I.jsxs)(`a`,{href:e.href,onClick:n=>{n.button!==0||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey||(n.preventDefault(),t(e.href))},className:_(`card card-link flex h-full gap-3.5 p-5`),children:[(0,I.jsx)(`span`,{className:`grid h-10 w-10 shrink-0 place-items-center rounded-full bg-ok-tint text-ok`,children:(0,I.jsx)(s,{name:e.icon,size:19})}),(0,I.jsxs)(`span`,{className:`min-w-0`,children:[(0,I.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[15.5px] font-semibold`,children:[e.title,(0,I.jsx)(s,{name:`arrow-right`,size:15,className:`text-soft`})]}),(0,I.jsx)(`span`,{className:`mt-0.5 block text-[13.5px] text-soft`,children:e.body})]})]})},e.href))}),(0,I.jsx)(r,{tone:`info`,title:`When you need to approve something, open the console`,children:`Approving requests and signing in to services happen here. Your servers keep working without the console open; anything that asks you first waits until you open it again.`})]})}function Te(){let[e,n]=(0,F.useState)(null),[r,i]=(0,F.useState)(`welcome`),[o,l]=(0,F.useState)(!1),[u,f]=(0,F.useState)(null),[p,oe]=(0,F.useState)([]),[T,E]=(0,F.useState)([]),[D,O]=(0,F.useState)(null),[k,de]=(0,F.useState)([]),[fe,A]=(0,F.useState)(!1),he=(0,F.useRef)(null),j=(0,F.useRef)(null),[_e,M]=(0,F.useState)(!1),N=(0,F.useRef)(!1),[P,L]=(0,F.useState)(w),[R,z]=(0,F.useState)(null),B=(0,F.useRef)(P);B.current=P;let V=(0,F.useRef)(null),[H,U]=(0,F.useState)(0),W=(0,F.useRef)(Promise.resolve()),G=(0,F.useRef)(re),K=(0,F.useCallback)((e,t={})=>c.servers().then(n=>{let r=n.filter(e=>e.ok),i=r.find(t=>t.id===e)??r.find(e=>e.id===`main`)??r[0],a=i?.upstreams??[];return t.isLive&&!t.isLive()||!i&&!t.clear||(f(i?.id??null),oe(a)),a}).catch(()=>null),[]);(0,F.useEffect)(()=>{let e=!0;return t.settings().then(ue,()=>(l(!0),re)).then(t=>{e&&(G.current=t,n(t),i(ie(t.onboarding)))}),K(null,{isLive:()=>e}),t.catalog().then(t=>e&&de(t.entries)).catch(()=>void 0),()=>{e=!1}},[K]);let q=(0,F.useCallback)(e=>{let r={...G.current,onboarding:e};G.current=r,n(r);let i=()=>t.saveSettings(r).then(()=>l(!1),()=>l(!0));return W.current=W.current.then(i,i),W.current},[]),J=()=>{let e=B.current;if(e.pending){let t=e.pending;E(e=>v({added:e,gatewayId:null},t).added),f(t.gatewayId)}e.state!==`idle`&&ge(),L(w)},Y=e=>{ce(r,P)?z(()=>e):e()},X=(e,t)=>{r===`server`&&e!==`server`&&(J(),A(!1)),N.current=!0,i(e),q(te(G.current.onboarding,e,t))},Z=async(e=`/`)=>{r===`server`&&J(),await q(S(G.current.onboarding)),g(e)};(0,F.useEffect)(()=>{if(r===`server`)return a(e=>L(t=>ae(t,e)))},[r]),(0,F.useEffect)(()=>{H&&V.current?.querySelector(`button`)?.focus()},[H]),(0,F.useEffect)(()=>{if(!N.current)return;he.current?.focus();let e=matchMedia(`(prefers-reduced-motion: reduce)`).matches;window.scrollTo({top:0,behavior:e?`auto`:`smooth`})},[r]),(0,F.useEffect)(()=>{let e=document.title;return document.title=`Step ${b.indexOf(r)+1} of ${b.length}: ${C[r]} – hardened-mcp`,()=>{document.title=e}},[r]);let Q=b.indexOf(r),$=e?.onboarding.done??[],Te=[...p,...pe(T,P.pending).map(e=>e.upstreamName)],De=ce(r,P);return(0,I.jsxs)(`div`,{className:`min-h-dvh bg-canvas text-ink`,children:[(0,I.jsx)(`header`,{className:`sticky top-0 z-20 border-b border-faint bg-canvas/95`,children:(0,I.jsxs)(`div`,{className:`mx-auto flex max-w-6xl items-center gap-3 px-4 py-3 sm:px-6`,children:[(0,I.jsx)(`span`,{className:`grid h-9 w-9 shrink-0 place-items-center rounded-xl bg-[#2a2623]`,children:(0,I.jsx)(`img`,{src:`/brand/mark.svg`,alt:``,width:24,height:24})}),(0,I.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`span`,{className:`block truncate text-[15px] font-semibold`,children:`Getting started`}),(0,I.jsx)(`span`,{className:`block text-[12.5px] text-soft`,children:`hardened-mcp`})]}),(0,I.jsx)(d,{variant:`ghost`,size:`sm`,iconRight:`arrow-right`,onClick:()=>Y(()=>void Z()),children:`Go to the console`})]})}),e?(0,I.jsxs)(`div`,{className:`mx-auto grid max-w-6xl gap-6 px-4 py-6 sm:px-6 lg:grid-cols-[240px_minmax(0,1fr)] lg:gap-10 lg:py-10`,children:[(0,I.jsxs)(`nav`,{"aria-label":`Guide steps`,className:`lg:sticky lg:top-24 lg:self-start`,children:[(0,I.jsxs)(`div`,{className:`lg:hidden`,children:[(0,I.jsxs)(`p`,{className:`text-[13px] font-semibold text-soft`,children:[`Step `,Q+1,` of `,b.length]}),(0,I.jsx)(`div`,{className:`mt-2 h-1.5 overflow-hidden rounded-full bg-line`,role:`progressbar`,"aria-label":`Progress through the guide`,"aria-valuemin":1,"aria-valuemax":b.length,"aria-valuenow":Q+1,children:(0,I.jsx)(`div`,{className:`h-full rounded-full bg-primary`,style:{width:`${(Q+1)/b.length*100}%`}})})]}),(0,I.jsx)(`ol`,{className:`hidden flex-col gap-1 lg:flex`,children:b.map((e,t)=>{let n=e===r,i=$.includes(e);return(0,I.jsx)(`li`,{children:(0,I.jsxs)(`button`,{type:`button`,onClick:()=>e===r?void 0:Y(()=>X(e)),"aria-current":n?`step`:void 0,className:_(`flex w-full items-center gap-3 rounded-2xl px-3 py-2.5 text-left text-[14px] transition-colors`,n?`bg-surface font-semibold shadow-[var(--shadow-sm)]`:`text-muted hover:bg-faint`),children:[(0,I.jsx)(`span`,{className:_(`tnum grid h-7 w-7 shrink-0 place-items-center rounded-full text-[12.5px] font-bold`,i?`bg-primary text-white`:n?`border-2 border-[var(--primary)] text-ink`:`border-[1.5px] border-line text-soft`),children:i?(0,I.jsx)(s,{name:`check`,size:14,strokeWidth:2.6}):t+1}),(0,I.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:C[e]}),i&&(0,I.jsx)(`span`,{className:`sr-only`,children:`(done)`})]})},e)})})]}),(0,I.jsxs)(`main`,{className:`min-w-0`,children:[(0,I.jsxs)(`article`,{className:`card p-5 sm:p-8`,"aria-labelledby":`start-step-h`,children:[(0,I.jsxs)(`p`,{className:`eyebrow text-soft`,children:[`Step `,Q+1,` · `,C[r]]}),(0,I.jsx)(`h1`,{id:`start-step-h`,ref:he,tabIndex:-1,className:`display mt-2 text-[28px] outline-none sm:text-[34px]`,children:ne[r]}),(0,I.jsxs)(`div`,{className:`mt-5`,children:[r===`welcome`&&(0,I.jsx)(ve,{}),r===`computer`&&(0,I.jsx)(ye,{entries:k}),r===`server`&&(0,I.jsx)(be,{gatewayId:u,existing:p,added:T,entries:k,onAdded:e=>{f(e.gatewayId),E(t=>pe(t,e)),L(w),U(e=>e+1)},onClosed:()=>L(w)}),r===`app`&&(0,I.jsx)(xe,{gatewayId:u,onAttached:e=>{O(e),U(e=>e+1)},onConnected:(e,t)=>{O({configPath:e.configPath,entryName:``,backupPath:e.backupPath,alreadyConnected:e.alreadyConnected,restartHint:e.restartHint,appLabel:t.label,scope:t.scope}),f(e.toolbox.id),A(!1),K(e.toolbox.id),y(e)&&q(x(G.current.onboarding,`server`)),U(e=>e+1)},onUndone:()=>{O(null),K(u,{clear:!0}).then(e=>{e&&q(me(G.current.onboarding,e.length))})},onNeedsServer:()=>A(!0),onAddServer:()=>{A(!0),X(`server`)},onProtect:()=>X(`protect`)}),r===`try`&&(0,I.jsx)(Se,{entries:k,servers:Te,appLabel:D?.appLabel??null}),r===`protect`&&(0,I.jsx)(Ce,{gatewayId:u,onAddServer:()=>X(`server`),applyRef:j}),r===`done`&&(0,I.jsx)(we,{gatewayId:u,onLeave:e=>void Z(e)})]}),(0,I.jsxs)(`footer`,{className:_(`mt-8 flex-wrap items-center gap-2 border-t border-faint pt-5`,De?`hidden`:`flex`),children:[Q>0&&(0,I.jsx)(d,{variant:`ghost`,icon:`arrow-left`,onClick:()=>X(le(r)),children:`Back`}),(0,I.jsx)(`span`,{className:`flex-1`}),r!==`done`&&(0,I.jsx)(d,{variant:`ghost`,onClick:()=>Y(()=>X(ee(r,$,!1))),children:`Skip for now`}),(0,I.jsx)(Ee,{buttonRef:V,step:r,ready:se(r,Te.length,!!D,P),busy:_e,onNext:async()=>{r===`protect`&&j.current&&(M(!0),!await j.current().finally(()=>M(!1)))||X(ee(r,$,fe),r)},onFinish:()=>void Z()})]})]}),(0,I.jsx)(h,{open:!!R,onClose:()=>z(null),title:`Leave without saving this server?`,description:`You're in the middle of setting up a server. If you leave now, it isn't added, and you'd start it again next time.`,footer:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(d,{variant:`ghost`,onClick:()=>{let e=R;z(null),e?.()},children:`Leave without saving`}),(0,I.jsx)(d,{variant:`primary`,onClick:()=>z(null),children:`Keep setting it up`})]})}),o&&(0,I.jsx)(`p`,{className:`mt-3 text-center text-[12.5px] text-soft`,role:`status`,children:`Your progress couldn't be saved, so the guide may start over next time. Everything you add is still saved.`})]})]}):(0,I.jsx)(`main`,{className:`flex min-h-[60dvh] items-center justify-center`,children:(0,I.jsxs)(`p`,{role:`status`,className:`flex items-center gap-3 text-soft`,children:[(0,I.jsx)(m,{}),` Getting things ready…`]})})]})}function Ee({buttonRef:e,step:t,ready:n,busy:r,onNext:i,onFinish:a}){if(t===`done`)return(0,I.jsx)(`span`,{ref:e,className:`contents`,children:(0,I.jsx)(d,{variant:`primary`,iconRight:`arrow-right`,onClick:a,children:`Go to the console`})});let o=t===`welcome`?`Let's start`:t===`try`?`I've tried it`:`Continue`,s=n?null:t===`server`?`Add a server first, or skip for now.`:`Connect an app first, or skip for now.`;return(0,I.jsxs)(I.Fragment,{children:[s&&(0,I.jsx)(`p`,{id:`start-continue-why`,className:`order-last basis-full text-right text-[13px] text-soft`,children:s}),(0,I.jsx)(`span`,{ref:e,className:`contents`,children:(0,I.jsx)(d,{variant:`primary`,iconRight:`arrow-right`,onClick:i,disabled:!n,loading:r,"aria-describedby":s?`start-continue-why`:void 0,children:o})})]})}export{Te as StartPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,B as t,Ct as n,Et as r,G as i,H as a,It as o,Nt as s,O as c,Ot as l,Pt as u,U as d,W as f,Z as p,_ as m,_t as h,b as g,c as _,d as v,et as y,ht as b,kt as x,mt as S,pt as C,s as w,w as T,wt as E,x as D,y as O,z as k}from"./kit-BHB_ha4i.js";import{dt as A,ft as j,ht as M,lt as N,mt as P,pn as F,pt as I,ut as L}from"./index-DywhXnhV.js";var R=o(),z=`Suggested from what watch-only mode recorded`;async function B(e,t,n){if(!A(n.match)&&n.effect){let r={tool:n.match,effect:n.effect,decision:n.decision,...n.args?{args:n.args}:{},...n.on_violation?{on_violation:n.on_violation}:{},...n.unknown_args?{unknown_args:n.unknown_args}:{},reason:n.reason??z};return{kind:`tool`,body:r,preview:await u.toolRulePreview(e,r,t)}}let r={...n,reason:n.reason??z};return{kind:`rules`,rule:r,preview:await u.previewRules(e,{op:`add`,rule:r,index:0},t)}}function V(e){if(e.kind===`tool`){let t=e.preview,n=t.overriddenReason;return{override:n,drop:t.dropsBounds,destructive:e.body.effect===`destructive`&&e.body.decision===`allow`,loosens:t.loosens,refused:t.writable.ok?n&&!t.overridesAllowed?`This toolbox does not let the console reverse rule ${n.ruleId}. Change it in the protection settings file instead.`:null:t.writable.why??`The protection settings file cannot be changed from here.`}}let t=e.preview;return{override:null,drop:null,destructive:!1,loosens:t.loosens,refused:t.writable.ok?t.loosens&&!t.overridesAllowed?`This toolbox lets the console tighten its rules but not loosen them.`:null:t.writable.why??`The protection settings file cannot be changed from here.`}}async function H(e,t,n,r){if(n.kind===`tool`){let i=n.preview,a={...r.override&&i.overriddenReason?{overrideDeny:i.overriddenReason.ruleId}:{},...r.drop&&i.dropsBounds?{dropBounds:!0}:{},...r.destructive?{destructiveAllow:!0}:{}};return{warning:(await u.setToolRule(e,{...n.body,expectedDigest:i.expectedDigest,...Object.keys(a).length>0?{acknowledged:a}:{}},t)).warning}}return{warning:(await u.addRule(e,n.rule,n.preview.expectedDigest,0,r.loosens?{loosens:!0}:void 0,t)).warning}}var U=e=>e instanceof s&&e.needsLoosenAck,W=x();function G({serverId:e,tenant:t,rule:n,onClose:r,onApplied:o}){let s=O(),[c,u]=(0,R.useState)(null),[d,f]=(0,R.useState)(null),[p,m]=(0,R.useState)(null),[h,_]=(0,R.useState)({override:!1,drop:!1,destructive:!1}),[x,S]=(0,R.useState)(!1),[C,w]=(0,R.useState)(!1),E=(0,R.useCallback)(()=>{u(null),f(null),m(null),_({override:!1,drop:!1,destructive:!1}),B(e,t,n).then(u).catch(e=>f(I(e.message)))},[e,t,n]);(0,R.useEffect)(E,[E]);let k=c?V(c):null,A=c!==null&&k!==null&&!k.refused&&(!k.override||h.override)&&(!k.drop||h.drop)&&(!k.destructive||h.destructive);async function M(i){if(c){w(!0),m(null);try{let{warning:a}=await H(e,t,c,{...h,loosens:i});s.show(`ok`,`Rule applied for ${n.match}.`),a&&s.show(`warn`,I(a)),o(),r()}catch(e){!i&&U(e)?S(!0):(S(!1),m(j(e)?{text:N,stale:!0}:{text:I(e.message),stale:!1}))}finally{w(!1)}}}let F=P(n);if(x&&c){let e=c.kind===`rules`?c.preview.loosenReasons.map(I):[];return(0,W.jsx)(g,{open:!0,title:`Let these calls run without asking?`,confirmLabel:`Apply rule`,busy:C,error:p?.text,onCancel:()=>S(!1),onConfirm:()=>void M(!0),consequences:e.length>0?e:[`Calls to ${n.match} that today ask you first will run on their own while their inputs look like the ones seen.`],children:`This rule lets more through than your settings do now. Calls outside what was seen still ask you or are blocked.`})}return(0,W.jsx)(D,{open:!0,onClose:r,dismissable:!C,width:600,title:`Apply suggested rule`,description:(0,W.jsxs)(W.Fragment,{children:[F.lead,` `,(0,W.jsx)(`span`,{className:`font-mono text-[13px] text-ink`,children:F.subject}),F.rest]}),footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(b,{variant:`secondary`,onClick:r,disabled:C,children:`Cancel`}),(0,W.jsx)(b,{variant:`primary`,disabled:!A,loading:C,onClick:()=>k?.loosens?S(!0):void M(!1),children:`Apply rule`})]}),children:(0,W.jsx)(`div`,{className:`space-y-4 pb-1 text-[14px]`,children:d?(0,W.jsx)(a,{tone:`danger`,title:`The rule could not be checked`,actions:(0,W.jsx)(b,{size:`sm`,onClick:E,children:`Try again`}),children:d}):!c||!k?(0,W.jsx)(i,{lines:4}):(0,W.jsxs)(W.Fragment,{children:[c.kind===`tool`?(0,W.jsxs)(`div`,{className:`rounded-2xl bg-sunken px-4 py-3`,children:[(0,W.jsx)(`p`,{className:`text-[12.5px] text-soft`,children:`What changes for this tool`}),(0,W.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Now`}),(0,W.jsx)(y,{decision:c.preview.current.kind}),(0,W.jsx)(l,{name:`arrow-right`,size:16,className:`text-soft`}),(0,W.jsx)(`span`,{className:`text-[13px] text-muted`,children:`After`}),(0,W.jsx)(y,{decision:c.preview.verdict.kind})]}),c.preview.bounds&&c.preview.verdict.kind!==`deny`&&(0,W.jsxs)(`p`,{className:`mt-2 text-[13px] text-muted`,children:[`That holds while its inputs stay within the limits below. A call outside them`,` `,c.preview.bounds.onViolation===`approve`?`asks you first`:`is blocked`,`.`]})]}):(0,W.jsxs)(`div`,{className:`rounded-2xl bg-sunken px-4 py-3`,children:[(0,W.jsx)(`p`,{className:`text-[12.5px] text-soft`,children:`What changes`}),c.preview.changes.length===0?(0,W.jsx)(`p`,{className:`mt-1 text-[13px] text-muted`,children:`No tool this toolbox serves changes how it is handled.`}):(0,W.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:c.preview.changes.map(e=>(0,W.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:e.tool}),(0,W.jsx)(y,{decision:e.before}),(0,W.jsx)(l,{name:`arrow-right`,size:14,className:`text-soft`}),(0,W.jsx)(y,{decision:e.after})]},e.tool))})]}),k.refused&&(0,W.jsx)(a,{tone:`info`,title:`This cannot be applied from here`,children:I(k.refused)}),c.kind===`tool`&&c.preview.overridden&&(0,W.jsx)(a,{tone:`warn`,children:I(c.preview.overridden)}),c.kind===`tool`&&c.preview.nameContradiction&&(0,W.jsx)(a,{tone:`warn`,children:I(c.preview.nameContradiction)}),c.kind===`tool`&&!c.preview.reloads&&(0,W.jsx)(`p`,{className:`text-[13px] text-muted`,children:`This toolbox reads its settings only when it starts, so the rule applies after a restart.`}),!k.refused&&(k.override||k.drop||k.destructive)&&(0,W.jsxs)(`div`,{className:`space-y-3 rounded-2xl border border-bad/40 px-4 py-3`,children:[k.override&&(0,W.jsx)(T,{checked:h.override,onChange:e=>_(t=>({...t,override:e})),label:`Reverse rule ${k.override.ruleId}`,description:`Someone set this tool to "${k.override.decision}" with the note "${k.override.reason}". This rule overrides that.`}),k.drop&&(0,W.jsx)(T,{checked:h.drop,onChange:e=>_(t=>({...t,drop:e})),label:`Drop the input limits this tool has today`,description:`Rule ${k.drop} limits this tool's inputs now. Those limits would no longer apply.`}),k.destructive&&(0,W.jsx)(T,{checked:h.destructive,onChange:e=>_(t=>({...t,destructive:e})),label:`Let a tool that deletes run without asking`,description:`Your AI app could remove things with nobody asked first.`})]}),p&&(0,W.jsx)(a,{tone:`danger`,role:`alert`,actions:p.stale?(0,W.jsx)(b,{size:`sm`,onClick:E,children:`Reload preview`}):void 0,children:p.text}),(0,W.jsxs)(`details`,{className:`group`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer text-[13px] font-medium text-muted select-none`,children:`Show the rule as written in the settings file`}),(0,W.jsx)(`div`,{className:`mt-2`,children:(0,W.jsx)(v,{label:`Rule as written`,maxHeight:240,children:(c.kind,c.preview.yaml??``)})})]})]})})})}var K=[{value:`24h`,label:`Last 24 hours`,ms:864e5,phrase:`in the last 24 hours`},{value:`7d`,label:`Last 7 days`,ms:6048e5,phrase:`in the last 7 days`},{value:`all`,label:`Everything`,ms:null,phrase:`so far`}];function q(){let{serverId:t,tenant:o,nav:s}=F(),l=s.query.get(`since`),f=l===`24h`||l===`7d`?l:`all`,p=K.find(e=>e.value===f),g=(0,R.useMemo)(()=>p.ms?new Date(Date.now()-p.ms).toISOString():void 0,[p]),v=w(()=>u.suggestions(t,g),[t,g]),y=w(()=>u.protection(t,o),[t,o]),[x,T]=(0,R.useState)(null),[D,O]=(0,R.useState)(new Set),[A,j]=(0,R.useState)(!1),M=v.data,N=y.data,P=e=>D.has(e.id)||Y(e,N),L=M?M.rules.filter(e=>!P(e)):[],z=(e,t={})=>n(s,e,t);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(_,{title:`Suggestions`,subtitle:`Rules drawn from what your AI app did while the toolbox was in watch-only mode.`,actions:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(c,{size:`sm`,label:`Calls since`,value:f,onChange:e=>E(r(s,{since:e===`all`?null:e})),options:K.map(e=>({value:e.value,label:e.label}))}),M&&M.rules.length>0&&(0,W.jsx)(b,{variant:`primary`,icon:`check`,disabled:L.length===0,onClick:()=>j(!0),children:`Apply all safe suggestions`})]})}),N?.enforcement===`enforce`&&M&&M.calls>0&&(0,W.jsx)(`div`,{className:`mb-4`,children:(0,W.jsx)(a,{tone:`info`,title:`This toolbox is protecting`,children:`Suggestions come from calls recorded in watch-only mode. Those already recorded are shown below; new calls add nothing here until the toolbox is in watch-only mode again.`})}),v.error&&!M?(0,W.jsx)(a,{tone:`danger`,title:`The suggestions could not be loaded`,actions:(0,W.jsx)(b,{size:`sm`,onClick:v.reload,children:`Try again`}),children:I(v.error)}):M?M.calls===0?(0,W.jsx)(C,{children:(0,W.jsx)(d,{level:2,icon:`lightbulb`,title:`No calls recorded in watch-only mode ${p.phrase}`,actions:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(h,{href:z(`/protection`,{focus:`mode`}),variant:`primary`,children:`Open protection mode`}),f!==`all`&&(0,W.jsx)(b,{variant:`secondary`,onClick:()=>E(r(s,{since:null})),children:`Show everything`})]}),children:N?.enforcement===`enforce`?`This toolbox is protecting, so calls are not recorded for suggestions. Switch it to watch-only for a while, use your AI app as you normally would, and suggestions appear here.`:`Suggestions appear after your AI app has been used for a while with the toolbox in watch-only mode. Use it as you normally would, then come back.`})}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4`,children:[(0,W.jsx)(S,{title:`Calls seen`,value:k(M.calls),sub:J(M)}),(0,W.jsx)(S,{title:`Would run`,value:k(M.wouldRun),sub:`without asking you`}),(0,W.jsx)(S,{title:`Would ask you`,value:k(M.wouldAsk),sub:`before running`,href:z(`/approvals`),hrefLabel:`Open waiting calls`}),(0,W.jsx)(S,{title:`Would be blocked`,value:k(M.wouldRefuse),sub:`had protection been on`})]}),(0,W.jsxs)(`p`,{className:`mt-3 flex items-center gap-1.5 text-[13px] text-soft`,children:[`Every one of these calls ran. The numbers say what would have happened had your rules been applied.`,(0,W.jsx)(m,{term:`watchOnly`})]}),(0,W.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,W.jsx)(X,{title:`Tools nobody has labelled yet`,empty:`Every tool that was called has a label.`,intro:M.onUnclassified===`deny`?`Nobody has said what these do, so with protection on every call to them is blocked. Label each one once.`:`Nobody has said what these do, so with protection on every call to them asks you. Label each one once.`,items:M.unclassified,nav:s,trailing:e=>(0,W.jsx)(h,{size:`sm`,variant:`secondary`,href:n(s,`/tools`,{tool:e.tool}),children:`Label tool`})}),(0,W.jsx)(X,{title:`Calls that would be blocked`,empty:`No call would have been blocked.`,intro:`A rule or setting would stop these. Change it if they should run.`,items:M.refused,nav:s,detail:e=>(0,W.jsxs)(W.Fragment,{children:[I(e.reason),` `,(0,W.jsx)(`span`,{className:`font-mono text-[11.5px]`,children:e.ruleId})]})})]}),(0,W.jsx)(`div`,{className:`mt-4`,children:(0,W.jsx)(X,{title:`Calls that would ask you`,empty:`No call would have waited for you.`,intro:`These would wait for your approval each time. Where the calls looked alike, a rule below lets the usual ones run.`,items:M.asked,nav:s,detail:e=>I(e.why),trailing:t=>t.suggested?(0,W.jsx)(e,{tone:`ok`,icon:`lightbulb`,children:`Rule suggested`}):null})}),(0,W.jsxs)(`section`,{className:`mt-8`,"aria-labelledby":`suggested-rules`,children:[(0,W.jsxs)(`header`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`h2`,{id:`suggested-rules`,className:`text-[22px] font-medium tracking-[-0.02em]`,children:`Suggested rules`}),(0,W.jsx)(m,{term:`rule`}),y.error&&!N&&(0,W.jsx)(e,{tone:`warn`,children:`Could not check which are already applied`})]}),M.rules.length===0?(0,W.jsx)(C,{children:(0,W.jsx)(d,{icon:`lightbulb`,title:`No rules to suggest`,compact:!0,children:`A rule is suggested when a tool asked you at least three times with inputs that look alike. Tools that delete things are always left to you.`})}):(0,W.jsx)(`div`,{className:`grid grid-cols-1 gap-4 xl:grid-cols-2`,children:M.rules.map(e=>(0,W.jsx)(Z,{rule:e,note:M.notes[e.id],done:P(e),canWrite:N?.policyWrite.ok??!0,onApply:()=>T(e)},e.id))})]})]}):(0,W.jsx)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4`,children:[0,1,2,3].map(e=>(0,W.jsx)(C,{children:(0,W.jsx)(i,{lines:3,height:18})},e))}),x&&(0,W.jsx)(G,{serverId:t,tenant:o,rule:x,onClose:()=>T(null),onApplied:()=>{O(e=>new Set(e).add(x.id)),y.reload()}}),A&&M&&(0,W.jsx)(Q,{serverId:t,tenant:o,rules:L,onClose:()=>j(!1),onApplied:e=>O(t=>new Set(t).add(e)),onDone:()=>{v.reload(),y.reload()}})]})}function J(e){return!e.from||!e.to?`recorded in watch-only mode`:`${new Date(e.from).toLocaleDateString(void 0,{day:`numeric`,month:`short`})} to ${new Date(e.to).toLocaleDateString(void 0,{day:`numeric`,month:`short`})}`}function Y(e,t){if(!t)return!1;let n=t.tools.find(t=>t.name===e.match);return!!n&&n.consoleRule!==null&&n.verdict.kind===e.decision}function X({title:r,intro:i,empty:a,items:o,nav:s,detail:c,trailing:l}){return(0,W.jsx)(C,{title:r,actions:(0,W.jsx)(e,{tone:`neutral`,children:t(o.length,`tool`)}),children:o.length===0?(0,W.jsx)(d,{icon:`check`,title:a,compact:!0}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`-mt-2 mb-2 text-[13px] text-soft`,children:i}),(0,W.jsx)(`div`,{className:`-my-1`,children:o.map(e=>(0,W.jsx)(f,{leading:(0,W.jsx)(`span`,{className:`grid h-10 w-10 shrink-0 place-items-center rounded-full bg-sunken`,children:(0,W.jsx)(p,{effect:e.effect})}),title:(0,W.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.tool}),sub:(0,W.jsxs)(W.Fragment,{children:[`Called `,t(e.calls,`time`),c&&(0,W.jsxs)(W.Fragment,{children:[` · `,c(e)]})]}),trailing:l?.(e)??(0,W.jsx)(h,{size:`sm`,variant:`ghost`,href:n(s,`/tools`,{tool:e.tool}),children:`Open tool`})},e.tool))})]})})}function Z({rule:t,note:n,done:r,canWrite:i,onApply:a}){let o=P(t),s=Object.entries(t.args??{});return(0,W.jsxs)(C,{as:`article`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`p`,{className:`text-[17px] leading-snug font-medium tracking-[-0.01em]`,children:[o.lead,` `,(0,W.jsx)(`span`,{className:`font-mono text-[15px] break-all`,children:o.subject}),o.rest]}),(0,W.jsx)(`p`,{className:`mt-1 font-mono text-[11.5px] text-soft`,children:t.id})]}),r?(0,W.jsx)(e,{tone:`ok`,icon:`check`,children:`Applied`}):(0,W.jsx)(b,{variant:`primary`,size:`sm`,onClick:a,disabled:!i,title:i?void 0:`The protection settings file cannot be changed from here`,children:`Apply rule`})]}),n&&(0,W.jsxs)(`p`,{className:`mt-3 text-[13px] text-muted`,children:[`Based on `,n.charAt(0).toLowerCase()+n.slice(1)]}),s.length>0&&(0,W.jsx)(`ul`,{className:`mt-3 space-y-1 rounded-2xl bg-sunken px-4 py-3 text-[13px]`,children:s.map(([e,t])=>(0,W.jsxs)(`li`,{className:`flex flex-wrap gap-x-2`,children:[(0,W.jsx)(`span`,{className:`font-mono text-[12px] text-ink`,children:e}),(0,W.jsx)(`span`,{className:`text-muted`,children:L(t)})]},e))}),(0,W.jsxs)(`details`,{className:`mt-3`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer text-[13px] font-medium text-muted select-none`,children:`Show the rule as written`}),(0,W.jsx)(`div`,{className:`mt-2`,children:(0,W.jsx)(v,{label:`Rule ${t.id}`,maxHeight:260,copy:!0,children:M(t)})})]})]})}function Q({serverId:e,tenant:n,rules:r,onClose:i,onApplied:a,onDone:o}){let s=O(),[c,l]=(0,R.useState)(()=>r.map(e=>({rule:e,state:`waiting`}))),[u,d]=(0,R.useState)(`ready`);async function f(){d(`running`);let i=(e,t)=>l(n=>n.map((n,r)=>r===e?{...n,...t}:n)),c=0;for(let[t,o]of r.entries()){i(t,{state:`checking`});try{let r=await B(e,n,o),s=V(r),l=s.refused?I(s.refused):s.loosens?`Lets calls run without asking. Apply it on its own to confirm.`:s.override||s.drop||s.destructive?`Needs your confirmation. Apply it on its own.`:null;if(l){i(t,{state:`skipped`,why:l});continue}let{warning:u}=await H(e,n,r,{});c++,a(o.id),i(t,{state:`applied`,...u?{why:I(u)}:{}})}catch(e){i(t,{state:`failed`,why:j(e)?N:I(e.message)})}}d(`done`),c>0&&s.show(`ok`,`${t(c,`rule`)} applied.`),o()}let p=c.filter(e=>e.state===`applied`).length,m=c.filter(e=>e.state===`skipped`).length,h=c.filter(e=>e.state===`failed`).length,g=c.findIndex(e=>e.state===`checking`);return(0,W.jsx)(D,{open:!0,onClose:i,dismissable:u!==`running`,width:600,title:`Apply all safe suggestions`,description:u===`ready`?`Only rules that let nothing more through than today are applied. Any that would let calls run without asking you are skipped, so you can look at each on its own.`:u===`running`?`Checking ${g+1} of ${c.length}`:`${t(p,`rule`)} applied, ${m} skipped${h?`, ${h} failed`:``}.`,footer:u===`ready`?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(b,{variant:`secondary`,onClick:i,children:`Cancel`}),(0,W.jsx)(b,{variant:`primary`,onClick:()=>void f(),children:`Check and apply ${t(c.length,`rule`)}`})]}):(0,W.jsx)(b,{variant:`primary`,onClick:i,disabled:u===`running`,loading:u===`running`,children:`Close summary`}),children:(0,W.jsx)(`ul`,{className:`space-y-2 pb-1`,"aria-live":`polite`,children:c.map(e=>(0,W.jsxs)(`li`,{className:`flex items-start gap-3 rounded-2xl bg-sunken px-3 py-2.5`,children:[(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`span`,{className:`block truncate font-mono text-[13px]`,children:e.rule.match}),e.why&&(0,W.jsx)(`span`,{className:`mt-0.5 block text-[12.5px] text-soft`,children:e.why})]}),(0,W.jsx)($,{state:e.state})]},e.rule.id))})})}function $({state:t}){return t===`applied`?(0,W.jsx)(e,{tone:`ok`,icon:`check`,children:`Applied`}):t===`skipped`?(0,W.jsx)(e,{tone:`warn`,children:`Skipped`}):t===`failed`?(0,W.jsx)(e,{tone:`bad`,icon:`x`,children:`Not applied`}):t===`checking`?(0,W.jsx)(e,{tone:`neutral`,children:`Checking`}):(0,W.jsx)(e,{tone:`neutral`,children:`Waiting`})}export{q as SuggestionsPage};
|
|
1
|
+
import{$ as e,B as t,Ct as n,Et as r,G as i,H as a,It as o,Nt as s,O as c,Ot as l,Pt as u,U as d,W as f,Z as p,_ as m,_t as h,b as g,c as _,d as v,et as y,ht as b,kt as x,mt as S,pt as C,s as w,w as T,wt as E,x as D,y as O,z as k}from"./kit-BHB_ha4i.js";import{dt as A,ft as j,ht as M,lt as N,mt as P,pn as F,pt as I,ut as L}from"./index-2otwle61.js";var R=o(),z=`Suggested from what watch-only mode recorded`;async function B(e,t,n){if(!A(n.match)&&n.effect){let r={tool:n.match,effect:n.effect,decision:n.decision,...n.args?{args:n.args}:{},...n.on_violation?{on_violation:n.on_violation}:{},...n.unknown_args?{unknown_args:n.unknown_args}:{},reason:n.reason??z};return{kind:`tool`,body:r,preview:await u.toolRulePreview(e,r,t)}}let r={...n,reason:n.reason??z};return{kind:`rules`,rule:r,preview:await u.previewRules(e,{op:`add`,rule:r,index:0},t)}}function V(e){if(e.kind===`tool`){let t=e.preview,n=t.overriddenReason;return{override:n,drop:t.dropsBounds,destructive:e.body.effect===`destructive`&&e.body.decision===`allow`,loosens:t.loosens,refused:t.writable.ok?n&&!t.overridesAllowed?`This toolbox does not let the console reverse rule ${n.ruleId}. Change it in the protection settings file instead.`:null:t.writable.why??`The protection settings file cannot be changed from here.`}}let t=e.preview;return{override:null,drop:null,destructive:!1,loosens:t.loosens,refused:t.writable.ok?t.loosens&&!t.overridesAllowed?`This toolbox lets the console tighten its rules but not loosen them.`:null:t.writable.why??`The protection settings file cannot be changed from here.`}}async function H(e,t,n,r){if(n.kind===`tool`){let i=n.preview,a={...r.override&&i.overriddenReason?{overrideDeny:i.overriddenReason.ruleId}:{},...r.drop&&i.dropsBounds?{dropBounds:!0}:{},...r.destructive?{destructiveAllow:!0}:{}};return{warning:(await u.setToolRule(e,{...n.body,expectedDigest:i.expectedDigest,...Object.keys(a).length>0?{acknowledged:a}:{}},t)).warning}}return{warning:(await u.addRule(e,n.rule,n.preview.expectedDigest,0,r.loosens?{loosens:!0}:void 0,t)).warning}}var U=e=>e instanceof s&&e.needsLoosenAck,W=x();function G({serverId:e,tenant:t,rule:n,onClose:r,onApplied:o}){let s=O(),[c,u]=(0,R.useState)(null),[d,f]=(0,R.useState)(null),[p,m]=(0,R.useState)(null),[h,_]=(0,R.useState)({override:!1,drop:!1,destructive:!1}),[x,S]=(0,R.useState)(!1),[C,w]=(0,R.useState)(!1),E=(0,R.useCallback)(()=>{u(null),f(null),m(null),_({override:!1,drop:!1,destructive:!1}),B(e,t,n).then(u).catch(e=>f(I(e.message)))},[e,t,n]);(0,R.useEffect)(E,[E]);let k=c?V(c):null,A=c!==null&&k!==null&&!k.refused&&(!k.override||h.override)&&(!k.drop||h.drop)&&(!k.destructive||h.destructive);async function M(i){if(c){w(!0),m(null);try{let{warning:a}=await H(e,t,c,{...h,loosens:i});s.show(`ok`,`Rule applied for ${n.match}.`),a&&s.show(`warn`,I(a)),o(),r()}catch(e){!i&&U(e)?S(!0):(S(!1),m(j(e)?{text:N,stale:!0}:{text:I(e.message),stale:!1}))}finally{w(!1)}}}let F=P(n);if(x&&c){let e=c.kind===`rules`?c.preview.loosenReasons.map(I):[];return(0,W.jsx)(g,{open:!0,title:`Let these calls run without asking?`,confirmLabel:`Apply rule`,busy:C,error:p?.text,onCancel:()=>S(!1),onConfirm:()=>void M(!0),consequences:e.length>0?e:[`Calls to ${n.match} that today ask you first will run on their own while their inputs look like the ones seen.`],children:`This rule lets more through than your settings do now. Calls outside what was seen still ask you or are blocked.`})}return(0,W.jsx)(D,{open:!0,onClose:r,dismissable:!C,width:600,title:`Apply suggested rule`,description:(0,W.jsxs)(W.Fragment,{children:[F.lead,` `,(0,W.jsx)(`span`,{className:`font-mono text-[13px] text-ink`,children:F.subject}),F.rest]}),footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(b,{variant:`secondary`,onClick:r,disabled:C,children:`Cancel`}),(0,W.jsx)(b,{variant:`primary`,disabled:!A,loading:C,onClick:()=>k?.loosens?S(!0):void M(!1),children:`Apply rule`})]}),children:(0,W.jsx)(`div`,{className:`space-y-4 pb-1 text-[14px]`,children:d?(0,W.jsx)(a,{tone:`danger`,title:`The rule could not be checked`,actions:(0,W.jsx)(b,{size:`sm`,onClick:E,children:`Try again`}),children:d}):!c||!k?(0,W.jsx)(i,{lines:4}):(0,W.jsxs)(W.Fragment,{children:[c.kind===`tool`?(0,W.jsxs)(`div`,{className:`rounded-2xl bg-sunken px-4 py-3`,children:[(0,W.jsx)(`p`,{className:`text-[12.5px] text-soft`,children:`What changes for this tool`}),(0,W.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Now`}),(0,W.jsx)(y,{decision:c.preview.current.kind}),(0,W.jsx)(l,{name:`arrow-right`,size:16,className:`text-soft`}),(0,W.jsx)(`span`,{className:`text-[13px] text-muted`,children:`After`}),(0,W.jsx)(y,{decision:c.preview.verdict.kind})]}),c.preview.bounds&&c.preview.verdict.kind!==`deny`&&(0,W.jsxs)(`p`,{className:`mt-2 text-[13px] text-muted`,children:[`That holds while its inputs stay within the limits below. A call outside them`,` `,c.preview.bounds.onViolation===`approve`?`asks you first`:`is blocked`,`.`]})]}):(0,W.jsxs)(`div`,{className:`rounded-2xl bg-sunken px-4 py-3`,children:[(0,W.jsx)(`p`,{className:`text-[12.5px] text-soft`,children:`What changes`}),c.preview.changes.length===0?(0,W.jsx)(`p`,{className:`mt-1 text-[13px] text-muted`,children:`No tool this toolbox serves changes how it is handled.`}):(0,W.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:c.preview.changes.map(e=>(0,W.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`font-mono text-[12.5px]`,children:e.tool}),(0,W.jsx)(y,{decision:e.before}),(0,W.jsx)(l,{name:`arrow-right`,size:14,className:`text-soft`}),(0,W.jsx)(y,{decision:e.after})]},e.tool))})]}),k.refused&&(0,W.jsx)(a,{tone:`info`,title:`This cannot be applied from here`,children:I(k.refused)}),c.kind===`tool`&&c.preview.overridden&&(0,W.jsx)(a,{tone:`warn`,children:I(c.preview.overridden)}),c.kind===`tool`&&c.preview.nameContradiction&&(0,W.jsx)(a,{tone:`warn`,children:I(c.preview.nameContradiction)}),c.kind===`tool`&&!c.preview.reloads&&(0,W.jsx)(`p`,{className:`text-[13px] text-muted`,children:`This toolbox reads its settings only when it starts, so the rule applies after a restart.`}),!k.refused&&(k.override||k.drop||k.destructive)&&(0,W.jsxs)(`div`,{className:`space-y-3 rounded-2xl border border-bad/40 px-4 py-3`,children:[k.override&&(0,W.jsx)(T,{checked:h.override,onChange:e=>_(t=>({...t,override:e})),label:`Reverse rule ${k.override.ruleId}`,description:`Someone set this tool to "${k.override.decision}" with the note "${k.override.reason}". This rule overrides that.`}),k.drop&&(0,W.jsx)(T,{checked:h.drop,onChange:e=>_(t=>({...t,drop:e})),label:`Drop the input limits this tool has today`,description:`Rule ${k.drop} limits this tool's inputs now. Those limits would no longer apply.`}),k.destructive&&(0,W.jsx)(T,{checked:h.destructive,onChange:e=>_(t=>({...t,destructive:e})),label:`Let a tool that deletes run without asking`,description:`Your AI app could remove things with nobody asked first.`})]}),p&&(0,W.jsx)(a,{tone:`danger`,role:`alert`,actions:p.stale?(0,W.jsx)(b,{size:`sm`,onClick:E,children:`Reload preview`}):void 0,children:p.text}),(0,W.jsxs)(`details`,{className:`group`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer text-[13px] font-medium text-muted select-none`,children:`Show the rule as written in the settings file`}),(0,W.jsx)(`div`,{className:`mt-2`,children:(0,W.jsx)(v,{label:`Rule as written`,maxHeight:240,children:(c.kind,c.preview.yaml??``)})})]})]})})})}var K=[{value:`24h`,label:`Last 24 hours`,ms:864e5,phrase:`in the last 24 hours`},{value:`7d`,label:`Last 7 days`,ms:6048e5,phrase:`in the last 7 days`},{value:`all`,label:`Everything`,ms:null,phrase:`so far`}];function q(){let{serverId:t,tenant:o,nav:s}=F(),l=s.query.get(`since`),f=l===`24h`||l===`7d`?l:`all`,p=K.find(e=>e.value===f),g=(0,R.useMemo)(()=>p.ms?new Date(Date.now()-p.ms).toISOString():void 0,[p]),v=w(()=>u.suggestions(t,g),[t,g]),y=w(()=>u.protection(t,o),[t,o]),[x,T]=(0,R.useState)(null),[D,O]=(0,R.useState)(new Set),[A,j]=(0,R.useState)(!1),M=v.data,N=y.data,P=e=>D.has(e.id)||Y(e,N),L=M?M.rules.filter(e=>!P(e)):[],z=(e,t={})=>n(s,e,t);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(_,{title:`Suggestions`,subtitle:`Rules drawn from what your AI app did while the toolbox was in watch-only mode.`,actions:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(c,{size:`sm`,label:`Calls since`,value:f,onChange:e=>E(r(s,{since:e===`all`?null:e})),options:K.map(e=>({value:e.value,label:e.label}))}),M&&M.rules.length>0&&(0,W.jsx)(b,{variant:`primary`,icon:`check`,disabled:L.length===0,onClick:()=>j(!0),children:`Apply all safe suggestions`})]})}),N?.enforcement===`enforce`&&M&&M.calls>0&&(0,W.jsx)(`div`,{className:`mb-4`,children:(0,W.jsx)(a,{tone:`info`,title:`This toolbox is protecting`,children:`Suggestions come from calls recorded in watch-only mode. Those already recorded are shown below; new calls add nothing here until the toolbox is in watch-only mode again.`})}),v.error&&!M?(0,W.jsx)(a,{tone:`danger`,title:`The suggestions could not be loaded`,actions:(0,W.jsx)(b,{size:`sm`,onClick:v.reload,children:`Try again`}),children:I(v.error)}):M?M.calls===0?(0,W.jsx)(C,{children:(0,W.jsx)(d,{level:2,icon:`lightbulb`,title:`No calls recorded in watch-only mode ${p.phrase}`,actions:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(h,{href:z(`/protection`,{focus:`mode`}),variant:`primary`,children:`Open protection mode`}),f!==`all`&&(0,W.jsx)(b,{variant:`secondary`,onClick:()=>E(r(s,{since:null})),children:`Show everything`})]}),children:N?.enforcement===`enforce`?`This toolbox is protecting, so calls are not recorded for suggestions. Switch it to watch-only for a while, use your AI app as you normally would, and suggestions appear here.`:`Suggestions appear after your AI app has been used for a while with the toolbox in watch-only mode. Use it as you normally would, then come back.`})}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4`,children:[(0,W.jsx)(S,{title:`Calls seen`,value:k(M.calls),sub:J(M)}),(0,W.jsx)(S,{title:`Would run`,value:k(M.wouldRun),sub:`without asking you`}),(0,W.jsx)(S,{title:`Would ask you`,value:k(M.wouldAsk),sub:`before running`,href:z(`/approvals`),hrefLabel:`Open waiting calls`}),(0,W.jsx)(S,{title:`Would be blocked`,value:k(M.wouldRefuse),sub:`had protection been on`})]}),(0,W.jsxs)(`p`,{className:`mt-3 flex items-center gap-1.5 text-[13px] text-soft`,children:[`Every one of these calls ran. The numbers say what would have happened had your rules been applied.`,(0,W.jsx)(m,{term:`watchOnly`})]}),(0,W.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,W.jsx)(X,{title:`Tools nobody has labelled yet`,empty:`Every tool that was called has a label.`,intro:M.onUnclassified===`deny`?`Nobody has said what these do, so with protection on every call to them is blocked. Label each one once.`:`Nobody has said what these do, so with protection on every call to them asks you. Label each one once.`,items:M.unclassified,nav:s,trailing:e=>(0,W.jsx)(h,{size:`sm`,variant:`secondary`,href:n(s,`/tools`,{tool:e.tool}),children:`Label tool`})}),(0,W.jsx)(X,{title:`Calls that would be blocked`,empty:`No call would have been blocked.`,intro:`A rule or setting would stop these. Change it if they should run.`,items:M.refused,nav:s,detail:e=>(0,W.jsxs)(W.Fragment,{children:[I(e.reason),` `,(0,W.jsx)(`span`,{className:`font-mono text-[11.5px]`,children:e.ruleId})]})})]}),(0,W.jsx)(`div`,{className:`mt-4`,children:(0,W.jsx)(X,{title:`Calls that would ask you`,empty:`No call would have waited for you.`,intro:`These would wait for your approval each time. Where the calls looked alike, a rule below lets the usual ones run.`,items:M.asked,nav:s,detail:e=>I(e.why),trailing:t=>t.suggested?(0,W.jsx)(e,{tone:`ok`,icon:`lightbulb`,children:`Rule suggested`}):null})}),(0,W.jsxs)(`section`,{className:`mt-8`,"aria-labelledby":`suggested-rules`,children:[(0,W.jsxs)(`header`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`h2`,{id:`suggested-rules`,className:`text-[22px] font-medium tracking-[-0.02em]`,children:`Suggested rules`}),(0,W.jsx)(m,{term:`rule`}),y.error&&!N&&(0,W.jsx)(e,{tone:`warn`,children:`Could not check which are already applied`})]}),M.rules.length===0?(0,W.jsx)(C,{children:(0,W.jsx)(d,{icon:`lightbulb`,title:`No rules to suggest`,compact:!0,children:`A rule is suggested when a tool asked you at least three times with inputs that look alike. Tools that delete things are always left to you.`})}):(0,W.jsx)(`div`,{className:`grid grid-cols-1 gap-4 xl:grid-cols-2`,children:M.rules.map(e=>(0,W.jsx)(Z,{rule:e,note:M.notes[e.id],done:P(e),canWrite:N?.policyWrite.ok??!0,onApply:()=>T(e)},e.id))})]})]}):(0,W.jsx)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4`,children:[0,1,2,3].map(e=>(0,W.jsx)(C,{children:(0,W.jsx)(i,{lines:3,height:18})},e))}),x&&(0,W.jsx)(G,{serverId:t,tenant:o,rule:x,onClose:()=>T(null),onApplied:()=>{O(e=>new Set(e).add(x.id)),y.reload()}}),A&&M&&(0,W.jsx)(Q,{serverId:t,tenant:o,rules:L,onClose:()=>j(!1),onApplied:e=>O(t=>new Set(t).add(e)),onDone:()=>{v.reload(),y.reload()}})]})}function J(e){return!e.from||!e.to?`recorded in watch-only mode`:`${new Date(e.from).toLocaleDateString(void 0,{day:`numeric`,month:`short`})} to ${new Date(e.to).toLocaleDateString(void 0,{day:`numeric`,month:`short`})}`}function Y(e,t){if(!t)return!1;let n=t.tools.find(t=>t.name===e.match);return!!n&&n.consoleRule!==null&&n.verdict.kind===e.decision}function X({title:r,intro:i,empty:a,items:o,nav:s,detail:c,trailing:l}){return(0,W.jsx)(C,{title:r,actions:(0,W.jsx)(e,{tone:`neutral`,children:t(o.length,`tool`)}),children:o.length===0?(0,W.jsx)(d,{icon:`check`,title:a,compact:!0}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`-mt-2 mb-2 text-[13px] text-soft`,children:i}),(0,W.jsx)(`div`,{className:`-my-1`,children:o.map(e=>(0,W.jsx)(f,{leading:(0,W.jsx)(`span`,{className:`grid h-10 w-10 shrink-0 place-items-center rounded-full bg-sunken`,children:(0,W.jsx)(p,{effect:e.effect})}),title:(0,W.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.tool}),sub:(0,W.jsxs)(W.Fragment,{children:[`Called `,t(e.calls,`time`),c&&(0,W.jsxs)(W.Fragment,{children:[` · `,c(e)]})]}),trailing:l?.(e)??(0,W.jsx)(h,{size:`sm`,variant:`ghost`,href:n(s,`/tools`,{tool:e.tool}),children:`Open tool`})},e.tool))})]})})}function Z({rule:t,note:n,done:r,canWrite:i,onApply:a}){let o=P(t),s=Object.entries(t.args??{});return(0,W.jsxs)(C,{as:`article`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`p`,{className:`text-[17px] leading-snug font-medium tracking-[-0.01em]`,children:[o.lead,` `,(0,W.jsx)(`span`,{className:`font-mono text-[15px] break-all`,children:o.subject}),o.rest]}),(0,W.jsx)(`p`,{className:`mt-1 font-mono text-[11.5px] text-soft`,children:t.id})]}),r?(0,W.jsx)(e,{tone:`ok`,icon:`check`,children:`Applied`}):(0,W.jsx)(b,{variant:`primary`,size:`sm`,onClick:a,disabled:!i,title:i?void 0:`The protection settings file cannot be changed from here`,children:`Apply rule`})]}),n&&(0,W.jsxs)(`p`,{className:`mt-3 text-[13px] text-muted`,children:[`Based on `,n.charAt(0).toLowerCase()+n.slice(1)]}),s.length>0&&(0,W.jsx)(`ul`,{className:`mt-3 space-y-1 rounded-2xl bg-sunken px-4 py-3 text-[13px]`,children:s.map(([e,t])=>(0,W.jsxs)(`li`,{className:`flex flex-wrap gap-x-2`,children:[(0,W.jsx)(`span`,{className:`font-mono text-[12px] text-ink`,children:e}),(0,W.jsx)(`span`,{className:`text-muted`,children:L(t)})]},e))}),(0,W.jsxs)(`details`,{className:`mt-3`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer text-[13px] font-medium text-muted select-none`,children:`Show the rule as written`}),(0,W.jsx)(`div`,{className:`mt-2`,children:(0,W.jsx)(v,{label:`Rule ${t.id}`,maxHeight:260,copy:!0,children:M(t)})})]})]})}function Q({serverId:e,tenant:n,rules:r,onClose:i,onApplied:a,onDone:o}){let s=O(),[c,l]=(0,R.useState)(()=>r.map(e=>({rule:e,state:`waiting`}))),[u,d]=(0,R.useState)(`ready`);async function f(){d(`running`);let i=(e,t)=>l(n=>n.map((n,r)=>r===e?{...n,...t}:n)),c=0;for(let[t,o]of r.entries()){i(t,{state:`checking`});try{let r=await B(e,n,o),s=V(r),l=s.refused?I(s.refused):s.loosens?`Lets calls run without asking. Apply it on its own to confirm.`:s.override||s.drop||s.destructive?`Needs your confirmation. Apply it on its own.`:null;if(l){i(t,{state:`skipped`,why:l});continue}let{warning:u}=await H(e,n,r,{});c++,a(o.id),i(t,{state:`applied`,...u?{why:I(u)}:{}})}catch(e){i(t,{state:`failed`,why:j(e)?N:I(e.message)})}}d(`done`),c>0&&s.show(`ok`,`${t(c,`rule`)} applied.`),o()}let p=c.filter(e=>e.state===`applied`).length,m=c.filter(e=>e.state===`skipped`).length,h=c.filter(e=>e.state===`failed`).length,g=c.findIndex(e=>e.state===`checking`);return(0,W.jsx)(D,{open:!0,onClose:i,dismissable:u!==`running`,width:600,title:`Apply all safe suggestions`,description:u===`ready`?`Only rules that let nothing more through than today are applied. Any that would let calls run without asking you are skipped, so you can look at each on its own.`:u===`running`?`Checking ${g+1} of ${c.length}`:`${t(p,`rule`)} applied, ${m} skipped${h?`, ${h} failed`:``}.`,footer:u===`ready`?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(b,{variant:`secondary`,onClick:i,children:`Cancel`}),(0,W.jsx)(b,{variant:`primary`,onClick:()=>void f(),children:`Check and apply ${t(c.length,`rule`)}`})]}):(0,W.jsx)(b,{variant:`primary`,onClick:i,disabled:u===`running`,loading:u===`running`,children:`Close summary`}),children:(0,W.jsx)(`ul`,{className:`space-y-2 pb-1`,"aria-live":`polite`,children:c.map(e=>(0,W.jsxs)(`li`,{className:`flex items-start gap-3 rounded-2xl bg-sunken px-3 py-2.5`,children:[(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`span`,{className:`block truncate font-mono text-[13px]`,children:e.rule.match}),e.why&&(0,W.jsx)(`span`,{className:`mt-0.5 block text-[12.5px] text-soft`,children:e.why})]}),(0,W.jsx)($,{state:e.state})]},e.rule.id))})})}function $({state:t}){return t===`applied`?(0,W.jsx)(e,{tone:`ok`,icon:`check`,children:`Applied`}):t===`skipped`?(0,W.jsx)(e,{tone:`warn`,children:`Skipped`}):t===`failed`?(0,W.jsx)(e,{tone:`bad`,icon:`x`,children:`Not applied`}):t===`checking`?(0,W.jsx)(e,{tone:`neutral`,children:`Checking`}):(0,W.jsx)(e,{tone:`neutral`,children:`Waiting`})}export{q as SuggestionsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,A as t,B as n,Ct as r,D as i,E as a,Et as o,G as s,H as c,I as l,It as u,J as d,M as f,N as p,Nt as m,O as h,Ot as g,Pt as _,Q as v,S as y,U as b,V as x,Y as S,Z as C,_ as w,_t as T,bt as ee,c as te,d as ne,et as E,f as re,ft as ie,gt as ae,ht as D,k as oe,kt as O,lt as se,ot as k,pt as A,q as ce,rt as j,s as le,st as M,w as N,wt as P,x as F,y as I,yt as L}from"./kit-BHB_ha4i.js";import{r as R,t as z}from"./server-name-D9u6r07i.js";import{Sn as ue,Tn as B,_n as V,cn as H,hn as de,pn as U,rn as fe,s as W,vn as pe,xn as G}from"./index-
|
|
1
|
+
import{$ as e,A as t,B as n,Ct as r,D as i,E as a,Et as o,G as s,H as c,I as l,It as u,J as d,M as f,N as p,Nt as m,O as h,Ot as g,Pt as _,Q as v,S as y,U as b,V as x,Y as S,Z as C,_ as w,_t as T,bt as ee,c as te,d as ne,et as E,f as re,ft as ie,gt as ae,ht as D,k as oe,kt as O,lt as se,ot as k,pt as A,q as ce,rt as j,s as le,st as M,w as N,wt as P,x as F,y as I,yt as L}from"./kit-BHB_ha4i.js";import{r as R,t as z}from"./server-name-D9u6r07i.js";import{Sn as ue,Tn as B,_n as V,cn as H,hn as de,pn as U,rn as fe,s as W,vn as pe,xn as G}from"./index-2otwle61.js";import{F as me,P as he,h as ge,v as _e}from"./connect-app-words-B_5RQcK_.js";var K=u(),ve=[`allow`,`approve`,`deny`,`unlabelled`,`off`,`changed`],ye={allow:`Runs freely`,approve:`Asks you first`,deny:`Blocked`,unlabelled:`Not labelled`,off:`Turned off`,changed:`Changed`};function be(e){return e!==null&&ve.includes(e)}function xe(e){return e.exposure.disabled?`off`:e.effect===null&&!e.reclassifiedTo?`unlabelled`:e.verdict.kind}function q(e){let t=e.reclassifiedTo??e.effect;return t===`read`||t===`write`||t===`destructive`?t:null}function Se(e){return e.standingGrants.some(e=>e.covers)}function Ce(e){if(e.exposure.disabled)return`Turned off. Your AI can't see it, and every call to it is blocked.`;if(e.hiddenByPolicy)return`Hidden from your AI, because its description carried hidden instructions.`;let t=e.effect===null&&!e.reclassifiedTo;if(e.unreachable)return`Asks you first, but approvals are switched off, so it can never run.`;if(t)return e.verdict.kind===`approve`?`Asks you first, because nobody has said what it does yet.`:`Blocked, because nobody has said what it does yet.`;if(e.verdict.kind===`deny`)return`Blocked. Your AI can see it, but every call to it is refused.`;let n=e.bounds,r=Ie(e,n);return r.length>0?`Every call ${n.unknownArgs===`approve`?`asks you first`:`is blocked`}, because ${Ne(r)} ${r.length===1?`is`:`are`} required and its limits don't mention ${r.length===1?`it`:`them`}.`:e.verdict.kind===`approve`?n?n.onViolation===`approve`?`Asks you first before it runs. Its inputs also have limits, listed below.`:`Asks you first before it runs, and a call that breaks the limits below is blocked.`:`Asks you first before it runs.`:n?`Runs freely while its inputs stay within the limits below. A call outside them ${we(n.onViolation)}.`:`Runs freely, without asking anyone.`}function we(e){return e===`approve`?`asks you first`:`is blocked`}function Te(e,t){let n=[];return t&&n.push({key:`changed`,text:`Changed`,tone:`warn`}),e.injection&&e.injection.length>0&&n.push({key:`inj`,text:`Hidden instructions found`,tone:`bad`}),e.unreachable&&n.push({key:`unreach`,text:`Can never run`,tone:`bad`}),e.bounds&&n.push({key:`bounds`,text:`Has limits`,tone:`neutral`}),e.unboundedInputs.length>0&&n.push({key:`unbounded`,text:`Some inputs unlimited`,tone:`neutral`}),Se(e)&&n.push({key:`grant`,text:`Pre-approved`,tone:`ok`}),n}function Ee(e,t){let{ruleId:n,reason:r,kind:i}=e,a=i===`allow`?`runs freely`:i===`approve`?`asks you first`:`is blocked`;return n===`exposure.disabled`?`Someone turned this tool off.`:n.startsWith(`tenant.`)?`The customer check stopped it: ${J(r)}`:n===`defaults.on_unclassified`?`Nobody has said what it does, and your setting for unlabelled tools is that they ${i===`approve`?`ask you first`:`are blocked`}.`:n===`defaults.mode`?t?`No rule mentions it, so it comes down to how careful the toolbox is: it is set to “${M[t].label}”. ${M[t].explain}`:`No rule mentions it, so it comes down to how careful the toolbox is.`:/^rule ".*" \(.*\) says (allow|approve|deny) for /.test(r)?`A rule in your protection settings says it ${a}.`:`A rule in your protection settings says it ${a}, because: “${r}”`}var De={policy:`A rule in your protection settings says what it does.`,annotation:`The connected server describes it this way. Nothing in your settings overrides it.`,name:`Guessed from the tool's name.`,unclassified:`Nobody has said what it does.`},Oe={max:`At most`,min:`At least`,enum:`Must be one of`,maxLength:`Longest text`,maxItems:`Most items`,within:`Must stay inside folder`,host:`Allowed websites`};function ke(e){return e===`number`||e===`integer`?[`max`,`min`,`enum`]:e===`string`?[`enum`,`maxLength`,`within`,`host`]:e===`array`?[`maxItems`]:e===`boolean`?[`enum`]:[`max`,`min`,`enum`,`maxLength`,`maxItems`,`within`,`host`]}function Ae(e){return e.pattern!==void 0||e.coerce!==void 0||e.required!==void 0}function je(e){let t=[];if(e.min!==void 0&&t.push(`at least ${e.min}`),e.max!==void 0&&t.push(`at most ${e.max}`),e.maxLength!==void 0&&t.push(`at most ${e.maxLength} characters`),e.maxItems!==void 0&&t.push(`at most ${e.maxItems} items`),e.sum_max!==void 0&&t.push(`${e.sum_max} in total`),e.count_max!==void 0&&t.push(`in at most ${e.count_max} places`),e.enum&&t.push(`one of ${e.enum.map(String).join(`, `)}`),e.const===null?t.push(`only empty (null)`):e.const!==void 0&&t.push(`exactly ${String(e.const)}`),e.within&&t.push(`inside ${typeof e.within==`string`?e.within:e.within.join(` or `)}`),e.host&&t.push(`a web address on ${e.host.join(`, `)}`),e.pattern&&t.push(`matching a pattern set in the settings file`),Object.keys(e).every(e=>e===`optional`))return`may be any value`;let n=t.length?`must be ${t.join(`, `)}`:`is limited`;return e.optional?`${n}, or left out`:n}function Me(e){return e?e.paths.map(t=>`${t} ${je(e.constraints[t]??{})}`):[]}function Ne(e){return e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`}function Pe(e){return/^[^.[\]]*/.exec(e)[0]}function Fe(e,t){let n=[];for(let r of e.args){if(t.includes(r.name))continue;let e=t.filter(e=>Pe(e)===r.name);n.push({name:r.name,required:r.required&&e.length===0,only:e.length>0?e:null,list:r.type===`array`})}return[...n.filter(e=>e.required),...n.filter(e=>!e.required&&!e.only),...n.filter(e=>e.only)]}function Ie(e,t){return!t||t.unknownArgs===`allow`?[]:Fe(e,t.paths).filter(e=>e.required).map(e=>e.name)}var Le={allow:`Anything else the tool is sent is let through without a check.`,approve:`A call sending anything else asks you first.`,deny:`A call sending anything else is blocked.`};function J(e){let t=e.split(/(?<=[.;])\s+/).filter(e=>!/\b(hmcp-gateway|hmcp|npx)\s+[a-z]/i.test(e)&&!/(^|\s)--[a-z][\w-]*/.test(e)),n=(t.length?t:[`The toolbox refused this change.`]).join(` `).replace(/`/g,``);return n.charAt(0).toUpperCase()+n.slice(1)}function Y(e){return J(e instanceof Error?e.message:String(e))}function Re(e){return e instanceof m&&e.status===409}var ze=`This changed since you opened it. Reload and try again.`;function Be(e,t=64){return e.split(`
|
|
2
2
|
`).map(e=>{let n=[],r=``;for(let i of e.split(/\s+/))r&&r.length+i.length+1>t?(n.push(r),r=i):r=r?`${r} ${i}`:i;return n.push(r),n.join(`
|
|
3
3
|
`)}).join(`
|
|
4
4
|
`)}var X=O(),Ve={effect:`What it does (looks, changes or deletes)`,description:`Its description`,"input schema":`The inputs it takes`,annotations:`The hints its server gives about it`};function He(e){return e.previousKnown?e.changes.length===0?[`Its details changed.`]:e.changes.map(e=>Ve[e]??e):[`Something changed, but the earlier version wasn't kept, so the toolbox can't show what.`]}function Ue({serverId:e,data:t,error:r,loading:i,reload:a,onAccepted:o}){let l=I(),[u,d]=(0,K.useState)(null),[f,p]=(0,K.useState)(!1),[m,h]=(0,K.useState)(null),[g,_]=(0,K.useState)(!1);async function v(t){p(!0);try{let n=t?await pe(e,t):await V(e);l.show(`ok`,n.accepted.length===1?`Accepted the change to ${n.accepted[0]}.`:`Accepted ${n.accepted.length} changed tools.`),d(null),n.restartNeeded&&(h(`checking`),G(e).then(h,()=>h(null))),a(),o()}catch(e){l.show(`bad`,`Not accepted. ${Y(e)}`)}finally{p(!1)}}async function y(){_(!0);try{let t=await B(e);l.show(`ok`,`The toolbox restarted. Accepted tools are available again.`),t.warning&&l.show(`warn`,J(t.warning)),h(null),a(),o()}catch(e){l.show(`bad`,`The toolbox didn't restart. ${Y(e)}`)}finally{_(!1)}}if(r&&!t)return(0,X.jsx)(c,{tone:`danger`,title:`Changed tools couldn't be loaded`,actions:(0,X.jsx)(D,{size:`sm`,icon:`refresh`,onClick:a,children:`Try again`}),children:Y(r)});if(!t)return(0,X.jsx)(A,{children:(0,X.jsx)(s,{lines:5})});let S=t.changed;return(0,X.jsxs)(`div`,{className:`space-y-5`,children:[m&&(0,X.jsx)(c,{tone:`warn`,title:`Restart the toolbox to bring accepted tools back`,actions:m!==`checking`&&m.managed&&(0,X.jsx)(D,{variant:`primary`,size:`sm`,icon:`refresh`,loading:g,onClick:()=>void y(),children:`Restart toolbox`}),children:m===`checking`?`Checking how this toolbox is running…`:m.managed?`Some accepted tools were held back from your AI. They come back once the toolbox restarts.`:m.externalHint?`Some accepted tools were held back from your AI. ${J(m.externalHint.replace(/\s+--\s+/g,`, `))}`:`Some accepted tools were held back from your AI. They come back the next time the AI app that runs this toolbox starts it again, so restart that app.`}),!t.live&&(0,X.jsx)(c,{tone:`warn`,title:`The toolbox isn't running, so changes can't be checked right now`,children:`The list below is what it reported last time. Changes can be accepted once it is running again.`}),(0,X.jsxs)(A,{title:(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[`Changed tools `,(0,X.jsx)(w,{term:`changedTools`})]}),actions:S.length>1&&(0,X.jsx)(D,{size:`sm`,variant:`primary`,icon:`check`,disabled:!t.live,onClick:()=>d({tool:null}),children:`Accept all`}),children:[(0,X.jsx)(`p`,{className:`-mt-2 mb-4 text-[13.5px] text-soft`,children:t.onToolChange===`deny`?`A changed tool is held back from your AI until you accept it.`:`A changed tool keeps working, and the change is noted in the activity log until you accept it.`}),S.length===0?(0,X.jsx)(b,{icon:`shield-check`,title:`No tools have changed`,compact:!0,children:`Every tool matches what was accepted before. The toolbox checks again each time it starts and when a connected server updates its list.`}):(0,X.jsx)(`ul`,{className:`space-y-3`,children:S.map(e=>(0,X.jsx)(We,{change:e,live:t.live,loading:i,onAccept:()=>d({tool:e.tool})},e.tool))})]}),t.pins.length>0&&(0,X.jsx)(A,{padded:!1,children:(0,X.jsxs)(`details`,{className:`group p-6`,children:[(0,X.jsxs)(`summary`,{className:`flex cursor-pointer items-center justify-between gap-3 text-[17px] font-medium tracking-[-0.015em]`,children:[`Reviewed tools`,(0,X.jsx)(`span`,{className:`text-[13px] font-normal text-soft`,children:n(t.pins.length,`tool`)})]}),(0,X.jsx)(`p`,{className:`mt-2 text-[13.5px] text-soft`,children:`The version of each tool that was last accepted. A tool is compared against this every time the toolbox sees it.`}),(0,X.jsx)(`ul`,{className:`mt-3 divide-y divide-faint`,children:t.pins.map(e=>(0,X.jsxs)(`li`,{className:`flex flex-wrap items-baseline justify-between gap-x-4 gap-y-0.5 py-2.5`,children:[(0,X.jsx)(`code`,{className:`font-mono text-[13.5px] break-all`,children:e.tool}),(0,X.jsxs)(`span`,{className:`text-[12.5px] text-soft`,children:[`Accepted `,x(e.pinnedAt),` by `,e.pinnedBy,(0,X.jsx)(`span`,{className:`ml-2 font-mono text-[11px]`,children:e.digest.slice(0,12)})]})]},e.tool))})]})}),(0,X.jsx)(F,{open:u!==null,onClose:()=>d(null),title:u?.tool?`Accept the change to ${u.tool}?`:`Accept all ${S.length} changed tools?`,description:`Accepting means you've looked at what changed and you're fine with it. The new version becomes the one future changes are compared against.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(D,{variant:`secondary`,onClick:()=>d(null),disabled:f,children:`Cancel`}),(0,X.jsx)(D,{variant:`primary`,icon:`check`,loading:f,onClick:()=>void v(u?.tool??null),children:u?.tool?`Accept change`:`Accept all`})]}),children:(0,X.jsxs)(`p`,{className:`text-[14px] text-muted`,children:[`Accepting doesn't change what the tool is allowed to do. Your rules still decide that.`,t.onToolChange===`deny`&&` A tool that was held back becomes available again after the toolbox restarts.`]})})]})}function We({change:t,live:n,loading:r,onAccept:i}){let a=t.was;return(0,X.jsxs)(`li`,{className:`rounded-[20px] border border-line p-4 sm:p-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`code`,{className:`font-mono text-[14.5px] font-medium break-all`,children:t.tool}),t.withheld?(0,X.jsx)(e,{tone:`bad`,icon:`lock`,children:`Held back until reviewed`}):(0,X.jsx)(e,{tone:`warn`,icon:`refresh`,children:`Changed`})]}),(0,X.jsxs)(`p`,{className:`mt-1 text-[12.5px] text-soft`,children:[`Noticed `,x(t.detectedAt),` · last accepted `,x(t.pinnedAt),` by `,t.pinnedBy]})]}),(0,X.jsx)(D,{size:`sm`,variant:`primary`,icon:`check`,onClick:i,disabled:!n||r,children:`Accept change`})]}),(0,X.jsx)(`ul`,{className:`mt-3 space-y-1`,children:He(t).map(e=>(0,X.jsxs)(`li`,{className:`flex gap-2 text-[13.5px]`,children:[(0,X.jsx)(`span`,{className:`mt-[8px] h-1.5 w-1.5 shrink-0 rounded-full bg-warn`,"aria-hidden":!0}),e]},e))}),a&&(0,X.jsxs)(`details`,{className:`mt-3`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer text-[13px] font-semibold text-soft`,children:`See what changed`}),(0,X.jsxs)(`div`,{className:`mt-3 space-y-4`,children:[a.effect!==t.now.effect&&(0,X.jsxs)(`p`,{className:`text-[13.5px]`,children:[`What it does: `,(0,X.jsx)(`strong`,{children:j[a.effect??`unknown`].label}),` →`,` `,(0,X.jsx)(`strong`,{children:j[t.now.effect??`unknown`].label})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`mb-1.5 text-[12.5px] font-semibold text-soft`,children:`Description`}),(0,X.jsx)(re,{before:Be(a.description),after:Be(t.now.description),label:`Description of ${t.tool}, before and after`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`mb-1.5 text-[12.5px] font-semibold text-soft`,children:`Inputs`}),(0,X.jsx)(re,{before:JSON.stringify(a.inputSchema??{},null,2),after:JSON.stringify(t.now.inputSchema??{},null,2),label:`Inputs of ${t.tool}, before and after`})]}),JSON.stringify(a.annotations)!==JSON.stringify(t.now.annotations)&&(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`mb-1.5 text-[12.5px] font-semibold text-soft`,children:`Hints from its server`}),(0,X.jsx)(re,{before:JSON.stringify(a.annotations??{},null,2),after:JSON.stringify(t.now.annotations??{},null,2),label:`Hints for ${t.tool}, before and after`})]})]})]})]})}function Ge(e){return e?e.surface.neverPublished?`This toolbox hasn't reported its tools yet. Start it once, then you can turn tools off here.`:e.surface.live?null:`The toolbox isn't running, so this list can't be confirmed as current. Start the toolbox to turn tools on or off.`:null}function Ke(e){let t=I(),[n,r]=(0,K.useState)(null),[i,a]=(0,K.useState)(null),o=Ge(e.protection);async function s(n,i,a){r(n.name);try{let r=await _.setExposure(e.serverId,n.name,i,a,e.tenant);return t.show(`ok`,i?`${n.name} is turned off. Your AI can't see it or use it.`:`${n.name} is back on. The normal rules decide what it may do.`),r.warning&&t.show(`warn`,Y(r.warning)),e.onChanged(),!0}catch(e){return t.show(`bad`,`${n.name} was not changed. ${Y(e)}`),!1}finally{r(null)}}function c(e,t,n=``){let r=q(e);!t&&(r===`write`||r===`destructive`)?a({tool:e,reason:n}):s(e,t,n)}let l=i,u=l?l.tool.verdict.kind===`allow`?`run freely, without asking anyone`:l.tool.verdict.kind===`approve`?`ask you first every time`:`still be blocked`:``;return{blocked:o,busy:e=>n===e,set:c,dialog:(0,X.jsx)(F,{open:l!==null,onClose:()=>a(null),title:l?`Turn ${l.tool.name} back on?`:``,description:`Turning a tool on doesn't allow it. It goes back to following your normal rules.`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(D,{variant:`secondary`,onClick:()=>a(null),children:`Keep it off`}),(0,X.jsx)(D,{variant:`primary`,icon:`power`,loading:n===l?.tool.name,onClick:async()=>{l&&await s(l.tool,!1,l.reason)&&a(null)},children:`Turn tool on`})]}),children:l&&(0,X.jsxs)(`div`,{className:`space-y-3 text-[14px] text-muted`,children:[(0,X.jsxs)(`p`,{children:[`This tool `,q(l.tool)===`destructive`?`deletes things`:`makes changes`,`. Under your rules today it would `,(0,X.jsx)(`strong`,{className:`text-ink`,children:u}),` (`,se(l.tool.verdict.kind),`).`]}),(0,X.jsx)(`p`,{children:`The change is written to the activity log and takes effect on the next call.`})]})})}}var qe=[{value:`deny`,label:`Block them`,hint:`A tool nobody has labelled can't run at all until someone says what it does.`,icon:`x`},{value:`approve`,label:`Ask me first`,hint:`Each call to an unlabelled tool waits for you to approve it, so a new tool is a question rather than a wall.`,icon:`clock`}];function Je({open:e,serverId:t,tenant:n,protection:r,onClose:i,onSaved:a,onReload:o}){let s=I(),l=r.onUnclassified===`approve`?`approve`:`deny`,[u,d]=(0,K.useState)(l),[f,p]=(0,K.useState)(!1),[m,h]=(0,K.useState)(null),v=r.policyWrite,y=r.surface.unclassifiedCount;async function b(){p(!0),h(null);try{let e=await _.setUnclassifiedPosture(t,u,v.digest,n);s.show(`ok`,u===`approve`?`Unlabelled tools now ask you first. The toolbox applies this within about a second.`:`Unlabelled tools are now blocked. The toolbox applies this within about a second.`),e.warning&&s.show(`warn`,J(e.warning)),a(),i()}catch(e){h({text:Re(e)?ze:Y(e),stale:Re(e)})}finally{p(!1)}}return(0,X.jsx)(F,{open:e,onClose:i,title:`What happens to unlabelled tools`,description:(0,X.jsxs)(X.Fragment,{children:[`A tool is unlabelled when nobody has said whether it looks, makes changes or deletes.`,` `,y>0?`${y===1?`One tool on this toolbox is`:`${y} tools on this toolbox are`} unlabelled right now.`:`Every tool on this toolbox is labelled right now, so this only affects tools that appear later.`]}),width:560,footer:(0,X.jsxs)(X.Fragment,{children:[m?.stale&&(0,X.jsx)(D,{variant:`ghost`,icon:`refresh`,className:`mr-auto`,onClick:()=>{h(null),o()},children:`Reload`}),(0,X.jsx)(D,{variant:`secondary`,onClick:i,disabled:f,children:`Cancel`}),(0,X.jsx)(D,{variant:`primary`,onClick:()=>void b(),disabled:!v.ok||u===l,loading:f,children:`Save setting`})]}),children:(0,X.jsxs)(`div`,{className:`space-y-4 text-[14px]`,children:[(0,X.jsx)(`div`,{role:`radiogroup`,"aria-label":`What happens to unlabelled tools`,className:`space-y-2`,children:qe.map(e=>{let t=u===e.value;return(0,X.jsxs)(`label`,{className:L(`flex cursor-pointer gap-3 rounded-[18px] border-[1.5px] p-4 transition-colors has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-[var(--focus)]`,t?`border-primary bg-ok-tint`:`border-line hover:border-[var(--soft)]`),children:[(0,X.jsx)(`input`,{type:`radio`,name:`unlabelled`,checked:t,onChange:()=>d(e.value),className:`sr-only`}),(0,X.jsx)(g,{name:e.icon,size:20,strokeWidth:2,className:L(`mt-0.5 shrink-0`,t?`text-ok`:`text-soft`)}),(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-2 font-semibold`,children:[e.label,e.value===l&&(0,X.jsx)(`span`,{className:`text-[12px] font-medium text-soft`,children:`current setting`})]}),(0,X.jsx)(`span`,{className:`mt-0.5 block text-[13px] text-soft`,children:e.hint})]})]},e.value)})}),(0,X.jsxs)(`p`,{className:`text-[13px] text-soft`,children:[`Either way, nothing unlabelled runs without you. Labelling a tool, from its panel, is how it starts following your normal rules. `,(0,X.jsx)(`code`,{className:`font-mono text-[11.5px]`,children:`defaults.on_unclassified`})]}),!v.ok&&(0,X.jsx)(c,{tone:`warn`,title:`This toolbox's settings can't be changed from here`,children:J(v.why??`The settings file is not writable.`)}),m&&(0,X.jsx)(`p`,{role:`alert`,className:`text-[13.5px] font-medium text-bad`,children:m.text})]})})}function Ye({tools:t,watching:n}){let r=de(),i=[...new Set(t.map(e=>e.upstream))].sort();return(0,X.jsx)(`div`,{className:`flex flex-col gap-4`,children:i.map(i=>(0,X.jsx)(A,{title:r(i),children:(0,X.jsx)(`ul`,{className:`flex flex-col`,"aria-label":`Tools from ${r(i)}`,children:t.filter(e=>e.upstream===i).map(t=>(0,X.jsxs)(`li`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-faint py-2.5 last:border-b-0`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:`block text-[14px] font-medium`,children:W(t.name).label}),(0,X.jsx)(`span`,{className:`mono block truncate text-[12px] text-soft`,children:t.name}),t.withheld&&(0,X.jsx)(`span`,{className:`block text-[12.5px] text-warn`,children:H(fe(t.withheld))})]}),(0,X.jsx)(`span`,{className:`text-[12.5px] text-muted`,children:ge[t.effect]}),(0,X.jsx)(e,{tone:t.verdict===`run`?`ok`:t.verdict===`ask`?`warn`:`bad`,children:me(t.verdict,n)})]},t.name))})},i))})}var Xe=[`max`,`min`,`enum`,`maxLength`,`maxItems`,`within`,`host`];function Ze(e){let t={};for(let[n,r]of Object.entries(e??{})){let e={},i={};for(let[t,n]of Object.entries(r))Xe.includes(t)?e[t]=t===`enum`?n.map(String):n:t!==`optional`&&(i[t]=n);let a=Object.keys(e).length===0&&Object.keys(i).length===0;t[n]={values:e,optional:r.optional===!0,carried:i,...a?{any:a}:{}}}return t}function Qe(e){return e==null||e===``||Array.isArray(e)&&e.length===0}function $e(e){return Object.values(e).some(e=>Object.values(e.values).some(Qe))}function et(e,t){return e.map(e=>(t===`number`||t===`integer`)&&e.trim()!==``&&!Number.isNaN(Number(e))?Number(e):t===`boolean`&&(e===`true`||e===`false`)?e===`true`:e)}function tt(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t.args.find(e=>e.name===r)?.type,a={...i.carried};for(let[t,n]of Object.entries(i.values))Qe(n)||(a[t]=t===`enum`?et(n,e):t===`within`?n.trim():n);(Object.keys(a).length!==0||i.any)&&(i.optional&&(a.optional=!0),n[r]=a)}return n}function nt(e,t,n,r=!1){return t?e??n:r?`allow`:e??`allow`}function rt(e,t){return e.required?`required: every call sends it, so every call would ${t===`approve`?`ask you first`:`be blocked`}`:e.only?`only ${Ne(e.only)} ${e.only.length===1?`has a limit`:`have limits`}, so anything else inside it, or an empty ${e.list?`list`:`one`}, is caught too`:`a call that sends it ${t===`approve`?`asks you first`:`is blocked`}`}function it({tool:e,draft:t,setDraft:n,onViolation:r,setOnViolation:i,unknownArgs:o,setUnknownArgs:s,approvalsOff:c=!1,hadLimits:l=!1}){let[u,d]=(0,K.useState)(``),p=[...new Set([...e.args.map(e=>e.name),...Object.keys(t)])],m=Object.keys(tt(t,e)),g=m.length>0,_=nt(o,g,r,l),v=_===`allow`?[]:Fe(e,m),y=e=>n({...t,[e]:{values:{},optional:!1,carried:{},any:!0}}),b=e=>{let r={...t};delete r[e],n(r)},x=(e,r)=>{let i=t[e]??{values:{},optional:!1,carried:{}};n({...t,[e]:r(i)})},S=(e,t,n)=>x(e,e=>{let r={...e.values};return n===void 0?delete r[t]:r[t]=n,{...e,values:r}});return(0,X.jsxs)(`div`,{className:`space-y-4`,children:[p.length===0&&(0,X.jsx)(`p`,{className:`rounded-2xl bg-sunken p-4 text-[13.5px] text-soft`,children:`This tool takes no inputs, so there is nothing to limit.`}),(0,X.jsx)(`ul`,{className:`space-y-3`,children:p.map(n=>{let r=e.args.find(e=>e.name===n),i=t[n],a=Object.keys(i?.values??{}),o=ke(r?.type).filter(e=>!a.includes(e));return(0,X.jsxs)(`li`,{className:`rounded-2xl border border-line p-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,X.jsx)(`code`,{className:`font-mono text-[13.5px] font-medium break-all`,children:n}),(0,X.jsxs)(`span`,{className:`text-[12.5px] text-soft`,children:[r?.type??`any type`,` · `,r?r.required?`required`:`optional`:`nested input`]})]}),r?.description&&(0,X.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-[12.5px] text-soft`,children:r.description}),a.length>0&&(0,X.jsx)(`div`,{className:`mt-3 space-y-2.5`,children:a.map(e=>(0,X.jsx)(at,{path:n,limit:e,value:i.values[e]??null,onChange:t=>S(n,e,t),onRemove:()=>S(n,e,void 0)},e))}),i?.any&&a.length===0&&(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-[13px] text-soft`,children:[`Any value is let through.`,(0,X.jsx)(D,{size:`sm`,variant:`ghost`,onClick:()=>b(n),children:`Undo`})]}),Object.keys(i?.carried??{}).length>0&&(0,X.jsxs)(`p`,{className:`mt-2 text-[12.5px] text-soft`,children:[`Also kept as written in the settings file:`,` `,(0,X.jsx)(`code`,{className:`font-mono`,children:Object.keys(i.carried).join(`, `)})]}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3`,children:[o.length>0&&(0,X.jsx)(oe,{"aria-label":`Add a limit to ${n}`,value:``,className:`w-56`,onChange:e=>{e&&S(n,e,e===`enum`||e===`host`?[]:e===`within`?``:null)},options:[{value:``,label:`Add a limit…`},...o.map(e=>({value:e,label:Oe[e]}))]}),a.length>0&&r&&!r.required&&(0,X.jsx)(N,{checked:i?.optional===!0,onChange:e=>x(n,t=>({...t,optional:e})),label:`It's fine to leave this input out`})]})]},n)})}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,X.jsx)(a,{label:`Limit a nested input`,className:`min-w-0 flex-1 basis-56`,children:(0,X.jsx)(f,{value:u,onChange:d,mono:!0,placeholder:`items[].qty`,onEnter:()=>C()})}),(0,X.jsx)(D,{icon:`plus`,disabled:u.trim()===``||p.includes(u.trim()),onClick:C,children:`Add input`})]}),(0,X.jsx)(`p`,{className:`mt-1.5 text-[12.5px] text-soft`,children:`For a value inside a list or object, such as items[].qty.`})]}),(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,X.jsx)(a,{label:`If a call breaks a limit`,technical:`on_violation`,children:(0,X.jsx)(h,{label:`If a call breaks a limit`,value:r,onChange:i,options:[{value:`deny`,label:`Block it`},{value:`approve`,label:`Ask me`}]})}),(g||_!==`allow`)&&(0,X.jsx)(a,{label:`Anything else the tool is sent`,technical:`unknown_args`,help:`Inputs your limits don't mention. Letting them through means an extra input like force: true isn't checked.`,children:(0,X.jsx)(h,{label:`Anything else the tool is sent`,value:_,onChange:s,options:[{value:`deny`,label:`Block it`},{value:`approve`,label:`Ask me first`},{value:`allow`,label:`Let it through`}]})})]}),_===`approve`&&c&&(0,X.jsx)(`p`,{className:`text-[13px] font-medium text-warn`,children:`Approvals are switched off on this toolbox, so “Ask me first” means refused for now.`}),v.length>0&&(_===`deny`||_===`approve`)&&(0,X.jsxs)(`div`,{className:`rounded-2xl bg-sunken p-4`,children:[(0,X.jsx)(`p`,{className:`text-[13px] font-semibold`,children:`What this catches`}),!g&&(0,X.jsx)(`p`,{className:`mt-1 text-[13px] text-muted`,children:`There are no limits, so every call that sends any input is caught.`}),(0,X.jsx)(`ul`,{className:`mt-2 space-y-2`,children:v.map(e=>(0,X.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 text-[13px]`,children:[(0,X.jsxs)(`span`,{className:e.required?`font-medium text-warn`:`text-muted`,children:[(0,X.jsx)(`code`,{className:`font-mono`,children:e.name}),` — `,rt(e,_)]}),(0,X.jsx)(D,{size:`sm`,onClick:()=>y(e.name),children:`Allow any value`})]},e.name))})]})]});function C(){let e=u.trim();e&&!p.includes(e)&&(n({...t,[e]:{values:{max:null},optional:!1,carried:{}}}),d(``))}}function at({path:e,limit:n,value:r,onChange:a,onRemove:o}){let s=`${Oe[n]} (${e})`,c;return c=n===`enum`||n===`host`?(0,X.jsx)(t,{"aria-label":s,value:r??[],onChange:a,placeholder:n===`host`?`example.com, or .example.com for every address under it`:`Type a value and press Enter`,validate:n===`host`?e=>/[\s/:]/.test(e)?`Type just the website name, such as example.com`:null:void 0}):n===`within`?(0,X.jsx)(f,{"aria-label":s,value:r??``,onChange:a,mono:!0,placeholder:`/Users/you/project`}):(0,X.jsx)(i,{"aria-label":s,value:r??null,onChange:a,min:n===`maxLength`?1:n===`maxItems`?0:void 0,step:n===`maxLength`||n===`maxItems`?1:void 0,unit:n===`maxLength`?`chars`:n===`maxItems`?`items`:void 0}),(0,X.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] items-start gap-x-2 gap-y-1 sm:grid-cols-[176px_1fr_auto] sm:items-center`,children:[(0,X.jsx)(`span`,{className:`col-span-2 text-[13px] font-semibold sm:col-span-1`,children:Oe[n]}),(0,X.jsx)(`div`,{className:`min-w-0`,children:c}),(0,X.jsx)(ae,{icon:`x`,label:`Remove ${Oe[n].toLowerCase()} from ${e}`,size:34,onClick:o})]})}var ot=[{value:`read`,label:`Looks only`,hint:`Reads or looks things up. Changes nothing.`,icon:`eye`},{value:`write`,label:`Makes changes`,hint:`Creates, edits, sends or adds something.`,icon:`edit`},{value:`destructive`,label:`Deletes`,hint:`Removes something, or does what can't be undone.`,icon:`trash`}],st=[{value:`allow`,label:`Run freely`,hint:`Nobody is asked.`,icon:`check`},{value:`approve`,label:`Ask me first`,hint:`Every call waits for you to approve it.`,icon:`clock`},{value:`deny`,label:`Block it`,hint:`Every call is refused.`,icon:`x`}];function ct({open:e,serverId:t,tenant:n,tool:r,protection:i,onClose:o,onSaved:s}){let l=I(),[u,d]=(0,K.useState)(q(r)),[p,m]=(0,K.useState)(q(r)===null?null:r.verdict.kind),[h,g]=(0,K.useState)(``),[v,y]=(0,K.useState)(!1),[b,x]=(0,K.useState)(()=>Ze(r.bounds?.constraints)),[S,C]=(0,K.useState)(r.bounds?.onViolation??`deny`),[T,te]=(0,K.useState)(r.bounds?.unknownArgs??null),[E,re]=(0,K.useState)(!1),[ie,ae]=(0,K.useState)(!1),[oe,O]=(0,K.useState)(!1),[k,A]=(0,K.useState)(null),[ce,j]=(0,K.useState)(null),[le,M]=(0,K.useState)(0),[N,P]=(0,K.useState)(!1),[L,R]=(0,K.useState)(null),[z,ue]=(0,K.useState)(null),B=Object.values((k?.preview.bounds??r.bounds)?.constraints??{}).some(e=>Ae(e)),V=(0,K.useMemo)(()=>{if(!u||!p)return null;let e={tool:r.name,effect:u,decision:p};return h.trim()&&(e.reason=h.trim()),v&&Object.assign(e,dt(r,b,S,T)),e},[r,u,p,h,v,b,S,T]),H=ee(V?JSON.stringify(V):``,350);(0,K.useEffect)(()=>{if(!e||!H){A(null);return}let r=!0;return j(null),_.toolRulePreview(t,JSON.parse(H),n).then(e=>{r&&(A({key:H,preview:e}),v||(x(Ze(e.bounds?.constraints)),C(e.bounds?.onViolation??`deny`),te(e.bounds?.unknownArgs??null)))}).catch(e=>r&&j(Y(e))),()=>{r=!1}},[e,H,t,n,le]);let de=V?JSON.stringify(V):``,U=k&&k.key===de?k.preview:null,fe=U!==null,W=k?.preview??null,pe=W?W.bounds:r.bounds,G=U?.overriddenReason!=null,me=G&&U?.overridesAllowed===!1,he=U?.dropsBounds!=null,ge=u===`destructive`&&p===`allow`,_e=v&&$e(b),ve=U?.writable.ok===!1,ye=U!==null&&fe&&!ce&&!N&&!ve&&!me&&!_e&&(!G||E)&&(!he||ie)&&(!ge||oe);async function be(){if(U&&V){P(!0),R(null);try{let e=await _.setToolRule(t,{...V,expectedDigest:U.expectedDigest,acknowledged:{...G?{overrideDeny:U.overriddenReason.ruleId}:{},...he?{dropBounds:!0}:{},...ge?{destructiveAllow:!0}:{}}},n);ue({yaml:e.yaml,reloads:U.reloads}),l.show(`ok`,`Saved what ${r.name} may do.`),e.warning&&l.show(`warn`,J(e.warning)),s()}catch(e){Re(e)?(R({text:ze,stale:!0}),A(null),M(e=>e+1)):R({text:Y(e),stale:!1})}finally{P(!1)}}}if(z)return(0,X.jsx)(F,{open:e,onClose:o,title:`Saved`,width:600,footer:(0,X.jsx)(D,{variant:`primary`,onClick:o,children:`Close`}),children:(0,X.jsxs)(`div`,{className:`space-y-4 text-[14px]`,children:[(0,X.jsxs)(`p`,{className:`text-muted`,children:[`The rule for `,(0,X.jsx)(`code`,{className:`font-mono text-ink`,children:r.name}),` is in your protection settings.`,` `,z.reloads?`The running toolbox applies it within about a second. No restart is needed.`:`This toolbox only reads its settings when it starts, so restart it to apply this.`]}),(0,X.jsxs)(`details`,{className:`group`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer text-[13px] font-semibold text-soft`,children:`Show what was written`}),(0,X.jsx)(`div`,{className:`mt-2`,children:(0,X.jsx)(ne,{label:`The rule that was written`,children:z.yaml})})]})]})});let xe=U?.approvalsReachable===!1;return(0,X.jsx)(F,{open:e,onClose:o,title:(0,X.jsxs)(X.Fragment,{children:[`Change what `,(0,X.jsx)(`span`,{className:`font-mono text-[0.9em]`,children:r.name}),` may do`]}),description:`Your answer is saved as a rule in your protection settings.`,width:720,footer:(0,X.jsxs)(X.Fragment,{children:[L?.stale&&(0,X.jsx)(D,{variant:`ghost`,icon:`refresh`,onClick:()=>M(e=>e+1),className:`mr-auto`,children:`Reload preview`}),(0,X.jsx)(D,{variant:`secondary`,onClick:o,disabled:N,children:`Cancel`}),(0,X.jsx)(D,{variant:`primary`,onClick:()=>void be(),disabled:!ye,loading:N,children:`Save rule`})]}),children:(0,X.jsxs)(`div`,{className:`space-y-6 pb-1 text-[14px]`,children:[i?.tenant&&(0,X.jsx)(c,{tone:`info`,title:`This applies to every customer`,children:`A rule changes the protection settings, which every customer of this toolbox shares. Turning a tool off is the only change kept for one customer.`}),r.injection&&r.injection.length>0&&(0,X.jsx)(c,{tone:`danger`,title:`Judge this tool by its name and inputs`,children:`Its description carried hidden instructions written to steer whoever reads it, so it isn't repeated here.`}),(0,X.jsx)(ft,{legend:`What does this tool do?`,name:`rule-effect`,value:u,onChange:d,options:ot}),(0,X.jsx)(ft,{legend:`What should happen when your AI uses it?`,name:`rule-decision`,value:p,onChange:m,options:st.map(e=>e.value===`approve`&&xe?{...e,disabled:!0,hint:`Approvals are switched off on this toolbox, so nobody could answer.`}:e)}),(0,X.jsxs)(`section`,{className:`rounded-[20px] bg-sunken/60 p-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`h3`,{className:`flex items-center gap-2 text-[15px] font-semibold`,children:[`Limits on its inputs `,(0,X.jsx)(w,{term:`limits`})]}),(0,X.jsx)(`p`,{className:`mt-1 text-[13px] text-soft`,children:B?`These limits include one written into the settings file by hand that can't be edited here. They are kept exactly as they are.`:v?`Set the values this tool may be called with.`:pe?lt(pe,W?.carriedFrom??null):`None. Every input is passed on as your AI sends it.`})]}),!v&&!B&&(0,X.jsx)(D,{size:`sm`,icon:pe?`edit`:`plus`,onClick:()=>y(!0),children:pe?`Edit limits`:`Add limits on its inputs`})]}),v&&(0,X.jsxs)(`div`,{className:`mt-4`,children:[(0,X.jsx)(it,{tool:r,draft:b,setDraft:x,onViolation:S,setOnViolation:C,unknownArgs:T,setUnknownArgs:te,approvalsOff:xe,hadLimits:ut(r)}),_e&&(0,X.jsx)(`p`,{className:`mt-3 text-[13px] font-medium text-warn`,children:`Fill in every limit you added, or remove it.`})]})]}),(0,X.jsx)(a,{label:`Reason`,optional:!0,help:`Saved with the rule and in the activity log. When a call is blocked, your AI is told this reason.`,children:(0,X.jsx)(f,{value:h,onChange:g,placeholder:`For example: finance signs these off by hand`})}),(0,X.jsx)(pt,{tool:r,preview:U,loading:V!==null&&U===null&&!ce,error:ce,incomplete:V===null}),U&&fe&&(0,X.jsxs)(`div`,{className:`space-y-3`,children:[ve&&(0,X.jsx)(c,{tone:`warn`,title:`This toolbox's settings can't be changed from here`,children:J(U.writable.why??`The settings file is not writable.`)}),me?(0,X.jsxs)(c,{tone:`info`,title:`This toolbox doesn't allow reversing a rule from here`,children:[`The rule `,(0,X.jsx)(`code`,{className:`font-mono`,children:U.overriddenReason.ruleId}),` stays as it is. It can only be changed in the settings file itself.`]}):G&&(0,X.jsxs)(gt,{title:`This reverses a rule somebody wrote`,checked:E,onChange:re,label:`Reverse the rule ${U.overriddenReason.ruleId} anyway`,children:[`The rule `,(0,X.jsx)(`code`,{className:`font-mono`,children:U.overriddenReason.ruleId}),` says`,` `,(0,X.jsx)(`strong`,{children:se(U.overriddenReason.decision).toLowerCase()}),` for this tool`,U.overriddenReason.reason?(0,X.jsxs)(X.Fragment,{children:[`, because: “`,U.overriddenReason.reason,`”`]}):`.`]}),he&&(0,X.jsxs)(gt,{title:`This removes the limits on its inputs`,checked:ie,onChange:ae,label:`Remove the limits on its inputs`,children:[`Today: `,Me(U.currentBounds).join(`; `)||`limited`,`. After this, nothing checks what the tool is called with.`]}),ge&&(0,X.jsx)(gt,{title:`Your AI could delete things without asking`,checked:oe,onChange:O,label:`Let a tool that deletes things run with nobody asked`,children:`“Ask me first” keeps it just as usable, with you approving each call.`})]}),L&&(0,X.jsx)(c,{tone:`danger`,role:`alert`,title:L.stale?`Not saved`:`The toolbox refused this change`,children:L.text})]})})}function lt(e,t){let n=Me(e);return n.length===0?`No limits on its inputs. ${Le[e.unknownArgs]}`:t?`Carried over from the rule ${t}, which governs it today: ${n.join(`; `)}.`:`Kept as they are: ${n.join(`; `)}.`}function ut(e){return(e.bounds?.paths.length??0)>0}function dt(e,t,n,r){let i=tt(t,e);return{args:i,on_violation:n,unknown_args:nt(r,Object.keys(i).length>0,n,ut(e))}}function ft({legend:e,name:t,value:n,onChange:r,options:i}){return(0,X.jsxs)(`fieldset`,{children:[(0,X.jsx)(`legend`,{className:`mb-2.5 text-[15px] font-semibold`,children:e}),(0,X.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:i.map(e=>{let i=n===e.value;return(0,X.jsxs)(`label`,{className:L(`relative flex cursor-pointer flex-col gap-1 rounded-[18px] border-[1.5px] p-3.5 transition-colors has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-[var(--focus)]`,i?`border-primary bg-ok-tint`:`border-line hover:border-[var(--soft)]`,e.disabled&&`cursor-not-allowed opacity-55`),children:[(0,X.jsx)(`input`,{type:`radio`,name:t,value:e.value,checked:i,disabled:e.disabled,onChange:()=>r(e.value),className:`sr-only`}),(0,X.jsxs)(`span`,{className:`flex items-center gap-2 font-semibold`,children:[(0,X.jsx)(g,{name:e.icon,size:17,strokeWidth:2,className:i?`text-ok`:`text-soft`}),e.label,i&&(0,X.jsx)(g,{name:`check`,size:16,strokeWidth:2.4,className:`ml-auto text-ok`})]}),(0,X.jsx)(`span`,{className:`text-[12.5px] leading-snug text-soft`,children:e.hint})]},e.value)})})]})}function pt({tool:e,preview:t,loading:n,error:r,incomplete:i}){return(0,X.jsxs)(`section`,{"aria-live":`polite`,className:`rounded-[20px] border-[1.5px] border-line p-4`,children:[(0,X.jsx)(`h3`,{className:`text-[15px] font-semibold`,children:`What changes`}),i?(0,X.jsx)(`p`,{className:`mt-2 text-[13.5px] text-soft`,children:`Answer both questions above to see what changes.`}):r?(0,X.jsx)(`p`,{role:`alert`,className:`mt-2 text-[13.5px] font-medium text-bad`,children:r}):n||!t?(0,X.jsx)(`div`,{className:`mt-3`,children:(0,X.jsx)(s,{lines:3})}):(0,X.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,X.jsx)(`span`,{className:`text-[13px] text-soft`,children:`Now`}),(0,X.jsx)(E,{decision:t.current.kind}),(0,X.jsx)(g,{name:`arrow-right`,size:18,className:`text-soft`,label:`becomes`}),(0,X.jsx)(`span`,{className:`text-[13px] text-soft`,children:`After`}),(0,X.jsx)(E,{decision:t.verdict.kind})]}),(0,X.jsx)(`p`,{className:`text-[13.5px] text-muted`,children:mt(e,t)}),(0,X.jsx)(ht,{preview:t}),(0,X.jsxs)(`details`,{children:[(0,X.jsx)(`summary`,{className:`cursor-pointer text-[13px] font-semibold text-soft`,children:`Show the rule that will be written`}),(0,X.jsxs)(`div`,{className:`mt-2 space-y-1.5`,children:[(0,X.jsx)(ne,{label:`The rule that will be written`,children:t.yaml}),t.policyPath&&(0,X.jsx)(`p`,{className:`font-mono text-[11.5px] break-all text-soft`,children:t.policyPath})]})]})]})]})}function mt(e,t){let n=e.name,r=t.verdict.kind===`deny`?[]:Ie(e,t.bounds);if(t.bounds&&r.length>0){let e=r.length===1;return`After saving, every call to ${n} ${t.bounds.unknownArgs===`approve`?`will ask you first`:`will be blocked`}, because ${Ne(r)} ${e?`is`:`are`} required and your limits don't mention ${e?`it`:`them`}.`}let i=`After saving, every call to ${n} ${t.verdict.kind===`allow`?`runs freely`:t.verdict.kind===`approve`?`asks you first`:`is blocked`}`;if(t.bounds&&t.verdict.kind!==`deny`){let e=Me(t.bounds);i+=e.length>0?` while its inputs stay within limits (${e.join(`; `)}). A call outside them ${we(t.bounds.onViolation)}.`:`.`,i+=` ${Le[t.bounds.unknownArgs]}`}else i+=`.`;return t.verdict.kind!==`deny`&&t.currentBounds&&t.currentBounds.unknownArgs!==`allow`&&(t.bounds?.unknownArgs??`allow`)===`allow`&&(i+=` Anything else the tool is sent will now be let through.`),i}function ht({preview:e}){let t=[];return e.loosens&&t.push({key:`loosens`,tone:`warn`,text:`This lets your AI do more with this tool than it can today. The safety check will point this out if a tool that changes or deletes things runs without asking.`}),e.overridden&&t.push({key:`overridden`,tone:`warn`,text:J(e.overridden)}),e.nameContradiction&&t.push({key:`name`,tone:`warn`,text:J(e.nameContradiction)}),e.strandedRule&&t.push({key:`stranded`,tone:`info`,text:(0,X.jsxs)(X.Fragment,{children:[`The rule `,(0,X.jsx)(`code`,{className:`font-mono`,children:e.strandedRule}),` no longer applies to any tool after this. It stays in your settings, and undoing this change brings it back.`]})}),e.reloads||t.push({key:`reload`,tone:`info`,text:`This toolbox only reads its settings when it starts, so this applies after a restart.`}),t.length===0?null:(0,X.jsx)(`ul`,{className:`space-y-2`,children:t.map(e=>(0,X.jsxs)(`li`,{className:L(`flex gap-2.5 rounded-2xl px-3.5 py-2.5 text-[13px]`,e.tone===`warn`?`bg-warn-tint`:`bg-info-tint`),children:[(0,X.jsx)(g,{name:e.tone===`warn`?`warning`:`info`,size:16,strokeWidth:2,className:L(`mt-0.5 shrink-0`,e.tone===`warn`?`text-warn`:`text-soft`)}),(0,X.jsx)(`span`,{className:`text-ink`,children:e.text})]},e.key))})}function gt({title:e,children:t,checked:n,onChange:r,label:i}){return(0,X.jsxs)(`div`,{className:`rounded-[18px] border-[1.5px] border-bad/45 bg-bad-tint/50 p-4`,children:[(0,X.jsxs)(`p`,{className:`flex items-center gap-2 font-semibold text-bad`,children:[(0,X.jsx)(g,{name:`warning`,size:17,strokeWidth:2}),e]}),(0,X.jsx)(`div`,{className:`mt-1 text-[13.5px] text-muted`,children:t}),(0,X.jsx)(`div`,{className:`mt-3`,children:(0,X.jsx)(N,{checked:n,onChange:r,label:i})})]})}var _t=[`read`,`write`,`destructive`,`unsure`,`off`],vt={read:`Looks at things`,write:`Makes changes`,destructive:`Deletes or overwrites`,unsure:`We're not sure what it does`,off:`Turned off`};function Z(e){let t=xe(e);return t===`off`?`off`:t===`unlabelled`?`unsure`:q(e)??`unsure`}function yt(e){return _t.map(t=>({key:t,tools:e.filter(e=>Z(e)===t)})).filter(e=>e.tools.length>0)}function bt(e){return`${e} ${e===1?`tool`:`tools`}`}function xt(e,t){if(e.exposure.disabled)return`off`;if(t.withheld?.has(e.name))return`held`;if(e.hiddenByPolicy)return`hidden`;let n=e.verdict.kind,r=Se(e);return t.observe?n===`allow`?`allow`:n===`deny`?`would-deny`:e.unreachable&&!r?`would-never`:`would-approve`:n===`deny`?`deny`:n===`approve`?r?t.approvalsOff?`granted-only`:`granted`:e.unreachable||t.approvalsOff?`never`:`approve`:e.bounds?`limited`:`allow`}var St={off:`Turned off`,held:`Held back: it changed since you approved it`,hidden:`Hidden: had hidden instructions`,never:`Can never run`,deny:`Blocked`,approve:`Asks you first`,granted:`Pre-approved within limits`,"granted-only":`Pre-approved calls only; others can never run`,limited:`Runs within limits`,allow:`Runs freely`,"would-deny":`Would be blocked`,"would-approve":`Would ask you first`,"would-never":`Would never run`},Ct=new Set([`off`,`held`,`hidden`,`never`,`deny`]);function wt(e,t){return Ct.has(xt(e,t))}function Tt(e,t){return St[xt(e,t)]}function Et(e,t){let n=xt(e,t);return n===`allow`||n===`limited`?`ok`:n===`approve`||n===`granted`||n===`granted-only`?`warn`:n===`off`||n.startsWith(`would-`)?`soft`:`bad`}var Dt=[`allow`,`limited`,`granted`,`granted-only`,`approve`,`would-approve`,`would-never`,`would-deny`,`never`,`deny`,`held`,`hidden`,`off`],Ot={allow:[`runs freely`,`run freely`],limited:[`runs within limits`,`run within limits`],granted:[`pre-approved`,`pre-approved`],"granted-only":[`runs only pre-approved calls`,`run only pre-approved calls`],approve:[`asks you first`,`ask you first`],"would-approve":[`would ask you first`,`would ask you first`],"would-never":[`would never run`,`would never run`],"would-deny":[`would be blocked`,`would be blocked`],never:[`can never run`,`can never run`],deny:[`blocked`,`blocked`],held:[`held back`,`held back`],hidden:[`hidden`,`hidden`],off:[`turned off`,`turned off`]},kt=(e,t)=>e.map(e=>xt(e,t));function At(e){let t=new Set(e);return t.size===1?[...t][0]:null}function jt(e,t){let n=new Map;for(let r of kt(e,t))n.set(r,(n.get(r)??0)+1);return Dt.filter(e=>n.has(e)).map(e=>{let t=n.get(e);return`${t} ${Ot[e][t===1?0:1]}`}).join(`, `)}var Mt=e=>e.every(e=>e===`allow`||e.startsWith(`would-`));function Nt(e,t){let n=t?`it`:`they`;switch(e){case`allow`:return`, so ${n} ${t?`runs`:`run`} freely`;case`approve`:return`, so ${n} ${t?`asks`:`ask`} you first`;case`deny`:return t?`, so it's blocked`:`, so they're blocked`;case`never`:return`, so ${n} can never run`;case`would-approve`:return`. ${t?`It runs`:`They run`} for now, and would ask you first`;case`would-deny`:return`. ${t?`It runs`:`They run`} for now, and would be blocked`;default:return null}}function Pt(e,t,n){let r=t.length===1;if(e===`off`)return r?`Your AI can't see it or use it`:`Your AI can't see or use these`;let i=kt(t,n),a=At(i);if(e===`unsure`){let e=r?`We're not sure what this does`:`We're not sure what these do`,i=a?Nt(a,r):null;return i?`${e}${i}`:a?`${e}. ${St[a]}`:`${e}. Mixed: ${jt(t,n)}`}let o=n.observe&&Mt(i)&&i.some(e=>e.startsWith(`would-`));return a?o?`Runs for now; ${St[a].toLowerCase()}`:St[a]:`${o?`Runs for now. `:``}Mixed: ${jt(t,n)}`}var Ft=[`inj`,`unreach`,`changed`,`bounds`,`unbounded`,`grant`],It={inj:e=>`${e} with hidden instructions`,unreach:e=>`${e} can never run`,changed:e=>`${e} changed`,bounds:e=>`${e} ${e===1?`has`:`have`} limits`,unbounded:e=>`${e} ${e===1?`input`:`inputs`} unlimited`,grant:e=>`${e} pre-approved`};function Lt(e,t){let n=new Map;for(let r of e)for(let e of Te(r,t.has(r.name))){let t=e.key===`unbounded`?r.unboundedInputs.length:1;n.set(e.key,{n:(n.get(e.key)?.n??0)+t,tone:e.tone})}return Ft.filter(e=>n.has(e)).map(e=>({key:e,text:It[e](n.get(e).n),tone:n.get(e).tone}))}function Q(e,t,n,r=0){let i=[];return e&&i.push(e===1?`the one tool that's turned off`:`the ${e} tools that are turned off`),r&&i.push(r===1?`the one tool held back because it changed`:`the ${r} tools held back because they changed`),t&&i.push(t===1?`the one tool hidden for carrying hidden instructions`:`the ${t} tools hidden for carrying hidden instructions`),n&&i.push(n===1?`the one tool we're not sure about`:`the ${n} tools we're not sure about`),i.length?`Apart from ${i.join(` and `)}, `:``}function Rt(e,t){let n=e.length,r=e.filter(e=>e.verdict.ruleId.startsWith(`tenant.`)).length,i=e.filter(e=>e.verdict.ruleId===`defaults.mode`).length;return r===n?`, because the toolbox needs to know which customer each call is for`:r>0?`, because of the customer check and your other settings`:i===n?t?`, because the toolbox is set to “${M[t].label}”`:`, because of how careful the toolbox is set to be`:i===0?` by rules in your protection settings`:`, because of your rules and how careful the toolbox is`}function zt(e){let t=At(e.map(e=>e.bounds?.onViolation??null));return t?`a call outside them ${we(t)}`:`what happens outside them depends on the tool`}function Bt(e,t,n){let r=t.filter(e=>Z(e)===`off`),i=t.filter(e=>Z(e)!==`off`),a=i.filter(e=>n.withheld?.has(e.name)),o=i.filter(e=>!n.withheld?.has(e.name)),s=o.filter(e=>e.hiddenByPolicy),c=o.filter(e=>!e.hiddenByPolicy&&Z(e)===`unsure`),l=o.filter(e=>!e.hiddenByPolicy&&Z(e)!==`unsure`),u=e=>xt(e,n),d=(e,t)=>e?t:t[0].toUpperCase()+t.slice(1);if(l.length===0&&c.length===0)return s.length===0&&a.length===0?`Every tool from ${e} is turned off.`:r.length===0&&a.length===0?`Every tool from ${e} is hidden, because their descriptions carried hidden instructions.`:`Nothing from ${e} can run: its tools are turned off, hidden or held back.`;if(n.observe){let t=Q(r.length,s.length,0,a.length);return`${t}${d(t,`everything`)} from ${e} runs for now, because your toolbox is only watching.`}if(l.length===0){let t=Q(r.length,s.length,0,a.length),n=At(c.map(u)),i=n===`allow`||n===`approve`||n===`deny`||n===`never`?Nt(n,!1):null;return`${t}${d(t,`we're`)} not sure what ${e}'s tools do${i??` yet`}.`}let f=l.map(u),p=At(f),m=e=>c.filter(t=>!e(u(t))).length;if(f.every(e=>e===`deny`||e===`never`)){let t=Q(0,0,m(e=>Ct.has(e)));return p===`deny`?`${t}${d(t,`everything`)} from ${e} is blocked${Rt(l,n.stance)}.`:p===`never`?`${t}${d(t,`everything`)} from ${e} would ask you first, but approvals are switched off, so none of it can run.`:`${t}${d(t,`nothing`)} from ${e} can run: ${jt(l,n)}.`}let h=l.filter(e=>Z(e)===`read`),g=l.filter(e=>Z(e)!==`read`),_=At(h.map(u)),v=At(g.map(u)),y=_===`allow`?`can look at things freely`:_===`limited`?`can look at things within limits you set (${zt(h)})`:null,b=g.length===0?``:v===`approve`?`; anything that changes something asks you first`:v===`granted`?`; anything that changes something asks you first, apart from calls you pre-approved`:v===`granted-only`?`; anything that changes something runs only if you pre-approved it, because approvals are switched off`:v===`deny`?`; anything that changes something is blocked`:v===`never`?`; anything that changes something can never run, because approvals are switched off`:null;if(h.length>0&&y&&b!==null)return`${Q(r.length,s.length,c.length,a.length)}${e} ${y}${b}.`;if(p===`allow`||p===`approve`){let t=Q(r.length,s.length,m(e=>e===p),a.length),i=p===`allow`?`runs freely, without asking you`:`asks you first`;return`${t}${d(t,`everything`)} from ${e} ${i}${Rt(l,n.stance)}.`}if(p===`limited`){let t=Q(r.length,s.length,c.length,a.length);return`${t}${d(t,`everything`)} from ${e} runs freely within limits you set; ${zt(l)}.`}if(p===`granted`){let t=Q(r.length,s.length,c.length,a.length);return`${t}${d(t,`everything`)} from ${e} asks you first, apart from calls you pre-approved.`}if(p===`granted-only`){let t=Q(r.length,s.length,c.length,a.length);return`${t}${d(t,`everything`)} from ${e} runs only calls you pre-approved, because approvals are switched off.`}return`${Q(r.length,s.length,c.length,a.length)}${e}'s tools are mixed: ${jt(l,n)}.`}function Vt(e,t){let n=t.trim().toLowerCase();return!n||`${W(e.name).label} ${e.name} ${e.description}`.toLowerCase().includes(n)}function Ht(e,t,n,r=[],i=new Set,a=e=>R(e)){let o=t.trim()!==``,s=new Set(e.map(e=>e.upstream));if(!o)for(let e of r)s.add(e);return[...s].sort((e,t)=>e.localeCompare(t)).flatMap(r=>{let o=e.filter(e=>e.upstream===r),s=a(r);if(o.length===0)return[{name:r,label:s,why:``,groups:[]}];let c=o.filter(e=>Vt(e,t)).sort((e,t)=>e.name.localeCompare(t.name));if(c.length===0)return[];let l=yt(c).map(e=>{let t=Lt(e.tools,i);return{key:e.key,label:vt[e.key],count:bt(e.tools.length),status:Pt(e.key,e.tools,n),flags:t,urgent:t.some(e=>e.tone===`bad`),tools:e.tools}});return[{name:r,label:s,why:Bt(s,o,n),groups:l}]})}function Ut({tools:e,changed:t,selected:n,onOpen:r,exposure:i}){return(0,X.jsx)(`ul`,{className:`divide-y divide-faint`,children:e.map(e=>(0,X.jsx)(Gt,{tool:e,changed:t.has(e.name),selected:n===e.name,onOpen:()=>r(e.name),exposure:i},e.name))})}var Wt={read:`bg-ok-tint`,write:`bg-warn-tint`,destructive:`bg-bad-tint`,unknown:`bg-sunken`};function Gt({tool:t,changed:n,selected:r,onOpen:i,exposure:a}){let o=xe(t),s=q(t),c=t.exposure.disabled;return(0,X.jsxs)(`li`,{onClick:i,className:L(`-mx-3 flex cursor-pointer flex-wrap items-center gap-x-4 gap-y-2 rounded-2xl px-3 py-3.5 transition-colors hover:bg-faint/70 sm:flex-nowrap`,r&&`bg-faint`),children:[(0,X.jsx)(`span`,{className:L(`grid h-11 w-11 shrink-0 place-items-center rounded-full`,Wt[s??`unknown`],c&&`opacity-50`),title:j[s??`unknown`].label,children:(0,X.jsx)(C,{effect:s})}),(0,X.jsxs)(`div`,{className:L(`min-w-0 flex-1 basis-[calc(100%-64px)] sm:basis-auto`,c&&`opacity-70`),children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),i()},className:`max-w-full truncate rounded font-mono text-[14px] font-medium text-ink hover:underline`,"aria-label":`Open ${t.name}`,children:t.name}),(0,X.jsxs)(`span`,{className:`truncate text-[12.5px] text-soft`,children:[`on `,t.upstream]})]}),(0,X.jsx)(`p`,{className:`mt-0.5 line-clamp-1 text-[13px] text-soft`,children:Yt(t.description)||(0,X.jsx)(`span`,{className:`italic`,children:`No description`})}),(0,X.jsx)(Jt,{tool:t,changed:n})]}),(0,X.jsxs)(`div`,{className:`ml-[60px] flex min-w-0 flex-wrap items-center gap-2 sm:ml-0 sm:shrink-0 sm:flex-nowrap`,children:[o===`off`?(0,X.jsx)(e,{tone:`neutral`,icon:`power`,children:`Turned off`}):o===`unlabelled`?(0,X.jsx)(e,{tone:t.verdict.kind===`approve`?`warn`:`bad`,icon:`help`,title:`Nobody has said what this tool does yet`,children:t.verdict.kind===`approve`?`Not labelled · asks`:`Not labelled · blocked`}):(0,X.jsx)(E,{decision:t.verdict.kind}),(0,X.jsx)(Kt,{tool:t,exposure:a})]})]})}function Kt({tool:e,exposure:t}){let n=e.exposure.disabled;return(0,X.jsx)(D,{size:`sm`,variant:`ghost`,icon:`power`,loading:t.busy(e.name),disabled:t.blocked!==null,title:t.blocked??void 0,onClick:r=>{r.stopPropagation(),t.set(e,!n)},"aria-label":`${n?`Turn on`:`Turn off`} ${e.name}`,className:`justify-center sm:w-[104px]`,children:n?`Turn on`:`Turn off`})}var qt={changed:`refresh`,inj:`warning`,unreach:`lock`,bounds:`sliders`,unbounded:`info`,grant:`key`};function Jt({tool:t,changed:n}){let r=Te(t,n);return r.length===0?null:(0,X.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:r.map(t=>(0,X.jsx)(e,{tone:t.tone,icon:qt[t.key],className:`py-0 text-[11.5px]`,children:t.text},t.key))})}function Yt(e){let t=/^\[description withheld by hmcp-gateway: it contained text that ([^\]]+)\]/.exec(e);return t?`Description hidden from your AI: it contained text that ${t[1]}.`:e}function Xt({protection:e,tools:t,query:n,onClearQuery:r,changed:i,selected:a,onOpen:o,exposure:c,configured:l,withheld:u,connectionsHref:d,onPosture:f}){let[p,m]=(0,K.useState)(()=>new Map),h=e?.defaults.mode??null,_=e?.enforcement===`observe`,v=e?.approvals?.mode===`deny`,y=(0,K.useMemo)(()=>({observe:_,approvalsOff:v,withheld:u}),[_,v,u]),x=de(),S=(0,K.useMemo)(()=>Ht(t,n,{stance:h,...y},l,i,x),[t,n,h,y,l,i,x]);if(!e)return(0,X.jsx)(A,{children:(0,X.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[(0,X.jsx)(s,{lines:2}),(0,X.jsx)(s,{lines:3})]})});if(t.length===0)return(0,X.jsx)(A,{children:(0,X.jsx)(b,{icon:`tool`,title:`No tools yet`,children:e.surface.neverPublished?`Start the toolbox once and the tools its connected servers offer will appear here.`:`The connected servers on this toolbox don't offer any tools.`})});if(S.length===0)return(0,X.jsx)(A,{children:(0,X.jsx)(b,{icon:`search`,title:`No tools match`,compact:!0,actions:(0,X.jsx)(D,{onClick:r,children:`Clear search`}),children:`Nothing on this toolbox matches what you typed.`})});let C=n.trim()!==``;return(0,X.jsx)(`div`,{className:`space-y-5`,children:S.map(e=>(0,X.jsx)(A,{title:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,X.jsx)(g,{name:`server`,size:20,className:`text-soft`}),e.label,z(e.name,e.label)&&(0,X.jsx)(`span`,{className:`font-mono text-[12px] font-normal text-soft`,children:e.name})]}),children:e.groups.length===0?(0,X.jsxs)(`p`,{className:`text-[14.5px] text-muted`,children:[`No tools listed yet. If it should have some, it may not have connected:`,` `,(0,X.jsx)(`a`,{href:d,className:`font-semibold underline underline-offset-2`,children:`check it on Connections`}),`.`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`text-[14.5px] text-muted`,children:e.why}),(0,X.jsx)(`ul`,{className:`mt-3 divide-y divide-faint`,children:e.groups.map(t=>{let n=`${e.name}\n${t.key}`,r=C||(p.get(n)??t.urgent);return(0,X.jsx)(Zt,{group:t,open:r,forced:C,onToggle:()=>m(e=>new Map(e).set(n,!r)),changed:i,selected:a,onOpen:o,exposure:c,status:y,onPosture:f},t.key)})})]})},e.name))})}function Zt({group:t,open:n,forced:r,onToggle:i,changed:a,selected:o,onOpen:s,exposure:c,status:l,onPosture:u}){let d=(0,K.useId)(),f=t.key===`read`||t.key===`write`||t.key===`destructive`?t.key:null;return(0,X.jsxs)(`li`,{className:`py-1`,children:[(0,X.jsxs)(`div`,{className:`-mx-3 flex items-center gap-2`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":n,disabled:r,"aria-controls":d,title:r?`Every group is open while you search. Clear the search to fold them.`:void 0,onClick:i,className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1 rounded-2xl px-3 py-3 text-left transition-colors enabled:hover:bg-faint/70`,children:[(0,X.jsx)(g,{name:`chevron`,size:18,className:L(`shrink-0 text-soft transition-transform`,!n&&`-rotate-90`)}),(0,X.jsx)(`span`,{className:L(`grid h-9 w-9 shrink-0 place-items-center rounded-full`,Wt[f??`unknown`]),children:t.key===`off`?(0,X.jsx)(g,{name:`power`,size:16,className:`text-soft`}):(0,X.jsx)(C,{effect:f})}),(0,X.jsx)(`span`,{className:`font-semibold text-ink`,children:t.label}),(0,X.jsx)(`span`,{className:`tnum text-[13px] text-soft`,children:t.count}),(0,X.jsx)(`span`,{className:`basis-full pl-[66px] text-[13.5px] text-muted sm:ml-auto sm:basis-auto sm:pl-0 sm:text-right`,children:t.status}),t.flags.length>0&&(0,X.jsx)(`span`,{className:`flex basis-full flex-wrap gap-1.5 pl-[66px]`,children:t.flags.map(t=>(0,X.jsx)(e,{tone:t.tone,icon:qt[t.key],className:`py-0 text-[11.5px]`,children:t.text},t.key))})]}),t.key===`unsure`&&(0,X.jsx)(D,{size:`sm`,variant:`ghost`,onClick:u,"aria-label":`Change what happens to tools we're not sure about`,children:`Change`})]}),(0,X.jsx)(`ul`,{id:d,hidden:!n,className:`mb-2 divide-y divide-faint pl-8`,children:t.tools.map(e=>(0,X.jsx)($t,{tool:e,changed:a.has(e.name),selected:o===e.name,onOpen:()=>s(e.name),exposure:c,status:l},e.name))})]})}var Qt={ok:`text-ok`,warn:`text-warn`,bad:`text-bad`,soft:`text-soft`};function $t({tool:e,changed:t,selected:n,onOpen:r,exposure:i,status:a}){let o=W(e.name).label;return(0,X.jsxs)(`li`,{onClick:r,className:L(`-mx-3 flex cursor-pointer flex-wrap items-center gap-x-4 gap-y-2 rounded-2xl px-3 py-3 transition-colors hover:bg-faint/70 sm:flex-nowrap`,n&&`bg-faint`),children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 basis-full sm:basis-auto`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),r()},className:`max-w-full truncate rounded text-left text-[14.5px] font-medium text-ink hover:underline`,"aria-label":`Open ${o} (${e.name})`,children:o}),(0,X.jsx)(`span`,{className:`block truncate font-mono text-[12px] text-soft`,children:e.name}),(0,X.jsx)(Jt,{tool:e,changed:t})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,X.jsx)(`span`,{className:L(`text-[13.5px] font-semibold`,Qt[Et(e,a)]),children:Tt(e,a)}),wt(e,a)?(0,X.jsx)(D,{size:`sm`,variant:`ghost`,icon:`sliders`,onClick:e=>{e.stopPropagation(),r()},"aria-label":`Change what ${o} may do`,title:e.name,className:`justify-center sm:w-[104px]`,children:`Change`}):(0,X.jsx)(Kt,{tool:e,exposure:i})]})]})}function en({name:e,serverId:t,tenant:n,protection:r,listTool:i,version:a,nav:o,exposure:l,ruleBlocked:u,onClose:d,onEditRule:f,onPosture:p,onChanged:m}){let h=de(),{data:g,error:v,loading:b,reload:x}=le(()=>e?_.tool(t,e,n):Promise.resolve(null),[t,e,n,a]),S=g&&g.name===e?g:null,T=S??i;return(0,X.jsx)(y,{open:e!==null,onClose:d,width:620,title:(0,X.jsx)(`span`,{className:`font-mono text-[18px] break-all`,children:e}),subtitle:T?(0,X.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,X.jsx)(C,{effect:q(T),withLabel:!0}),(0,X.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,X.jsxs)(`span`,{children:[`on `,(0,X.jsx)(`span`,{className:`font-medium text-muted`,title:T.upstream,children:h(T.upstream)})]}),(0,X.jsx)(w,{term:`connectedServer`})]}):void 0,children:v&&!T?(0,X.jsx)(c,{tone:`danger`,title:`This tool couldn't be loaded`,actions:(0,X.jsx)(D,{size:`sm`,icon:`refresh`,onClick:x,children:`Try again`}),children:Y(v)}):T?(0,X.jsxs)(`div`,{className:`space-y-8`,children:[(0,X.jsx)(tn,{tool:T}),(0,X.jsx)(nn,{tool:T,protection:r,serverId:t,tenant:n,ruleBlocked:u,onEditRule:()=>f(T),onPosture:p,onChanged:m}),(0,X.jsx)(on,{tool:T}),(0,X.jsx)(sn,{tool:T,loading:b&&!S}),(0,X.jsx)(cn,{tool:T,nav:o}),(0,X.jsx)(ln,{tool:S,loading:b&&!S,nav:o}),(0,X.jsx)(un,{tool:T,exposure:l,perCustomer:!!r?.tenant},T.name)]}):(0,X.jsxs)(`div`,{className:`space-y-6`,children:[(0,X.jsx)(s,{height:20,lines:3}),(0,X.jsx)(s,{height:40}),(0,X.jsx)(s,{lines:4})]})})}function $({title:e,aside:t,children:n}){return(0,X.jsxs)(`section`,{children:[(0,X.jsxs)(`header`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`h3`,{className:`flex items-center gap-2 text-[16px] font-semibold tracking-[-0.01em]`,children:e}),t]}),n]})}function tn({tool:e}){let t=de()(e.upstream),n=e.rawDescription!==e.description,r=e.injection??[],i=r.length>0&&!e.hiddenByPolicy&&!n;return(0,X.jsxs)($,{title:n?`What your AI is told about it`:`What ${t} says about it`,children:[(0,X.jsx)(`p`,{className:`text-[14.5px] whitespace-pre-wrap text-ink`,children:e.description||(0,X.jsx)(`span`,{className:`text-soft italic`,children:`The connected server gave no description.`})}),(0,X.jsx)(`p`,{className:`mt-1.5 text-[12.5px] text-soft`,children:`This is the description your AI sees.`}),r.length>0&&(0,X.jsx)(`div`,{className:`mt-4`,children:(0,X.jsxs)(c,{tone:i?`info`:`danger`,title:e.hiddenByPolicy?`Hidden instructions found, so the tool is hidden`:i?`Hidden instructions found, and accepted after review`:`Hidden instructions found and removed`,children:[`The connected server's description contained text aimed at your AI rather than at you, such as telling it to ignore its rules.`,` `,e.hiddenByPolicy?`The toolbox keeps this tool away from your AI entirely.`:i?`Someone reviewed it and chose to pass the text through unchanged. It doesn't change what the tool may do.`:`The toolbox changed the description before your AI saw it.`,(0,X.jsx)(`span`,{className:`mt-1.5 block font-mono text-[11.5px] text-soft`,children:r.map(e=>ie(e)===e?e:`${e} (${ie(e)})`).join(`, `)})]})}),n&&(0,X.jsxs)(`details`,{className:`mt-3`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer text-[13px] font-semibold text-soft`,children:`What ${t} originally said`}),(0,X.jsx)(`p`,{className:`mt-2 mb-2 text-[12.5px] text-soft`,children:`What the connected server sent (removed lines) and what your AI sees instead (added lines).`}),(0,X.jsx)(re,{before:Be(e.rawDescription),after:Be(e.description),label:`Original and shown description`})]})]})}function nn({tool:e,protection:t,serverId:n,tenant:r,ruleBlocked:i,onEditRule:a,onPosture:o,onChanged:s}){let[l,u]=(0,K.useState)(!1),d=e.effect===null&&!e.reclassifiedTo,f=e.exposure.disabled?`deny`:e.verdict.kind;return(0,X.jsxs)($,{title:`What it's allowed to do`,children:[(0,X.jsxs)(`div`,{className:`rounded-[20px] bg-sunken/70 p-5`,children:[(0,X.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,X.jsx)(E,{decision:f,label:e.exposure.disabled?`Turned off`:void 0})}),(0,X.jsx)(`p`,{className:`display mt-3 text-[22px] leading-snug`,children:Ce(e)}),t?.enforcement===`observe`&&e.verdict.kind!==`allow`&&!e.exposure.disabled&&(0,X.jsx)(`p`,{className:`mt-1 text-[13.5px] text-muted`,children:`That starts once protection is on. Your toolbox is only watching now, so for the moment it runs.`}),!e.exposure.disabled&&(0,X.jsxs)(`dl`,{className:`mt-4 space-y-2 text-[13.5px]`,children:[(0,X.jsxs)(rn,{label:`Why`,children:[Ee(e.verdict,t?.defaults.mode??null),(0,X.jsx)(`code`,{className:`mt-0.5 block font-mono text-[11.5px] break-all text-soft`,children:e.verdict.ruleId})]}),(0,X.jsxs)(rn,{label:`Labelled as`,children:[j[q(e)??`unknown`].label,`.`,` `,(0,X.jsx)(`span`,{className:`text-soft`,children:De[e.effectSource]??e.effectSource}),e.reclassifiedTo&&e.effect&&(0,X.jsxs)(`span`,{className:`block text-[12.5px] text-soft`,children:[`The connected server calls it “`,j[e.effect]?.label??e.effect,`”; a rule changed that.`]})]}),e.consoleRule&&(0,X.jsx)(rn,{label:`Set by`,children:`You, from this console. Use “Undo my change” to remove it.`})]}),(0,X.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,X.jsx)(D,{variant:`primary`,icon:`sliders`,onClick:a,disabled:i!==null,children:`Change what it may do`}),e.consoleRule&&(0,X.jsx)(D,{icon:`refresh`,onClick:()=>u(!0),disabled:i!==null,children:`Undo my change`}),d&&(0,X.jsx)(D,{variant:`ghost`,onClick:o,children:`Change the setting for unlabelled tools`})]}),i&&(0,X.jsx)(`p`,{className:`mt-2 text-[12.5px] text-soft`,children:i})]}),(0,X.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[t?.runtime.policyApplied===!1&&(0,X.jsxs)(c,{tone:`warn`,title:`The running toolbox hasn't picked up the latest settings`,children:[`What's shown here is the settings file. The toolbox still uses the version it read when it started`,` `,t.runtime.startedAt?x(t.runtime.startedAt):`earlier`,`. Restart it to apply the newer one.`]}),e.boundsDrift&&(0,X.jsxs)(c,{tone:`info`,title:`These limits no longer match the rule they were copied from`,children:[`When this rule was saved it copied the limits from`,` `,(0,X.jsx)(`code`,{className:`font-mono text-[12px]`,children:e.boundsDrift.ruleId}),`. That rule has changed since:`,(0,X.jsx)(`ul`,{className:`mt-1.5 list-disc space-y-0.5 pl-5`,children:e.boundsDrift.differences.map(e=>(0,X.jsx)(`li`,{children:J(e)},e))}),(0,X.jsx)(`span`,{className:`mt-1.5 block`,children:`This tool still follows its own copy. Change what it may do to take the newer limits, or leave it if these are the ones you want.`})]})]}),l&&(0,X.jsx)(an,{serverId:n,tenant:r,tool:e,protection:t,onClose:()=>u(!1),onDone:()=>{u(!1),s()}})]})}function rn({label:e,children:t}){return(0,X.jsxs)(`div`,{className:`grid gap-x-4 gap-y-0.5 sm:grid-cols-[110px_1fr]`,children:[(0,X.jsx)(`dt`,{className:`font-semibold text-soft`,children:e}),(0,X.jsx)(`dd`,{className:`min-w-0 text-ink`,children:t})]})}function an({serverId:e,tenant:t,tool:n,protection:r,onClose:i,onDone:a}){let o=I(),[l,u]=(0,K.useState)(null),[d,f]=(0,K.useState)(null),[p,m]=(0,K.useState)(!1),[h,g]=(0,K.useState)(0);(0,K.useEffect)(()=>{let r=!0;return u(null),_.clearPreview(e,n.name,t).then(e=>r&&u(e),e=>r&&f({text:Y(e),stale:!1})),()=>{r=!1}},[e,n.name,t,h]);async function v(){if(l){m(!0),f(null);try{let r=await _.clearToolRule(e,n.name,l.expectedDigest,t);o.show(`ok`,`Your change to ${n.name} is undone. The toolbox applies it within about a second.`),r.warning&&o.show(`warn`,J(r.warning)),a()}catch(e){f({text:Re(e)?ze:Y(e),stale:Re(e)})}finally{m(!1)}}}let y=l?.verdict.kind===`allow`?`run freely`:l?.verdict.kind===`approve`?`ask you first`:`be blocked`;return(0,X.jsx)(F,{open:!0,onClose:i,title:`Undo your change to ${n.name}?`,description:`This removes the rule you saved here. The tool goes back to whatever your other settings say.`,footer:(0,X.jsxs)(X.Fragment,{children:[d?.stale&&(0,X.jsx)(D,{variant:`ghost`,icon:`refresh`,className:`mr-auto`,onClick:()=>{f(null),g(e=>e+1)},children:`Reload`}),(0,X.jsx)(D,{variant:`secondary`,onClick:i,disabled:p,children:`Keep my change`}),(0,X.jsx)(D,{variant:`primary`,onClick:()=>void v(),disabled:!l,loading:p,children:`Undo change`})]}),children:(0,X.jsxs)(`div`,{className:`space-y-3 text-[14px]`,children:[!l&&!d&&(0,X.jsx)(s,{lines:3}),l&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,X.jsx)(`span`,{className:`text-[13px] text-soft`,children:`Afterwards it will`}),(0,X.jsx)(E,{decision:l.verdict.kind})]}),(0,X.jsxs)(`p`,{className:`text-muted`,children:[`Every call to `,(0,X.jsx)(`code`,{className:`font-mono text-ink`,children:n.name}),` will `,y,l.verdict.ruleId.startsWith(`defaults.`)?`, by your default settings`:``,`.`,l.bounds?` Limits: ${Me(l.bounds).join(`; `)}.`:``]}),l.becomesUnclassified&&(0,X.jsx)(c,{tone:`warn`,title:`Nothing else says what this tool does`,children:`Your change was the only label on this tool. Without it, it is treated as not labelled again.`}),r?.tenant&&(0,X.jsx)(`p`,{className:`text-[12.5px] text-soft`,children:`This affects every customer of this toolbox.`}),(0,X.jsxs)(`details`,{children:[(0,X.jsx)(`summary`,{className:`cursor-pointer text-[13px] font-semibold text-soft`,children:`Show the rule being removed`}),(0,X.jsx)(`div`,{className:`mt-2`,children:(0,X.jsx)(ne,{label:`The rule being removed`,children:l.yaml})})]})]}),d&&(0,X.jsx)(`p`,{role:`alert`,className:`text-[13.5px] font-medium text-bad`,children:d.text})]})})}function on({tool:e}){let t=e.bounds;return(0,X.jsx)($,{title:(0,X.jsxs)(X.Fragment,{children:[`Limits on its inputs `,(0,X.jsx)(w,{term:`limits`})]}),children:t?(0,X.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,X.jsx)(`ul`,{className:`space-y-1.5`,children:t.paths.map((e,n)=>(0,X.jsxs)(`li`,{className:`flex gap-2.5 text-[14px]`,children:[(0,X.jsx)(`span`,{className:`mt-[7px] h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--soft)]`,"aria-hidden":!0}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`code`,{className:`font-mono text-[13px] font-medium`,children:e}),` `,Me(t)[n].slice(e.length+1)]})]},e))}),(0,X.jsxs)(`p`,{className:`text-[13px] text-soft`,children:[`A call that breaks a limit `,t.onViolation===`approve`?`asks you first`:`is blocked`,`.`,` `,Le[t.unknownArgs]]}),e.unboundedInputs.length>0&&(0,X.jsxs)(`p`,{className:`text-[13px] text-ink`,children:[e.unboundedOpen?`Inputs with no limits include: `:`These inputs have no limits: `,e.unboundedInputs.map((e,t)=>(0,X.jsxs)(`span`,{children:[t>0&&`, `,(0,X.jsx)(`code`,{className:`font-mono text-[12.5px]`,children:e})]},e)),e.unboundedOpen&&` and any other input the tool accepts`,`. Set “Anything else the tool is sent” to block or ask to cover them.`]}),(0,X.jsx)(`p`,{className:`font-mono text-[11.5px] text-soft`,children:t.ruleId})]}):(0,X.jsx)(`p`,{className:`text-[14px] text-soft`,children:`No limits. Every input is passed on as your AI sends it.`})})}function sn({tool:t,loading:n}){return(0,X.jsxs)($,{title:`Inputs`,children:[t.args.length===0?(0,X.jsx)(`p`,{className:`text-[14px] text-soft`,children:`This tool takes no inputs.`}):(0,X.jsx)(`ul`,{className:`divide-y divide-faint rounded-[18px] border border-line`,children:t.args.map(t=>(0,X.jsxs)(`li`,{className:`px-4 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,X.jsx)(`code`,{className:`font-mono text-[13.5px] font-medium break-all`,children:t.name}),(0,X.jsxs)(`span`,{className:`text-[12.5px] text-soft`,children:[t.type??`any type`,t.format?`, ${t.format}`:``,` · `,t.required?`required`:`optional`]}),t.constrainedByRule&&(0,X.jsx)(e,{tone:`neutral`,icon:`sliders`,className:`py-0 text-[11.5px]`,children:`Limited`})]}),t.description&&(0,X.jsx)(`p`,{className:`mt-1 text-[13px] text-muted`,children:t.description}),t.enumValues&&(0,X.jsxs)(`p`,{className:`mt-1 text-[12.5px] text-soft`,children:[`Accepts: `,(0,X.jsx)(`span`,{className:`font-mono`,children:t.enumValues.join(`, `)})]}),t.defaultValue!==null&&(0,X.jsxs)(`p`,{className:t.defaultIsUrl?`mt-1 text-[12.5px] text-warn`:`mt-1 text-[12.5px] text-soft`,children:[`If left out: `,(0,X.jsx)(`span`,{className:`font-mono break-all`,children:t.defaultValue}),t.defaultIsUrl&&` (a web address the connected server contacts on its own; your network limits don't cover it)`]})]},t.name))}),t.schemaClosed===!1&&(0,X.jsx)(`p`,{className:`mt-2 text-[13px] text-warn`,children:`The connected server accepts inputs beyond the ones listed here, and passes them on as given.`}),(0,X.jsxs)(`details`,{className:`mt-3`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer text-[13px] font-semibold text-soft`,children:`Show the full input definition`}),(0,X.jsx)(`div`,{className:`mt-2`,children:n?(0,X.jsx)(s,{lines:4}):(0,X.jsx)(ne,{copy:!0,label:`Input definition`,children:JSON.stringify(t.inputSchema??{},null,2)})})]})]})}function cn({tool:t,nav:n}){return(0,X.jsx)($,{title:(0,X.jsxs)(X.Fragment,{children:[`Pre-approvals that cover it `,(0,X.jsx)(w,{term:`preApproval`})]}),aside:(0,X.jsx)(T,{href:r(n,`/pre-approvals`),size:`sm`,variant:`ghost`,iconRight:`arrow-right`,children:`Open pre-approvals`}),children:t.standingGrants.length===0?(0,X.jsx)(`p`,{className:`text-[14px] text-soft`,children:`None. When this tool asks first, you decide each call.`}):(0,X.jsx)(`ul`,{className:`space-y-2`,children:t.standingGrants.map(t=>(0,X.jsxs)(`li`,{className:`rounded-[18px] border border-line px-4 py-3 text-[13.5px]`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(e,{tone:t.covers?`ok`:`neutral`,icon:t.covers?`check`:`x`,children:t.covers?`Covers this tool`:`Doesn't apply`}),(0,X.jsxs)(`span`,{className:`text-soft`,children:[t.uses,` of `,t.maxUses??`unlimited`,` uses · ends `,x(t.expiresAt)]})]}),t.reason&&(0,X.jsx)(`p`,{className:`mt-1.5 text-ink`,children:t.reason}),!t.covers&&(0,X.jsx)(`p`,{className:`mt-1 text-soft`,children:J(t.why)}),t.covers&&t.heldBounds.length>0&&(0,X.jsxs)(`p`,{className:`mt-1 text-soft`,children:[`A call that breaks the limit on `,(0,X.jsx)(`span`,{className:`font-mono`,children:t.heldBounds.join(`, `)}),` still asks you, because this pre-approval doesn't limit that input.`]}),(0,X.jsx)(`p`,{className:`mt-1 font-mono text-[11.5px] text-soft`,children:t.grantId})]},t.grantId))})})}function ln({tool:t,loading:n,nav:i}){let a=t?.activity??[];return(0,X.jsx)($,{title:`Recent activity`,aside:t&&(0,X.jsx)(T,{href:r(i,`/activity`,{tool:t.name}),size:`sm`,variant:`ghost`,iconRight:`arrow-right`,children:`Open activity`}),children:n?(0,X.jsx)(s,{lines:3}):a.length===0?(0,X.jsx)(`p`,{className:`text-[14px] text-soft`,children:`Your AI hasn't used this tool yet.`}):(0,X.jsx)(`ul`,{className:`divide-y divide-faint`,children:a.map(t=>{let n=k[t.outcome];return(0,X.jsxs)(`li`,{className:`flex flex-wrap items-start gap-x-3 gap-y-1 py-2.5`,children:[(0,X.jsx)(`span`,{className:`w-24 shrink-0 text-[12.5px] text-soft`,title:l(t.ts),children:x(t.ts)}),(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(E,{decision:t.decision}),n&&(0,X.jsx)(e,{tone:n.tone,className:`py-0 text-[11.5px]`,children:n.label}),t.observe&&(0,X.jsx)(e,{tone:`neutral`,className:`py-0 text-[11.5px]`,children:`Watch-only`})]}),t.reason&&(0,X.jsx)(`span`,{className:`w-full text-[12.5px] text-soft sm:pl-[108px]`,children:J(t.reason)})]},t.id)})})})}function un({tool:e,exposure:t,perCustomer:n}){let[r,i]=(0,K.useState)(``),o=e.exposure.disabled;return(0,X.jsx)($,{title:(0,X.jsxs)(X.Fragment,{children:[`Turn off this tool `,(0,X.jsx)(w,{term:`killSwitch`})]}),children:(0,X.jsxs)(`div`,{className:`space-y-4 rounded-[20px] border border-line p-5`,children:[(0,X.jsx)(p,{checked:o,onChange:n=>t.set(e,n,n?r.trim():``),disabled:t.blocked!==null||t.busy(e.name),label:o?`This tool is turned off`:`Turn off this tool`,description:o?`Your AI can't see it, and every call is blocked${e.exposure.setBy?`. Turned off by ${e.exposure.setBy}`:``}${e.exposure.setAt?` ${x(e.exposure.setAt)}`:``}.`:`Hides it from your AI and blocks every call, even in watch-only mode.`}),o&&e.exposure.reason&&(0,X.jsxs)(`p`,{className:`text-[13.5px] text-muted`,children:[`Reason given: `,(0,X.jsx)(`span`,{className:`text-ink`,children:e.exposure.reason})]}),!o&&(0,X.jsx)(a,{label:`Reason`,optional:!0,help:`Saved in the activity log with the change.`,children:(0,X.jsx)(f,{value:r,onChange:i,placeholder:`For example: misbehaving since the last update`,disabled:t.blocked!==null})}),(0,X.jsxs)(`p`,{className:`text-[12.5px] text-soft`,children:[`Turning it back on returns it to your normal rules. It never makes it allowed on its own`,e.exposure.policyWouldExpose?`.`:`: your rules block this tool anyway.`,n&&` This switch is kept separately for each customer.`]}),t.blocked&&(0,X.jsx)(c,{tone:`warn`,title:`Not available right now`,children:t.blocked})]})})}var dn=`hmcp.tools.look`;function fn(){try{return localStorage.getItem(dn)===`detailed`?`detailed`:`simple`}catch{return`simple`}}function pn(e){try{localStorage.setItem(dn,e)}catch{}}var mn={allow:`allow`,approve:`approve`,deny:`deny`,unlabelled:`unclassified`,off:null,changed:null};function hn(){let{server:e,serverId:t,tenant:i,nav:a,reload:l}=U(),u=le(()=>_.protection(t,i),[t,i],3e4),f=le(()=>ue(t),[t],3e4),[p,m]=(0,K.useState)(0),[g,v]=(0,K.useState)(``),[y,C]=(0,K.useState)(`any`),[w,ee]=(0,K.useState)(null),[ne,E]=(0,K.useState)(!1),[re,ie]=(0,K.useState)(fn),ae=(0,K.useRef)(void 0);(0,K.useEffect)(()=>()=>clearTimeout(ae.current),[]);let O=u.data,se=a.query.get(`tool`),k=a.query.get(`verdict`),j=be(k)?k:null,M=a.query.get(`view`)===`changed`?`changed`:`all`,N=a.query.get(`list`),F=N===`detailed`||N===`simple`?N:re,I=()=>{u.reload(),f.reload(),m(e=>e+1),l()},L=()=>{I(),clearTimeout(ae.current),ae.current=setTimeout(I,1500)},R=Ke({serverId:t,tenant:i,protection:O,onChanged:I}),z=(0,K.useMemo)(()=>O?.tools??[],[O]),B=z.length===0?O?.surface.provisional??[]:[],V=(0,K.useMemo)(()=>e?.upstreams??[],[e]),H=(0,K.useMemo)(()=>new Set((f.data?.changed??[]).map(e=>e.tool)),[f.data]),de=(0,K.useMemo)(()=>new Set((f.data?.changed??[]).filter(e=>e.withheld).map(e=>e.tool)),[f.data]),fe=(0,K.useMemo)(()=>{let e={allow:0,approve:0,deny:0,unlabelled:0,off:0,changed:0};for(let t of z)e[xe(t)]++,H.has(t.name)&&e.changed++;return e},[z,H]),W=(0,K.useMemo)(()=>{let e=g.trim().toLowerCase();return z.filter(t=>!((j===`changed`?!H.has(t.name):j!==null&&xe(t)!==j)||y!==`any`&&q(t)!==y||e&&!`${t.name} ${t.description} ${t.upstream}`.toLowerCase().includes(e))).sort((e,t)=>e.upstream.localeCompare(t.upstream)||e.name.localeCompare(t.name))},[z,j,y,g,H]),pe=O?O.surface.neverPublished?`Your toolbox hasn't run yet, so there's no list of its tools to set a rule on. Open your AI app once, then come back.`:O.policyWrite.ok?null:J(O.policyWrite.why??`This toolbox's settings can't be changed from here.`):null,G=f.data?.changed.length??0,me=e=>P(o(a,{verdict:e})),ge=e=>P(o(a,{view:e===`changed`?e:null})),Se=e=>P(o(a,{tool:e}));return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(te,{title:`Tools`,subtitle:`Everything your AI can use through your toolbox, and what each one is allowed to do.`,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(D,{icon:`help`,onClick:()=>E(!0),disabled:!O,children:`What happens to unlabelled tools`}),G>0&&(0,X.jsxs)(D,{variant:`primary`,icon:`refresh`,onClick:()=>ge(`changed`),children:[`Review changed tools (`,G,`)`]})]})}),O?.enforcement===`observe`&&(0,X.jsx)(`div`,{className:`mb-5`,children:(0,X.jsx)(c,{tone:`warn`,title:`Only watching: every tool runs for now`,children:`Your toolbox isn't protecting you yet, so nothing below asks you first or is blocked today. The labels say what happens once protection is on.`})}),(0,X.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-center justify-between gap-3`,children:[(0,X.jsx)(ce,{label:`Tool views`,value:M,onChange:ge,items:[{id:`all`,label:`All tools`,count:O&&B.length===0?z.length:void 0},{id:`changed`,label:`Changed tools`,count:G}]}),M===`all`&&B.length===0&&(0,X.jsx)(h,{label:`How to show tools`,size:`sm`,value:F,onChange:e=>{pn(e),ie(e),P(o(a,{list:e===`detailed`?e:null}))},options:[{value:`simple`,label:`Simple`},{value:`detailed`,label:`Detailed`}]})]}),(0,X.jsx)(`div`,{role:`tabpanel`,id:S(M),"aria-labelledby":d(M),className:`space-y-5`,children:M===`changed`?(0,X.jsx)(Ue,{serverId:t,data:f.data,error:f.error,loading:f.loading,reload:f.reload,onAccepted:I}):u.error&&!O?(0,X.jsx)(c,{tone:`danger`,title:`The tool list couldn't be loaded`,actions:(0,X.jsx)(D,{size:`sm`,icon:`refresh`,onClick:u.reload,children:`Try again`}),children:Y(u.error)}):(0,X.jsxs)(X.Fragment,{children:[O&&B.length>0&&(0,X.jsx)(c,{tone:`info`,title:`Tools found when you connected`,children:he(_e(a.query.get(`app`)))}),O&&R.blocked&&B.length===0&&(0,X.jsx)(c,{tone:`warn`,title:O.surface.neverPublished?`No tool list yet`:`The toolbox isn't running`,children:O.surface.neverPublished?`This toolbox hasn't reported which tools its connected servers offer. Start it once and they appear here.`:`This is the list it reported ${O.surface.publishedAt?x(O.surface.publishedAt):`last time`}. Start the toolbox to turn tools off or change their rules.`}),B.length>0?(0,X.jsx)(Ye,{tools:B,watching:O?.enforcement===`observe`}):F===`simple`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(gn,{value:g,onChange:v}),(0,X.jsx)(T,{href:r(a,`/protection`,{focus:`stance`}),icon:`sliders`,children:`Change how careful to be (all servers)`})]}),(0,X.jsx)(Xt,{protection:O,tools:z,query:g,onClearQuery:()=>v(``),changed:H,selected:se,onOpen:Se,exposure:R,configured:V,withheld:de,connectionsHref:r(a,`/connections`),onPosture:()=>E(!0)})]}):(0,X.jsxs)(A,{padded:!1,children:[(0,X.jsxs)(`div`,{className:`space-y-4 border-b border-faint p-5 sm:p-6`,children:[(0,X.jsx)(`div`,{role:`group`,"aria-label":`Show tools that`,className:`flex flex-wrap gap-2`,children:ve.map(e=>(0,X.jsx)(_n,{label:ye[e],count:O?fe[e]:null,dot:mn[e],icon:e===`off`?`power`:e===`changed`?`refresh`:null,on:j===e,onClick:()=>me(j===e?null:e)},e))}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,X.jsx)(gn,{value:g,onChange:v}),(0,X.jsx)(oe,{"aria-label":`Show tools by what they do`,value:y,onChange:C,className:`w-full sm:w-52`,options:[{value:`any`,label:`Any kind of tool`},{value:`read`,label:`Looks only`},{value:`write`,label:`Makes changes`},{value:`destructive`,label:`Deletes`}]})]})]}),(0,X.jsx)(`div`,{className:`px-5 pt-1 pb-3 sm:px-6`,children:O?z.length===0?(0,X.jsx)(b,{icon:`tool`,title:`No tools yet`,children:O.surface.neverPublished?`Start the toolbox once and the tools its connected servers offer will appear here.`:`The connected servers on this toolbox don't offer any tools.`}):W.length===0?(0,X.jsx)(b,{icon:`search`,title:`No tools match`,compact:!0,actions:(0,X.jsx)(D,{onClick:()=>{v(``),C(`any`),me(null)},children:`Clear filters`}),children:`Nothing on this toolbox matches what you picked.`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`sr-only`,"aria-live":`polite`,children:[n(W.length,`tool`),` shown`]}),(0,X.jsx)(Ut,{tools:W,changed:H,selected:se,onOpen:Se,exposure:R})]}):(0,X.jsx)(`div`,{className:`space-y-5 py-4`,"aria-busy":!0,children:[0,1,2,3].map(e=>(0,X.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,X.jsx)(`span`,{className:`skeleton h-11 w-11 shrink-0 rounded-full`}),(0,X.jsx)(`div`,{className:`flex-1`,children:(0,X.jsx)(s,{lines:2})})]},e))})})]})]})}),(0,X.jsx)(en,{name:se,serverId:t,tenant:i,protection:O,listTool:z.find(e=>e.name===se)??null,version:p,nav:a,exposure:R,ruleBlocked:pe,onClose:()=>Se(null),onEditRule:ee,onPosture:()=>E(!0),onChanged:L}),w&&(0,X.jsx)(ct,{open:!0,serverId:t,tenant:i,tool:w,protection:O,onClose:()=>ee(null),onSaved:L},w.name),O&&ne&&(0,X.jsx)(Je,{open:!0,serverId:t,tenant:i,protection:O,onClose:()=>E(!1),onSaved:L,onReload:u.reload}),R.dialog]})}function gn({value:e,onChange:t}){return(0,X.jsxs)(`div`,{className:`relative min-w-0 flex-1 basis-60`,children:[(0,X.jsx)(g,{name:`search`,size:18,className:`pointer-events-none absolute top-1/2 left-3.5 -translate-y-1/2 text-soft`}),(0,X.jsx)(f,{type:`search`,value:e,onChange:t,placeholder:`Search by name or description`,"aria-label":`Search tools by name or description`,className:`pl-10`})]})}function _n({label:e,count:t,dot:n,icon:r,on:i,onClick:a}){return(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:a,className:L(`inline-flex h-10 items-center gap-2 rounded-full border-[1.5px] px-4 text-[13.5px] font-semibold transition-colors active:scale-[.98]`,i?`border-primary bg-primary text-white`:`border-line text-muted hover:border-[var(--soft)] hover:text-ink`),children:[n&&(i?(0,X.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-white`,"aria-hidden":!0}):(0,X.jsx)(v,{decision:n})),r&&(0,X.jsx)(g,{name:r,size:15,strokeWidth:2}),e,(0,X.jsx)(`span`,{className:L(`tnum rounded-full px-1.5 text-[12px]`,i?`bg-white/20`:`bg-faint`),children:t??`–`})]})}export{hn as ToolsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cn as e,rn as t}from"./index-
|
|
1
|
+
import{cn as e,rn as t}from"./index-2otwle61.js";var n=`Connect your AI app`,r=`Pick the AI app you use. The servers it already has move into your toolbox, so every call they make is written down under Activity. A copy of the app's old settings is kept, so you can undo it.`,i=`"Undo connection" under Advanced in Connect your AI app`,a=`Also record what Claude Code does by itself (reading and editing files, running commands)`;function o(e){return e?.mode===`protecting`?`Your toolbox is protecting you, so these follow its rules: looking runs, but editing files and running commands wait for your OK here, and are refused if nobody answers within 2 minutes. Tools you switched off are blocked.`:e&&e.mode!==`watching`?`These follow your toolbox's rules: while it only watches, they are written down and nothing is blocked; once it protects you, editing files and running commands wait for your OK here. Tools you switched off stay off either way.`:`Written down only, nothing is blocked. Once you turn on protection, these will wait for your OK here, like other changes. Two things apply even now: tools you switched off stay off, and a change to Claude Code's own settings or this console's files waits for your OK.`}var s=`Not on this computer`,c=`Can't be connected from here`,l=`No AI app was found on this computer.`,u=`Install one of these, open it once, then come back here and press Check again.`,d=`Advanced`,f=`For one project folder only, a different toolbox, Roo Code, or adding your toolbox to an app without moving its servers.`;function p(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function m(e){return{moving:e.servers.filter(e=>e.auto),staying:e.servers.filter(e=>!e.auto)}}function h(e){let{moving:t,staying:n}=m(e);if(e.servers.length===0)return e.connected?`It is connected to your toolbox.`:`It has no servers yet.`;if(t.length===0)return`${e.connected?`Nothing more to move into your toolbox`:`No servers can move into your toolbox yet`} · ${p(n.length,`server`)} ${n.length===1?`stays`:`stay`}`;let r=`${p(t.length,`server`)} will move into your toolbox`;return n.length>0?`${r} · ${n.length} ${n.length===1?`stays`:`stay`}`:r}function g(n){return e(t(n.why??n.reason??`It can't be brought in.`))}function _(e){return`${e} is open. Quit it completely first, so it doesn't write its old list of servers back.`}function v(e){return e===`adopt`?`It was connected the older way. Use ${i}, then connect it again here.`:e===`entry-missing`||e===`toolbox-missing`?`Its connection from this console no longer works. Use ${i}, then connect it again here.`:null}function y(e){return`Wait for ${e} to finish connecting.`}function b(e){return`Undo connecting ${e}`}function x(e,t,n=!1){return t&&n?`Update ${e}`:t?`Connect ${e} again`:`Connect ${e}`}function S(e,t){return t.runs===t.current?`${e} starts your toolbox in an older way. Update it so it uses ${t.current}.`:`${e} runs an older copy of your toolbox (${t.runs}). Update it so it uses ${t.current}.`}function C(e,t){return`${e} now uses ${t.to}.`}function w(e){return`Use ${e}`}function T(e,t){let n=t.servers.length>0?`already has ${t.servers.join(`, `)}`:`already has servers of its own`;return`${e}'s servers would go into ${t.label}, which ${n}. ${e} would be able to use those too.`}function E(e,t){return e.alreadyConnected&&e.imported.length===0&&e.takenOut.length===0?e.refreshed?`Updated ${t}`:`${t} was already connected`:`Connected ${t}`}function D(e,t){let n=e.imported.length;return n===0?`No new servers moved this time.`:`${p(n,`server`)} will go through ${e.toolbox.label} once you restart ${t} (${p(e.toolCount,`tool`)}):`}function O(e,t){return`Already in your toolbox, so ${e}'s own ${t.length===1?`copy was`:`copies were`} taken out: ${t.join(`, `)}.`}function k(e){return`Left in ${e}, outside your toolbox (not recorded)`}var A=`Web addresses your toolbox may now reach`,j=`The servers you moved live at these addresses, so your toolbox was allowed to connect to them.`;function M(e){return e===1?`1 step left`:`${e} steps left`}function N(e){return`Switch off “${e}” in Claude Desktop`}var P=`Not recorded`,F=`Claude Code's own actions (reading and editing files, running commands, opening web pages) are recorded too.`,I=`Claude Code's own actions are no longer recorded.`;function L(e){return e===`observe`?`Watching only: everything runs and is written down.`:e===`enforce`?`Protecting: changes ask you first, and everything is written down.`:null}function R(e){return`${e.join(` and `)} also ${e.length===1?`uses`:`use`} this toolbox, so ${e.length===1?`it gets`:`they get`} these servers too.`}var z=`Some servers need your OK before they can move`;function B(e,t){return t?`${e} wasn't connected`:`${e} has no servers to bring in yet`}function V(e,t){return t?`None of ${e}'s servers could be brought in. Nothing was changed. The list below says why. You can add a server instead: that makes your toolbox, and then you can connect ${e} to it.`:`Nothing was changed. Add a server first: that makes your toolbox. Then connect ${e} to it.`}function H(e,t){return t?`${e} is back as it was`:`Undone: ${e} stays connected to your toolbox, as it was before`}function U(e){return`${e.restored.length>0?`Put back in the app: ${e.restored.join(`, `)}.`:``}${e.toolboxDeleted?` The toolbox made for it was removed.`:``}`.trim()||`Nothing else needed putting back.`}function W(e){return`Taken out of your toolbox: ${e.join(`, `)}.`}function G(e){return`Still in your toolbox: ${e.join(`, `)}.`}var K={"claude-desktop":`Claude Desktop`,"claude-code":`Claude Code`,cursor:`Cursor`,vscode:`VS Code`,codex:`Codex or the ChatGPT desktop app`,"copilot-cli":`GitHub Copilot CLI`,antigravity:`Antigravity`,devin:`Devin`,junie:`Junie`,windsurf:`Windsurf`};function q(e){return e&&K[e]||`your AI app`}var J=`Tools found when you connected`;function Y(e){return`Restart ${e} so it starts using your toolbox. Then you can turn tools on or off here.`}var X={read:`Looks at things`,write:`Makes changes`,destructive:`Deletes things`,unknown:`We're not sure what it does`};function Z(e,t){return e===`run`?`Runs`:e===`ask`?t?`Would ask you first`:`Asks you first`:t?`Would be blocked`:`Blocked`}export{R as A,g as B,p as C,D,k as E,Z as F,U as G,N as H,_ as I,L as J,H as K,C as L,h as M,m as N,V as O,Y as P,W as R,v as S,G as T,O as U,M as V,b as W,z as _,F as a,T as b,j as c,u as d,l as f,J as g,X as h,a as i,S as j,B as k,s as l,n as m,d as n,I as o,r as p,y as q,c as r,A as s,f as t,P as u,q as v,o as w,x,w as y,E as z};
|