title: '[FEATURE] Support file:// with ~ expansion in *ApiKey config fields'
labels: enhancement
Is your feature request related to a problem?
The *ApiKey config fields (embeddingApiKey, memoryApiKey) currently accept only the key as a plain string:
For users who prefer to keep the key in a separate file (managed outside the config, shared across machines, rotated via CI, etc.), there's no built-in way to reference a file.
file:// is partially supported — "file:///abs/path" works — but the convenient portable form "file://~/.config/..." throws on Linux:
ERROR error=File URL host must be "localhost" or empty on linux failed to load plugin
Proposed solution
Support file:// references with ~ expansion in *ApiKey fields:
Root cause of the current failure is in src/services/secret-resolver.ts:33, where new URL(value) validates the URL before ~ is expanded, so ~ ends up as the URL host.
Upstream opencode-mem (tickernelz) handles this in one line (dist/services/secret-resolver.js:33):
const filePath = expandPath(value.slice(7));
The same approach should work here.
Additional context
Discovered while migrating from upstream opencode-mem, where the file://~/... pattern works out of the box.
title: '[FEATURE] Support file:// with ~ expansion in *ApiKey config fields'
labels: enhancement
Is your feature request related to a problem?
The
*ApiKeyconfig fields (embeddingApiKey,memoryApiKey) currently accept only the key as a plain string:{ "embeddingApiKey": "nvapi-..." }For users who prefer to keep the key in a separate file (managed outside the config, shared across machines, rotated via CI, etc.), there's no built-in way to reference a file.
file://is partially supported —"file:///abs/path"works — but the convenient portable form"file://~/.config/..."throws on Linux:Proposed solution
Support
file://references with~expansion in*ApiKeyfields:{ "embeddingApiKey": "file://~/.config/opencode/nvidia-key" }Root cause of the current failure is in
src/services/secret-resolver.ts:33, wherenew URL(value)validates the URL before~is expanded, so~ends up as the URL host.Upstream
opencode-mem(tickernelz) handles this in one line (dist/services/secret-resolver.js:33):The same approach should work here.
Additional context
Discovered while migrating from upstream
opencode-mem, where thefile://~/...pattern works out of the box.