@agimon-ai/doompi 0.0.1-alpha.35 → 0.0.1-alpha.36

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.
Files changed (49) hide show
  1. package/dist/services/compatibility/shared.cjs +1 -1
  2. package/dist/services/compatibility/shared.d.cts +2 -2
  3. package/dist/services/compatibility/shared.d.mts +2 -2
  4. package/dist/services/compatibility/shared.mjs +1 -1
  5. package/dist/src/adapters/compatibility/antigravity.cjs +1 -1
  6. package/dist/src/adapters/compatibility/antigravity.cjs.map +1 -1
  7. package/dist/src/adapters/compatibility/antigravity.d.cts.map +1 -1
  8. package/dist/src/adapters/compatibility/antigravity.d.mts.map +1 -1
  9. package/dist/src/adapters/compatibility/antigravity.mjs +1 -1
  10. package/dist/src/adapters/compatibility/antigravity.mjs.map +1 -1
  11. package/dist/src/adapters/compatibility/codex.cjs +1 -1
  12. package/dist/src/adapters/compatibility/codex.cjs.map +1 -1
  13. package/dist/src/adapters/compatibility/codex.d.cts.map +1 -1
  14. package/dist/src/adapters/compatibility/codex.d.mts.map +1 -1
  15. package/dist/src/adapters/compatibility/codex.mjs +1 -1
  16. package/dist/src/adapters/compatibility/codex.mjs.map +1 -1
  17. package/dist/src/adapters/compatibility/index.cjs +1 -1
  18. package/dist/src/adapters/compatibility/index.cjs.map +1 -1
  19. package/dist/src/adapters/compatibility/index.d.cts.map +1 -1
  20. package/dist/src/adapters/compatibility/index.d.mts.map +1 -1
  21. package/dist/src/adapters/compatibility/index.mjs +1 -1
  22. package/dist/src/adapters/compatibility/index.mjs.map +1 -1
  23. package/dist/src/adapters/compatibility/shared.cjs +1 -1
  24. package/dist/src/adapters/compatibility/shared.cjs.map +1 -1
  25. package/dist/src/adapters/compatibility/shared.d.cts +12 -3
  26. package/dist/src/adapters/compatibility/shared.d.cts.map +1 -1
  27. package/dist/src/adapters/compatibility/shared.d.mts +12 -3
  28. package/dist/src/adapters/compatibility/shared.d.mts.map +1 -1
  29. package/dist/src/adapters/compatibility/shared.mjs +1 -1
  30. package/dist/src/adapters/compatibility/shared.mjs.map +1 -1
  31. package/dist/src/adapters/layerPackageInstaller.cjs +2 -2
  32. package/dist/src/adapters/layerPackageInstaller.cjs.map +1 -1
  33. package/dist/src/adapters/layerPackageInstaller.mjs +2 -2
  34. package/dist/src/adapters/layerPackageInstaller.mjs.map +1 -1
  35. package/dist/src/commands/cli/compatibilityOptions.cjs +1 -1
  36. package/dist/src/commands/cli/compatibilityOptions.cjs.map +1 -1
  37. package/dist/src/commands/cli/compatibilityOptions.d.cts.map +1 -1
  38. package/dist/src/commands/cli/compatibilityOptions.d.mts.map +1 -1
  39. package/dist/src/commands/cli/compatibilityOptions.mjs +1 -1
  40. package/dist/src/commands/cli/compatibilityOptions.mjs.map +1 -1
  41. package/dist/src/commands/cli/help.cjs +6 -2
  42. package/dist/src/commands/cli/help.cjs.map +1 -1
  43. package/dist/src/commands/cli/help.mjs +6 -2
  44. package/dist/src/commands/cli/help.mjs.map +1 -1
  45. package/dist/src/types/interfaces/compatibility.d.cts +9 -0
  46. package/dist/src/types/interfaces/compatibility.d.cts.map +1 -1
  47. package/dist/src/types/interfaces/compatibility.d.mts +9 -0
  48. package/dist/src/types/interfaces/compatibility.d.mts.map +1 -1
  49. package/package.json +21 -13
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../src/adapters/compatibility/shared.cjs");exports.ADD_DIRECTORY_OPTION=e.ADD_DIRECTORY_OPTION,exports.AGIFLOW_PROXY_SERVER_NAME=e.AGIFLOW_PROXY_SERVER_NAME,exports.ANTIGRAVITY_MCP_PROXY_PACKAGE=e.ANTIGRAVITY_MCP_PROXY_PACKAGE,exports.CORE_PLUGIN_NAME=e.CORE_PLUGIN_NAME,exports.MCP_CONFIG_OPTION=e.MCP_CONFIG_OPTION,exports.MCP_PRESTART_OPTION=e.MCP_PRESTART_OPTION,exports.MCP_PROXY_PACKAGE=e.MCP_PROXY_PACKAGE,exports.MCP_SERVERS_KEY=e.MCP_SERVERS_KEY,exports.NPX_COMMAND=e.NPX_COMMAND,exports.PLUGINS_DIRECTORY=e.PLUGINS_DIRECTORY,exports.PLUGIN_MANIFEST_FILENAME=e.PLUGIN_MANIFEST_FILENAME,exports.SKILLS_DIRECTORY=e.SKILLS_DIRECTORY,exports.SKIP_PERMISSIONS_OPTION=e.SKIP_PERMISSIONS_OPTION,exports.additionalDirectoryArgs=e.additionalDirectoryArgs,exports.mcpProxyArguments=e.mcpProxyArguments;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../src/adapters/compatibility/shared.cjs");exports.ADD_DIRECTORY_OPTION=e.ADD_DIRECTORY_OPTION,exports.AGIFLOW_PROXY_SERVER_NAME=e.AGIFLOW_PROXY_SERVER_NAME,exports.ANTIGRAVITY_MCP_PROXY_PACKAGE=e.ANTIGRAVITY_MCP_PROXY_PACKAGE,exports.CORE_PLUGIN_NAME=e.CORE_PLUGIN_NAME,exports.MCP_CONFIG_OPTION=e.MCP_CONFIG_OPTION,exports.MCP_PRESTART_OPTION=e.MCP_PRESTART_OPTION,exports.MCP_PROXY_PACKAGE=e.MCP_PROXY_PACKAGE,exports.MCP_PROXY_VERSION=e.MCP_PROXY_VERSION,exports.MCP_SERVERS_KEY=e.MCP_SERVERS_KEY,exports.NPX_COMMAND=e.NPX_COMMAND,exports.PLUGINS_DIRECTORY=e.PLUGINS_DIRECTORY,exports.PLUGIN_MANIFEST_FILENAME=e.PLUGIN_MANIFEST_FILENAME,exports.SKILLS_DIRECTORY=e.SKILLS_DIRECTORY,exports.SKIP_PERMISSIONS_OPTION=e.SKIP_PERMISSIONS_OPTION,exports.additionalDirectoryArgs=e.additionalDirectoryArgs,exports.mcpProxyArguments=e.mcpProxyArguments;
@@ -1,2 +1,2 @@
1
- import { ADD_DIRECTORY_OPTION, AGIFLOW_PROXY_SERVER_NAME, ANTIGRAVITY_MCP_PROXY_PACKAGE, CORE_PLUGIN_NAME, MCP_CONFIG_OPTION, MCP_PRESTART_OPTION, MCP_PROXY_PACKAGE, MCP_SERVERS_KEY, NPX_COMMAND, PLUGINS_DIRECTORY, PLUGIN_MANIFEST_FILENAME, SKILLS_DIRECTORY, SKIP_PERMISSIONS_OPTION, additionalDirectoryArgs, mcpProxyArguments } from "../../src/adapters/compatibility/shared.cjs";
2
- export { ADD_DIRECTORY_OPTION, AGIFLOW_PROXY_SERVER_NAME, ANTIGRAVITY_MCP_PROXY_PACKAGE, CORE_PLUGIN_NAME, MCP_CONFIG_OPTION, MCP_PRESTART_OPTION, MCP_PROXY_PACKAGE, MCP_SERVERS_KEY, NPX_COMMAND, PLUGINS_DIRECTORY, PLUGIN_MANIFEST_FILENAME, SKILLS_DIRECTORY, SKIP_PERMISSIONS_OPTION, additionalDirectoryArgs, mcpProxyArguments };
1
+ import { ADD_DIRECTORY_OPTION, AGIFLOW_PROXY_SERVER_NAME, ANTIGRAVITY_MCP_PROXY_PACKAGE, CORE_PLUGIN_NAME, MCP_CONFIG_OPTION, MCP_PRESTART_OPTION, MCP_PROXY_PACKAGE, MCP_PROXY_VERSION, MCP_SERVERS_KEY, NPX_COMMAND, PLUGINS_DIRECTORY, PLUGIN_MANIFEST_FILENAME, SKILLS_DIRECTORY, SKIP_PERMISSIONS_OPTION, additionalDirectoryArgs, mcpProxyArguments } from "../../src/adapters/compatibility/shared.cjs";
2
+ export { ADD_DIRECTORY_OPTION, AGIFLOW_PROXY_SERVER_NAME, ANTIGRAVITY_MCP_PROXY_PACKAGE, CORE_PLUGIN_NAME, MCP_CONFIG_OPTION, MCP_PRESTART_OPTION, MCP_PROXY_PACKAGE, MCP_PROXY_VERSION, MCP_SERVERS_KEY, NPX_COMMAND, PLUGINS_DIRECTORY, PLUGIN_MANIFEST_FILENAME, SKILLS_DIRECTORY, SKIP_PERMISSIONS_OPTION, additionalDirectoryArgs, mcpProxyArguments };
@@ -1,2 +1,2 @@
1
- import { ADD_DIRECTORY_OPTION, AGIFLOW_PROXY_SERVER_NAME, ANTIGRAVITY_MCP_PROXY_PACKAGE, CORE_PLUGIN_NAME, MCP_CONFIG_OPTION, MCP_PRESTART_OPTION, MCP_PROXY_PACKAGE, MCP_SERVERS_KEY, NPX_COMMAND, PLUGINS_DIRECTORY, PLUGIN_MANIFEST_FILENAME, SKILLS_DIRECTORY, SKIP_PERMISSIONS_OPTION, additionalDirectoryArgs, mcpProxyArguments } from "../../src/adapters/compatibility/shared.mjs";
2
- export { ADD_DIRECTORY_OPTION, AGIFLOW_PROXY_SERVER_NAME, ANTIGRAVITY_MCP_PROXY_PACKAGE, CORE_PLUGIN_NAME, MCP_CONFIG_OPTION, MCP_PRESTART_OPTION, MCP_PROXY_PACKAGE, MCP_SERVERS_KEY, NPX_COMMAND, PLUGINS_DIRECTORY, PLUGIN_MANIFEST_FILENAME, SKILLS_DIRECTORY, SKIP_PERMISSIONS_OPTION, additionalDirectoryArgs, mcpProxyArguments };
1
+ import { ADD_DIRECTORY_OPTION, AGIFLOW_PROXY_SERVER_NAME, ANTIGRAVITY_MCP_PROXY_PACKAGE, CORE_PLUGIN_NAME, MCP_CONFIG_OPTION, MCP_PRESTART_OPTION, MCP_PROXY_PACKAGE, MCP_PROXY_VERSION, MCP_SERVERS_KEY, NPX_COMMAND, PLUGINS_DIRECTORY, PLUGIN_MANIFEST_FILENAME, SKILLS_DIRECTORY, SKIP_PERMISSIONS_OPTION, additionalDirectoryArgs, mcpProxyArguments } from "../../src/adapters/compatibility/shared.mjs";
2
+ export { ADD_DIRECTORY_OPTION, AGIFLOW_PROXY_SERVER_NAME, ANTIGRAVITY_MCP_PROXY_PACKAGE, CORE_PLUGIN_NAME, MCP_CONFIG_OPTION, MCP_PRESTART_OPTION, MCP_PROXY_PACKAGE, MCP_PROXY_VERSION, MCP_SERVERS_KEY, NPX_COMMAND, PLUGINS_DIRECTORY, PLUGIN_MANIFEST_FILENAME, SKILLS_DIRECTORY, SKIP_PERMISSIONS_OPTION, additionalDirectoryArgs, mcpProxyArguments };
@@ -1 +1 @@
1
- import{ADD_DIRECTORY_OPTION as e,AGIFLOW_PROXY_SERVER_NAME as t,ANTIGRAVITY_MCP_PROXY_PACKAGE as n,CORE_PLUGIN_NAME as r,MCP_CONFIG_OPTION as i,MCP_PRESTART_OPTION as a,MCP_PROXY_PACKAGE as o,MCP_SERVERS_KEY as s,NPX_COMMAND as c,PLUGINS_DIRECTORY as l,PLUGIN_MANIFEST_FILENAME as u,SKILLS_DIRECTORY as d,SKIP_PERMISSIONS_OPTION as f,additionalDirectoryArgs as p,mcpProxyArguments as m}from"../../src/adapters/compatibility/shared.mjs";export{e as ADD_DIRECTORY_OPTION,t as AGIFLOW_PROXY_SERVER_NAME,n as ANTIGRAVITY_MCP_PROXY_PACKAGE,r as CORE_PLUGIN_NAME,i as MCP_CONFIG_OPTION,a as MCP_PRESTART_OPTION,o as MCP_PROXY_PACKAGE,s as MCP_SERVERS_KEY,c as NPX_COMMAND,l as PLUGINS_DIRECTORY,u as PLUGIN_MANIFEST_FILENAME,d as SKILLS_DIRECTORY,f as SKIP_PERMISSIONS_OPTION,p as additionalDirectoryArgs,m as mcpProxyArguments};
1
+ import{ADD_DIRECTORY_OPTION as e,AGIFLOW_PROXY_SERVER_NAME as t,ANTIGRAVITY_MCP_PROXY_PACKAGE as n,CORE_PLUGIN_NAME as r,MCP_CONFIG_OPTION as i,MCP_PRESTART_OPTION as a,MCP_PROXY_PACKAGE as o,MCP_PROXY_VERSION as s,MCP_SERVERS_KEY as c,NPX_COMMAND as l,PLUGINS_DIRECTORY as u,PLUGIN_MANIFEST_FILENAME as d,SKILLS_DIRECTORY as f,SKIP_PERMISSIONS_OPTION as p,additionalDirectoryArgs as m,mcpProxyArguments as h}from"../../src/adapters/compatibility/shared.mjs";export{e as ADD_DIRECTORY_OPTION,t as AGIFLOW_PROXY_SERVER_NAME,n as ANTIGRAVITY_MCP_PROXY_PACKAGE,r as CORE_PLUGIN_NAME,i as MCP_CONFIG_OPTION,a as MCP_PRESTART_OPTION,o as MCP_PROXY_PACKAGE,s as MCP_PROXY_VERSION,c as MCP_SERVERS_KEY,l as NPX_COMMAND,u as PLUGINS_DIRECTORY,d as PLUGIN_MANIFEST_FILENAME,f as SKILLS_DIRECTORY,p as SKIP_PERMISSIONS_OPTION,m as additionalDirectoryArgs,h as mcpProxyArguments};
@@ -1,2 +1,2 @@
1
- const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../serialization/json.cjs"),n=require("./process.cjs"),r=require("./shared.cjs");let i=require("node:path");i=e.__toESM(i,1);let a=require("node:fs");a=e.__toESM(a,1);const o=`.doom-pi-managed.json`,s=`mcp-proxy`,c=`project-mcp`,l=`pencil`,u=`.agents`,d=`_agents`,f=`mcp_config.json`,p=`hooks.json`,m=`plugins`,h=`.gemini`,g=`antigravity-cli`;function _(e,t){if(typeof e.command==`string`){let n={...e,command:e.command,args:Array.isArray(e.args)?e.args.map(String):[],cwd:typeof e.cwd==`string`?e.cwd:t};return delete n.type,n}let n=typeof e.url==`string`?e.url:void 0;if(!n)return;let r={...e,serverUrl:n};return delete r.type,delete r.url,r}function v(e){let n=e.options.repoRoot,d=i.default.join(n,u,f),p=i.default.join(n,u,o),m=t.readJson(d),g=m[r.MCP_SERVERS_KEY],v=t.isRecord(g)?{...g}:{},y=t.readJson(p),b=y[r.MCP_SERVERS_KEY],x=Array.isArray(b)?b.map(String):[];for(let e of new Set([...x,s,c,l]))delete v[e];let S=t.readJson(e.mcpConfigPath)[r.MCP_SERVERS_KEY],C=t.isRecord(S)?S:{},w=e.mcpAllowlist?.servers,T=e=>!w||w.length===0||w.includes(e),E=[];T(`agiflow-proxy`)&&(v[s]={command:`npx`,args:r.mcpProxyArguments(r.ANTIGRAVITY_MCP_PROXY_PACKAGE,e.proxyConfigPath,!0),cwd:n,timeout:12e5},E.push(s));let D=e.mcpAllowlist?w??[]:[c,l];for(let e of D){if(e===`agiflow-proxy`)continue;let r=C[e];if(!t.isRecord(r))continue;let i=_(r,n);i&&(v[e]=i,E.push(e))}t.writeJson(d,{...m,[r.MCP_SERVERS_KEY]:v}),t.writeJson(p,{...y,[r.MCP_SERVERS_KEY]:E});let O=e.environment.HOME;if(O)for(let e of[i.default.join(O,h,`config`,f),i.default.join(O,h,`config`,r.PLUGINS_DIRECTORY,`shared`,f)]){if(!a.default.existsSync(e))continue;let n=t.readJson(e),i=n[r.MCP_SERVERS_KEY],o=t.isRecord(i)?{...i}:{};for(let e of[s,r.AGIFLOW_PROXY_SERVER_NAME,c,l])delete o[e];t.writeJson(e,{...n,[r.MCP_SERVERS_KEY]:o})}}function y(e){return i.default.join(e,h,g,`settings.json`)}function b(e){let n=e.environment.HOME;if(!n)throw Error(`HOME is required for Antigravity compatibility`);let r=y(n),i=t.readJson(r);i.model||=e.environment.AGY_MODEL??`Gemini 3.5 Flash`;let a=Array.isArray(i.trustedWorkspaces)?i.trustedWorkspaces.map(String):[];a.includes(e.options.repoRoot)||a.push(e.options.repoRoot),i.trustedWorkspaces=a,t.writeJson(r,i)}function x(e){let t=a.default.lstatSync(e,{throwIfNoEntry:!1});if(t&&!t.isDirectory())throw Error(`Refusing to use unmanaged Antigravity path: ${e}`);t||a.default.mkdirSync(e,{recursive:!0})}function S(e,t){if(a.default.existsSync(e)||a.default.lstatSync(e,{throwIfNoEntry:!1})){if(!a.default.lstatSync(e).isSymbolicLink())throw Error(`Refusing to replace unmanaged Antigravity path: ${e}`);a.default.rmSync(e,{force:!0})}a.default.symlinkSync(t,e,`dir`)}function C(e){let s=e.options.repoRoot,c=i.default.join(s,r.PLUGINS_DIRECTORY),l=i.default.join(s,d),f=i.default.join(l,r.PLUGINS_DIRECTORY),p=i.default.join(s,u,o),h=t.readJson(p),g=h[m],_=new Set(Array.isArray(g)?g.map(String):[]);x(l),x(f);let v=new Set;for(let n of e.plugins){let e=i.default.join(n.directory,`.codex-plugin`,r.PLUGIN_MANIFEST_FILENAME);if(!a.default.existsSync(e))continue;let o=t.readJson(e),s=typeof o.name==`string`&&o.name?o.name:i.default.basename(n.directory);if(s===`.`||s===`..`||s.toLowerCase()===`core`||s.includes(`/`)||s.includes(`\\`))throw Error(`Invalid Antigravity plugin name: ${s}`);let c=i.default.join(f,s);v.add(s),x(c),t.writeJson(i.default.join(c,r.PLUGIN_MANIFEST_FILENAME),{name:s});let l=i.default.join(n.directory,r.SKILLS_DIRECTORY),u=i.default.join(c,r.SKILLS_DIRECTORY);a.default.existsSync(l)?S(u,l):a.default.lstatSync(u,{throwIfNoEntry:!1})?.isSymbolicLink()&&a.default.rmSync(u,{force:!0})}for(let e of a.default.readdirSync(f,{withFileTypes:!0})){if(e.name===`core`||v.has(e.name))continue;let t=i.default.join(f,e.name);if(_.has(e.name)){a.default.rmSync(t,{recursive:!0,force:!0});continue}if(!e.isDirectory())continue;let o=i.default.join(t,r.SKILLS_DIRECTORY);if(!a.default.lstatSync(o,{throwIfNoEntry:!1})?.isSymbolicLink())continue;let s=i.default.resolve(i.default.dirname(o),a.default.readlinkSync(o));n.pathInside(c,s)&&a.default.rmSync(t,{recursive:!0,force:!0})}t.writeJson(p,{...h,[m]:[...v]})}function w(e){t.readJson(i.default.join(e,`plugin.json`)).name===`core`&&a.default.rmSync(e,{recursive:!0,force:!0})}function T(e){let n=i.default.join(e.options.repoRoot,d,r.PLUGINS_DIRECTORY,r.CORE_PLUGIN_NAME);if(a.default.lstatSync(n,{throwIfNoEntry:!1})?.isSymbolicLink())throw Error(`Refusing to use unmanaged Antigravity path: ${n}`);if(!e.sharedSkills){w(n);return}let o=i.default.join(e.options.repoRoot,`.claude`,r.SKILLS_DIRECTORY);if(!a.default.existsSync(o)){w(n);return}x(n);let s=i.default.join(n,r.SKILLS_DIRECTORY);x(s),t.writeJson(i.default.join(n,r.PLUGIN_MANIFEST_FILENAME),{name:r.CORE_PLUGIN_NAME});let c=new Set;for(let e of a.default.readdirSync(o,{withFileTypes:!0}))e.isDirectory()&&(c.add(e.name),S(i.default.join(s,e.name),i.default.join(o,e.name)));for(let e of a.default.readdirSync(s)){if(c.has(e))continue;let t=i.default.join(s,e);a.default.lstatSync(t).isSymbolicLink()&&a.default.rmSync(t,{force:!0})}}function E(e){let n=i.default.join(e.options.repoRoot,`.antigravity-local`,p),r=i.default.join(e.options.repoRoot,u,p),s=i.default.join(e.options.repoRoot,u,o),c=t.readJson(s);if(!a.default.existsSync(n)){c.hooks===!0&&a.default.rmSync(r,{force:!0}),t.writeJson(s,{...c,hooks:!1});return}let l=a.default.readFileSync(n,`utf8`).replaceAll(`$AGY_REPO_ROOT`,e.options.repoRoot),d=a.default.lstatSync(r,{throwIfNoEntry:!1});if(d&&c.hooks!==!0&&(!d.isFile()||a.default.readFileSync(r,`utf8`)!==l))throw Error(`Refusing to replace unmanaged Antigravity path: ${r}`);t.writeFileAtomic(r,l),t.writeJson(s,{...c,hooks:!0})}function D(e){return[r.SKIP_PERMISSIONS_OPTION,...r.additionalDirectoryArgs(e),...e.options.providerArgs]}async function O(e){let t=e.environment.HOME;if(!t)throw Error(`HOME is required for Antigravity compatibility`);let r=i.default.join(t,h,g,`.doom-pi-sync.lock`),a=await n.acquireDirectoryLock(r);try{v(e),b(e),C(e),T(e),E(e)}finally{await a()}return n.runInteractive(`agy`,D(e),e.options.repoRoot,e.environment)}exports.adaptAntigravityMcpDefinition=_,exports.antigravityCompatibilityArgs=D,exports.launchAntigravity=O;
1
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../serialization/json.cjs"),n=require("./process.cjs"),r=require("./shared.cjs");let i=require("node:path");i=e.__toESM(i,1);let a=require("node:fs");a=e.__toESM(a,1);const o=`.doom-pi-managed.json`,s=`mcp-proxy`,c=`project-mcp`,l=`pencil`,u=`.agents`,d=`_agents`,f=`mcp_config.json`,p=`hooks.json`,m=`plugins`,h=`.gemini`,g=`antigravity-cli`;function _(e,t){if(typeof e.command==`string`){let n={...e,command:e.command,args:Array.isArray(e.args)?e.args.map(String):[],cwd:typeof e.cwd==`string`?e.cwd:t};return delete n.type,n}let n=typeof e.url==`string`?e.url:void 0;if(!n)return;let r={...e,serverUrl:n};return delete r.type,delete r.url,r}function v(e){let n=e.options.repoRoot,d=i.default.join(n,u,f),p=i.default.join(n,u,o),m=t.readJson(d),g=m[r.MCP_SERVERS_KEY],v=t.isRecord(g)?{...g}:{},y=t.readJson(p),b=y[r.MCP_SERVERS_KEY],x=Array.isArray(b)?b.map(String):[];for(let e of new Set([...x,s,c,l]))delete v[e];let S=t.readJson(e.mcpConfigPath)[r.MCP_SERVERS_KEY],C=t.isRecord(S)?S:{},w=e.mcpAllowlist?.servers,T=e=>!w||w.length===0||w.includes(e),E=[];T(`agiflow-proxy`)&&(v[s]={command:`npx`,args:r.mcpProxyArguments(r.ANTIGRAVITY_MCP_PROXY_PACKAGE,e.proxyConfigPath,!0),cwd:n,timeout:12e5},E.push(s));let D=e.mcpAllowlist?w??[]:[c,l];for(let e of D){if(e===`agiflow-proxy`)continue;let r=C[e];if(!t.isRecord(r))continue;let i=_(r,n);i&&(v[e]=i,E.push(e))}t.writeJson(d,{...m,[r.MCP_SERVERS_KEY]:v}),t.writeJson(p,{...y,[r.MCP_SERVERS_KEY]:E});let O=e.environment.HOME;if(O)for(let e of[i.default.join(O,h,`config`,f),i.default.join(O,h,`config`,r.PLUGINS_DIRECTORY,`shared`,f)]){if(!a.default.existsSync(e))continue;let n=t.readJson(e),i=n[r.MCP_SERVERS_KEY],o=t.isRecord(i)?{...i}:{};for(let e of[s,r.AGIFLOW_PROXY_SERVER_NAME,c,l])delete o[e];t.writeJson(e,{...n,[r.MCP_SERVERS_KEY]:o})}}function y(e){return i.default.join(e,h,g,`settings.json`)}function b(e){let n=e.environment.HOME;if(!n)throw Error(`HOME is required for Antigravity compatibility`);let r=y(n),i=t.readJson(r);i.model||=e.environment.AGY_MODEL??`Gemini 3.5 Flash`;let a=Array.isArray(i.trustedWorkspaces)?i.trustedWorkspaces.map(String):[];a.includes(e.options.repoRoot)||(a.push(e.options.repoRoot),process.stderr.write(`[doompi] trusting ${e.options.repoRoot} in ${r}\n`)),i.trustedWorkspaces=a,t.writeJson(r,i)}function x(e){let t=a.default.lstatSync(e,{throwIfNoEntry:!1});if(t&&!t.isDirectory())throw Error(`Refusing to use unmanaged Antigravity path: ${e}`);t||a.default.mkdirSync(e,{recursive:!0})}function S(e,t){if(a.default.existsSync(e)||a.default.lstatSync(e,{throwIfNoEntry:!1})){if(!a.default.lstatSync(e).isSymbolicLink())throw Error(`Refusing to replace unmanaged Antigravity path: ${e}`);a.default.rmSync(e,{force:!0})}a.default.symlinkSync(t,e,`dir`)}function C(e){let s=e.options.repoRoot,c=i.default.join(s,r.PLUGINS_DIRECTORY),l=i.default.join(s,d),f=i.default.join(l,r.PLUGINS_DIRECTORY),p=i.default.join(s,u,o),h=t.readJson(p),g=h[m],_=new Set(Array.isArray(g)?g.map(String):[]);x(l),x(f);let v=new Set;for(let n of e.plugins){let e=i.default.join(n.directory,`.codex-plugin`,r.PLUGIN_MANIFEST_FILENAME);if(!a.default.existsSync(e))continue;let o=t.readJson(e),s=typeof o.name==`string`&&o.name?o.name:i.default.basename(n.directory);if(s===`.`||s===`..`||s.toLowerCase()===`core`||s.includes(`/`)||s.includes(`\\`))throw Error(`Invalid Antigravity plugin name: ${s}`);let c=i.default.join(f,s);v.add(s),x(c),t.writeJson(i.default.join(c,r.PLUGIN_MANIFEST_FILENAME),{name:s});let l=i.default.join(n.directory,r.SKILLS_DIRECTORY),u=i.default.join(c,r.SKILLS_DIRECTORY);a.default.existsSync(l)?S(u,l):a.default.lstatSync(u,{throwIfNoEntry:!1})?.isSymbolicLink()&&a.default.rmSync(u,{force:!0})}for(let e of a.default.readdirSync(f,{withFileTypes:!0})){if(e.name===`core`||v.has(e.name))continue;let t=i.default.join(f,e.name);if(_.has(e.name)){a.default.rmSync(t,{recursive:!0,force:!0});continue}if(!e.isDirectory())continue;let o=i.default.join(t,r.SKILLS_DIRECTORY);if(!a.default.lstatSync(o,{throwIfNoEntry:!1})?.isSymbolicLink())continue;let s=i.default.resolve(i.default.dirname(o),a.default.readlinkSync(o));n.pathInside(c,s)&&a.default.rmSync(t,{recursive:!0,force:!0})}t.writeJson(p,{...h,[m]:[...v]})}function w(e){t.readJson(i.default.join(e,`plugin.json`)).name===`core`&&a.default.rmSync(e,{recursive:!0,force:!0})}function T(e){let n=i.default.join(e.options.repoRoot,d,r.PLUGINS_DIRECTORY,r.CORE_PLUGIN_NAME);if(a.default.lstatSync(n,{throwIfNoEntry:!1})?.isSymbolicLink())throw Error(`Refusing to use unmanaged Antigravity path: ${n}`);if(!e.sharedSkills){w(n);return}let o=i.default.join(e.options.repoRoot,`.claude`,r.SKILLS_DIRECTORY);if(!a.default.existsSync(o)){w(n);return}x(n);let s=i.default.join(n,r.SKILLS_DIRECTORY);x(s),t.writeJson(i.default.join(n,r.PLUGIN_MANIFEST_FILENAME),{name:r.CORE_PLUGIN_NAME});let c=new Set;for(let e of a.default.readdirSync(o,{withFileTypes:!0}))e.isDirectory()&&(c.add(e.name),S(i.default.join(s,e.name),i.default.join(o,e.name)));for(let e of a.default.readdirSync(s)){if(c.has(e))continue;let t=i.default.join(s,e);a.default.lstatSync(t).isSymbolicLink()&&a.default.rmSync(t,{force:!0})}}function E(e){let n=i.default.join(e.options.repoRoot,`.antigravity-local`,p),r=i.default.join(e.options.repoRoot,u,p),s=i.default.join(e.options.repoRoot,u,o),c=t.readJson(s);if(!a.default.existsSync(n)){c.hooks===!0&&a.default.rmSync(r,{force:!0}),t.writeJson(s,{...c,hooks:!1});return}let l=a.default.readFileSync(n,`utf8`).replaceAll(`$AGY_REPO_ROOT`,e.options.repoRoot),d=a.default.lstatSync(r,{throwIfNoEntry:!1});if(d&&c.hooks!==!0&&(!d.isFile()||a.default.readFileSync(r,`utf8`)!==l))throw Error(`Refusing to replace unmanaged Antigravity path: ${r}`);t.writeFileAtomic(r,l),t.writeJson(s,{...c,hooks:!0})}function D(e){return[...e.options.skipPermissions?[r.SKIP_PERMISSIONS_OPTION]:[],...r.additionalDirectoryArgs(e),...e.options.providerArgs]}async function O(e){let t=e.environment.HOME;if(!t)throw Error(`HOME is required for Antigravity compatibility`);let r=i.default.join(t,h,g,`.doom-pi-sync.lock`),a=await n.acquireDirectoryLock(r);try{v(e),b(e),C(e),T(e),E(e)}finally{await a()}return n.runInteractive(`agy`,D(e),e.options.repoRoot,e.environment)}exports.adaptAntigravityMcpDefinition=_,exports.antigravityCompatibilityArgs=D,exports.launchAntigravity=O;
2
2
  //# sourceMappingURL=antigravity.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"antigravity.cjs","names":["path","readJson","MCP_SERVERS_KEY","isRecord","mcpProxyArguments","ANTIGRAVITY_MCP_PROXY_PACKAGE","PLUGINS_DIRECTORY","fs","AGIFLOW_PROXY_SERVER_NAME","PLUGIN_MANIFEST_FILENAME","SKILLS_DIRECTORY","pathInside","CORE_PLUGIN_NAME","SKIP_PERMISSIONS_OPTION","additionalDirectoryArgs","acquireDirectoryLock","runInteractive"],"sources":["../../../../src/adapters/compatibility/antigravity.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { isRecord, readJson, writeFileAtomic, writeJson } from '../serialization/json';\nimport type { JsonObject } from '../serialization/json';\nimport type { CompatibilityContext } from '../compatibilityContext.ts';\nimport { acquireDirectoryLock, pathInside, runInteractive } from './process.ts';\nimport {\n AGIFLOW_PROXY_SERVER_NAME,\n ANTIGRAVITY_MCP_PROXY_PACKAGE,\n additionalDirectoryArgs,\n CORE_PLUGIN_NAME,\n MCP_SERVERS_KEY,\n mcpProxyArguments,\n NPX_COMMAND,\n PLUGIN_MANIFEST_FILENAME,\n PLUGINS_DIRECTORY,\n SKILLS_DIRECTORY,\n SKIP_PERMISSIONS_OPTION,\n} from './shared.ts';\n\n/**\n * Antigravity state synchronisation.\n *\n * Antigravity reads its configuration from the workspace and from the user's\n * home directory rather than from arguments, so every selection has to be\n * written to disk before launch and reverted when it is no longer selected.\n * Everything the harness writes is tracked in a managed-state file so a file\n * the user created by hand is never silently replaced.\n */\n\nconst ANTIGRAVITY_PROVIDER = 'agy';\nconst AGY_MANAGED_STATE = '.doom-pi-managed.json';\nconst ANTIGRAVITY_PROXY_SERVER_NAME = 'mcp-proxy';\nconst PROJECT_MCP_SERVER_NAME = 'project-mcp';\nconst PENCIL_SERVER_NAME = 'pencil';\nconst ANTIGRAVITY_SYNC_LOCK = '.doom-pi-sync.lock';\nconst AGENTS_DIRECTORY = '.agents';\nconst GENERATED_AGENTS_DIRECTORY = '_agents';\nconst CODEX_PLUGIN_DIRECTORY = '.codex-plugin';\nconst MCP_CONFIG_FILENAME = 'mcp_config.json';\nconst HOOKS_CONFIG_FILENAME = 'hooks.json';\nconst MANAGED_PLUGINS_KEY = 'plugins';\nconst MCP_PROXY_TIMEOUT_MS = 1_200_000;\nconst GEMINI_DIRECTORY = '.gemini';\nconst ANTIGRAVITY_CLI_DIRECTORY = 'antigravity-cli';\nconst ANTIGRAVITY_SETTINGS_FILENAME = 'settings.json';\nconst ANTIGRAVITY_LOCAL_DIRECTORY = '.antigravity-local';\nconst CLAUDE_DIRECTORY = '.claude';\nconst DEFAULT_ANTIGRAVITY_MODEL = 'Gemini 3.5 Flash';\nconst REPO_ROOT_PLACEHOLDER = '$AGY_REPO_ROOT';\n\n/** Rewrites one MCP server definition into the shape Antigravity expects. */\nexport function adaptAntigravityMcpDefinition(definition: JsonObject, repoRoot: string): JsonObject | undefined {\n if (typeof definition.command === 'string') {\n const adapted: JsonObject = {\n ...definition,\n command: definition.command,\n args: Array.isArray(definition.args) ? definition.args.map(String) : [],\n cwd: typeof definition.cwd === 'string' ? definition.cwd : repoRoot,\n };\n delete adapted.type;\n return adapted;\n }\n const url = typeof definition.url === 'string' ? definition.url : undefined;\n if (!url) return undefined;\n const adapted: JsonObject = { ...definition, serverUrl: url };\n delete adapted.type;\n delete adapted.url;\n return adapted;\n}\n\nfunction syncAntigravityMcp(context: CompatibilityContext): void {\n const repoRoot = context.options.repoRoot;\n const workspacePath = path.join(repoRoot, AGENTS_DIRECTORY, MCP_CONFIG_FILENAME);\n const managedPath = path.join(repoRoot, AGENTS_DIRECTORY, AGY_MANAGED_STATE);\n const workspace = readJson(workspacePath);\n const workspaceMcpServers = workspace[MCP_SERVERS_KEY];\n const workspaceServers = isRecord(workspaceMcpServers) ? { ...workspaceMcpServers } : {};\n const previousManaged = readJson(managedPath);\n const previousMcpServers = previousManaged[MCP_SERVERS_KEY];\n const previousNames = Array.isArray(previousMcpServers) ? previousMcpServers.map(String) : [];\n for (const name of new Set([\n ...previousNames,\n ANTIGRAVITY_PROXY_SERVER_NAME,\n PROJECT_MCP_SERVER_NAME,\n PENCIL_SERVER_NAME,\n ])) {\n delete workspaceServers[name];\n }\n\n const selectedConfig = readJson(context.mcpConfigPath);\n const selectedMcpServers = selectedConfig[MCP_SERVERS_KEY];\n const selectedServers = isRecord(selectedMcpServers) ? selectedMcpServers : {};\n const allowed = context.mcpAllowlist?.servers;\n const keeps = (name: string): boolean => !allowed || allowed.length === 0 || allowed.includes(name);\n const managedNames: string[] = [];\n\n if (keeps(AGIFLOW_PROXY_SERVER_NAME)) {\n workspaceServers[ANTIGRAVITY_PROXY_SERVER_NAME] = {\n command: NPX_COMMAND,\n args: mcpProxyArguments(ANTIGRAVITY_MCP_PROXY_PACKAGE, context.proxyConfigPath, true),\n cwd: repoRoot,\n timeout: MCP_PROXY_TIMEOUT_MS,\n };\n managedNames.push(ANTIGRAVITY_PROXY_SERVER_NAME);\n }\n\n const directNames = context.mcpAllowlist ? (allowed ?? []) : [PROJECT_MCP_SERVER_NAME, PENCIL_SERVER_NAME];\n for (const name of directNames) {\n if (name === AGIFLOW_PROXY_SERVER_NAME) continue;\n const definition = selectedServers[name];\n if (!isRecord(definition)) continue;\n const adapted = adaptAntigravityMcpDefinition(definition, repoRoot);\n if (!adapted) continue;\n workspaceServers[name] = adapted;\n managedNames.push(name);\n }\n\n writeJson(workspacePath, { ...workspace, [MCP_SERVERS_KEY]: workspaceServers });\n writeJson(managedPath, { ...previousManaged, [MCP_SERVERS_KEY]: managedNames });\n\n const home = context.environment.HOME;\n if (!home) return;\n // Earlier releases wrote these servers into the Gemini config. Leaving them\n // there would double every tool, so they are removed wherever they are found.\n for (const legacyPath of [\n path.join(home, GEMINI_DIRECTORY, 'config', MCP_CONFIG_FILENAME),\n path.join(home, GEMINI_DIRECTORY, 'config', PLUGINS_DIRECTORY, 'shared', MCP_CONFIG_FILENAME),\n ]) {\n if (!fs.existsSync(legacyPath)) continue;\n const legacy = readJson(legacyPath);\n const legacyMcpServers = legacy[MCP_SERVERS_KEY];\n const servers = isRecord(legacyMcpServers) ? { ...legacyMcpServers } : {};\n for (const name of [\n ANTIGRAVITY_PROXY_SERVER_NAME,\n AGIFLOW_PROXY_SERVER_NAME,\n PROJECT_MCP_SERVER_NAME,\n PENCIL_SERVER_NAME,\n ]) {\n delete servers[name];\n }\n writeJson(legacyPath, { ...legacy, [MCP_SERVERS_KEY]: servers });\n }\n}\n\nfunction antigravitySettingsPath(home: string): string {\n return path.join(home, GEMINI_DIRECTORY, ANTIGRAVITY_CLI_DIRECTORY, ANTIGRAVITY_SETTINGS_FILENAME);\n}\n\nfunction syncAntigravityModel(context: CompatibilityContext): void {\n const home = context.environment.HOME;\n if (!home) throw new Error('HOME is required for Antigravity compatibility');\n const settingsPath = antigravitySettingsPath(home);\n const settings = readJson(settingsPath);\n if (!settings.model) settings.model = context.environment.AGY_MODEL ?? DEFAULT_ANTIGRAVITY_MODEL;\n const trusted = Array.isArray(settings.trustedWorkspaces) ? settings.trustedWorkspaces.map(String) : [];\n if (!trusted.includes(context.options.repoRoot)) trusted.push(context.options.repoRoot);\n settings.trustedWorkspaces = trusted;\n writeJson(settingsPath, settings);\n}\n\nfunction ensureManagedDirectory(directory: string): void {\n const stat = fs.lstatSync(directory, { throwIfNoEntry: false });\n if (stat && !stat.isDirectory()) {\n throw new Error(`Refusing to use unmanaged Antigravity path: ${directory}`);\n }\n if (!stat) fs.mkdirSync(directory, { recursive: true });\n}\n\nfunction replaceManagedSkillLink(linkPath: string, sourcePath: string): void {\n if (fs.existsSync(linkPath) || fs.lstatSync(linkPath, { throwIfNoEntry: false })) {\n const stat = fs.lstatSync(linkPath);\n if (!stat.isSymbolicLink()) throw new Error(`Refusing to replace unmanaged Antigravity path: ${linkPath}`);\n fs.rmSync(linkPath, { force: true });\n }\n fs.symlinkSync(sourcePath, linkPath, 'dir');\n}\n\nfunction syncAntigravityPlugins(context: CompatibilityContext): void {\n const repoRoot = context.options.repoRoot;\n const pluginsRoot = path.join(repoRoot, PLUGINS_DIRECTORY);\n const agentsRoot = path.join(repoRoot, GENERATED_AGENTS_DIRECTORY);\n const targetRoot = path.join(agentsRoot, PLUGINS_DIRECTORY);\n const managedPath = path.join(repoRoot, AGENTS_DIRECTORY, AGY_MANAGED_STATE);\n const managed = readJson(managedPath);\n const previousPlugins = managed[MANAGED_PLUGINS_KEY];\n const previousNames = new Set(Array.isArray(previousPlugins) ? previousPlugins.map(String) : []);\n ensureManagedDirectory(agentsRoot);\n ensureManagedDirectory(targetRoot);\n const selectedNames = new Set<string>();\n\n for (const plugin of context.plugins) {\n const manifestPath = path.join(plugin.directory, CODEX_PLUGIN_DIRECTORY, PLUGIN_MANIFEST_FILENAME);\n if (!fs.existsSync(manifestPath)) continue;\n const manifest = readJson(manifestPath);\n const pluginName =\n typeof manifest.name === 'string' && manifest.name ? manifest.name : path.basename(plugin.directory);\n if (\n pluginName === '.' ||\n pluginName === '..' ||\n pluginName.toLowerCase() === CORE_PLUGIN_NAME ||\n pluginName.includes('/') ||\n pluginName.includes('\\\\')\n ) {\n throw new Error(`Invalid Antigravity plugin name: ${pluginName}`);\n }\n const target = path.join(targetRoot, pluginName);\n selectedNames.add(pluginName);\n ensureManagedDirectory(target);\n writeJson(path.join(target, PLUGIN_MANIFEST_FILENAME), { name: pluginName });\n const skills = path.join(plugin.directory, SKILLS_DIRECTORY);\n const skillsLink = path.join(target, SKILLS_DIRECTORY);\n if (fs.existsSync(skills)) {\n replaceManagedSkillLink(skillsLink, skills);\n } else if (fs.lstatSync(skillsLink, { throwIfNoEntry: false })?.isSymbolicLink()) {\n fs.rmSync(skillsLink, { force: true });\n }\n }\n\n for (const entry of fs.readdirSync(targetRoot, { withFileTypes: true })) {\n if (entry.name === CORE_PLUGIN_NAME || selectedNames.has(entry.name)) continue;\n const target = path.join(targetRoot, entry.name);\n if (previousNames.has(entry.name)) {\n fs.rmSync(target, { recursive: true, force: true });\n continue;\n }\n if (!entry.isDirectory()) continue;\n // Not in the managed list, but its skills link points into this repository's\n // plugins, so an earlier run created it before the state file existed.\n const skillsLink = path.join(target, SKILLS_DIRECTORY);\n const stat = fs.lstatSync(skillsLink, { throwIfNoEntry: false });\n if (!stat?.isSymbolicLink()) continue;\n const source = path.resolve(path.dirname(skillsLink), fs.readlinkSync(skillsLink));\n if (pathInside(pluginsRoot, source)) fs.rmSync(target, { recursive: true, force: true });\n }\n\n writeJson(managedPath, { ...managed, [MANAGED_PLUGINS_KEY]: [...selectedNames] });\n}\n\nfunction removeManagedCorePlugin(core: string): void {\n if (readJson(path.join(core, PLUGIN_MANIFEST_FILENAME)).name === CORE_PLUGIN_NAME) {\n fs.rmSync(core, { recursive: true, force: true });\n }\n}\n\nfunction syncAntigravitySharedSkills(context: CompatibilityContext): void {\n const core = path.join(context.options.repoRoot, GENERATED_AGENTS_DIRECTORY, PLUGINS_DIRECTORY, CORE_PLUGIN_NAME);\n const coreStat = fs.lstatSync(core, { throwIfNoEntry: false });\n if (coreStat?.isSymbolicLink()) throw new Error(`Refusing to use unmanaged Antigravity path: ${core}`);\n if (!context.sharedSkills) {\n removeManagedCorePlugin(core);\n return;\n }\n\n const source = path.join(context.options.repoRoot, CLAUDE_DIRECTORY, SKILLS_DIRECTORY);\n if (!fs.existsSync(source)) {\n removeManagedCorePlugin(core);\n return;\n }\n ensureManagedDirectory(core);\n const target = path.join(core, SKILLS_DIRECTORY);\n ensureManagedDirectory(target);\n writeJson(path.join(core, PLUGIN_MANIFEST_FILENAME), { name: CORE_PLUGIN_NAME });\n const selected = new Set<string>();\n for (const entry of fs.readdirSync(source, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue;\n selected.add(entry.name);\n replaceManagedSkillLink(path.join(target, entry.name), path.join(source, entry.name));\n }\n for (const entry of fs.readdirSync(target)) {\n if (selected.has(entry)) continue;\n const candidate = path.join(target, entry);\n if (fs.lstatSync(candidate).isSymbolicLink()) fs.rmSync(candidate, { force: true });\n }\n}\n\nfunction syncAntigravityHooks(context: CompatibilityContext): void {\n const source = path.join(context.options.repoRoot, ANTIGRAVITY_LOCAL_DIRECTORY, HOOKS_CONFIG_FILENAME);\n const target = path.join(context.options.repoRoot, AGENTS_DIRECTORY, HOOKS_CONFIG_FILENAME);\n const managedPath = path.join(context.options.repoRoot, AGENTS_DIRECTORY, AGY_MANAGED_STATE);\n const managed = readJson(managedPath);\n if (!fs.existsSync(source)) {\n if (managed.hooks === true) fs.rmSync(target, { force: true });\n writeJson(managedPath, { ...managed, hooks: false });\n return;\n }\n const content = fs.readFileSync(source, 'utf8').replaceAll(REPO_ROOT_PLACEHOLDER, context.options.repoRoot);\n const targetStat = fs.lstatSync(target, { throwIfNoEntry: false });\n if (targetStat && managed.hooks !== true) {\n if (!targetStat.isFile() || fs.readFileSync(target, 'utf8') !== content) {\n throw new Error(`Refusing to replace unmanaged Antigravity path: ${target}`);\n }\n }\n writeFileAtomic(target, content);\n writeJson(managedPath, { ...managed, hooks: true });\n}\n\nexport function antigravityCompatibilityArgs(context: CompatibilityContext): string[] {\n return [SKIP_PERMISSIONS_OPTION, ...additionalDirectoryArgs(context), ...context.options.providerArgs];\n}\n\nexport async function launchAntigravity(context: CompatibilityContext): Promise<number> {\n const home = context.environment.HOME;\n if (!home) throw new Error('HOME is required for Antigravity compatibility');\n // Every step below writes shared state under the user's home directory, so\n // two repositories launching at once have to be serialised.\n const lockPath = path.join(home, GEMINI_DIRECTORY, ANTIGRAVITY_CLI_DIRECTORY, ANTIGRAVITY_SYNC_LOCK);\n const releaseLock = await acquireDirectoryLock(lockPath);\n try {\n syncAntigravityMcp(context);\n syncAntigravityModel(context);\n syncAntigravityPlugins(context);\n syncAntigravitySharedSkills(context);\n syncAntigravityHooks(context);\n } finally {\n await releaseLock();\n }\n return runInteractive(\n ANTIGRAVITY_PROVIDER,\n antigravityCompatibilityArgs(context),\n context.options.repoRoot,\n context.environment,\n );\n}\n"],"mappings":"6OA8BA,MACM,EAAoB,wBACpB,EAAgC,YAChC,EAA0B,cAC1B,EAAqB,SAErB,EAAmB,UACnB,EAA6B,UAE7B,EAAsB,kBACtB,EAAwB,aACxB,EAAsB,UAEtB,EAAmB,UACnB,EAA4B,kBAQlC,SAAgB,EAA8B,EAAwB,EAA0C,CAC9G,GAAI,OAAO,EAAW,SAAY,SAAU,CAC1C,IAAM,EAAsB,CAC1B,GAAG,EACH,QAAS,EAAW,QACpB,KAAM,MAAM,QAAQ,EAAW,IAAI,EAAI,EAAW,KAAK,IAAI,MAAM,EAAI,CAAC,EACtE,IAAK,OAAO,EAAW,KAAQ,SAAW,EAAW,IAAM,CAC7D,EAEA,OADA,OAAO,EAAQ,KACR,CACT,CACA,IAAM,EAAM,OAAO,EAAW,KAAQ,SAAW,EAAW,IAAM,IAAA,GAClE,GAAI,CAAC,EAAK,OACV,IAAM,EAAsB,CAAE,GAAG,EAAY,UAAW,CAAI,EAG5D,OAFA,OAAO,EAAQ,KACf,OAAO,EAAQ,IACR,CACT,CAEA,SAAS,EAAmB,EAAqC,CAC/D,IAAM,EAAW,EAAQ,QAAQ,SAC3B,EAAgBA,EAAAA,QAAK,KAAK,EAAU,EAAkB,CAAmB,EACzE,EAAcA,EAAAA,QAAK,KAAK,EAAU,EAAkB,CAAiB,EACrE,EAAYC,EAAAA,SAAS,CAAa,EAClC,EAAsB,EAAUC,EAAAA,iBAChC,EAAmBC,EAAAA,SAAS,CAAmB,EAAI,CAAE,GAAG,CAAoB,EAAI,CAAC,EACjF,EAAkBF,EAAAA,SAAS,CAAW,EACtC,EAAqB,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M,EAAWd,EAAAA,QAAK,KAAK,EAAM,EAAkB,EAA2B,oBAAqB,EAC7F,EAAc,MAAMe,EAAAA,qBAAqB,CAAQ,EACvD,GAAI,CACF,EAAmB,CAAO,EAC1B,EAAqB,CAAO,EAC5B,EAAuB,CAAO,EAC9B,EAA4B,CAAO,EACnC,EAAqB,CAAO,CAC9B,QAAU,CACR,MAAM,EAAY,CACpB,CACA,OAAOC,EAAAA,eACL,MACA,EAA6B,CAAO,EACpC,EAAQ,QAAQ,SAChB,EAAQ,WACV,CACF"}
