feat(server): expose opencode server proxy url env#351
feat(server): expose opencode server proxy url env#351pascalandr wants to merge 2 commits intoNeuralNomadsAI:devfrom
Conversation
Provide the current workspace OpenCode proxy URL directly in the runtime environment so tools and plugins can call the correct server without an extra lookup.
|
I want you to perform the gatekeeper checks for latest PR state check for regressions |
|
Gatekeeper review for the latest PR state. What I reviewed
What I understood the request to be
Findings
Why this looks sound
Validation
Non-blocking quality note
Gatekeeper verdict
-- |
|
@pascalandr - Would you be able to tell me the usecase for this? |
|
This is mainly for tools running inside OpenCode, not plugin code. |
Why does tools like (bash, edit, apply_patch ) need access to CodeNomad base url? |
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/24960350917 Artifacts expire in 7 days. |
Well this is the issue :
|
|
opencode plugins don't need the port to call API calls to opencode. We already have codenomad base url and opencode instance id but If your requirement is opencode specific and if below doesn't help, we can add the port PluginIn a server plugin, use the
This comes from
So if the server is actually listening, Bash ToolYes, the bash tool can figure it out, but there’s no first-class “give me server port” API. Practically you can:
Examples (macOS): lsof -nP -p "$OPENCODE_PID" -iTCP -sTCP:LISTENor: lsof -nP -iTCP -sTCP:LISTEN | rg -i 'opencode|bun'This works because the bash tool inherits |
|
Right, and that workaround is exactly what @TheStaticMage is using today. This issue is really just a convenience request. |
|
@pascalandr - Can we change it to OPENCODE_SERVER_PORT in that case, it will be more targetted to OpenCode |
|
Just to confirm before I change the PR: do you mean a straight rename of the current env var shape, or do you want to also change the PR to expose only the actual OpenCode port value instead of the resolved proxy URL? |
I am thinking to just expose the OPENCODE_PORT as to be able to connect to opencode username, password and port are needed and port is the missing piece of the puzzle. |
Fixes #321
Summary
Why
Tools and plugins already receive the auth credentials needed to call the current workspace instance, but they still need an extra lookup to discover the correct URL.
The proxy URL is already known before runtime startup, so exposing it directly removes that lookup without changing OpenCode's port selection flow.
What Changed
Validation