feat(core): add server.enabled config option to restore HTTP server#8562
feat(core): add server.enabled config option to restore HTTP server#8562rmk40 wants to merge 1 commit intoanomalyco:devfrom
Conversation
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
- Change config from http.enabled/port to server.hostname: localhost - Add explanation that localhost differs from default 127.0.0.1 - Reference upstream PR anomalyco/opencode#8562 for cleaner server.enabled option - Update README.md and INSTALL.md
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
|
Hi @rmk40 are there any blockers to merge this? |
1897f25 to
17e88cc
Compare
|
Shouldn't be and I've confirmed there's no way to replicate the desired behavior (which was also prior behavior) of starting the server on localhost, assigning port to 4096 and falling back to dynamic assignment. Basically it takes specifying port to get the server to start on localhost, which will fail if the port isn't available. Yet, starting on say 0.0.0.0 without specifying port works and will try 4096 and fall back to others accordingly. |
17e88cc to
b413c7c
Compare
Adds a `server.enabled` config option that explicitly enables the HTTP
server for the TUI, restoring the pre-982b71e behavior for users who
need external connections (desktop app, SDK, etc).
Usage in opencode.json:
{ "server": { "enabled": true } }
This provides a clear opt-in mechanism without relying on side effects
like setting hostname to 'localhost' or enabling mDNS.
Refs: 982b71e (disable server unless explicitly opted in)
b413c7c to
7f8884d
Compare
|
Worth noting for anyone evaluating workarounds: The gap this PR addresses is the config-only path. If you set
There's no config-only way to say "start the server on the default host/port" without side effects like enabling mDNS or binding to |
Summary
Adds a
server.enabledconfig option and--enable-serverCLI flag that explicitly enable the HTTP server for the TUI, restoring the pre-982b71e behavior for users who need external connections (desktop app, SDK, etc).Fixes #8561
Usage
Config (
opencode.json):{ "server": { "enabled": true } }CLI:
Both use the default port-0 fallback (try 4096, then random) on
127.0.0.1— the same resilient behavior as before the server was disabled by default.Changes
config.ts: Addenabled: z.boolean().optional()to Server schemanetwork.ts: Add--enable-serverCLI option, resolveenabledfrom CLI flag or config, return inresolveNetworkOptions()thread.ts: AddnetworkOpts.enabled ||toshouldStartServerconditionWhy
Since 982b71e ("disable server unless explicitly opted in"), users who need the HTTP server have no clean way to enable it:
port: 0fails (schema rejects non-positive)hostname: "127.0.0.1"doesn't trigger server (matches default)mdns: trueworks but has unwanted side effectsThis provides a clear, self-documenting opt-in via both config and CLI with no side effects.
Testing
Tested locally — setting
"server": { "enabled": true }inopencode.jsonor passing--enable-servercorrectly starts the HTTP server with the default port-0 fallback behavior.