1
+ {"version":3,"file":"antigravity.cjs","names":["path","readJson","MCP_SERVERS_KEY","isRecord","mcpProxyArguments","ANTIGRAVITY_MCP_PROXY_PACKAGE","PLUGINS_DIRECTORY","fs","AGIFLOW_PROXY_SERVER_NAME","PLUGIN_MANIFEST_FILENAME","SKILLS_DIRECTORY","pathInside","CORE_PLUGIN_NAME","SKIP_PERMISSIONS_OPTION","additionalDirectoryArgs","acquireDirectoryLock","runInteractive"],"sources":["../../../../src/adapters/compatibility/antigravity.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { isRecord, readJson, writeFileAtomic, writeJson } from '../serialization/json';\nimport type { JsonObject } from '../serialization/json';\nimport type { CompatibilityContext } from '../compatibilityContext.ts';\nimport { acquireDirectoryLock, pathInside, runInteractive } from './process.ts';\nimport {\n AGIFLOW_PROXY_SERVER_NAME,\n ANTIGRAVITY_MCP_PROXY_PACKAGE,\n additionalDirectoryArgs,\n CORE_PLUGIN_NAME,\n MCP_SERVERS_KEY,\n mcpProxyArguments,\n NPX_COMMAND,\n PLUGIN_MANIFEST_FILENAME,\n PLUGINS_DIRECTORY,\n SKILLS_DIRECTORY,\n SKIP_PERMISSIONS_OPTION,\n} from './shared.ts';\n\n/**\n * Antigravity state synchronisation.\n *\n * Antigravity reads its configuration from the workspace and from the user's\n * home directory rather than from arguments, so every selection has to be\n * written to disk before launch and reverted when it is no longer selected.\n * Everything the harness writes is tracked in a managed-state file so a file\n * the user created by hand is never silently replaced.\n */\n\nconst ANTIGRAVITY_PROVIDER = 'agy';\nconst AGY_MANAGED_STATE = '.doom-pi-managed.json';\nconst ANTIGRAVITY_PROXY_SERVER_NAME = 'mcp-proxy';\nconst PROJECT_MCP_SERVER_NAME = 'project-mcp';\nconst PENCIL_SERVER_NAME = 'pencil';\nconst ANTIGRAVITY_SYNC_LOCK = '.doom-pi-sync.lock';\nconst AGENTS_DIRECTORY = '.agents';\nconst GENERATED_AGENTS_DIRECTORY = '_agents';\nconst CODEX_PLUGIN_DIRECTORY = '.codex-plugin';\nconst MCP_CONFIG_FILENAME = 'mcp_config.json';\nconst HOOKS_CONFIG_FILENAME = 'hooks.json';\nconst MANAGED_PLUGINS_KEY = 'plugins';\nconst MCP_PROXY_TIMEOUT_MS = 1_200_000;\nconst GEMINI_DIRECTORY = '.gemini';\nconst ANTIGRAVITY_CLI_DIRECTORY = 'antigravity-cli';\nconst ANTIGRAVITY_SETTINGS_FILENAME = 'settings.json';\nconst ANTIGRAVITY_LOCAL_DIRECTORY = '.antigravity-local';\nconst CLAUDE_DIRECTORY = '.claude';\nconst DEFAULT_ANTIGRAVITY_MODEL = 'Gemini 3.5 Flash';\nconst REPO_ROOT_PLACEHOLDER = '$AGY_REPO_ROOT';\n\n/** Rewrites one MCP server definition into the shape Antigravity expects. */\nexport function adaptAntigravityMcpDefinition(definition: JsonObject, repoRoot: string): JsonObject | undefined {\n if (typeof definition.command === 'string') {\n const adapted: JsonObject = {\n ...definition,\n command: definition.command,\n args: Array.isArray(definition.args) ? definition.args.map(String) : [],\n cwd: typeof definition.cwd === 'string' ? definition.cwd : repoRoot,\n };\n delete adapted.type;\n return adapted;\n }\n const url = typeof definition.url === 'string' ? definition.url : undefined;\n if (!url) return undefined;\n const adapted: JsonObject = { ...definition, serverUrl: url };\n delete adapted.type;\n delete adapted.url;\n return adapted;\n}\n\nfunction syncAntigravityMcp(context: CompatibilityContext): void {\n const repoRoot = context.options.repoRoot;\n const workspacePath = path.join(repoRoot, AGENTS_DIRECTORY, MCP_CONFIG_FILENAME);\n const managedPath = path.join(repoRoot, AGENTS_DIRECTORY, AGY_MANAGED_STATE);\n const workspace = readJson(workspacePath);\n const workspaceMcpServers = workspace[MCP_SERVERS_KEY];\n const workspaceServers = isRecord(workspaceMcpServers) ? { ...workspaceMcpServers } : {};\n const previousManaged = readJson(managedPath);\n const previousMcpServers = previousManaged[MCP_SERVERS_KEY];\n const previousNames = Array.isArray(previousMcpServers) ? previousMcpServers.map(String) : [];\n for (const name of new Set([\n ...previousNames,\n ANTIGRAVITY_PROXY_SERVER_NAME,\n PROJECT_MCP_SERVER_NAME,\n PENCIL_SERVER_NAME,\n ])) {\n delete workspaceServers[name];\n }\n\n const selectedConfig = readJson(context.mcpConfigPath);\n const selectedMcpServers = selectedConfig[MCP_SERVERS_KEY];\n const selectedServers = isRecord(selectedMcpServers) ? selectedMcpServers : {};\n const allowed = context.mcpAllowlist?.servers;\n const keeps = (name: string): boolean => !allowed || allowed.length === 0 || allowed.includes(name);\n const managedNames: string[] = [];\n\n if (keeps(AGIFLOW_PROXY_SERVER_NAME)) {\n workspaceServers[ANTIGRAVITY_PROXY_SERVER_NAME] = {\n command: NPX_COMMAND,\n args: mcpProxyArguments(ANTIGRAVITY_MCP_PROXY_PACKAGE, context.proxyConfigPath, true),\n cwd: repoRoot,\n timeout: MCP_PROXY_TIMEOUT_MS,\n };\n managedNames.push(ANTIGRAVITY_PROXY_SERVER_NAME);\n }\n\n const directNames = context.mcpAllowlist ? (allowed ?? []) : [PROJECT_MCP_SERVER_NAME, PENCIL_SERVER_NAME];\n for (const name of directNames) {\n if (name === AGIFLOW_PROXY_SERVER_NAME) continue;\n const definition = selectedServers[name];\n if (!isRecord(definition)) continue;\n const adapted = adaptAntigravityMcpDefinition(definition, repoRoot);\n if (!adapted) continue;\n workspaceServers[name] = adapted;\n managedNames.push(name);\n }\n\n writeJson(workspacePath, { ...workspace, [MCP_SERVERS_KEY]: workspaceServers });\n writeJson(managedPath, { ...previousManaged, [MCP_SERVERS_KEY]: managedNames });\n\n const home = context.environment.HOME;\n if (!home) return;\n // Earlier releases wrote these servers into the Gemini config. Leaving them\n // there would double every tool, so they are removed wherever they are found.\n for (const legacyPath of [\n path.join(home, GEMINI_DIRECTORY, 'config', MCP_CONFIG_FILENAME),\n path.join(home, GEMINI_DIRECTORY, 'config', PLUGINS_DIRECTORY, 'shared', MCP_CONFIG_FILENAME),\n ]) {\n if (!fs.existsSync(legacyPath)) continue;\n const legacy = readJson(legacyPath);\n const legacyMcpServers = legacy[MCP_SERVERS_KEY];\n const servers = isRecord(legacyMcpServers) ? { ...legacyMcpServers } : {};\n for (const name of [\n ANTIGRAVITY_PROXY_SERVER_NAME,\n AGIFLOW_PROXY_SERVER_NAME,\n PROJECT_MCP_SERVER_NAME,\n PENCIL_SERVER_NAME,\n ]) {\n delete servers[name];\n }\n writeJson(legacyPath, { ...legacy, [MCP_SERVERS_KEY]: servers });\n }\n}\n\nfunction antigravitySettingsPath(home: string): string {\n return path.join(home, GEMINI_DIRECTORY, ANTIGRAVITY_CLI_DIRECTORY, ANTIGRAVITY_SETTINGS_FILENAME);\n}\n\nfunction syncAntigravityModel(context: CompatibilityContext): void {\n const home = context.environment.HOME;\n if (!home) throw new Error('HOME is required for Antigravity compatibility');\n const settingsPath = antigravitySettingsPath(home);\n const settings = readJson(settingsPath);\n if (!settings.model) settings.model = context.environment.AGY_MODEL ?? DEFAULT_ANTIGRAVITY_MODEL;\n const trusted = Array.isArray(settings.trustedWorkspaces) ? settings.trustedWorkspaces.map(String) : [];\n // Trusting a workspace outlives the run that added it, and this file belongs\n // to Antigravity rather than to DoomPi, so say which file gained the entry.\n if (!trusted.includes(context.options.repoRoot)) {\n trusted.push(context.options.repoRoot);\n process.stderr.write(`[doompi] trusting ${context.options.repoRoot} in ${settingsPath}\\n`);\n }\n settings.trustedWorkspaces = trusted;\n writeJson(settingsPath, settings);\n}\n\nfunction ensureManagedDirectory(directory: string): void {\n const stat = fs.lstatSync(directory, { throwIfNoEntry: false });\n if (stat && !stat.isDirectory()) {\n throw new Error(`Refusing to use unmanaged Antigravity path: ${directory}`);\n }\n if (!stat) fs.mkdirSync(directory, { recursive: true });\n}\n\nfunction replaceManagedSkillLink(linkPath: string, sourcePath: string): void {\n if (fs.existsSync(linkPath) || fs.lstatSync(linkPath, { throwIfNoEntry: false })) {\n const stat = fs.lstatSync(linkPath);\n if (!stat.isSymbolicLink()) throw new Error(`Refusing to replace unmanaged Antigravity path: ${linkPath}`);\n fs.rmSync(linkPath, { force: true });\n }\n fs.symlinkSync(sourcePath, linkPath, 'dir');\n}\n\nfunction syncAntigravityPlugins(context: CompatibilityContext): void {\n const repoRoot = context.options.repoRoot;\n const pluginsRoot = path.join(repoRoot, PLUGINS_DIRECTORY);\n const agentsRoot = path.join(repoRoot, GENERATED_AGENTS_DIRECTORY);\n const targetRoot = path.join(agentsRoot, PLUGINS_DIRECTORY);\n const managedPath = path.join(repoRoot, AGENTS_DIRECTORY, AGY_MANAGED_STATE);\n const managed = readJson(managedPath);\n const previousPlugins = managed[MANAGED_PLUGINS_KEY];\n const previousNames = new Set(Array.isArray(previousPlugins) ? previousPlugins.map(String) : []);\n ensureManagedDirectory(agentsRoot);\n ensureManagedDirectory(targetRoot);\n const selectedNames = new Set<string>();\n\n for (const plugin of context.plugins) {\n const manifestPath = path.join(plugin.directory, CODEX_PLUGIN_DIRECTORY, PLUGIN_MANIFEST_FILENAME);\n if (!fs.existsSync(manifestPath)) continue;\n const manifest = readJson(manifestPath);\n const pluginName =\n typeof manifest.name === 'string' && manifest.name ? manifest.name : path.basename(plugin.directory);\n if (\n pluginName === '.' ||\n pluginName === '..' ||\n pluginName.toLowerCase() === CORE_PLUGIN_NAME ||\n pluginName.includes('/') ||\n pluginName.includes('\\\\')\n ) {\n throw new Error(`Invalid Antigravity plugin name: ${pluginName}`);\n }\n const target = path.join(targetRoot, pluginName);\n selectedNames.add(pluginName);\n ensureManagedDirectory(target);\n writeJson(path.join(target, PLUGIN_MANIFEST_FILENAME), { name: pluginName });\n const skills = path.join(plugin.directory, SKILLS_DIRECTORY);\n const skillsLink = path.join(target, SKILLS_DIRECTORY);\n if (fs.existsSync(skills)) {\n replaceManagedSkillLink(skillsLink, skills);\n } else if (fs.lstatSync(skillsLink, { throwIfNoEntry: false })?.isSymbolicLink()) {\n fs.rmSync(skillsLink, { force: true });\n }\n }\n\n for (const entry of fs.readdirSync(targetRoot, { withFileTypes: true })) {\n if (entry.name === CORE_PLUGIN_NAME || selectedNames.has(entry.name)) continue;\n const target = path.join(targetRoot, entry.name);\n if (previousNames.has(entry.name)) {\n fs.rmSync(target, { recursive: true, force: true });\n continue;\n }\n if (!entry.isDirectory()) continue;\n // Not in the managed list, but its skills link points into this repository's\n // plugins, so an earlier run created it before the state file existed.\n const skillsLink = path.join(target, SKILLS_DIRECTORY);\n const stat = fs.lstatSync(skillsLink, { throwIfNoEntry: false });\n if (!stat?.isSymbolicLink()) continue;\n const source = path.resolve(path.dirname(skillsLink), fs.readlinkSync(skillsLink));\n if (pathInside(pluginsRoot, source)) fs.rmSync(target, { recursive: true, force: true });\n }\n\n writeJson(managedPath, { ...managed, [MANAGED_PLUGINS_KEY]: [...selectedNames] });\n}\n\nfunction removeManagedCorePlugin(core: string): void {\n if (readJson(path.join(core, PLUGIN_MANIFEST_FILENAME)).name === CORE_PLUGIN_NAME) {\n fs.rmSync(core, { recursive: true, force: true });\n }\n}\n\nfunction syncAntigravitySharedSkills(context: CompatibilityContext): void {\n const core = path.join(context.options.repoRoot, GENERATED_AGENTS_DIRECTORY, PLUGINS_DIRECTORY, CORE_PLUGIN_NAME);\n const coreStat = fs.lstatSync(core, { throwIfNoEntry: false });\n if (coreStat?.isSymbolicLink()) throw new Error(`Refusing to use unmanaged Antigravity path: ${core}`);\n if (!context.sharedSkills) {\n removeManagedCorePlugin(core);\n return;\n }\n\n const source = path.join(context.options.repoRoot, CLAUDE_DIRECTORY, SKILLS_DIRECTORY);\n if (!fs.existsSync(source)) {\n removeManagedCorePlugin(core);\n return;\n }\n ensureManagedDirectory(core);\n const target = path.join(core, SKILLS_DIRECTORY);\n ensureManagedDirectory(target);\n writeJson(path.join(core, PLUGIN_MANIFEST_FILENAME), { name: CORE_PLUGIN_NAME });\n const selected = new Set<string>();\n for (const entry of fs.readdirSync(source, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue;\n selected.add(entry.name);\n replaceManagedSkillLink(path.join(target, entry.name), path.join(source, entry.name));\n }\n for (const entry of fs.readdirSync(target)) {\n if (selected.has(entry)) continue;\n const candidate = path.join(target, entry);\n if (fs.lstatSync(candidate).isSymbolicLink()) fs.rmSync(candidate, { force: true });\n }\n}\n\nfunction syncAntigravityHooks(context: CompatibilityContext): void {\n const source = path.join(context.options.repoRoot, ANTIGRAVITY_LOCAL_DIRECTORY, HOOKS_CONFIG_FILENAME);\n const target = path.join(context.options.repoRoot, AGENTS_DIRECTORY, HOOKS_CONFIG_FILENAME);\n const managedPath = path.join(context.options.repoRoot, AGENTS_DIRECTORY, AGY_MANAGED_STATE);\n const managed = readJson(managedPath);\n if (!fs.existsSync(source)) {\n if (managed.hooks === true) fs.rmSync(target, { force: true });\n writeJson(managedPath, { ...managed, hooks: false });\n return;\n }\n const content = fs.readFileSync(source, 'utf8').replaceAll(REPO_ROOT_PLACEHOLDER, context.options.repoRoot);\n const targetStat = fs.lstatSync(target, { throwIfNoEntry: false });\n if (targetStat && managed.hooks !== true) {\n if (!targetStat.isFile() || fs.readFileSync(target, 'utf8') !== content) {\n throw new Error(`Refusing to replace unmanaged Antigravity path: ${target}`);\n }\n }\n writeFileAtomic(target, content);\n writeJson(managedPath, { ...managed, hooks: true });\n}\n\nexport function antigravityCompatibilityArgs(context: CompatibilityContext): string[] {\n return [\n ...(context.options.skipPermissions ? [SKIP_PERMISSIONS_OPTION] : []),\n ...additionalDirectoryArgs(context),\n ...context.options.providerArgs,\n ];\n}\n\nexport async function launchAntigravity(context: CompatibilityContext): Promise<number> {\n const home = context.environment.HOME;\n if (!home) throw new Error('HOME is required for Antigravity compatibility');\n // Every step below writes shared state under the user's home directory, so\n // two repositories launching at once have to be serialised.\n const lockPath = path.join(home, GEMINI_DIRECTORY, ANTIGRAVITY_CLI_DIRECTORY, ANTIGRAVITY_SYNC_LOCK);\n const releaseLock = await acquireDirectoryLock(lockPath);\n try {\n syncAntigravityMcp(context);\n syncAntigravityModel(context);\n syncAntigravityPlugins(context);\n syncAntigravitySharedSkills(context);\n syncAntigravityHooks(context);\n } finally {\n await releaseLock();\n }\n return runInteractive(\n ANTIGRAVITY_PROVIDER,\n antigravityCompatibilityArgs(context),\n context.options.repoRoot,\n context.environment,\n );\n}\n"],"mappings":"6OA8BA,MACM,EAAoB,wBACpB,EAAgC,YAChC,EAA0B,cAC1B,EAAqB,SAErB,EAAmB,UACnB,EAA6B,UAE7B,EAAsB,kBACtB,EAAwB,aACxB,EAAsB,UAEtB,EAAmB,UACnB,EAA4B,kBAQlC,SAAgB,EAA8B,EAAwB,EAA0C,CAC9G,GAAI,OAAO,EAAW,SAAY,SAAU,CAC1C,IAAM,EAAsB,CAC1B,GAAG,EACH,QAAS,EAAW,QACpB,KAAM,MAAM,QAAQ,EAAW,IAAI,EAAI,EAAW,KAAK,IAAI,MAAM,EAAI,CAAC,EACtE,IAAK,OAAO,EAAW,KAAQ,SAAW,EAAW,IAAM,CAC7D,EAEA,OADA,OAAO,EAAQ,KACR,CACT,CACA,IAAM,EAAM,OAAO,EAAW,KAAQ,SAAW,EAAW,IAAM,IAAA,GAClE,GAAI,CAAC,EAAK,OACV,IAAM,EAAsB,CAAE,GAAG,EAAY,UAAW,CAAI,EAG5D,OAFA,OAAO,EAAQ,KACf,OAAO,EAAQ,IACR,CACT,CAEA,SAAS,EAAmB,EAAqC,CAC/D,IAAM,EAAW,EAAQ,QAAQ,SAC3B,EAAgBA,EAAAA,QAAK,KAAK,EAAU,EAAkB,CAAmB,EACzE,EAAcA,EAAAA,QAAK,KAAK,EAAU,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AS,MAAO,EAAK,CAAC,CACpD,CAEA,SAAgB,EAA6B,EAAyC,CACpF,MAAO,CACL,GAAI,EAAQ,QAAQ,gBAAkB,CAACM,EAAAA,uBAAuB,EAAI,CAAC,EACnE,GAAGC,EAAAA,wBAAwB,CAAO,EAClC,GAAG,EAAQ,QAAQ,YACrB,CACF,CAEA,eAAsB,EAAkB,EAAgD,CACtF,IAAM,EAAO,EAAQ,YAAY,KACjC,GAAI,CAAC,EAAM,MAAU,MAAM,gDAAgD,EAG3E,IAAM,EAAWd,EAAAA,QAAK,KAAK,EAAM,EAAkB,EAA2B,oBAAqB,EAC7F,EAAc,MAAMe,EAAAA,qBAAqB,CAAQ,EACvD,GAAI,CACF,EAAmB,CAAO,EAC1B,EAAqB,CAAO,EAC5B,EAAuB,CAAO,EAC9B,EAA4B,CAAO,EACnC,EAAqB,CAAO,CAC9B,QAAU,CACR,MAAM,EAAY,CACpB,CACA,OAAOC,EAAAA,eACL,MACA,EAA6B,CAAO,EACpC,EAAQ,QAAQ,SAChB,EAAQ,WACV,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"antigravity.d.cts","names":[],"sources":["../../../../src/adapters/compatibility/antigravity.ts"],"mappings":";;;;iBAoDgB,8BAA8B,YAAY,YAAY,mBAAmB;iBAqPzE,6BAA6B,SAAS;iBAIhC,kBAAkB,SAAS,uBAAuB"}
1
+ {"version":3,"file":"antigravity.d.cts","names":[],"sources":["../../../../src/adapters/compatibility/antigravity.ts"],"mappings":";;;;iBAoDgB,8BAA8B,YAAY,YAAY,mBAAmB;iBA0PzE,6BAA6B,SAAS;iBAQhC,kBAAkB,SAAS,uBAAuB"}
@@ -1 +1 @@
1
- {"version":3,"file":"antigravity.d.mts","names":[],"sources":["../../../../src/adapters/compatibility/antigravity.ts"],"mappings":";;;;iBAoDgB,8BAA8B,YAAY,YAAY,mBAAmB;iBAqPzE,6BAA6B,SAAS;iBAIhC,kBAAkB,SAAS,uBAAuB"}
1
+ {"version":3,"file":"antigravity.d.mts","names":[],"sources":["../../../../src/adapters/compatibility/antigravity.ts"],"mappings":";;;;iBAoDgB,8BAA8B,YAAY,YAAY,mBAAmB;iBA0PzE,6BAA6B,SAAS;iBAQhC,kBAAkB,SAAS,uBAAuB"}
@@ -1,2 +1,2 @@
1
- import{isRecord as e,readJson as t,writeFileAtomic as n,writeJson as r}from"../serialization/json.mjs";import{acquireDirectoryLock as i,pathInside as a,runInteractive as o}from"./process.mjs";import{AGIFLOW_PROXY_SERVER_NAME as s,ANTIGRAVITY_MCP_PROXY_PACKAGE as c,CORE_PLUGIN_NAME as l,MCP_SERVERS_KEY as u,PLUGINS_DIRECTORY as d,PLUGIN_MANIFEST_FILENAME as f,SKILLS_DIRECTORY as p,SKIP_PERMISSIONS_OPTION as m,additionalDirectoryArgs as h,mcpProxyArguments as g}from"./shared.mjs";import _ from"node:path";import v from"node:fs";const y=`.doom-pi-managed.json`,b=`mcp-proxy`,x=`project-mcp`,S=`pencil`,C=`.agents`,w=`_agents`,T=`mcp_config.json`,E=`hooks.json`,D=`plugins`,O=`.gemini`,k=`antigravity-cli`;function A(e,t){if(typeof e.command==`string`){let n={...e,command:e.command,args:Array.isArray(e.args)?e.args.map(String):[],cwd:typeof e.cwd==`string`?e.cwd:t};return delete n.type,n}let n=typeof e.url==`string`?e.url:void 0;if(!n)return;let r={...e,serverUrl:n};return delete r.type,delete r.url,r}function j(n){let i=n.options.repoRoot,a=_.join(i,C,T),o=_.join(i,C,y),l=t(a),f=l[u],p=e(f)?{...f}:{},m=t(o),h=m[u],w=Array.isArray(h)?h.map(String):[];for(let e of new Set([...w,b,x,S]))delete p[e];let E=t(n.mcpConfigPath)[u],D=e(E)?E:{},k=n.mcpAllowlist?.servers,j=e=>!k||k.length===0||k.includes(e),M=[];j(`agiflow-proxy`)&&(p[b]={command:`npx`,args:g(c,n.proxyConfigPath,!0),cwd:i,timeout:12e5},M.push(b));let N=n.mcpAllowlist?k??[]:[x,S];for(let t of N){if(t===`agiflow-proxy`)continue;let n=D[t];if(!e(n))continue;let r=A(n,i);r&&(p[t]=r,M.push(t))}r(a,{...l,[u]:p}),r(o,{...m,[u]:M});let P=n.environment.HOME;if(P)for(let n of[_.join(P,O,`config`,T),_.join(P,O,`config`,d,`shared`,T)]){if(!v.existsSync(n))continue;let i=t(n),a=i[u],o=e(a)?{...a}:{};for(let e of[b,s,x,S])delete o[e];r(n,{...i,[u]:o})}}function M(e){return _.join(e,O,k,`settings.json`)}function N(e){let n=e.environment.HOME;if(!n)throw Error(`HOME is required for Antigravity compatibility`);let i=M(n),a=t(i);a.model||=e.environment.AGY_MODEL??`Gemini 3.5 Flash`;let o=Array.isArray(a.trustedWorkspaces)?a.trustedWorkspaces.map(String):[];o.includes(e.options.repoRoot)||o.push(e.options.repoRoot),a.trustedWorkspaces=o,r(i,a)}function P(e){let t=v.lstatSync(e,{throwIfNoEntry:!1});if(t&&!t.isDirectory())throw Error(`Refusing to use unmanaged Antigravity path: ${e}`);t||v.mkdirSync(e,{recursive:!0})}function F(e,t){if(v.existsSync(e)||v.lstatSync(e,{throwIfNoEntry:!1})){if(!v.lstatSync(e).isSymbolicLink())throw Error(`Refusing to replace unmanaged Antigravity path: ${e}`);v.rmSync(e,{force:!0})}v.symlinkSync(t,e,`dir`)}function I(e){let n=e.options.repoRoot,i=_.join(n,d),o=_.join(n,w),s=_.join(o,d),c=_.join(n,C,y),l=t(c),u=l[D],m=new Set(Array.isArray(u)?u.map(String):[]);P(o),P(s);let h=new Set;for(let n of e.plugins){let e=_.join(n.directory,`.codex-plugin`,f);if(!v.existsSync(e))continue;let i=t(e),a=typeof i.name==`string`&&i.name?i.name:_.basename(n.directory);if(a===`.`||a===`..`||a.toLowerCase()===`core`||a.includes(`/`)||a.includes(`\\`))throw Error(`Invalid Antigravity plugin name: ${a}`);let o=_.join(s,a);h.add(a),P(o),r(_.join(o,f),{name:a});let c=_.join(n.directory,p),l=_.join(o,p);v.existsSync(c)?F(l,c):v.lstatSync(l,{throwIfNoEntry:!1})?.isSymbolicLink()&&v.rmSync(l,{force:!0})}for(let e of v.readdirSync(s,{withFileTypes:!0})){if(e.name===`core`||h.has(e.name))continue;let t=_.join(s,e.name);if(m.has(e.name)){v.rmSync(t,{recursive:!0,force:!0});continue}if(!e.isDirectory())continue;let n=_.join(t,p);if(!v.lstatSync(n,{throwIfNoEntry:!1})?.isSymbolicLink())continue;let r=_.resolve(_.dirname(n),v.readlinkSync(n));a(i,r)&&v.rmSync(t,{recursive:!0,force:!0})}r(c,{...l,[D]:[...h]})}function L(e){t(_.join(e,`plugin.json`)).name===`core`&&v.rmSync(e,{recursive:!0,force:!0})}function R(e){let t=_.join(e.options.repoRoot,w,d,l);if(v.lstatSync(t,{throwIfNoEntry:!1})?.isSymbolicLink())throw Error(`Refusing to use unmanaged Antigravity path: ${t}`);if(!e.sharedSkills){L(t);return}let n=_.join(e.options.repoRoot,`.claude`,p);if(!v.existsSync(n)){L(t);return}P(t);let i=_.join(t,p);P(i),r(_.join(t,f),{name:l});let a=new Set;for(let e of v.readdirSync(n,{withFileTypes:!0}))e.isDirectory()&&(a.add(e.name),F(_.join(i,e.name),_.join(n,e.name)));for(let e of v.readdirSync(i)){if(a.has(e))continue;let t=_.join(i,e);v.lstatSync(t).isSymbolicLink()&&v.rmSync(t,{force:!0})}}function z(e){let i=_.join(e.options.repoRoot,`.antigravity-local`,E),a=_.join(e.options.repoRoot,C,E),o=_.join(e.options.repoRoot,C,y),s=t(o);if(!v.existsSync(i)){s.hooks===!0&&v.rmSync(a,{force:!0}),r(o,{...s,hooks:!1});return}let c=v.readFileSync(i,`utf8`).replaceAll(`$AGY_REPO_ROOT`,e.options.repoRoot),l=v.lstatSync(a,{throwIfNoEntry:!1});if(l&&s.hooks!==!0&&(!l.isFile()||v.readFileSync(a,`utf8`)!==c))throw Error(`Refusing to replace unmanaged Antigravity path: ${a}`);n(a,c),r(o,{...s,hooks:!0})}function B(e){return[m,...h(e),...e.options.providerArgs]}async function V(e){let t=e.environment.HOME;if(!t)throw Error(`HOME is required for Antigravity compatibility`);let n=_.join(t,O,k,`.doom-pi-sync.lock`),r=await i(n);try{j(e),N(e),I(e),R(e),z(e)}finally{await r()}return o(`agy`,B(e),e.options.repoRoot,e.environment)}export{A as adaptAntigravityMcpDefinition,B as antigravityCompatibilityArgs,V as launchAntigravity};
1
+ import{isRecord as e,readJson as t,writeFileAtomic as n,writeJson as r}from"../serialization/json.mjs";import{acquireDirectoryLock as i,pathInside as a,runInteractive as o}from"./process.mjs";import{AGIFLOW_PROXY_SERVER_NAME as s,ANTIGRAVITY_MCP_PROXY_PACKAGE as c,CORE_PLUGIN_NAME as l,MCP_SERVERS_KEY as u,PLUGINS_DIRECTORY as d,PLUGIN_MANIFEST_FILENAME as f,SKILLS_DIRECTORY as p,SKIP_PERMISSIONS_OPTION as m,additionalDirectoryArgs as h,mcpProxyArguments as g}from"./shared.mjs";import _ from"node:path";import v from"node:fs";const y=`.doom-pi-managed.json`,b=`mcp-proxy`,x=`project-mcp`,S=`pencil`,C=`.agents`,w=`_agents`,T=`mcp_config.json`,E=`hooks.json`,D=`plugins`,O=`.gemini`,k=`antigravity-cli`;function A(e,t){if(typeof e.command==`string`){let n={...e,command:e.command,args:Array.isArray(e.args)?e.args.map(String):[],cwd:typeof e.cwd==`string`?e.cwd:t};return delete n.type,n}let n=typeof e.url==`string`?e.url:void 0;if(!n)return;let r={...e,serverUrl:n};return delete r.type,delete r.url,r}function j(n){let i=n.options.repoRoot,a=_.join(i,C,T),o=_.join(i,C,y),l=t(a),f=l[u],p=e(f)?{...f}:{},m=t(o),h=m[u],w=Array.isArray(h)?h.map(String):[];for(let e of new Set([...w,b,x,S]))delete p[e];let E=t(n.mcpConfigPath)[u],D=e(E)?E:{},k=n.mcpAllowlist?.servers,j=e=>!k||k.length===0||k.includes(e),M=[];j(`agiflow-proxy`)&&(p[b]={command:`npx`,args:g(c,n.proxyConfigPath,!0),cwd:i,timeout:12e5},M.push(b));let N=n.mcpAllowlist?k??[]:[x,S];for(let t of N){if(t===`agiflow-proxy`)continue;let n=D[t];if(!e(n))continue;let r=A(n,i);r&&(p[t]=r,M.push(t))}r(a,{...l,[u]:p}),r(o,{...m,[u]:M});let P=n.environment.HOME;if(P)for(let n of[_.join(P,O,`config`,T),_.join(P,O,`config`,d,`shared`,T)]){if(!v.existsSync(n))continue;let i=t(n),a=i[u],o=e(a)?{...a}:{};for(let e of[b,s,x,S])delete o[e];r(n,{...i,[u]:o})}}function M(e){return _.join(e,O,k,`settings.json`)}function N(e){let n=e.environment.HOME;if(!n)throw Error(`HOME is required for Antigravity compatibility`);let i=M(n),a=t(i);a.model||=e.environment.AGY_MODEL??`Gemini 3.5 Flash`;let o=Array.isArray(a.trustedWorkspaces)?a.trustedWorkspaces.map(String):[];o.includes(e.options.repoRoot)||(o.push(e.options.repoRoot),process.stderr.write(`[doompi] trusting ${e.options.repoRoot} in ${i}\n`)),a.trustedWorkspaces=o,r(i,a)}function P(e){let t=v.lstatSync(e,{throwIfNoEntry:!1});if(t&&!t.isDirectory())throw Error(`Refusing to use unmanaged Antigravity path: ${e}`);t||v.mkdirSync(e,{recursive:!0})}function F(e,t){if(v.existsSync(e)||v.lstatSync(e,{throwIfNoEntry:!1})){if(!v.lstatSync(e).isSymbolicLink())throw Error(`Refusing to replace unmanaged Antigravity path: ${e}`);v.rmSync(e,{force:!0})}v.symlinkSync(t,e,`dir`)}function I(e){let n=e.options.repoRoot,i=_.join(n,d),o=_.join(n,w),s=_.join(o,d),c=_.join(n,C,y),l=t(c),u=l[D],m=new Set(Array.isArray(u)?u.map(String):[]);P(o),P(s);let h=new Set;for(let n of e.plugins){let e=_.join(n.directory,`.codex-plugin`,f);if(!v.existsSync(e))continue;let i=t(e),a=typeof i.name==`string`&&i.name?i.name:_.basename(n.directory);if(a===`.`||a===`..`||a.toLowerCase()===`core`||a.includes(`/`)||a.includes(`\\`))throw Error(`Invalid Antigravity plugin name: ${a}`);let o=_.join(s,a);h.add(a),P(o),r(_.join(o,f),{name:a});let c=_.join(n.directory,p),l=_.join(o,p);v.existsSync(c)?F(l,c):v.lstatSync(l,{throwIfNoEntry:!1})?.isSymbolicLink()&&v.rmSync(l,{force:!0})}for(let e of v.readdirSync(s,{withFileTypes:!0})){if(e.name===`core`||h.has(e.name))continue;let t=_.join(s,e.name);if(m.has(e.name)){v.rmSync(t,{recursive:!0,force:!0});continue}if(!e.isDirectory())continue;let n=_.join(t,p);if(!v.lstatSync(n,{throwIfNoEntry:!1})?.isSymbolicLink())continue;let r=_.resolve(_.dirname(n),v.readlinkSync(n));a(i,r)&&v.rmSync(t,{recursive:!0,force:!0})}r(c,{...l,[D]:[...h]})}function L(e){t(_.join(e,`plugin.json`)).name===`core`&&v.rmSync(e,{recursive:!0,force:!0})}function R(e){let t=_.join(e.options.repoRoot,w,d,l);if(v.lstatSync(t,{throwIfNoEntry:!1})?.isSymbolicLink())throw Error(`Refusing to use unmanaged Antigravity path: ${t}`);if(!e.sharedSkills){L(t);return}let n=_.join(e.options.repoRoot,`.claude`,p);if(!v.existsSync(n)){L(t);return}P(t);let i=_.join(t,p);P(i),r(_.join(t,f),{name:l});let a=new Set;for(let e of v.readdirSync(n,{withFileTypes:!0}))e.isDirectory()&&(a.add(e.name),F(_.join(i,e.name),_.join(n,e.name)));for(let e of v.readdirSync(i)){if(a.has(e))continue;let t=_.join(i,e);v.lstatSync(t).isSymbolicLink()&&v.rmSync(t,{force:!0})}}function z(e){let i=_.join(e.options.repoRoot,`.antigravity-local`,E),a=_.join(e.options.repoRoot,C,E),o=_.join(e.options.repoRoot,C,y),s=t(o);if(!v.existsSync(i)){s.hooks===!0&&v.rmSync(a,{force:!0}),r(o,{...s,hooks:!1});return}let c=v.readFileSync(i,`utf8`).replaceAll(`$AGY_REPO_ROOT`,e.options.repoRoot),l=v.lstatSync(a,{throwIfNoEntry:!1});if(l&&s.hooks!==!0&&(!l.isFile()||v.readFileSync(a,`utf8`)!==c))throw Error(`Refusing to replace unmanaged Antigravity path: ${a}`);n(a,c),r(o,{...s,hooks:!0})}function B(e){return[...e.options.skipPermissions?[m]:[],...h(e),...e.options.providerArgs]}async function V(e){let t=e.environment.HOME;if(!t)throw Error(`HOME is required for Antigravity compatibility`);let n=_.join(t,O,k,`.doom-pi-sync.lock`),r=await i(n);try{j(e),N(e),I(e),R(e),z(e)}finally{await r()}return o(`agy`,B(e),e.options.repoRoot,e.environment)}export{A as adaptAntigravityMcpDefinition,B as antigravityCompatibilityArgs,V as launchAntigravity};
2
2
  //# sourceMappingURL=antigravity.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"antigravity.mjs","names":[],"sources":["../../../../src/adapters/compatibility/antigravity.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { isRecord, readJson, writeFileAtomic, writeJson } from '../serialization/json';\nimport type { JsonObject } from '../serialization/json';\nimport type { CompatibilityContext } from '../compatibilityContext.ts';\nimport { acquireDirectoryLock, pathInside, runInteractive } from './process.ts';\nimport {\n AGIFLOW_PROXY_SERVER_NAME,\n ANTIGRAVITY_MCP_PROXY_PACKAGE,\n additionalDirectoryArgs,\n CORE_PLUGIN_NAME,\n MCP_SERVERS_KEY,\n mcpProxyArguments,\n NPX_COMMAND,\n PLUGIN_MANIFEST_FILENAME,\n PLUGINS_DIRECTORY,\n SKILLS_DIRECTORY,\n SKIP_PERMISSIONS_OPTION,\n} from './shared.ts';\n\n/**\n * Antigravity state synchronisation.\n *\n * Antigravity reads its configuration from the workspace and from the user's\n * home directory rather than from arguments, so every selection has to be\n * written to disk before launch and reverted when it is no longer selected.\n * Everything the harness writes is tracked in a managed-state file so a file\n * the user created by hand is never silently replaced.\n */\n\nconst ANTIGRAVITY_PROVIDER = 'agy';\nconst AGY_MANAGED_STATE = '.doom-pi-managed.json';\nconst ANTIGRAVITY_PROXY_SERVER_NAME = 'mcp-proxy';\nconst PROJECT_MCP_SERVER_NAME = 'project-mcp';\nconst PENCIL_SERVER_NAME = 'pencil';\nconst ANTIGRAVITY_SYNC_LOCK = '.doom-pi-sync.lock';\nconst AGENTS_DIRECTORY = '.agents';\nconst GENERATED_AGENTS_DIRECTORY = '_agents';\nconst CODEX_PLUGIN_DIRECTORY = '.codex-plugin';\nconst MCP_CONFIG_FILENAME = 'mcp_config.json';\nconst HOOKS_CONFIG_FILENAME = 'hooks.json';\nconst MANAGED_PLUGINS_KEY = 'plugins';\nconst MCP_PROXY_TIMEOUT_MS = 1_200_000;\nconst GEMINI_DIRECTORY = '.gemini';\nconst ANTIGRAVITY_CLI_DIRECTORY = 'antigravity-cli';\nconst ANTIGRAVITY_SETTINGS_FILENAME = 'settings.json';\nconst ANTIGRAVITY_LOCAL_DIRECTORY = '.antigravity-local';\nconst CLAUDE_DIRECTORY = '.claude';\nconst DEFAULT_ANTIGRAVITY_MODEL = 'Gemini 3.5 Flash';\nconst REPO_ROOT_PLACEHOLDER = '$AGY_REPO_ROOT';\n\n/** Rewrites one MCP server definition into the shape Antigravity expects. */\nexport function adaptAntigravityMcpDefinition(definition: JsonObject, repoRoot: string): JsonObject | undefined {\n if (typeof definition.command === 'string') {\n const adapted: JsonObject = {\n ...definition,\n command: definition.command,\n args: Array.isArray(definition.args) ? definition.args.map(String) : [],\n cwd: typeof definition.cwd === 'string' ? definition.cwd : repoRoot,\n };\n delete adapted.type;\n return adapted;\n }\n const url = typeof definition.url === 'string' ? definition.url : undefined;\n if (!url) return undefined;\n const adapted: JsonObject = { ...definition, serverUrl: url };\n delete adapted.type;\n delete adapted.url;\n return adapted;\n}\n\nfunction syncAntigravityMcp(context: CompatibilityContext): void {\n const repoRoot = context.options.repoRoot;\n const workspacePath = path.join(repoRoot, AGENTS_DIRECTORY, MCP_CONFIG_FILENAME);\n const managedPath = path.join(repoRoot, AGENTS_DIRECTORY, AGY_MANAGED_STATE);\n const workspace = readJson(workspacePath);\n const workspaceMcpServers = workspace[MCP_SERVERS_KEY];\n const workspaceServers = isRecord(workspaceMcpServers) ? { ...workspaceMcpServers } : {};\n const previousManaged = readJson(managedPath);\n const previousMcpServers = previousManaged[MCP_SERVERS_KEY];\n const previousNames = Array.isArray(previousMcpServers) ? previousMcpServers.map(String) : [];\n for (const name of new Set([\n ...previousNames,\n ANTIGRAVITY_PROXY_SERVER_NAME,\n PROJECT_MCP_SERVER_NAME,\n PENCIL_SERVER_NAME,\n ])) {\n delete workspaceServers[name];\n }\n\n const selectedConfig = readJson(context.mcpConfigPath);\n const selectedMcpServers = selectedConfig[MCP_SERVERS_KEY];\n const selectedServers = isRecord(selectedMcpServers) ? selectedMcpServers : {};\n const allowed = context.mcpAllowlist?.servers;\n const keeps = (name: string): boolean => !allowed || allowed.length === 0 || allowed.includes(name);\n const managedNames: string[] = [];\n\n if (keeps(AGIFLOW_PROXY_SERVER_NAME)) {\n workspaceServers[ANTIGRAVITY_PROXY_SERVER_NAME] = {\n command: NPX_COMMAND,\n args: mcpProxyArguments(ANTIGRAVITY_MCP_PROXY_PACKAGE, context.proxyConfigPath, true),\n cwd: repoRoot,\n timeout: MCP_PROXY_TIMEOUT_MS,\n };\n managedNames.push(ANTIGRAVITY_PROXY_SERVER_NAME);\n }\n\n const directNames = context.mcpAllowlist ? (allowed ?? []) : [PROJECT_MCP_SERVER_NAME, PENCIL_SERVER_NAME];\n for (const name of directNames) {\n if (name === AGIFLOW_PROXY_SERVER_NAME) continue;\n const definition = selectedServers[name];\n if (!isRecord(definition)) continue;\n const adapted = adaptAntigravityMcpDefinition(definition, repoRoot);\n if (!adapted) continue;\n workspaceServers[name] = adapted;\n managedNames.push(name);\n }\n\n writeJson(workspacePath, { ...workspace, [MCP_SERVERS_KEY]: workspaceServers });\n writeJson(managedPath, { ...previousManaged, [MCP_SERVERS_KEY]: managedNames });\n\n const home = context.environment.HOME;\n if (!home) return;\n // Earlier releases wrote these servers into the Gemini config. Leaving them\n // there would double every tool, so they are removed wherever they are found.\n for (const legacyPath of [\n path.join(home, GEMINI_DIRECTORY, 'config', MCP_CONFIG_FILENAME),\n path.join(home, GEMINI_DIRECTORY, 'config', PLUGINS_DIRECTORY, 'shared', MCP_CONFIG_FILENAME),\n ]) {\n if (!fs.existsSync(legacyPath)) continue;\n const legacy = readJson(legacyPath);\n const legacyMcpServers = legacy[MCP_SERVERS_KEY];\n const servers = isRecord(legacyMcpServers) ? { ...legacyMcpServers } : {};\n for (const name of [\n ANTIGRAVITY_PROXY_SERVER_NAME,\n AGIFLOW_PROXY_SERVER_NAME,\n PROJECT_MCP_SERVER_NAME,\n PENCIL_SERVER_NAME,\n ]) {\n delete servers[name];\n }\n writeJson(legacyPath, { ...legacy, [MCP_SERVERS_KEY]: servers });\n }\n}\n\nfunction antigravitySettingsPath(home: string): string {\n return path.join(home, GEMINI_DIRECTORY, ANTIGRAVITY_CLI_DIRECTORY, ANTIGRAVITY_SETTINGS_FILENAME);\n}\n\nfunction syncAntigravityModel(context: CompatibilityContext): void {\n const home = context.environment.HOME;\n if (!home) throw new Error('HOME is required for Antigravity compatibility');\n const settingsPath = antigravitySettingsPath(home);\n const settings = readJson(settingsPath);\n if (!settings.model) settings.model = context.environment.AGY_MODEL ?? DEFAULT_ANTIGRAVITY_MODEL;\n const trusted = Array.isArray(settings.trustedWorkspaces) ? settings.trustedWorkspaces.map(String) : [];\n if (!trusted.includes(context.options.repoRoot)) trusted.push(context.options.repoRoot);\n settings.trustedWorkspaces = trusted;\n writeJson(settingsPath, settings);\n}\n\nfunction ensureManagedDirectory(directory: string): void {\n const stat = fs.lstatSync(directory, { throwIfNoEntry: false });\n if (stat && !stat.isDirectory()) {\n throw new Error(`Refusing to use unmanaged Antigravity path: ${directory}`);\n }\n if (!stat) fs.mkdirSync(directory, { recursive: true });\n}\n\nfunction replaceManagedSkillLink(linkPath: string, sourcePath: string): void {\n if (fs.existsSync(linkPath) || fs.lstatSync(linkPath, { throwIfNoEntry: false })) {\n const stat = fs.lstatSync(linkPath);\n if (!stat.isSymbolicLink()) throw new Error(`Refusing to replace unmanaged Antigravity path: ${linkPath}`);\n fs.rmSync(linkPath, { force: true });\n }\n fs.symlinkSync(sourcePath, linkPath, 'dir');\n}\n\nfunction syncAntigravityPlugins(context: CompatibilityContext): void {\n const repoRoot = context.options.repoRoot;\n const pluginsRoot = path.join(repoRoot, PLUGINS_DIRECTORY);\n const agentsRoot = path.join(repoRoot, GENERATED_AGENTS_DIRECTORY);\n const targetRoot = path.join(agentsRoot, PLUGINS_DIRECTORY);\n const managedPath = path.join(repoRoot, AGENTS_DIRECTORY, AGY_MANAGED_STATE);\n const managed = readJson(managedPath);\n const previousPlugins = managed[MANAGED_PLUGINS_KEY];\n const previousNames = new Set(Array.isArray(previousPlugins) ? previousPlugins.map(String) : []);\n ensureManagedDirectory(agentsRoot);\n ensureManagedDirectory(targetRoot);\n const selectedNames = new Set<string>();\n\n for (const plugin of context.plugins) {\n const manifestPath = path.join(plugin.directory, CODEX_PLUGIN_DIRECTORY, PLUGIN_MANIFEST_FILENAME);\n if (!fs.existsSync(manifestPath)) continue;\n const manifest = readJson(manifestPath);\n const pluginName =\n typeof manifest.name === 'string' && manifest.name ? manifest.name : path.basename(plugin.directory);\n if (\n pluginName === '.' ||\n pluginName === '..' ||\n pluginName.toLowerCase() === CORE_PLUGIN_NAME ||\n pluginName.includes('/') ||\n pluginName.includes('\\\\')\n ) {\n throw new Error(`Invalid Antigravity plugin name: ${pluginName}`);\n }\n const target = path.join(targetRoot, pluginName);\n selectedNames.add(pluginName);\n ensureManagedDirectory(target);\n writeJson(path.join(target, PLUGIN_MANIFEST_FILENAME), { name: pluginName });\n const skills = path.join(plugin.directory, SKILLS_DIRECTORY);\n const skillsLink = path.join(target, SKILLS_DIRECTORY);\n if (fs.existsSync(skills)) {\n replaceManagedSkillLink(skillsLink, skills);\n } else if (fs.lstatSync(skillsLink, { throwIfNoEntry: false })?.isSymbolicLink()) {\n fs.rmSync(skillsLink, { force: true });\n }\n }\n\n for (const entry of fs.readdirSync(targetRoot, { withFileTypes: true })) {\n if (entry.name === CORE_PLUGIN_NAME || selectedNames.has(entry.name)) continue;\n const target = path.join(targetRoot, entry.name);\n if (previousNames.has(entry.name)) {\n fs.rmSync(target, { recursive: true, force: true });\n continue;\n }\n if (!entry.isDirectory()) continue;\n // Not in the managed list, but its skills link points into this repository's\n // plugins, so an earlier run created it before the state file existed.\n const skillsLink = path.join(target, SKILLS_DIRECTORY);\n const stat = fs.lstatSync(skillsLink, { throwIfNoEntry: false });\n if (!stat?.isSymbolicLink()) continue;\n const source = path.resolve(path.dirname(skillsLink), fs.readlinkSync(skillsLink));\n if (pathInside(pluginsRoot, source)) fs.rmSync(target, { recursive: true, force: true });\n }\n\n writeJson(managedPath, { ...managed, [MANAGED_PLUGINS_KEY]: [...selectedNames] });\n}\n\nfunction removeManagedCorePlugin(core: string): void {\n if (readJson(path.join(core, PLUGIN_MANIFEST_FILENAME)).name === CORE_PLUGIN_NAME) {\n fs.rmSync(core, { recursive: true, force: true });\n }\n}\n\nfunction syncAntigravitySharedSkills(context: CompatibilityContext): void {\n const core = path.join(context.options.repoRoot, GENERATED_AGENTS_DIRECTORY, PLUGINS_DIRECTORY, CORE_PLUGIN_NAME);\n const coreStat = fs.lstatSync(core, { throwIfNoEntry: false });\n if (coreStat?.isSymbolicLink()) throw new Error(`Refusing to use unmanaged Antigravity path: ${core}`);\n if (!context.sharedSkills) {\n removeManagedCorePlugin(core);\n return;\n }\n\n const source = path.join(context.options.repoRoot, CLAUDE_DIRECTORY, SKILLS_DIRECTORY);\n if (!fs.existsSync(source)) {\n removeManagedCorePlugin(core);\n return;\n }\n ensureManagedDirectory(core);\n const target = path.join(core, SKILLS_DIRECTORY);\n ensureManagedDirectory(target);\n writeJson(path.join(core, PLUGIN_MANIFEST_FILENAME), { name: CORE_PLUGIN_NAME });\n const selected = new Set<string>();\n for (const entry of fs.readdirSync(source, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue;\n selected.add(entry.name);\n replaceManagedSkillLink(path.join(target, entry.name), path.join(source, entry.name));\n }\n for (const entry of fs.readdirSync(target)) {\n if (selected.has(entry)) continue;\n const candidate = path.join(target, entry);\n if (fs.lstatSync(candidate).isSymbolicLink()) fs.rmSync(candidate, { force: true });\n }\n}\n\nfunction syncAntigravityHooks(context: CompatibilityContext): void {\n const source = path.join(context.options.repoRoot, ANTIGRAVITY_LOCAL_DIRECTORY, HOOKS_CONFIG_FILENAME);\n const target = path.join(context.options.repoRoot, AGENTS_DIRECTORY, HOOKS_CONFIG_FILENAME);\n const managedPath = path.join(context.options.repoRoot, AGENTS_DIRECTORY, AGY_MANAGED_STATE);\n const managed = readJson(managedPath);\n if (!fs.existsSync(source)) {\n if (managed.hooks === true) fs.rmSync(target, { force: true });\n writeJson(managedPath, { ...managed, hooks: false });\n return;\n }\n const content = fs.readFileSync(source, 'utf8').replaceAll(REPO_ROOT_PLACEHOLDER, context.options.repoRoot);\n const targetStat = fs.lstatSync(target, { throwIfNoEntry: false });\n if (targetStat && managed.hooks !== true) {\n if (!targetStat.isFile() || fs.readFileSync(target, 'utf8') !== content) {\n throw new Error(`Refusing to replace unmanaged Antigravity path: ${target}`);\n }\n }\n writeFileAtomic(target, content);\n writeJson(managedPath, { ...managed, hooks: true });\n}\n\nexport function antigravityCompatibilityArgs(context: CompatibilityContext): string[] {\n return [SKIP_PERMISSIONS_OPTION, ...additionalDirectoryArgs(context), ...context.options.providerArgs];\n}\n\nexport async function launchAntigravity(context: CompatibilityContext): Promise<number> {\n const home = context.environment.HOME;\n if (!home) throw new Error('HOME is required for Antigravity compatibility');\n // Every step below writes shared state under the user's home directory, so\n // two repositories launching at once have to be serialised.\n const lockPath = path.join(home, GEMINI_DIRECTORY, ANTIGRAVITY_CLI_DIRECTORY, ANTIGRAVITY_SYNC_LOCK);\n const releaseLock = await acquireDirectoryLock(lockPath);\n try {\n syncAntigravityMcp(context);\n syncAntigravityModel(context);\n syncAntigravityPlugins(context);\n syncAntigravitySharedSkills(context);\n syncAntigravityHooks(context);\n } finally {\n await releaseLock();\n }\n return runInteractive(\n ANTIGRAVITY_PROVIDER,\n antigravityCompatibilityArgs(context),\n context.options.repoRo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AAG,EAAQ,QAAQ,YAAY,CACvG,CAEA,eAAsB,EAAkB,EAAgD,CACtF,IAAM,EAAO,EAAQ,YAAY,KACjC,GAAI,CAAC,EAAM,MAAU,MAAM,gDAAgD,EAG3E,IAAM,EAAW,EAAK,KAAK,EAAM,EAAkB,EAA2B,oBAAqB,EAC7F,EAAc,MAAM,EAAqB,CAAQ,EACvD,GAAI,CACF,EAAmB,CAAO,EAC1B,EAAqB,CAAO,EAC5B,EAAuB,CAAO,EAC9B,EAA4B,CAAO,EACnC,EAAqB,CAAO,CAC9B,QAAU,CACR,MAAM,EAAY,CACpB,CACA,OAAO,EACL,MACA,EAA6B,CAAO,EACpC,EAAQ,QAAQ,SAChB,EAAQ,WACV,CACF"}
1
+ {"version":3,"file":"antigravity.mjs","names":[],"sources":["../../../../src/adapters/compatibility/antigravity.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { isRecord, readJson, writeFileAtomic, writeJson } from '../serialization/json';\nimport type { JsonObject } from '../serialization/json';\nimport type { CompatibilityContext } from '../compatibilityContext.ts';\nimport { acquireDirectoryLock, pathInside, runInteractive } from './process.ts';\nimport {\n AGIFLOW_PROXY_SERVER_NAME,\n ANTIGRAVITY_MCP_PROXY_PACKAGE,\n additionalDirectoryArgs,\n CORE_PLUGIN_NAME,\n MCP_SERVERS_KEY,\n mcpProxyArguments,\n NPX_COMMAND,\n PLUGIN_MANIFEST_FILENAME,\n PLUGINS_DIRECTORY,\n SKILLS_DIRECTORY,\n SKIP_PERMISSIONS_OPTION,\n} from './shared.ts';\n\n/**\n * Antigravity state synchronisation.\n *\n * Antigravity reads its configuration from the workspace and from the user's\n * home directory rather than from arguments, so every selection has to be\n * written to disk before launch and reverted when it is no longer selected.\n * Everything the harness writes is tracked in a managed-state file so a file\n * the user created by hand is never silently replaced.\n */\n\nconst ANTIGRAVITY_PROVIDER = 'agy';\nconst AGY_MANAGED_STATE = '.doom-pi-managed.json';\nconst ANTIGRAVITY_PROXY_SERVER_NAME = 'mcp-proxy';\nconst PROJECT_MCP_SERVER_NAME = 'project-mcp';\nconst PENCIL_SERVER_NAME = 'pencil';\nconst ANTIGRAVITY_SYNC_LOCK = '.doom-pi-sync.lock';\nconst AGENTS_DIRECTORY = '.agents';\nconst GENERATED_AGENTS_DIRECTORY = '_agents';\nconst CODEX_PLUGIN_DIRECTORY = '.codex-plugin';\nconst MCP_CONFIG_FILENAME = 'mcp_config.json';\nconst HOOKS_CONFIG_FILENAME = 'hooks.json';\nconst MANAGED_PLUGINS_KEY = 'plugins';\nconst MCP_PROXY_TIMEOUT_MS = 1_200_000;\nconst GEMINI_DIRECTORY = '.gemini';\nconst ANTIGRAVITY_CLI_DIRECTORY = 'antigravity-cli';\nconst ANTIGRAVITY_SETTINGS_FILENAME = 'settings.json';\nconst ANTIGRAVITY_LOCAL_DIRECTORY = '.antigravity-local';\nconst CLAUDE_DIRECTORY = '.claude';\nconst DEFAULT_ANTIGRAVITY_MODEL = 'Gemini 3.5 Flash';\nconst REPO_ROOT_PLACEHOLDER = '$AGY_REPO_ROOT';\n\n/** Rewrites one MCP server definition into the shape Antigravity expects. */\nexport function adaptAntigravityMcpDefinition(definition: JsonObject, repoRoot: string): JsonObject | undefined {\n if (typeof definition.command === 'string') {\n const adapted: JsonObject = {\n ...definition,\n command: definition.command,\n args: Array.isArray(definition.args) ? definition.args.map(String) : [],\n cwd: typeof definition.cwd === 'string' ? definition.cwd : repoRoot,\n };\n delete adapted.type;\n return adapted;\n }\n const url = typeof definition.url === 'string' ? definition.url : undefined;\n if (!url) return undefined;\n const adapted: JsonObject = { ...definition, serverUrl: url };\n delete adapted.type;\n delete adapted.url;\n return adapted;\n}\n\nfunction syncAntigravityMcp(context: CompatibilityContext): void {\n const repoRoot = context.options.repoRoot;\n const workspacePath = path.join(repoRoot, AGENTS_DIRECTORY, MCP_CONFIG_FILENAME);\n const managedPath = path.join(repoRoot, AGENTS_DIRECTORY, AGY_MANAGED_STATE);\n const workspace = readJson(workspacePath);\n const workspaceMcpServers = workspace[MCP_SERVERS_KEY];\n const workspaceServers = isRecord(workspaceMcpServers) ? { ...workspaceMcpServers } : {};\n const previousManaged = readJson(managedPath);\n const previousMcpServers = previousManaged[MCP_SERVERS_KEY];\n const previousNames = Array.isArray(previousMcpServers) ? previousMcpServers.map(String) : [];\n for (const name of new Set([\n ...previousNames,\n ANTIGRAVITY_PROXY_SERVER_NAME,\n PROJECT_MCP_SERVER_NAME,\n PENCIL_SERVER_NAME,\n ])) {\n delete workspaceServers[name];\n }\n\n const selectedConfig = readJson(context.mcpConfigPath);\n const selectedMcpServers = selectedConfig[MCP_SERVERS_KEY];\n const selectedServers = isRecord(selectedMcpServers) ? selectedMcpServers : {};\n const allowed = context.mcpAllowlist?.servers;\n const keeps = (name: string): boolean => !allowed || allowed.length === 0 || allowed.includes(name);\n const managedNames: string[] = [];\n\n if (keeps(AGIFLOW_PROXY_SERVER_NAME)) {\n workspaceServers[ANTIGRAVITY_PROXY_SERVER_NAME] = {\n command: NPX_COMMAND,\n args: mcpProxyArguments(ANTIGRAVITY_MCP_PROXY_PACKAGE, context.proxyConfigPath, true),\n cwd: repoRoot,\n timeout: MCP_PROXY_TIMEOUT_MS,\n };\n managedNames.push(ANTIGRAVITY_PROXY_SERVER_NAME);\n }\n\n const directNames = context.mcpAllowlist ? (allowed ?? []) : [PROJECT_MCP_SERVER_NAME, PENCIL_SERVER_NAME];\n for (const name of directNames) {\n if (name === AGIFLOW_PROXY_SERVER_NAME) continue;\n const definition = selectedServers[name];\n if (!isRecord(definition)) continue;\n const adapted = adaptAntigravityMcpDefinition(definition, repoRoot);\n if (!adapted) continue;\n workspaceServers[name] = adapted;\n managedNames.push(name);\n }\n\n writeJson(workspacePath, { ...workspace, [MCP_SERVERS_KEY]: workspaceServers });\n writeJson(managedPath, { ...previousManaged, [MCP_SERVERS_KEY]: managedNames });\n\n const home = context.environment.HOME;\n if (!home) return;\n // Earlier releases wrote these servers into the Gemini config. Leaving them\n // there would double every tool, so they are removed wherever they are found.\n for (const legacyPath of [\n path.join(home, GEMINI_DIRECTORY, 'config', MCP_CONFIG_FILENAME),\n path.join(home, GEMINI_DIRECTORY, 'config', PLUGINS_DIRECTORY, 'shared', MCP_CONFIG_FILENAME),\n ]) {\n if (!fs.existsSync(legacyPath)) continue;\n const legacy = readJson(legacyPath);\n const legacyMcpServers = legacy[MCP_SERVERS_KEY];\n const servers = isRecord(legacyMcpServers) ? { ...legacyMcpServers } : {};\n for (const name of [\n ANTIGRAVITY_PROXY_SERVER_NAME,\n AGIFLOW_PROXY_SERVER_NAME,\n PROJECT_MCP_SERVER_NAME,\n PENCIL_SERVER_NAME,\n ]) {\n delete servers[name];\n }\n writeJson(legacyPath, { ...legacy, [MCP_SERVERS_KEY]: servers });\n }\n}\n\nfunction antigravitySettingsPath(home: string): string {\n return path.join(home, GEMINI_DIRECTORY, ANTIGRAVITY_CLI_DIRECTORY, ANTIGRAVITY_SETTINGS_FILENAME);\n}\n\nfunction syncAntigravityModel(context: CompatibilityContext): void {\n const home = context.environment.HOME;\n if (!home) throw new Error('HOME is required for Antigravity compatibility');\n const settingsPath = antigravitySettingsPath(home);\n const settings = readJson(settingsPath);\n if (!settings.model) settings.model = context.environment.AGY_MODEL ?? DEFAULT_ANTIGRAVITY_MODEL;\n const trusted = Array.isArray(settings.trustedWorkspaces) ? settings.trustedWorkspaces.map(String) : [];\n // Trusting a workspace outlives the run that added it, and this file belongs\n // to Antigravity rather than to DoomPi, so say which file gained the entry.\n if (!trusted.includes(context.options.repoRoot)) {\n trusted.push(context.options.repoRoot);\n process.stderr.write(`[doompi] trusting ${context.options.repoRoot} in ${settingsPath}\\n`);\n }\n settings.trustedWorkspaces = trusted;\n writeJson(settingsPath, settings);\n}\n\nfunction ensureManagedDirectory(directory: string): void {\n const stat = fs.lstatSync(directory, { throwIfNoEntry: false });\n if (stat && !stat.isDirectory()) {\n throw new Error(`Refusing to use unmanaged Antigravity path: ${directory}`);\n }\n if (!stat) fs.mkdirSync(directory, { recursive: true });\n}\n\nfunction replaceManagedSkillLink(linkPath: string, sourcePath: string): void {\n if (fs.existsSync(linkPath) || fs.lstatSync(linkPath, { throwIfNoEntry: false })) {\n const stat = fs.lstatSync(linkPath);\n if (!stat.isSymbolicLink()) throw new Error(`Refusing to replace unmanaged Antigravity path: ${linkPath}`);\n fs.rmSync(linkPath, { force: true });\n }\n fs.symlinkSync(sourcePath, linkPath, 'dir');\n}\n\nfunction syncAntigravityPlugins(context: CompatibilityContext): void {\n const repoRoot = context.options.repoRoot;\n const pluginsRoot = path.join(repoRoot, PLUGINS_DIRECTORY);\n const agentsRoot = path.join(repoRoot, GENERATED_AGENTS_DIRECTORY);\n const targetRoot = path.join(agentsRoot, PLUGINS_DIRECTORY);\n const managedPath = path.join(repoRoot, AGENTS_DIRECTORY, AGY_MANAGED_STATE);\n const managed = readJson(managedPath);\n const previousPlugins = managed[MANAGED_PLUGINS_KEY];\n const previousNames = new Set(Array.isArray(previousPlugins) ? previousPlugins.map(String) : []);\n ensureManagedDirectory(agentsRoot);\n ensureManagedDirectory(targetRoot);\n const selectedNames = new Set<string>();\n\n for (const plugin of context.plugins) {\n const manifestPath = path.join(plugin.directory, CODEX_PLUGIN_DIRECTORY, PLUGIN_MANIFEST_FILENAME);\n if (!fs.existsSync(manifestPath)) continue;\n const manifest = readJson(manifestPath);\n const pluginName =\n typeof manifest.name === 'string' && manifest.name ? manifest.name : path.basename(plugin.directory);\n if (\n pluginName === '.' ||\n pluginName === '..' ||\n pluginName.toLowerCase() === CORE_PLUGIN_NAME ||\n pluginName.includes('/') ||\n pluginName.includes('\\\\')\n ) {\n throw new Error(`Invalid Antigravity plugin name: ${pluginName}`);\n }\n const target = path.join(targetRoot, pluginName);\n selectedNames.add(pluginName);\n ensureManagedDirectory(target);\n writeJson(path.join(target, PLUGIN_MANIFEST_FILENAME), { name: pluginName });\n const skills = path.join(plugin.directory, SKILLS_DIRECTORY);\n const skillsLink = path.join(target, SKILLS_DIRECTORY);\n if (fs.existsSync(skills)) {\n replaceManagedSkillLink(skillsLink, skills);\n } else if (fs.lstatSync(skillsLink, { throwIfNoEntry: false })?.isSymbolicLink()) {\n fs.rmSync(skillsLink, { force: true });\n }\n }\n\n for (const entry of fs.readdirSync(targetRoot, { withFileTypes: true })) {\n if (entry.name === CORE_PLUGIN_NAME || selectedNames.has(entry.name)) continue;\n const target = path.join(targetRoot, entry.name);\n if (previousNames.has(entry.name)) {\n fs.rmSync(target, { recursive: true, force: true });\n continue;\n }\n if (!entry.isDirectory()) continue;\n // Not in the managed list, but its skills link points into this repository's\n // plugins, so an earlier run created it before the state file existed.\n const skillsLink = path.join(target, SKILLS_DIRECTORY);\n const stat = fs.lstatSync(skillsLink, { throwIfNoEntry: false });\n if (!stat?.isSymbolicLink()) continue;\n const source = path.resolve(path.dirname(skillsLink), fs.readlinkSync(skillsLink));\n if (pathInside(pluginsRoot, source)) fs.rmSync(target, { recursive: true, force: true });\n }\n\n writeJson(managedPath, { ...managed, [MANAGED_PLUGINS_KEY]: [...selectedNames] });\n}\n\nfunction removeManagedCorePlugin(core: string): void {\n if (readJson(path.join(core, PLUGIN_MANIFEST_FILENAME)).name === CORE_PLUGIN_NAME) {\n fs.rmSync(core, { recursive: true, force: true });\n }\n}\n\nfunction syncAntigravitySharedSkills(context: CompatibilityContext): void {\n const core = path.join(context.options.repoRoot, GENERATED_AGENTS_DIRECTORY, PLUGINS_DIRECTORY, CORE_PLUGIN_NAME);\n const coreStat = fs.lstatSync(core, { throwIfNoEntry: false });\n if (coreStat?.isSymbolicLink()) throw new Error(`Refusing to use unmanaged Antigravity path: ${core}`);\n if (!context.sharedSkills) {\n removeManagedCorePlugin(core);\n return;\n }\n\n const source = path.join(context.options.repoRoot, CLAUDE_DIRECTORY, SKILLS_DIRECTORY);\n if (!fs.existsSync(source)) {\n removeManagedCorePlugin(core);\n return;\n }\n ensureManagedDirectory(core);\n const target = path.join(core, SKILLS_DIRECTORY);\n ensureManagedDirectory(target);\n writeJson(path.join(core, PLUGIN_MANIFEST_FILENAME), { name: CORE_PLUGIN_NAME });\n const selected = new Set<string>();\n for (const entry of fs.readdirSync(source, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue;\n selected.add(entry.name);\n replaceManagedSkillLink(path.join(target, entry.name), path.join(source, entry.name));\n }\n for (const entry of fs.readdirSync(target)) {\n if (selected.has(entry)) continue;\n const candidate = path.join(target, entry);\n if (fs.lstatSync(candidate).isSymbolicLink()) fs.rmSync(candidate, { force: true });\n }\n}\n\nfunction syncAntigravityHooks(context: CompatibilityContext): void {\n const source = path.join(context.options.repoRoot, ANTIGRAVITY_LOCAL_DIRECTORY, HOOKS_CONFIG_FILENAME);\n const target = path.join(context.options.repoRoot, AGENTS_DIRECTORY, HOOKS_CONFIG_FILENAME);\n const managedPath = path.join(context.options.repoRoot, AGENTS_DIRECTORY, AGY_MANAGED_STATE);\n const managed = readJson(managedPath);\n if (!fs.existsSync(source)) {\n if (managed.hooks === true) fs.rmSync(target, { force: true });\n writeJson(managedPath, { ...managed, hooks: false });\n return;\n }\n const content = fs.readFileSync(source, 'utf8').replaceAll(REPO_ROOT_PLACEHOLDER, context.options.repoRoot);\n const targetStat = fs.lstatSync(target, { throwIfNoEntry: false });\n if (targetStat && managed.hooks !== true) {\n if (!targetStat.isFile() || fs.readFileSync(target, 'utf8') !== content) {\n throw new Error(`Refusing to replace unmanaged Antigravity path: ${target}`);\n }\n }\n writeFileAtomic(target, content);\n writeJson(managedPath, { ...managed, hooks: true });\n}\n\nexport function antigravityCompatibilityArgs(context: CompatibilityContext): string[] {\n return [\n ...(context.options.skipPermissions ? [SKIP_PERMISSIONS_OPTION] : []),\n ...additionalDirectoryArgs(context),\n ...context.options.providerArgs,\n ];\n}\n\nexport async function launchAntigravity(context: CompatibilityContext): Promise<number> {\n const home = context.environment.HOME;\n if (!home) throw new Error('HOME is required for Antigravity compatibility');\n // Every step below writes shared state under the user's home directory, so\n // two repositories launching at once have to be serialised.\n const lockPath = path.join(home, GEMINI_DIRECTORY, ANTIGRAVITY_CLI_DIRECTORY, ANTIGRAVITY_SYNC_LOCK);\n const releaseLock = await acquireDirectoryLock(lockPath);\n try {\n syncAntigravityMcp(context);\n syncAntigravityModel(context);\n syncAntigravityPlugins(context);\n syncAntigravitySharedSkills(context);\n syncAntigravityHooks(context);\n } finally {\n await releaseLock();\n }\n return runInteractive(\n ANTIGRAVITY_PROVIDER,\n antigravityCompatibilityArgs(context),\n context.options.repoRoot,\n context.environment,\n );\n}\n"],"mappings":"mhBA8BA,MACM,EAAoB,wBACpB,EAAgC,YAChC,EAA0B,cAC1B,EAAqB,SAErB,EAAmB,UACnB,EAA6B,UAE7B,EAAsB,kBACtB,EAAwB,aACxB,EAAsB,UAEtB,EAAmB,UACnB,EAA4B,kBAQlC,SAAgB,EAA8B,EAAwB,EAA0C,CAC9G,GAAI,OAAO,EAAW,SAAY,SAAU,CAC1C,IAAM,EAAsB,CAC1B,GAAG,EACH,QAAS,EAAW,QACpB,KAAM,MAAM,QAAQ,EAAW,IAAI,EAAI,EAAW,KAAK,IAAI,MAAM,EAAI,CAAC,EACtE,IAAK,OAAO,EAAW,KAAQ,SAAW,EAAW,IAAM,CAC7D,EAEA,OADA,OAAO,EAAQ,KACR,CACT,CACA,IAAM,EAAM,OAAO,EAAW,KAAQ,SAAW,EAAW,IAAM,IAAA,GAClE,GAAI,CAAC,EAAK,OACV,IAAM,EAAsB,CAAE,GAAG,EAAY,UAAW,CAAI,EAG5D,OAFA,OAAO,EAAQ,KACf,OAAO,EAAQ,IACR,CACT,CAEA,SAAS,EAAmB,EAAqC,CAC/D,IAAM,EAAW,EAAQ,QAAQ,SAC3B,EAAgB,EAAK,KAAK,EAAU,EAAkB,CAAmB,EACzE,EAAc,EAAK,KAAK,EAAU,EAAkB,CAAiB,EACrE,EAAY,EAAS,CAAa,EAClC,EAAsB,EAAU,GAChC,EAAmB,EAAS,CAAmB,EAAI,CAAE,GAAG,CAAoB,EAAI,CAAC,EACjF,EAAkB,EAAS,C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Q,EACpG,EAAa,EAAG,UAAU,EAAQ,CAAE,eAAgB,EAAM,CAAC,EACjE,GAAI,GAAc,EAAQ,QAAU,KAC9B,CAAC,EAAW,OAAO,GAAK,EAAG,aAAa,EAAQ,MAAM,IAAM,GAC9D,MAAU,MAAM,mDAAmD,GAAQ,EAG/E,EAAgB,EAAQ,CAAO,EAC/B,EAAU,EAAa,CAAE,GAAG,EAAS,MAAO,EAAK,CAAC,CACpD,CAEA,SAAgB,EAA6B,EAAyC,CACpF,MAAO,CACL,GAAI,EAAQ,QAAQ,gBAAkB,CAAC,CAAuB,EAAI,CAAC,EACnE,GAAG,EAAwB,CAAO,EAClC,GAAG,EAAQ,QAAQ,YACrB,CACF,CAEA,eAAsB,EAAkB,EAAgD,CACtF,IAAM,EAAO,EAAQ,YAAY,KACjC,GAAI,CAAC,EAAM,MAAU,MAAM,gDAAgD,EAG3E,IAAM,EAAW,EAAK,KAAK,EAAM,EAAkB,EAA2B,oBAAqB,EAC7F,EAAc,MAAM,EAAqB,CAAQ,EACvD,GAAI,CACF,EAAmB,CAAO,EAC1B,EAAqB,CAAO,EAC5B,EAAuB,CAAO,EAC9B,EAA4B,CAAO,EACnC,EAAqB,CAAO,CAC9B,QAAU,CACR,MAAM,EAAY,CACpB,CACA,OAAO,EACL,MACA,EAA6B,CAAO,EACpC,EAAQ,QAAQ,SAChB,EAAQ,WACV,CACF"}
@@ -1,2 +1,2 @@
1
- const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("./process.cjs"),n=require("./shared.cjs");let r=require("node:path");r=e.__toESM(r,1);let i=require("node:fs");i=e.__toESM(i,1);let a=require("node:child_process");const o=`codex`,s=`--profile`,c=`--profile-v2`,l=/^[A-Za-z0-9_-]+$/,u=[`tools`,`harness`,`sync-codex-state.cjs`];function d(e){return new Set([s,c,`-c`,n.MCP_CONFIG_OPTION,`--enable`,`--disable`,`--remote`,`--remote-auth-token-env`,`-i`,`--image`,`-m`,`--model`,`--local-provider`,`-s`,`--sandbox`,`-C`,`--cd`,n.ADD_DIRECTORY_OPTION,`-a`,`--ask-for-approval`]).has(e)}function f(e){let t=!1,n=``,r=``;for(let i of e){if(t){t=!1;continue}if(d(i)){t=!0;continue}if(!i.startsWith(`-`)){if(!n){n=i;continue}n===`debug`&&!r&&(r=i);break}}return!n||[`exec`,`e`,`review`,`resume`,`fork`].includes(n)?!0:n===`debug`?r===`prompt-input`:![`login`,`logout`,`mcp`,`plugin`,`mcp-server`,`app-server`,`remote-control`,`app`,`completion`,`update`,`doctor`,`sandbox`,`apply`,`a`,`cloud`,`exec-server`,`features`,`archive`,`delete`,`unarchive`,`help`].includes(n)}function p(e){let t=r.default.join(e.options.repoRoot,n.PLUGINS_DIRECTORY);return e.plugins.map(e=>{let n=r.default.relative(t,e.directory);if(!n||n===`..`||n.startsWith(`..${r.default.sep}`)||n.includes(r.default.sep))throw Error(`Codex compatibility requires a direct repository plugin: ${e.directory}`);return n})}function m(e){return n.mcpProxyArguments(n.MCP_PROXY_PACKAGE,e.proxyConfigPath,!0,!0)}function h(e,t,r){let a=[`--yolo`,`--enable`,`hooks`,...n.additionalDirectoryArgs(e)];if(f(e.options.providerArgs)){if(a.push(r,t),e.personaFile){let t=i.default.readFileSync(e.personaFile,`utf8`);a.push(`-c`,`developer_instructions=${JSON.stringify(t)}`)}e.mcpAllowlist&&a.push(`-c`,`mcp_servers.${n.AGIFLOW_PROXY_SERVER_NAME}.args=${JSON.stringify(m(e))}`)}return[...a,...e.options.providerArgs]}function g(e){let t={...e.environment},n=(0,a.spawnSync)(`git`,[`-C`,e.options.repoRoot,`remote`,`get-url`,`origin`],{encoding:`utf8`,env:t});return t.CODEX_REPO_ORIGIN=n.status===0?n.stdout.trim():``,t.CODEX_PROFILE_NAMES=e.options.domains.join(`,`),t.CODEX_PLUGIN_DIRS=p(e).join(`,`),t.CODEX_ENABLE_XCODE_MCP=(0,a.spawnSync)(`xcrun`,[`mcpbridge`,`--help`],{env:t,stdio:`ignore`}).status===0?`1`:`0`,t}async function _(e){let i=g(e),a=r.default.join(e.options.repoRoot,...u),d=t.runCaptured(process.execPath,[a,`owner-key`],e.options.repoRoot,i),f=i.HOME;i.CODEX_LEGACY_HOME=f?r.default.join(f,`.codex`,`agirepo`):void 0,i.CODEX_HOME=f?r.default.join(f,`.codex`,d):r.default.join(e.options.repoRoot,`.codex-local`,`state`,d),t.runChecked(`npx`,[...n.mcpProxyArguments(n.MCP_PROXY_PACKAGE,e.proxyConfigPath,!0),n.MCP_PRESTART_OPTION],e.options.repoRoot,i);let p=t.runCaptured(process.execPath,[a,`sync`],e.options.repoRoot,i),m=JSON.parse(p);if(typeof m.profileConfigName!=`string`||!l.test(m.profileConfigName))throw Error(`Codex sync returned an invalid profile config name`);let _=t.runCaptured(`codex`,[`--help`],e.options.repoRoot,i).includes(c)?c:s;return t.runInteractive(o,h(e,m.profileConfigName,_),e.options.repoRoot,i)}exports.CODEX_PROVIDER=o,exports.codexCompatibilityArgs=h,exports.codexEnvironment=g,exports.codexPluginDirectories=p,exports.launchCodex=_,exports.supportsCodexManagedProfile=f;
1
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("./process.cjs"),n=require("./shared.cjs");let r=require("node:path");r=e.__toESM(r,1);let i=require("node:fs");i=e.__toESM(i,1);let a=require("node:child_process");const o=`codex`,s=`--profile`,c=`--profile-v2`,l=/^[A-Za-z0-9_-]+$/,u=[`tools`,`harness`,`sync-codex-state.cjs`];function d(e){return new Set([s,c,`-c`,n.MCP_CONFIG_OPTION,`--enable`,`--disable`,`--remote`,`--remote-auth-token-env`,`-i`,`--image`,`-m`,`--model`,`--local-provider`,`-s`,`--sandbox`,`-C`,`--cd`,n.ADD_DIRECTORY_OPTION,`-a`,`--ask-for-approval`]).has(e)}function f(e){let t=!1,n=``,r=``;for(let i of e){if(t){t=!1;continue}if(d(i)){t=!0;continue}if(!i.startsWith(`-`)){if(!n){n=i;continue}n===`debug`&&!r&&(r=i);break}}return!n||[`exec`,`e`,`review`,`resume`,`fork`].includes(n)?!0:n===`debug`?r===`prompt-input`:![`login`,`logout`,`mcp`,`plugin`,`mcp-server`,`app-server`,`remote-control`,`app`,`completion`,`update`,`doctor`,`sandbox`,`apply`,`a`,`cloud`,`exec-server`,`features`,`archive`,`delete`,`unarchive`,`help`].includes(n)}function p(e){let t=r.default.join(e.options.repoRoot,n.PLUGINS_DIRECTORY);return e.plugins.map(e=>{let n=r.default.relative(t,e.directory);if(!n||n===`..`||n.startsWith(`..${r.default.sep}`)||n.includes(r.default.sep))throw Error(`Codex compatibility requires a direct repository plugin: ${e.directory}`);return n})}function m(e){return n.mcpProxyArguments(n.MCP_PROXY_PACKAGE,e.proxyConfigPath,!0,!0)}function h(e,t,r){let a=[...e.options.skipPermissions?[`--yolo`]:[],`--enable`,`hooks`,...n.additionalDirectoryArgs(e)];if(f(e.options.providerArgs)){if(a.push(r,t),e.personaFile){let t=i.default.readFileSync(e.personaFile,`utf8`);a.push(`-c`,`developer_instructions=${JSON.stringify(t)}`)}e.mcpAllowlist&&a.push(`-c`,`mcp_servers.${n.AGIFLOW_PROXY_SERVER_NAME}.args=${JSON.stringify(m(e))}`)}return[...a,...e.options.providerArgs]}function g(e){let t={...e.environment},n=(0,a.spawnSync)(`git`,[`-C`,e.options.repoRoot,`remote`,`get-url`,`origin`],{encoding:`utf8`,env:t});return t.CODEX_REPO_ORIGIN=n.status===0?n.stdout.trim():``,t.CODEX_PROFILE_NAMES=e.options.domains.join(`,`),t.CODEX_PLUGIN_DIRS=p(e).join(`,`),t.CODEX_ENABLE_XCODE_MCP=(0,a.spawnSync)(`xcrun`,[`mcpbridge`,`--help`],{env:t,stdio:`ignore`}).status===0?`1`:`0`,t}async function _(e){let i=g(e),a=r.default.join(e.options.repoRoot,...u),d=t.runCaptured(process.execPath,[a,`owner-key`],e.options.repoRoot,i),f=i.HOME;i.CODEX_LEGACY_HOME=f?r.default.join(f,`.codex`,`agirepo`):void 0,i.CODEX_HOME=f?r.default.join(f,`.codex`,d):r.default.join(e.options.repoRoot,`.codex-local`,`state`,d),t.runChecked(`npx`,[...n.mcpProxyArguments(n.MCP_PROXY_PACKAGE,e.proxyConfigPath,!0),n.MCP_PRESTART_OPTION],e.options.repoRoot,i);let p=t.runCaptured(process.execPath,[a,`sync`],e.options.repoRoot,i),m=JSON.parse(p);if(typeof m.profileConfigName!=`string`||!l.test(m.profileConfigName))throw Error(`Codex sync returned an invalid profile config name`);let _=t.runCaptured(`codex`,[`--help`],e.options.repoRoot,i).includes(c)?c:s;return t.runInteractive(o,h(e,m.profileConfigName,_),e.options.repoRoot,i)}exports.CODEX_PROVIDER=o,exports.codexCompatibilityArgs=h,exports.codexEnvironment=g,exports.codexPluginDirectories=p,exports.launchCodex=_,exports.supportsCodexManagedProfile=f;
2
2
  //# sourceMappingURL=codex.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"codex.cjs","names":["MCP_CONFIG_OPTION","ADD_DIRECTORY_OPTION","path","PLUGINS_DIRECTORY","mcpProxyArguments","MCP_PROXY_PACKAGE","additionalDirectoryArgs","fs","AGIFLOW_PROXY_SERVER_NAME","spawnSync","runCaptured","MCP_PRESTART_OPTION","runInteractive"],"sources":["../../../../src/adapters/compatibility/codex.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport type { JsonObject } from '../serialization/json';\nimport type { CompatibilityContext } from '../compatibilityContext.ts';\nimport { runCaptured, runChecked, runInteractive } from './process.ts';\nimport {\n ADD_DIRECTORY_OPTION,\n AGIFLOW_PROXY_SERVER_NAME,\n additionalDirectoryArgs,\n MCP_CONFIG_OPTION,\n MCP_PRESTART_OPTION,\n MCP_PROXY_PACKAGE,\n mcpProxyArguments,\n NPX_COMMAND,\n PLUGINS_DIRECTORY,\n} from './shared.ts';\n\nexport const CODEX_PROVIDER = 'codex';\n\nconst PROFILE_FLAG = '--profile';\nconst PROFILE_V2_FLAG = '--profile-v2';\nconst PROFILE_CONFIG_NAME_PATTERN = /^[A-Za-z0-9_-]+$/;\nconst SYNC_SCRIPT_RELATIVE_PATH = ['tools', 'harness', 'sync-codex-state.cjs'];\n\n/** Codex options that consume the following argument, so it is not a subcommand. */\nfunction optionRequiresValue(argument: string): boolean {\n return new Set([\n PROFILE_FLAG,\n PROFILE_V2_FLAG,\n '-c',\n MCP_CONFIG_OPTION,\n '--enable',\n '--disable',\n '--remote',\n '--remote-auth-token-env',\n '-i',\n '--image',\n '-m',\n '--model',\n '--local-provider',\n '-s',\n '--sandbox',\n '-C',\n '--cd',\n ADD_DIRECTORY_OPTION,\n '-a',\n '--ask-for-approval',\n ]).has(argument);\n}\n\n/**\n * Whether the managed profile, persona, and proxy config apply to this run.\n *\n * Codex management subcommands reject session options, so injecting them would\n * turn `codex login` into an error.\n */\nexport function supportsCodexManagedProfile(args: string[]): boolean {\n let previousRequiresValue = false;\n let command = '';\n let debugSubcommand = '';\n\n for (const argument of args) {\n if (previousRequiresValue) {\n previousRequiresValue = false;\n continue;\n }\n if (optionRequiresValue(argument)) {\n previousRequiresValue = true;\n continue;\n }\n if (argument.startsWith('-')) continue;\n if (!command) {\n command = argument;\n continue;\n }\n if (command === 'debug' && !debugSubcommand) debugSubcommand = argument;\n break;\n }\n\n if (!command || ['exec', 'e', 'review', 'resume', 'fork'].includes(command)) return true;\n if (command === 'debug') return debugSubcommand === 'prompt-input';\n if (\n [\n 'login',\n 'logout',\n 'mcp',\n 'plugin',\n 'mcp-server',\n 'app-server',\n 'remote-control',\n 'app',\n 'completion',\n 'update',\n 'doctor',\n 'sandbox',\n 'apply',\n 'a',\n 'cloud',\n 'exec-server',\n 'features',\n 'archive',\n 'delete',\n 'unarchive',\n 'help',\n ].includes(command)\n ) {\n return false;\n }\n return true;\n}\n\n/** Plugin directory names relative to `plugins/`, which is all Codex accepts. */\nexport function codexPluginDirectories(context: CompatibilityContext): string[] {\n const pluginsRoot = path.join(context.options.repoRoot, PLUGINS_DIRECTORY);\n return context.plugins.map((plugin) => {\n const relative = path.relative(pluginsRoot, plugin.directory);\n if (!relative || relative === '..' || relative.startsWith(`..${path.sep}`) || relative.includes(path.sep)) {\n throw new Error(`Codex compatibility requires a direct repository plugin: ${plugin.directory}`);\n }\n return relative;\n });\n}\n\nfunction codexProxyArguments(context: CompatibilityContext): string[] {\n return mcpProxyArguments(MCP_PROXY_PACKAGE, context.proxyConfigPath, true, true);\n}\n\nexport function codexCompatibilityArgs(\n context: CompatibilityContext,\n managedProfileName: string,\n managedProfileFlag: string,\n): string[] {\n const args = ['--yolo', '--enable', 'hooks', ...additionalDirectoryArgs(context)];\n if (supportsCodexManagedProfile(context.options.providerArgs)) {\n args.push(managedProfileFlag, managedProfileName);\n if (context.personaFile) {\n const persona = fs.readFileSync(context.personaFile, 'utf8');\n args.push('-c', `developer_instructions=${JSON.stringify(persona)}`);\n }\n if (context.mcpAllowlist) {\n args.push('-c', `mcp_servers.${AGIFLOW_PROXY_SERVER_NAME}.args=${JSON.stringify(codexProxyArguments(context))}`);\n }\n }\n return [...args, ...context.options.providerArgs];\n}\n\nexport function codexEnvironment(context: CompatibilityContext): NodeJS.ProcessEnv {\n const environment = { ...context.environment };\n const originResult = spawnSync('git', ['-C', context.options.repoRoot, 'remote', 'get-url', 'origin'], {\n encoding: 'utf8',\n env: environment,\n });\n environment.CODEX_REPO_ORIGIN = originResult.status === 0 ? originResult.stdout.trim() : '';\n environment.CODEX_PROFILE_NAMES = context.options.domains.join(',');\n environment.CODEX_PLUGIN_DIRS = codexPluginDirectories(context).join(',');\n environment.CODEX_ENABLE_XCODE_MCP =\n spawnSync('xcrun', ['mcpbridge', '--help'], { env: environment, stdio: 'ignore' }).status === 0 ? '1' : '0';\n return environment;\n}\n\nexport async function launchCodex(context: CompatibilityContext): Promise<number> {\n const environment = codexEnvironment(context);\n const syncScript = path.join(context.options.repoRoot, ...SYNC_SCRIPT_RELATIVE_PATH);\n const stateName = runCaptured(process.execPath, [syncScript, 'owner-key'], context.options.repoRoot, environment);\n const home = environment.HOME;\n environment.CODEX_LEGACY_HOME = home ? path.join(home, '.codex', 'agirepo') : undefined;\n environment.CODEX_HOME = home\n ? path.join(home, '.codex', stateName)\n : path.join(context.options.repoRoot, '.codex-local', 'state', stateName);\n\n runChecked(\n NPX_COMMAND,\n [...mcpProxyArguments(MCP_PROXY_PACKAGE, context.proxyConfigPath, true), MCP_PRESTART_OPTION],\n context.options.repoRoot,\n environment,\n );\n\n const syncOutput = runCaptured(process.execPath, [syncScript, 'sync'], context.options.repoRoot, environment);\n const syncResult = JSON.parse(syncOutput) as JsonObject;\n if (\n typeof syncResult.profileConfigName !== 'string' ||\n !PROFILE_CONFIG_NAME_PATTERN.test(syncResult.profileConfigName)\n ) {\n throw new Error('Codex sync returned an invalid profile config name');\n }\n // Older Codex builds only understand --profile, so the flag is probed rather\n // than assumed.\n const help = runCaptured(CODEX_PROVIDER, ['--help'], context.options.repoRoot, environment);\n const profileFlag = help.includes(PROFILE_V2_FLAG) ? PROFILE_V2_FLAG : PROFILE_FLAG;\n return runInteractive(\n CODEX_PROVIDER,\n codexCompatibilityArgs(context, syncResult.profileConfigName, profileFlag),\n context.options.repoRoot,\n environment,\n );\n}\n"],"mappings":"0OAkBA,MAAa,EAAiB,QAExB,EAAe,YACf,EAAkB,eAClB,EAA8B,mBAC9B,EAA4B,CAAC,QAAS,UAAW,sBAAsB,EAG7E,SAAS,EAAoB,EAA2B,CACtD,OAAO,IAAI,IAAI,CACb,EACA,EACA,KACAA,EAAAA,kBACA,WACA,YACA,WACA,0BACA,KACA,UACA,KACA,UACA,mBACA,KACA,YACA,KACA,OACAC,EAAAA,qBACA,KACA,oBACF,CAAC,CAAA,CAAE,IAAI,CAAQ,CACjB,CAQA,SAAgB,EAA4B,EAAyB,CACnE,IAAI,EAAwB,GACxB,EAAU,GACV,EAAkB,GAEtB,IAAK,IAAM,KAAY,EAAM,CAC3B,GAAI,EAAuB,CACzB,EAAwB,GACxB,QACF,CACA,GAAI,EAAoB,CAAQ,EAAG,CACjC,EAAwB,GACxB,Q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AAI,EAAGM,EAAAA,mBAAmB,EAC5F,EAAQ,QAAQ,SAChB,CACF,EAEA,IAAM,EAAaD,EAAAA,YAAY,QAAQ,SAAU,CAAC,EAAY,MAAM,EAAG,EAAQ,QAAQ,SAAU,CAAW,EACtG,EAAa,KAAK,MAAM,CAAU,EACxC,GACE,OAAO,EAAW,mBAAsB,UACxC,CAAC,EAA4B,KAAK,EAAW,iBAAiB,EAE9D,MAAU,MAAM,oDAAoD,EAKtE,IAAM,EADOA,EAAAA,YAAAA,QAA4B,CAAC,QAAQ,EAAG,EAAQ,QAAQ,SAAU,CACxD,CAAC,CAAC,SAAS,CAAe,EAAI,EAAkB,EACvE,OAAOE,EAAAA,eACL,EACA,EAAuB,EAAS,EAAW,kBAAmB,CAAW,EACzE,EAAQ,QAAQ,SAChB,CACF,CACF"}
1
+ {"version":3,"file":"codex.cjs","names":["MCP_CONFIG_OPTION","ADD_DIRECTORY_OPTION","path","PLUGINS_DIRECTORY","mcpProxyArguments","MCP_PROXY_PACKAGE","additionalDirectoryArgs","fs","AGIFLOW_PROXY_SERVER_NAME","spawnSync","runCaptured","MCP_PRESTART_OPTION","runInteractive"],"sources":["../../../../src/adapters/compatibility/codex.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport type { JsonObject } from '../serialization/json';\nimport type { CompatibilityContext } from '../compatibilityContext.ts';\nimport { runCaptured, runChecked, runInteractive } from './process.ts';\nimport {\n ADD_DIRECTORY_OPTION,\n AGIFLOW_PROXY_SERVER_NAME,\n additionalDirectoryArgs,\n MCP_CONFIG_OPTION,\n MCP_PRESTART_OPTION,\n MCP_PROXY_PACKAGE,\n mcpProxyArguments,\n NPX_COMMAND,\n PLUGINS_DIRECTORY,\n} from './shared.ts';\n\nexport const CODEX_PROVIDER = 'codex';\n\nconst PROFILE_FLAG = '--profile';\nconst PROFILE_V2_FLAG = '--profile-v2';\nconst PROFILE_CONFIG_NAME_PATTERN = /^[A-Za-z0-9_-]+$/;\nconst SYNC_SCRIPT_RELATIVE_PATH = ['tools', 'harness', 'sync-codex-state.cjs'];\n\n/** Codex options that consume the following argument, so it is not a subcommand. */\nfunction optionRequiresValue(argument: string): boolean {\n return new Set([\n PROFILE_FLAG,\n PROFILE_V2_FLAG,\n '-c',\n MCP_CONFIG_OPTION,\n '--enable',\n '--disable',\n '--remote',\n '--remote-auth-token-env',\n '-i',\n '--image',\n '-m',\n '--model',\n '--local-provider',\n '-s',\n '--sandbox',\n '-C',\n '--cd',\n ADD_DIRECTORY_OPTION,\n '-a',\n '--ask-for-approval',\n ]).has(argument);\n}\n\n/**\n * Whether the managed profile, persona, and proxy config apply to this run.\n *\n * Codex management subcommands reject session options, so injecting them would\n * turn `codex login` into an error.\n */\nexport function supportsCodexManagedProfile(args: string[]): boolean {\n let previousRequiresValue = false;\n let command = '';\n let debugSubcommand = '';\n\n for (const argument of args) {\n if (previousRequiresValue) {\n previousRequiresValue = false;\n continue;\n }\n if (optionRequiresValue(argument)) {\n previousRequiresValue = true;\n continue;\n }\n if (argument.startsWith('-')) continue;\n if (!command) {\n command = argument;\n continue;\n }\n if (command === 'debug' && !debugSubcommand) debugSubcommand = argument;\n break;\n }\n\n if (!command || ['exec', 'e', 'review', 'resume', 'fork'].includes(command)) return true;\n if (command === 'debug') return debugSubcommand === 'prompt-input';\n if (\n [\n 'login',\n 'logout',\n 'mcp',\n 'plugin',\n 'mcp-server',\n 'app-server',\n 'remote-control',\n 'app',\n 'completion',\n 'update',\n 'doctor',\n 'sandbox',\n 'apply',\n 'a',\n 'cloud',\n 'exec-server',\n 'features',\n 'archive',\n 'delete',\n 'unarchive',\n 'help',\n ].includes(command)\n ) {\n return false;\n }\n return true;\n}\n\n/** Plugin directory names relative to `plugins/`, which is all Codex accepts. */\nexport function codexPluginDirectories(context: CompatibilityContext): string[] {\n const pluginsRoot = path.join(context.options.repoRoot, PLUGINS_DIRECTORY);\n return context.plugins.map((plugin) => {\n const relative = path.relative(pluginsRoot, plugin.directory);\n if (!relative || relative === '..' || relative.startsWith(`..${path.sep}`) || relative.includes(path.sep)) {\n throw new Error(`Codex compatibility requires a direct repository plugin: ${plugin.directory}`);\n }\n return relative;\n });\n}\n\n/** Codex's full-auto mode: no approval prompts and no sandbox. */\nconst YOLO_OPTION = '--yolo';\n\nfunction codexProxyArguments(context: CompatibilityContext): string[] {\n return mcpProxyArguments(MCP_PROXY_PACKAGE, context.proxyConfigPath, true, true);\n}\n\nexport function codexCompatibilityArgs(\n context: CompatibilityContext,\n managedProfileName: string,\n managedProfileFlag: string,\n): string[] {\n const args = [\n ...(context.options.skipPermissions ? [YOLO_OPTION] : []),\n '--enable',\n 'hooks',\n ...additionalDirectoryArgs(context),\n ];\n if (supportsCodexManagedProfile(context.options.providerArgs)) {\n args.push(managedProfileFlag, managedProfileName);\n if (context.personaFile) {\n const persona = fs.readFileSync(context.personaFile, 'utf8');\n args.push('-c', `developer_instructions=${JSON.stringify(persona)}`);\n }\n if (context.mcpAllowlist) {\n args.push('-c', `mcp_servers.${AGIFLOW_PROXY_SERVER_NAME}.args=${JSON.stringify(codexProxyArguments(context))}`);\n }\n }\n return [...args, ...context.options.providerArgs];\n}\n\nexport function codexEnvironment(context: CompatibilityContext): NodeJS.ProcessEnv {\n const environment = { ...context.environment };\n const originResult = spawnSync('git', ['-C', context.options.repoRoot, 'remote', 'get-url', 'origin'], {\n encoding: 'utf8',\n env: environment,\n });\n environment.CODEX_REPO_ORIGIN = originResult.status === 0 ? originResult.stdout.trim() : '';\n environment.CODEX_PROFILE_NAMES = context.options.domains.join(',');\n environment.CODEX_PLUGIN_DIRS = codexPluginDirectories(context).join(',');\n environment.CODEX_ENABLE_XCODE_MCP =\n spawnSync('xcrun', ['mcpbridge', '--help'], { env: environment, stdio: 'ignore' }).status === 0 ? '1' : '0';\n return environment;\n}\n\nexport async function launchCodex(context: CompatibilityContext): Promise<number> {\n const environment = codexEnvironment(context);\n const syncScript = path.join(context.options.repoRoot, ...SYNC_SCRIPT_RELATIVE_PATH);\n const stateName = runCaptured(process.execPath, [syncScript, 'owner-key'], context.options.repoRoot, environment);\n const home = environment.HOME;\n environment.CODEX_LEGACY_HOME = home ? path.join(home, '.codex', 'agirepo') : undefined;\n environment.CODEX_HOME = home\n ? path.join(home, '.codex', stateName)\n : path.join(context.options.repoRoot, '.codex-local', 'state', stateName);\n\n runChecked(\n NPX_COMMAND,\n [...mcpProxyArguments(MCP_PROXY_PACKAGE, context.proxyConfigPath, true), MCP_PRESTART_OPTION],\n context.options.repoRoot,\n environment,\n );\n\n const syncOutput = runCaptured(process.execPath, [syncScript, 'sync'], context.options.repoRoot, environment);\n const syncResult = JSON.parse(syncOutput) as JsonObject;\n if (\n typeof syncResult.profileConfigName !== 'string' ||\n !PROFILE_CONFIG_NAME_PATTERN.test(syncResult.profileConfigName)\n ) {\n throw new Error('Codex sync returned an invalid profile config name');\n }\n // Older Codex builds only understand --profile, so the flag is probed rather\n // than assumed.\n const help = runCaptured(CODEX_PROVIDER, ['--help'], context.options.repoRoot, environment);\n const profileFlag = help.includes(PROFILE_V2_FLAG) ? PROFILE_V2_FLAG : PROFILE_FLAG;\n return runInteractive(\n CODEX_PROVIDER,\n codexCompatibilityArgs(context, syncResult.profileConfigName, profileFlag),\n context.options.repoRoot,\n environment,\n );\n}\n"],"mappings":"0OAkBA,MAAa,EAAiB,QAExB,EAAe,YACf,EAAkB,eAClB,EAA8B,mBAC9B,EAA4B,CAAC,QAAS,UAAW,sBAAsB,EAG7E,SAAS,EAAoB,EAA2B,CACtD,OAAO,IAAI,IAAI,CACb,EACA,EACA,KACAA,EAAAA,kBACA,WACA,YACA,WACA,0BACA,KACA,UACA,KACA,UACA,mBACA,KACA,YACA,KACA,OACAC,EAAAA,qBACA,KACA,oBACF,CAAC,CAAA,CAAE,IAAI,CAAQ,CACjB,CAQA,SAAgB,EAA4B,EAAyB,CACnE,IAAI,EAAwB,GACxB,EAAU,GACV,EAAkB,GAEtB,IAAK,IAAM,KAAY,E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A,EAAAA,QAAK,KAAK,EAAQ,QAAQ,SAAU,eAAgB,QAAS,CAAS,EAE1E,EAAA,WAAA,MAEE,CAAC,GAAGE,EAAAA,kBAAkBC,EAAAA,kBAAmB,EAAQ,gBAAiB,EAAI,EAAGM,EAAAA,mBAAmB,EAC5F,EAAQ,QAAQ,SAChB,CACF,EAEA,IAAM,EAAaD,EAAAA,YAAY,QAAQ,SAAU,CAAC,EAAY,MAAM,EAAG,EAAQ,QAAQ,SAAU,CAAW,EACtG,EAAa,KAAK,MAAM,CAAU,EACxC,GACE,OAAO,EAAW,mBAAsB,UACxC,CAAC,EAA4B,KAAK,EAAW,iBAAiB,EAE9D,MAAU,MAAM,oDAAoD,EAKtE,IAAM,EADOA,EAAAA,YAAAA,QAA4B,CAAC,QAAQ,EAAG,EAAQ,QAAQ,SAAU,CACxD,CAAC,CAAC,SAAS,CAAe,EAAI,EAAkB,EACvE,OAAOE,EAAAA,eACL,EACA,EAAuB,EAAS,EAAW,kBAAmB,CAAW,EACzE,EAAQ,QAAQ,SAChB,CACF,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"codex.d.cts","names":[],"sources":["../../../../src/adapters/compatibility/codex.ts"],"mappings":";;cAkBa;;;;;;;iBAuCG,4BAA4B;;iBAwD5B,uBAAuB,SAAS;iBAehC,uBACd,SAAS,sBACT,4BACA;iBAgBc,iBAAiB,SAAS,uBAAuB,OAAO;iBAclD,YAAY,SAAS,uBAAuB"}
1
+ {"version":3,"file":"codex.d.cts","names":[],"sources":["../../../../src/adapters/compatibility/codex.ts"],"mappings":";;cAkBa;;;;;;;iBAuCG,4BAA4B;;iBAwD5B,uBAAuB,SAAS;iBAkBhC,uBACd,SAAS,sBACT,4BACA;iBAqBc,iBAAiB,SAAS,uBAAuB,OAAO;iBAclD,YAAY,SAAS,uBAAuB"}
@@ -1 +1 @@
1
- {"version":3,"file":"codex.d.mts","names":[],"sources":["../../../../src/adapters/compatibility/codex.ts"],"mappings":";;cAkBa;;;;;;;iBAuCG,4BAA4B;;iBAwD5B,uBAAuB,SAAS;iBAehC,uBACd,SAAS,sBACT,4BACA;iBAgBc,iBAAiB,SAAS,uBAAuB,OAAO;iBAclD,YAAY,SAAS,uBAAuB"}
1
+ {"version":3,"file":"codex.d.mts","names":[],"sources":["../../../../src/adapters/compatibility/codex.ts"],"mappings":";;cAkBa;;;;;;;iBAuCG,4BAA4B;;iBAwD5B,uBAAuB,SAAS;iBAkBhC,uBACd,SAAS,sBACT,4BACA;iBAqBc,iBAAiB,SAAS,uBAAuB,OAAO;iBAclD,YAAY,SAAS,uBAAuB"}
@@ -1,2 +1,2 @@
1
- import{runCaptured as e,runChecked as t,runInteractive as n}from"./process.mjs";import{ADD_DIRECTORY_OPTION as r,AGIFLOW_PROXY_SERVER_NAME as i,MCP_CONFIG_OPTION as a,MCP_PRESTART_OPTION as o,MCP_PROXY_PACKAGE as s,PLUGINS_DIRECTORY as c,additionalDirectoryArgs as l,mcpProxyArguments as u}from"./shared.mjs";import d from"node:path";import f from"node:fs";import{spawnSync as p}from"node:child_process";const m=`codex`,h=`--profile`,g=`--profile-v2`,_=/^[A-Za-z0-9_-]+$/,v=[`tools`,`harness`,`sync-codex-state.cjs`];function y(e){return new Set([h,g,`-c`,a,`--enable`,`--disable`,`--remote`,`--remote-auth-token-env`,`-i`,`--image`,`-m`,`--model`,`--local-provider`,`-s`,`--sandbox`,`-C`,`--cd`,r,`-a`,`--ask-for-approval`]).has(e)}function b(e){let t=!1,n=``,r=``;for(let i of e){if(t){t=!1;continue}if(y(i)){t=!0;continue}if(!i.startsWith(`-`)){if(!n){n=i;continue}n===`debug`&&!r&&(r=i);break}}return!n||[`exec`,`e`,`review`,`resume`,`fork`].includes(n)?!0:n===`debug`?r===`prompt-input`:![`login`,`logout`,`mcp`,`plugin`,`mcp-server`,`app-server`,`remote-control`,`app`,`completion`,`update`,`doctor`,`sandbox`,`apply`,`a`,`cloud`,`exec-server`,`features`,`archive`,`delete`,`unarchive`,`help`].includes(n)}function x(e){let t=d.join(e.options.repoRoot,c);return e.plugins.map(e=>{let n=d.relative(t,e.directory);if(!n||n===`..`||n.startsWith(`..${d.sep}`)||n.includes(d.sep))throw Error(`Codex compatibility requires a direct repository plugin: ${e.directory}`);return n})}function S(e){return u(s,e.proxyConfigPath,!0,!0)}function C(e,t,n){let r=[`--yolo`,`--enable`,`hooks`,...l(e)];if(b(e.options.providerArgs)){if(r.push(n,t),e.personaFile){let t=f.readFileSync(e.personaFile,`utf8`);r.push(`-c`,`developer_instructions=${JSON.stringify(t)}`)}e.mcpAllowlist&&r.push(`-c`,`mcp_servers.${i}.args=${JSON.stringify(S(e))}`)}return[...r,...e.options.providerArgs]}function w(e){let t={...e.environment},n=p(`git`,[`-C`,e.options.repoRoot,`remote`,`get-url`,`origin`],{encoding:`utf8`,env:t});return t.CODEX_REPO_ORIGIN=n.status===0?n.stdout.trim():``,t.CODEX_PROFILE_NAMES=e.options.domains.join(`,`),t.CODEX_PLUGIN_DIRS=x(e).join(`,`),t.CODEX_ENABLE_XCODE_MCP=p(`xcrun`,[`mcpbridge`,`--help`],{env:t,stdio:`ignore`}).status===0?`1`:`0`,t}async function T(r){let i=w(r),a=d.join(r.options.repoRoot,...v),c=e(process.execPath,[a,`owner-key`],r.options.repoRoot,i),l=i.HOME;i.CODEX_LEGACY_HOME=l?d.join(l,`.codex`,`agirepo`):void 0,i.CODEX_HOME=l?d.join(l,`.codex`,c):d.join(r.options.repoRoot,`.codex-local`,`state`,c),t(`npx`,[...u(s,r.proxyConfigPath,!0),o],r.options.repoRoot,i);let f=e(process.execPath,[a,`sync`],r.options.repoRoot,i),p=JSON.parse(f);if(typeof p.profileConfigName!=`string`||!_.test(p.profileConfigName))throw Error(`Codex sync returned an invalid profile config name`);let y=e(`codex`,[`--help`],r.options.repoRoot,i).includes(g)?g:h;return n(m,C(r,p.profileConfigName,y),r.options.repoRoot,i)}export{m as CODEX_PROVIDER,C as codexCompatibilityArgs,w as codexEnvironment,x as codexPluginDirectories,T as launchCodex,b as supportsCodexManagedProfile};
1
+ import{runCaptured as e,runChecked as t,runInteractive as n}from"./process.mjs";import{ADD_DIRECTORY_OPTION as r,AGIFLOW_PROXY_SERVER_NAME as i,MCP_CONFIG_OPTION as a,MCP_PRESTART_OPTION as o,MCP_PROXY_PACKAGE as s,PLUGINS_DIRECTORY as c,additionalDirectoryArgs as l,mcpProxyArguments as u}from"./shared.mjs";import d from"node:path";import f from"node:fs";import{spawnSync as p}from"node:child_process";const m=`codex`,h=`--profile`,g=`--profile-v2`,_=/^[A-Za-z0-9_-]+$/,v=[`tools`,`harness`,`sync-codex-state.cjs`];function y(e){return new Set([h,g,`-c`,a,`--enable`,`--disable`,`--remote`,`--remote-auth-token-env`,`-i`,`--image`,`-m`,`--model`,`--local-provider`,`-s`,`--sandbox`,`-C`,`--cd`,r,`-a`,`--ask-for-approval`]).has(e)}function b(e){let t=!1,n=``,r=``;for(let i of e){if(t){t=!1;continue}if(y(i)){t=!0;continue}if(!i.startsWith(`-`)){if(!n){n=i;continue}n===`debug`&&!r&&(r=i);break}}return!n||[`exec`,`e`,`review`,`resume`,`fork`].includes(n)?!0:n===`debug`?r===`prompt-input`:![`login`,`logout`,`mcp`,`plugin`,`mcp-server`,`app-server`,`remote-control`,`app`,`completion`,`update`,`doctor`,`sandbox`,`apply`,`a`,`cloud`,`exec-server`,`features`,`archive`,`delete`,`unarchive`,`help`].includes(n)}function x(e){let t=d.join(e.options.repoRoot,c);return e.plugins.map(e=>{let n=d.relative(t,e.directory);if(!n||n===`..`||n.startsWith(`..${d.sep}`)||n.includes(d.sep))throw Error(`Codex compatibility requires a direct repository plugin: ${e.directory}`);return n})}function S(e){return u(s,e.proxyConfigPath,!0,!0)}function C(e,t,n){let r=[...e.options.skipPermissions?[`--yolo`]:[],`--enable`,`hooks`,...l(e)];if(b(e.options.providerArgs)){if(r.push(n,t),e.personaFile){let t=f.readFileSync(e.personaFile,`utf8`);r.push(`-c`,`developer_instructions=${JSON.stringify(t)}`)}e.mcpAllowlist&&r.push(`-c`,`mcp_servers.${i}.args=${JSON.stringify(S(e))}`)}return[...r,...e.options.providerArgs]}function w(e){let t={...e.environment},n=p(`git`,[`-C`,e.options.repoRoot,`remote`,`get-url`,`origin`],{encoding:`utf8`,env:t});return t.CODEX_REPO_ORIGIN=n.status===0?n.stdout.trim():``,t.CODEX_PROFILE_NAMES=e.options.domains.join(`,`),t.CODEX_PLUGIN_DIRS=x(e).join(`,`),t.CODEX_ENABLE_XCODE_MCP=p(`xcrun`,[`mcpbridge`,`--help`],{env:t,stdio:`ignore`}).status===0?`1`:`0`,t}async function T(r){let i=w(r),a=d.join(r.options.repoRoot,...v),c=e(process.execPath,[a,`owner-key`],r.options.repoRoot,i),l=i.HOME;i.CODEX_LEGACY_HOME=l?d.join(l,`.codex`,`agirepo`):void 0,i.CODEX_HOME=l?d.join(l,`.codex`,c):d.join(r.options.repoRoot,`.codex-local`,`state`,c),t(`npx`,[...u(s,r.proxyConfigPath,!0),o],r.options.repoRoot,i);let f=e(process.execPath,[a,`sync`],r.options.repoRoot,i),p=JSON.parse(f);if(typeof p.profileConfigName!=`string`||!_.test(p.profileConfigName))throw Error(`Codex sync returned an invalid profile config name`);let y=e(`codex`,[`--help`],r.options.repoRoot,i).includes(g)?g:h;return n(m,C(r,p.profileConfigName,y),r.options.repoRoot,i)}export{m as CODEX_PROVIDER,C as codexCompatibilityArgs,w as codexEnvironment,x as codexPluginDirectories,T as launchCodex,b as supportsCodexManagedProfile};
2
2
  //# sourceMappingURL=codex.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"codex.mjs","names":[],"sources":["../../../../src/adapters/compatibility/codex.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport type { JsonObject } from '../serialization/json';\nimport type { CompatibilityContext } from '../compatibilityContext.ts';\nimport { runCaptured, runChecked, runInteractive } from './process.ts';\nimport {\n ADD_DIRECTORY_OPTION,\n AGIFLOW_PROXY_SERVER_NAME,\n additionalDirectoryArgs,\n MCP_CONFIG_OPTION,\n MCP_PRESTART_OPTION,\n MCP_PROXY_PACKAGE,\n mcpProxyArguments,\n NPX_COMMAND,\n PLUGINS_DIRECTORY,\n} from './shared.ts';\n\nexport const CODEX_PROVIDER = 'codex';\n\nconst PROFILE_FLAG = '--profile';\nconst PROFILE_V2_FLAG = '--profile-v2';\nconst PROFILE_CONFIG_NAME_PATTERN = /^[A-Za-z0-9_-]+$/;\nconst SYNC_SCRIPT_RELATIVE_PATH = ['tools', 'harness', 'sync-codex-state.cjs'];\n\n/** Codex options that consume the following argument, so it is not a subcommand. */\nfunction optionRequiresValue(argument: string): boolean {\n return new Set([\n PROFILE_FLAG,\n PROFILE_V2_FLAG,\n '-c',\n MCP_CONFIG_OPTION,\n '--enable',\n '--disable',\n '--remote',\n '--remote-auth-token-env',\n '-i',\n '--image',\n '-m',\n '--model',\n '--local-provider',\n '-s',\n '--sandbox',\n '-C',\n '--cd',\n ADD_DIRECTORY_OPTION,\n '-a',\n '--ask-for-approval',\n ]).has(argument);\n}\n\n/**\n * Whether the managed profile, persona, and proxy config apply to this run.\n *\n * Codex management subcommands reject session options, so injecting them would\n * turn `codex login` into an error.\n */\nexport function supportsCodexManagedProfile(args: string[]): boolean {\n let previousRequiresValue = false;\n let command = '';\n let debugSubcommand = '';\n\n for (const argument of args) {\n if (previousRequiresValue) {\n previousRequiresValue = false;\n continue;\n }\n if (optionRequiresValue(argument)) {\n previousRequiresValue = true;\n continue;\n }\n if (argument.startsWith('-')) continue;\n if (!command) {\n command = argument;\n continue;\n }\n if (command === 'debug' && !debugSubcommand) debugSubcommand = argument;\n break;\n }\n\n if (!command || ['exec', 'e', 'review', 'resume', 'fork'].includes(command)) return true;\n if (command === 'debug') return debugSubcommand === 'prompt-input';\n if (\n [\n 'login',\n 'logout',\n 'mcp',\n 'plugin',\n 'mcp-server',\n 'app-server',\n 'remote-control',\n 'app',\n 'completion',\n 'update',\n 'doctor',\n 'sandbox',\n 'apply',\n 'a',\n 'cloud',\n 'exec-server',\n 'features',\n 'archive',\n 'delete',\n 'unarchive',\n 'help',\n ].includes(command)\n ) {\n return false;\n }\n return true;\n}\n\n/** Plugin directory names relative to `plugins/`, which is all Codex accepts. */\nexport function codexPluginDirectories(context: CompatibilityContext): string[] {\n const pluginsRoot = path.join(context.options.repoRoot, PLUGINS_DIRECTORY);\n return context.plugins.map((plugin) => {\n const relative = path.relative(pluginsRoot, plugin.directory);\n if (!relative || relative === '..' || relative.startsWith(`..${path.sep}`) || relative.includes(path.sep)) {\n throw new Error(`Codex compatibility requires a direct repository plugin: ${plugin.directory}`);\n }\n return relative;\n });\n}\n\nfunction codexProxyArguments(context: CompatibilityContext): string[] {\n return mcpProxyArguments(MCP_PROXY_PACKAGE, context.proxyConfigPath, true, true);\n}\n\nexport function codexCompatibilityArgs(\n context: CompatibilityContext,\n managedProfileName: string,\n managedProfileFlag: string,\n): string[] {\n const args = ['--yolo', '--enable', 'hooks', ...additionalDirectoryArgs(context)];\n if (supportsCodexManagedProfile(context.options.providerArgs)) {\n args.push(managedProfileFlag, managedProfileName);\n if (context.personaFile) {\n const persona = fs.readFileSync(context.personaFile, 'utf8');\n args.push('-c', `developer_instructions=${JSON.stringify(persona)}`);\n }\n if (context.mcpAllowlist) {\n args.push('-c', `mcp_servers.${AGIFLOW_PROXY_SERVER_NAME}.args=${JSON.stringify(codexProxyArguments(context))}`);\n }\n }\n return [...args, ...context.options.providerArgs];\n}\n\nexport function codexEnvironment(context: CompatibilityContext): NodeJS.ProcessEnv {\n const environment = { ...context.environment };\n const originResult = spawnSync('git', ['-C', context.options.repoRoot, 'remote', 'get-url', 'origin'], {\n encoding: 'utf8',\n env: environment,\n });\n environment.CODEX_REPO_ORIGIN = originResult.status === 0 ? originResult.stdout.trim() : '';\n environment.CODEX_PROFILE_NAMES = context.options.domains.join(',');\n environment.CODEX_PLUGIN_DIRS = codexPluginDirectories(context).join(',');\n environment.CODEX_ENABLE_XCODE_MCP =\n spawnSync('xcrun', ['mcpbridge', '--help'], { env: environment, stdio: 'ignore' }).status === 0 ? '1' : '0';\n return environment;\n}\n\nexport async function launchCodex(context: CompatibilityContext): Promise<number> {\n const environment = codexEnvironment(context);\n const syncScript = path.join(context.options.repoRoot, ...SYNC_SCRIPT_RELATIVE_PATH);\n const stateName = runCaptured(process.execPath, [syncScript, 'owner-key'], context.options.repoRoot, environment);\n const home = environment.HOME;\n environment.CODEX_LEGACY_HOME = home ? path.join(home, '.codex', 'agirepo') : undefined;\n environment.CODEX_HOME = home\n ? path.join(home, '.codex', stateName)\n : path.join(context.options.repoRoot, '.codex-local', 'state', stateName);\n\n runChecked(\n NPX_COMMAND,\n [...mcpProxyArguments(MCP_PROXY_PACKAGE, context.proxyConfigPath, true), MCP_PRESTART_OPTION],\n context.options.repoRoot,\n environment,\n );\n\n const syncOutput = runCaptured(process.execPath, [syncScript, 'sync'], context.options.repoRoot, environment);\n const syncResult = JSON.parse(syncOutput) as JsonObject;\n if (\n typeof syncResult.profileConfigName !== 'string' ||\n !PROFILE_CONFIG_NAME_PATTERN.test(syncResult.profileConfigName)\n ) {\n throw new Error('Codex sync returned an invalid profile config name');\n }\n // Older Codex builds only understand --profile, so the flag is probed rather\n // than assumed.\n const help = runCaptured(CODEX_PROVIDER, ['--help'], context.options.repoRoot, environment);\n const profileFlag = help.includes(PROFILE_V2_FLAG) ? PROFILE_V2_FLAG : PROFILE_FLAG;\n return runInteractive(\n CODEX_PROVIDER,\n codexCompatibilityArgs(context, syncResult.profileConfigName, profileFlag),\n context.options.repoRoot,\n environment,\n );\n}\n"],"mappings":"oZAkBA,MAAa,EAAiB,QAExB,EAAe,YACf,EAAkB,eAClB,EAA8B,mBAC9B,EAA4B,CAAC,QAAS,UAAW,sBAAsB,EAG7E,SAAS,EAAoB,EAA2B,CACtD,OAAO,IAAI,IAAI,CACb,EACA,EACA,KACA,EACA,WACA,YACA,WACA,0BACA,KACA,UACA,KACA,UACA,mBACA,KACA,YACA,KACA,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EAAA,MAEE,CAAC,GAAG,EAAkB,EAAmB,EAAQ,gBAAiB,EAAI,EAAG,CAAmB,EAC5F,EAAQ,QAAQ,SAChB,CACF,EAEA,IAAM,EAAa,EAAY,QAAQ,SAAU,CAAC,EAAY,MAAM,EAAG,EAAQ,QAAQ,SAAU,CAAW,EACtG,EAAa,KAAK,MAAM,CAAU,EACxC,GACE,OAAO,EAAW,mBAAsB,UACxC,CAAC,EAA4B,KAAK,EAAW,iBAAiB,EAE9D,MAAU,MAAM,oDAAoD,EAKtE,IAAM,EADO,EAAA,QAA4B,CAAC,QAAQ,EAAG,EAAQ,QAAQ,SAAU,CACxD,CAAC,CAAC,SAAS,CAAe,EAAI,EAAkB,EACvE,OAAO,EACL,EACA,EAAuB,EAAS,EAAW,kBAAmB,CAAW,EACzE,EAAQ,QAAQ,SAChB,CACF,CACF"}
1
+ {"version":3,"file":"codex.mjs","names":[],"sources":["../../../../src/adapters/compatibility/codex.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport type { JsonObject } from '../serialization/json';\nimport type { CompatibilityContext } from '../compatibilityContext.ts';\nimport { runCaptured, runChecked, runInteractive } from './process.ts';\nimport {\n ADD_DIRECTORY_OPTION,\n AGIFLOW_PROXY_SERVER_NAME,\n additionalDirectoryArgs,\n MCP_CONFIG_OPTION,\n MCP_PRESTART_OPTION,\n MCP_PROXY_PACKAGE,\n mcpProxyArguments,\n NPX_COMMAND,\n PLUGINS_DIRECTORY,\n} from './shared.ts';\n\nexport const CODEX_PROVIDER = 'codex';\n\nconst PROFILE_FLAG = '--profile';\nconst PROFILE_V2_FLAG = '--profile-v2';\nconst PROFILE_CONFIG_NAME_PATTERN = /^[A-Za-z0-9_-]+$/;\nconst SYNC_SCRIPT_RELATIVE_PATH = ['tools', 'harness', 'sync-codex-state.cjs'];\n\n/** Codex options that consume the following argument, so it is not a subcommand. */\nfunction optionRequiresValue(argument: string): boolean {\n return new Set([\n PROFILE_FLAG,\n PROFILE_V2_FLAG,\n '-c',\n MCP_CONFIG_OPTION,\n '--enable',\n '--disable',\n '--remote',\n '--remote-auth-token-env',\n '-i',\n '--image',\n '-m',\n '--model',\n '--local-provider',\n '-s',\n '--sandbox',\n '-C',\n '--cd',\n ADD_DIRECTORY_OPTION,\n '-a',\n '--ask-for-approval',\n ]).has(argument);\n}\n\n/**\n * Whether the managed profile, persona, and proxy config apply to this run.\n *\n * Codex management subcommands reject session options, so injecting them would\n * turn `codex login` into an error.\n */\nexport function supportsCodexManagedProfile(args: string[]): boolean {\n let previousRequiresValue = false;\n let command = '';\n let debugSubcommand = '';\n\n for (const argument of args) {\n if (previousRequiresValue) {\n previousRequiresValue = false;\n continue;\n }\n if (optionRequiresValue(argument)) {\n previousRequiresValue = true;\n continue;\n }\n if (argument.startsWith('-')) continue;\n if (!command) {\n command = argument;\n continue;\n }\n if (command === 'debug' && !debugSubcommand) debugSubcommand = argument;\n break;\n }\n\n if (!command || ['exec', 'e', 'review', 'resume', 'fork'].includes(command)) return true;\n if (command === 'debug') return debugSubcommand === 'prompt-input';\n if (\n [\n 'login',\n 'logout',\n 'mcp',\n 'plugin',\n 'mcp-server',\n 'app-server',\n 'remote-control',\n 'app',\n 'completion',\n 'update',\n 'doctor',\n 'sandbox',\n 'apply',\n 'a',\n 'cloud',\n 'exec-server',\n 'features',\n 'archive',\n 'delete',\n 'unarchive',\n 'help',\n ].includes(command)\n ) {\n return false;\n }\n return true;\n}\n\n/** Plugin directory names relative to `plugins/`, which is all Codex accepts. */\nexport function codexPluginDirectories(context: CompatibilityContext): string[] {\n const pluginsRoot = path.join(context.options.repoRoot, PLUGINS_DIRECTORY);\n return context.plugins.map((plugin) => {\n const relative = path.relative(pluginsRoot, plugin.directory);\n if (!relative || relative === '..' || relative.startsWith(`..${path.sep}`) || relative.includes(path.sep)) {\n throw new Error(`Codex compatibility requires a direct repository plugin: ${plugin.directory}`);\n }\n return relative;\n });\n}\n\n/** Codex's full-auto mode: no approval prompts and no sandbox. */\nconst YOLO_OPTION = '--yolo';\n\nfunction codexProxyArguments(context: CompatibilityContext): string[] {\n return mcpProxyArguments(MCP_PROXY_PACKAGE, context.proxyConfigPath, true, true);\n}\n\nexport function codexCompatibilityArgs(\n context: CompatibilityContext,\n managedProfileName: string,\n managedProfileFlag: string,\n): string[] {\n const args = [\n ...(context.options.skipPermissions ? [YOLO_OPTION] : []),\n '--enable',\n 'hooks',\n ...additionalDirectoryArgs(context),\n ];\n if (supportsCodexManagedProfile(context.options.providerArgs)) {\n args.push(managedProfileFlag, managedProfileName);\n if (context.personaFile) {\n const persona = fs.readFileSync(context.personaFile, 'utf8');\n args.push('-c', `developer_instructions=${JSON.stringify(persona)}`);\n }\n if (context.mcpAllowlist) {\n args.push('-c', `mcp_servers.${AGIFLOW_PROXY_SERVER_NAME}.args=${JSON.stringify(codexProxyArguments(context))}`);\n }\n }\n return [...args, ...context.options.providerArgs];\n}\n\nexport function codexEnvironment(context: CompatibilityContext): NodeJS.ProcessEnv {\n const environment = { ...context.environment };\n const originResult = spawnSync('git', ['-C', context.options.repoRoot, 'remote', 'get-url', 'origin'], {\n encoding: 'utf8',\n env: environment,\n });\n environment.CODEX_REPO_ORIGIN = originResult.status === 0 ? originResult.stdout.trim() : '';\n environment.CODEX_PROFILE_NAMES = context.options.domains.join(',');\n environment.CODEX_PLUGIN_DIRS = codexPluginDirectories(context).join(',');\n environment.CODEX_ENABLE_XCODE_MCP =\n spawnSync('xcrun', ['mcpbridge', '--help'], { env: environment, stdio: 'ignore' }).status === 0 ? '1' : '0';\n return environment;\n}\n\nexport async function launchCodex(context: CompatibilityContext): Promise<number> {\n const environment = codexEnvironment(context);\n const syncScript = path.join(context.options.repoRoot, ...SYNC_SCRIPT_RELATIVE_PATH);\n const stateName = runCaptured(process.execPath, [syncScript, 'owner-key'], context.options.repoRoot, environment);\n const home = environment.HOME;\n environment.CODEX_LEGACY_HOME = home ? path.join(home, '.codex', 'agirepo') : undefined;\n environment.CODEX_HOME = home\n ? path.join(home, '.codex', stateName)\n : path.join(context.options.repoRoot, '.codex-local', 'state', stateName);\n\n runChecked(\n NPX_COMMAND,\n [...mcpProxyArguments(MCP_PROXY_PACKAGE, context.proxyConfigPath, true), MCP_PRESTART_OPTION],\n context.options.repoRoot,\n environment,\n );\n\n const syncOutput = runCaptured(process.execPath, [syncScript, 'sync'], context.options.repoRoot, environment);\n const syncResult = JSON.parse(syncOutput) as JsonObject;\n if (\n typeof syncResult.profileConfigName !== 'string' ||\n !PROFILE_CONFIG_NAME_PATTERN.test(syncResult.profileConfigName)\n ) {\n throw new Error('Codex sync returned an invalid profile config name');\n }\n // Older Codex builds only understand --profile, so the flag is probed rather\n // than assumed.\n const help = runCaptured(CODEX_PROVIDER, ['--help'], context.options.repoRoot, environment);\n const profileFlag = help.includes(PROFILE_V2_FLAG) ? PROFILE_V2_FLAG : PROFILE_FLAG;\n return runInteractive(\n CODEX_PROVIDER,\n codexCompatibilityArgs(context, syncResult.profileConfigName, profileFlag),\n context.options.repoRoot,\n environment,\n );\n}\n"],"mappings":"oZAkBA,MAAa,EAAiB,QAExB,EAAe,YACf,EAAkB,eAClB,EAA8B,mBAC9B,EAA4B,CAAC,QAAS,UAAW,sBAAsB,EAG7E,SAAS,EAAoB,EAA2B,CACtD,OAAO,IAAI,IAAI,CACb,EACA,EACA,KACA,EACA,WACA,YACA,WACA,0BACA,KACA,UACA,KACA,UACA,mBACA,KACA,YACA,KACA,OACA,EACA,KACA,oBACF,CAAC,CAAA,CAAE,IAAI,CAAQ,CACjB,CAQA,SAAgB,EAA4B,EAAyB,CACnE,IAAI,EAAwB,GACxB,EAAU,GACV,EAAkB,GAEtB,IAAK,IAAM,KAAY,EAAM,CAC3B,GAAI,EAAuB,CACzB,EAAwB,GACxB,QACF,CACA,GAAI,EAAoB,CAAQ,EAAG,CACjC,EAAwB,GACxB,QACF,CACI,MAAS,WAAW,GAAG,EAC3B,IAAI,CAAC,EAAS,CACZ,EAAU,EACV,QACF,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AAW,iBAAiB,EAE9D,MAAU,MAAM,oDAAoD,EAKtE,IAAM,EADO,EAAA,QAA4B,CAAC,QAAQ,EAAG,EAAQ,QAAQ,SAAU,CACxD,CAAC,CAAC,SAAS,CAAe,EAAI,EAAkB,EACvE,OAAO,EACL,EACA,EAAuB,EAAS,EAAW,kBAAmB,CAAW,EACzE,EAAQ,QAAQ,SAChB,CACF,CACF"}
@@ -1,2 +1,2 @@
1
- const e=require("./process.cjs"),t=require("./shared.cjs"),n=require("./antigravity.cjs"),r=require("./codex.cjs"),i=`claude`;function a(e){let n=[t.SKIP_PERMISSIONS_OPTION];for(let t of e.plugins)n.push(`--plugin-dir`,t.directory);return e.mcpAllowlist&&n.push(`--mcp-config`,e.mcpConfigPath,`--strict-mcp-config`),e.personaFile&&n.push(`--append-system-prompt-file`,e.personaFile),n.push(...t.additionalDirectoryArgs(e)),[...n,...e.options.providerArgs]}async function o(t){let o=t.options.provider;return o===i?e.runInteractive(i,a(t),t.options.currentDirectory,t.environment):o===`codex`?r.launchCodex(t):n.launchAntigravity(t)}exports.acquireDirectoryLock=e.acquireDirectoryLock,exports.adaptAntigravityMcpDefinition=n.adaptAntigravityMcpDefinition,exports.antigravityCompatibilityArgs=n.antigravityCompatibilityArgs,exports.claudeCompatibilityArgs=a,exports.codexCompatibilityArgs=r.codexCompatibilityArgs,exports.codexEnvironment=r.codexEnvironment,exports.codexPluginDirectories=r.codexPluginDirectories,exports.forwardSignals=e.forwardSignals,exports.isFileSystemError=e.isFileSystemError,exports.launchAntigravity=n.launchAntigravity,exports.launchCodex=r.launchCodex,exports.launchCompatibility=o,exports.lockOwnerIsRunning=e.lockOwnerIsRunning,exports.mcpProxyArguments=t.mcpProxyArguments,exports.pathInside=e.pathInside,exports.runCaptured=e.runCaptured,exports.runChecked=e.runChecked,exports.runInteractive=e.runInteractive,exports.signalExitCode=e.signalExitCode,exports.supportsCodexManagedProfile=r.supportsCodexManagedProfile,exports.waitForExit=e.waitForExit;
1
+ const e=require("./process.cjs"),t=require("./shared.cjs"),n=require("./antigravity.cjs"),r=require("./codex.cjs"),i=`claude`;function a(e){let n=e.options.skipPermissions?[t.SKIP_PERMISSIONS_OPTION]:[];for(let t of e.plugins)n.push(`--plugin-dir`,t.directory);return e.mcpAllowlist&&n.push(`--mcp-config`,e.mcpConfigPath,`--strict-mcp-config`),e.personaFile&&n.push(`--append-system-prompt-file`,e.personaFile),n.push(...t.additionalDirectoryArgs(e)),[...n,...e.options.providerArgs]}function o(e){process.stderr.write(`[doompi] --skip-permissions: approval prompts are disabled for this ${e} run.\n`)}async function s(t){let s=t.options.provider;return t.options.skipPermissions&&o(s),s===i?e.runInteractive(i,a(t),t.options.currentDirectory,t.environment):s===`codex`?r.launchCodex(t):n.launchAntigravity(t)}exports.acquireDirectoryLock=e.acquireDirectoryLock,exports.adaptAntigravityMcpDefinition=n.adaptAntigravityMcpDefinition,exports.antigravityCompatibilityArgs=n.antigravityCompatibilityArgs,exports.claudeCompatibilityArgs=a,exports.codexCompatibilityArgs=r.codexCompatibilityArgs,exports.codexEnvironment=r.codexEnvironment,exports.codexPluginDirectories=r.codexPluginDirectories,exports.forwardSignals=e.forwardSignals,exports.isFileSystemError=e.isFileSystemError,exports.launchAntigravity=n.launchAntigravity,exports.launchCodex=r.launchCodex,exports.launchCompatibility=s,exports.lockOwnerIsRunning=e.lockOwnerIsRunning,exports.mcpProxyArguments=t.mcpProxyArguments,exports.pathInside=e.pathInside,exports.runCaptured=e.runCaptured,exports.runChecked=e.runChecked,exports.runInteractive=e.runInteractive,exports.signalExitCode=e.signalExitCode,exports.supportsCodexManagedProfile=r.supportsCodexManagedProfile,exports.waitForExit=e.waitForExit;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["SKIP_PERMISSIONS_OPTION","additionalDirectoryArgs","runInteractive","launchCodex","launchAntigravity"],"sources":["../../../../src/adapters/compatibility/index.ts"],"sourcesContent":["import type { CompatibilityProvider } from '../../types/interfaces/compatibility';\nimport type { CompatibilityContext } from '../compatibilityContext.ts';\nimport { launchAntigravity } from './antigravity.ts';\nimport { CODEX_PROVIDER, launchCodex } from './codex.ts';\nimport { runInteractive } from './process.ts';\nimport { additionalDirectoryArgs, SKIP_PERMISSIONS_OPTION } from './shared.ts';\n\nexport { adaptAntigravityMcpDefinition, antigravityCompatibilityArgs, launchAntigravity } from './antigravity.ts';\nexport {\n codexCompatibilityArgs,\n codexEnvironment,\n codexPluginDirectories,\n launchCodex,\n supportsCodexManagedProfile,\n} from './codex.ts';\nexport {\n acquireDirectoryLock,\n forwardSignals,\n isFileSystemError,\n lockOwnerIsRunning,\n pathInside,\n runCaptured,\n runChecked,\n runInteractive,\n signalExitCode,\n waitForExit,\n} from './process.ts';\nexport { mcpProxyArguments } from './shared.ts';\n\nconst CLAUDE_PROVIDER = 'claude';\nconst PLUGIN_DIRECTORY_OPTION = '--plugin-dir';\nconst MCP_CONFIG_OPTION = '--mcp-config';\nconst STRICT_MCP_CONFIG_OPTION = '--strict-mcp-config';\nconst APPEND_SYSTEM_PROMPT_FILE_OPTION = '--append-system-prompt-file';\n\n/**\n * Claude needs no state sync: everything it reads is passed as an argument, so\n * a run leaves nothing behind to revert.\n */\nexport function claudeCompatibilityArgs(context: CompatibilityContext): string[] {\n const args = [SKIP_PERMISSIONS_OPTION];\n for (const plugin of context.plugins) args.push(PLUGIN_DIRECTORY_OPTION, plugin.directory);\n if (context.mcpAllowlist) args.push(MCP_CONFIG_OPTION, context.mcpConfigPath, STRICT_MCP_CONFIG_OPTION);\n if (context.personaFile) args.push(APPEND_SYSTEM_PROMPT_FILE_OPTION, context.personaFile);\n args.push(...additionalDirectoryArgs(context));\n return [...args, ...context.options.providerArgs];\n}\n\nexport async function launchCompatibility(context: CompatibilityContext): Promise<number> {\n const provider: CompatibilityProvider = context.options.provider;\n if (provider === CLAUDE_PROVIDER) {\n return runInteractive(\n CLAUDE_PROVIDER,\n claudeCompatibilityArgs(context),\n context.options.currentDirectory,\n context.environment,\n );\n }\n if (provider === CODEX_PROVIDER) return launchCodex(context);\n return launchAntigravity(context);\n}\n"],"mappings":"mHA6BM,EAAkB,SAUxB,SAAgB,EAAwB,EAAyC,CAC/E,IAAM,EAAO,CAACA,EAAAA,uBAAuB,EACrC,IAAK,IAAM,KAAU,EAAQ,QAAS,EAAK,KAAK,eAAyB,EAAO,SAAS,EAIzF,OAHI,EAAQ,cAAc,EAAK,KAAK,eAAmB,EAAQ,cAAe,qBAAwB,EAClG,EAAQ,aAAa,EAAK,KAAK,8BAAkC,EAAQ,WAAW,EACxF,EAAK,KAAK,GAAGC,EAAAA,wBAAwB,CAAO,CAAC,EACtC,CAAC,GAAG,EAAM,GAAG,EAAQ,QAAQ,YAAY,CAClD,CAEA,eAAsB,EAAoB,EAAgD,CACxF,IAAM,EAAkC,EAAQ,QAAQ,SAUxD,OATI,IAAa,EACRC,EAAAA,eACL,EACA,EAAwB,CAAO,EAC/B,EAAQ,QAAQ,iBAChB,EAAQ,WACV,EAEE,IAAA,QAAoCC,EAAAA,YAAY,CAAO,EACpDC,EAAAA,kBAAkB,CAAO,CAClC"}
1
+ {"version":3,"file":"index.cjs","names":["SKIP_PERMISSIONS_OPTION","additionalDirectoryArgs","runInteractive","launchCodex","launchAntigravity"],"sources":["../../../../src/adapters/compatibility/index.ts"],"sourcesContent":["import type { CompatibilityProvider } from '../../types/interfaces/compatibility';\nimport type { CompatibilityContext } from '../compatibilityContext.ts';\nimport { launchAntigravity } from './antigravity.ts';\nimport { CODEX_PROVIDER, launchCodex } from './codex.ts';\nimport { runInteractive } from './process.ts';\nimport { additionalDirectoryArgs, SKIP_PERMISSIONS_OPTION } from './shared.ts';\n\nexport { adaptAntigravityMcpDefinition, antigravityCompatibilityArgs, launchAntigravity } from './antigravity.ts';\nexport {\n codexCompatibilityArgs,\n codexEnvironment,\n codexPluginDirectories,\n launchCodex,\n supportsCodexManagedProfile,\n} from './codex.ts';\nexport {\n acquireDirectoryLock,\n forwardSignals,\n isFileSystemError,\n lockOwnerIsRunning,\n pathInside,\n runCaptured,\n runChecked,\n runInteractive,\n signalExitCode,\n waitForExit,\n} from './process.ts';\nexport { mcpProxyArguments } from './shared.ts';\n\nconst CLAUDE_PROVIDER = 'claude';\n/** The DoomPi-side flag that asks for the bypass, quoted back in the warning. */\nconst SKIP_PERMISSIONS_REQUEST_OPTION = '--skip-permissions';\nconst PLUGIN_DIRECTORY_OPTION = '--plugin-dir';\nconst MCP_CONFIG_OPTION = '--mcp-config';\nconst STRICT_MCP_CONFIG_OPTION = '--strict-mcp-config';\nconst APPEND_SYSTEM_PROMPT_FILE_OPTION = '--append-system-prompt-file';\n\n/**\n * Claude needs no state sync: everything it reads is passed as an argument, so\n * a run leaves nothing behind to revert.\n */\nexport function claudeCompatibilityArgs(context: CompatibilityContext): string[] {\n const args = context.options.skipPermissions ? [SKIP_PERMISSIONS_OPTION] : [];\n for (const plugin of context.plugins) args.push(PLUGIN_DIRECTORY_OPTION, plugin.directory);\n if (context.mcpAllowlist) args.push(MCP_CONFIG_OPTION, context.mcpConfigPath, STRICT_MCP_CONFIG_OPTION);\n if (context.personaFile) args.push(APPEND_SYSTEM_PROMPT_FILE_OPTION, context.personaFile);\n args.push(...additionalDirectoryArgs(context));\n return [...args, ...context.options.providerArgs];\n}\n\n/**\n * One line on stderr, once per run, naming the frontend whose gate is off.\n *\n * The bypass is invisible in the child's own UI: the frontend simply stops\n * asking. Announcing it here is the only point where the user learns that the\n * absence of prompts was DoomPi's doing and not the frontend's default.\n */\nfunction warnPermissionsBypassed(provider: CompatibilityProvider): void {\n process.stderr.write(\n `[doompi] ${SKIP_PERMISSIONS_REQUEST_OPTION}: approval prompts are disabled for this ${provider} run.\\n`,\n );\n}\n\nexport async function launchCompatibility(context: CompatibilityContext): Promise<number> {\n const provider: CompatibilityProvider = context.options.provider;\n if (context.options.skipPermissions) warnPermissionsBypassed(provider);\n if (provider === CLAUDE_PROVIDER) {\n return runInteractive(\n CLAUDE_PROVIDER,\n claudeCompatibilityArgs(context),\n context.options.currentDirectory,\n context.environment,\n );\n }\n if (provider === CODEX_PROVIDER) return launchCodex(context);\n return launchAntigravity(context);\n}\n"],"mappings":"mHA6BM,EAAkB,SAYxB,SAAgB,EAAwB,EAAyC,CAC/E,IAAM,EAAO,EAAQ,QAAQ,gBAAkB,CAACA,EAAAA,uBAAuB,EAAI,CAAC,EAC5E,IAAK,IAAM,KAAU,EAAQ,QAAS,EAAK,KAAK,eAAyB,EAAO,SAAS,EAIzF,OAHI,EAAQ,cAAc,EAAK,KAAK,eAAmB,EAAQ,cAAe,qBAAwB,EAClG,EAAQ,aAAa,EAAK,KAAK,8BAAkC,EAAQ,WAAW,EACxF,EAAK,KAAK,GAAGC,EAAAA,wBAAwB,CAAO,CAAC,EACtC,CAAC,GAAG,EAAM,GAAG,EAAQ,QAAQ,YAAY,CAClD,CASA,SAAS,EAAwB,EAAuC,CACtE,QAAQ,OAAO,MACb,uEAAuF,EAAS,QAClG,CACF,CAEA,eAAsB,EAAoB,EAAgD,CACxF,IAAM,EAAkC,EAAQ,QAAQ,SAWxD,OAVI,EAAQ,QAAQ,iBAAiB,EAAwB,CAAQ,EACjE,IAAa,EACRC,EAAAA,eACL,EACA,EAAwB,CAAO,EAC/B,EAAQ,QAAQ,iBAChB,EAAQ,WACV,EAEE,IAAA,QAAoCC,EAAAA,YAAY,CAAO,EACpDC,EAAAA,kBAAkB,CAAO,CAClC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../../../src/adapters/compatibility/index.ts"],"mappings":";;;;;;;;;;iBAuCgB,wBAAwB,SAAS;iBAS3B,oBAAoB,SAAS,uBAAuB"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../../../src/adapters/compatibility/index.ts"],"mappings":";;;;;;;;;;iBAyCgB,wBAAwB,SAAS;iBAsB3B,oBAAoB,SAAS,uBAAuB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/adapters/compatibility/index.ts"],"mappings":";;;;;;;;;;iBAuCgB,wBAAwB,SAAS;iBAS3B,oBAAoB,SAAS,uBAAuB"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/adapters/compatibility/index.ts"],"mappings":";;;;;;;;;;iBAyCgB,wBAAwB,SAAS;iBAsB3B,oBAAoB,SAAS,uBAAuB"}
@@ -1,2 +1,2 @@
1
- import{acquireDirectoryLock as e,forwardSignals as t,isFileSystemError as n,lockOwnerIsRunning as r,pathInside as i,runCaptured as a,runChecked as o,runInteractive as s,signalExitCode as c,waitForExit as l}from"./process.mjs";import{SKIP_PERMISSIONS_OPTION as u,additionalDirectoryArgs as d,mcpProxyArguments as f}from"./shared.mjs";import{adaptAntigravityMcpDefinition as p,antigravityCompatibilityArgs as m,launchAntigravity as h}from"./antigravity.mjs";import{codexCompatibilityArgs as g,codexEnvironment as _,codexPluginDirectories as v,launchCodex as y,supportsCodexManagedProfile as b}from"./codex.mjs";const x=`claude`;function S(e){let t=[u];for(let n of e.plugins)t.push(`--plugin-dir`,n.directory);return e.mcpAllowlist&&t.push(`--mcp-config`,e.mcpConfigPath,`--strict-mcp-config`),e.personaFile&&t.push(`--append-system-prompt-file`,e.personaFile),t.push(...d(e)),[...t,...e.options.providerArgs]}async function C(e){let t=e.options.provider;return t===x?s(x,S(e),e.options.currentDirectory,e.environment):t===`codex`?y(e):h(e)}export{e as acquireDirectoryLock,p as adaptAntigravityMcpDefinition,m as antigravityCompatibilityArgs,S as claudeCompatibilityArgs,g as codexCompatibilityArgs,_ as codexEnvironment,v as codexPluginDirectories,t as forwardSignals,n as isFileSystemError,h as launchAntigravity,y as launchCodex,C as launchCompatibility,r as lockOwnerIsRunning,f as mcpProxyArguments,i as pathInside,a as runCaptured,o as runChecked,s as runInteractive,c as signalExitCode,b as supportsCodexManagedProfile,l as waitForExit};
1
+ import{acquireDirectoryLock as e,forwardSignals as t,isFileSystemError as n,lockOwnerIsRunning as r,pathInside as i,runCaptured as a,runChecked as o,runInteractive as s,signalExitCode as c,waitForExit as l}from"./process.mjs";import{SKIP_PERMISSIONS_OPTION as u,additionalDirectoryArgs as d,mcpProxyArguments as f}from"./shared.mjs";import{adaptAntigravityMcpDefinition as p,antigravityCompatibilityArgs as m,launchAntigravity as h}from"./antigravity.mjs";import{codexCompatibilityArgs as g,codexEnvironment as _,codexPluginDirectories as v,launchCodex as y,supportsCodexManagedProfile as b}from"./codex.mjs";const x=`claude`;function S(e){let t=e.options.skipPermissions?[u]:[];for(let n of e.plugins)t.push(`--plugin-dir`,n.directory);return e.mcpAllowlist&&t.push(`--mcp-config`,e.mcpConfigPath,`--strict-mcp-config`),e.personaFile&&t.push(`--append-system-prompt-file`,e.personaFile),t.push(...d(e)),[...t,...e.options.providerArgs]}function C(e){process.stderr.write(`[doompi] --skip-permissions: approval prompts are disabled for this ${e} run.\n`)}async function w(e){let t=e.options.provider;return e.options.skipPermissions&&C(t),t===x?s(x,S(e),e.options.currentDirectory,e.environment):t===`codex`?y(e):h(e)}export{e as acquireDirectoryLock,p as adaptAntigravityMcpDefinition,m as antigravityCompatibilityArgs,S as claudeCompatibilityArgs,g as codexCompatibilityArgs,_ as codexEnvironment,v as codexPluginDirectories,t as forwardSignals,n as isFileSystemError,h as launchAntigravity,y as launchCodex,w as launchCompatibility,r as lockOwnerIsRunning,f as mcpProxyArguments,i as pathInside,a as runCaptured,o as runChecked,s as runInteractive,c as signalExitCode,b as supportsCodexManagedProfile,l as waitForExit};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/adapters/compatibility/index.ts"],"sourcesContent":["import type { CompatibilityProvider } from '../../types/interfaces/compatibility';\nimport type { CompatibilityContext } from '../compatibilityContext.ts';\nimport { launchAntigravity } from './antigravity.ts';\nimport { CODEX_PROVIDER, launchCodex } from './codex.ts';\nimport { runInteractive } from './process.ts';\nimport { additionalDirectoryArgs, SKIP_PERMISSIONS_OPTION } from './shared.ts';\n\nexport { adaptAntigravityMcpDefinition, antigravityCompatibilityArgs, launchAntigravity } from './antigravity.ts';\nexport {\n codexCompatibilityArgs,\n codexEnvironment,\n codexPluginDirectories,\n launchCodex,\n supportsCodexManagedProfile,\n} from './codex.ts';\nexport {\n acquireDirectoryLock,\n forwardSignals,\n isFileSystemError,\n lockOwnerIsRunning,\n pathInside,\n runCaptured,\n runChecked,\n runInteractive,\n signalExitCode,\n waitForExit,\n} from './process.ts';\nexport { mcpProxyArguments } from './shared.ts';\n\nconst CLAUDE_PROVIDER = 'claude';\nconst PLUGIN_DIRECTORY_OPTION = '--plugin-dir';\nconst MCP_CONFIG_OPTION = '--mcp-config';\nconst STRICT_MCP_CONFIG_OPTION = '--strict-mcp-config';\nconst APPEND_SYSTEM_PROMPT_FILE_OPTION = '--append-system-prompt-file';\n\n/**\n * Claude needs no state sync: everything it reads is passed as an argument, so\n * a run leaves nothing behind to revert.\n */\nexport function claudeCompatibilityArgs(context: CompatibilityContext): string[] {\n const args = [SKIP_PERMISSIONS_OPTION];\n for (const plugin of context.plugins) args.push(PLUGIN_DIRECTORY_OPTION, plugin.directory);\n if (context.mcpAllowlist) args.push(MCP_CONFIG_OPTION, context.mcpConfigPath, STRICT_MCP_CONFIG_OPTION);\n if (context.personaFile) args.push(APPEND_SYSTEM_PROMPT_FILE_OPTION, context.personaFile);\n args.push(...additionalDirectoryArgs(context));\n return [...args, ...context.options.providerArgs];\n}\n\nexport async function launchCompatibility(context: CompatibilityContext): Promise<number> {\n const provider: CompatibilityProvider = context.options.provider;\n if (provider === CLAUDE_PROVIDER) {\n return runInteractive(\n CLAUDE_PROVIDER,\n claudeCompatibilityArgs(context),\n context.options.currentDirectory,\n context.environment,\n );\n }\n if (provider === CODEX_PROVIDER) return launchCodex(context);\n return launchAntigravity(context);\n}\n"],"mappings":"imBA6BA,MAAM,EAAkB,SAUxB,SAAgB,EAAwB,EAAyC,CAC/E,IAAM,EAAO,CAAC,CAAuB,EACrC,IAAK,IAAM,KAAU,EAAQ,QAAS,EAAK,KAAK,eAAyB,EAAO,SAAS,EAIzF,OAHI,EAAQ,cAAc,EAAK,KAAK,eAAmB,EAAQ,cAAe,qBAAwB,EAClG,EAAQ,aAAa,EAAK,KAAK,8BAAkC,EAAQ,WAAW,EACxF,EAAK,KAAK,GAAG,EAAwB,CAAO,CAAC,EACtC,CAAC,GAAG,EAAM,GAAG,EAAQ,QAAQ,YAAY,CAClD,CAEA,eAAsB,EAAoB,EAAgD,CACxF,IAAM,EAAkC,EAAQ,QAAQ,SAUxD,OATI,IAAa,EACR,EACL,EACA,EAAwB,CAAO,EAC/B,EAAQ,QAAQ,iBAChB,EAAQ,WACV,EAEE,IAAA,QAAoC,EAAY,CAAO,EACpD,EAAkB,CAAO,CAClC"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/adapters/compatibility/index.ts"],"sourcesContent":["import type { CompatibilityProvider } from '../../types/interfaces/compatibility';\nimport type { CompatibilityContext } from '../compatibilityContext.ts';\nimport { launchAntigravity } from './antigravity.ts';\nimport { CODEX_PROVIDER, launchCodex } from './codex.ts';\nimport { runInteractive } from './process.ts';\nimport { additionalDirectoryArgs, SKIP_PERMISSIONS_OPTION } from './shared.ts';\n\nexport { adaptAntigravityMcpDefinition, antigravityCompatibilityArgs, launchAntigravity } from './antigravity.ts';\nexport {\n codexCompatibilityArgs,\n codexEnvironment,\n codexPluginDirectories,\n launchCodex,\n supportsCodexManagedProfile,\n} from './codex.ts';\nexport {\n acquireDirectoryLock,\n forwardSignals,\n isFileSystemError,\n lockOwnerIsRunning,\n pathInside,\n runCaptured,\n runChecked,\n runInteractive,\n signalExitCode,\n waitForExit,\n} from './process.ts';\nexport { mcpProxyArguments } from './shared.ts';\n\nconst CLAUDE_PROVIDER = 'claude';\n/** The DoomPi-side flag that asks for the bypass, quoted back in the warning. */\nconst SKIP_PERMISSIONS_REQUEST_OPTION = '--skip-permissions';\nconst PLUGIN_DIRECTORY_OPTION = '--plugin-dir';\nconst MCP_CONFIG_OPTION = '--mcp-config';\nconst STRICT_MCP_CONFIG_OPTION = '--strict-mcp-config';\nconst APPEND_SYSTEM_PROMPT_FILE_OPTION = '--append-system-prompt-file';\n\n/**\n * Claude needs no state sync: everything it reads is passed as an argument, so\n * a run leaves nothing behind to revert.\n */\nexport function claudeCompatibilityArgs(context: CompatibilityContext): string[] {\n const args = context.options.skipPermissions ? [SKIP_PERMISSIONS_OPTION] : [];\n for (const plugin of context.plugins) args.push(PLUGIN_DIRECTORY_OPTION, plugin.directory);\n if (context.mcpAllowlist) args.push(MCP_CONFIG_OPTION, context.mcpConfigPath, STRICT_MCP_CONFIG_OPTION);\n if (context.personaFile) args.push(APPEND_SYSTEM_PROMPT_FILE_OPTION, context.personaFile);\n args.push(...additionalDirectoryArgs(context));\n return [...args, ...context.options.providerArgs];\n}\n\n/**\n * One line on stderr, once per run, naming the frontend whose gate is off.\n *\n * The bypass is invisible in the child's own UI: the frontend simply stops\n * asking. Announcing it here is the only point where the user learns that the\n * absence of prompts was DoomPi's doing and not the frontend's default.\n */\nfunction warnPermissionsBypassed(provider: CompatibilityProvider): void {\n process.stderr.write(\n `[doompi] ${SKIP_PERMISSIONS_REQUEST_OPTION}: approval prompts are disabled for this ${provider} run.\\n`,\n );\n}\n\nexport async function launchCompatibility(context: CompatibilityContext): Promise<number> {\n const provider: CompatibilityProvider = context.options.provider;\n if (context.options.skipPermissions) warnPermissionsBypassed(provider);\n if (provider === CLAUDE_PROVIDER) {\n return runInteractive(\n CLAUDE_PROVIDER,\n claudeCompatibilityArgs(context),\n context.options.currentDirectory,\n context.environment,\n );\n }\n if (provider === CODEX_PROVIDER) return launchCodex(context);\n return launchAntigravity(context);\n}\n"],"mappings":"imBA6BA,MAAM,EAAkB,SAYxB,SAAgB,EAAwB,EAAyC,CAC/E,IAAM,EAAO,EAAQ,QAAQ,gBAAkB,CAAC,CAAuB,EAAI,CAAC,EAC5E,IAAK,IAAM,KAAU,EAAQ,QAAS,EAAK,KAAK,eAAyB,EAAO,SAAS,EAIzF,OAHI,EAAQ,cAAc,EAAK,KAAK,eAAmB,EAAQ,cAAe,qBAAwB,EAClG,EAAQ,aAAa,EAAK,KAAK,8BAAkC,EAAQ,WAAW,EACxF,EAAK,KAAK,GAAG,EAAwB,CAAO,CAAC,EACtC,CAAC,GAAG,EAAM,GAAG,EAAQ,QAAQ,YAAY,CAClD,CASA,SAAS,EAAwB,EAAuC,CACtE,QAAQ,OAAO,MACb,uEAAuF,EAAS,QAClG,CACF,CAEA,eAAsB,EAAoB,EAAgD,CACxF,IAAM,EAAkC,EAAQ,QAAQ,SAWxD,OAVI,EAAQ,QAAQ,iBAAiB,EAAwB,CAAQ,EACjE,IAAa,EACR,EACL,EACA,EAAwB,CAAO,EAC/B,EAAQ,QAAQ,iBAChB,EAAQ,WACV,EAEE,IAAA,QAAoC,EAAY,CAAO,EACpD,EAAkB,CAAO,CAClC"}
@@ -1,2 +1,2 @@
1
- const e=`--config`,t=`--add-dir`,n=`--proxy-mode`,r=`flat`,i=`${n}=${r}`;function a(t,a,o,s=!1){return[...o?[`-y`]:[],t,`mcp-serve`,`--type`,`stdio-http`,...s?[i]:[n,r],e,a]}function o(e){return e.options.additionalDirectories.flatMap(e=>[t,e])}exports.ADD_DIRECTORY_OPTION=t,exports.AGIFLOW_PROXY_SERVER_NAME=`agiflow-proxy`,exports.ANTIGRAVITY_MCP_PROXY_PACKAGE=`@agimon-ai/mcp-proxy`,exports.CORE_PLUGIN_NAME=`core`,exports.MCP_CONFIG_OPTION=e,exports.MCP_PRESTART_OPTION=`--prestart-http`,exports.MCP_PROXY_PACKAGE=`@agimon-ai/mcp-proxy@latest`,exports.MCP_SERVERS_KEY=`mcpServers`,exports.NPX_COMMAND=`npx`,exports.PLUGINS_DIRECTORY=`plugins`,exports.PLUGIN_MANIFEST_FILENAME=`plugin.json`,exports.SKILLS_DIRECTORY=`skills`,exports.SKIP_PERMISSIONS_OPTION=`--dangerously-skip-permissions`,exports.additionalDirectoryArgs=o,exports.mcpProxyArguments=a;
1
+ const e=`0.31.16`,t=`@agimon-ai/mcp-proxy@${e}`,n=`@agimon-ai/mcp-proxy@${e}`,r=`--config`,i=`--add-dir`,a=`--proxy-mode`,o=`flat`,s=`${a}=${o}`;function c(e,t,n,i=!1){return[...n?[`-y`]:[],e,`mcp-serve`,`--type`,`stdio-http`,...i?[s]:[a,o],r,t]}function l(e){return e.options.additionalDirectories.flatMap(e=>[i,e])}exports.ADD_DIRECTORY_OPTION=i,exports.AGIFLOW_PROXY_SERVER_NAME=`agiflow-proxy`,exports.ANTIGRAVITY_MCP_PROXY_PACKAGE=n,exports.CORE_PLUGIN_NAME=`core`,exports.MCP_CONFIG_OPTION=r,exports.MCP_PRESTART_OPTION=`--prestart-http`,exports.MCP_PROXY_PACKAGE=t,exports.MCP_PROXY_VERSION=e,exports.MCP_SERVERS_KEY=`mcpServers`,exports.NPX_COMMAND=`npx`,exports.PLUGINS_DIRECTORY=`plugins`,exports.PLUGIN_MANIFEST_FILENAME=`plugin.json`,exports.SKILLS_DIRECTORY=`skills`,exports.SKIP_PERMISSIONS_OPTION=`--dangerously-skip-permissions`,exports.additionalDirectoryArgs=l,exports.mcpProxyArguments=c;
2
2
  //# sourceMappingURL=shared.cjs.map