Commit Graph

61 Commits

Author SHA1 Message Date
William Valentin 73fc5d173d feat: add auto-login for GitHub Copilot when no token is available
GitHubModelsClient now lazily resolves tokens at first API call. If no
token exists (env var, stored OAuth, or config), it triggers the OAuth
device flow automatically via an onLoginRequired callback wired in both
the TUI and daemon entry points.
2026-02-06 22:33:48 -08:00
William Valentin f363717f5f feat: add GitHub Copilot model provider with OAuth device flow
Add a new 'github' model provider backed by the Copilot API
(api.githubcopilot.com), with OAuth device flow for authentication.

- New src/auth/github.ts: device flow login, token storage at
  ~/.config/flynn/auth.json with 0600 permissions
- New src/models/github.ts: OpenAI-compatible client with streaming,
  tool calling, and Copilot-specific headers
- Add 'github' to provider enum in config schema
- Register provider in daemon factory and TUI client factory
- Refactor TUI to use provider-agnostic client factory (was hardcoded
  to AnthropicClient for all tiers)
- Add /login command to TUI for interactive OAuth authorization
- Add Copilot model cost tracking entries
2026-02-06 22:26:52 -08:00
William Valentin 0eb1f7a073 feat: add Gemini and Bedrock model providers
Add native GeminiClient using @google/generative-ai SDK and BedrockClient
using @aws-sdk/client-bedrock-runtime. Replace the previous Gemini fallback
(OpenAI-compatible shim) with the real implementation. Add OpenRouter as a
provider option (OpenAI-compatible with custom baseURL). Update model costs,
doctor CLI checks, and client factory tests.
2026-02-06 16:51:32 -08:00
William Valentin e4b7f96d33 fix: provider-aware model routing with fallback visibility
- Extract createClientFromConfig() to dispatch on provider field instead
  of hardcoding all tiers as AnthropicClient
- Add fallback/fallbackReason metadata to ChatResponse and ChatStreamEvent
  so callers know when a fallback model was used
- Enhance doctor check to report full model stack and warn on missing
  API keys for cloud providers
- Log fallback warnings in NativeAgent and display them in TUI
- Support tier names and local_providers entries in fallback_chain
- Add 8 tests for createClientFromConfig covering all provider types
2026-02-06 09:58:56 -08:00
William Valentin c4d30fd0d3 feat(cli): implement doctor diagnostics with 10 health checks
Replace doctor stub with full implementation including checks for:
config existence, YAML parsing, schema validation, env vars,
data directory writability, session DB, model config, Telegram,
MCP servers, and skills loading.
2026-02-05 22:20:37 -08:00
William Valentin 1ed9a34715 feat(cli): implement tui command wrapping existing TUI logic 2026-02-05 22:17:44 -08:00
William Valentin 117f3405ce feat(cli): implement config display command 2026-02-05 22:16:58 -08:00
William Valentin 0699730627 feat(cli): implement sessions list command 2026-02-05 22:16:29 -08:00
William Valentin 237246a8cf feat(cli): implement send command for one-shot agent messages 2026-02-05 22:15:46 -08:00
William Valentin 72c75a8bd7 feat(cli): add CLI entry point with commander and start command 2026-02-05 22:14:42 -08:00
William Valentin 6f7b5b8f0f feat(cli): add shared utilities for config loading and output 2026-02-05 22:13:05 -08:00