Skip to content

Add server.enabled config option to explicitly enable HTTP server #8561

@rmk40

Description

@rmk40

Problem

Since v1.1.10 (commit 982b71e), the TUI no longer starts an HTTP server by default. While this is a reasonable security improvement, it breaks workflows that depend on the HTTP server:

  • Desktop app connecting to the TUI backend
  • SDK integrations that communicate via HTTP
  • Remote access scenarios (e.g., driving OpenCode from a mobile app)

Current Workarounds Don't Work Well

  1. port: 0 - Fails because the schema uses .positive() which rejects 0
  2. hostname: "127.0.0.1" - Doesn't trigger server because it matches the default
  3. mdns: true - Works but enables mDNS discovery which may not be desired

Users need a clear, explicit way to opt into the HTTP server without side effects.

Proposed Solution

Add a server.enabled config option:

{
  "server": {
    "enabled": true
  }
}

This provides a clear opt-in mechanism that:

  • Is self-documenting (the intent is obvious)
  • Has no side effects (unlike mdns: true)
  • Restores pre-982b71e behavior for users who need it

Implementation

Minimal 3-file change:

  1. Add enabled: z.boolean().optional() to Server schema
  2. Return enabled from resolveNetworkOptions()
  3. Add networkOpts.enabled || to shouldStartServer condition

I have a PR ready with this implementation.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions