co-mono/packages
Yevhen Bobrov 243104fa18
Allow models.json to override built-in providers (#406)
* Allow models.json to override built-in providers

When a provider is defined in models.json with the same name as a
built-in provider (e.g., 'anthropic', 'google'), the built-in models
for that provider are completely replaced by the custom definition.

This enables users to:
- Use custom base URLs (proxies, self-hosted endpoints)
- Define a subset of models they want available
- Customize model configurations for built-in providers

Example usage in ~/.pi/agent/models.json:
{
  "providers": {
    "anthropic": {
      "baseUrl": "https://my-proxy.example.com/v1",
      "apiKey": "ANTHROPIC_API_KEY",
      "api": "anthropic-messages",
      "models": [...]
    }
  }
}

* Refactor model-registry for readability

- Extract CustomModelsResult type and emptyCustomModelsResult helper
- Extract loadBuiltInModels method with clear skip logic
- Simplify loadModels with destructuring and ternary
- Reduce repetition in error handling paths

* Refactor model-registry tests for readability

- Extract providerConfig() helper to hide irrelevant model fields
- Extract writeModelsJson() helper for file writing
- Extract getModelsForProvider() helper for filtering
- Move modelsJsonPath to beforeEach

Reduces test file from 262 to 130 lines while maintaining same coverage.
2026-01-03 00:59:59 +01:00
..
agent docs: update CHANGELOGs for steer()/followUp() API changes 2026-01-03 00:13:26 +01:00
ai fix(ai): add retry with server-provided delay for Gemini CLI rate limits, fixes #370 2026-01-02 10:45:59 +01:00
coding-agent Allow models.json to override built-in providers (#406) 2026-01-03 00:59:59 +01:00
mom feat(coding-agent): complete steer()/followUp() migration 2026-01-03 00:13:25 +01:00
pods Release v0.31.1 2026-01-02 10:39:08 +01:00
tui Merge PR #382: word wrapping in Editor component 2026-01-03 00:48:28 +01:00
web-ui feat(coding-agent): complete steer()/followUp() migration 2026-01-03 00:13:25 +01:00