Skip to content

Conversation

@ThomasK33
Copy link
Member

Summary

  • Electron now runs an HTTP/WS API server on 127.0.0.1 alongside the existing MessagePort transport
  • Both transports share the same oRPC router instance with auth middleware
  • CLI tools can discover and connect to the running Electron app via lockfile at ~/.mux/server.lock

Changes

  • Add ServerLockfile service for server discovery and conflict detection
  • Extend ServerService with startServer/stopServer lifecycle methods
  • Move orpcServer.ts to src/node/orpc/server.ts (shared module)
  • Electron generates auth token, injects synthetic header for MessagePort
  • CLI server checks lockfile to prevent conflicts
  • CLI api auto-discovers running server via lockfile

Environment Variables

Variable Purpose
MUX_SERVER_AUTH_TOKEN Override auth token
MUX_SERVER_PORT Fixed port (default: random)
MUX_NO_API_SERVER=1 Disable API server in Electron

Test plan

  • make typecheck passes
  • make lint passes
  • ServerLockfile tests pass (11 tests)
  • oRPC server tests pass (13 tests)

Generated with mux

Base automatically changed from cli-api-orpc-proxy to main December 3, 2025 16:48
@ThomasK33 ThomasK33 force-pushed the unified-api-server branch 5 times, most recently from fe68498 to 15d325c Compare December 3, 2025 19:19
@ThomasK33 ThomasK33 marked this pull request as ready for review December 3, 2025 19:23
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ThomasK33
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ThomasK33
Copy link
Member Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Hooray!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Electron now runs an HTTP/WS API server on 127.0.0.1 alongside the
existing MessagePort transport. Both transports share the same oRPC
router instance with auth middleware.

- Add ServerLockfile to manage ~/.mux/server.lock for discovery
- Extend ServerService with startServer/stopServer lifecycle
- Move orpcServer.ts to src/node/orpc/server.ts (shared module)
- Electron generates auth token, injects into both transports
- CLI server checks lockfile to prevent conflicts
- CLI api auto-discovers running server via lockfile

Env vars:
- MUX_SERVER_AUTH_TOKEN: Override auth token
- MUX_SERVER_PORT: Fixed port (default: random)
- MUX_NO_API_SERVER=1: Disable API server in Electron
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.

1 participant