Skip to content

feat: plugin RPC + Custom Endpoint API Keys consolidation with .env sync - #68043

Closed
eiritsu wants to merge 3 commits into
NousResearch:mainfrom
eiritsu:feat/custom-endpoint-api-keys-card
Closed

feat: plugin RPC + Custom Endpoint API Keys consolidation with .env sync#68043
eiritsu wants to merge 3 commits into
NousResearch:mainfrom
eiritsu:feat/custom-endpoint-api-keys-card

Conversation

@eiritsu

@eiritsu eiritsu commented Jul 20, 2026

Copy link
Copy Markdown

What

Three related changes bundled into one PR:

1. Plugin RPC registration

Add PluginContext.register_rpc() so plugins can expose JSON-RPC methods to the gateway WebSocket API without modifying tui_gateway/server.py. Desktop plugin GUIs invoke them via host.request(method, params).

2. Custom Endpoint consolidated into API Keys page

Removed the standalone Custom Endpoints sub-page and sidebar nav. Added CustomEndpointKeyCard in the API Keys page using the same structure as ProviderKeyRows.

Backend: GET/PUT /api/providers/custom-endpoints reading/writing the managed_by:desktop-api-keys entry. Auto-detects api_mode from URL. Profile-scoped. 4 new test cases.

Frontend: API Key lifecycle matches KeyField (masked display, draft-on-focus, Esc cancel, explicit Remove with confirm). Only sends api_key when user typed one. Full i18n (en/zh/zh-hant/ja).

3. .env sync on save

_write_custom_endpoint() now syncs CUSTOM_BASE_URL / CUSTOM_API_KEY to .env on save and cleans them up on delete. Without this, stale .env values silently override config.yaml.

Notes

@alt-glitch alt-glitch added type/feature New feature or request comp/cli CLI entry point, hermes_cli/, setup wizard comp/desktop Electron desktop app (apps/desktop/*) comp/dashboard Web dashboard / control panel UI (dashboard/, landing) comp/plugins Plugin system and bundled plugins comp/tui Terminal UI (ui-tui/ + tui_gateway/) area/config Config system, migrations, profiles P2 Medium — degraded but workaround exists sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 20, 2026
eiritsu added 2 commits July 21, 2026 11:59
Allow plugins to register JSON-RPC methods via ctx.register_rpc() that
are merged into the gateway's method table, so Desktop plugin GUIs can
invoke them through host.request(method, params).

Changes:
- PluginContext.register_rpc() validates and stores RPC handlers
- PluginManager._rpc_methods registry (cleared on force=True reload)
- get_plugin_rpc_methods() / get_plugin_rpc_method_names() accessors
- Gateway: _merge_plugin_rpc_methods() discovers plugins on each call,
  reconciles stale plugin-owned methods, and is safe to call repeatedly
- handle_request() calls _merge_plugin_rpc_methods() before dispatch

Addresses review feedback:
- discover_plugins() called before reading registrations (fixes empty
  merge in standalone TUI process)
- Only marks merge state after successful discovery
- force=True clears _rpc_methods registry
- Stale plugin RPC methods removed from _methods on re-merge
…ified card UX

Removed the standalone Custom Endpoints sub-page and sidebar navigation.
Added CustomEndpointKeyCard in the API Keys page using the same structure
as ProviderKeyRows (@container, status dot, row-hover, @2XL responsive).

Backend: new GET/PUT /api/providers/custom-endpoint reading/writing the
managed_by:desktop-api-keys entry in config.yaml custom_providers:.
Auto-detects api_mode from URL. Profile-scoped. 4 new test cases.

Frontend: API Key lifecycle matches KeyField (masked display, draft-on-focus,
Esc cancel, explicit Remove with confirm). Only sends api_key when user
typed one. Full i18n (en/zh/zh-hant/ja). Removed standalone CRUD endpoints.
@eiritsu
eiritsu force-pushed the feat/custom-endpoint-api-keys-card branch from 33f3c1b to 3fecd7e Compare July 21, 2026 04:08
…routes

Frontend was calling singular /custom-endpoint but upstream backend
registers plural /custom-endpoints. Caused 404 from headless catch-all.
@eiritsu eiritsu changed the title fix: sync Custom Endpoint saves to .env to prevent URL drift feat: plugin RPC + Custom Endpoint API Keys consolidation with .env sync Jul 21, 2026
@eiritsu
eiritsu force-pushed the feat/custom-endpoint-api-keys-card branch from 0c9d56e to 13e4111 Compare July 21, 2026 05:29
@eiritsu

eiritsu commented Jul 21, 2026

Copy link
Copy Markdown
Author

Closing in favor of a clean PR with squashed commits. Replaced by a fresh branch rebased on latest origin/main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard comp/dashboard Web dashboard / control panel UI (dashboard/, landing) comp/desktop Electron desktop app (apps/desktop/*) comp/plugins Plugin system and bundled plugins comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants