Repository navigation
Description
Part of #1341.
Context
Whether an embedding provider is usable is decided three times: resolveProviders (packages/core/src/cli/brain.ts:113-131), the MCP server (packages/core/src/mcp-server.ts:104-113) and doctor (packages/core/src/cli/commands/doctor.ts:389). Each hard-codes "GEMINI_API_KEY" as the default key name, which also appears in packages/core/src/cli/brain.ts:96, :101, :128 and packages/core/src/cli/commands/init.ts:74, while the providers already own their default (packages/core/src/providers/embeddings/gemini.ts:47, packages/core/src/providers/completions/gemini.ts:54). The registry is a plain record of factories (packages/core/src/lib/registry.ts:35-70) with no key metadata.
Scope
- Each built-in registry entry declares its default key variable.
- One
resolveProviders(config)(or equivalent) inlib/registry.tsreturns the resolved providers plus degraded-mode warnings. - CLI, MCP and
doctorcall it.
Out of scope
- Adding a provider; changing the custom-implementation path (
{ provider: value }). - Changing warning text in
--jsonenvelopes.
Acceptance criteria
-
grep -rn '"GEMINI_API_KEY"' packages/core/srcmatches only the registry/provider definitions and the env descriptor. - A test registers a fake built-in with a different key name and proves CLI and MCP both honour it, failing before the change.
- CLI and MCP contract snapshots are unchanged.
Verification
bun run test packages/core
bun run typecheckContract impact
None intended.
Blocked by #1355
2026-10-09: sequenced against the other code-quality issues to avoid overlapping edits; see the epic's planned-order comment.
Activity
schlessera commentedon Oct 10, 2026
Unblocked: #1355 is closed, so
scripts/sync-project.tsis removing theblockedlabel.schlessera commentedon Oct 10, 2026
Claimed (claim token
wi-1350-a7). Working on branchrefactor/1350-registry-provider-availability.CONTRACT: refactor(core): decide provider availability once in the re…
test(core): keep the fake built-in out of the test process
CONTRACT: refactor(core): decide provider availability once in the re…
test(core): keep the fake built-in out of the test process
CONTRACT: refactor(core): decide provider availability once in the re…
test(core): keep the fake built-in out of the test process
CONTRACT: refactor(core): decide provider availability once in the re…
schlessera commentedon Oct 10, 2026
Merged in #1458 as a8f884f (parent 02fd0b9). Built-in embedding and completion entries in
lib/registry.tsnow declare their key variable, andresolveProviders(config)decides availability for the CLI, the MCP server andbrain doctor."GEMINI_API_KEY"appears only in the two Gemini provider definitions and the env descriptor.provider-availability.test.tsruns a fake built-in with its own key through the real CLI and MCP server: it failed first on the pre-change tree for both hosts, and three mutations fail on the expected assertions (receipts in the PR). The CLI and MCP contract snapshots are unchanged. CI run 38026939921 passed every selected job on head 72ff4a6 (merge checkout b6658a6 onto d4eff9f). Main then advanced only by 02fd0b9 (ui-sdk/backends, no core changes). The combined tree merged cleanly and passed typecheck and the citation test locally; the squash tree equals that combined tree. #1349 is unblocked.docs: move the session-principals citations after rebasing onto #1350 …
docs: move the session-principals citations after rebasing onto #1350 …
CONTRACT: feat(core): add the @schlessera/brain/module authoring entry (