Grilling: config surface for endpoint and token #5

Closed
opened 2026-10-03 13:44:12 +00:00 by haylan · 1 comment
Owner

Map: #1

Question

Given the verified plugin options mechanism, finalise the config surface: option names, defaults, env var names and precedence (options > env > default), validation, how the token is supplied without living in opencode.json, limit clamping, and behaviour when endpoint/token are missing. Decided direction: options with env fallback.

Map: #1 ## Question Given the verified plugin options mechanism, finalise the config surface: option names, defaults, env var names and precedence (options > env > default), validation, how the token is supplied without living in `opencode.json`, `limit` clamping, and behaviour when endpoint/token are missing. Decided direction: options with env fallback.
haylan added the wayfinder:grilling label 2026-10-03 13:44:12 +00:00
haylan added a new dependency 2026-10-03 13:44:41 +00:00
haylan added a new dependency 2026-10-03 13:44:42 +00:00
haylan self-assigned this 2026-10-03 13:58:24 +00:00
Author
Owner

Resolved with the user. Glossary in CONTEXT.md.

Options: baseURL, apiKey, limit, lang, tbs. Env: CRW_API_URL, CRW_API_KEY. Precedence options > env > default.

  • Endpoint default http://localhost:3000; trailing slash stripped.
  • Token optional: Bearer header only when resolved; never logged or echoed.
  • limit default 8, clamped 1..20; invalid falls back to 8, never throws.
  • lang/tbs exposed, omitted from the request when unset; tbs in qdr:h|d|w|m|y.
  • Validation in setup; malformed baseURL, bad tbs or non-string lang makes setup throw loudly, naming the option and value.
  • Provider id fastcrw (display "fastCRW"); user chose the plain id knowingly over a namespaced one. Plugin id left to the packaging ticket.
  • The plugin makes fastcrw the default and only provider; no fallback to built-ins.

Runtime checks for the spec (docs silent): (1) can built-in providers be removed/disabled, else fall back to "websearch": false + explicit fastcrw; (2) a throwing setup disables only this plugin, not opencode startup; (3) config websearch.provider vs editor.default.set precedence.

Resolved with the user. Glossary in CONTEXT.md. **Options:** `baseURL`, `apiKey`, `limit`, `lang`, `tbs`. **Env:** `CRW_API_URL`, `CRW_API_KEY`. Precedence options > env > default. - Endpoint default `http://localhost:3000`; trailing slash stripped. - Token optional: Bearer header only when resolved; never logged or echoed. - `limit` default 8, clamped 1..20; invalid falls back to 8, never throws. - `lang`/`tbs` exposed, omitted from the request when unset; `tbs` in `qdr:h|d|w|m|y`. - Validation in `setup`; malformed `baseURL`, bad `tbs` or non-string `lang` makes `setup` throw loudly, naming the option and value. - Provider id `fastcrw` (display "fastCRW"); user chose the plain id knowingly over a namespaced one. Plugin id left to the packaging ticket. - The plugin makes `fastcrw` the default and only provider; no fallback to built-ins. Runtime checks for the spec (docs silent): (1) can built-in providers be removed/disabled, else fall back to `"websearch": false` + explicit `fastcrw`; (2) a throwing `setup` disables only this plugin, not opencode startup; (3) config `websearch.provider` vs `editor.default.set` precedence.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Depends on
#2 Research: verified opencode v2 plugin API
haylan/fastcrw-opencode-websearch
#3 Research: fastCRW /v1/search API contract
haylan/fastcrw-opencode-websearch
Reference: haylan/fastcrw-opencode-websearch#5