hmcp-web 0.2.0 → 0.2.1
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/model/protection.d.ts +1 -0
- package/dist/model/protection.js +6 -2
- package/dist-ui/assets/{Activity-CZ78RyRO.js → Activity-Dgo5oK2r.js} +1 -1
- package/dist-ui/assets/{Approvals-DPIlNZsv.js → Approvals-C5_8rBkL.js} +1 -1
- package/dist-ui/assets/{AttachApp-DjSeWCbS.js → AttachApp-BRW1mJ7X.js} +1 -1
- package/dist-ui/assets/{Connections-qcA96lXh.js → Connections-BHsXRdYI.js} +1 -1
- package/dist-ui/assets/{PreApprovals-C4cKajcK.js → PreApprovals-CXcU-_ug.js} +1 -1
- package/dist-ui/assets/{Protection-B8h-5YAb.js → Protection-BF5OlzGC.js} +1 -1
- package/dist-ui/assets/{Safety-BQqHyYdo.js → Safety-DVb8sdbt.js} +1 -1
- package/dist-ui/assets/{Settings-Cx50zZSt.js → Settings-XjNZ-wo-.js} +1 -1
- package/dist-ui/assets/{StartPage-CdX-v7ej.js → StartPage-D8WBBhDy.js} +1 -1
- package/dist-ui/assets/{Suggestions-CRo5UOTT.js → Suggestions-HZyd0jDU.js} +1 -1
- package/dist-ui/assets/Tools-GMaKxxIG.js +4 -0
- package/dist-ui/assets/index-CvZ3niHA.css +2 -0
- package/dist-ui/assets/{index-DttDjRpu.js → index-DbHZ_SUd.js} +2 -2
- package/dist-ui/index.html +2 -2
- package/package.json +4 -4
- package/dist-ui/assets/Tools-xo39lPKB.js +0 -4
- package/dist-ui/assets/index-QeJyD5z2.css +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Activity-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Activity-Dgo5oK2r.js","assets/kit-DRVm92_t.js","assets/Approvals-C5_8rBkL.js","assets/Connections-BHsXRdYI.js","assets/AttachApp-BRW1mJ7X.js","assets/PreApprovals-CXcU-_ug.js","assets/Protection-BF5OlzGC.js","assets/Safety-DVb8sdbt.js","assets/Settings-XjNZ-wo-.js","assets/Suggestions-HZyd0jDU.js","assets/Tools-GMaKxxIG.js","assets/Gallery-DB_OO7Vw.js","assets/StartPage-D8WBBhDy.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{$ as e,At as t,B as n,C as r,Ct as i,E as a,Et as o,F as s,Ft as c,G as l,H as u,It as d,Lt as f,M as p,Nt as m,O as h,Ot as g,Pt as _,St as v,Tt as y,U as b,V as x,W as ee,X as S,Z as te,_t as ne,a as C,c as re,ct as w,et as ie,ft as T,g as ae,gt as oe,h as se,ht as E,i as ce,kt as le,mt as ue,ot as de,pt as fe,r as pe,s as me,tt as he,v as ge,vt as _e,wt as ve,x as ye,xt as be,y as xe,yt as Se,z as D}from"./kit-DRVm92_t.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var O=f((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,ee||(ee=!0,w());else{var t=n(l);t!==null&&ae(x,t.startTime-e)}}}var ee=!1,S=-1,te=5,ne=-1;function C(){return g?!0:!(e.unstable_now()-ne<te)}function re(){if(g=!1,ee){var t=e.unstable_now();ne=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(S),S=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&C());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ae(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?w():ee=!1}}}var w;if(typeof y==`function`)w=function(){y(re)};else if(typeof MessageChannel<`u`){var ie=new MessageChannel,T=ie.port2;ie.port1.onmessage=re,w=function(){T.postMessage(null)}}else w=function(){_(re,0)};function ae(t,n){S=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):te=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(S),S=-1):h=!0,ae(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,w()))),r},e.unstable_shouldYield=C,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Ce=f(((e,t)=>{t.exports=O()})),we=f((e=>{var t=Ce(),n=d(),r=c();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(o(e)!==e)throw Error(i(188))}function f(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return u(a),e;if(s===r)return u(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,l=a.child;l;){if(l===n){c=!0,n=a,r=s;break}if(l===r){c=!0,r=a,n=s;break}l=l.sibling}if(!c){for(l=s.child;l;){if(l===n){c=!0,n=s,r=a;break}if(l===r){c=!0,r=s,n=a;break}l=l.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}function m(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&m(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function h(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function g(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function _(e){var t=[null,null],n=h(e);return n===null||v(t,e,n.child,{foundSelf:!1}),t}function v(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&v(e,t,n.child,r))return!0;n=n.sibling}return!1}function y(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var b=null,x=null;function ee(e,t,n){return e===n||e===t&&(b=e,!0)}function S(e,t,n){return e===n?(x=e,!1):e===t&&(x!==null&&(b=e),!0)}function te(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function ne(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var C=Object.assign,re=Symbol.for(`react.element`),w=Symbol.for(`react.transitional.element`),ie=Symbol.for(`react.portal`),T=Symbol.for(`react.fragment`),ae=Symbol.for(`react.strict_mode`),oe=Symbol.for(`react.profiler`),se=Symbol.for(`react.consumer`),E=Symbol.for(`react.context`),ce=Symbol.for(`react.forward_ref`),le=Symbol.for(`react.suspense`),ue=Symbol.for(`react.suspense_list`),de=Symbol.for(`react.memo`),fe=Symbol.for(`react.lazy`),pe=Symbol.for(`react.activity`),me=Symbol.for(`react.legacy_hidden`),he=Symbol.for(`react.memo_cache_sentinel`),ge=Symbol.for(`react.view_transition`),_e=Symbol.for(`react.recoverable`),ve=Symbol.iterator;function ye(e){return typeof e!=`object`||!e?null:(e=ve&&e[ve]||e[`@@iterator`],typeof e==`function`?e:null)}var be=Symbol.for(`react.client.reference`);function xe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===be?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case T:return`Fragment`;case oe:return`Profiler`;case ae:return`StrictMode`;case le:return`Suspense`;case ue:return`SuspenseList`;case pe:return`Activity`;case ge:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case ie:return`Portal`;case E:return e.displayName||`Context`;case se:return(e._context.displayName||`Context`)+`.Consumer`;case ce:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case de:return t=e.displayName||null,t===null?xe(e.type)||`Memo`:t;case fe:t=e._payload,e=e._init;try{return xe(e(t))}catch{}}return null}var Se=Array.isArray,D=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,we={pending:!1,data:null,method:null,action:null},Te=[],k=-1;function Ee(e){return{current:e}}function De(e){0>k||(e.current=Te[k],Te[k]=null,k--)}function A(e,t){k++,Te[k]=e.current,e.current=t}var Oe=Ee(null),ke=Ee(null),Ae=Ee(null),je=Ee(null);function Me(e,t){switch(A(Ae,t),A(ke,e),A(Oe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}De(Oe),A(Oe,e)}function Ne(){De(Oe),De(ke),De(Ae)}function Pe(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,A(je,e)),t=Oe.current;var n=dp(t,e.type);t!==n&&(A(ke,e),A(Oe,n))}function Fe(e){ke.current===e&&(De(Oe),De(ke)),je.current===e&&(De(je),sh._currentValue=we)}var Ie,Le;function Re(e){if(Ie===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ie=t&&t[1]||``,Le=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+Ie+e+Le}var ze=!1;function Be(e,t){if(!e||ze)return``;ze=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -13,4 +13,4 @@ Error generating stack: `+e.message+`
|
|
|
13
13
|
`)+`
|
|
14
14
|
`}function Zn(e,t,n){let r=URL.createObjectURL(new Blob([n],{type:t})),i=document.createElement(`a`);i.href=r,i.download=e,document.body.append(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}async function Qn(e){try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function $n(e){let t=e.split(/(?<=[.!?])\s+/),n=t.filter(e=>!/\b(hmcp-gateway|hmcp-web|npx)\b|\bhmcp [a-z]|(^|\s)--[a-z]/.test(e));return(n.length>0?n:t).join(` `).replace(/!/g,`.`)}var er=`This changed since you opened it. Reload and try again.`;function tr(e){return e instanceof m&&e.status===409}var nr={"exposure.disable":`Turned off`,"exposure.enable":`Turned back on`,"approval.decide":`Answered a waiting call for`,"standing_grant.create":`Pre-approved`,"standing_grant.use":`Used a pre-approval for`,"standing_grant.revoke":`Cancelled a pre-approval for`,"policy.reload":`Reloaded protection settings`,"policy.reload-refused":`Refused new protection settings`,"policy.reclassify":`Labelled`,"policy.tool-rule.set":`Set a rule for`,"policy.tool-rule.update":`Changed the rule for`,"policy.tool-rule.clear":`Removed the rule for`,"policy.tool-rule.refused":`Was refused a rule change for`,"policy.unclassified-posture":`Changed what happens to unlabelled tools`,HMCP005:`Found hidden instructions in`,HMCP011:`Noticed a change to`,HMCP012:`Withheld a result from`};function rr(e){return e.component===`hmcp-web`||/^\(.*\)$/.test(e.tool??``)}var ir={"(policy)":`Changed the protection settings`,"(gateway)":`Changed the toolbox's setup`,"(connect)":`Changed which AI apps use the toolbox`};function ar(e){if(e.rule_id===`gateway.unknown-tool`)return{verb:`Asked for a tool that doesn't exist:`,tool:e.tool||null,outcome:{label:`No such tool`,tone:`warn`}};let t=nr[e.rule_id];if(rr(e)&&!(t&&e.duration_ms===null)){let t=/^\(.*\)$/.test(e.tool??``),n=Vn(e);return{verb:n&&n.title!==`Setting changed`?n.title:ir[e.tool??``]??`Changed a setting`,tool:t?null:e.tool||null,outcome:{label:`Setting changed`,tone:`neutral`}}}if(e.duration_ms===null&&t){let n=/^HMCP\d+$/.test(e.rule_id)?{label:`Flagged`,tone:`warn`}:e.rule_id===`approval.decide`?e.decision===`deny`?{label:`Refused`,tone:`bad`}:{label:`Approved`,tone:`ok`}:e.rule_id.startsWith(`standing_grant.`)?{label:`Pre-approval`,tone:`neutral`}:{label:`Setting changed`,tone:`neutral`};return{verb:t,tool:/^\(.*\)$/.test(e.tool??``)?null:e.tool||null,outcome:n}}if(e.observe)return{verb:e.decision===`allow`?`Ran`:e.decision===`approve`?`Ran, would have asked about`:`Ran, would have blocked`,tool:e.tool||null,outcome:{label:`Watch-only`,tone:e.decision===`allow`?`ok`:`warn`}};if(Un(e))return{verb:`You said no to`,tool:e.tool||null,outcome:{label:`You said no`,tone:`bad`}};let n=e.outcome===`pending-approval`?`Is waiting for you on`:e.outcome===`error`?`Tried`:e.decision===`deny`||e.outcome===`denied`?`Was blocked from`:e.decision===`approve`?`Ran after asking`:`Ran`,r=de[e.outcome];return{verb:n,tool:e.tool||null,outcome:r??{label:e.outcome,tone:`neutral`}}}function or(e,t){return t===`hmcp-web`?`You, in the console`:e?e===`console`?`Someone in the console`:e===`gateway`?`The toolbox`:e===`agent`?`Your AI app`:e:`Your AI app`}var sr=e=>/[*?{},[\]]/.test(e);function cr(e){let t=[];return 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.enum&&t.push(e.enum.length===1?`always ${String(e.enum[0])}`:`one of ${e.enum.map(String).join(`, `)}`),t.length===0&&t.push(`any value`),e.optional&&t.push(`or left out`),t.join(`, `)}function lr(e){let t=e.decision===`allow`?`Let`:e.decision===`approve`?`Ask you before`:`Block`,n=e.match,r=e.decision===`allow`?` run without asking`:e.decision===`approve`?` runs`:``,i=e.args&&Object.keys(e.args).length>0,a=r;return i&&e.decision!==`deny`&&(a+=`, as long as its inputs stay like the ones seen`,a+=e.on_violation===`approve`?`. Anything else asks you first`:`. Anything else is blocked`),e.unknown_args===`deny`?a+=`. An input it was never seen with is blocked`:e.unknown_args===`approve`&&(a+=`. An input it was never seen with asks you first`),{lead:t,subject:n,rest:`${a}.`}}var ur=e=>typeof e==`string`?/^[A-Za-z0-9_./-]+$/.test(e)&&!/^(true|false|null|yes|no|on|off)$/i.test(e)?e:JSON.stringify(e):String(e);function dr(e){let t=[`- id: ${ur(e.id)}`,` match: ${ur(e.match)}`];if(e.effect&&t.push(` effect: ${e.effect}`),t.push(` decision: ${e.decision}`),e.on_violation&&t.push(` on_violation: ${e.on_violation}`),e.unknown_args&&t.push(` unknown_args: ${e.unknown_args}`),e.args&&Object.keys(e.args).length>0){t.push(` args:`);for(let[n,r]of Object.entries(e.args)){let e=Object.entries(r).filter(([,e])=>e!==void 0);if(e.length===0)t.push(` ${ur(n)}: {}`);else{t.push(` ${ur(n)}:`);for(let[n,r]of e)t.push(` ${n}: ${Array.isArray(r)?`[${r.map(ur).join(`, `)}]`:ur(r)}`)}}}return e.reason&&t.push(` reason: ${JSON.stringify(e.reason)}`),t.join(`
|
|
15
15
|
`)}function fr(e){let t=new Map;for(let n of e){if(n.outcome!==`error`||rr(n)||!n.tool||n.rule_id===`guard.outcome`)continue;let e=n.tool.indexOf(`__`),r=e>0?n.tool.slice(0,e):n.tool,i=t.get(r)??{count:0,error:null};i.count++,i.error??=n.error,t.set(r,i)}return[...t.entries()].map(([e,t])=>({server:e,...t})).sort((e,t)=>t.count-e.count)}var pr={"command-not-found":{title:`The program could not be found`,explain:`The program this server starts with isn't on this computer, or isn't where it used to be. This usually means something it needs was never installed, or was moved by an update.`,fix:{label:`Check the spelling`,action:`check-address`}},"runtime-missing":{title:`Something it needs isn't installed`,explain:`This server needs another free program to run, and that program isn't installed on this computer yet. Installing it takes a few minutes, and nothing else changes.`,fix:{label:`Show me how to install it`,action:`install-runtime`}},"runtime-not-running":{title:`Something it needs isn't running`,explain:`The program this server runs inside is installed but not open right now. Open it, wait until it says it's running, then try again.`,fix:{label:`How to start it`,action:`start-runtime`}},"folder-missing":{title:`A folder it was given doesn't exist`,explain:`One of the folders this server was set up with can't be found. It may have been renamed, moved, or be on a drive that isn't plugged in.`,fix:{label:`Choose the folder again`,action:`choose-folder`}},"secret-missing":{title:`A saved key is missing`,explain:`This server uses a key from your locked keys, but that key isn't there any more. It may have been removed from Settings. Enter it again. The server then uses it.`,fix:{label:`Enter the key again`,action:`replace-key`}},"auth-rejected":{title:`The key was not accepted`,explain:`The service said no to the key this server uses. The key may have been typed wrongly, expired, or been turned off on the service's website. Make a new one there and replace it here.`,fix:{label:`Replace the key`,action:`replace-key`}},"needs-sign-in":{title:`Sign in again`,explain:`Your sign-in to this service has ended. That happens when it expires or when access is taken back on the service's website. Sign in again and the server works again.`,fix:{label:`Sign in again`,action:`sign-in`}},timeout:{title:`It started but never answered`,explain:`The server was started, but it didn't reply in time. The first start can be slow while it downloads what it needs, so trying again often works.`,fix:{label:`Try again`,action:`retry`}},"egress-refused":{title:`Your network rules don't allow this address`,explain:`Your toolbox stopped this server from reaching an address that isn't on your list of allowed addresses. Your toolbox blocked it, as it should. Allow the address if you trust it.`,fix:{label:`Allow it`,action:`allow-address`}},network:{title:`It could not be reached`,explain:`Nothing answered at this server's address. The address may be mistyped, the service may be down, or this computer may be offline.`,fix:{label:`Check the address`,action:`check-address`}},tls:{title:`Its security certificate could not be checked`,explain:`The server's address answered, but its security certificate could not be confirmed, so your toolbox didn't connect, to keep you safe. This can mean the address is wrong, or that something on your network is in the way. Check the address, or ask whoever runs the server.`},exited:{title:`It started and then stopped`,explain:`The server began to run and then quit on its own. Often a setting it needs is missing or wrong. The details show the last thing it said before it stopped.`,fix:{label:`Show details`,action:`show-details`}},"not-mcp":{title:`That address isn't an MCP server`,explain:`Something answered at this address, but it isn't an MCP server. Check that you copied the server's own address from its instructions, not the website's.`,fix:{label:`Check the address`,action:`check-address`}},"sse-only":{title:`This server uses an older connection type`,explain:`This server only offers an older way of connecting that your toolbox can't protect safely. Look in its instructions for a newer address, or ask its maker for one.`},unknown:{title:`Something went wrong`,explain:`The server didn't start, and the reason wasn't one we recognise. The details show what it said, which helps if you ask for support.`,fix:{label:`Show details`,action:`show-details`}}},mr={node:`Node.js`,npx:`Node.js`,uv:`uv`,uvx:`uv`,docker:`Docker Desktop`,python:`Python`,python3:`Python`,git:`Git`},hr=/^(localhost|127\.\d+\.\d+\.\d+|\[::1\])(:\d+)?$/i;function gr(e,t={}){let n=pr[e.code]??pr.unknown,r=e.detail??{},i=r.runtime?mr[r.runtime.toLowerCase()]??r.runtime:null;switch(e.code){case`runtime-missing`:return i?{...n,title:`${i} isn't installed`,explain:`This server needs ${i} to run, and it isn't installed on this computer yet. It's free, installing it takes a few minutes, and nothing else changes.`,fix:{label:`Show me how to install ${i}`,action:`install-runtime`}}:n;case`runtime-not-running`:return i?{...n,title:`${i} isn't running`,explain:`${i} is installed but not open right now. Open it, wait until it says it's running, then try again.`,fix:{label:`How to start ${i}`,action:`start-runtime`}}:n;case`command-not-found`:{if(i)return{...n,explain:`This server is started with ${i}, and ${i} couldn't be found on this computer. It may not be installed, or an update may have moved it.`,fix:{label:`Check my computer`,action:`install-runtime`}};let e=r.command?r.command.split(/[\\/]/).pop()??r.command:null;return e?{...n,title:`“${e}” isn't on this computer`,explain:`This server starts a program called **${e}**, and this computer doesn't have it. Check the server's instructions for how to install it, or check its spelling.`}:n}case`needs-sign-in`:return t.firstSignIn||/no sign-in saved|never signed in/i.test(e.message??``)?{title:`This service asks you to sign in`,explain:`This server needs you to sign in with your account on its website before it can be used. Your password stays with the service; the sign-in is kept in your locked keys on this computer only.`,fix:{label:`Sign in`,action:`sign-in`}}:n;case`folder-missing`:{let e=r.path?{...n,explain:`The folder ${r.path} can't be found. It may have been renamed, moved, or be on a drive that isn't plugged in.`}:n;return t.hasFolderField===!1?{...e,fix:{label:`Change its settings`,action:`check-address`}}:e}case`egress-refused`:return r.host?{...n,title:`${r.host} isn't on your allowed addresses`,explain:`Your toolbox stopped this server from reaching ${r.host}, because it isn't on your list of allowed addresses. Your toolbox blocked it, as it should. Allow it if you trust it.`,fix:{label:`Allow ${r.host}`,action:`allow-address`}}:n;case`network`:return t.desktopApp?{title:`${t.desktopApp} isn't open`,explain:`This server is part of the ${t.desktopApp} app on this computer, and nothing answered${r.host?` at ${r.host}`:``}. Open the app, make sure its MCP server is turned on (the steps above show where), then try again.`,fix:{label:`Try again`,action:`retry`}}:r.host?hr.test(r.host)?{title:`Nothing answered on this computer`,explain:`Nothing answered at ${r.host}, which is on this computer. The program or app that provides this server may not be open, or may use another address.`,fix:{label:`Try again`,action:`retry`}}:{...n,explain:`Nothing answered at ${r.host}. The address may be mistyped, the service may be down, or this computer may be offline.`}:n;case`tls`:return r.host?{...n,explain:`${r.host} answered, but its security certificate could not be confirmed, so your toolbox didn't connect, to keep you safe. The address may be wrong, or something on your network may be in the way.`}:n;default:return n}}var _r={darwin:`Mac`,win32:`Windows`,linux:`Linux`};function vr(e){return e===`darwin`||e===`win32`?e:`linux`}var yr={text:`After installing, come back here and press **Check again**. If a server still can't find it, quit your AI app completely and open it again.`},br={label:`Open the Node.js download page`,url:`https://nodejs.org/en/download`},xr={label:`Open uv's install page`,url:`https://docs.astral.sh/uv/getting-started/installation/`},Sr=`curl -LsSf https://astral.sh/uv/install.sh | sh`,Cr={label:`Open the Docker Desktop page`,url:`https://www.docker.com/products/docker-desktop/`},wr={label:`Docker Engine for Linux`,url:`https://docs.docker.com/engine/install/`},Tr={label:`Open the Python download page`,url:`https://www.python.org/downloads/`},Er={label:`Open the Git download page`,url:`https://git-scm.com/install/`},Dr={node:{name:`Node.js`,why:`Many servers are built with it and need it to run. It's free and widely used.`,steps:{darwin:[{text:`Open the Node.js download page and choose the **LTS** version's macOS installer (the .pkg file).`,link:br},{text:`Open the downloaded file and follow the steps. The defaults are fine.`},{text:"If you already use Homebrew, you can instead run `brew install node` in Terminal."},yr],win32:[{text:`Open the Node.js download page and choose the **LTS** version's Windows installer (the .msi file).`,link:br},{text:`Open the downloaded file and follow the steps. The defaults are fine.`},{text:"Or, in PowerShell, run `winget install OpenJS.NodeJS.LTS`."},yr],linux:[{text:"Install it with your package manager: `sudo apt install nodejs npm` on Ubuntu or Debian, `sudo dnf install nodejs` on Fedora."},{text:`If that version is old, the Node.js download page has an up-to-date one.`,link:br},yr]}},uv:{name:`uv`,why:`Runs servers written in Python, such as Git, Fetch, Time and Postgres. You only need it for those. It brings its own Python, so you don't need to install that too.`,steps:{darwin:[{text:`Press **Copy** to copy this line. It is uv's own installer, from its makers.`,copy:Sr},{text:`Open **Terminal**: press **Command** and **Space** together, type **Terminal**, then press **Return**.`},{text:`Click inside the Terminal window, press **Command** and **V** together to paste the line, then press **Return**.`},{text:`Wait a few seconds until it finishes and a new line appears. Then you can close Terminal.`},{text:`If you'd rather read uv's own instructions first, open its install page.`,link:xr},yr],win32:[{text:"In PowerShell, run `winget install --id=astral-sh.uv -e`."},{text:`Or open uv's install page and follow the Windows steps.`,link:xr},yr],linux:[{text:`Open uv's install page and follow the Linux steps. It's one line to paste into a terminal.`,link:xr},{text:"Some systems also offer it as a package, for example `sudo pacman -S uv` on Arch."},yr]}},docker:{name:`Docker Desktop`,why:`Runs servers that come packaged as a ready-made container. Only a few servers need it.`,steps:{darwin:[{text:`Open the Docker Desktop page and download it for Mac. Pick **Apple silicon** or **Intel chip** to match your Mac (Apple menu → About This Mac).`,link:Cr},{text:`Open the downloaded file, drag Docker into Applications, then open it once and accept its terms.`},{text:"If you use Homebrew, you can instead run `brew install --cask docker`."},yr],win32:[{text:`Open the Docker Desktop page and download it for Windows.`,link:Cr},{text:`Run the installer and keep the defaults. It may ask to restart your computer.`},{text:"Or, in PowerShell, run `winget install -e --id Docker.DockerDesktop`."},yr],linux:[{text:`Install Docker Desktop for Linux from the Docker Desktop page, or install Docker Engine with your package manager.`,link:Cr},{text:`Docker's own guide covers each Linux system step by step.`,link:wr},yr]},start:{darwin:`Open Docker from your Applications folder and wait until the whale icon in the menu bar stops moving. Then press **Check again**.`,win32:`Open Docker Desktop from the Start menu and wait until it says it's running. Then press **Check again**.`,linux:"Open Docker Desktop, or start Docker Engine with `sudo systemctl start docker`. Then press **Check again**."}},python:{name:`Python`,why:`A few servers are written in Python and run with it directly. Most Python servers use uv instead, so you may not need this.`,steps:{darwin:[{text:`Open the Python download page and download the latest macOS installer.`,link:Tr},{text:`Open the downloaded file and follow the steps.`},{text:"If you use Homebrew, you can instead run `brew install python` in Terminal."},yr],win32:[{text:`Open the Python download page and download the latest Windows installer.`,link:Tr},{text:`On the installer's first screen, tick **Add python.exe to PATH**, then choose **Install Now**.`},{text:"Or, in PowerShell, run `winget install Python.Python.3.13`."},yr],linux:[{text:"Python is usually already installed. If not, run `sudo apt install python3` on Ubuntu or Debian, or `sudo dnf install python3` on Fedora."},{text:`Newer versions are on the Python download page.`,link:Tr},yr]}},git:{name:`Git`,why:`Lets the Git server read the history of your code projects. Only that server needs it.`,steps:{darwin:[{text:`Open the Git download page and follow the macOS steps. Your Mac may also offer to install it for you the first time something needs it.`,link:Er},{text:"If you use Homebrew, you can instead run `brew install git` in Terminal."},yr],win32:[{text:`Open the Git download page and download Git for Windows.`,link:Er},{text:`Run the installer. The defaults are fine.`},{text:"Or, in PowerShell, run `winget install --id Git.Git -e`."},yr],linux:[{text:"Install it with your package manager: `sudo apt install git` on Ubuntu or Debian, `sudo dnf install git` on Fedora."},{text:`The Git download page lists the command for other systems.`,link:Er},yr]}}},Or=[`node`,`uv`,`docker`,`python`,`git`];function kr({value:e,onChange:t,options:n,label:r,columns:i=2}){return(0,A.jsx)(`div`,{role:`radiogroup`,"aria-label":r,onKeyDown:r=>{let i=r.key===`ArrowRight`||r.key===`ArrowDown`?1:r.key===`ArrowLeft`||r.key===`ArrowUp`?-1:0;if(!i)return;r.preventDefault();let a=n.filter(e=>!e.disabled),o=a[(a.findIndex(t=>t.value===e)+i+a.length)%a.length];o&&(t(o.value),r.currentTarget.querySelector(`[data-value="${CSS.escape(o.value)}"]`)?.focus())},className:Se(`grid gap-3`,i===3?`sm:grid-cols-3`:`sm:grid-cols-2`),children:n.map(n=>{let r=n.value===e;return(0,A.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r,"data-value":n.value,tabIndex:r?0:-1,disabled:n.disabled,onClick:()=>t(n.value),className:Se(`flex min-w-0 flex-col items-start gap-1.5 rounded-[18px] border-[1.5px] p-4 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-50`,r?`border-primary bg-ok-tint`:`border-line hover:border-[var(--soft)]`),children:[(0,A.jsxs)(`span`,{className:`flex w-full items-center gap-2`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:Se(`grid h-5 w-5 shrink-0 place-items-center rounded-full border-[1.5px]`,r?`border-primary bg-primary text-white`:`border-[var(--soft)]`),children:r&&(0,A.jsx)(g,{name:`check`,size:12,strokeWidth:3})}),(0,A.jsx)(`span`,{className:`text-[15px] font-semibold`,children:n.title}),n.badge&&(0,A.jsx)(`span`,{className:`ml-auto`,children:n.badge})]}),(0,A.jsx)(`span`,{className:`text-[13px] text-soft`,children:n.body})]},n.value)})})}function Ar({value:e,onChange:t,keyLabel:n,valueLabel:r,addLabel:i,secret:a,valueType:o=`text`,keyPlaceholder:s,valuePlaceholder:c}){let l=(0,k.useId)(),u=(n,r,i)=>t(e.map((e,t)=>t===n?r===0?[i,e[1]]:[e[0],i]:e));return(0,A.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.map(([i,d],f)=>{let m=hn(d);if(m)return(0,A.jsxs)(`div`,{className:`grid grid-cols-[1fr_1fr_auto] items-center gap-2 max-sm:grid-cols-[1fr_auto]`,children:[(0,A.jsx)(p,{id:`${l}-k${f}`,value:i,onChange:e=>u(f,0,e),"aria-label":`${n} ${f+1}`,mono:!0}),(0,A.jsxs)(`span`,{className:`flex min-h-[44px] items-center gap-2 rounded-[14px] bg-sunken/60 px-3 text-[13px] max-sm:order-3 max-sm:col-span-2`,children:[(0,A.jsx)(g,{name:`lock`,size:15,className:`shrink-0 text-ok`}),(0,A.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[`Locked key: `,(0,A.jsx)(`code`,{className:`mono`,children:m.secret}),m.prefix&&(0,A.jsxs)(`span`,{className:`text-soft`,children:[` (after “`,m.prefix.trim(),`”)`]})]}),(0,A.jsx)(E,{size:`sm`,variant:`ghost`,onClick:()=>u(f,1,``),children:`Replace`})]}),(0,A.jsx)(oe,{icon:`trash`,label:`Remove ${i||`row ${f+1}`}`,size:36,onClick:()=>t(e.filter((e,t)=>t!==f))})]},f);let h=a!==void 0&&d===a;return(0,A.jsxs)(`div`,{className:`grid grid-cols-[1fr_1fr_auto] items-center gap-2 max-sm:grid-cols-[1fr_auto]`,children:[(0,A.jsx)(p,{id:`${l}-k${f}`,value:i,onChange:e=>u(f,0,e),"aria-label":`${n} ${f+1}`,placeholder:s,mono:!0}),(0,A.jsx)(`span`,{className:`max-sm:order-3 max-sm:col-span-2`,children:(0,A.jsx)(p,{id:`${l}-v${f}`,value:h?``:d,onChange:e=>u(f,1,e===``&&h?a:e),"aria-label":`${r} ${f+1}`,placeholder:h?`Kept secret. Type to replace it`:c,type:o,mono:!0})}),(0,A.jsx)(oe,{icon:`trash`,label:`Remove ${i||`row ${f+1}`}`,size:36,onClick:()=>t(e.filter((e,t)=>t!==f))})]},f)}),(0,A.jsx)(`div`,{children:(0,A.jsx)(E,{size:`sm`,variant:`ghost`,icon:`plus`,onClick:()=>t([...e,[``,``]]),children:i})})]})}function jr({title:e,children:t,defaultOpen:n=!1}){let[r,i]=(0,k.useState)(n);return(0,A.jsxs)(`div`,{className:`rounded-[18px] border border-line`,children:[(0,A.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(!r),className:`flex w-full items-center justify-between gap-3 px-4 py-3.5 text-left text-[14.5px] font-semibold`,children:[e,(0,A.jsx)(g,{name:`chevron`,size:18,className:Se(`transition-transform`,r&&`rotate-180`)})]}),r&&(0,A.jsx)(`div`,{className:`flex flex-col gap-5 border-t border-faint px-4 pt-4 pb-5`,children:t})]})}function Mr({children:e,sub:t}){return(0,A.jsxs)(`div`,{className:`mb-3`,children:[(0,A.jsx)(`h3`,{className:`text-[16px] font-semibold`,children:e}),t&&(0,A.jsx)(`p`,{className:`mt-0.5 text-[13px] text-soft`,children:t})]})}function Nr({children:e}){return(0,A.jsx)(`code`,{className:`mono text-[12px] break-all text-soft`,children:e})}function Pr({text:e,label:t}){let[n,r]=(0,k.useState)(!1);return(0,A.jsx)(E,{size:`sm`,icon:n?`check`:`copy`,onClick:()=>navigator.clipboard?.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)},()=>void 0),children:n?`Copied`:t})}var Fr=e=>Object.entries(e??{}).map(([e,t])=>[e,typeof t==`string`?t:mn(t)]),Ir=e=>Object.fromEntries(e.filter(([e])=>e.trim()!==``).map(([e,t])=>[e.trim(),hn(t)??t])),Lr={"Write reachable without approval":{id:`HMCP001`,plain:`This tool can change or delete things without asking you first.`},"Bounded write with unbounded arguments":{id:`HMCP001`,plain:`A rule limits some of this tool's inputs, but lets the others through unchecked.`},"Argument bound names an argument that does not exist":{id:`HMCP001`,plain:`A rule limits an input this tool doesn't have, so the limit guards nothing.`},"Tenant scoping not enforced":{id:`HMCP002`,plain:`This tool lets your AI choose whose data it reads, so it could reach another customer's data.`},"List operation without a result ceiling":{id:`HMCP003`,plain:`This tool can send back an unlimited amount of data in one go.`},"Secret in the generated tool surface":{id:`HMCP004`,plain:`A key or password appears in this server's own text, which your AI would read. Treat it as leaked and replace it.`},"Prompt injection in tool text":{id:`HMCP005`,plain:`This tool's description contains text that tries to give your AI orders.`},"Overly permissive input schema":{id:`HMCP006`,plain:`An input accepts free-form text or lists with no size limit.`,quiet:!0},"Egress target not permitted by policy":{id:`HMCP007`,plain:`This server's address isn't in your allowed addresses, so calls to it would be refused.`},"Tool set is hard to review or to tell apart":{id:`HMCP009`,plain:`This server offers a lot of tools, or tools whose names are easy to mix up.`},"Audit trail is missing or weakened":{id:`HMCP010`,plain:`The activity log is off, or could be edited without leaving a trace.`}};function Rr(e){for(let[t,n]of Object.entries(Lr))if(e===t||e.startsWith(`${t}.`))return{rule:n,technical:e};return{rule:null,technical:e}}function zr(e){return e.default===void 0?e.kind===`folders`?[]:e.kind===`toggle`?!1:e.kind===`choice`?e.choices?.[0]?.value??``:``:e.kind===`folders`?Array.isArray(e.default)?[...e.default]:e.default?[String(e.default)]:[]:e.kind===`toggle`?e.default===!0||e.default===`true`:Array.isArray(e.default)?e.default[0]??``:String(e.default)}function Br(e,t={}){let n={};for(let r of e.fields){let e=t[r.id];n[r.id]=e!==void 0&&Vr(r,e)?e:zr(r)}return n}function Vr(e,t){return e.kind===`folders`?Array.isArray(t):e.kind===`toggle`?typeof t==`boolean`:typeof t==`string`}var Hr=e=>e===void 0||typeof e==`string`&&e.trim()===``||Array.isArray(e)&&e.length===0;function Ur(e,t){if(e.kind===`toggle`)return null;if(Hr(t))return e.required?e.kind===`secret`?`Paste the key here.`:e.kind===`folder`?`Choose a folder.`:e.kind===`folders`?`Choose at least one folder.`:e.kind===`choice`?`Pick one.`:`Fill this in.`:null;let n=Array.isArray(t)?t:[String(t)];if(e.kind===`url`)for(let e of n){let t;try{t=new URL(e.trim())}catch{return`Enter the full address, starting with https://.`}if(t.protocol!==`https:`&&t.protocol!==`http:`)return`Enter the full address, starting with https://.`}if(e.kind===`choice`&&e.choices&&!e.choices.some(e=>e.value===t))return`Pick one of the choices.`;if(e.validate){let t=null;try{t=new RegExp(e.validate.pattern)}catch{t=null}if(t){for(let r of n)if(!t.test(r.trim()))return e.validate.message}}return null}function Wr(e,t){let n={};for(let r of e.fields){if(r.kind===`secret`&&Hr(t[r.id])&&typeof t[`__saved.${r.id}`]==`string`)continue;let e=Ur(r,t[r.id]);e&&(n[r.id]=e)}return n}function Gr(e,t){return e.replace(/\{\{\s*fields\.([\w-]+)\s*\}\}/g,(e,n)=>{let r=t[n];return Array.isArray(r)?r.join(`,`):r===void 0?``:String(r)})}var Kr=`__local_ok`;function qr(e,t){if(e.launch.transport!==`http`||e.source.kind!==`registry`&&e.source.kind!==`paste`)return null;let n;try{n=new URL(Gr(e.launch.url,t)).hostname.replace(/^\[|\]$/g,``).toLowerCase()}catch{return null}if(n===`localhost`||n.endsWith(`.localhost`)||/^127\./.test(n)||n===`::1`)return`loopback`;let r=/^(\d+)\.(\d+)\.\d+\.\d+$/.exec(n);if(r){let[e,t]=[Number(r[1]),Number(r[2])];return e===10||e===0||e===172&&t>=16&&t<=31||e===192&&t===168||e===100&&t>=64&&t<=127?`private`:null}return/^f[cd][0-9a-f]{2}:/.test(n)||n.endsWith(`.local`)||n.endsWith(`.lan`)||n.endsWith(`.internal`)?`private`:null}function Jr(e){return e.launch.transport===`http`&&!!e.launch.oauth}function Yr(e){if(e.launch.transport!==`http`)return e;let t={},n=new Set;for(let[r,i]of Object.entries(e.launch.headers??{}))if(r.toLowerCase()===`authorization`){if(typeof i==`string`)for(let e of i.matchAll(/\{\{\s*fields\.([a-z0-9_]+)\s*\}\}/gi))n.add(e[1]);else n.add(i.field)}else t[r]=i;let r=n=>e.launch.transport===`http`&&(e.launch.url.includes(`fields.${n}`)||Object.values(t).some(e=>typeof e==`string`?e.includes(`fields.${n}`):e.field===n));return{...e,launch:{...e.launch,headers:t,oauth:!0},fields:e.fields.filter(e=>!n.has(e.id)||r(e.id))}}function Xr(e){return`${(e.toLowerCase().replace(/[^a-z0-9_.-]+/g,`_`).replace(/^[^a-z0-9]+/,``)||`server`).slice(0,56)}.signin`}var Zr=`__signin`,Qr=/^[a-z0-9_]+$/;function $r(e,t=[]){let n=e.trim();return Qr.test(n)?t.includes(n)?`Another server is already called “${n}”.`:null:`Use lower-case letters, digits and underscores.`}function ei(e){let t=e.replace(/[_-]+/g,` `).trim();return t?t[0].toUpperCase()+t.slice(1):e}var ti=/(TOKEN|KEY|SECRET|PASSWORD|PASSWD|CREDENTIAL|AUTH|(^|[_-])PAT($|[_-]))/i;function ni(e){let t=[],n={},r=(e,r)=>{let i={};for(let[a,o]of Object.entries(e??{})){if(typeof o!=`string`)continue;if(!(r===`header`&&/^(authorization|x-api-key|api-key)$/i.test(a)||ti.test(a))){i[a]=o;continue}let e=`${r}_${a.toLowerCase().replace(/[^a-z0-9]+/g,`_`)}`,s=r===`header`&&/^bearer\s+/i.test(o);t.push({id:e,kind:`secret`,label:`Value for ${a}`,required:!0,technical:a}),n[e]=s?o.replace(/^bearer\s+/i,``):o,i[a]=s?{field:e,prefix:`Bearer `}:{field:e}}return i},i;if(e.transport===`stdio`){let t=r(e.env,`env`);i={transport:`stdio`,command:e.command,...e.args?.length?{args:e.args}:{},...Object.keys(t).length?{env:t}:{}}}else{let t=r(e.headers,`header`);i={transport:`http`,url:e.url,...Object.keys(t).length?{headers:t}:{}}}return{draft:{source:{kind:`manual`},name:e.name,displayName:ei(e.name),launch:i,fields:t,guide:[],requires:[],warnings:[]},values:n}}var ri=`__saved.`,ii=e=>(e.startsWith(`/`)||e.startsWith(`~/`)||e===`~`||/^[A-Za-z]:[\\/]/.test(e))&&!/\.[A-Za-z0-9]{1,6}$/.test(e.split(/[\\/]/).pop()??``),ai=e=>e.transport===`stdio`?(e.args??[]).filter(e=>!e.includes(`{{`)&&!e.startsWith(`-`)):[];function oi(e,t){for(let n of t)for(let t of n.variants){let r=t.launch;if(r.transport===`http`&&e.transport===`http`){if(!r.url.includes(`{{`)&&r.url===e.url)return{entry:n,variant:t.id};continue}if(r.transport!==`stdio`||e.transport!==`stdio`)continue;let i=e=>(e.split(/[\\/]/).pop()??e).toLowerCase();if(i(r.command)!==i(e.command))continue;let a=ai(r);if(a.length>0&&a.every(t=>(e.args??[]).includes(t)))return{entry:n,variant:t.id}}return null}function si(e,t,n){let r={},i=e.launch;if(i.transport===`stdio`&&t.transport===`stdio`){let a=(t.args??[]).filter(e=>ii(e)&&e!==n);for(let t of i.args??[]){let n=/^\{\{\s*\.\.\.fields\.([a-z0-9_]+)\s*\}\}$/i.exec(t),i=n?e.fields.find(e=>e.id===n[1]):void 0;i&&(i.kind===`folders`||i.kind===`folder`)&&(r[i.id]=i.kind===`folders`?a:a[0]??``)}}let a=i.transport===`stdio`?i.env:i.headers,o=t.transport===`stdio`?t.env:t.headers;for(let[t,n]of Object.entries(a??{})){let i=o?.[t];if(i===void 0)continue;if(typeof n!=`string`){typeof i!=`string`&&(r[`${ri}${n.field}`]=i.secret);continue}let a=/^\{\{\s*fields\.([a-z0-9_]+)\s*\}\}$/i.exec(n),s=a?e.fields.find(e=>e.id===a[1]):void 0;s&&typeof i==`string`&&!i.startsWith(`[kept`)&&(r[s.id]=i)}return r}function ci(e,t){let n=[],r={},i=e=>{let t={};for(let[i,a]of Object.entries(e??{})){if(typeof a==`string`){t[i]=a;continue}let e=`key_${i.toLowerCase().replace(/[^a-z0-9]+/g,`_`)}`.slice(0,60);n.push({id:e,kind:`secret`,label:`Value for ${i}`,required:!0,technical:i}),r[`${ri}${e}`]=a.secret,t[i]=a.prefix?{field:e,prefix:a.prefix}:{field:e}}return t},a;if(e.transport===`stdio`){let o=[],s=[],c=!1;for(let n of e.args??[])ii(n)?(n!==t&&s.push(n),c||o.push(`{{...fields.folders}}`),c=!0):o.push(n);c&&(n.push({id:`folders`,kind:`folders`,label:`Folders the server may use`,required:!0}),r.folders=s);let l=i(e.env);a={transport:`stdio`,command:e.command,...o.length?{args:o}:{},...Object.keys(l).length?{env:l}:{}}}else{let t=i(e.headers);a={transport:`http`,url:e.url,...Object.keys(t).length?{headers:t}:{},...e.oauth?{oauth:!0}:{}}}return{draft:{source:{kind:`manual`},name:e.name,displayName:ei(e.name),launch:a,fields:n,guide:[],requires:[],warnings:[]},values:r}}var li={files:`Files`,developer:`Developer`,productivity:`Work apps`,data:`Data`,web:`Web`,knowledge:`Knowledge`,design:`Design`},ui={node:`Node.js`,uv:`uv`,docker:`Docker`,python:`Python`,git:`Git`},di=[`uv`,`docker`];function fi(e){let t=e??[];return{setup:t.filter(e=>di.includes(e)),needs:t.filter(e=>!di.includes(e)).map(e=>`Needs ${ui[e]??e}`)}}function pi(e,t,n=`all`){let r=t.toLowerCase().split(/\s+/).filter(Boolean);return e.filter(e=>n===`all`||e.category===n).map(e=>{if(!r.length)return{e,score:1};let t=`${e.name} ${e.id.replace(/-/g,` `)}`.toLowerCase(),n=e.variants.flatMap(e=>e.launch.transport===`stdio`?(e.launch.args??[]).filter(e=>!e.startsWith(`-`)&&!e.includes(`{{`)):[e.launch.url]),i=[e.summary,e.description??``,e.publisher.name,...e.keywords??[],e.category,e.id,e.registry_name??``,...n].join(` `).toLowerCase(),a=0;for(let n of r)if(t.startsWith(n)||t.split(` `).includes(n))a+=4;else if(t.includes(n))a+=3;else if(i.includes(n))a+=1;else return{e,score:0};return{e,score:a}}).filter(e=>e.score>0).sort((e,t)=>t.score-e.score).map(e=>e.e)}function mi(e,t){if(!t)return[];let n=[];for(let r of e){let e=t.checks.find(e=>e.id===r);e&&(e.found?e.running===!1&&n.push({runtime:r,notRunning:!0}):n.push({runtime:r,notRunning:!1}))}return n}function hi(e){return e===`darwin`||e===`win32`?e:`linux`}function gi(e,t){return e<3?t===`http`?`Reaching the server…`:`Starting the server…`:e<8?`Asking what it can do…`:e<14?`Checking each tool…`:t===`http`?`Still waiting for an answer…`:`Still starting. The first time can be slow while it downloads…`}var _i={run:`allow`,ask:`approve`,blocked:`deny`};function vi(e){let t={run:[],ask:[],blocked:[],withheld:[],offered:0};for(let n of e.tools)n.withheld?t.withheld.push(n):t[n.verdict].push(n);return t.offered=t.run.length+t.ask.length+t.blocked.length,t}function yi(e){let t={high:0,medium:1,low:2},n=[],r=[],i=new Set,a=!0;for(let o of[...e.findings].sort((e,n)=>t[e.severity]-t[n.severity])){let{rule:e,technical:t}=Rr(o.message),s=e?`${e.id} · ${t}`:void 0;e?.quiet||o.severity===`low`?(e?.quiet||(a=!1),o.tool&&i.add(o.tool),r.push({...o.tool?{tool:o.tool}:{},text:s??o.message})):n.push({tone:`warn`,text:e?.plain??o.message,...o.tool?{tool:o.tool}:{},...s?{technical:s}:{}})}for(let t of e.tools)t.withheld&&n.push({tone:`neutral`,text:`Won't be offered: ${t.withheld}`,tool:t.name});let o=null;if(r.length){let e=i.size||r.length;o={text:a&&i.size?`Nothing here needs you. (${e} ${e===1?`tool accepts`:`tools accept`} text of any length, which is normal.)`:`${r.length} small ${r.length===1?`note`:`notes`} about how this server describes its tools. Nothing to do now.`,details:r}}return{lines:n,quiet:o}}function bi(e){let t=vi(e).offered,n=[`It offers ${t} ${t===1?`tool`:`tools`} your AI can use`];return e.prompts&&n.push(`${e.prompts} ready-made ${e.prompts===1?`prompt`:`prompts`}`),n.join(`, and `)+`.`}function xi(e){let t=/^gateway\.yaml changed (.+?), which a running gateway cannot pick up/.exec(e);if(t){let n=/The servers were updated|Server changes are still applied/.test(e);return`Your AI app is still using the toolbox as it was before a setting changed (${t[1]}). That setting only takes effect when the app starts`+(n?`. Servers you add or change still reach the app straight away. `:`, and nothing else you change reaches the app until then. `)+`Quit the app completely and open it again.`}let n=/^gateway\.yaml could not be used[^:]*: (.*)$/s.exec(e);return n?`The toolbox's settings file has a mistake in it, so your AI app kept using the settings from before. Fix the file and save it again. (${n[1]})`:e}function Si(e){let t=e?.processes.find(e=>e.refusal&&!/^gateway\.yaml could not be used/.test(e.refusal))?.refusal;return t?xi(t):void 0}function Ci(e){return!/^gateway\.yaml could not be used/.test(e)&&!/The servers were updated|Server changes are still applied/.test(e)}function wi(e,t,n){let r=e?.upstreams.find(e=>e.name===t);if(r&&n!==void 0&&r.state!==`connected`&&r.state!==`connecting`){let e=Date.parse(r.since);if(Number.isFinite(e)&&e<n)return{kind:`waiting`}}if(!r){let t=e?.processes??[];if(e?.running&&!e.applied&&t.length>0&&t.every(e=>!!e.refusal&&Ci(e.refusal))){let t=Si(e);return t?{kind:`needs-restart`,why:t}:{kind:`needs-restart`}}return{kind:`waiting`}}return r.state===`connected`?{kind:`live`,tools:r.tool_count}:r.state===`needs-sign-in`?{kind:`needs-sign-in`}:r.state===`failed`&&r.problem?{kind:`problem`,problem:r.problem}:{kind:`waiting`}}function Ti(e,t){return e.kind!==`waiting`||t>=15e3}function Ei(e,t,n,r,i){let a=wi(e,t,i);if(n===`needs-restart`&&a.kind===`waiting`){let t=Si(e);return{live:t?{kind:`needs-restart`,why:t}:{kind:`needs-restart`},settled:!0}}return{live:a,settled:n===`needs-restart`||Ti(a,r)}}var Di={"install-runtime":`download`,"start-runtime":`play`,"choose-folder":`search`,"replace-key":`key`,"sign-in":`user`,"check-address":`edit`,"allow-address":`shield`,retry:`refresh`,"show-details":`info`};function Oi({problem:e,onFix:t,fixBusy:n,extra:r,compact:i,context:a}){let o=gr(e,a),[s,c]=(0,k.useState)(!1),[l,u]=(0,k.useState)(!1),d=e.detail?.runtime,f=o.fix,p=()=>{if(f){if(f.action===`show-details`)return c(!0);(f.action===`install-runtime`||f.action===`start-runtime`)&&ki(d)&&u(!0),t?.(f.action)}},m=(e.detail?.stderrTail??[]).filter(e=>!/^npm (notice|warn)\b/i.test(e.trim()));return(0,A.jsxs)(`div`,{role:`alert`,className:Se(`flex flex-col gap-3 rounded-[18px] border-[1.5px] border-bad/40 bg-surface`,i?`p-3.5`:`p-4`),children:[(0,A.jsxs)(`div`,{className:`flex gap-3`,children:[(0,A.jsx)(`span`,{className:`grid h-9 w-9 shrink-0 place-items-center rounded-full bg-bad-tint text-bad`,children:(0,A.jsx)(g,{name:`warning`,size:18,strokeWidth:2})}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`p`,{className:`text-[15px] font-semibold`,children:o.title}),o.explain&&(0,A.jsx)(`p`,{className:`mt-0.5 text-[13.5px] text-muted`,children:(0,A.jsx)(pe,{text:o.explain})}),e.detail?.path&&(0,A.jsxs)(`p`,{className:`mt-1 text-[13px] text-soft`,children:[`Folder: `,(0,A.jsx)(`code`,{className:`mono break-all`,children:e.detail.path})]}),e.detail?.host&&(0,A.jsxs)(`p`,{className:`mt-1 text-[13px] text-soft`,children:[`Address: `,(0,A.jsx)(`code`,{className:`mono break-all`,children:e.detail.host})]})]})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-2 pl-12`,children:[f&&f.action!==`show-details`&&(0,A.jsx)(E,{size:`sm`,variant:`primary`,icon:Di[f.action],onClick:p,loading:n,children:f.label}),r,(0,A.jsx)(E,{size:`sm`,variant:`ghost`,"aria-expanded":s,onClick:()=>c(!s),children:s?`Hide technical details`:`Technical details`})]}),l&&ki(d)&&(0,A.jsx)(`div`,{className:`pl-12`,children:(0,A.jsx)(ji,{runtime:ki(d)})}),s&&(0,A.jsxs)(`div`,{className:`ml-12 flex flex-col gap-2 rounded-2xl bg-sunken/60 p-3 text-[12.5px]`,children:[(0,A.jsx)(`p`,{className:`text-soft`,children:`For support: these are the words the server and your toolbox used.`}),e.code===`timeout`&&(0,A.jsx)(`p`,{className:`text-muted`,children:`It may be waiting for a password or a setting it wasn't given. Check the server's instructions, then try again.`}),(0,A.jsxs)(`p`,{children:[(0,A.jsx)(`span`,{className:`text-soft`,children:`What happened: `}),(0,A.jsx)(`code`,{className:`mono break-words`,children:e.message})]}),(0,A.jsxs)(`p`,{className:`text-soft`,children:[`Reason code `,(0,A.jsx)(`code`,{className:`mono`,children:e.code}),e.detail?.status?(0,A.jsxs)(A.Fragment,{children:[` · answer `,(0,A.jsx)(`code`,{className:`mono`,children:e.detail.status})]}):null,e.detail?.exitCode!==void 0&&e.detail.exitCode!==null?(0,A.jsxs)(A.Fragment,{children:[` · quit with `,(0,A.jsx)(`code`,{className:`mono`,children:e.detail.exitCode})]}):null,e.detail?.command?(0,A.jsxs)(A.Fragment,{children:[` · program `,(0,A.jsx)(`code`,{className:`mono`,children:e.detail.command})]}):null]}),m.length>0&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`text-soft`,children:`The last lines it wrote:`}),(0,A.jsx)(`pre`,{className:`mono scrollbar-thin max-h-48 overflow-auto rounded-xl bg-surface p-2.5 text-[12px] whitespace-pre-wrap`,children:m.join(`
|
|
16
|
-
`)})]})]})]})}function ki(e){return e?e===`npx`||e===`node`?`node`:e===`uvx`||e===`uv`?`uv`:e in Dr?e:null:null}function Ai(){let e=typeof navigator<`u`?navigator.userAgent:``;return/Mac/i.test(e)?`darwin`:/Win/i.test(e)?`win32`:`linux`}function ji({runtime:e,platform:t,notRunning:n}){let r=Dr[e],i=r.steps[hi(t??Ai())];return(0,A.jsxs)(`div`,{className:`rounded-2xl bg-sunken/60 p-4 text-[13.5px]`,children:[(0,A.jsx)(`p`,{className:`font-semibold`,children:n?`Start ${r.name}`:`Install ${r.name}`}),r.why&&(0,A.jsx)(`p`,{className:`mt-0.5 text-muted`,children:r.why}),n?(0,A.jsxs)(`p`,{className:`mt-2 text-muted`,children:[`It is installed but not open. Open `,r.name,`, wait until it says it is running, then check again.`]}):i.length===0?(0,A.jsxs)(`p`,{className:`mt-2 text-muted`,children:[`Install `,r.name,` from its website, then check again.`]}):(0,A.jsx)(`ol`,{className:`mt-2 flex list-decimal flex-col gap-2 pl-5`,children:i.map((e,t)=>(0,A.jsxs)(`li`,{className:`text-muted`,children:[(0,A.jsx)(pe,{text:e.text}),e.copy&&(0,A.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,A.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,A.jsx)(Pr,{text:e.copy,label:`Copy`})]}),e.link&&/^https?:\/\//.test(e.link.url)&&(0,A.jsxs)(`a`,{href:e.link.url,target:`_blank`,rel:`noreferrer noopener`,className:`btn btn-sm btn-secondary mt-1.5 ml-1`,children:[(0,A.jsx)(`span`,{children:e.link.label}),(0,A.jsx)(g,{name:`external`,size:16,strokeWidth:2}),(0,A.jsx)(`span`,{className:`sr-only`,children:`(opens in a new tab)`})]})]},t))})]})}function Mi({missing:e,platform:t,onRecheck:n,checking:r}){if(e.length===0)return null;let i=e.map(e=>Dr[e.runtime].name),a=e.every(e=>e.notRunning);return(0,A.jsx)(u,{tone:`warn`,role:`status`,title:a?`${i.join(` and `)} ${i.length===1?`isn't`:`aren't`} running`:`This server needs ${i.join(` and `)}`,actions:(0,A.jsx)(E,{size:`sm`,icon:`refresh`,onClick:n,loading:r,children:`Check again`}),children:(0,A.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:e.map(e=>(0,A.jsx)(ji,{runtime:e.runtime,platform:t,notRunning:e.notRunning},e.runtime))})})}function Ni({serverUrl:e,secretName:n,name:r,signedIn:i,onSignedIn:o,startNonce:s}){let[c,l]=(0,k.useState)(i?{kind:`done`,provider:r}:{kind:`idle`}),[d,f]=(0,k.useState)(!1),[h,_]=(0,k.useState)(``),[v,y]=(0,k.useState)(``),b=(0,k.useRef)(null),x=()=>{let i=null;try{i=window.open(`about:blank`,`_blank`),i&&(i.opener=null)}catch{i=null}b.current=i,l({kind:`starting`}),o(!1),t.oauthStart({serverUrl:e,secretName:n,label:r,...h.trim()?{clientId:h.trim(),...v?{clientSecret:v}:{}}:{}}).then(e=>{i&&!i.closed&&(i.location.href=e.authorizeUrl),l({kind:`waiting`,state:e.state,url:e.authorizeUrl,provider:e.provider||r,blocked:!i})}).catch(e=>{let t=()=>{try{i&&!i.closed&&i.close()}catch{}};t(),setTimeout(t,50),e instanceof m&&e.code===`no-dynamic-registration`?(f(!0),l({kind:`failed`,text:`${r} needs an app ID before you can sign in. Add one under Advanced below, then sign in again.`})):e instanceof m&&e.status===409?l({kind:`failed`,text:`A saved key already uses the name ${n}. Change the name under More options, then sign in again.`}):l({kind:`failed`,text:Zt(e)})})};return(0,k.useEffect)(()=>{s&&x()},[s]),(0,k.useEffect)(()=>{if(c.kind!==`waiting`)return;let e=!0,n=setInterval(()=>{t.oauthFlow(c.state).then(t=>{e&&(t.status===`done`?(l({kind:`done`,provider:c.provider}),o(!0)):t.status===`failed`?l({kind:`failed`,text:t.problem??`The sign-in didn't finish.`}):t.status===`expired`&&l({kind:`failed`,text:`The sign-in took too long and was stopped. Start it again.`}))}).catch(()=>void 0)},1500);return()=>{e=!1,clearInterval(n)}},[c.kind===`waiting`?c.state:null]),(0,A.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,A.jsx)(`div`,{role:`status`,"aria-live":`polite`,children:c.kind===`done`?(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-[18px] bg-ok-tint p-4`,children:[(0,A.jsx)(g,{name:`check`,size:20,className:`text-ok`,strokeWidth:2.2}),(0,A.jsxs)(`span`,{className:`min-w-0 flex-1 text-[14px] font-medium`,children:[`Signed in with `,c.provider]}),(0,A.jsx)(E,{size:`sm`,variant:`ghost`,onClick:x,children:`Sign in again`})]}):c.kind===`waiting`?(0,A.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-[18px] border border-line p-4`,children:[(0,A.jsxs)(`p`,{className:`flex items-center gap-2.5 text-[14.5px] font-medium`,children:[(0,A.jsx)(_e,{size:18}),` Waiting for you to finish signing in with `,c.provider,`…`]}),(0,A.jsx)(`p`,{className:`text-[13.5px] text-muted`,children:c.blocked?`Your browser stopped the new tab from opening. Open it with the button below.`:`Finish in the ${c.provider} tab that just opened. This page notices by itself when you are done.`}),(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,A.jsxs)(`a`,{href:c.url,target:`_blank`,rel:`noreferrer noopener`,className:`btn btn-sm btn-secondary`,children:[(0,A.jsx)(`span`,{children:`Open the sign-in page`}),(0,A.jsx)(g,{name:`external`,size:16,strokeWidth:2}),(0,A.jsx)(`span`,{className:`sr-only`,children:`(opens in a new tab)`})]}),(0,A.jsx)(E,{size:`sm`,variant:`ghost`,icon:`refresh`,onClick:x,children:`I closed the tab — try again`})]})]}):(0,A.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,A.jsx)(`div`,{children:(0,A.jsxs)(E,{variant:`primary`,icon:`user`,onClick:x,loading:c.kind===`starting`,children:[`Sign in with `,r]})}),(0,A.jsxs)(`p`,{className:`text-[13px] text-soft`,children:[`A new tab opens where you sign in. Your password stays with `,r,`. The sign-in is kept in your locked keys on this computer only.`]})]})}),c.kind===`failed`&&(0,A.jsx)(u,{tone:`danger`,role:`alert`,title:`You're not signed in yet`,children:c.text}),(d||h)&&(0,A.jsxs)(jr,{title:`Advanced: use your own app ID`,defaultOpen:d,children:[(0,A.jsxs)(`p`,{className:`text-[13px] text-soft`,children:[`Some services ask you to register an app first. Make one in `,r,`'s developer settings with the address below as its return address, then paste its ID here.`]}),(0,A.jsx)(`code`,{className:`mono rounded-xl bg-sunken px-3 py-2 text-[12.5px] break-all`,children:`${location.origin}/oauth/callback`}),(0,A.jsx)(a,{label:`App ID`,technical:`client_id`,children:(0,A.jsx)(p,{value:h,onChange:_,mono:!0})}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,A.jsxs)(`label`,{htmlFor:`signin-app-secret`,className:`flex flex-wrap items-baseline gap-x-2 text-[13px] font-semibold`,children:[`App secret `,(0,A.jsx)(`span`,{className:`font-normal text-soft`,children:`optional`}),(0,A.jsx)(`code`,{className:`mono text-[11.5px] font-normal text-soft`,children:`client_secret`})]}),(0,A.jsx)(ce,{id:`signin-app-secret`,value:v,onChange:y,placeholder:`Only if the service gave you one`})]}),(0,A.jsx)(`div`,{children:(0,A.jsx)(E,{size:`sm`,variant:`primary`,icon:`user`,disabled:!h.trim(),onClick:x,children:`Sign in with this app ID`})})]})]})}function Pi(e){return me(()=>t.live(e).catch(()=>null),[e],5e3)}function Fi(e){return me(()=>_.audit(e,{outcome:`error`,limit:`50`,since:new Date(Date.now()-36e5).toISOString()}).then(e=>fr(e.records)).catch(()=>[]),[e],3e4)}function Ii(){return me(()=>t.secrets().catch(()=>null),[],3e4)}function Li(e,t){return e?.upstreams.find(e=>e.name===t)??null}function Ri({live:e,running:t,state:r}){if(!e||!e.running||!t)return(0,A.jsx)(C,{state:`unknown`,label:`Starts when your AI app opens`});if(!r)return(0,A.jsx)(C,{state:`connecting`,label:`Waiting to start`});let i=r.state===`connected`?` · ${n(r.tool_count,`tool`)}`:``;return(0,A.jsx)(C,{state:r.state,label:`${$t[r.state].label}${i}`})}function zi({gatewayId:e,upstream:n,state:r,onEdit:i,onFixed:a,onAllowAddress:o}){let s=xe(),[c,l]=(0,k.useState)(!1),[u,d]=(0,k.useState)(null),[f,p]=(0,k.useState)(!1),m=()=>(l(!0),t.retry(e,n.name).then(()=>{s.show(`ok`,`Trying ${n.name} again.`),a()}).catch(e=>s.show(`bad`,Zt(e))).finally(()=>l(!1))),h=r.problem??(r.state===`needs-sign-in`?{code:`needs-sign-in`,message:`The sign-in ended.`}:{code:`unknown`,message:`No reason was given.`}),g=n.transport===`http`?n.oauth?.secret??h.detail?.secret:void 0;return(0,A.jsxs)(`div`,{className:`w-full`,children:[(0,A.jsx)(Oi,{compact:!0,problem:h,onFix:e=>{switch(e){case`retry`:m();return;case`replace-key`:return h.detail?.secret?d(h.detail.secret):i(e);case`sign-in`:return n.transport===`http`&&g?p(!0):i(e);case`choose-folder`:case`check-address`:return i(e);case`allow-address`:return o();default:return}},fixBusy:c,extra:(0,A.jsx)(E,{size:`sm`,icon:`refresh`,loading:c,onClick:()=>void m(),children:`Try again`})}),r.next_retry_at&&(0,A.jsxs)(`p`,{className:`mt-1.5 pl-1 text-[12.5px] text-soft`,children:[`It tries again by itself `,x(r.next_retry_at),r.attempts>1?` (${r.attempts} tries so far)`:``,`.`]}),(0,A.jsx)(Bi,{secret:u,onClose:()=>d(null),onSaved:()=>{d(null),m()}}),(0,A.jsx)(ye,{open:f,onClose:()=>p(!1),title:`Sign in to ${n.name} again`,width:560,footer:(0,A.jsx)(E,{onClick:()=>p(!1),children:`Close`}),children:n.transport===`http`&&g&&(0,A.jsx)(Ni,{serverUrl:n.url,secretName:g,name:n.name,signedIn:!1,onSignedIn:e=>{e&&(p(!1),m())}})})]})}function Bi({secret:e,onClose:n,onSaved:r}){let[i,a]=(0,k.useState)(``),[o,s]=(0,k.useState)(!1),[c,l]=(0,k.useState)(null);return e?(0,A.jsx)(ye,{open:!0,onClose:n,dismissable:!o,title:`Replace the key`,description:`Paste the new key. The old one is replaced in your locked keys, and the server is tried again straight away.`,footer:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(E,{variant:`secondary`,onClick:n,disabled:o,children:`Cancel`}),(0,A.jsx)(E,{variant:`primary`,icon:`key`,onClick:()=>{s(!0),l(null),t.replaceSecret(e,i).then(()=>{a(``),r()}).catch(e=>l(Zt(e))).finally(()=>s(!1))},loading:o,disabled:!i.trim(),children:`Save new key`})]}),children:(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,A.jsxs)(`label`,{htmlFor:`replace-key-input`,className:`flex flex-wrap items-baseline gap-x-2 text-[13px] font-semibold`,children:[`New key `,(0,A.jsx)(`code`,{className:`mono text-[11.5px] font-normal text-soft`,children:e})]}),(0,A.jsx)(ce,{id:`replace-key-input`,value:i,onChange:a}),c&&(0,A.jsx)(`p`,{role:`alert`,className:`text-[12.5px] font-medium text-bad`,children:c})]})}):null}function Vi(e,t){return e.transport!==`http`||!e.oauth?!1:t?.secrets.find(t=>t.name===e.oauth.secret)?.status===`needs-sign-in`}function Hi({id:e,upstreams:r,digest:i,onMoved:a}){let o=xe(),[s,c]=(0,k.useState)(!1),[l,d]=(0,k.useState)(null),f=r.filter(e=>fn(e));return l?l.length?(0,A.jsxs)(u,{tone:`warn`,title:`Old copies of the keys are still in backup files`,children:[(0,A.jsx)(`p`,{children:`Your toolbox's settings file no longer holds them, but these backups made earlier still do. Delete them, or keep them private:`}),(0,A.jsx)(`ul`,{className:`mt-1 space-y-0.5`,children:l.map(e=>(0,A.jsx)(`li`,{children:(0,A.jsx)(Nr,{children:e})},e))}),(0,A.jsx)(E,{size:`sm`,variant:`ghost`,className:`mt-2`,onClick:()=>d(null),children:`Got it`})]}):null:f.length===0?null:(0,A.jsxs)(u,{tone:`warn`,title:`Keys are written out in your toolbox's settings file`,actions:(0,A.jsx)(E,{size:`sm`,variant:`primary`,icon:`lock`,loading:s,onClick:()=>{c(!0),t.moveSecrets(e,i).then(e=>{o.show(`ok`,`${n(e.moved.length,`key`)} moved to your locked keys.`),d(e.stillIn),a()}).catch(e=>o.show(`bad`,Zt(e))).finally(()=>c(!1))},children:`Move keys to your locked keys`}),children:[f.map(e=>e.name).join(`, `),` `,f.length===1?`has a key`:`have keys`,` written out in your toolbox's settings file, where anyone who can read that file can read`,f.length===1?` it`:` them`,`. Your locked keys are a separate file only you can read.`]})}function Ui({serverId:e,tenant:r,protection:i,status:a,verify:o,changes:s,process:c,connectionsHref:u,loading:d,onChanged:f}){let p=xe(),[m,h]=(0,k.useState)(!1),[v,y]=(0,k.useState)(null),b=me(()=>t.live(e).catch(()=>null),[e],1e4),ee=Fi(e);if(d&&!i&&!a)return(0,A.jsx)(fe,{tone:`hero`,title:`Toolbox status`,children:(0,A.jsxs)(`div`,{className:`space-y-3 opacity-60`,children:[(0,A.jsx)(l,{height:34,width:`60%`}),(0,A.jsx)(l,{lines:3})]})});let S=a?.running??i?.runtime.running??!1,te=(i?.enforcement??a?.enforcement??`enforce`)===`observe`,C=o?o.ok:i?i.audit.verify.ok:null,re=i?!i.audit.enabled:!1,w=s?s.changed.length:null,ie=a?.startedAt??i?.runtime.startedAt??null,T=i?.policyWrite,ae=!S&&c!==null&&!c.externallyRunning;async function oe(){if(T){h(!0),y(null);try{let t=await _.setPolicySetting(e,`enforcement`,`enforce`,T.digest,void 0,r);p.show(`ok`,`The toolbox is protecting now. Blocked calls stop, and some calls wait for you.`),t.warning&&p.show(`warn`,$n(t.warning)),f()}catch(e){y(tr(e)?{text:er,stale:!0}:{text:$n(e.message),stale:!1})}finally{h(!1)}}}let se=[];S&&ie&&se.push({icon:`clock`,text:`On since ${x(ie)}`}),a?.lastCall&&se.push({icon:`activity`,text:`Last call ${x(a.lastCall.ts)}, to ${a.lastCall.tool}`}),a&&a.upstreams.length>0&&se.push({icon:`server`,text:`${n(a.upstreams.length,`server`)} connected`}),S&&a?.policyCurrent===!1&&se.push({icon:`warning`,text:`Has not picked up your latest settings yet`}),a&&a.activeGrants>0&&se.push({icon:`key`,text:`${n(a.activeGrants,`pre-approval`)} active`});let ce=[te?`Watch-only`:`Protecting`,re?`log off`:C===null?null:C?`log intact`:`log damaged`,w===null?null:w===0?`no changed tools`:`${n(w,`changed tool`)}`].filter(Boolean),le=S?`text-on-hero-soft`:`text-soft`;return(0,A.jsxs)(fe,{tone:S?`hero`:`plain`,title:`Toolbox status`,children:[(0,A.jsx)(`p`,{className:`display text-[34px] leading-tight`,children:S?`Running`:`Not running`}),(0,A.jsx)(`p`,{className:`mt-1 text-[13px] ${le}`,children:ce.join(` · `)}),(0,A.jsx)(Wi,{onHero:S,live:b.data,failures:ee.data??[],href:`${u}${u.includes(`?`)?`&`:`?`}manage=${encodeURIComponent(e)}&tab=servers`}),te&&(0,A.jsx)(`p`,{className:`mt-3 text-[13px] leading-snug ${le}`,children:`Every call runs right now. The log notes what would have been blocked or held.`}),!S&&(0,A.jsx)(`p`,{className:`mt-3 text-[13px] leading-snug ${le}`,children:c?.externallyRunning?`Your AI app starts this toolbox. Open the app to bring it back.`:a?.lastCall?`Your AI app isn't running the toolbox right now. It starts again by itself when the app opens it.`:`Your AI app hasn't used the toolbox yet. Quit your AI app completely and open it again, and the toolbox starts by itself.`}),se.length>0&&(0,A.jsx)(`ul`,{className:`mt-4 space-y-1.5 text-[13px]`,children:se.map(e=>(0,A.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(g,{name:e.icon,size:15,className:`shrink-0 ${le}`}),(0,A.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]},e.text))}),v&&(0,A.jsxs)(`div`,{role:`alert`,className:`mt-4 rounded-2xl bg-black/20 px-3 py-2.5 text-[13px]`,children:[v.text,v.stale&&(0,A.jsx)(`button`,{type:`button`,onClick:f,className:`ml-2 font-semibold underline underline-offset-2`,children:`Reload status`})]}),(te||ae)&&(0,A.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[te&&(0,A.jsx)(E,{variant:S?`on-hero`:`secondary`,icon:`shield-check`,loading:m,disabled:!T?.ok,title:T?.ok?void 0:T?.why??void 0,onClick:()=>void oe(),children:`Start protecting`}),ae&&(0,A.jsx)(ne,{variant:S?`on-hero`:`secondary`,icon:`plug`,href:u,children:`Open connections`})]}),te&&T&&!T.ok&&T.why&&(0,A.jsx)(`p`,{className:`mt-2 text-[12px] ${le}`,children:$n(T.why)})]})}function Wi({live:e,failures:t,href:n,onHero:r}){let i=nn(e?.upstreams??[],e?.running??!1,t)??(t[0]?nn([],!1,t):null);if(!i)return null;let a=i.failing,o=r?`text-on-hero-soft`:`text-soft`,s=a?.error&&rn(a.error)?`Replace the key for ${i.fix}`:`Fix ${i.fix}`,c=s.startsWith(`Replace the key`)&&a?`${n}&key=${encodeURIComponent(a.server)}`:n;return(0,A.jsxs)(`div`,{role:`status`,className:`mt-3 min-w-0 text-[13.5px]`,children:[(0,A.jsxs)(`p`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-1`,children:[(0,A.jsxs)(`span`,{className:`min-w-0 font-medium [overflow-wrap:anywhere]`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`mr-2 inline-block h-2.5 w-2.5 shrink-0 rounded-full align-[-1px]`,style:{background:i.tone===`ok`?`var(--mark-allow)`:i.tone===`bad`?`var(--mark-deny)`:`var(--mark-approve)`}}),i.text]}),i.fix&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:o,children:`—`}),(0,A.jsx)(`a`,{href:c,onClick:v,className:`font-semibold underline underline-offset-2`,children:s})]})]}),a?.error&&(0,A.jsxs)(`div`,{className:`mt-1 text-[12.5px] ${o}`,children:[(0,A.jsx)(`p`,{children:an(a.server,a.error)}),(0,A.jsxs)(`details`,{className:`mt-0.5`,children:[(0,A.jsx)(`summary`,{className:`cursor-pointer select-none`,children:`Technical details`}),(0,A.jsx)(`p`,{className:`mono mt-1 text-[11.5px] [overflow-wrap:anywhere]`,children:$n(a.error).slice(0,400)})]})]})]})}var Gi=`defaults.on_unclassified`,Ki=e=>e.ruleId===Gi;function qi(e){let t=e.indexOf(`__`),n=t>0?e.slice(0,t):null,r=(t>0?e.slice(t+2):e).replace(/[_\-.]+/g,` `).trim();return r?{label:r[0].toUpperCase()+r.slice(1),server:n}:{label:e,server:n}}function Ji(e){return Ki(e)?`Nobody has said what this tool does yet, so its calls wait for you.`:e.violations.length>0?`It reaches past what this tool may do on its own, so it waits for your OK.`:e.ruleId?.startsWith(`tenant.`)?`The account on this call needs checking.`:e.effect===`destructive`?`This deletes or overwrites something, so it asks you first.`:e.effect===`write`&&(e.ruleId===`defaults.mode`||e.ruleId?.startsWith(`pack-`))?`This changes something, and while protection is on every change asks you first.`:e.ruleId?`Your protection settings say this tool asks you first.`:ea(e.reason)}var Yi=[`path`,`file`,`filename`,`file_path`,`url`,`uri`,`repo`,`repository`,`name`,`title`,`query`];function Xi(e){let t=e.length>120?`${e.slice(0,117)}…`:e,n=/^(.*)[/\\]([^/\\]+)[/\\]?$/.exec(e);return n&&/^([/~]|[a-zA-Z]:[/\\])/.test(e)&&n[1]?`“${n[2]}” in ${n[1]}`:`“${t}”`}function Zi(e){let t=qi(e.tool).label.toLowerCase(),n=e.args&&typeof e.args==`object`&&!Array.isArray(e.args)?e.args:{},r=e=>typeof n[e]==`string`&&n[e]!==``?n[e]:null,i=r(`source`),a=r(`destination`);if(i&&a)return`Your AI wants to ${t}: from ${Xi(i)} to ${Xi(a)}.`;for(let e of Yi){let n=r(e);if(n)return`Your AI wants to ${t}: ${Xi(n)}.`}for(let e of Object.values(n)){if(!Array.isArray(e))continue;let n=e.map(e=>e&&typeof e==`object`?e.name:void 0).filter(e=>typeof e==`string`);if(n.length>0)return`Your AI wants to ${t}: ${n.slice(0,3).map(e=>`“${e}”`).join(`, `)}${n.length>3?` and ${n.length-3} more`:``}.`}return`Your AI wants to ${t}.`}function Qi(e,t){let n;if(n=/^(\S+) length (\d+) exceeds the policy maximum of (\d+)$/.exec(e)){let e=Array.isArray($i(t,n[1]))?`items`:`characters`;return`${n[1]} is ${n[2]} ${e} long. The limit is ${n[3]}.`}return(n=/^(\S+)=(.+) exceeds the policy maximum of (.+)$/.exec(e))?`${n[1]} is ${n[2]}, above the limit of ${n[3]}.`:(n=/^(\S+)=(.+) is below the policy minimum of (.+)$/.exec(e))?`${n[1]} is ${n[2]}, below the minimum of ${n[3]}.`:(n=/^(\S+)=(.+) is not one of (.+)$/.exec(e))?`${n[1]} is ${n[2]}, which is not one of the allowed values ${n[3]}.`:(n=/^(\S+) must equal (.+)$/.exec(e))?`${n[1]} must be exactly ${n[2]}.`:(n=/^(\S+) has (\d+) items, exceeding the policy maximum of (\d+)$/.exec(e))?`${n[1]} has ${n[2]} items. The limit is ${n[3]}.`:(n=/^(\S+) is required by policy$/.exec(e))?`${n[1]} is required, and was left out.`:(n=/^(\S+) is bounded by policy but absent/.exec(e))?`${n[1]} was left out, so its limit could not be checked.`:(n=/^(\S+) does not match the required pattern$/.exec(e))?`${n[1]} is not in the required format.`:(n=/^(\S+) matched (\d+) values, exceeding the policy maximum of (\d+)$/.exec(e))?`${n[1]} appears ${n[2]} times. The limit is ${n[3]}.`:(n=/^(\S+) totals (.+) across \d+ values, exceeding the policy maximum of (.+)$/.exec(e))?`${n[1]} adds up to ${n[2]}. The limit is ${n[3]}.`:(n=/unknown_args: \w+, and (.+) (?:is|are) not bounded by it$/.exec(e))?`It sent inputs your rule does not mention: ${n[1].replace(/"/g,``)}.`:ta(e.replace(/the policy (maximum|minimum)/g,`the $1`).replace(/by policy/g,`by your rules`))}function $i(e,t){return e&&typeof e==`object`?e[t]:void 0}function ea(e){return/--classify/.test(e)?`Nobody has said what this tool does yet. Approve this call on its own and choose what the tool does, then remember a later call.`:ta(e.replace(/\s*\((?:[^()]*\bhmcp[\w-]*\s[^()]*)\)/g,``).replace(/`?hmcp(?:-gateway)? [^`.;]*`?/g,`the console`).replace(/\s--[a-z][\w-]*/g,``).replace(/standing grant/g,`pre-approval`).replace(/policy\.yaml/g,`your protection settings`).replace(/\s{2,}/g,` `))}function ta(e){let t=e.trim();if(!t)return t;let n=t[0].toUpperCase()+t.slice(1);return/[.?]$/.test(n)?n:`${n}.`}function na(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n>0?`${n}:${String(r).padStart(2,`0`)}:${i}`:`${r}:${i}`}function ra(e){return new Date(e).toDateString()===new Date().toDateString()?s(e):new Date(e).toLocaleString(void 0,{day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`})}function ia(e=1e3){let[t,n]=(0,k.useState)(Date.now);return(0,k.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var aa=e=>Array.isArray(e)?e.map(e=>String(e)).join(`, `):String(e);function oa(e){let t=[];if(e.const!==void 0&&t.push(`exactly ${String(e.const)}`),e.enum!==void 0&&t.push(`one of ${aa(e.enum)}`),e.min!==void 0&&t.push(`at least ${String(e.min)}`),e.max!==void 0&&t.push(`at most ${String(e.max)}`),e.maxLength!==void 0&&t.push(`up to ${String(e.maxLength)} characters`),e.maxItems!==void 0&&t.push(`up to ${String(e.maxItems)} items`),Array.isArray(e.same_items)){let n=e.same_items.length;t.push(n===0?`an empty list`:`exactly the ${n===1?`item`:`${n} items`} you approved`)}return e.within!==void 0&&t.push(`inside the folder ${String(e.within)}`),e.host!==void 0&&t.push(`only to ${aa(e.host)}`),e.pattern!==void 0&&t.push(`in a set format`),e.sum_max!==void 0&&t.push(`adding up to at most ${String(e.sum_max)}`),e.count_max!==void 0&&t.push(`at most ${String(e.count_max)} times`),e.required===!0&&t.push(`must be sent`),t}function sa(e){return!e||typeof e!=`object`?[]:Object.entries(e).map(([e,t])=>[e,oa(t??{}).join(`, `)]).filter(([,e])=>e!==``)}function ca(){let{serverId:e,tenant:n,nav:r,reload:a}=Lt(),s=r.query.get(`window`),c=zt(s)?s:`24h`,d=Rt.find(e=>e.value===c).phrase,f=me(()=>_.metrics(e,c,n),[e,n,c],3e4),p=me(()=>_.pending(e,n,{limit:50}),[e,n],1e4),m=me(()=>_.protection(e,n),[e,n]),g=me(()=>_.audit(e,{limit:`5`,...n?{tenant:n}:{}}),[e,n]),y=me(()=>t.settings().then(e=>Ie(e).onboarding).catch(()=>null),[]),b=me(()=>_.status(e),[e]),ee=me(()=>_.verify(e),[e]),S=me(()=>xt(e),[e]),te=me(()=>jt(e).catch(()=>null),[e]),C=()=>{for(let e of[f,p,m,g,b,ee,S,te])e.reload();a()},w=f.data,ie=m.data,T=p.data??null,ae=T&&T.length>0?T.reduce((e,t)=>t.createdAt<e.createdAt?t:e):null,ce=ie?.enforcement===`observe`,le=(e,t={})=>i(r,e,t),de=w?.unknownTool??0,pe=w?.refusedTools.find(e=>!rr({tool:e.tool,component:``}))?.tool??null;return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(re,{title:`Home`,subtitle:`What your AI apps did through your toolbox, and anything that needs you.`,actions:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(ne,{href:le(`/approvals`),variant:T&&T.length>0?`primary`:`secondary`,icon:`clock`,children:T&&T.length>0?`Review waiting calls (${T.length})`:`Waiting for you`}),(0,A.jsx)(ne,{href:le(`/safety`),variant:`secondary`,children:`Run safety check`}),(0,A.jsx)(oe,{icon:`refresh`,label:`Refresh this page`,variant:`outline`,onClick:C})]})}),y.data&&Re(y.data)&&(0,A.jsx)(`div`,{className:`mb-4`,children:(0,A.jsx)(u,{tone:`info`,title:`Finish setting up: step ${Me.indexOf(y.data.step)+1} of ${Me.length}, ${Ne[y.data.step]}`,actions:(0,A.jsx)(ne,{href:`/start`,size:`sm`,variant:`primary`,iconRight:`arrow-right`,children:`Continue the guide`}),children:`The guide picks up where you left off.`})}),ie&&(0,A.jsx)(`section`,{"aria-label":`Protection`,className:`mb-5`,children:ce?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`h2`,{className:`display text-[26px] leading-tight`,children:`Only watching`}),(0,A.jsxs)(`p`,{className:`mt-1 max-w-3xl text-[14.5px] text-muted`,children:[`Everything your AI does runs and is written down. Nothing asks you first and nothing is blocked.`,` `,(0,A.jsx)(`a`,{href:le(`/protection`),onClick:v,className:`font-semibold underline underline-offset-2`,children:`Turn protection on`})]})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`h2`,{className:`display text-[26px] leading-tight`,children:b.data?.running??ie.runtime.running?`You're protected`:`Protection is on`}),(0,A.jsxs)(`p`,{className:`mt-1 max-w-3xl text-[14.5px] text-muted`,children:[!(b.data?.running??ie.runtime.running)&&`It starts when your AI app opens the toolbox. `,`Reading runs freely, every change asks you first, and anything outside the folders and services you gave it is blocked.`]})]})}),w&&!w.auditing&&(0,A.jsx)(`div`,{className:`mb-4`,children:(0,A.jsx)(u,{tone:`warn`,title:`The activity log is turned off`,actions:(0,A.jsx)(ne,{href:le(`/protection`),size:`sm`,children:`Open protection settings`}),children:`Nothing is being recorded, so the counts below stay at zero whatever your AI app does.`})}),(0,A.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4`,children:[(0,A.jsx)(ue,{tone:`hero`,title:`Allowed`,value:w?D(w.decisions.allow):`–`,loading:f.loading&&!w,sub:f.error?`Could not be counted`:ce?`ran ${d}, in watch-only mode`:`ran ${d}`,href:le(`/activity`,{decision:`allow`}),hrefLabel:`See allowed calls`}),(0,A.jsx)(ue,{title:`Waiting for you`,value:T?D(T.length):`–`,loading:p.loading&&!T,sub:p.error?`Could not be loaded`:ae?`Oldest ${x(ae.createdAt)}`:`Nothing is waiting`,href:le(`/approvals`),hrefLabel:`Review waiting calls`}),(0,A.jsx)(ue,{title:`Blocked`,value:w?D(w.decisions.deny):`–`,loading:f.loading&&!w,sub:f.error?`Could not be counted`:`${ce?`would have been blocked ${d}`:w&&pe?`${d}, most often ${pe}`:d}${de>0?`. Not counted: ${D(de)} asked for a tool that doesn't exist`:``}`,href:le(`/activity`,{decision:`deny`}),hrefLabel:`See blocked calls`}),(0,A.jsx)(ua,{protection:ie,loading:m.loading,error:m.error,href:le(`/tools`)})]}),(0,A.jsxs)(`div`,{className:`mt-4 grid grid-cols-1 gap-4 lg:grid-cols-2 xl:grid-cols-4`,children:[(0,A.jsx)(fe,{title:`Activity`,className:`lg:col-span-2`,actions:(0,A.jsx)(h,{size:`sm`,label:`Time window`,value:c,onChange:e=>ve(o(r,{window:e===`24h`?null:e})),options:Rt.map(e=>({value:e.value,label:e.label}))}),children:f.error&&!w?(0,A.jsx)(u,{tone:`danger`,title:`The activity could not be counted`,actions:(0,A.jsx)(E,{size:`sm`,onClick:f.reload,children:`Try again`}),children:$n(f.error)}):w?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`relative overflow-x-clip`,children:(0,A.jsx)(se,{data:Bt(w,c),label:`Calls ${d}`,height:230})}),(0,A.jsx)(la,{}),!w.coverage.complete&&(0,A.jsxs)(`p`,{className:`mt-2 text-[12px] text-soft`,children:[`Counted from the latest `,D(w.coverage.records),` log entries; older calls in this window are not included.`]})]}):(0,A.jsx)(l,{height:228})}),(0,A.jsx)(N,{oldest:ae,count:T?.length??null,loading:p.loading,error:p.error,retry:p.reload,href:le(`/approvals`)}),(0,A.jsx)(fa,{protection:ie,changed:S.data?.changed.map(e=>e.tool)??[],loading:m.loading,error:m.error,retry:m.reload,nav:r}),(0,A.jsx)(pa,{records:g.data?.records??null,loading:g.loading,error:g.error,retry:g.reload,href:le(`/activity`)}),(0,A.jsx)(ma,{protection:ie,loading:m.loading,error:m.error,retry:m.reload}),(0,A.jsx)(Ui,{serverId:e,tenant:n,protection:ie,status:b.data,verify:ee.data,changes:S.data,process:te.data,connectionsHref:i(r,`/connections`),loading:m.loading||b.loading,onChanged:()=>{m.reload(),b.reload(),a()}})]})]})}function la(){return(0,A.jsx)(`p`,{className:`mt-3 flex flex-wrap gap-x-5 gap-y-1 text-[12.5px] text-muted`,"aria-hidden":!0,children:[{key:`allow`,label:`Ran freely`},{key:`approve`,label:`Asked you`},{key:`deny`,label:`Blocked`}].map(e=>(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,A.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 rounded-full`,style:{background:`var(--mark-${e.key})`}}),e.label]},e.key))})}function ua({protection:e,loading:t,error:n,href:r}){let i=e?.surface,a=i&&!i.neverPublished;return(0,A.jsx)(ue,{title:`Tools protected`,value:a?D(i.toolCount):`–`,loading:t&&!e,sub:n?`Could not be loaded`:i?i.neverPublished?`Not known until the toolbox runs`:i.unclassifiedCount>0?`${D(i.unclassifiedCount)} not labelled yet`:i.stale?`List may be out of date`:`All labelled`:void 0,href:r,hrefLabel:`See all tools`})}function N({oldest:e,count:t,loading:n,error:r,retry:i,href:a}){return(0,A.jsx)(fe,{title:`Waiting for you`,children:r&&t===null?(0,A.jsx)(u,{tone:`danger`,title:`The waiting calls could not be loaded`,actions:(0,A.jsx)(E,{size:`sm`,onClick:i,children:`Try again`}),children:$n(r)}):t===null&&n?(0,A.jsx)(l,{lines:4}):e?(0,A.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,A.jsx)(`p`,{className:`text-[13px] text-soft`,children:t&&t>1?`Oldest of ${t}`:`One call`}),(0,A.jsx)(`p`,{className:`display mt-1 text-[22px] leading-tight text-ok`,children:`Your AI app wants to`}),(0,A.jsxs)(`p`,{className:`mt-1 text-[16px] font-medium break-words text-ink`,children:[qi(e.tool).label.toLowerCase(),qi(e.tool).server&&(0,A.jsxs)(`span`,{className:`text-[13px] font-normal text-soft`,children:[` · `,qi(e.tool).server]})]}),(0,A.jsxs)(`p`,{className:`mt-2 text-[13.5px] text-muted`,children:[`Waiting `,x(e.createdAt).replace(` ago`,``)]}),(0,A.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[13px] text-soft`,children:Ji(e)}),(0,A.jsx)(`div`,{className:`mt-5`,children:(0,A.jsx)(ne,{href:a,variant:`primary`,size:`lg`,icon:`arrow-right`,className:`w-full justify-center`,children:`Review now`})})]}):(0,A.jsx)(b,{icon:`check`,title:`Nothing is waiting for you`,compact:!0,children:`When a call needs your approval it shows up here.`})})}function P(e,t){let n=e=>(t.has(e.name)?0:8)+(e.exposure.disabled?0:4)+(e.effect===null?0:2);return[...e].sort((e,t)=>n(e)-n(t)||e.name.localeCompare(t.name)).slice(0,5)}var da={read:`ok`,write:`warn`,destructive:`bad`};function fa({protection:t,changed:n,loading:r,error:a,retry:o,nav:s}){let c=(0,k.useMemo)(()=>new Set(n),[n]),d=t?P(t.tools,c):[];return(0,A.jsx)(fe,{title:`Tools`,actions:(0,A.jsx)(ne,{href:i(s,`/tools`),size:`sm`,variant:`secondary`,children:`See all tools`}),children:a&&!t?(0,A.jsx)(u,{tone:`danger`,title:`The tools could not be loaded`,actions:(0,A.jsx)(E,{size:`sm`,onClick:o,children:`Try again`}),children:$n(a)}):!t&&r?(0,A.jsx)(l,{lines:5,height:18}):d.length===0?(0,A.jsx)(b,{icon:`tool`,title:`No tools listed yet`,compact:!0,children:t?.surface.neverPublished?`The tool list appears once your AI app has started the toolbox.`:`This toolbox has no tools.`}):(0,A.jsx)(`div`,{className:`-my-1`,children:d.map(t=>{let n=c.has(t.name)?`Changed`:t.exposure.disabled?`Turned off`:null,r=da[t.effect??``]??`neutral`;return(0,A.jsx)(ee,{href:i(s,`/tools`,{tool:t.name}),leading:(0,A.jsx)(`span`,{className:`grid h-10 w-10 shrink-0 place-items-center rounded-full ${r===`ok`?`bg-ok-tint`:r===`warn`?`bg-warn-tint`:r===`bad`?`bg-bad-tint`:`bg-sunken`}`,children:(0,A.jsx)(te,{effect:t.effect})}),title:(0,A.jsx)(`span`,{className:`text-[13.5px] break-words`,title:t.name,children:ha(t.name)}),sub:(0,A.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-1.5`,children:[ga(t.name)&&(0,A.jsx)(`span`,{className:`text-[12px] text-soft`,children:ga(t.name)}),t.exposure.disabled?(0,A.jsx)(e,{tone:`bad`,icon:`power`,children:`Turned off`}):(0,A.jsx)(ie,{decision:t.verdict.kind}),n===`Changed`&&(0,A.jsx)(e,{tone:`warn`,icon:`warning`,children:`Changed`})]})},t.name)})})})}function pa({records:t,loading:n,error:r,retry:i,href:a}){return(0,A.jsx)(fe,{title:`Recent activity`,className:`lg:col-span-2`,actions:(0,A.jsx)(ne,{href:a,size:`sm`,variant:`secondary`,children:`See all activity`}),children:r&&!t?(0,A.jsx)(u,{tone:`danger`,title:`The activity log could not be read`,actions:(0,A.jsx)(E,{size:`sm`,onClick:i,children:`Try again`}),children:$n(r)}):!t&&n?(0,A.jsx)(l,{lines:5,height:18}):!t||t.length===0?(0,A.jsx)(b,{icon:`activity`,title:`No activity yet`,compact:!0,children:`Calls your AI app makes through your toolbox are listed here.`}):(0,A.jsx)(`div`,{className:`-my-1`,children:t.map(t=>{let n=ar(t),r=or(t.actor,t.component);return(0,A.jsx)(ee,{icon:t.actor===`gateway`?`shield`:t.component===`hmcp-web`?`user`:`activity`,iconTone:n.outcome.tone===`bad`?`bad`:n.outcome.tone===`warn`?`warn`:`neutral`,title:r,wrapSub:!0,sub:(0,A.jsxs)(A.Fragment,{children:[n.verb,n.tool&&(0,A.jsxs)(A.Fragment,{children:[` `,(0,A.jsx)(`span`,{className:`text-ink`,title:n.tool,children:qi(n.tool).label.toLowerCase()})]}),(0,A.jsxs)(`span`,{className:`text-soft`,children:[` · `,x(t.ts)]})]}),trailing:(0,A.jsx)(e,{tone:n.outcome.tone,children:n.outcome.label})},`${t.seq}-${t.id}`)})})})}function ma({protection:e,loading:t,error:n,retry:r}){let i=(0,k.useMemo)(()=>{let t={allow:0,approve:0,deny:0,unlabelled:0};for(let n of e?.tools??[])n.effect===null&&!n.exposure.disabled?t.unlabelled++:t[n.verdict.kind]++;return t},[e]),a=i.allow+i.approve+i.deny+i.unlabelled;return(0,A.jsx)(fe,{title:`How your tools are set`,children:n&&!e?(0,A.jsx)(u,{tone:`danger`,title:`The tool settings could not be loaded`,actions:(0,A.jsx)(E,{size:`sm`,onClick:r,children:`Try again`}),children:$n(n)}):!e&&t?(0,A.jsx)(l,{height:200}):a===0?(0,A.jsx)(b,{icon:`sliders`,title:`No tools to show`,compact:!0,children:`Once the toolbox lists its tools, this shows how many run freely, ask you first or are blocked.`}):(0,A.jsx)(ae,{label:`${i.allow} tools run freely, ${i.approve} ask you first, ${i.deny} are blocked, ${i.unlabelled} not labelled yet.`,center:String(i.allow),caption:`of ${a} run freely`,segments:[{label:`Runs freely`,value:i.allow,mark:`allow`},{label:`Asks you first`,value:i.approve,mark:`approve`},{label:`Blocked`,value:i.deny,mark:`deny`},...i.unlabelled>0?[{label:`Not labelled`,value:i.unlabelled,mark:`unclassified`}]:[]]})})}function ha(e){let t=e.indexOf(`__`);return t>0?e.slice(t+2):e}function ga(e){let t=e.indexOf(`__`);return t>0?e.slice(0,t):null}var _a=`modulepreload`,va=function(e){return`/`+e},ya={},ba=function(e){return e.pathname.endsWith(`.css`)},xa=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=va(t,n);let r=s(t);if(r.href in ya)return;ya[r.href]=!0;let i=ba(r);if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let o=document.createElement(`link`);if(o.rel=i?`stylesheet`:_a,i||(o.as=`script`),o.crossOrigin=``,o.href=r.href,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),i)return new Promise((e,t)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${r}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Sa=(0,k.lazy)(()=>xa(()=>import(`./Activity-CZ78RyRO.js`).then(e=>({default:e.ActivityPage})),__vite__mapDeps([0,1]))),Ca=(0,k.lazy)(()=>xa(()=>import(`./Approvals-DPIlNZsv.js`).then(e=>({default:e.ApprovalsPage})),__vite__mapDeps([2,1]))),wa=(0,k.lazy)(()=>xa(()=>import(`./Connections-qcA96lXh.js`).then(e=>({default:e.ConnectionsPage})),__vite__mapDeps([3,1,4]))),Ta=(0,k.lazy)(()=>xa(()=>import(`./PreApprovals-C4cKajcK.js`).then(e=>({default:e.PreApprovalsPage})),__vite__mapDeps([5,1]))),Ea=(0,k.lazy)(()=>xa(()=>import(`./Protection-B8h-5YAb.js`).then(e=>({default:e.ProtectionPage})),__vite__mapDeps([6,1]))),Da=(0,k.lazy)(()=>xa(()=>import(`./Safety-BQqHyYdo.js`).then(e=>({default:e.SafetyPage})),__vite__mapDeps([7,1]))),Oa=(0,k.lazy)(()=>xa(()=>import(`./Settings-Cx50zZSt.js`).then(e=>({default:e.SettingsPage})),__vite__mapDeps([8,1]))),ka=(0,k.lazy)(()=>xa(()=>import(`./Suggestions-CRo5UOTT.js`).then(e=>({default:e.SuggestionsPage})),__vite__mapDeps([9,1]))),Aa=(0,k.lazy)(()=>xa(()=>import(`./Tools-xo39lPKB.js`).then(e=>({default:e.ToolsPage})),__vite__mapDeps([10,1]))),F=[{path:`/`,title:`Home`,icon:`home`,section:`menu`,page:ca,scoped:!0},{path:`/approvals`,title:`Waiting for you`,icon:`clock`,section:`menu`,page:Ca,scoped:!0,badge:`pending`},{path:`/tools`,title:`Tools`,icon:`tool`,section:`menu`,page:Aa,scoped:!0},{path:`/activity`,title:`Activity`,icon:`activity`,section:`menu`,page:Sa,scoped:!0},{path:`/safety`,title:`Safety check`,icon:`shield-check`,section:`menu`,page:Da,scoped:!0,badge:`high`},{path:`/pre-approvals`,title:`Pre-approvals`,icon:`key`,section:`setup`,page:Ta,scoped:!0},{path:`/suggestions`,title:`Suggestions`,icon:`lightbulb`,section:`setup`,page:ka,scoped:!0},{path:`/protection`,title:`Protection settings`,icon:`sliders`,section:`setup`,page:Ea,scoped:!0},{path:`/connections`,title:`Connections`,icon:`plug`,section:`setup`,page:wa,scoped:!1},{path:`/settings`,title:`Settings & help`,icon:`settings`,section:`setup`,page:Oa,scoped:!1}],ja={"/functions":`/tools`,"/audit":`/activity`,"/findings":`/safety`,"/policy":`/protection`,"/servers":`/connections`,"/overview":`/`};function Ma(e){let t=e.length>1?e.replace(/\/+$/,``):e;return F.find(e=>e.path===t)??F[0]}function Na(){dispatchEvent(new CustomEvent(`hmcp:palette`))}function Pa({nav:e,servers:t,active:n,tenant:a}){let[s,c]=(0,k.useState)(!1),[l,u]=(0,k.useState)(``),[d,f]=(0,k.useState)(0),[p,m]=(0,k.useState)(null),h=(0,k.useRef)(null),v=(0,k.useId)();r(h,s,()=>c(!1)),(0,k.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),c(e=>!e))},t=()=>c(!0);return addEventListener(`keydown`,e),addEventListener(`hmcp:palette`,t),()=>{removeEventListener(`keydown`,e),removeEventListener(`hmcp:palette`,t)}},[]),(0,k.useEffect)(()=>m(null),[n?.id,a]),(0,k.useEffect)(()=>{if(!s||p!==null||!n)return;let e=!0;return _.tools(n.id,a).then(t=>e&&m(t),()=>e&&m([])),()=>{e=!1}},[s,p,n?.id,a]),(0,k.useEffect)(()=>{s||u(``)},[s]);let y=(0,k.useMemo)(()=>{let r=F.map(t=>({key:`p:${t.path}`,label:t.title,hint:`Page`,icon:t.icon,href:i(e,t.path)}));for(let t of p??[])r.push({key:`t:${t.name}`,label:t.name,hint:`Tool`,icon:`tool`,href:i(e,`/tools`,{tool:t.name}),sub:he[t.verdict.kind]?.label});for(let i of t)i.id!==n?.id&&r.push({key:`g:${i.id}`,label:i.label,hint:`Toolbox`,icon:`server`,href:o(e,{server:i.id,tenant:null})});return r},[e,p,t,n?.id]),b=l.trim().toLowerCase(),x=(b?y.filter(e=>e.label.toLowerCase().includes(b)):y).slice(0,14);if((0,k.useEffect)(()=>f(0),[b,s]),!s)return null;let ee=e=>{c(!1),be(e)},S=e=>`${v}-o${e}`;return(0,gt.createPortal)((0,A.jsxs)(`div`,{className:`fixed inset-0 z-[70] flex items-start justify-center px-3 pt-[12vh]`,children:[(0,A.jsx)(`div`,{className:`anim-overlay absolute inset-0 bg-[var(--scrim)]`,onClick:()=>c(!1),"aria-hidden":!0}),(0,A.jsxs)(`div`,{ref:h,role:`dialog`,"aria-modal":`true`,"aria-label":`Search pages and tools`,className:`anim-dialog relative w-full max-w-[560px] overflow-hidden rounded-[22px] bg-surface shadow-[var(--shadow-lg)]`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-faint px-5 py-4`,children:[(0,A.jsx)(g,{name:`search`,size:20,className:`shrink-0 text-muted`}),(0,A.jsx)(`input`,{autoFocus:!0,value:l,onChange:e=>u(e.target.value),placeholder:`Search pages and tools`,role:`combobox`,"aria-label":`Search pages and tools`,"aria-expanded":`true`,"aria-controls":v,"aria-activedescendant":x[d]?S(d):void 0,"aria-autocomplete":`list`,onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),f(e=>Math.min(e+1,x.length-1))):e.key===`ArrowUp`?(e.preventDefault(),f(e=>Math.max(e-1,0))):e.key===`Enter`&&x[d]&&ee(x[d].href)},className:`min-w-0 flex-1 bg-transparent text-[16px] outline-none placeholder:text-soft`}),(0,A.jsx)(`kbd`,{className:`rounded-md bg-sunken px-1.5 py-0.5 font-sans text-[11.5px] font-semibold text-muted`,children:`Esc`})]}),x.length===0?(0,A.jsxs)(`p`,{className:`px-5 py-8 text-center text-[14px] text-soft`,children:[`Nothing matches “`,l,`”.`]}):(0,A.jsxs)(`ul`,{id:v,role:`listbox`,"aria-label":`Results`,className:`scrollbar-thin max-h-[min(420px,55vh)] overflow-y-auto p-2`,children:[x.map((e,t)=>(0,A.jsxs)(`li`,{id:S(t),role:`option`,"aria-selected":t===d,onMouseEnter:()=>f(t),onClick:()=>ee(e.href),className:Se(`flex cursor-pointer items-center gap-3 rounded-xl px-3 py-2.5`,t===d&&`bg-faint`),children:[(0,A.jsx)(`span`,{className:`grid h-8 w-8 shrink-0 place-items-center rounded-full bg-sunken text-muted`,children:(0,A.jsx)(g,{name:e.icon,size:16})}),(0,A.jsx)(`span`,{className:Se(`min-w-0 flex-1 truncate text-[14px] font-medium`,e.hint===`Tool`&&`font-mono text-[13px]`),children:e.label}),e.sub&&(0,A.jsx)(`span`,{className:`shrink-0 text-[12px] text-soft max-sm:hidden`,children:e.sub}),(0,A.jsx)(`span`,{className:`shrink-0 text-[12px] font-semibold text-soft`,children:e.hint})]},e.key)),n&&p===null&&(0,A.jsx)(`li`,{className:`px-3 py-2 text-[12.5px] text-soft`,children:`Loading tools…`})]})]})]}),document.body)}var Fa=(0,k.lazy)(()=>xa(()=>import(`./Gallery-DB_OO7Vw.js`).then(e=>({default:e.Gallery})),__vite__mapDeps([11,1])));function I(){let e=y(),t=ja[e.path];(0,k.useEffect)(()=>{t&&ve(i(e,t,Object.fromEntries(e.query),[]))},[t,e]);let n=me(()=>_.servers(),[],3e4),r=n.data??[],a=r.filter(e=>e.ok),s=e.query.get(`server`),c=a.find(e=>e.id===s)??a[0]??null;(0,k.useEffect)(()=>{c&&s!==c.id&&ve(o(e,{server:c.id}))},[c?.id,s,e.path]);let l=me(()=>c?_.tenants(c.id):Promise.resolve(null),[c?.id]),d=e.query.get(`tenant`)??l.data?.assumed??null,f=!!l.data?.configured&&d===null,p=me(()=>c&&!f?_.pending(c.id,d).then(e=>e.length):Promise.resolve(null),[c?.id,d,f],1e4),m=me(()=>c&&!f?_.scan(c.id,d).then(e=>e.findings.filter(e=>e.severity===`high`).length):Promise.resolve(null),[c?.id,d,f],6e4),h=Ma(e.path),g=e.path===`/_kit`,b={server:c,serverId:c?.id??null,servers:r,tenant:d,tenantInfo:l.data??null,reload:()=>{n.reload(),p.reload(),m.reload()},pendingCount:p.error?null:p.data,highFindings:m.error?null:m.data,nav:e},[x,ee]=(0,k.useState)(!1);(0,k.useEffect)(()=>ee(!1),[e.path]),(0,k.useEffect)(()=>{document.title=`${g?`Kit`:h.title} · hardened-mcp`},[h.title,g]);let S=h.page,te=n.loading&&n.data===null;return(0,A.jsxs)(Ft.Provider,{value:b,children:[(0,A.jsxs)(`nav`,{"aria-label":`Skip links`,children:[(0,A.jsx)(`a`,{href:`#main`,className:`sr-only z-[100] rounded-full bg-primary px-4 py-2 font-semibold text-white focus:not-sr-only focus:fixed focus:top-3 focus:left-3`,children:`Skip to content`}),(0,A.jsx)(`a`,{href:`#pages-nav`,onClick:e=>{e.preventDefault(),document.querySelector(`#pages-nav a`)?.focus()},className:`sr-only z-[100] rounded-full bg-primary px-4 py-2 font-semibold text-white focus:not-sr-only focus:fixed focus:top-3 focus:left-3`,children:`Skip to the menu`}),(b.pendingCount??0)>0&&e.path!==`/approvals`&&(0,A.jsxs)(`a`,{href:i(e,`/approvals`),onClick:e=>{v(e),Ga()},className:`sr-only z-[100] rounded-full bg-primary px-4 py-2 font-semibold text-white focus:not-sr-only focus:fixed focus:top-3 focus:left-3`,children:[`Skip to what's waiting for you (`,b.pendingCount,`)`]})]}),(0,A.jsxs)(`div`,{className:`mx-auto flex min-h-dvh max-w-[1680px] gap-4 p-3 lg:gap-5 lg:p-4`,children:[(0,A.jsx)(`aside`,{"aria-label":`Sidebar`,className:`card sticky top-4 hidden h-[calc(100dvh-2rem)] w-[264px] shrink-0 flex-col overflow-hidden rounded-[28px] lg:flex`,children:(0,A.jsx)(Ia,{nav:e,route:g?null:h,pending:b.pendingCount,high:b.highFindings})}),(0,A.jsx)(Ra,{open:x,onClose:()=>ee(!1),children:(0,A.jsx)(Ia,{nav:e,route:g?null:h,pending:b.pendingCount,high:b.highFindings,mobile:!0})}),(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-4 lg:gap-5`,children:[(0,A.jsx)(za,{nav:e,servers:r,active:c,tenants:l.data??null,tenant:d,pending:b.pendingCount,menuOpen:x,onMenu:()=>ee(!0),scoped:h.scoped&&!g}),(0,A.jsx)(`main`,{id:`main`,tabIndex:-1,className:`min-w-0 flex-1 px-1 pb-10 outline-none sm:px-2 lg:px-3`,children:n.error?(0,A.jsx)(u,{tone:`danger`,title:`The console could not load your toolboxes`,role:`alert`,children:n.error}):te?(0,A.jsx)(Wa,{}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Ha,{nav:e,servers:r,active:c,tenantMissing:f,tenants:l.data??null}),g?(0,A.jsx)(k.Suspense,{fallback:(0,A.jsx)(Wa,{}),children:(0,A.jsx)(Fa,{})}):h.scoped&&!c?(0,A.jsx)(Ua,{nav:e}):(0,A.jsx)(k.Suspense,{fallback:(0,A.jsx)(Wa,{}),children:(0,A.jsx)(S,{},h.scoped?`${h.path}|${c?.id??``}|${d??``}`:h.path)})]})})]})]}),(0,A.jsx)(Pa,{nav:e,servers:a,active:c,tenant:f?null:d})]})}function Ia({nav:e,route:t,pending:n,high:r,mobile:a=!1}){let o=e=>F.filter(t=>t.section===e),s=e=>e.badge===`pending`?n??0:e.badge===`high`?r??0:0,c=n=>{let r=s(n);return(0,A.jsx)(`li`,{children:(0,A.jsxs)(`a`,{href:i(e,n.path),onClick:v,"aria-current":t?.path===n.path?`page`:void 0,className:`nav-link`,children:[(0,A.jsx)(g,{name:n.icon,size:21,className:`nav-icon shrink-0`}),(0,A.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.title}),(0,A.jsx)(S,{count:r,label:n.badge===`pending`?`waiting`:`serious findings`})]})},n.path)};return(0,A.jsxs)(`div`,{className:`flex h-full flex-col px-5 pt-7 pb-5`,children:[(0,A.jsxs)(`a`,{href:i(e,`/`),onClick:v,className:`flex items-center gap-3 px-2`,"aria-label":`hardened-mcp home`,children:[(0,A.jsx)(`span`,{className:`grid h-10 w-10 place-items-center rounded-xl bg-[#2a2623] shadow-[var(--shadow-sm)] ring-1 ring-[var(--faint)]`,children:(0,A.jsx)(`img`,{src:`/brand/mark.svg`,alt:``,width:30,height:30})}),(0,A.jsx)(`span`,{className:`text-[19px] font-semibold tracking-[-0.03em]`,children:`hardened-mcp`})]}),(0,A.jsxs)(`nav`,{id:a?void 0:`pages-nav`,"aria-label":`Pages`,className:`scrollbar-thin -mx-2 mt-7 flex min-h-0 flex-1 flex-col overflow-y-auto px-2`,children:[(0,A.jsx)(`p`,{className:`eyebrow px-3 pb-2`,children:`Menu`}),(0,A.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:o(`menu`).map(c)}),(0,A.jsx)(`p`,{className:`eyebrow mt-7 px-3 pb-2`,children:`Setup`}),(0,A.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:o(`setup`).map(c)})]}),(0,A.jsx)(`div`,{className:`shrink-0 pt-5`,children:(0,A.jsx)(La,{nav:e,mobile:a})})]})}function La({nav:e,mobile:t=!1}){let n=(me(()=>at.clients().catch(()=>null),[]).data?.clients??[]).some(e=>e.alreadyAdopted);return(0,A.jsxs)(`section`,{"aria-labelledby":t?void 0:`promo-title`,"aria-label":t?`Connect your AI apps`:void 0,className:`card-hero relative overflow-hidden rounded-[22px] p-4`,children:[(0,A.jsx)(`svg`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 h-full w-full opacity-30`,viewBox:`0 0 220 200`,preserveAspectRatio:`none`,children:(0,A.jsxs)(`g`,{fill:`none`,stroke:`#8fd0ab`,strokeWidth:`1`,children:[(0,A.jsx)(`path`,{d:`M120 0c-10 60 40 90 100 80`}),(0,A.jsx)(`path`,{d:`M100 0c-12 75 50 110 120 98`}),(0,A.jsx)(`path`,{d:`M80 0c-14 90 60 130 140 118`}),(0,A.jsx)(`path`,{d:`M-10 170c60-30 130-10 240 30`}),(0,A.jsx)(`path`,{d:`M-10 186c70-26 140-6 240 26`})]})}),(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(`span`,{className:`grid h-9 w-9 place-items-center rounded-full bg-white text-green-deep [@media(max-height:820px)]:hidden`,children:(0,A.jsx)(g,{name:`plug`,size:18,strokeWidth:2})}),(0,A.jsx)(`h2`,{id:t?void 0:`promo-title`,className:`mt-3 text-[17px] leading-snug font-semibold text-white [@media(max-height:820px)]:mt-0`,children:n?`Using another AI app?`:`Connect your AI apps`}),(0,A.jsx)(`p`,{className:`mt-1 text-[12.5px] leading-snug text-on-hero-soft`,children:n?`Your toolbox works with Claude, Cursor and VS Code too.`:`Let Claude, Cursor or VS Code use your toolbox.`}),(0,A.jsx)(ne,{href:i(e,`/connections`,{connect:`1`}),variant:`on-hero`,size:`sm`,className:`mt-3 w-full`,children:n?`Connect another app`:`Connect an app`})]})]})}function Ra({open:e,onClose:t,children:n}){let i=(0,k.useRef)(null);return r(i,e,t),e?(0,A.jsxs)(`div`,{className:`fixed inset-0 z-50 lg:hidden`,children:[(0,A.jsx)(`div`,{className:`anim-overlay absolute inset-0 bg-[var(--scrim)]`,onClick:t,"aria-hidden":!0}),(0,A.jsxs)(`div`,{ref:i,id:`mobile-menu`,role:`dialog`,"aria-modal":`true`,"aria-label":`Menu`,className:`anim-drawer card absolute inset-y-2 left-2 flex w-[min(300px,calc(100vw-56px))] flex-col overflow-hidden rounded-[24px]`,children:[(0,A.jsx)(oe,{icon:`x`,label:`Close menu`,onClick:t,className:`absolute top-5 right-4 z-10`,size:36}),n]})]}):null}function za({nav:e,servers:t,active:n,tenants:r,tenant:a,pending:o,menuOpen:s,onMenu:c,scoped:l}){let{theme:u,toggle:d}=ht(),f=(0,k.useMemo)(()=>/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),[]);return(0,A.jsxs)(`header`,{className:`card flex items-center gap-2 rounded-[24px] p-2.5 sm:gap-3 sm:p-3`,children:[(0,A.jsx)(oe,{icon:`menu`,label:`Open menu`,onClick:c,"aria-expanded":s,"aria-controls":`mobile-menu`,className:`lg:hidden`,variant:`soft`}),(0,A.jsxs)(`button`,{type:`button`,onClick:Na,"aria-keyshortcuts":`Meta+K Control+K`,className:`flex h-11 min-w-0 flex-1 items-center gap-3 rounded-full bg-sunken/70 px-4 text-left text-[14px] text-soft transition-colors hover:bg-sunken sm:max-w-[400px]`,children:[(0,A.jsx)(g,{name:`search`,size:19,className:`shrink-0 text-muted`}),(0,A.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,A.jsx)(`span`,{className:`sm:hidden`,children:`Search`}),(0,A.jsx)(`span`,{className:`max-sm:hidden`,children:`Search pages and tools`})]}),(0,A.jsx)(`kbd`,{"aria-hidden":!0,className:`hidden shrink-0 rounded-md bg-surface px-1.5 py-0.5 font-sans text-[12px] font-semibold text-muted shadow-[var(--shadow-sm)] sm:inline`,children:f?`⌘K`:`Ctrl K`})]}),(0,A.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,A.jsx)(oe,{icon:u===`dark`?`sun`:`moon`,label:u===`dark`?`Use light theme`:`Use dark theme`,onClick:d,variant:`soft`,className:`max-sm:hidden`}),(0,A.jsx)(oe,{icon:`bell`,label:`Waiting for you`,href:i(e,`/approvals`),variant:`soft`,badge:o??0}),t.length>0&&(0,A.jsx)(Ba,{nav:e,servers:t,active:n}),n&&l&&r?.configured&&(0,A.jsx)(Va,{nav:e,tenants:r,tenant:a})]})]})}function Ba({nav:e,servers:t,active:n}){let r=n?n.enforcement===`observe`?`Watch-only`:n.running?`Protecting`:`Not running`:`No toolbox`,i=n?n.enforcement===`observe`?`bg-bad`:n.running?`bg-allow`:`bg-approve`:`bg-[var(--soft)]`;return(0,A.jsxs)(`label`,{className:`relative flex h-11 max-w-[220px] min-w-0 cursor-pointer items-center gap-2.5 rounded-full border border-faint bg-surface py-1 pr-3 pl-1.5 shadow-[var(--shadow-sm)] transition-colors focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-[var(--focus)] hover:bg-faint`,children:[(0,A.jsx)(`span`,{className:`grid h-8 w-8 shrink-0 place-items-center rounded-full bg-sunken text-muted`,children:(0,A.jsx)(g,{name:`server`,size:17})}),(0,A.jsxs)(`span`,{className:`min-w-0 max-md:hidden`,children:[(0,A.jsx)(`span`,{className:`block truncate text-[13.5px] leading-tight font-semibold`,children:n?.label??`Choose toolbox`}),(0,A.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[12px] leading-tight text-soft`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:Se(`h-1.5 w-1.5 rounded-full`,i)}),r]})]}),(0,A.jsx)(g,{name:`chevron`,size:16,className:`shrink-0 text-soft max-md:hidden`}),(0,A.jsxs)(`select`,{"aria-label":`Toolbox`,value:n?.id??``,onChange:t=>be(o(e,{server:t.target.value,tenant:null})),className:`absolute inset-0 cursor-pointer opacity-0`,children:[!n&&(0,A.jsx)(`option`,{value:``,children:`Choose toolbox`}),t.map(e=>(0,A.jsxs)(`option`,{value:e.id,disabled:!e.ok,children:[e.label,e.ok?``:` (cannot load)`]},e.id))]})]})}function Va({nav:e,tenants:t,tenant:n}){let r=t.tenants.filter(e=>e!==``);return(0,A.jsxs)(`label`,{className:Se(`relative flex h-11 max-w-[180px] min-w-0 cursor-pointer items-center gap-2 rounded-full border bg-surface py-1 pr-3 pl-3 shadow-[var(--shadow-sm)] focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-[var(--focus)] hover:bg-faint`,n===null?`border-warn/50`:`border-faint`),title:t.whyNotAssumed??void 0,children:[(0,A.jsx)(g,{name:`users`,size:17,className:`shrink-0 text-muted`}),(0,A.jsxs)(`span`,{className:`min-w-0 max-md:hidden`,children:[(0,A.jsx)(`span`,{className:`block text-[11.5px] leading-tight text-soft`,children:`Customer`}),(0,A.jsx)(`span`,{className:Se(`block truncate text-[13.5px] leading-tight font-semibold`,n===null&&`text-warn`),children:n??`Choose…`})]}),(0,A.jsx)(g,{name:`chevron`,size:16,className:`shrink-0 text-soft max-md:hidden`}),(0,A.jsxs)(`select`,{"aria-label":`Customer`,value:e.query.get(`tenant`)??``,onChange:t=>ve(o(e,{tenant:t.target.value||null})),className:`absolute inset-0 cursor-pointer opacity-0`,children:[(0,A.jsx)(`option`,{value:``,children:t.assumed===null?`Choose a customer`:`${t.assumed} (default)`}),r.map(e=>(0,A.jsx)(`option`,{value:e,children:e},e))]})]})}function Ha({nav:e,servers:t,active:n,tenantMissing:r,tenants:a}){let o=t.filter(e=>!e.ok),s=n?.enforcement===`observe`;return!s&&o.length===0&&!r&&!n?.tenantError?null:(0,A.jsxs)(`div`,{className:`mb-6 flex flex-col gap-3`,children:[s&&(0,A.jsx)(u,{tone:`danger`,role:`alert`,title:`Your toolbox is only watching. Nothing is being blocked or asked.`,actions:(0,A.jsx)(ne,{href:i(e,`/protection`,{focus:`mode`}),variant:`primary`,size:`sm`,icon:`shield`,children:`Start protecting`}),children:`Every call from your AI apps runs, even ones your rules would stop. The log shows what would have happened. Tools you turned off stay off.`}),o.map(t=>(0,A.jsx)(u,{tone:`warn`,title:`“${t.label}” could not be loaded`,actions:(0,A.jsx)(ne,{href:i(e,`/connections`),size:`sm`,children:`Open connections`}),children:t.error},t.id)),r&&(0,A.jsxs)(u,{tone:`info`,title:`Choose a customer to see their data`,children:[`This toolbox keeps each customer’s approvals and settings apart.`,a?.whyNotAssumed?` ${a.whyNotAssumed}`:``,` Pick one with the Customer menu at the top.`]}),n?.tenantError&&!r&&(0,A.jsx)(u,{tone:`warn`,title:`The customer setting could not be read`,children:n.tenantError})]})}function Ua({nav:e}){return(0,A.jsx)(fe,{className:`mx-auto mt-6 max-w-2xl`,children:(0,A.jsx)(b,{icon:`plug`,title:`No toolbox yet`,actions:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(ne,{href:i(e,`/connections`,{connect:`1`}),variant:`primary`,icon:`plug`,children:`Connect an app`}),(0,A.jsx)(ne,{href:i(e,`/connections`,{add:`1`}),icon:`plus`,children:`Add a toolbox`})]}),children:`A toolbox sits between your AI apps and the tools they use, and decides what runs. Connect an app to set one up, or add a toolbox you already run.`})})}function Wa(){return(0,A.jsxs)(`div`,{"aria-busy":`true`,"aria-label":`Loading`,children:[(0,A.jsx)(l,{height:40,width:`280px`}),(0,A.jsx)(`div`,{className:`mt-8 grid gap-4 sm:grid-cols-2 xl:grid-cols-4`,children:[0,1,2,3].map(e=>(0,A.jsx)(`div`,{className:`card h-[184px] p-6`,children:(0,A.jsx)(l,{lines:3})},e))})]})}function Ga(){let e=Date.now(),t=document.querySelector(`#main h1`),n=()=>{let r=document.querySelector(`#main h1`);r&&(r!==t||Date.now()-e>300)?(r.hasAttribute(`tabindex`)||r.setAttribute(`tabindex`,`-1`),r.focus()):Date.now()-e<2e3&&requestAnimationFrame(n)};requestAnimationFrame(n)}var Ka=(0,k.lazy)(()=>xa(()=>import(`./StartPage-CdX-v7ej.js`).then(e=>({default:e.StartPage})),__vite__mapDeps([12,1,4])));function qa(){let[e,t]=(0,k.useState)(null),[n,r]=(0,k.useState)(null);return(0,k.useEffect)(()=>{let e=new URLSearchParams(location.search).get(`t`);e?_.session(e).then(()=>{let e=new URLSearchParams(location.search);e.delete(`t`);let n=e.toString();history.replaceState(null,``,n?`${location.pathname}?${n}`:location.pathname),t(!0)}).catch(e=>{r(e.message),t(!1)}):_.servers().then(()=>t(!0)).catch(e=>{e instanceof m&&e.status===401||r(String(e.message)),t(!1)})},[]),e===null?(0,A.jsx)(Ya,{children:(0,A.jsx)(`p`,{className:`text-soft`,role:`status`,children:`Connecting…`})}):e?(0,A.jsx)(ge,{children:(0,A.jsx)(Ja,{})}):(0,A.jsx)(Ya,{children:(0,A.jsxs)(`div`,{className:`card w-full max-w-md p-8 text-left`,children:[(0,A.jsx)(`span`,{className:`grid h-12 w-12 place-items-center rounded-2xl bg-[#2a2623]`,children:(0,A.jsx)(`img`,{src:`/brand/mark.svg`,alt:``,width:34,height:34})}),(0,A.jsx)(`h1`,{className:`display mt-6 text-[30px]`,children:`Open hardened-mcp again to sign in`}),(0,A.jsx)(`p`,{className:`mt-3 text-[15px] text-muted`,children:`This page can't sign you in by itself, so that no other website can open your console. To get back in:`}),(0,A.jsxs)(`ol`,{className:`mt-3 list-decimal space-y-1.5 pl-5 text-[15px] text-muted`,children:[(0,A.jsx)(`li`,{children:`Open hardened-mcp the same way you did the first time.`}),(0,A.jsx)(`li`,{children:`It opens your console in a new tab, already signed in. You can close this one.`})]}),(0,A.jsx)(`div`,{className:`mt-5 flex flex-wrap items-center gap-3`,children:(0,A.jsx)(E,{variant:`primary`,icon:`refresh`,onClick:()=>location.reload(),children:`I've opened it, check again`})}),(0,A.jsxs)(`details`,{className:`mt-5 text-[13.5px] text-soft`,children:[(0,A.jsx)(`summary`,{className:`cursor-pointer select-none`,children:`I started it in Terminal`}),(0,A.jsxs)(`p`,{className:`mt-2`,children:[`Type the same command again in Terminal, for example `,(0,A.jsx)(`code`,{className:`mono`,children:`npx hardened-mcp`}),`. If hardened-mcp is still running, that works too: it opens a signed-in page for you.`]})]}),n&&(0,A.jsx)(`div`,{className:`mt-5`,children:(0,A.jsx)(u,{tone:`danger`,children:n})})]})})}function Ja(){let e=y(),[n,r]=(0,k.useState)(!1);return(0,k.useEffect)(()=>{n||e.path!==`/`||(r(!0),Promise.all([_.servers(),t.settings()]).then(([e,t])=>{ze(Ie(t).onboarding,e.length)&&ve(`/start`)}).catch(()=>void 0))},[e.path,n]),e.path===`/oauth/callback`?(0,A.jsx)(Ae,{}):e.path===`/start`?(0,A.jsx)(k.Suspense,{fallback:null,children:(0,A.jsx)(Ka,{})}):(0,A.jsx)(I,{})}function Ya({children:e}){return(0,A.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center p-6`,children:e})}pt(),(0,Ee.createRoot)(document.getElementById(`root`)).render((0,A.jsx)(k.StrictMode,{children:(0,A.jsx)(qa,{})}));export{Ar as $,hn as $t,ci as A,Me as An,gn as At,Xr as B,Be as Bn,En as Bt,li as C,Mt as Cn,Fn as Ct,Zr as D,at as Dn,Xn as Dt,ri as E,ht as En,Zn as Et,mi as F,Ue as Fn,qt as Ft,Wr as G,tt as Gn,yn as Gt,gi as H,Ve as Hn,Yt as Ht,$r as I,Ke as In,An as It,Yr as J,dn as Jt,Ur as K,Je as Kn,On as Kt,Ei as L,Qe as Ln,xn as Lt,vi as M,Pe as Mn,Xt as Mt,Br as N,Ze as Nn,$t as Nt,_i as O,Xe as On,Yn as Ot,ni as P,$e as Pn,cn as Pt,jr as Q,M as Qt,fi as R,He as Rn,ln as Rt,Oi as S,Tt as Sn,Pn as St,ui as T,Dt as Tn,Un as Tt,bi as U,We as Un,Zt as Ut,qr as V,Ie as Vn,Tn as Vt,Jr as W,Le as Wn,nn as Wt,kr as X,on as Xt,yi as Y,Qt as Yt,Pr as Z,_n as Zt,Pi as _,xt as _n,Ln as _t,Qi as a,Kt as an,_r as at,Ni as b,Pt as bn,Wn as bt,ra as c,kn as cn,gr as ct,Hi as d,It as dn,sr as dt,Wt as en,Nr as et,Bi as f,Ct as fn,tr as ft,Vi as g,jt as gn,jn as gt,Li as h,wt as hn,dr as ht,sa as i,bn as in,Dr as it,Gr as j,Ne as jn,Sn as jt,oi as k,Fe as kn,Kn as kt,ia as l,wn as ln,er as lt,zi as m,Et as mn,lr as mt,na as n,sn as nn,Ir as nt,ea as o,vn as on,Or as ot,Ri as p,St as pn,$n as pt,si as q,et as qn,Jt as qt,Ki as r,Cn as rn,Fr as rt,qi as s,en as sn,vr as st,Zi as t,Gt as tn,Mr as tt,Ji as u,Lt as un,cr as ut,Fi as v,kt as vn,Gn as vt,Kr as w,Nt as wn,Nn as wt,Mi as x,At as xn,Vn as xt,Ii as y,Ot as yn,Qn as yt,pi as z,Ye as zn,Dn as zt};
|
|
16
|
+
`)})]})]})]})}function ki(e){return e?e===`npx`||e===`node`?`node`:e===`uvx`||e===`uv`?`uv`:e in Dr?e:null:null}function Ai(){let e=typeof navigator<`u`?navigator.userAgent:``;return/Mac/i.test(e)?`darwin`:/Win/i.test(e)?`win32`:`linux`}function ji({runtime:e,platform:t,notRunning:n}){let r=Dr[e],i=r.steps[hi(t??Ai())];return(0,A.jsxs)(`div`,{className:`rounded-2xl bg-sunken/60 p-4 text-[13.5px]`,children:[(0,A.jsx)(`p`,{className:`font-semibold`,children:n?`Start ${r.name}`:`Install ${r.name}`}),r.why&&(0,A.jsx)(`p`,{className:`mt-0.5 text-muted`,children:r.why}),n?(0,A.jsxs)(`p`,{className:`mt-2 text-muted`,children:[`It is installed but not open. Open `,r.name,`, wait until it says it is running, then check again.`]}):i.length===0?(0,A.jsxs)(`p`,{className:`mt-2 text-muted`,children:[`Install `,r.name,` from its website, then check again.`]}):(0,A.jsx)(`ol`,{className:`mt-2 flex list-decimal flex-col gap-2 pl-5`,children:i.map((e,t)=>(0,A.jsxs)(`li`,{className:`text-muted`,children:[(0,A.jsx)(pe,{text:e.text}),e.copy&&(0,A.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,A.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,A.jsx)(Pr,{text:e.copy,label:`Copy`})]}),e.link&&/^https?:\/\//.test(e.link.url)&&(0,A.jsxs)(`a`,{href:e.link.url,target:`_blank`,rel:`noreferrer noopener`,className:`btn btn-sm btn-secondary mt-1.5 ml-1`,children:[(0,A.jsx)(`span`,{children:e.link.label}),(0,A.jsx)(g,{name:`external`,size:16,strokeWidth:2}),(0,A.jsx)(`span`,{className:`sr-only`,children:`(opens in a new tab)`})]})]},t))})]})}function Mi({missing:e,platform:t,onRecheck:n,checking:r}){if(e.length===0)return null;let i=e.map(e=>Dr[e.runtime].name),a=e.every(e=>e.notRunning);return(0,A.jsx)(u,{tone:`warn`,role:`status`,title:a?`${i.join(` and `)} ${i.length===1?`isn't`:`aren't`} running`:`This server needs ${i.join(` and `)}`,actions:(0,A.jsx)(E,{size:`sm`,icon:`refresh`,onClick:n,loading:r,children:`Check again`}),children:(0,A.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:e.map(e=>(0,A.jsx)(ji,{runtime:e.runtime,platform:t,notRunning:e.notRunning},e.runtime))})})}function Ni({serverUrl:e,secretName:n,name:r,signedIn:i,onSignedIn:o,startNonce:s}){let[c,l]=(0,k.useState)(i?{kind:`done`,provider:r}:{kind:`idle`}),[d,f]=(0,k.useState)(!1),[h,_]=(0,k.useState)(``),[v,y]=(0,k.useState)(``),b=(0,k.useRef)(null),x=()=>{let i=null;try{i=window.open(`about:blank`,`_blank`),i&&(i.opener=null)}catch{i=null}b.current=i,l({kind:`starting`}),o(!1),t.oauthStart({serverUrl:e,secretName:n,label:r,...h.trim()?{clientId:h.trim(),...v?{clientSecret:v}:{}}:{}}).then(e=>{i&&!i.closed&&(i.location.href=e.authorizeUrl),l({kind:`waiting`,state:e.state,url:e.authorizeUrl,provider:e.provider||r,blocked:!i})}).catch(e=>{let t=()=>{try{i&&!i.closed&&i.close()}catch{}};t(),setTimeout(t,50),e instanceof m&&e.code===`no-dynamic-registration`?(f(!0),l({kind:`failed`,text:`${r} needs an app ID before you can sign in. Add one under Advanced below, then sign in again.`})):e instanceof m&&e.status===409?l({kind:`failed`,text:`A saved key already uses the name ${n}. Change the name under More options, then sign in again.`}):l({kind:`failed`,text:Zt(e)})})};return(0,k.useEffect)(()=>{s&&x()},[s]),(0,k.useEffect)(()=>{if(c.kind!==`waiting`)return;let e=!0,n=setInterval(()=>{t.oauthFlow(c.state).then(t=>{e&&(t.status===`done`?(l({kind:`done`,provider:c.provider}),o(!0)):t.status===`failed`?l({kind:`failed`,text:t.problem??`The sign-in didn't finish.`}):t.status===`expired`&&l({kind:`failed`,text:`The sign-in took too long and was stopped. Start it again.`}))}).catch(()=>void 0)},1500);return()=>{e=!1,clearInterval(n)}},[c.kind===`waiting`?c.state:null]),(0,A.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,A.jsx)(`div`,{role:`status`,"aria-live":`polite`,children:c.kind===`done`?(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-[18px] bg-ok-tint p-4`,children:[(0,A.jsx)(g,{name:`check`,size:20,className:`text-ok`,strokeWidth:2.2}),(0,A.jsxs)(`span`,{className:`min-w-0 flex-1 text-[14px] font-medium`,children:[`Signed in with `,c.provider]}),(0,A.jsx)(E,{size:`sm`,variant:`ghost`,onClick:x,children:`Sign in again`})]}):c.kind===`waiting`?(0,A.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-[18px] border border-line p-4`,children:[(0,A.jsxs)(`p`,{className:`flex items-center gap-2.5 text-[14.5px] font-medium`,children:[(0,A.jsx)(_e,{size:18}),` Waiting for you to finish signing in with `,c.provider,`…`]}),(0,A.jsx)(`p`,{className:`text-[13.5px] text-muted`,children:c.blocked?`Your browser stopped the new tab from opening. Open it with the button below.`:`Finish in the ${c.provider} tab that just opened. This page notices by itself when you are done.`}),(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,A.jsxs)(`a`,{href:c.url,target:`_blank`,rel:`noreferrer noopener`,className:`btn btn-sm btn-secondary`,children:[(0,A.jsx)(`span`,{children:`Open the sign-in page`}),(0,A.jsx)(g,{name:`external`,size:16,strokeWidth:2}),(0,A.jsx)(`span`,{className:`sr-only`,children:`(opens in a new tab)`})]}),(0,A.jsx)(E,{size:`sm`,variant:`ghost`,icon:`refresh`,onClick:x,children:`I closed the tab — try again`})]})]}):(0,A.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,A.jsx)(`div`,{children:(0,A.jsxs)(E,{variant:`primary`,icon:`user`,onClick:x,loading:c.kind===`starting`,children:[`Sign in with `,r]})}),(0,A.jsxs)(`p`,{className:`text-[13px] text-soft`,children:[`A new tab opens where you sign in. Your password stays with `,r,`. The sign-in is kept in your locked keys on this computer only.`]})]})}),c.kind===`failed`&&(0,A.jsx)(u,{tone:`danger`,role:`alert`,title:`You're not signed in yet`,children:c.text}),(d||h)&&(0,A.jsxs)(jr,{title:`Advanced: use your own app ID`,defaultOpen:d,children:[(0,A.jsxs)(`p`,{className:`text-[13px] text-soft`,children:[`Some services ask you to register an app first. Make one in `,r,`'s developer settings with the address below as its return address, then paste its ID here.`]}),(0,A.jsx)(`code`,{className:`mono rounded-xl bg-sunken px-3 py-2 text-[12.5px] break-all`,children:`${location.origin}/oauth/callback`}),(0,A.jsx)(a,{label:`App ID`,technical:`client_id`,children:(0,A.jsx)(p,{value:h,onChange:_,mono:!0})}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,A.jsxs)(`label`,{htmlFor:`signin-app-secret`,className:`flex flex-wrap items-baseline gap-x-2 text-[13px] font-semibold`,children:[`App secret `,(0,A.jsx)(`span`,{className:`font-normal text-soft`,children:`optional`}),(0,A.jsx)(`code`,{className:`mono text-[11.5px] font-normal text-soft`,children:`client_secret`})]}),(0,A.jsx)(ce,{id:`signin-app-secret`,value:v,onChange:y,placeholder:`Only if the service gave you one`})]}),(0,A.jsx)(`div`,{children:(0,A.jsx)(E,{size:`sm`,variant:`primary`,icon:`user`,disabled:!h.trim(),onClick:x,children:`Sign in with this app ID`})})]})]})}function Pi(e){return me(()=>t.live(e).catch(()=>null),[e],5e3)}function Fi(e){return me(()=>_.audit(e,{outcome:`error`,limit:`50`,since:new Date(Date.now()-36e5).toISOString()}).then(e=>fr(e.records)).catch(()=>[]),[e],3e4)}function Ii(){return me(()=>t.secrets().catch(()=>null),[],3e4)}function Li(e,t){return e?.upstreams.find(e=>e.name===t)??null}function Ri({live:e,running:t,state:r}){if(!e||!e.running||!t)return(0,A.jsx)(C,{state:`unknown`,label:`Starts when your AI app opens`});if(!r)return(0,A.jsx)(C,{state:`connecting`,label:`Waiting to start`});let i=r.state===`connected`?` · ${n(r.tool_count,`tool`)}`:``;return(0,A.jsx)(C,{state:r.state,label:`${$t[r.state].label}${i}`})}function zi({gatewayId:e,upstream:n,state:r,onEdit:i,onFixed:a,onAllowAddress:o}){let s=xe(),[c,l]=(0,k.useState)(!1),[u,d]=(0,k.useState)(null),[f,p]=(0,k.useState)(!1),m=()=>(l(!0),t.retry(e,n.name).then(()=>{s.show(`ok`,`Trying ${n.name} again.`),a()}).catch(e=>s.show(`bad`,Zt(e))).finally(()=>l(!1))),h=r.problem??(r.state===`needs-sign-in`?{code:`needs-sign-in`,message:`The sign-in ended.`}:{code:`unknown`,message:`No reason was given.`}),g=n.transport===`http`?n.oauth?.secret??h.detail?.secret:void 0;return(0,A.jsxs)(`div`,{className:`w-full`,children:[(0,A.jsx)(Oi,{compact:!0,problem:h,onFix:e=>{switch(e){case`retry`:m();return;case`replace-key`:return h.detail?.secret?d(h.detail.secret):i(e);case`sign-in`:return n.transport===`http`&&g?p(!0):i(e);case`choose-folder`:case`check-address`:return i(e);case`allow-address`:return o();default:return}},fixBusy:c,extra:(0,A.jsx)(E,{size:`sm`,icon:`refresh`,loading:c,onClick:()=>void m(),children:`Try again`})}),r.next_retry_at&&(0,A.jsxs)(`p`,{className:`mt-1.5 pl-1 text-[12.5px] text-soft`,children:[`It tries again by itself `,x(r.next_retry_at),r.attempts>1?` (${r.attempts} tries so far)`:``,`.`]}),(0,A.jsx)(Bi,{secret:u,onClose:()=>d(null),onSaved:()=>{d(null),m()}}),(0,A.jsx)(ye,{open:f,onClose:()=>p(!1),title:`Sign in to ${n.name} again`,width:560,footer:(0,A.jsx)(E,{onClick:()=>p(!1),children:`Close`}),children:n.transport===`http`&&g&&(0,A.jsx)(Ni,{serverUrl:n.url,secretName:g,name:n.name,signedIn:!1,onSignedIn:e=>{e&&(p(!1),m())}})})]})}function Bi({secret:e,onClose:n,onSaved:r}){let[i,a]=(0,k.useState)(``),[o,s]=(0,k.useState)(!1),[c,l]=(0,k.useState)(null);return e?(0,A.jsx)(ye,{open:!0,onClose:n,dismissable:!o,title:`Replace the key`,description:`Paste the new key. The old one is replaced in your locked keys, and the server is tried again straight away.`,footer:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(E,{variant:`secondary`,onClick:n,disabled:o,children:`Cancel`}),(0,A.jsx)(E,{variant:`primary`,icon:`key`,onClick:()=>{s(!0),l(null),t.replaceSecret(e,i).then(()=>{a(``),r()}).catch(e=>l(Zt(e))).finally(()=>s(!1))},loading:o,disabled:!i.trim(),children:`Save new key`})]}),children:(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,A.jsxs)(`label`,{htmlFor:`replace-key-input`,className:`flex flex-wrap items-baseline gap-x-2 text-[13px] font-semibold`,children:[`New key `,(0,A.jsx)(`code`,{className:`mono text-[11.5px] font-normal text-soft`,children:e})]}),(0,A.jsx)(ce,{id:`replace-key-input`,value:i,onChange:a}),c&&(0,A.jsx)(`p`,{role:`alert`,className:`text-[12.5px] font-medium text-bad`,children:c})]})}):null}function Vi(e,t){return e.transport!==`http`||!e.oauth?!1:t?.secrets.find(t=>t.name===e.oauth.secret)?.status===`needs-sign-in`}function Hi({id:e,upstreams:r,digest:i,onMoved:a}){let o=xe(),[s,c]=(0,k.useState)(!1),[l,d]=(0,k.useState)(null),f=r.filter(e=>fn(e));return l?l.length?(0,A.jsxs)(u,{tone:`warn`,title:`Old copies of the keys are still in backup files`,children:[(0,A.jsx)(`p`,{children:`Your toolbox's settings file no longer holds them, but these backups made earlier still do. Delete them, or keep them private:`}),(0,A.jsx)(`ul`,{className:`mt-1 space-y-0.5`,children:l.map(e=>(0,A.jsx)(`li`,{children:(0,A.jsx)(Nr,{children:e})},e))}),(0,A.jsx)(E,{size:`sm`,variant:`ghost`,className:`mt-2`,onClick:()=>d(null),children:`Got it`})]}):null:f.length===0?null:(0,A.jsxs)(u,{tone:`warn`,title:`Keys are written out in your toolbox's settings file`,actions:(0,A.jsx)(E,{size:`sm`,variant:`primary`,icon:`lock`,loading:s,onClick:()=>{c(!0),t.moveSecrets(e,i).then(e=>{o.show(`ok`,`${n(e.moved.length,`key`)} moved to your locked keys.`),d(e.stillIn),a()}).catch(e=>o.show(`bad`,Zt(e))).finally(()=>c(!1))},children:`Move keys to your locked keys`}),children:[f.map(e=>e.name).join(`, `),` `,f.length===1?`has a key`:`have keys`,` written out in your toolbox's settings file, where anyone who can read that file can read`,f.length===1?` it`:` them`,`. Your locked keys are a separate file only you can read.`]})}function Ui({serverId:e,tenant:r,protection:i,status:a,verify:o,changes:s,process:c,connectionsHref:u,loading:d,onChanged:f}){let p=xe(),[m,h]=(0,k.useState)(!1),[v,y]=(0,k.useState)(null),b=me(()=>t.live(e).catch(()=>null),[e],1e4),ee=Fi(e);if(d&&!i&&!a)return(0,A.jsx)(fe,{tone:`hero`,title:`Toolbox status`,children:(0,A.jsxs)(`div`,{className:`space-y-3 opacity-60`,children:[(0,A.jsx)(l,{height:34,width:`60%`}),(0,A.jsx)(l,{lines:3})]})});let S=a?.running??i?.runtime.running??!1,te=(i?.enforcement??a?.enforcement??`enforce`)===`observe`,C=o?o.ok:i?i.audit.verify.ok:null,re=i?!i.audit.enabled:!1,w=s?s.changed.length:null,ie=a?.startedAt??i?.runtime.startedAt??null,T=i?.policyWrite,ae=!S&&c!==null&&!c.externallyRunning;async function oe(){if(T){h(!0),y(null);try{let t=await _.setPolicySetting(e,`enforcement`,`enforce`,T.digest,void 0,r);p.show(`ok`,`The toolbox is protecting now. Blocked calls stop, and some calls wait for you.`),t.warning&&p.show(`warn`,$n(t.warning)),f()}catch(e){y(tr(e)?{text:er,stale:!0}:{text:$n(e.message),stale:!1})}finally{h(!1)}}}let se=[];S&&ie&&se.push({icon:`clock`,text:`On since ${x(ie)}`}),a?.lastCall&&se.push({icon:`activity`,text:`Last call ${x(a.lastCall.ts)}, to ${a.lastCall.tool}`}),a&&a.upstreams.length>0&&se.push({icon:`server`,text:`${n(a.upstreams.length,`server`)} connected`}),S&&a?.policyCurrent===!1&&se.push({icon:`warning`,text:`Has not picked up your latest settings yet`}),a&&a.activeGrants>0&&se.push({icon:`key`,text:`${n(a.activeGrants,`pre-approval`)} active`});let ce=[te?`Watch-only`:`Protecting`,re?`log off`:C===null?null:C?`log intact`:`log damaged`,w===null?null:w===0?`no changed tools`:`${n(w,`changed tool`)}`].filter(Boolean),le=S?`text-on-hero-soft`:`text-soft`;return(0,A.jsxs)(fe,{tone:S?`hero`:`plain`,title:`Toolbox status`,children:[(0,A.jsx)(`p`,{className:`display text-[34px] leading-tight`,children:S?`Running`:`Not running`}),(0,A.jsx)(`p`,{className:`mt-1 text-[13px] ${le}`,children:ce.join(` · `)}),(0,A.jsx)(Wi,{onHero:S,live:b.data,failures:ee.data??[],href:`${u}${u.includes(`?`)?`&`:`?`}manage=${encodeURIComponent(e)}&tab=servers`}),te&&(0,A.jsx)(`p`,{className:`mt-3 text-[13px] leading-snug ${le}`,children:`Every call runs right now. The log notes what would have been blocked or held.`}),!S&&(0,A.jsx)(`p`,{className:`mt-3 text-[13px] leading-snug ${le}`,children:c?.externallyRunning?`Your AI app starts this toolbox. Open the app to bring it back.`:a?.lastCall?`Your AI app isn't running the toolbox right now. It starts again by itself when the app opens it.`:`Your AI app hasn't used the toolbox yet. Quit your AI app completely and open it again, and the toolbox starts by itself.`}),se.length>0&&(0,A.jsx)(`ul`,{className:`mt-4 space-y-1.5 text-[13px]`,children:se.map(e=>(0,A.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(g,{name:e.icon,size:15,className:`shrink-0 ${le}`}),(0,A.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]},e.text))}),v&&(0,A.jsxs)(`div`,{role:`alert`,className:`mt-4 rounded-2xl bg-black/20 px-3 py-2.5 text-[13px]`,children:[v.text,v.stale&&(0,A.jsx)(`button`,{type:`button`,onClick:f,className:`ml-2 font-semibold underline underline-offset-2`,children:`Reload status`})]}),(te||ae)&&(0,A.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[te&&(0,A.jsx)(E,{variant:S?`on-hero`:`secondary`,icon:`shield-check`,loading:m,disabled:!T?.ok,title:T?.ok?void 0:T?.why??void 0,onClick:()=>void oe(),children:`Start protecting`}),ae&&(0,A.jsx)(ne,{variant:S?`on-hero`:`secondary`,icon:`plug`,href:u,children:`Open connections`})]}),te&&T&&!T.ok&&T.why&&(0,A.jsx)(`p`,{className:`mt-2 text-[12px] ${le}`,children:$n(T.why)})]})}function Wi({live:e,failures:t,href:n,onHero:r}){let i=nn(e?.upstreams??[],e?.running??!1,t)??(t[0]?nn([],!1,t):null);if(!i)return null;let a=i.failing,o=r?`text-on-hero-soft`:`text-soft`,s=a?.error&&rn(a.error)?`Replace the key for ${i.fix}`:`Fix ${i.fix}`,c=s.startsWith(`Replace the key`)&&a?`${n}&key=${encodeURIComponent(a.server)}`:n;return(0,A.jsxs)(`div`,{role:`status`,className:`mt-3 min-w-0 text-[13.5px]`,children:[(0,A.jsxs)(`p`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-1`,children:[(0,A.jsxs)(`span`,{className:`min-w-0 font-medium [overflow-wrap:anywhere]`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:`mr-2 inline-block h-2.5 w-2.5 shrink-0 rounded-full align-[-1px]`,style:{background:i.tone===`ok`?`var(--mark-allow)`:i.tone===`bad`?`var(--mark-deny)`:`var(--mark-approve)`}}),i.text]}),i.fix&&(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:o,children:`—`}),(0,A.jsx)(`a`,{href:c,onClick:v,className:`font-semibold underline underline-offset-2`,children:s})]})]}),a?.error&&(0,A.jsxs)(`div`,{className:`mt-1 text-[12.5px] ${o}`,children:[(0,A.jsx)(`p`,{children:an(a.server,a.error)}),(0,A.jsxs)(`details`,{className:`mt-0.5`,children:[(0,A.jsx)(`summary`,{className:`cursor-pointer select-none`,children:`Technical details`}),(0,A.jsx)(`p`,{className:`mono mt-1 text-[11.5px] [overflow-wrap:anywhere]`,children:$n(a.error).slice(0,400)})]})]})]})}var Gi=`defaults.on_unclassified`,Ki=e=>e.ruleId===Gi;function qi(e){let t=e.indexOf(`__`),n=t>0?e.slice(0,t):null,r=(t>0?e.slice(t+2):e).replace(/[_\-.]+/g,` `).trim();return r?{label:r[0].toUpperCase()+r.slice(1),server:n}:{label:e,server:n}}function Ji(e){return Ki(e)?`Nobody has said what this tool does yet, so its calls wait for you.`:e.violations.length>0?`It reaches past what this tool may do on its own, so it waits for your OK.`:e.ruleId?.startsWith(`tenant.`)?`The account on this call needs checking.`:e.effect===`destructive`?`This deletes or overwrites something, so it asks you first.`:e.effect===`write`&&(e.ruleId===`defaults.mode`||e.ruleId?.startsWith(`pack-`))?`This changes something, and while protection is on every change asks you first.`:e.ruleId?`Your protection settings say this tool asks you first.`:ea(e.reason)}var Yi=[`path`,`file`,`filename`,`file_path`,`url`,`uri`,`repo`,`repository`,`name`,`title`,`query`];function Xi(e){let t=e.length>120?`${e.slice(0,117)}…`:e,n=/^(.*)[/\\]([^/\\]+)[/\\]?$/.exec(e);return n&&/^([/~]|[a-zA-Z]:[/\\])/.test(e)&&n[1]?`“${n[2]}” in ${n[1]}`:`“${t}”`}function Zi(e){let t=qi(e.tool).label.toLowerCase(),n=e.args&&typeof e.args==`object`&&!Array.isArray(e.args)?e.args:{},r=e=>typeof n[e]==`string`&&n[e]!==``?n[e]:null,i=r(`source`),a=r(`destination`);if(i&&a)return`Your AI wants to ${t}: from ${Xi(i)} to ${Xi(a)}.`;for(let e of Yi){let n=r(e);if(n)return`Your AI wants to ${t}: ${Xi(n)}.`}for(let e of Object.values(n)){if(!Array.isArray(e))continue;let n=e.map(e=>e&&typeof e==`object`?e.name:void 0).filter(e=>typeof e==`string`);if(n.length>0)return`Your AI wants to ${t}: ${n.slice(0,3).map(e=>`“${e}”`).join(`, `)}${n.length>3?` and ${n.length-3} more`:``}.`}return`Your AI wants to ${t}.`}function Qi(e,t){let n;if(n=/^(\S+) length (\d+) exceeds the policy maximum of (\d+)$/.exec(e)){let e=Array.isArray($i(t,n[1]))?`items`:`characters`;return`${n[1]} is ${n[2]} ${e} long. The limit is ${n[3]}.`}return(n=/^(\S+)=(.+) exceeds the policy maximum of (.+)$/.exec(e))?`${n[1]} is ${n[2]}, above the limit of ${n[3]}.`:(n=/^(\S+)=(.+) is below the policy minimum of (.+)$/.exec(e))?`${n[1]} is ${n[2]}, below the minimum of ${n[3]}.`:(n=/^(\S+)=(.+) is not one of (.+)$/.exec(e))?`${n[1]} is ${n[2]}, which is not one of the allowed values ${n[3]}.`:(n=/^(\S+) must equal (.+)$/.exec(e))?`${n[1]} must be exactly ${n[2]}.`:(n=/^(\S+) has (\d+) items, exceeding the policy maximum of (\d+)$/.exec(e))?`${n[1]} has ${n[2]} items. The limit is ${n[3]}.`:(n=/^(\S+) is required by policy$/.exec(e))?`${n[1]} is required, and was left out.`:(n=/^(\S+) is bounded by policy but absent/.exec(e))?`${n[1]} was left out, so its limit could not be checked.`:(n=/^(\S+) does not match the required pattern$/.exec(e))?`${n[1]} is not in the required format.`:(n=/^(\S+) matched (\d+) values, exceeding the policy maximum of (\d+)$/.exec(e))?`${n[1]} appears ${n[2]} times. The limit is ${n[3]}.`:(n=/^(\S+) totals (.+) across \d+ values, exceeding the policy maximum of (.+)$/.exec(e))?`${n[1]} adds up to ${n[2]}. The limit is ${n[3]}.`:(n=/unknown_args: \w+, and (.+) (?:is|are) not bounded by it$/.exec(e))?`It sent inputs your rule does not mention: ${n[1].replace(/"/g,``)}.`:ta(e.replace(/the policy (maximum|minimum)/g,`the $1`).replace(/by policy/g,`by your rules`))}function $i(e,t){return e&&typeof e==`object`?e[t]:void 0}function ea(e){return/--classify/.test(e)?`Nobody has said what this tool does yet. Approve this call on its own and choose what the tool does, then remember a later call.`:ta(e.replace(/\s*\((?:[^()]*\bhmcp[\w-]*\s[^()]*)\)/g,``).replace(/`?hmcp(?:-gateway)? [^`.;]*`?/g,`the console`).replace(/\s--[a-z][\w-]*/g,``).replace(/standing grant/g,`pre-approval`).replace(/policy\.yaml/g,`your protection settings`).replace(/\s{2,}/g,` `))}function ta(e){let t=e.trim();if(!t)return t;let n=t[0].toUpperCase()+t.slice(1);return/[.?]$/.test(n)?n:`${n}.`}function na(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n>0?`${n}:${String(r).padStart(2,`0`)}:${i}`:`${r}:${i}`}function ra(e){return new Date(e).toDateString()===new Date().toDateString()?s(e):new Date(e).toLocaleString(void 0,{day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`})}function ia(e=1e3){let[t,n]=(0,k.useState)(Date.now);return(0,k.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var aa=e=>Array.isArray(e)?e.map(e=>String(e)).join(`, `):String(e);function oa(e){let t=[];if(e.const!==void 0&&t.push(`exactly ${String(e.const)}`),e.enum!==void 0&&t.push(`one of ${aa(e.enum)}`),e.min!==void 0&&t.push(`at least ${String(e.min)}`),e.max!==void 0&&t.push(`at most ${String(e.max)}`),e.maxLength!==void 0&&t.push(`up to ${String(e.maxLength)} characters`),e.maxItems!==void 0&&t.push(`up to ${String(e.maxItems)} items`),Array.isArray(e.same_items)){let n=e.same_items.length;t.push(n===0?`an empty list`:`exactly the ${n===1?`item`:`${n} items`} you approved`)}return e.within!==void 0&&t.push(`inside the folder ${String(e.within)}`),e.host!==void 0&&t.push(`only to ${aa(e.host)}`),e.pattern!==void 0&&t.push(`in a set format`),e.sum_max!==void 0&&t.push(`adding up to at most ${String(e.sum_max)}`),e.count_max!==void 0&&t.push(`at most ${String(e.count_max)} times`),e.required===!0&&t.push(`must be sent`),t}function sa(e){return!e||typeof e!=`object`?[]:Object.entries(e).map(([e,t])=>[e,oa(t??{}).join(`, `)]).filter(([,e])=>e!==``)}function ca(){let{serverId:e,tenant:n,nav:r,reload:a}=Lt(),s=r.query.get(`window`),c=zt(s)?s:`24h`,d=Rt.find(e=>e.value===c).phrase,f=me(()=>_.metrics(e,c,n),[e,n,c],3e4),p=me(()=>_.pending(e,n,{limit:50}),[e,n],1e4),m=me(()=>_.protection(e,n),[e,n]),g=me(()=>_.audit(e,{limit:`5`,...n?{tenant:n}:{}}),[e,n]),y=me(()=>t.settings().then(e=>Ie(e).onboarding).catch(()=>null),[]),b=me(()=>_.status(e),[e]),ee=me(()=>_.verify(e),[e]),S=me(()=>xt(e),[e]),te=me(()=>jt(e).catch(()=>null),[e]),C=()=>{for(let e of[f,p,m,g,b,ee,S,te])e.reload();a()},w=f.data,ie=m.data,T=p.data??null,ae=T&&T.length>0?T.reduce((e,t)=>t.createdAt<e.createdAt?t:e):null,ce=ie?.enforcement===`observe`,le=(e,t={})=>i(r,e,t),de=w?.unknownTool??0,pe=w?.refusedTools.find(e=>!rr({tool:e.tool,component:``}))?.tool??null;return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(re,{title:`Home`,subtitle:`What your AI apps did through your toolbox, and anything that needs you.`,actions:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(ne,{href:le(`/approvals`),variant:T&&T.length>0?`primary`:`secondary`,icon:`clock`,children:T&&T.length>0?`Review waiting calls (${T.length})`:`Waiting for you`}),(0,A.jsx)(ne,{href:le(`/safety`),variant:`secondary`,children:`Run safety check`}),(0,A.jsx)(oe,{icon:`refresh`,label:`Refresh this page`,variant:`outline`,onClick:C})]})}),y.data&&Re(y.data)&&(0,A.jsx)(`div`,{className:`mb-4`,children:(0,A.jsx)(u,{tone:`info`,title:`Finish setting up: step ${Me.indexOf(y.data.step)+1} of ${Me.length}, ${Ne[y.data.step]}`,actions:(0,A.jsx)(ne,{href:`/start`,size:`sm`,variant:`primary`,iconRight:`arrow-right`,children:`Continue the guide`}),children:`The guide picks up where you left off.`})}),ie&&(0,A.jsx)(`section`,{"aria-label":`Protection`,className:`mb-5`,children:ce?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`h2`,{className:`display text-[26px] leading-tight`,children:`Only watching`}),(0,A.jsxs)(`p`,{className:`mt-1 max-w-3xl text-[14.5px] text-muted`,children:[`Everything your AI does runs and is written down. Nothing asks you first and nothing is blocked.`,` `,(0,A.jsx)(`a`,{href:le(`/protection`),onClick:v,className:`font-semibold underline underline-offset-2`,children:`Turn protection on`})]})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`h2`,{className:`display text-[26px] leading-tight`,children:b.data?.running??ie.runtime.running?`You're protected`:`Protection is on`}),(0,A.jsxs)(`p`,{className:`mt-1 max-w-3xl text-[14.5px] text-muted`,children:[!(b.data?.running??ie.runtime.running)&&`It starts when your AI app opens the toolbox. `,`Reading runs freely, every change asks you first, and anything outside the folders and services you gave it is blocked.`]})]})}),w&&!w.auditing&&(0,A.jsx)(`div`,{className:`mb-4`,children:(0,A.jsx)(u,{tone:`warn`,title:`The activity log is turned off`,actions:(0,A.jsx)(ne,{href:le(`/protection`),size:`sm`,children:`Open protection settings`}),children:`Nothing is being recorded, so the counts below stay at zero whatever your AI app does.`})}),(0,A.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4`,children:[(0,A.jsx)(ue,{tone:`hero`,title:`Allowed`,value:w?D(w.decisions.allow):`–`,loading:f.loading&&!w,sub:f.error?`Could not be counted`:ce?`ran ${d}, in watch-only mode`:`ran ${d}`,href:le(`/activity`,{decision:`allow`}),hrefLabel:`See allowed calls`}),(0,A.jsx)(ue,{title:`Waiting for you`,value:T?D(T.length):`–`,loading:p.loading&&!T,sub:p.error?`Could not be loaded`:ae?`Oldest ${x(ae.createdAt)}`:`Nothing is waiting`,href:le(`/approvals`),hrefLabel:`Review waiting calls`}),(0,A.jsx)(ue,{title:`Blocked`,value:w?D(w.decisions.deny):`–`,loading:f.loading&&!w,sub:f.error?`Could not be counted`:`${ce?`would have been blocked ${d}`:w&&pe?`${d}, most often ${pe}`:d}${de>0?`. Not counted: ${D(de)} asked for a tool that doesn't exist`:``}`,href:le(`/activity`,{decision:`deny`}),hrefLabel:`See blocked calls`}),(0,A.jsx)(ua,{protection:ie,loading:m.loading,error:m.error,href:le(`/tools`)})]}),(0,A.jsxs)(`div`,{className:`mt-4 grid grid-cols-1 gap-4 lg:grid-cols-2 xl:grid-cols-4`,children:[(0,A.jsx)(fe,{title:`Activity`,className:`lg:col-span-2`,actions:(0,A.jsx)(h,{size:`sm`,label:`Time window`,value:c,onChange:e=>ve(o(r,{window:e===`24h`?null:e})),options:Rt.map(e=>({value:e.value,label:e.label}))}),children:f.error&&!w?(0,A.jsx)(u,{tone:`danger`,title:`The activity could not be counted`,actions:(0,A.jsx)(E,{size:`sm`,onClick:f.reload,children:`Try again`}),children:$n(f.error)}):w?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`relative overflow-x-clip`,children:(0,A.jsx)(se,{data:Bt(w,c),label:`Calls ${d}`,height:230})}),(0,A.jsx)(la,{}),!w.coverage.complete&&(0,A.jsxs)(`p`,{className:`mt-2 text-[12px] text-soft`,children:[`Counted from the latest `,D(w.coverage.records),` log entries; older calls in this window are not included.`]})]}):(0,A.jsx)(l,{height:228})}),(0,A.jsx)(N,{oldest:ae,count:T?.length??null,loading:p.loading,error:p.error,retry:p.reload,href:le(`/approvals`)}),(0,A.jsx)(fa,{protection:ie,changed:S.data?.changed.map(e=>e.tool)??[],loading:m.loading,error:m.error,retry:m.reload,nav:r}),(0,A.jsx)(pa,{records:g.data?.records??null,loading:g.loading,error:g.error,retry:g.reload,href:le(`/activity`)}),(0,A.jsx)(ma,{protection:ie,loading:m.loading,error:m.error,retry:m.reload}),(0,A.jsx)(Ui,{serverId:e,tenant:n,protection:ie,status:b.data,verify:ee.data,changes:S.data,process:te.data,connectionsHref:i(r,`/connections`),loading:m.loading||b.loading,onChanged:()=>{m.reload(),b.reload(),a()}})]})]})}function la(){return(0,A.jsx)(`p`,{className:`mt-3 flex flex-wrap gap-x-5 gap-y-1 text-[12.5px] text-muted`,"aria-hidden":!0,children:[{key:`allow`,label:`Ran freely`},{key:`approve`,label:`Asked you`},{key:`deny`,label:`Blocked`}].map(e=>(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,A.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 rounded-full`,style:{background:`var(--mark-${e.key})`}}),e.label]},e.key))})}function ua({protection:e,loading:t,error:n,href:r}){let i=e?.surface,a=i&&!i.neverPublished;return(0,A.jsx)(ue,{title:`Tools protected`,value:a?D(i.toolCount):`–`,loading:t&&!e,sub:n?`Could not be loaded`:i?i.neverPublished?`Not known until the toolbox runs`:i.unclassifiedCount>0?`${D(i.unclassifiedCount)} not labelled yet`:i.stale?`List may be out of date`:`All labelled`:void 0,href:r,hrefLabel:`See all tools`})}function N({oldest:e,count:t,loading:n,error:r,retry:i,href:a}){return(0,A.jsx)(fe,{title:`Waiting for you`,children:r&&t===null?(0,A.jsx)(u,{tone:`danger`,title:`The waiting calls could not be loaded`,actions:(0,A.jsx)(E,{size:`sm`,onClick:i,children:`Try again`}),children:$n(r)}):t===null&&n?(0,A.jsx)(l,{lines:4}):e?(0,A.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,A.jsx)(`p`,{className:`text-[13px] text-soft`,children:t&&t>1?`Oldest of ${t}`:`One call`}),(0,A.jsx)(`p`,{className:`display mt-1 text-[22px] leading-tight text-ok`,children:`Your AI app wants to`}),(0,A.jsxs)(`p`,{className:`mt-1 text-[16px] font-medium break-words text-ink`,children:[qi(e.tool).label.toLowerCase(),qi(e.tool).server&&(0,A.jsxs)(`span`,{className:`text-[13px] font-normal text-soft`,children:[` · `,qi(e.tool).server]})]}),(0,A.jsxs)(`p`,{className:`mt-2 text-[13.5px] text-muted`,children:[`Waiting `,x(e.createdAt).replace(` ago`,``)]}),(0,A.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[13px] text-soft`,children:Ji(e)}),(0,A.jsx)(`div`,{className:`mt-5`,children:(0,A.jsx)(ne,{href:a,variant:`primary`,size:`lg`,icon:`arrow-right`,className:`w-full justify-center`,children:`Review now`})})]}):(0,A.jsx)(b,{icon:`check`,title:`Nothing is waiting for you`,compact:!0,children:`When a call needs your approval it shows up here.`})})}function P(e,t){let n=e=>(t.has(e.name)?0:8)+(e.exposure.disabled?0:4)+(e.effect===null?0:2);return[...e].sort((e,t)=>n(e)-n(t)||e.name.localeCompare(t.name)).slice(0,5)}var da={read:`ok`,write:`warn`,destructive:`bad`};function fa({protection:t,changed:n,loading:r,error:a,retry:o,nav:s}){let c=(0,k.useMemo)(()=>new Set(n),[n]),d=t?P(t.tools,c):[];return(0,A.jsx)(fe,{title:`Tools`,actions:(0,A.jsx)(ne,{href:i(s,`/tools`),size:`sm`,variant:`secondary`,children:`See all tools`}),children:a&&!t?(0,A.jsx)(u,{tone:`danger`,title:`The tools could not be loaded`,actions:(0,A.jsx)(E,{size:`sm`,onClick:o,children:`Try again`}),children:$n(a)}):!t&&r?(0,A.jsx)(l,{lines:5,height:18}):d.length===0?(0,A.jsx)(b,{icon:`tool`,title:`No tools listed yet`,compact:!0,children:t?.surface.neverPublished?`The tool list appears once your AI app has started the toolbox.`:`This toolbox has no tools.`}):(0,A.jsx)(`div`,{className:`-my-1`,children:d.map(t=>{let n=c.has(t.name)?`Changed`:t.exposure.disabled?`Turned off`:null,r=da[t.effect??``]??`neutral`;return(0,A.jsx)(ee,{href:i(s,`/tools`,{tool:t.name}),leading:(0,A.jsx)(`span`,{className:`grid h-10 w-10 shrink-0 place-items-center rounded-full ${r===`ok`?`bg-ok-tint`:r===`warn`?`bg-warn-tint`:r===`bad`?`bg-bad-tint`:`bg-sunken`}`,children:(0,A.jsx)(te,{effect:t.effect})}),title:(0,A.jsx)(`span`,{className:`text-[13.5px] break-words`,title:t.name,children:ha(t.name)}),sub:(0,A.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-1.5`,children:[ga(t.name)&&(0,A.jsx)(`span`,{className:`text-[12px] text-soft`,children:ga(t.name)}),t.exposure.disabled?(0,A.jsx)(e,{tone:`bad`,icon:`power`,children:`Turned off`}):(0,A.jsx)(ie,{decision:t.verdict.kind}),n===`Changed`&&(0,A.jsx)(e,{tone:`warn`,icon:`warning`,children:`Changed`})]})},t.name)})})})}function pa({records:t,loading:n,error:r,retry:i,href:a}){return(0,A.jsx)(fe,{title:`Recent activity`,className:`lg:col-span-2`,actions:(0,A.jsx)(ne,{href:a,size:`sm`,variant:`secondary`,children:`See all activity`}),children:r&&!t?(0,A.jsx)(u,{tone:`danger`,title:`The activity log could not be read`,actions:(0,A.jsx)(E,{size:`sm`,onClick:i,children:`Try again`}),children:$n(r)}):!t&&n?(0,A.jsx)(l,{lines:5,height:18}):!t||t.length===0?(0,A.jsx)(b,{icon:`activity`,title:`No activity yet`,compact:!0,children:`Calls your AI app makes through your toolbox are listed here.`}):(0,A.jsx)(`div`,{className:`-my-1`,children:t.map(t=>{let n=ar(t),r=or(t.actor,t.component);return(0,A.jsx)(ee,{icon:t.actor===`gateway`?`shield`:t.component===`hmcp-web`?`user`:`activity`,iconTone:n.outcome.tone===`bad`?`bad`:n.outcome.tone===`warn`?`warn`:`neutral`,title:r,wrapSub:!0,sub:(0,A.jsxs)(A.Fragment,{children:[n.verb,n.tool&&(0,A.jsxs)(A.Fragment,{children:[` `,(0,A.jsx)(`span`,{className:`text-ink`,title:n.tool,children:qi(n.tool).label.toLowerCase()})]}),(0,A.jsxs)(`span`,{className:`text-soft`,children:[` · `,x(t.ts)]})]}),trailing:(0,A.jsx)(e,{tone:n.outcome.tone,children:n.outcome.label})},`${t.seq}-${t.id}`)})})})}function ma({protection:e,loading:t,error:n,retry:r}){let i=(0,k.useMemo)(()=>{let t={allow:0,approve:0,deny:0,unlabelled:0};for(let n of e?.tools??[])n.effect===null&&!n.exposure.disabled?t.unlabelled++:t[n.verdict.kind]++;return t},[e]),a=i.allow+i.approve+i.deny+i.unlabelled;return(0,A.jsx)(fe,{title:`How your tools are set`,children:n&&!e?(0,A.jsx)(u,{tone:`danger`,title:`The tool settings could not be loaded`,actions:(0,A.jsx)(E,{size:`sm`,onClick:r,children:`Try again`}),children:$n(n)}):!e&&t?(0,A.jsx)(l,{height:200}):a===0?(0,A.jsx)(b,{icon:`sliders`,title:`No tools to show`,compact:!0,children:`Once the toolbox lists its tools, this shows how many run freely, ask you first or are blocked.`}):(0,A.jsx)(ae,{label:`${i.allow} tools run freely, ${i.approve} ask you first, ${i.deny} are blocked, ${i.unlabelled} not labelled yet.`,center:String(i.allow),caption:`of ${a} run freely`,segments:[{label:`Runs freely`,value:i.allow,mark:`allow`},{label:`Asks you first`,value:i.approve,mark:`approve`},{label:`Blocked`,value:i.deny,mark:`deny`},...i.unlabelled>0?[{label:`Not labelled`,value:i.unlabelled,mark:`unclassified`}]:[]]})})}function ha(e){let t=e.indexOf(`__`);return t>0?e.slice(t+2):e}function ga(e){let t=e.indexOf(`__`);return t>0?e.slice(0,t):null}var _a=`modulepreload`,va=function(e){return`/`+e},ya={},ba=function(e){return e.pathname.endsWith(`.css`)},xa=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=va(t,n);let r=s(t);if(r.href in ya)return;ya[r.href]=!0;let i=ba(r);if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let o=document.createElement(`link`);if(o.rel=i?`stylesheet`:_a,i||(o.as=`script`),o.crossOrigin=``,o.href=r.href,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),i)return new Promise((e,t)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${r}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Sa=(0,k.lazy)(()=>xa(()=>import(`./Activity-Dgo5oK2r.js`).then(e=>({default:e.ActivityPage})),__vite__mapDeps([0,1]))),Ca=(0,k.lazy)(()=>xa(()=>import(`./Approvals-C5_8rBkL.js`).then(e=>({default:e.ApprovalsPage})),__vite__mapDeps([2,1]))),wa=(0,k.lazy)(()=>xa(()=>import(`./Connections-BHsXRdYI.js`).then(e=>({default:e.ConnectionsPage})),__vite__mapDeps([3,1,4]))),Ta=(0,k.lazy)(()=>xa(()=>import(`./PreApprovals-CXcU-_ug.js`).then(e=>({default:e.PreApprovalsPage})),__vite__mapDeps([5,1]))),Ea=(0,k.lazy)(()=>xa(()=>import(`./Protection-BF5OlzGC.js`).then(e=>({default:e.ProtectionPage})),__vite__mapDeps([6,1]))),Da=(0,k.lazy)(()=>xa(()=>import(`./Safety-DVb8sdbt.js`).then(e=>({default:e.SafetyPage})),__vite__mapDeps([7,1]))),Oa=(0,k.lazy)(()=>xa(()=>import(`./Settings-XjNZ-wo-.js`).then(e=>({default:e.SettingsPage})),__vite__mapDeps([8,1]))),ka=(0,k.lazy)(()=>xa(()=>import(`./Suggestions-HZyd0jDU.js`).then(e=>({default:e.SuggestionsPage})),__vite__mapDeps([9,1]))),Aa=(0,k.lazy)(()=>xa(()=>import(`./Tools-GMaKxxIG.js`).then(e=>({default:e.ToolsPage})),__vite__mapDeps([10,1]))),F=[{path:`/`,title:`Home`,icon:`home`,section:`menu`,page:ca,scoped:!0},{path:`/approvals`,title:`Waiting for you`,icon:`clock`,section:`menu`,page:Ca,scoped:!0,badge:`pending`},{path:`/tools`,title:`Tools`,icon:`tool`,section:`menu`,page:Aa,scoped:!0},{path:`/activity`,title:`Activity`,icon:`activity`,section:`menu`,page:Sa,scoped:!0},{path:`/safety`,title:`Safety check`,icon:`shield-check`,section:`menu`,page:Da,scoped:!0,badge:`high`},{path:`/pre-approvals`,title:`Pre-approvals`,icon:`key`,section:`setup`,page:Ta,scoped:!0},{path:`/suggestions`,title:`Suggestions`,icon:`lightbulb`,section:`setup`,page:ka,scoped:!0},{path:`/protection`,title:`Protection settings`,icon:`sliders`,section:`setup`,page:Ea,scoped:!0},{path:`/connections`,title:`Connections`,icon:`plug`,section:`setup`,page:wa,scoped:!1},{path:`/settings`,title:`Settings & help`,icon:`settings`,section:`setup`,page:Oa,scoped:!1}],ja={"/functions":`/tools`,"/audit":`/activity`,"/findings":`/safety`,"/policy":`/protection`,"/servers":`/connections`,"/overview":`/`};function Ma(e){let t=e.length>1?e.replace(/\/+$/,``):e;return F.find(e=>e.path===t)??F[0]}function Na(){dispatchEvent(new CustomEvent(`hmcp:palette`))}function Pa({nav:e,servers:t,active:n,tenant:a}){let[s,c]=(0,k.useState)(!1),[l,u]=(0,k.useState)(``),[d,f]=(0,k.useState)(0),[p,m]=(0,k.useState)(null),h=(0,k.useRef)(null),v=(0,k.useId)();r(h,s,()=>c(!1)),(0,k.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),c(e=>!e))},t=()=>c(!0);return addEventListener(`keydown`,e),addEventListener(`hmcp:palette`,t),()=>{removeEventListener(`keydown`,e),removeEventListener(`hmcp:palette`,t)}},[]),(0,k.useEffect)(()=>m(null),[n?.id,a]),(0,k.useEffect)(()=>{if(!s||p!==null||!n)return;let e=!0;return _.tools(n.id,a).then(t=>e&&m(t),()=>e&&m([])),()=>{e=!1}},[s,p,n?.id,a]),(0,k.useEffect)(()=>{s||u(``)},[s]);let y=(0,k.useMemo)(()=>{let r=F.map(t=>({key:`p:${t.path}`,label:t.title,hint:`Page`,icon:t.icon,href:i(e,t.path)}));for(let t of p??[])r.push({key:`t:${t.name}`,label:t.name,hint:`Tool`,icon:`tool`,href:i(e,`/tools`,{tool:t.name}),sub:he[t.verdict.kind]?.label});for(let i of t)i.id!==n?.id&&r.push({key:`g:${i.id}`,label:i.label,hint:`Toolbox`,icon:`server`,href:o(e,{server:i.id,tenant:null})});return r},[e,p,t,n?.id]),b=l.trim().toLowerCase(),x=(b?y.filter(e=>e.label.toLowerCase().includes(b)):y).slice(0,14);if((0,k.useEffect)(()=>f(0),[b,s]),!s)return null;let ee=e=>{c(!1),be(e)},S=e=>`${v}-o${e}`;return(0,gt.createPortal)((0,A.jsxs)(`div`,{className:`fixed inset-0 z-[70] flex items-start justify-center px-3 pt-[12vh]`,children:[(0,A.jsx)(`div`,{className:`anim-overlay absolute inset-0 bg-[var(--scrim)]`,onClick:()=>c(!1),"aria-hidden":!0}),(0,A.jsxs)(`div`,{ref:h,role:`dialog`,"aria-modal":`true`,"aria-label":`Search pages and tools`,className:`anim-dialog relative w-full max-w-[560px] overflow-hidden rounded-[22px] bg-surface shadow-[var(--shadow-lg)]`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-faint px-5 py-4`,children:[(0,A.jsx)(g,{name:`search`,size:20,className:`shrink-0 text-muted`}),(0,A.jsx)(`input`,{autoFocus:!0,value:l,onChange:e=>u(e.target.value),placeholder:`Search pages and tools`,role:`combobox`,"aria-label":`Search pages and tools`,"aria-expanded":`true`,"aria-controls":v,"aria-activedescendant":x[d]?S(d):void 0,"aria-autocomplete":`list`,onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),f(e=>Math.min(e+1,x.length-1))):e.key===`ArrowUp`?(e.preventDefault(),f(e=>Math.max(e-1,0))):e.key===`Enter`&&x[d]&&ee(x[d].href)},className:`min-w-0 flex-1 bg-transparent text-[16px] outline-none placeholder:text-soft`}),(0,A.jsx)(`kbd`,{className:`rounded-md bg-sunken px-1.5 py-0.5 font-sans text-[11.5px] font-semibold text-muted`,children:`Esc`})]}),x.length===0?(0,A.jsxs)(`p`,{className:`px-5 py-8 text-center text-[14px] text-soft`,children:[`Nothing matches “`,l,`”.`]}):(0,A.jsxs)(`ul`,{id:v,role:`listbox`,"aria-label":`Results`,className:`scrollbar-thin max-h-[min(420px,55vh)] overflow-y-auto p-2`,children:[x.map((e,t)=>(0,A.jsxs)(`li`,{id:S(t),role:`option`,"aria-selected":t===d,onMouseEnter:()=>f(t),onClick:()=>ee(e.href),className:Se(`flex cursor-pointer items-center gap-3 rounded-xl px-3 py-2.5`,t===d&&`bg-faint`),children:[(0,A.jsx)(`span`,{className:`grid h-8 w-8 shrink-0 place-items-center rounded-full bg-sunken text-muted`,children:(0,A.jsx)(g,{name:e.icon,size:16})}),(0,A.jsx)(`span`,{className:Se(`min-w-0 flex-1 truncate text-[14px] font-medium`,e.hint===`Tool`&&`font-mono text-[13px]`),children:e.label}),e.sub&&(0,A.jsx)(`span`,{className:`shrink-0 text-[12px] text-soft max-sm:hidden`,children:e.sub}),(0,A.jsx)(`span`,{className:`shrink-0 text-[12px] font-semibold text-soft`,children:e.hint})]},e.key)),n&&p===null&&(0,A.jsx)(`li`,{className:`px-3 py-2 text-[12.5px] text-soft`,children:`Loading tools…`})]})]})]}),document.body)}var Fa=(0,k.lazy)(()=>xa(()=>import(`./Gallery-DB_OO7Vw.js`).then(e=>({default:e.Gallery})),__vite__mapDeps([11,1])));function I(){let e=y(),t=ja[e.path];(0,k.useEffect)(()=>{t&&ve(i(e,t,Object.fromEntries(e.query),[]))},[t,e]);let n=me(()=>_.servers(),[],3e4),r=n.data??[],a=r.filter(e=>e.ok),s=e.query.get(`server`),c=a.find(e=>e.id===s)??a[0]??null;(0,k.useEffect)(()=>{c&&s!==c.id&&ve(o(e,{server:c.id}))},[c?.id,s,e.path]);let l=me(()=>c?_.tenants(c.id):Promise.resolve(null),[c?.id]),d=e.query.get(`tenant`)??l.data?.assumed??null,f=!!l.data?.configured&&d===null,p=me(()=>c&&!f?_.pending(c.id,d).then(e=>e.length):Promise.resolve(null),[c?.id,d,f],1e4),m=me(()=>c&&!f?_.scan(c.id,d).then(e=>e.findings.filter(e=>e.severity===`high`).length):Promise.resolve(null),[c?.id,d,f],6e4),h=Ma(e.path),g=e.path===`/_kit`,b={server:c,serverId:c?.id??null,servers:r,tenant:d,tenantInfo:l.data??null,reload:()=>{n.reload(),p.reload(),m.reload()},pendingCount:p.error?null:p.data,highFindings:m.error?null:m.data,nav:e},[x,ee]=(0,k.useState)(!1);(0,k.useEffect)(()=>ee(!1),[e.path]),(0,k.useEffect)(()=>{document.title=`${g?`Kit`:h.title} · hardened-mcp`},[h.title,g]);let S=h.page,te=n.loading&&n.data===null;return(0,A.jsxs)(Ft.Provider,{value:b,children:[(0,A.jsxs)(`nav`,{"aria-label":`Skip links`,children:[(0,A.jsx)(`a`,{href:`#main`,className:`sr-only z-[100] rounded-full bg-primary px-4 py-2 font-semibold text-white focus:not-sr-only focus:fixed focus:top-3 focus:left-3`,children:`Skip to content`}),(0,A.jsx)(`a`,{href:`#pages-nav`,onClick:e=>{e.preventDefault(),document.querySelector(`#pages-nav a`)?.focus()},className:`sr-only z-[100] rounded-full bg-primary px-4 py-2 font-semibold text-white focus:not-sr-only focus:fixed focus:top-3 focus:left-3`,children:`Skip to the menu`}),(b.pendingCount??0)>0&&e.path!==`/approvals`&&(0,A.jsxs)(`a`,{href:i(e,`/approvals`),onClick:e=>{v(e),Ga()},className:`sr-only z-[100] rounded-full bg-primary px-4 py-2 font-semibold text-white focus:not-sr-only focus:fixed focus:top-3 focus:left-3`,children:[`Skip to what's waiting for you (`,b.pendingCount,`)`]})]}),(0,A.jsxs)(`div`,{className:`mx-auto flex min-h-dvh max-w-[1680px] gap-4 p-3 lg:gap-5 lg:p-4`,children:[(0,A.jsx)(`aside`,{"aria-label":`Sidebar`,className:`card sticky top-4 hidden h-[calc(100dvh-2rem)] w-[264px] shrink-0 flex-col overflow-hidden rounded-[28px] lg:flex`,children:(0,A.jsx)(Ia,{nav:e,route:g?null:h,pending:b.pendingCount,high:b.highFindings})}),(0,A.jsx)(Ra,{open:x,onClose:()=>ee(!1),children:(0,A.jsx)(Ia,{nav:e,route:g?null:h,pending:b.pendingCount,high:b.highFindings,mobile:!0})}),(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-4 lg:gap-5`,children:[(0,A.jsx)(za,{nav:e,servers:r,active:c,tenants:l.data??null,tenant:d,pending:b.pendingCount,menuOpen:x,onMenu:()=>ee(!0),scoped:h.scoped&&!g}),(0,A.jsx)(`main`,{id:`main`,tabIndex:-1,className:`min-w-0 flex-1 px-1 pb-10 outline-none sm:px-2 lg:px-3`,children:n.error?(0,A.jsx)(u,{tone:`danger`,title:`The console could not load your toolboxes`,role:`alert`,children:n.error}):te?(0,A.jsx)(Wa,{}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Ha,{nav:e,servers:r,active:c,tenantMissing:f,tenants:l.data??null}),g?(0,A.jsx)(k.Suspense,{fallback:(0,A.jsx)(Wa,{}),children:(0,A.jsx)(Fa,{})}):h.scoped&&!c?(0,A.jsx)(Ua,{nav:e}):(0,A.jsx)(k.Suspense,{fallback:(0,A.jsx)(Wa,{}),children:(0,A.jsx)(S,{},h.scoped?`${h.path}|${c?.id??``}|${d??``}`:h.path)})]})})]})]}),(0,A.jsx)(Pa,{nav:e,servers:a,active:c,tenant:f?null:d})]})}function Ia({nav:e,route:t,pending:n,high:r,mobile:a=!1}){let o=e=>F.filter(t=>t.section===e),s=e=>e.badge===`pending`?n??0:e.badge===`high`?r??0:0,c=n=>{let r=s(n);return(0,A.jsx)(`li`,{children:(0,A.jsxs)(`a`,{href:i(e,n.path),onClick:v,"aria-current":t?.path===n.path?`page`:void 0,className:`nav-link`,children:[(0,A.jsx)(g,{name:n.icon,size:21,className:`nav-icon shrink-0`}),(0,A.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.title}),(0,A.jsx)(S,{count:r,label:n.badge===`pending`?`waiting`:`serious findings`})]})},n.path)};return(0,A.jsxs)(`div`,{className:`flex h-full flex-col px-5 pt-7 pb-5`,children:[(0,A.jsxs)(`a`,{href:i(e,`/`),onClick:v,className:`flex items-center gap-3 px-2`,"aria-label":`hardened-mcp home`,children:[(0,A.jsx)(`span`,{className:`grid h-10 w-10 place-items-center rounded-xl bg-[#2a2623] shadow-[var(--shadow-sm)] ring-1 ring-[var(--faint)]`,children:(0,A.jsx)(`img`,{src:`/brand/mark.svg`,alt:``,width:30,height:30})}),(0,A.jsx)(`span`,{className:`text-[19px] font-semibold tracking-[-0.03em]`,children:`hardened-mcp`})]}),(0,A.jsxs)(`nav`,{id:a?void 0:`pages-nav`,"aria-label":`Pages`,className:`scrollbar-thin -mx-2 mt-7 flex min-h-0 flex-1 flex-col overflow-y-auto px-2`,children:[(0,A.jsx)(`p`,{className:`eyebrow px-3 pb-2`,children:`Menu`}),(0,A.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:o(`menu`).map(c)}),(0,A.jsx)(`p`,{className:`eyebrow mt-7 px-3 pb-2`,children:`Setup`}),(0,A.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:o(`setup`).map(c)})]}),(0,A.jsx)(`div`,{className:`shrink-0 pt-5`,children:(0,A.jsx)(La,{nav:e,mobile:a})})]})}function La({nav:e,mobile:t=!1}){let n=(me(()=>at.clients().catch(()=>null),[]).data?.clients??[]).some(e=>e.alreadyAdopted);return(0,A.jsxs)(`section`,{"aria-labelledby":t?void 0:`promo-title`,"aria-label":t?`Connect your AI apps`:void 0,className:`card-hero relative overflow-hidden rounded-[22px] p-4`,children:[(0,A.jsx)(`svg`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 h-full w-full opacity-30`,viewBox:`0 0 220 200`,preserveAspectRatio:`none`,children:(0,A.jsxs)(`g`,{fill:`none`,stroke:`#8fd0ab`,strokeWidth:`1`,children:[(0,A.jsx)(`path`,{d:`M120 0c-10 60 40 90 100 80`}),(0,A.jsx)(`path`,{d:`M100 0c-12 75 50 110 120 98`}),(0,A.jsx)(`path`,{d:`M80 0c-14 90 60 130 140 118`}),(0,A.jsx)(`path`,{d:`M-10 170c60-30 130-10 240 30`}),(0,A.jsx)(`path`,{d:`M-10 186c70-26 140-6 240 26`})]})}),(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(`span`,{className:`grid h-9 w-9 place-items-center rounded-full bg-white text-green-deep [@media(max-height:820px)]:hidden`,children:(0,A.jsx)(g,{name:`plug`,size:18,strokeWidth:2})}),(0,A.jsx)(`h2`,{id:t?void 0:`promo-title`,className:`mt-3 text-[17px] leading-snug font-semibold text-white [@media(max-height:820px)]:mt-0`,children:n?`Using another AI app?`:`Connect your AI apps`}),(0,A.jsx)(`p`,{className:`mt-1 text-[12.5px] leading-snug text-on-hero-soft`,children:n?`Your toolbox works with Claude, Cursor and VS Code too.`:`Let Claude, Cursor or VS Code use your toolbox.`}),(0,A.jsx)(ne,{href:i(e,`/connections`,{connect:`1`}),variant:`on-hero`,size:`sm`,className:`mt-3 w-full`,children:n?`Connect another app`:`Connect an app`})]})]})}function Ra({open:e,onClose:t,children:n}){let i=(0,k.useRef)(null);return r(i,e,t),e?(0,A.jsxs)(`div`,{className:`fixed inset-0 z-50 lg:hidden`,children:[(0,A.jsx)(`div`,{className:`anim-overlay absolute inset-0 bg-[var(--scrim)]`,onClick:t,"aria-hidden":!0}),(0,A.jsxs)(`div`,{ref:i,id:`mobile-menu`,role:`dialog`,"aria-modal":`true`,"aria-label":`Menu`,className:`anim-drawer card absolute inset-y-2 left-2 flex w-[min(300px,calc(100vw-56px))] flex-col overflow-hidden rounded-[24px]`,children:[(0,A.jsx)(oe,{icon:`x`,label:`Close menu`,onClick:t,className:`absolute top-5 right-4 z-10`,size:36}),n]})]}):null}function za({nav:e,servers:t,active:n,tenants:r,tenant:a,pending:o,menuOpen:s,onMenu:c,scoped:l}){let{theme:u,toggle:d}=ht(),f=(0,k.useMemo)(()=>/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),[]);return(0,A.jsxs)(`header`,{className:`card flex items-center gap-2 rounded-[24px] p-2.5 sm:gap-3 sm:p-3`,children:[(0,A.jsx)(oe,{icon:`menu`,label:`Open menu`,onClick:c,"aria-expanded":s,"aria-controls":`mobile-menu`,className:`lg:hidden`,variant:`soft`}),(0,A.jsxs)(`button`,{type:`button`,onClick:Na,"aria-keyshortcuts":`Meta+K Control+K`,className:`flex h-11 min-w-0 flex-1 items-center gap-3 rounded-full bg-sunken/70 px-4 text-left text-[14px] text-soft transition-colors hover:bg-sunken sm:max-w-[400px]`,children:[(0,A.jsx)(g,{name:`search`,size:19,className:`shrink-0 text-muted`}),(0,A.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,A.jsx)(`span`,{className:`sm:hidden`,children:`Search`}),(0,A.jsx)(`span`,{className:`max-sm:hidden`,children:`Search pages and tools`})]}),(0,A.jsx)(`kbd`,{"aria-hidden":!0,className:`hidden shrink-0 rounded-md bg-surface px-1.5 py-0.5 font-sans text-[12px] font-semibold text-muted shadow-[var(--shadow-sm)] sm:inline`,children:f?`⌘K`:`Ctrl K`})]}),(0,A.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,A.jsx)(oe,{icon:u===`dark`?`sun`:`moon`,label:u===`dark`?`Use light theme`:`Use dark theme`,onClick:d,variant:`soft`,className:`max-sm:hidden`}),(0,A.jsx)(oe,{icon:`bell`,label:`Waiting for you`,href:i(e,`/approvals`),variant:`soft`,badge:o??0}),t.length>0&&(0,A.jsx)(Ba,{nav:e,servers:t,active:n}),n&&l&&r?.configured&&(0,A.jsx)(Va,{nav:e,tenants:r,tenant:a})]})]})}function Ba({nav:e,servers:t,active:n}){let r=n?n.enforcement===`observe`?`Watch-only`:n.running?`Protecting`:`Not running`:`No toolbox`,i=n?n.enforcement===`observe`?`bg-bad`:n.running?`bg-allow`:`bg-approve`:`bg-[var(--soft)]`;return(0,A.jsxs)(`label`,{className:`relative flex h-11 max-w-[220px] min-w-0 cursor-pointer items-center gap-2.5 rounded-full border border-faint bg-surface py-1 pr-3 pl-1.5 shadow-[var(--shadow-sm)] transition-colors focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-[var(--focus)] hover:bg-faint`,children:[(0,A.jsx)(`span`,{className:`grid h-8 w-8 shrink-0 place-items-center rounded-full bg-sunken text-muted`,children:(0,A.jsx)(g,{name:`server`,size:17})}),(0,A.jsxs)(`span`,{className:`min-w-0 max-md:hidden`,children:[(0,A.jsx)(`span`,{className:`block truncate text-[13.5px] leading-tight font-semibold`,children:n?.label??`Choose toolbox`}),(0,A.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[12px] leading-tight text-soft`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,className:Se(`h-1.5 w-1.5 rounded-full`,i)}),r]})]}),(0,A.jsx)(g,{name:`chevron`,size:16,className:`shrink-0 text-soft max-md:hidden`}),(0,A.jsxs)(`select`,{"aria-label":`Toolbox`,value:n?.id??``,onChange:t=>be(o(e,{server:t.target.value,tenant:null})),className:`absolute inset-0 cursor-pointer opacity-0`,children:[!n&&(0,A.jsx)(`option`,{value:``,children:`Choose toolbox`}),t.map(e=>(0,A.jsxs)(`option`,{value:e.id,disabled:!e.ok,children:[e.label,e.ok?``:` (cannot load)`]},e.id))]})]})}function Va({nav:e,tenants:t,tenant:n}){let r=t.tenants.filter(e=>e!==``);return(0,A.jsxs)(`label`,{className:Se(`relative flex h-11 max-w-[180px] min-w-0 cursor-pointer items-center gap-2 rounded-full border bg-surface py-1 pr-3 pl-3 shadow-[var(--shadow-sm)] focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-[var(--focus)] hover:bg-faint`,n===null?`border-warn/50`:`border-faint`),title:t.whyNotAssumed??void 0,children:[(0,A.jsx)(g,{name:`users`,size:17,className:`shrink-0 text-muted`}),(0,A.jsxs)(`span`,{className:`min-w-0 max-md:hidden`,children:[(0,A.jsx)(`span`,{className:`block text-[11.5px] leading-tight text-soft`,children:`Customer`}),(0,A.jsx)(`span`,{className:Se(`block truncate text-[13.5px] leading-tight font-semibold`,n===null&&`text-warn`),children:n??`Choose…`})]}),(0,A.jsx)(g,{name:`chevron`,size:16,className:`shrink-0 text-soft max-md:hidden`}),(0,A.jsxs)(`select`,{"aria-label":`Customer`,value:e.query.get(`tenant`)??``,onChange:t=>ve(o(e,{tenant:t.target.value||null})),className:`absolute inset-0 cursor-pointer opacity-0`,children:[(0,A.jsx)(`option`,{value:``,children:t.assumed===null?`Choose a customer`:`${t.assumed} (default)`}),r.map(e=>(0,A.jsx)(`option`,{value:e,children:e},e))]})]})}function Ha({nav:e,servers:t,active:n,tenantMissing:r,tenants:a}){let o=t.filter(e=>!e.ok),s=n?.enforcement===`observe`;return!s&&o.length===0&&!r&&!n?.tenantError?null:(0,A.jsxs)(`div`,{className:`mb-6 flex flex-col gap-3`,children:[s&&(0,A.jsx)(u,{tone:`danger`,role:`alert`,title:`Your toolbox is only watching. Nothing is being blocked or asked.`,actions:(0,A.jsx)(ne,{href:i(e,`/protection`,{focus:`mode`}),variant:`primary`,size:`sm`,icon:`shield`,children:`Start protecting`}),children:`Every call from your AI apps runs, even ones your rules would stop. The log shows what would have happened. Tools you turned off stay off.`}),o.map(t=>(0,A.jsx)(u,{tone:`warn`,title:`“${t.label}” could not be loaded`,actions:(0,A.jsx)(ne,{href:i(e,`/connections`),size:`sm`,children:`Open connections`}),children:t.error},t.id)),r&&(0,A.jsxs)(u,{tone:`info`,title:`Choose a customer to see their data`,children:[`This toolbox keeps each customer’s approvals and settings apart.`,a?.whyNotAssumed?` ${a.whyNotAssumed}`:``,` Pick one with the Customer menu at the top.`]}),n?.tenantError&&!r&&(0,A.jsx)(u,{tone:`warn`,title:`The customer setting could not be read`,children:n.tenantError})]})}function Ua({nav:e}){return(0,A.jsx)(fe,{className:`mx-auto mt-6 max-w-2xl`,children:(0,A.jsx)(b,{icon:`plug`,title:`No toolbox yet`,actions:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(ne,{href:i(e,`/connections`,{connect:`1`}),variant:`primary`,icon:`plug`,children:`Connect an app`}),(0,A.jsx)(ne,{href:i(e,`/connections`,{add:`1`}),icon:`plus`,children:`Add a toolbox`})]}),children:`A toolbox sits between your AI apps and the tools they use, and decides what runs. Connect an app to set one up, or add a toolbox you already run.`})})}function Wa(){return(0,A.jsxs)(`div`,{"aria-busy":`true`,"aria-label":`Loading`,children:[(0,A.jsx)(l,{height:40,width:`280px`}),(0,A.jsx)(`div`,{className:`mt-8 grid gap-4 sm:grid-cols-2 xl:grid-cols-4`,children:[0,1,2,3].map(e=>(0,A.jsx)(`div`,{className:`card h-[184px] p-6`,children:(0,A.jsx)(l,{lines:3})},e))})]})}function Ga(){let e=Date.now(),t=document.querySelector(`#main h1`),n=()=>{let r=document.querySelector(`#main h1`);r&&(r!==t||Date.now()-e>300)?(r.hasAttribute(`tabindex`)||r.setAttribute(`tabindex`,`-1`),r.focus()):Date.now()-e<2e3&&requestAnimationFrame(n)};requestAnimationFrame(n)}var Ka=(0,k.lazy)(()=>xa(()=>import(`./StartPage-D8WBBhDy.js`).then(e=>({default:e.StartPage})),__vite__mapDeps([12,1,4])));function qa(){let[e,t]=(0,k.useState)(null),[n,r]=(0,k.useState)(null);return(0,k.useEffect)(()=>{let e=new URLSearchParams(location.search).get(`t`);e?_.session(e).then(()=>{let e=new URLSearchParams(location.search);e.delete(`t`);let n=e.toString();history.replaceState(null,``,n?`${location.pathname}?${n}`:location.pathname),t(!0)}).catch(e=>{r(e.message),t(!1)}):_.servers().then(()=>t(!0)).catch(e=>{e instanceof m&&e.status===401||r(String(e.message)),t(!1)})},[]),e===null?(0,A.jsx)(Ya,{children:(0,A.jsx)(`p`,{className:`text-soft`,role:`status`,children:`Connecting…`})}):e?(0,A.jsx)(ge,{children:(0,A.jsx)(Ja,{})}):(0,A.jsx)(Ya,{children:(0,A.jsxs)(`div`,{className:`card w-full max-w-md p-8 text-left`,children:[(0,A.jsx)(`span`,{className:`grid h-12 w-12 place-items-center rounded-2xl bg-[#2a2623]`,children:(0,A.jsx)(`img`,{src:`/brand/mark.svg`,alt:``,width:34,height:34})}),(0,A.jsx)(`h1`,{className:`display mt-6 text-[30px]`,children:`Open hardened-mcp again to sign in`}),(0,A.jsx)(`p`,{className:`mt-3 text-[15px] text-muted`,children:`This page can't sign you in by itself, so that no other website can open your console. To get back in:`}),(0,A.jsxs)(`ol`,{className:`mt-3 list-decimal space-y-1.5 pl-5 text-[15px] text-muted`,children:[(0,A.jsx)(`li`,{children:`Open hardened-mcp the same way you did the first time.`}),(0,A.jsx)(`li`,{children:`It opens your console in a new tab, already signed in. You can close this one.`})]}),(0,A.jsx)(`div`,{className:`mt-5 flex flex-wrap items-center gap-3`,children:(0,A.jsx)(E,{variant:`primary`,icon:`refresh`,onClick:()=>location.reload(),children:`I've opened it, check again`})}),(0,A.jsxs)(`details`,{className:`mt-5 text-[13.5px] text-soft`,children:[(0,A.jsx)(`summary`,{className:`cursor-pointer select-none`,children:`I started it in Terminal`}),(0,A.jsxs)(`p`,{className:`mt-2`,children:[`Type the same command again in Terminal, for example `,(0,A.jsx)(`code`,{className:`mono`,children:`npx hardened-mcp`}),`. If hardened-mcp is still running, that works too: it opens a signed-in page for you.`]})]}),n&&(0,A.jsx)(`div`,{className:`mt-5`,children:(0,A.jsx)(u,{tone:`danger`,children:n})})]})})}function Ja(){let e=y(),[n,r]=(0,k.useState)(!1);return(0,k.useEffect)(()=>{n||e.path!==`/`||(r(!0),Promise.all([_.servers(),t.settings()]).then(([e,t])=>{ze(Ie(t).onboarding,e.length)&&ve(`/start`)}).catch(()=>void 0))},[e.path,n]),e.path===`/oauth/callback`?(0,A.jsx)(Ae,{}):e.path===`/start`?(0,A.jsx)(k.Suspense,{fallback:null,children:(0,A.jsx)(Ka,{})}):(0,A.jsx)(I,{})}function Ya({children:e}){return(0,A.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center p-6`,children:e})}pt(),(0,Ee.createRoot)(document.getElementById(`root`)).render((0,A.jsx)(k.StrictMode,{children:(0,A.jsx)(qa,{})}));export{Ar as $,hn as $t,ci as A,Me as An,gn as At,Xr as B,Be as Bn,En as Bt,li as C,Mt as Cn,Fn as Ct,Zr as D,at as Dn,Xn as Dt,ri as E,ht as En,Zn as Et,mi as F,Ue as Fn,qt as Ft,Wr as G,tt as Gn,yn as Gt,gi as H,Ve as Hn,Yt as Ht,$r as I,Ke as In,An as It,Yr as J,dn as Jt,Ur as K,Je as Kn,On as Kt,Ei as L,Qe as Ln,xn as Lt,vi as M,Pe as Mn,Xt as Mt,Br as N,Ze as Nn,$t as Nt,_i as O,Xe as On,Yn as Ot,ni as P,$e as Pn,cn as Pt,jr as Q,M as Qt,fi as R,He as Rn,ln as Rt,Oi as S,Tt as Sn,Pn as St,ui as T,Dt as Tn,Un as Tt,bi as U,We as Un,Zt as Ut,qr as V,Ie as Vn,Tn as Vt,Jr as W,Le as Wn,nn as Wt,kr as X,on as Xt,yi as Y,Qt as Yt,Pr as Z,_n as Zt,Pi as _,xt as _n,Ln as _t,Qi as a,Kt as an,_r as at,Ni as b,Pt as bn,Wn as bt,ra as c,kn as cn,gr as ct,Hi as d,It as dn,sr as dt,Wt as en,Nr as et,Bi as f,Ct as fn,tr as ft,Vi as g,jt as gn,jn as gt,Li as h,wt as hn,dr as ht,sa as i,bn as in,Dr as it,Gr as j,Ne as jn,Sn as jt,oi as k,Fe as kn,Kn as kt,ia as l,wn as ln,er as lt,zi as m,Et as mn,lr as mt,na as n,sn as nn,Ir as nt,ea as o,vn as on,Or as ot,Ri as p,St as pn,$n as pt,si as q,et as qn,Jt as qt,Ki as r,Cn as rn,Fr as rt,qi as s,en as sn,vr as st,Zi as t,Gt as tn,Mr as tt,Ji as u,Lt as un,cr as ut,Fi as v,kt as vn,Gn as vt,Kr as w,Nt as wn,Nn as wt,Mi as x,At as xn,Vn as xt,Ii as y,Ot as yn,Qn as yt,pi as z,Ye as zn,Dn as zt};
|
package/dist-ui/index.html
CHANGED
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
type="font/woff2"
|
|
42
42
|
crossorigin="anonymous"
|
|
43
43
|
/>
|
|
44
|
-
<script type="module" crossorigin src="/assets/index-
|
|
44
|
+
<script type="module" crossorigin src="/assets/index-DbHZ_SUd.js"></script>
|
|
45
45
|
<link rel="modulepreload" crossorigin href="/assets/kit-DRVm92_t.js">
|
|
46
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
46
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CvZ3niHA.css">
|
|
47
47
|
</head>
|
|
48
48
|
<body>
|
|
49
49
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hmcp-web",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "The hardened-mcp review console: what each gateway exposes, and why.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Aditya Das",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"lint:ui": "eslint --config ui/eslint.config.js --max-warnings 0 ui/src"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"hmcp-core": "0.2.
|
|
54
|
-
"hmcp-scanner": "0.2.
|
|
53
|
+
"hmcp-core": "0.2.1",
|
|
54
|
+
"hmcp-scanner": "0.2.1",
|
|
55
55
|
"commander": "^15.0.0",
|
|
56
|
-
"hmcp-gateway": "0.2.
|
|
56
|
+
"hmcp-gateway": "0.2.1",
|
|
57
57
|
"yaml": "^2.7.0",
|
|
58
58
|
"zod": "^4.0.0"
|
|
59
59
|
},
|