[Feature]: Web Studio: manual account/user identity in trusted mode + root cross-account data view
Issue Origin
Observed or reproduced in a real environment
Problem Statement
Web Studio has no way to connect as a non-default identity in trusted auth mode, and no cross-account data view in api_key mode.
1. Trusted mode: identity is stuck at server defaults. The Studio connection form (web-studio/src/routes/settings/route.tsx) offers exactly three inputs: Base URL, Root API Key, User API Key. The [account/user] badge next to the key field is a derived label, not an input. The identity picker (web-studio/src/hooks/use-identity-directory.ts) is hard-gated:
const available =
serverMode === 'api_key' &&
(connectionRole === 'root' || connectionRole === 'admin') &&
Boolean(controlApiKey)
Meanwhile, in trusted mode without a configured root_api_key, the Admin API is disabled entirely — the server itself answers "Admin API requires api_key mode with root_api_key configured" on GET /api/v1/admin/accounts. So in trusted mode the Studio connects only as default/default (from server.default_account/default_user), which in real deployments is an empty tenant. The dashboard — the natural observability surface for the server — is unusable for the identities that actually hold data.
2. api_key mode: no cross-account observability. Identity is per-key. Inspecting a second account means re-entering that account's user key in settings. A root key unlocks the admin plane (account/user management) but provides no cross-account data-plane view (browse/search memories across accounts). For an operator running multiple teams/tenants on one server, there is no fleet-wide view.
Proposed Solution
- Manual identity fields (trusted mode). Add optional Account ID / User ID text inputs to the connection form. When the server reports
auth_mode: trustedand no key is configured, sendX-OpenViking-Account/X-OpenViking-User(the Studio client already supportsidentityHeaders) with those values instead of the defaults. - Root-scoped account switching (api_key mode). When the connection has root capability, drive an account/user switcher from
GET /api/v1/admin/accounts(+ per-account users) and re-scope data-plane requests to the selected tenant — root can already enumerate tenants, so no new backend privilege is needed, only data-plane scoping (e.g. explicitaccount_id/user_idURL parameters on read endpoints, or a root-issued impersonation token).
Alternatives Considered
- Per-account user keys in
api_keymode: works for Studio, but forces every local keyless agent integration back to per-agent key management, and still leaves no cross-account view. root_api_keyin trusted mode: makes the key mandatory for every request (trusted.pyresolve_identityrejects keyless calls once configured), breaking keyless local agent setups — so it's not a viable path to the admin plane for this deployment shape.- Local Studio fork: ongoing rebuild/maintenance cost on every server upgrade.
Feature Area
Other (Web Studio)
Use Case
A self-hosted OpenViking server (v0.4.15) holds several team accounts, each with agents reading/writing memories via MCP. The operator wants to observe memory growth, search quality, ingestion/task state, and agent-evolution output across all teams from the Web Studio dashboard. Today this requires either switching the whole server to api_key mode and juggling per-account keys (and even then: one account at a time), or asking an agent to query the REST API by hand.
Example API (Optional)
Trusted-mode connection the Studio could already send today if the form allowed it:
curl http://server:1933/api/v1/search/find \
-H 'Content-Type: application/json' \
-H 'X-OpenViking-Account: team-a' \
-H 'X-OpenViking-User: alice' \
-d '{"query": "incident review", "limit": 10, "context_type": ["memory"]}'
Root cross-account read (one possible shape):
curl "http://server:1933/api/v1/fs/ls?uri=viking://user/alice/memories/&account_id=team-a" \
-H 'X-API-Key: <root-key>'
Additional Context
- Verified against server v0.4.15: trusted mode without
root_api_keydisables the Admin API; inapi_keymode the server stripsX-OpenViking-Account/Userheaders (identity comes from the key), so header-based identity cannot be emulated there either. - Related but distinct: #1722 (trusted-mode root key handling), #3801 (header/key mismatch acceptance).