Skip to content

feat: route every open through the plugin's own server RPC - #19

Merged
nabheet merged 1 commit into
mainfrom
feat/internal-open
Nov 20, 2026
Merged

nabheet merged 1 commit into
mainfrom
feat/internal-open

Conversation

@nabheet

@nabheet nabheet commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Change

Opening now originates inside the TUI process:

/media or autoplay
  → context.client.rpc(Media).open({ source })   (TUI → server)
  → server emits "open"
  → the TUI's subscription renders the panel      (server → TUI)

One path for the slash command, autoplay and an external caller. No shell, no CLI, no second process in the plugin's flow.

Fallback: if the server part is not loaded the call rejects and the local opener runs, so a TUI-only install (no opencode.json entry) keeps working.

Docs corrected

  • Body is an envelope: {"input": ...}, not {"source": ...}.
  • Authentication is HTTP Basic: username opencode, password from service.json, channel port (49374 for latest).

Verification

Isolated instance, local checkout, real keystrokes: /media opened the panel at 19/48 through the RPC round trip. npm run check green (typecheck, biome, markdownlint, build, 24 tests).

The open request now originates inside the TUI process. `open()` calls
`context.client.rpc(Media).open(...)`, the server part emits `open`, and the
subscriber in the same process renders it. `/media`, autoplay and an external
caller all take that path; the plugin never shells out.

If the server part is not loaded the call rejects and the local opener runs, so
a TUI-only install keeps working.

Also documents the call's real shape: the body is `{"input": ...}` and the
service authenticates with HTTP Basic, `opencode` plus the password from
service.json.

Verified by driving /media in an isolated instance: the panel opened at 19/48
through the RPC round trip.
@github-actions

Copy link
Copy Markdown

Beta prerelease published: 0.1.0-beta.47. Install with npm i opencode-media-panel@beta.

@nabheet
nabheet merged commit 6f89b61 into main Nov 20, 2026
3 checks passed
@nabheet
nabheet deleted the feat/internal-open branch November 20, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant