Skip to content

app: refactor server management backend#13813

Merged
Brendonovich merged 16 commits intodevfrom
brendan/refactor-server-management-backend
Feb 18, 2026
Merged

app: refactor server management backend#13813
Brendonovich merged 16 commits intodevfrom
brendan/refactor-server-management-backend

Conversation

@Brendonovich
Copy link
Collaborator

@Brendonovich Brendonovich commented Feb 16, 2026

Refactors context/server.ts and broader server connection management to support more than just plan HTTP clients. The app is now aware of servers that are managed externally via sidecar and SSH, and app hosts can inject their own servers alongside saved into storage by the app itself.

This PR

ServerConnection

  • Type that represents a possible connection to an OpenCode server
  • Can be plain http, sidecars, or SSH
  • All connections have an underlying http endpoint on their http property which is what the app actually uses in fetch/ws
  • ServerConnection.key can be used to get a branded string that uniquely identifies a given connection. Replaces using the raw url as a connection key as in some cases the same connection can have a different key across launches (SSH http servers and sidecars are ephemeral but are always resolve to the same host under the hood)

Auth

  • The http section of each ServerConnection stores the username & password needed to authenticate to the OC server
  • This is read by SDK clients and when creating terminal WebSockets
  • Since Desktop can inject its own ServerConnection for the sidecar, it can use this same mechanism for providing its auth. No more __OPENCODE__.serverPassword!

SDK Clients

  • Usage of createOpencodeClient has been replaced by createSdkForServer, which takes in a ServerConnection instead of baseUrl. This ensures that all sdk instances are created with appropriate auth
  • SDKProvider and GlobalSDKProvider now have createClient utilities to facilitate creating sub-clients that share the same url/server but have different directories, error throwing semantics, etc. Just helps to keep things uniform

Other

  • Sidecar instances can now not be deleted or set as default
  • ServerConnection also has a displayName, so the desktop sidecar now displays as 'Local Server'

Further Work

  • The server list in ServerProvider should store ServerConnection objects instead of just URLs. I'm leaving this till later to minimise the surface area of this PR
  • UI for configuring username/password would be great after that

@github-actions
Copy link
Contributor

Hey! Your PR title app: refactor server management backend doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@Brendonovich Brendonovich marked this pull request as ready for review February 18, 2026 06:52
@Brendonovich Brendonovich merged commit 1bb8574 into dev Feb 18, 2026
7 checks passed
@Brendonovich Brendonovich deleted the brendan/refactor-server-management-backend branch February 18, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant