-
Notifications
You must be signed in to change notification settings - Fork 32
feat: unify Electron and CLI with shared oRPC API server #878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
9602beb to
a808f8a
Compare
78a30ac to
18d85b3
Compare
fe68498 to
15d325c
Compare
There was a problem hiding this 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".
15d325c to
45fd635
Compare
|
@codex review |
There was a problem hiding this 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".
45fd635 to
0e19846
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
0e19846 to
c6fc07a
Compare
|
@codex review |
There was a problem hiding this 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".
c6fc07a to
3602f01
Compare
|
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Lines 155 to 159 in 3602f01
| httpServer, | |
| wsServer, | |
| app, | |
| port: actualPort, | |
| baseUrl: `http://${host}:${actualPort}`, |
When the server binds to a wildcard host (e.g., mux server --host 0.0.0.0 so remote clients can reach it), the lockfile advertises baseUrl exactly as bound. That yields http://0.0.0.0:<port> here, which is not a routable address for HTTP clients. Because mux api now auto-discovers the running server via that lockfile, all CLI commands will fail to connect whenever the server is started on 0.0.0.0. The baseUrl written to the lockfile should use an address clients can actually dial (e.g., localhost or the real interface) instead of the bind wildcard.
ℹ️ 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
3602f01 to
86489da
Compare
Summary
127.0.0.1alongside the existing MessagePort transport~/.mux/server.lockChanges
ServerLockfileservice for server discovery and conflict detectionServerServicewithstartServer/stopServerlifecycle methodsorpcServer.tstosrc/node/orpc/server.ts(shared module)Environment Variables
MUX_SERVER_AUTH_TOKENMUX_SERVER_PORTMUX_NO_API_SERVER=1Test plan
make typecheckpassesmake lintpassesGenerated with mux