Hand out the right opencode command: the API's public URL, and setup uses the install script

install-newt now asks for the API's public URL first (--api-url) and records it; it names
the Pangolin resource and refuses an endpoint on the same host. expose-dashboard records
only that the dashboard is public. One rule (opencode.client_targets) decides which
opencode-install.sh commands are shown -- local only without a tunnel; internet and local
with one; internet only once the dashboard is public -- and setup's closing message,
`llmhost opencode-config` and the dashboard's Connect dialog all use it.

Setup's offer to install opencode now goes through opencode-install.sh --install-only, a
new mode that only installs opencode; this machine's own provider is still configured by
llm-host, which keeps it in sync on every switch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
neil 2026-11-06 18:35:41 -08:00
parent c8b70afdbf
commit 3e9ebeed42
10 changed files with 266 additions and 109 deletions

View file

@ -109,8 +109,20 @@ check("opencode block is the openai-compatible provider", blk["npm"] == "@ai-sdk
check("opencode block offers the one alias", list(blk["models"]) == [cx["model"]] == ["default"], blk["models"])
check("opencode block leaves the address to the page", "LABEL" in blk["name"] and "HOST" in blk["options"]["baseURL"], blk)
check("the key isn't inlined in the block", KEY not in json.dumps(blk))
check("installer URL is a raw file in the repo", cx["installer"].startswith("https://")
and cx["installer"].endswith("/opencode-install.sh"), cx["installer"])
check("one address before any tunnel: the LAN", len(cx["targets"]) == 1
and cx["targets"][0]["url"].endswith(f":{harness.config()['api_port']}"), cx["targets"])
check("with its opencode-install.sh command", "/opencode-install.sh)\" -- --url http://" in cx["targets"][0]["command"],
cx["targets"])
c2 = harness.config(); c2["newt"] = {"endpoint": "https://p.example.test", "id": "x", "api_url": "https://llm-api.example.test"}
paths.save_config(c2)
cx = json.loads(req(srv, "GET", "/api/connect", {"Authorization": f"Bearer {KEY}"})[2])
check("tunnel, local dashboard: internet then LAN", [t["where"] for t in cx["targets"]]
== ["from the internet", "on your local network"] and cx["targets"][0]["url"] == "https://llm-api.example.test", cx["targets"])
c2["dashboard_public"] = True
paths.save_config(c2)
cx = json.loads(req(srv, "GET", "/api/connect", {"Authorization": f"Bearer {KEY}"})[2])
check("public dashboard: the internet only", [t["url"] for t in cx["targets"]] == ["https://llm-api.example.test"], cx["targets"])
paths.save_config(harness.config())
R = web.raw_file_url
check("raw URL for a Gitea/Forgejo repo", R("https://git.example.com/pub/llm-host.git", "main", "f.sh")
== "https://git.example.com/pub/llm-host/raw/branch/main/f.sh")