coder-config 0.41.6 → 0.41.8
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/lib/constants.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coder-config",
|
|
3
|
-
"version": "0.41.
|
|
3
|
+
"version": "0.41.8",
|
|
4
4
|
"description": "Configuration manager for AI coding tools - Claude Code, Gemini CLI, Codex CLI, Antigravity. Manage MCPs, rules, permissions, memory, and workstreams.",
|
|
5
5
|
"author": "regression.io",
|
|
6
6
|
"main": "config-loader.js",
|
|
@@ -618,7 +618,7 @@ WARNING: This link could potentially be dangerous`)){const v=window.open();if(v)
|
|
|
618
618
|
`});++s<e.length;)s&&n.push({type:"text",value:`
|
|
619
619
|
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
620
620
|
`}),n}function Pw(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Aw(e,t){const n=sz(e,t),s=n.one(e,void 0),o=K$(n),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return o&&u.children.push({type:"text",value:`
|
|
621
|
-
`},o),u}function cz(e,t){return e&&"run"in e?async function(n,s){const o=Aw(n,{file:s,...t});await e.run(o,s)}:function(n,s){return Aw(n,{file:s,...e||t})}}function Tw(e){if(e)throw e}var lm,Rw;function uz(){if(Rw)return lm;Rw=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,o=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},u=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var m=e.call(f,"constructor"),h=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!m&&!h)return!1;var x;for(x in f);return typeof x>"u"||e.call(f,x)},d=function(f,m){n&&m.name==="__proto__"?n(f,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):f[m.name]=m.newValue},l=function(f,m){if(m==="__proto__")if(e.call(f,m)){if(s)return s(f,m).value}else return;return f[m]};return lm=function c(){var f,m,h,x,w,k,_=arguments[0],y=1,v=arguments.length,g=!1;for(typeof _=="boolean"&&(g=_,_=arguments[1]||{},y=2),(_==null||typeof _!="object"&&typeof _!="function")&&(_={});y<v;++y)if(f=arguments[y],f!=null)for(m in f)h=l(_,m),x=l(f,m),_!==x&&(g&&x&&(u(x)||(w=o(x)))?(w?(w=!1,k=h&&o(h)?h:[]):k=h&&u(h)?h:{},d(_,{name:m,newValue:c(g,k,x)})):typeof x<"u"&&d(_,{name:m,newValue:x}));return _},lm}var dz=uz();const cm=vl(dz);function ap(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function hz(){const e=[],t={run:n,use:s};return t;function n(...o){let u=-1;const d=o.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);l(null,...o);function l(c,...f){const m=e[++u];let h=-1;if(c){d(c);return}for(;++h<o.length;)(f[h]===null||f[h]===void 0)&&(f[h]=o[h]);o=f,m?fz(m,l)(...f):d(null,...f)}}function s(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function fz(e,t){let n;return s;function s(...d){const l=e.length>d.length;let c;l&&d.push(o);try{c=e.apply(this,d)}catch(f){const m=f;if(l&&n)throw m;return o(m)}l||(c&&c.then&&typeof c.then=="function"?c.then(u,o):c instanceof Error?o(c):u(c))}function o(d,...l){n||(n=!0,t(d,...l))}function u(d){o(null,d)}}const Xn={basename:mz,dirname:pz,extname:gz,join:xz,sep:"/"};function mz(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');zl(e);let n=0,s=-1,o=e.length,u;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(u){n=o+1;break}}else s<0&&(u=!0,s=o+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let d=-1,l=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(u){n=o+1;break}}else d<0&&(u=!0,d=o+1),l>-1&&(e.codePointAt(o)===t.codePointAt(l--)?l<0&&(s=o):(l=-1,s=d));return n===s?s=d:s<0&&(s=e.length),e.slice(n,s)}function pz(e){if(zl(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function gz(e){zl(e);let t=e.length,n=-1,s=0,o=-1,u=0,d;for(;t--;){const l=e.codePointAt(t);if(l===47){if(d){s=t+1;break}continue}n<0&&(d=!0,n=t+1),l===46?o<0?o=t:u!==1&&(u=1):o>-1&&(u=-1)}return o<0||n<0||u===0||u===1&&o===n-1&&o===s+1?"":e.slice(o,n)}function xz(...e){let t=-1,n;for(;++t<e.length;)zl(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":vz(n)}function vz(e){zl(e);const t=e.codePointAt(0)===47;let n=yz(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function yz(e,t){let n="",s=0,o=-1,u=0,d=-1,l,c;for(;++d<=e.length;){if(d<e.length)l=e.codePointAt(d);else{if(l===47)break;l=47}if(l===47){if(!(o===d-1||u===1))if(o!==d-1&&u===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",s=0):(n=n.slice(0,c),s=n.length-1-n.lastIndexOf("/")),o=d,u=0;continue}}else if(n.length>0){n="",s=0,o=d,u=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(o+1,d):n=e.slice(o+1,d),s=d-o-1;o=d,u=0}else l===46&&u>-1?u++:u=-1}return n}function zl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const bz={cwd:wz};function wz(){return"/"}function lp(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function _z(e){if(typeof e=="string")e=new URL(e);else if(!lp(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Cz(e)}function Cz(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const um=["history","path","basename","stem","extname","dirname"];class SN{constructor(t){let n;t?lp(t)?n={path:t}:typeof t=="string"||Sz(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":bz.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<um.length;){const u=um[s];u in n&&n[u]!==void 0&&n[u]!==null&&(this[u]=u==="history"?[...n[u]]:n[u])}let o;for(o in n)um.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Xn.basename(this.path):void 0}set basename(t){hm(t,"basename"),dm(t,"basename"),this.path=Xn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Xn.dirname(this.path):void 0}set dirname(t){Mw(this.basename,"dirname"),this.path=Xn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Xn.extname(this.path):void 0}set extname(t){if(dm(t,"extname"),Mw(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Xn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){lp(t)&&(t=_z(t)),hm(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Xn.basename(this.path,this.extname):void 0}set stem(t){hm(t,"stem"),dm(t,"stem"),this.path=Xn.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const o=this.message(t,n,s);throw o.fatal=!0,o}info(t,n,s){const o=this.message(t,n,s);return o.fatal=void 0,o}message(t,n,s){const o=new Br(t,n,s);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function dm(e,t){if(e&&e.includes(Xn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Xn.sep+"`")}function hm(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Mw(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Sz(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const kz=(function(e){const s=this.constructor.prototype,o=s[e],u=function(){return o.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),jz={}.hasOwnProperty;class ex extends kz{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=hz()}copy(){const t=new ex;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(cm(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(pm("data",this.frozen),this.namespace[t]=n,this):jz.call(this.namespace,t)&&this.namespace[t]||void 0:t?(pm("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const o=n.call(t,...s);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=uu(t),s=this.parser||this.Parser;return fm("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),fm("process",this.parser||this.Parser),mm("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(u,d){const l=uu(t),c=s.parse(l);s.run(c,l,function(m,h,x){if(m||!h||!x)return f(m);const w=h,k=s.stringify(w,x);Pz(k)?x.value=k:x.result=k,f(m,x)});function f(m,h){m||!h?d(m):u?u(h):n(void 0,h)}}}processSync(t){let n=!1,s;return this.freeze(),fm("processSync",this.parser||this.Parser),mm("processSync",this.compiler||this.Compiler),this.process(t,o),Lw("processSync","process",n),s;function o(u,d){n=!0,Tw(u),s=d}}run(t,n,s){Dw(t),this.freeze();const o=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?u(void 0,s):new Promise(u);function u(d,l){const c=uu(n);o.run(t,c,f);function f(m,h,x){const w=h||t;m?l(m):d?d(w):s(void 0,w,x)}}}runSync(t,n){let s=!1,o;return this.run(t,n,u),Lw("runSync","run",s),o;function u(d,l){Tw(d),o=l,s=!0}}stringify(t,n){this.freeze();const s=uu(n),o=this.compiler||this.Compiler;return mm("stringify",o),Dw(t),o(t,s)}use(t,...n){const s=this.attachers,o=this.namespace;if(pm("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):d(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function u(f){if(typeof f=="function")c(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[m,...h]=f;c(m,h)}else d(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function d(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(f.plugins),f.settings&&(o.settings=cm(!0,o.settings,f.settings))}function l(f){let m=-1;if(f!=null)if(Array.isArray(f))for(;++m<f.length;){const h=f[m];u(h)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function c(f,m){let h=-1,x=-1;for(;++h<s.length;)if(s[h][0]===f){x=h;break}if(x===-1)s.push([f,...m]);else if(m.length>0){let[w,...k]=m;const _=s[x][1];ap(_)&&ap(w)&&(w=cm(!0,_,w)),s[x]=[f,w,...k]}}}}const Nz=new ex().freeze();function fm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function mm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function pm(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Dw(e){if(!ap(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Lw(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function uu(e){return Ez(e)?e:new SN(e)}function Ez(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Pz(e){return typeof e=="string"||Az(e)}function Az(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Tz="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Iw=[],Ow={allowDangerousHtml:!0},Rz=/^(https?|ircs?|mailto|xmpp)$/i,Mz=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Dz(e){const t=Lz(e),n=Iz(e);return Oz(t.runSync(t.parse(n),n),e)}function Lz(e){const t=e.rehypePlugins||Iw,n=e.remarkPlugins||Iw,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ow}:Ow;return Nz().use(m$).use(n).use(cz,s).use(t)}function Iz(e){const t=e.children||"",n=new SN;return typeof t=="string"&&(n.value=t),n}function Oz(e,t){const n=t.allowedElements,s=t.allowElement,o=t.components,u=t.disallowedElements,d=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||Bz;for(const m of Mz)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+Tz+m.id,void 0);return CN(e,f),K8(e,{Fragment:r.Fragment,components:o,ignoreInvalidStyle:!0,jsx:r.jsx,jsxs:r.jsxs,passKeys:!0,passNode:!0});function f(m,h,x){if(m.type==="raw"&&x&&typeof h=="number")return d?x.children.splice(h,1):x.children[h]={type:"text",value:m.value},h;if(m.type==="element"){let w;for(w in im)if(Object.hasOwn(im,w)&&Object.hasOwn(m.properties,w)){const k=m.properties[w],_=im[w];(_===null||_.includes(m.tagName))&&(m.properties[w]=c(String(k||""),w,m))}}if(m.type==="element"){let w=n?!n.includes(m.tagName):u?u.includes(m.tagName):!1;if(!w&&s&&typeof h=="number"&&(w=!s(m,h,x)),w&&x&&typeof h=="number")return l&&m.children?x.children.splice(h,1,...m.children):x.children.splice(h,1),h}}}function Bz(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||s!==-1&&t>s||Rz.test(e.slice(0,t))?e:""}function Fz(){var z,K;const[e,t]=S.useState(null),[n,s]=S.useState(""),[o,u]=S.useState({open:!1,field:null,type:"directory"}),[d,l]=S.useState(!0),[c,f]=S.useState(!1),[m,h]=S.useState(null),[x,w]=S.useState(!1),[k,_]=S.useState(null),[y,v]=S.useState([]),[g,b]=S.useState({open:!1,content:"",loading:!1});S.useEffect(()=>{I(),j(),E()},[]);const j=async()=>{try{const G=await ye.checkVersion();h(G)}catch(G){console.error("Failed to load version info:",G)}},E=async()=>{try{const G=await ye.getProject();_(G.dir),A(G.dir)}catch(G){console.error("Failed to load project info:",G)}},A=async G=>{if(G)try{const U=await ye.getHiddenSubprojects(G);v(U.hidden||[])}catch(U){console.error("Failed to load hidden sub-projects:",U)}},P=async G=>{if(k)try{const U=await ye.unhideSubproject(k,G);U.success?(ee.success("Sub-project unhidden"),A(k)):ee.error(U.error||"Failed to unhide")}catch(U){ee.error("Failed to unhide: "+U.message)}},N=async()=>{if(!(m!=null&&m.updateAvailable)){ee.error("No update available");return}w(!0);try{const G=await ye.performUpdate({updateMethod:m.updateMethod,sourcePath:m.sourcePath});G.success?(G.updateMethod==="npm"?ee.success("Updated via npm! Run: coder-config ui stop && coder-config ui"):ee.success("Updated! Run: coder-config ui stop && coder-config ui"),j()):ee.error("Update failed: "+G.error)}catch(G){ee.error("Update failed: "+G.message)}finally{w(!1)}},R=async()=>{b(G=>({...G,open:!0,loading:!0}));try{const G=await ye.getChangelog();G.success?b(U=>({...U,content:G.content,loading:!1})):(ee.error("Failed to load changelog"),b(U=>({...U,open:!1,loading:!1})))}catch(G){ee.error("Failed to load changelog: "+G.message),b(U=>({...U,open:!1,loading:!1}))}},I=async()=>{try{l(!0);const G=await ye.getConfig();t(G.config),s(G.path)}catch{ee.error("Failed to load settings")}finally{l(!1)}},O=async()=>{f(!0);try{await ye.saveConfig(e),ee.success("Preferences saved!")}catch{ee.error("Failed to save preferences")}finally{f(!1)}},F=(G,U)=>{t(L=>({...L,[G]:U}))},H=(G,U,L)=>{t(M=>({...M,[G]:{...M[G],[U]:L}}))},Y=async G=>{const U=(e==null?void 0:e.enabledTools)||["claude"];let L;if(U.includes(G)){if(U.length<=1){ee.error("At least one tool must be enabled");return}L=U.filter(B=>B!==G)}else L=[...U,G];const M={...e,enabledTools:L};t(M);try{await ye.saveConfig(M),ee.success(`${G==="claude"?"Claude Code":G==="gemini"?"Gemini CLI":"Antigravity"} ${L.includes(G)?"enabled":"disabled"}`)}catch{t(e),ee.error("Failed to save preference")}};return d?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(it,{className:"w-8 h-8 animate-spin text-primary"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-muted flex items-center justify-center",children:r.jsx(IC,{className:"w-5 h-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"coder-config Preferences"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Tool settings for this configuration manager"})]})]}),r.jsxs("div",{className:"bg-card rounded-xl border border-border p-6 shadow-sm",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsx("div",{children:r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Stored in: ",r.jsx("code",{className:"bg-muted px-2 py-0.5 rounded",children:n})]})}),r.jsxs(le,{onClick:O,disabled:c,children:[c?r.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(hi,{className:"w-4 h-4 mr-2"}),"Save"]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"border-b border-border pb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(kr,{className:"w-4 h-4"}),"Directories"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"MCP Tools Directories"}),r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Folders containing local MCP tool repositories for discovery"}),r.jsxs("div",{className:"space-y-2",children:[((e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[])).map((G,U)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{value:G||"",onChange:L=>{const M=[...(e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[])];M[U]=L.target.value,F("toolsDirs",M),e!=null&&e.toolsDir&&t(B=>{const{toolsDir:q,...$}=B;return{...$,toolsDirs:M}})},placeholder:"~/mcp-tools",className:"font-mono flex-1"}),r.jsx(le,{variant:"outline",size:"icon",onClick:()=>u({open:!0,field:"toolsDirs",type:"directory",index:U}),title:"Browse...",children:r.jsx(oi,{className:"w-4 h-4"})}),r.jsx(le,{variant:"outline",size:"icon",onClick:()=>{const M=((e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[])).filter((B,q)=>q!==U);t(B=>{const{toolsDir:q,...$}=B;return{...$,toolsDirs:M.length>0?M:void 0}})},title:"Remove",className:"text-destructive hover:text-destructive",children:r.jsx(ti,{className:"w-4 h-4"})})]},U)),r.jsxs(le,{variant:"outline",size:"sm",onClick:()=>u({open:!0,field:"toolsDirs",type:"directory",index:-1}),className:"mt-2",children:[r.jsx(Li,{className:"w-4 h-4 mr-2"}),"Add Tools Folder"]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Global Registry Path"}),r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Path to the global MCP registry file"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{value:(e==null?void 0:e.registryPath)||"",onChange:G=>F("registryPath",G.target.value),placeholder:"~/.claude/registry.json",className:"font-mono flex-1"}),r.jsx(le,{variant:"outline",size:"icon",onClick:()=>u({open:!0,field:"registryPath",type:"file"}),title:"Browse...",children:r.jsx(oi,{className:"w-4 h-4"})})]})]})]})]}),r.jsxs("div",{className:"border-b border-border pb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(C5,{className:"w-4 h-4"}),"User Interface"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Default Port"}),r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Port for the web UI server"}),r.jsx(lt,{type:"number",value:((z=e==null?void 0:e.ui)==null?void 0:z.port)||3333,onChange:G=>H("ui","port",parseInt(G.target.value)||3333),placeholder:"3333",className:"w-32"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Open Browser on Start"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically open browser when starting the UI"})]}),r.jsx(dt,{checked:((K=e==null?void 0:e.ui)==null?void 0:K.openBrowser)??!0,onCheckedChange:G=>H("ui","openBrowser",G)})]})]})]}),r.jsxs("div",{className:"border-b border-border pb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(uM,{className:"w-4 h-4"}),"AI Assistant"]}),r.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Choose which AI assistant to use for features like MCP creation and tool import."}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg cursor-pointer border-2 transition-colors ${((e==null?void 0:e.aiAssistant)||"claude")==="claude"?"border-orange-500 bg-orange-500/5":"border-transparent bg-muted/50 hover:bg-muted"}`,onClick:()=>F("aiAssistant","claude"),children:[r.jsx("input",{type:"radio",name:"aiAssistant",value:"claude",checked:((e==null?void 0:e.aiAssistant)||"claude")==="claude",onChange:()=>F("aiAssistant","claude"),className:"sr-only"}),r.jsx("div",{className:"w-8 h-8 rounded-md bg-orange-500/10 flex items-center justify-center",children:r.jsx(zt,{className:"w-4 h-4 text-orange-500"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Claude Code"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Anthropic's AI coding assistant • Command: ",r.jsx("code",{className:"text-xs",children:"claude"})]})]}),((e==null?void 0:e.aiAssistant)||"claude")==="claude"&&r.jsx("div",{className:"w-2 h-2 rounded-full bg-orange-500"})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg cursor-pointer border-2 transition-colors ${(e==null?void 0:e.aiAssistant)==="gemini"?"border-blue-500 bg-blue-500/5":"border-transparent bg-muted/50 hover:bg-muted"}`,onClick:()=>F("aiAssistant","gemini"),children:[r.jsx("input",{type:"radio",name:"aiAssistant",value:"gemini",checked:(e==null?void 0:e.aiAssistant)==="gemini",onChange:()=>F("aiAssistant","gemini"),className:"sr-only"}),r.jsx("div",{className:"w-8 h-8 rounded-md bg-blue-500/10 flex items-center justify-center",children:r.jsx(Mt,{className:"w-4 h-4 text-blue-500"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Gemini CLI"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Google's AI coding assistant • Command: ",r.jsx("code",{className:"text-xs",children:"gemini"})]})]}),(e==null?void 0:e.aiAssistant)==="gemini"&&r.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"})]})]})]}),r.jsxs("div",{className:"border-b border-border pb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(DM,{className:"w-4 h-4"}),"Enabled AI Tools"]}),r.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Select which AI coding tools to generate MCP configurations for. The Apply button will update all enabled tools."}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-md bg-orange-500/10 flex items-center justify-center",children:r.jsx(zt,{className:"w-4 h-4 text-orange-500"})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Claude Code"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Anthropic's AI coding assistant • Output: ",r.jsx("code",{className:"text-xs",children:".mcp.json"})]})]})]}),r.jsx(dt,{checked:((e==null?void 0:e.enabledTools)||["claude"]).includes("claude"),onCheckedChange:()=>Y("claude")})]}),r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-md bg-blue-500/10 flex items-center justify-center",children:r.jsx(zt,{className:"w-4 h-4 text-blue-500"})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Gemini CLI"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Google's terminal AI coding assistant • Output: ",r.jsx("code",{className:"text-xs",children:"~/.gemini/settings.json"})]})]})]}),r.jsx(dt,{checked:((e==null?void 0:e.enabledTools)||["claude"]).includes("gemini"),onCheckedChange:()=>Y("gemini")})]}),r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-md bg-purple-500/10 flex items-center justify-center",children:r.jsx(zt,{className:"w-4 h-4 text-purple-500"})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Antigravity"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Google's AI IDE • Output: ",r.jsx("code",{className:"text-xs",children:"~/.gemini/antigravity/mcp_config.json"})]})]})]}),r.jsx(dt,{checked:((e==null?void 0:e.enabledTools)||["claude"]).includes("antigravity"),onCheckedChange:()=>Y("antigravity")})]}),r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-md bg-green-500/10 flex items-center justify-center",children:r.jsx(zt,{className:"w-4 h-4 text-green-500"})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Codex CLI"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["OpenAI's terminal coding assistant • Output: ",r.jsx("code",{className:"text-xs",children:".codex/mcp.json"})]})]})]}),r.jsx(dt,{checked:((e==null?void 0:e.enabledTools)||["claude"]).includes("codex"),onCheckedChange:()=>Y("codex")})]}),r.jsxs("p",{className:"text-xs text-muted-foreground italic",children:["Note: Antigravity does not support environment variable interpolation (",r.jsx("code",{children:"${VAR}"}),"). Variables are resolved to actual values when generating its config."]})]})]}),y.length>0&&r.jsxs("div",{children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(NC,{className:"w-4 h-4"}),"Hidden Sub-projects"]}),r.jsx("div",{className:"space-y-2",children:y.map(G=>r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(kr,{className:"w-4 h-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:G.name}),r.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:G.dir.replace(k+"/","")})]})]}),r.jsxs(le,{size:"sm",variant:"outline",onClick:()=>P(G.dir),className:"h-7",children:[r.jsx(Gp,{className:"w-3 h-3 mr-1"}),"Unhide"]})]},G.dir))})]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(Nr,{className:"w-4 h-4"}),"About"]}),r.jsxs("div",{className:"bg-muted rounded-lg p-4 space-y-3",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Installed Version"}),r.jsx("span",{className:"font-medium font-mono text-foreground",children:(m==null?void 0:m.installedVersion)||"Loading..."})]}),(m==null?void 0:m.updateAvailable)&&r.jsx("div",{className:"p-3 bg-green-500/10 border border-green-500/20 rounded-lg",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:"Update Available!"}),r.jsxs("p",{className:"text-xs text-green-600/80 dark:text-green-400/80",children:["Version ",m.latestVersion," via ",m.updateMethod==="npm"?"npm":m.sourcePath]})]}),r.jsxs(le,{size:"sm",onClick:N,disabled:x,className:"bg-green-600 hover:bg-green-700 text-white",children:[x?r.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(Sl,{className:"w-4 h-4 mr-2"}),"Update Now"]})]})}),!(m!=null&&m.updateAvailable)&&(m==null?void 0:m.latestVersion)&&r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Latest Version"}),r.jsxs("span",{className:"font-mono text-green-600 dark:text-green-400",children:[m.latestVersion," ✓"]})]}),(m==null?void 0:m.sourcePath)&&!(m!=null&&m.updateAvailable)&&r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Dev Source"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("code",{className:"text-xs text-muted-foreground",children:m.sourcePath}),r.jsx(le,{size:"sm",variant:"outline",onClick:N,disabled:x,className:"h-7",children:x?r.jsx(it,{className:"w-3 h-3 animate-spin"}):r.jsx(yr,{className:"w-3 h-3"})})]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Install Location"}),r.jsx("code",{className:"text-xs text-muted-foreground",children:(m==null?void 0:m.installDir)||"~/.coder-config"})]}),r.jsxs("div",{className:"border-t border-border pt-3 mt-3 space-y-2",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Documentation"}),r.jsx("a",{href:"https://github.com/regression-io/coder-config",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"GitHub"})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"What's New"}),r.jsxs("button",{onClick:R,className:"text-primary hover:underline flex items-center gap-1",children:[r.jsx(Tu,{className:"w-3 h-3"}),"Changelog"]})]}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["After updating, restart the server with ",r.jsx("code",{className:"bg-muted-foreground/10 px-1 rounded",children:"coder-config ui"})]})]})]})]})]})]}),r.jsx(Ng,{open:o.open,onOpenChange:G=>u(U=>({...U,open:G})),onSelect:G=>{if(o.field==="toolsDirs"){const U=(e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[]);if(o.index===-1)t(L=>{const{toolsDir:M,...B}=L;return{...B,toolsDirs:[...U,G]}});else{const L=[...U];L[o.index]=G,t(M=>{const{toolsDir:B,...q}=M;return{...q,toolsDirs:L}})}}else o.field&&F(o.field,G)},type:o.type,initialPath:o.field==="toolsDirs"&&o.index>=0?((e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[]))[o.index]||"~":(e==null?void 0:e[o.field])||"~",title:o.type==="directory"?"Select Directory":"Select File"}),r.jsx(St,{open:g.open,onOpenChange:G=>b(U=>({...U,open:G})),children:r.jsxs(yt,{className:"max-w-2xl max-h-[80vh] flex flex-col overflow-hidden",children:[r.jsx(bt,{className:"flex-shrink-0",children:r.jsxs(wt,{className:"flex items-center gap-2",children:[r.jsx(Tu,{className:"w-5 h-5"}),"Changelog"]})}),g.loading?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(it,{className:"w-6 h-6 animate-spin text-primary"})}):r.jsx(En,{className:"h-[60vh]",children:r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none pr-4",children:r.jsx(Dz,{components:{h1:({children:G})=>r.jsx("h1",{className:"text-xl font-bold text-foreground mb-4",children:G}),h2:({children:G})=>r.jsx("h2",{className:"text-lg font-semibold text-foreground mt-6 mb-3 pb-2 border-b border-border",children:G}),h3:({children:G})=>r.jsx("h3",{className:"text-base font-medium text-foreground mt-4 mb-2",children:G}),p:({children:G})=>r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:G}),ul:({children:G})=>r.jsx("ul",{className:"text-sm text-muted-foreground list-disc pl-5 mb-3 space-y-1",children:G}),li:({children:G})=>r.jsx("li",{className:"text-sm",children:G}),code:({children:G})=>r.jsx("code",{className:"bg-muted px-1 py-0.5 rounded text-xs font-mono",children:G}),hr:()=>r.jsx("hr",{className:"my-4 border-border"}),strong:({children:G})=>r.jsx("strong",{className:"font-semibold text-foreground",children:G})},children:g.content})})})]})})]})}function $z(){const[e,t]=S.useState(null),[n,s]=S.useState({}),[o,u]=S.useState(!0);S.useEffect(()=>{d()},[]);const d=async()=>{try{u(!0);const[c,f]=await Promise.all([ye.getClaudeSettings(),ye.getRegistry()]);t(c.settings),s(f.mcpServers||{})}catch(c){console.error("Failed to load Claude settings:",c)}finally{u(!1)}},l=async c=>{try{await ye.saveClaudeSettings(c),t(c),ee.success("Claude Code settings saved!")}catch(f){ee.error("Failed to save settings: "+f.message)}};return o?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(it,{className:"w-8 h-8 animate-spin text-indigo-600"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-6 shadow-sm",children:r.jsx(Oj,{settings:e,onSave:l,loading:o,settingsPath:"~/.claude/settings.json",mcpServers:n})}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{children:"coder-config init # Initialize project"}),r.jsx("p",{children:"coder-config apply # Generate .mcp.json from config"}),r.jsx("p",{children:"coder-config show # Show current project config"})]})]})]})}function zz(){const[e,t]=S.useState(null),[n,s]=S.useState(!0);S.useEffect(()=>{o()},[]);const o=async()=>{try{s(!0);const d=await ye.getGeminiSettings();t(d.settings)}catch(d){console.error("Failed to load Gemini settings:",d)}finally{s(!1)}},u=async d=>{try{await ye.saveGeminiSettings(d),t(d),ee.success("Gemini CLI settings saved!")}catch(l){ee.error("Failed to save settings: "+l.message)}};return n?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(it,{className:"w-8 h-8 animate-spin text-blue-600"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-6 shadow-sm",children:r.jsx(Bj,{settings:e,onSave:u,loading:n,settingsPath:"~/.gemini/settings.json"})}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{children:"coder-config apply # Generate settings for all tools"}),r.jsx("p",{children:"coder-config apply --gemini # Generate Gemini settings only"})]})]})]})}const Hz=[{id:"off",name:"Off",description:"Never auto-execute; requires allow list"},{id:"auto",name:"Auto",description:"Safety model determines execution"},{id:"turbo",name:"Turbo",description:"Auto-execute unless in deny list",dangerous:!0}],Wz=[{id:"always-proceed",name:"Always Proceed",description:"Agent never requests review"},{id:"agent-decides",name:"Agent Decides",description:"Agent determines when review is needed"},{id:"request-review",name:"Request Review",description:"Agent always requests review"}],Vz=[{id:"always-proceed",name:"Always Proceed",description:"Maximum autonomy",dangerous:!0},{id:"request-review",name:"Request Review",description:"Ask before browser JavaScript"},{id:"disabled",name:"Disabled",description:"Never run browser JavaScript"}];function Uz({settings:e,onSave:t,loading:n,settingsPath:s}){const[o,u]=S.useState(e||{}),[d,l]=S.useState(!1),[c,f]=S.useState("rich"),[m,h]=S.useState(JSON.stringify(e||{},null,2)),[x,w]=S.useState({open:!1,name:"",json:""}),[k,_]=S.useState({}),y=async()=>{l(!0);try{if(c==="json")try{const P=JSON.parse(m);await t(P),u(P)}catch{ee.error("Invalid JSON"),l(!1);return}else await t(o),h(JSON.stringify(o,null,2));ee.success("Settings saved")}finally{l(!1)}},v=(P,N)=>{u(R=>({...R,[P]:N}))},g=(P,N)=>(o==null?void 0:o[P])??N,b=o.mcpServers||{},j=()=>{const{name:P,json:N}=x;if(!P.trim()){ee.error("Please enter a name for the MCP");return}let R;try{R=JSON.parse(N)}catch{ee.error("Invalid JSON configuration");return}if(!R.command){ee.error('MCP config must have a "command" field');return}u(I=>({...I,mcpServers:{...I.mcpServers,[P.trim()]:R}})),w({open:!1,name:"",json:""}),ee.success(`Added MCP: ${P}`)},E=P=>{u(N=>{const{[P]:R,...I}=N.mcpServers||{};return{...N,mcpServers:I}}),ee.success(`Removed MCP: ${P}`)},A=P=>{_(N=>({...N,[P]:!N[P]}))};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-500/10 flex items-center justify-center",children:r.jsx(kl,{className:"w-5 h-5 text-purple-500"})}),r.jsxs("div",{children:[r.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:["Antigravity Settings",r.jsx(Je,{variant:"outline",className:"text-xs font-normal text-purple-600 border-purple-300 dark:border-purple-700",children:"Google"})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Stored in: ",r.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs",children:s})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex bg-muted rounded-lg p-1",children:[r.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${c==="rich"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>f("rich"),children:"Settings"}),r.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${c==="json"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>{h(JSON.stringify(o,null,2)),f("json")},children:"JSON"})]}),r.jsxs(le,{onClick:y,disabled:d||n,children:[d?r.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(hi,{className:"w-4 h-4 mr-2"}),"Save"]})]})]}),c==="json"?r.jsx("div",{className:"border border-border rounded-lg bg-card overflow-hidden",children:r.jsx(ft,{value:m,onChange:P=>h(P.target.value),className:"font-mono text-sm min-h-[500px] border-0 rounded-none resize-none",placeholder:"{ }"})}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(ls,{className:"w-4 h-4 text-purple-500"}),"Security Policies"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Terminal Command Execution"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Control how the agent executes shell commands"})]}),r.jsxs(gr,{value:g("terminalPolicy","auto"),onValueChange:P=>v("terminalPolicy",P),children:[r.jsx(ur,{className:"w-44",children:r.jsx(xr,{})}),r.jsx(dr,{children:Hz.map(P=>r.jsx(_t,{value:P.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:P.name}),P.dangerous&&r.jsx(Je,{variant:"destructive",className:"text-xs",children:"Risk"})]})},P.id))})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Review Policy"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"When the agent should request human review"})]}),r.jsxs(gr,{value:g("reviewPolicy","agent-decides"),onValueChange:P=>v("reviewPolicy",P),children:[r.jsx(ur,{className:"w-44",children:r.jsx(xr,{})}),r.jsx(dr,{children:Wz.map(P=>r.jsx(_t,{value:P.id,children:P.name},P.id))})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"JavaScript Execution"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Control browser JavaScript execution"})]}),r.jsxs(gr,{value:g("jsPolicy","request-review"),onValueChange:P=>v("jsPolicy",P),children:[r.jsx(ur,{className:"w-44",children:r.jsx(xr,{})}),r.jsx(dr,{children:Vz.map(P=>r.jsx(_t,{value:P.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:P.name}),P.dangerous&&r.jsx(Je,{variant:"destructive",className:"text-xs",children:"Risk"})]})},P.id))})]})]})]})]}),r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[r.jsx($n,{className:"w-4 h-4 text-purple-500"}),"MCP Servers",r.jsx(Je,{variant:"secondary",className:"text-xs",children:Object.keys(b).length})]}),r.jsxs(le,{size:"sm",variant:"outline",onClick:()=>w({open:!0,name:"",json:`{
|
|
621
|
+
`},o),u}function cz(e,t){return e&&"run"in e?async function(n,s){const o=Aw(n,{file:s,...t});await e.run(o,s)}:function(n,s){return Aw(n,{file:s,...e||t})}}function Tw(e){if(e)throw e}var lm,Rw;function uz(){if(Rw)return lm;Rw=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,o=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},u=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var m=e.call(f,"constructor"),h=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!m&&!h)return!1;var x;for(x in f);return typeof x>"u"||e.call(f,x)},d=function(f,m){n&&m.name==="__proto__"?n(f,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):f[m.name]=m.newValue},l=function(f,m){if(m==="__proto__")if(e.call(f,m)){if(s)return s(f,m).value}else return;return f[m]};return lm=function c(){var f,m,h,x,w,k,_=arguments[0],y=1,v=arguments.length,g=!1;for(typeof _=="boolean"&&(g=_,_=arguments[1]||{},y=2),(_==null||typeof _!="object"&&typeof _!="function")&&(_={});y<v;++y)if(f=arguments[y],f!=null)for(m in f)h=l(_,m),x=l(f,m),_!==x&&(g&&x&&(u(x)||(w=o(x)))?(w?(w=!1,k=h&&o(h)?h:[]):k=h&&u(h)?h:{},d(_,{name:m,newValue:c(g,k,x)})):typeof x<"u"&&d(_,{name:m,newValue:x}));return _},lm}var dz=uz();const cm=vl(dz);function ap(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function hz(){const e=[],t={run:n,use:s};return t;function n(...o){let u=-1;const d=o.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);l(null,...o);function l(c,...f){const m=e[++u];let h=-1;if(c){d(c);return}for(;++h<o.length;)(f[h]===null||f[h]===void 0)&&(f[h]=o[h]);o=f,m?fz(m,l)(...f):d(null,...f)}}function s(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function fz(e,t){let n;return s;function s(...d){const l=e.length>d.length;let c;l&&d.push(o);try{c=e.apply(this,d)}catch(f){const m=f;if(l&&n)throw m;return o(m)}l||(c&&c.then&&typeof c.then=="function"?c.then(u,o):c instanceof Error?o(c):u(c))}function o(d,...l){n||(n=!0,t(d,...l))}function u(d){o(null,d)}}const Xn={basename:mz,dirname:pz,extname:gz,join:xz,sep:"/"};function mz(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');zl(e);let n=0,s=-1,o=e.length,u;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(u){n=o+1;break}}else s<0&&(u=!0,s=o+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let d=-1,l=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(u){n=o+1;break}}else d<0&&(u=!0,d=o+1),l>-1&&(e.codePointAt(o)===t.codePointAt(l--)?l<0&&(s=o):(l=-1,s=d));return n===s?s=d:s<0&&(s=e.length),e.slice(n,s)}function pz(e){if(zl(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function gz(e){zl(e);let t=e.length,n=-1,s=0,o=-1,u=0,d;for(;t--;){const l=e.codePointAt(t);if(l===47){if(d){s=t+1;break}continue}n<0&&(d=!0,n=t+1),l===46?o<0?o=t:u!==1&&(u=1):o>-1&&(u=-1)}return o<0||n<0||u===0||u===1&&o===n-1&&o===s+1?"":e.slice(o,n)}function xz(...e){let t=-1,n;for(;++t<e.length;)zl(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":vz(n)}function vz(e){zl(e);const t=e.codePointAt(0)===47;let n=yz(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function yz(e,t){let n="",s=0,o=-1,u=0,d=-1,l,c;for(;++d<=e.length;){if(d<e.length)l=e.codePointAt(d);else{if(l===47)break;l=47}if(l===47){if(!(o===d-1||u===1))if(o!==d-1&&u===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",s=0):(n=n.slice(0,c),s=n.length-1-n.lastIndexOf("/")),o=d,u=0;continue}}else if(n.length>0){n="",s=0,o=d,u=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(o+1,d):n=e.slice(o+1,d),s=d-o-1;o=d,u=0}else l===46&&u>-1?u++:u=-1}return n}function zl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const bz={cwd:wz};function wz(){return"/"}function lp(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function _z(e){if(typeof e=="string")e=new URL(e);else if(!lp(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Cz(e)}function Cz(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const um=["history","path","basename","stem","extname","dirname"];class SN{constructor(t){let n;t?lp(t)?n={path:t}:typeof t=="string"||Sz(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":bz.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<um.length;){const u=um[s];u in n&&n[u]!==void 0&&n[u]!==null&&(this[u]=u==="history"?[...n[u]]:n[u])}let o;for(o in n)um.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Xn.basename(this.path):void 0}set basename(t){hm(t,"basename"),dm(t,"basename"),this.path=Xn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Xn.dirname(this.path):void 0}set dirname(t){Mw(this.basename,"dirname"),this.path=Xn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Xn.extname(this.path):void 0}set extname(t){if(dm(t,"extname"),Mw(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Xn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){lp(t)&&(t=_z(t)),hm(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Xn.basename(this.path,this.extname):void 0}set stem(t){hm(t,"stem"),dm(t,"stem"),this.path=Xn.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const o=this.message(t,n,s);throw o.fatal=!0,o}info(t,n,s){const o=this.message(t,n,s);return o.fatal=void 0,o}message(t,n,s){const o=new Br(t,n,s);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function dm(e,t){if(e&&e.includes(Xn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Xn.sep+"`")}function hm(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Mw(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Sz(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const kz=(function(e){const s=this.constructor.prototype,o=s[e],u=function(){return o.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),jz={}.hasOwnProperty;class ex extends kz{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=hz()}copy(){const t=new ex;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(cm(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(pm("data",this.frozen),this.namespace[t]=n,this):jz.call(this.namespace,t)&&this.namespace[t]||void 0:t?(pm("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const o=n.call(t,...s);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=uu(t),s=this.parser||this.Parser;return fm("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),fm("process",this.parser||this.Parser),mm("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(u,d){const l=uu(t),c=s.parse(l);s.run(c,l,function(m,h,x){if(m||!h||!x)return f(m);const w=h,k=s.stringify(w,x);Pz(k)?x.value=k:x.result=k,f(m,x)});function f(m,h){m||!h?d(m):u?u(h):n(void 0,h)}}}processSync(t){let n=!1,s;return this.freeze(),fm("processSync",this.parser||this.Parser),mm("processSync",this.compiler||this.Compiler),this.process(t,o),Lw("processSync","process",n),s;function o(u,d){n=!0,Tw(u),s=d}}run(t,n,s){Dw(t),this.freeze();const o=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?u(void 0,s):new Promise(u);function u(d,l){const c=uu(n);o.run(t,c,f);function f(m,h,x){const w=h||t;m?l(m):d?d(w):s(void 0,w,x)}}}runSync(t,n){let s=!1,o;return this.run(t,n,u),Lw("runSync","run",s),o;function u(d,l){Tw(d),o=l,s=!0}}stringify(t,n){this.freeze();const s=uu(n),o=this.compiler||this.Compiler;return mm("stringify",o),Dw(t),o(t,s)}use(t,...n){const s=this.attachers,o=this.namespace;if(pm("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):d(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function u(f){if(typeof f=="function")c(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[m,...h]=f;c(m,h)}else d(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function d(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(f.plugins),f.settings&&(o.settings=cm(!0,o.settings,f.settings))}function l(f){let m=-1;if(f!=null)if(Array.isArray(f))for(;++m<f.length;){const h=f[m];u(h)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function c(f,m){let h=-1,x=-1;for(;++h<s.length;)if(s[h][0]===f){x=h;break}if(x===-1)s.push([f,...m]);else if(m.length>0){let[w,...k]=m;const _=s[x][1];ap(_)&&ap(w)&&(w=cm(!0,_,w)),s[x]=[f,w,...k]}}}}const Nz=new ex().freeze();function fm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function mm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function pm(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Dw(e){if(!ap(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Lw(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function uu(e){return Ez(e)?e:new SN(e)}function Ez(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Pz(e){return typeof e=="string"||Az(e)}function Az(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Tz="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Iw=[],Ow={allowDangerousHtml:!0},Rz=/^(https?|ircs?|mailto|xmpp)$/i,Mz=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Dz(e){const t=Lz(e),n=Iz(e);return Oz(t.runSync(t.parse(n),n),e)}function Lz(e){const t=e.rehypePlugins||Iw,n=e.remarkPlugins||Iw,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ow}:Ow;return Nz().use(m$).use(n).use(cz,s).use(t)}function Iz(e){const t=e.children||"",n=new SN;return typeof t=="string"&&(n.value=t),n}function Oz(e,t){const n=t.allowedElements,s=t.allowElement,o=t.components,u=t.disallowedElements,d=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||Bz;for(const m of Mz)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+Tz+m.id,void 0);return CN(e,f),K8(e,{Fragment:r.Fragment,components:o,ignoreInvalidStyle:!0,jsx:r.jsx,jsxs:r.jsxs,passKeys:!0,passNode:!0});function f(m,h,x){if(m.type==="raw"&&x&&typeof h=="number")return d?x.children.splice(h,1):x.children[h]={type:"text",value:m.value},h;if(m.type==="element"){let w;for(w in im)if(Object.hasOwn(im,w)&&Object.hasOwn(m.properties,w)){const k=m.properties[w],_=im[w];(_===null||_.includes(m.tagName))&&(m.properties[w]=c(String(k||""),w,m))}}if(m.type==="element"){let w=n?!n.includes(m.tagName):u?u.includes(m.tagName):!1;if(!w&&s&&typeof h=="number"&&(w=!s(m,h,x)),w&&x&&typeof h=="number")return l&&m.children?x.children.splice(h,1,...m.children):x.children.splice(h,1),h}}}function Bz(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||s!==-1&&t>s||Rz.test(e.slice(0,t))?e:""}function Fz(){var z,K;const[e,t]=S.useState(null),[n,s]=S.useState(""),[o,u]=S.useState({open:!1,field:null,type:"directory"}),[d,l]=S.useState(!0),[c,f]=S.useState(!1),[m,h]=S.useState(null),[x,w]=S.useState(!1),[k,_]=S.useState(null),[y,v]=S.useState([]),[g,b]=S.useState({open:!1,content:"",loading:!1});S.useEffect(()=>{I(),j(),E()},[]);const j=async()=>{try{const G=await ye.checkVersion();h(G)}catch(G){console.error("Failed to load version info:",G)}},E=async()=>{try{const G=await ye.getProject();_(G.dir),A(G.dir)}catch(G){console.error("Failed to load project info:",G)}},A=async G=>{if(G)try{const U=await ye.getHiddenSubprojects(G);v(U.hidden||[])}catch(U){console.error("Failed to load hidden sub-projects:",U)}},P=async G=>{if(k)try{const U=await ye.unhideSubproject(k,G);U.success?(ee.success("Sub-project unhidden"),A(k)):ee.error(U.error||"Failed to unhide")}catch(U){ee.error("Failed to unhide: "+U.message)}},N=async()=>{if(!(m!=null&&m.updateAvailable)){ee.error("No update available");return}w(!0);try{const G=await ye.performUpdate({updateMethod:m.updateMethod,sourcePath:m.sourcePath});if(G.success){ee.success(`Updated to v${G.newVersion}! Restarting server...`);try{await ye.restartServer()}catch{}let U=0;const L=setInterval(async()=>{U++;try{await ye.checkVersion(),clearInterval(L),ee.success("Server restarted! Reloading..."),setTimeout(()=>window.location.reload(),500)}catch{U>30&&(clearInterval(L),ee.info("Server restarting. Please refresh the page."),w(!1))}},500)}else ee.error("Update failed: "+G.error),w(!1)}catch(G){ee.error("Update failed: "+G.message),w(!1)}},R=async()=>{b(G=>({...G,open:!0,loading:!0}));try{const G=await ye.getChangelog();G.success?b(U=>({...U,content:G.content,loading:!1})):(ee.error("Failed to load changelog"),b(U=>({...U,open:!1,loading:!1})))}catch(G){ee.error("Failed to load changelog: "+G.message),b(U=>({...U,open:!1,loading:!1}))}},I=async()=>{try{l(!0);const G=await ye.getConfig();t(G.config),s(G.path)}catch{ee.error("Failed to load settings")}finally{l(!1)}},O=async()=>{f(!0);try{await ye.saveConfig(e),ee.success("Preferences saved!")}catch{ee.error("Failed to save preferences")}finally{f(!1)}},F=(G,U)=>{t(L=>({...L,[G]:U}))},H=(G,U,L)=>{t(M=>({...M,[G]:{...M[G],[U]:L}}))},Y=async G=>{const U=(e==null?void 0:e.enabledTools)||["claude"];let L;if(U.includes(G)){if(U.length<=1){ee.error("At least one tool must be enabled");return}L=U.filter(B=>B!==G)}else L=[...U,G];const M={...e,enabledTools:L};t(M);try{await ye.saveConfig(M),ee.success(`${G==="claude"?"Claude Code":G==="gemini"?"Gemini CLI":"Antigravity"} ${L.includes(G)?"enabled":"disabled"}`)}catch{t(e),ee.error("Failed to save preference")}};return d?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(it,{className:"w-8 h-8 animate-spin text-primary"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-muted flex items-center justify-center",children:r.jsx(IC,{className:"w-5 h-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"coder-config Preferences"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Tool settings for this configuration manager"})]})]}),r.jsxs("div",{className:"bg-card rounded-xl border border-border p-6 shadow-sm",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsx("div",{children:r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Stored in: ",r.jsx("code",{className:"bg-muted px-2 py-0.5 rounded",children:n})]})}),r.jsxs(le,{onClick:O,disabled:c,children:[c?r.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(hi,{className:"w-4 h-4 mr-2"}),"Save"]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"border-b border-border pb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(kr,{className:"w-4 h-4"}),"Directories"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"MCP Tools Directories"}),r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Folders containing local MCP tool repositories for discovery"}),r.jsxs("div",{className:"space-y-2",children:[((e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[])).map((G,U)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{value:G||"",onChange:L=>{const M=[...(e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[])];M[U]=L.target.value,F("toolsDirs",M),e!=null&&e.toolsDir&&t(B=>{const{toolsDir:q,...$}=B;return{...$,toolsDirs:M}})},placeholder:"~/mcp-tools",className:"font-mono flex-1"}),r.jsx(le,{variant:"outline",size:"icon",onClick:()=>u({open:!0,field:"toolsDirs",type:"directory",index:U}),title:"Browse...",children:r.jsx(oi,{className:"w-4 h-4"})}),r.jsx(le,{variant:"outline",size:"icon",onClick:()=>{const M=((e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[])).filter((B,q)=>q!==U);t(B=>{const{toolsDir:q,...$}=B;return{...$,toolsDirs:M.length>0?M:void 0}})},title:"Remove",className:"text-destructive hover:text-destructive",children:r.jsx(ti,{className:"w-4 h-4"})})]},U)),r.jsxs(le,{variant:"outline",size:"sm",onClick:()=>u({open:!0,field:"toolsDirs",type:"directory",index:-1}),className:"mt-2",children:[r.jsx(Li,{className:"w-4 h-4 mr-2"}),"Add Tools Folder"]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Global Registry Path"}),r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Path to the global MCP registry file"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{value:(e==null?void 0:e.registryPath)||"",onChange:G=>F("registryPath",G.target.value),placeholder:"~/.claude/registry.json",className:"font-mono flex-1"}),r.jsx(le,{variant:"outline",size:"icon",onClick:()=>u({open:!0,field:"registryPath",type:"file"}),title:"Browse...",children:r.jsx(oi,{className:"w-4 h-4"})})]})]})]})]}),r.jsxs("div",{className:"border-b border-border pb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(C5,{className:"w-4 h-4"}),"User Interface"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Default Port"}),r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Port for the web UI server"}),r.jsx(lt,{type:"number",value:((z=e==null?void 0:e.ui)==null?void 0:z.port)||3333,onChange:G=>H("ui","port",parseInt(G.target.value)||3333),placeholder:"3333",className:"w-32"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Open Browser on Start"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically open browser when starting the UI"})]}),r.jsx(dt,{checked:((K=e==null?void 0:e.ui)==null?void 0:K.openBrowser)??!0,onCheckedChange:G=>H("ui","openBrowser",G)})]})]})]}),r.jsxs("div",{className:"border-b border-border pb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(uM,{className:"w-4 h-4"}),"AI Assistant"]}),r.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Choose which AI assistant to use for features like MCP creation and tool import."}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg cursor-pointer border-2 transition-colors ${((e==null?void 0:e.aiAssistant)||"claude")==="claude"?"border-orange-500 bg-orange-500/5":"border-transparent bg-muted/50 hover:bg-muted"}`,onClick:()=>F("aiAssistant","claude"),children:[r.jsx("input",{type:"radio",name:"aiAssistant",value:"claude",checked:((e==null?void 0:e.aiAssistant)||"claude")==="claude",onChange:()=>F("aiAssistant","claude"),className:"sr-only"}),r.jsx("div",{className:"w-8 h-8 rounded-md bg-orange-500/10 flex items-center justify-center",children:r.jsx(zt,{className:"w-4 h-4 text-orange-500"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Claude Code"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Anthropic's AI coding assistant • Command: ",r.jsx("code",{className:"text-xs",children:"claude"})]})]}),((e==null?void 0:e.aiAssistant)||"claude")==="claude"&&r.jsx("div",{className:"w-2 h-2 rounded-full bg-orange-500"})]}),r.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg cursor-pointer border-2 transition-colors ${(e==null?void 0:e.aiAssistant)==="gemini"?"border-blue-500 bg-blue-500/5":"border-transparent bg-muted/50 hover:bg-muted"}`,onClick:()=>F("aiAssistant","gemini"),children:[r.jsx("input",{type:"radio",name:"aiAssistant",value:"gemini",checked:(e==null?void 0:e.aiAssistant)==="gemini",onChange:()=>F("aiAssistant","gemini"),className:"sr-only"}),r.jsx("div",{className:"w-8 h-8 rounded-md bg-blue-500/10 flex items-center justify-center",children:r.jsx(Mt,{className:"w-4 h-4 text-blue-500"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Gemini CLI"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Google's AI coding assistant • Command: ",r.jsx("code",{className:"text-xs",children:"gemini"})]})]}),(e==null?void 0:e.aiAssistant)==="gemini"&&r.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"})]})]})]}),r.jsxs("div",{className:"border-b border-border pb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(DM,{className:"w-4 h-4"}),"Enabled AI Tools"]}),r.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Select which AI coding tools to generate MCP configurations for. The Apply button will update all enabled tools."}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-md bg-orange-500/10 flex items-center justify-center",children:r.jsx(zt,{className:"w-4 h-4 text-orange-500"})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Claude Code"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Anthropic's AI coding assistant • Output: ",r.jsx("code",{className:"text-xs",children:".mcp.json"})]})]})]}),r.jsx(dt,{checked:((e==null?void 0:e.enabledTools)||["claude"]).includes("claude"),onCheckedChange:()=>Y("claude")})]}),r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-md bg-blue-500/10 flex items-center justify-center",children:r.jsx(zt,{className:"w-4 h-4 text-blue-500"})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Gemini CLI"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Google's terminal AI coding assistant • Output: ",r.jsx("code",{className:"text-xs",children:"~/.gemini/settings.json"})]})]})]}),r.jsx(dt,{checked:((e==null?void 0:e.enabledTools)||["claude"]).includes("gemini"),onCheckedChange:()=>Y("gemini")})]}),r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-md bg-purple-500/10 flex items-center justify-center",children:r.jsx(zt,{className:"w-4 h-4 text-purple-500"})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Antigravity"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Google's AI IDE • Output: ",r.jsx("code",{className:"text-xs",children:"~/.gemini/antigravity/mcp_config.json"})]})]})]}),r.jsx(dt,{checked:((e==null?void 0:e.enabledTools)||["claude"]).includes("antigravity"),onCheckedChange:()=>Y("antigravity")})]}),r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-md bg-green-500/10 flex items-center justify-center",children:r.jsx(zt,{className:"w-4 h-4 text-green-500"})}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Codex CLI"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["OpenAI's terminal coding assistant • Output: ",r.jsx("code",{className:"text-xs",children:".codex/mcp.json"})]})]})]}),r.jsx(dt,{checked:((e==null?void 0:e.enabledTools)||["claude"]).includes("codex"),onCheckedChange:()=>Y("codex")})]}),r.jsxs("p",{className:"text-xs text-muted-foreground italic",children:["Note: Antigravity does not support environment variable interpolation (",r.jsx("code",{children:"${VAR}"}),"). Variables are resolved to actual values when generating its config."]})]})]}),y.length>0&&r.jsxs("div",{children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(NC,{className:"w-4 h-4"}),"Hidden Sub-projects"]}),r.jsx("div",{className:"space-y-2",children:y.map(G=>r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(kr,{className:"w-4 h-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-foreground",children:G.name}),r.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:G.dir.replace(k+"/","")})]})]}),r.jsxs(le,{size:"sm",variant:"outline",onClick:()=>P(G.dir),className:"h-7",children:[r.jsx(Gp,{className:"w-3 h-3 mr-1"}),"Unhide"]})]},G.dir))})]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(Nr,{className:"w-4 h-4"}),"About"]}),r.jsxs("div",{className:"bg-muted rounded-lg p-4 space-y-3",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Installed Version"}),r.jsx("span",{className:"font-medium font-mono text-foreground",children:(m==null?void 0:m.installedVersion)||"Loading..."})]}),(m==null?void 0:m.updateAvailable)&&r.jsx("div",{className:"p-3 bg-green-500/10 border border-green-500/20 rounded-lg",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:"Update Available!"}),r.jsxs("p",{className:"text-xs text-green-600/80 dark:text-green-400/80",children:["Version ",m.latestVersion," via ",m.updateMethod==="npm"?"npm":m.sourcePath]})]}),r.jsxs(le,{size:"sm",onClick:N,disabled:x,className:"bg-green-600 hover:bg-green-700 text-white",children:[x?r.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(Sl,{className:"w-4 h-4 mr-2"}),"Update Now"]})]})}),!(m!=null&&m.updateAvailable)&&(m==null?void 0:m.latestVersion)&&r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Latest Version"}),r.jsxs("span",{className:"font-mono text-green-600 dark:text-green-400",children:[m.latestVersion," ✓"]})]}),(m==null?void 0:m.sourcePath)&&!(m!=null&&m.updateAvailable)&&r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Dev Source"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("code",{className:"text-xs text-muted-foreground",children:m.sourcePath}),r.jsx(le,{size:"sm",variant:"outline",onClick:N,disabled:x,className:"h-7",children:x?r.jsx(it,{className:"w-3 h-3 animate-spin"}):r.jsx(yr,{className:"w-3 h-3"})})]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Install Location"}),r.jsx("code",{className:"text-xs text-muted-foreground",children:(m==null?void 0:m.installDir)||"~/.coder-config"})]}),r.jsxs("div",{className:"border-t border-border pt-3 mt-3 space-y-2",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Documentation"}),r.jsx("a",{href:"https://github.com/regression-io/coder-config",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"GitHub"})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"What's New"}),r.jsxs("button",{onClick:R,className:"text-primary hover:underline flex items-center gap-1",children:[r.jsx(Tu,{className:"w-3 h-3"}),"Changelog"]})]}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["After updating, restart the server with ",r.jsx("code",{className:"bg-muted-foreground/10 px-1 rounded",children:"coder-config ui"})]})]})]})]})]})]}),r.jsx(Ng,{open:o.open,onOpenChange:G=>u(U=>({...U,open:G})),onSelect:G=>{if(o.field==="toolsDirs"){const U=(e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[]);if(o.index===-1)t(L=>{const{toolsDir:M,...B}=L;return{...B,toolsDirs:[...U,G]}});else{const L=[...U];L[o.index]=G,t(M=>{const{toolsDir:B,...q}=M;return{...q,toolsDirs:L}})}}else o.field&&F(o.field,G)},type:o.type,initialPath:o.field==="toolsDirs"&&o.index>=0?((e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[]))[o.index]||"~":(e==null?void 0:e[o.field])||"~",title:o.type==="directory"?"Select Directory":"Select File"}),r.jsx(St,{open:g.open,onOpenChange:G=>b(U=>({...U,open:G})),children:r.jsxs(yt,{className:"max-w-2xl max-h-[80vh] flex flex-col overflow-hidden",children:[r.jsx(bt,{className:"flex-shrink-0",children:r.jsxs(wt,{className:"flex items-center gap-2",children:[r.jsx(Tu,{className:"w-5 h-5"}),"Changelog"]})}),g.loading?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(it,{className:"w-6 h-6 animate-spin text-primary"})}):r.jsx(En,{className:"h-[60vh]",children:r.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none pr-4",children:r.jsx(Dz,{components:{h1:({children:G})=>r.jsx("h1",{className:"text-xl font-bold text-foreground mb-4",children:G}),h2:({children:G})=>r.jsx("h2",{className:"text-lg font-semibold text-foreground mt-6 mb-3 pb-2 border-b border-border",children:G}),h3:({children:G})=>r.jsx("h3",{className:"text-base font-medium text-foreground mt-4 mb-2",children:G}),p:({children:G})=>r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:G}),ul:({children:G})=>r.jsx("ul",{className:"text-sm text-muted-foreground list-disc pl-5 mb-3 space-y-1",children:G}),li:({children:G})=>r.jsx("li",{className:"text-sm",children:G}),code:({children:G})=>r.jsx("code",{className:"bg-muted px-1 py-0.5 rounded text-xs font-mono",children:G}),hr:()=>r.jsx("hr",{className:"my-4 border-border"}),strong:({children:G})=>r.jsx("strong",{className:"font-semibold text-foreground",children:G})},children:g.content})})})]})})]})}function $z(){const[e,t]=S.useState(null),[n,s]=S.useState({}),[o,u]=S.useState(!0);S.useEffect(()=>{d()},[]);const d=async()=>{try{u(!0);const[c,f]=await Promise.all([ye.getClaudeSettings(),ye.getRegistry()]);t(c.settings),s(f.mcpServers||{})}catch(c){console.error("Failed to load Claude settings:",c)}finally{u(!1)}},l=async c=>{try{await ye.saveClaudeSettings(c),t(c),ee.success("Claude Code settings saved!")}catch(f){ee.error("Failed to save settings: "+f.message)}};return o?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(it,{className:"w-8 h-8 animate-spin text-indigo-600"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-6 shadow-sm",children:r.jsx(Oj,{settings:e,onSave:l,loading:o,settingsPath:"~/.claude/settings.json",mcpServers:n})}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{children:"coder-config init # Initialize project"}),r.jsx("p",{children:"coder-config apply # Generate .mcp.json from config"}),r.jsx("p",{children:"coder-config show # Show current project config"})]})]})]})}function zz(){const[e,t]=S.useState(null),[n,s]=S.useState(!0);S.useEffect(()=>{o()},[]);const o=async()=>{try{s(!0);const d=await ye.getGeminiSettings();t(d.settings)}catch(d){console.error("Failed to load Gemini settings:",d)}finally{s(!1)}},u=async d=>{try{await ye.saveGeminiSettings(d),t(d),ee.success("Gemini CLI settings saved!")}catch(l){ee.error("Failed to save settings: "+l.message)}};return n?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(it,{className:"w-8 h-8 animate-spin text-blue-600"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-6 shadow-sm",children:r.jsx(Bj,{settings:e,onSave:u,loading:n,settingsPath:"~/.gemini/settings.json"})}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{children:"coder-config apply # Generate settings for all tools"}),r.jsx("p",{children:"coder-config apply --gemini # Generate Gemini settings only"})]})]})]})}const Hz=[{id:"off",name:"Off",description:"Never auto-execute; requires allow list"},{id:"auto",name:"Auto",description:"Safety model determines execution"},{id:"turbo",name:"Turbo",description:"Auto-execute unless in deny list",dangerous:!0}],Wz=[{id:"always-proceed",name:"Always Proceed",description:"Agent never requests review"},{id:"agent-decides",name:"Agent Decides",description:"Agent determines when review is needed"},{id:"request-review",name:"Request Review",description:"Agent always requests review"}],Vz=[{id:"always-proceed",name:"Always Proceed",description:"Maximum autonomy",dangerous:!0},{id:"request-review",name:"Request Review",description:"Ask before browser JavaScript"},{id:"disabled",name:"Disabled",description:"Never run browser JavaScript"}];function Uz({settings:e,onSave:t,loading:n,settingsPath:s}){const[o,u]=S.useState(e||{}),[d,l]=S.useState(!1),[c,f]=S.useState("rich"),[m,h]=S.useState(JSON.stringify(e||{},null,2)),[x,w]=S.useState({open:!1,name:"",json:""}),[k,_]=S.useState({}),y=async()=>{l(!0);try{if(c==="json")try{const P=JSON.parse(m);await t(P),u(P)}catch{ee.error("Invalid JSON"),l(!1);return}else await t(o),h(JSON.stringify(o,null,2));ee.success("Settings saved")}finally{l(!1)}},v=(P,N)=>{u(R=>({...R,[P]:N}))},g=(P,N)=>(o==null?void 0:o[P])??N,b=o.mcpServers||{},j=()=>{const{name:P,json:N}=x;if(!P.trim()){ee.error("Please enter a name for the MCP");return}let R;try{R=JSON.parse(N)}catch{ee.error("Invalid JSON configuration");return}if(!R.command){ee.error('MCP config must have a "command" field');return}u(I=>({...I,mcpServers:{...I.mcpServers,[P.trim()]:R}})),w({open:!1,name:"",json:""}),ee.success(`Added MCP: ${P}`)},E=P=>{u(N=>{const{[P]:R,...I}=N.mcpServers||{};return{...N,mcpServers:I}}),ee.success(`Removed MCP: ${P}`)},A=P=>{_(N=>({...N,[P]:!N[P]}))};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-500/10 flex items-center justify-center",children:r.jsx(kl,{className:"w-5 h-5 text-purple-500"})}),r.jsxs("div",{children:[r.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:["Antigravity Settings",r.jsx(Je,{variant:"outline",className:"text-xs font-normal text-purple-600 border-purple-300 dark:border-purple-700",children:"Google"})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Stored in: ",r.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs",children:s})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex bg-muted rounded-lg p-1",children:[r.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${c==="rich"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>f("rich"),children:"Settings"}),r.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${c==="json"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>{h(JSON.stringify(o,null,2)),f("json")},children:"JSON"})]}),r.jsxs(le,{onClick:y,disabled:d||n,children:[d?r.jsx(it,{className:"w-4 h-4 mr-2 animate-spin"}):r.jsx(hi,{className:"w-4 h-4 mr-2"}),"Save"]})]})]}),c==="json"?r.jsx("div",{className:"border border-border rounded-lg bg-card overflow-hidden",children:r.jsx(ft,{value:m,onChange:P=>h(P.target.value),className:"font-mono text-sm min-h-[500px] border-0 rounded-none resize-none",placeholder:"{ }"})}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(ls,{className:"w-4 h-4 text-purple-500"}),"Security Policies"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Terminal Command Execution"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Control how the agent executes shell commands"})]}),r.jsxs(gr,{value:g("terminalPolicy","auto"),onValueChange:P=>v("terminalPolicy",P),children:[r.jsx(ur,{className:"w-44",children:r.jsx(xr,{})}),r.jsx(dr,{children:Hz.map(P=>r.jsx(_t,{value:P.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:P.name}),P.dangerous&&r.jsx(Je,{variant:"destructive",className:"text-xs",children:"Risk"})]})},P.id))})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"Review Policy"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"When the agent should request human review"})]}),r.jsxs(gr,{value:g("reviewPolicy","agent-decides"),onValueChange:P=>v("reviewPolicy",P),children:[r.jsx(ur,{className:"w-44",children:r.jsx(xr,{})}),r.jsx(dr,{children:Wz.map(P=>r.jsx(_t,{value:P.id,children:P.name},P.id))})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"JavaScript Execution"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Control browser JavaScript execution"})]}),r.jsxs(gr,{value:g("jsPolicy","request-review"),onValueChange:P=>v("jsPolicy",P),children:[r.jsx(ur,{className:"w-44",children:r.jsx(xr,{})}),r.jsx(dr,{children:Vz.map(P=>r.jsx(_t,{value:P.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:P.name}),P.dangerous&&r.jsx(Je,{variant:"destructive",className:"text-xs",children:"Risk"})]})},P.id))})]})]})]})]}),r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[r.jsx($n,{className:"w-4 h-4 text-purple-500"}),"MCP Servers",r.jsx(Je,{variant:"secondary",className:"text-xs",children:Object.keys(b).length})]}),r.jsxs(le,{size:"sm",variant:"outline",onClick:()=>w({open:!0,name:"",json:`{
|
|
622
622
|
"command": "npx",
|
|
623
623
|
"args": ["-y", "@example/mcp-server"]
|
|
624
624
|
}`}),children:[r.jsx(vt,{className:"w-4 h-4 mr-1"}),"Add MCP"]})]}),r.jsx("div",{className:"space-y-2",children:Object.keys(b).length===0?r.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No MCP servers configured"}):Object.entries(b).map(([P,N])=>r.jsxs(Ol,{open:k[P],onOpenChange:()=>A(P),children:[r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-background group",children:[r.jsxs(Bl,{className:"flex items-center gap-2 flex-1 text-left",children:[k[P]?r.jsx(vr,{className:"w-4 h-4 text-muted-foreground"}):r.jsx(Hr,{className:"w-4 h-4 text-muted-foreground"}),r.jsx($n,{className:"w-4 h-4 text-purple-500"}),r.jsx("span",{className:"font-medium text-sm",children:P}),r.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:N.command})]}),r.jsx(le,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 text-destructive hover:text-destructive",onClick:()=>E(P),children:r.jsx(mn,{className:"w-4 h-4"})})]}),r.jsx(Fl,{children:r.jsx("div",{className:"mt-2 ml-6 p-3 rounded-lg bg-muted/50 border",children:r.jsx("pre",{className:"text-xs font-mono text-muted-foreground overflow-x-auto",children:JSON.stringify(N,null,2)})})})]},P))})]}),r.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[r.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[r.jsx(Fi,{className:"w-4 h-4 text-purple-500"}),"Browser Settings"]}),r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-foreground",children:"URL Allowlist"}),r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Domains the agent can visit (one per line)"}),r.jsx(ft,{value:g("browserAllowlist",""),onChange:P=>v("browserAllowlist",P.target.value),placeholder:`github.com
|
package/ui/dist/index.html
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
<!-- PWA Manifest -->
|
|
21
21
|
<link rel="manifest" href="/manifest.json">
|
|
22
|
-
<script type="module" crossorigin src="/assets/index-
|
|
22
|
+
<script type="module" crossorigin src="/assets/index-58WNljjI.js"></script>
|
|
23
23
|
<link rel="stylesheet" crossorigin href="/assets/index-ClOpkZec.css">
|
|
24
24
|
</head>
|
|
25
25
|
<body>
|
package/ui/routes/updates.js
CHANGED
|
@@ -249,7 +249,7 @@ async function performNpmUpdate(targetVersion) {
|
|
|
249
249
|
success: true,
|
|
250
250
|
updateMethod: 'npm',
|
|
251
251
|
newVersion: targetVersion || 'latest',
|
|
252
|
-
message: 'Updated via npm.
|
|
252
|
+
message: 'Updated via npm. Server will restart automatically.'
|
|
253
253
|
};
|
|
254
254
|
} catch (error) {
|
|
255
255
|
const isEtarget = error.message.includes('ETARGET') || error.message.includes('No matching version');
|