Skip to content

fix: resolve ACP stdio MCP proxy without import.meta in CJS bundle - #81

Merged
Killea merged 1 commit into
Killea:mainfrom
bertheto:feat/acp-cjs-mcp-proxy-path
Aug 23, 2026
Merged

fix: resolve ACP stdio MCP proxy without import.meta in CJS bundle#81
Killea merged 1 commit into
Killea:mainfrom
bertheto:feat/acp-cjs-mcp-proxy-path

Conversation

@bertheto

Copy link
Copy Markdown
Collaborator

Summary

  • The bundled CLI is CJS, so import.meta.url is empty and URL.pathname produces unusable Windows paths (/C:/...).
  • Resolve mcpProxy.mjs the same way as the PTY worker (argv + cwd candidates) and copy it to dist/workers at bundle time.
  • Unit tests cover source-tree resolution.

Test plan

  • npx vitest run tests/unit/test_acp_mcp_proxy_path.test.ts tests/unit/test_acp_adapter.test.ts
  • npm run check
  • node ./scripts/build-bundle.mjs — no import.meta warning; dist/workers/mcpProxy.mjs present
  • Optional: spawn an ACP agent with AGENTCHATBUS_BASE_URL set and confirm the stdio MCP proxy path exists

The CLI ships as CJS, so import.meta.url is empty and URL.pathname
breaks Windows paths. Locate mcpProxy.mjs like the PTY worker and copy
it to dist/workers during bundle.
@Killea
Killea merged commit 9b8196a into Killea:main Aug 23, 2026
1 check passed
Killea added a commit that referenced this pull request Aug 23, 2026
Apply the same CJS-safe path resolution pattern from PR #81 to the V2
socket proxy (proxy.mjs). Both import.meta.url references in acpAdapter.ts
are now replaced with path-based resolvers, eliminating all empty-import-meta
esbuild warnings.

The new resolveAcpSocketProxyScript() mirrors resolveAcpMcpProxyScript(),
using process.argv[1] + cwd candidates with existsSync fallbacks. On
Windows, path.resolve returns native C:\ paths (no /C:/ prefix), making
the result safe for spawn()/child_process.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants