Commit Graph

16 Commits

Author SHA1 Message Date
William Valentin 6b56d9e223 feat(models): add auth profile cooldown for api key pools 2026-02-19 11:45:55 -08:00
William Valentin 8e3cd2e0ba feat: add multi-key auth profile rotation for model providers 2026-02-18 10:29:54 -08:00
William Valentin 0a4cfda787 feat: add claude-sonnet-4-6 (20260217) model support
- costs.ts: add claude-sonnet-4-6-20260217 at $3/$15 per 1M tokens, claude-sonnet-4.6 GitHub alias at $0
- models.ts: add anthropicToGitHubModel mapping for claude-sonnet-4-6-20260217 → claude-sonnet-4.6
- tokens.ts: add 1M token context window for claude-sonnet-4-6-20260217
- providers.ts: bump Anthropic, GitHub Models, and Bedrock default to sonnet-4-6
- AGENTS.md: update default subagent model from claude-sonnet-4.5 to claude-sonnet-4.6
2026-02-17 14:56:41 -08:00
William Valentin 46538e71a8 chore(lint): restore zero-error eslint baseline 2026-02-15 22:25:29 -08:00
William Valentin dd15ccb927 Fix Z.AI credential resolution and improve 401 auth diagnostics 2026-02-15 19:47:27 -08:00
William Valentin 0470647ee7 feat(models): add minimax and moonshot providers 2026-02-15 19:18:48 -08:00
William Valentin 87e942b4c5 feat(models): add Vercel AI Gateway provider 2026-02-15 10:52:03 -08:00
William Valentin 7627e6e630 daemon: enforce auth_mode for OpenAI and Anthropic 2026-02-15 10:39:53 -08:00
William Valentin 184ebe4480 models: add synthetic provider 2026-02-14 09:34:39 -08:00
William Valentin 4bb8c88fbe feat(auth): add anthropic api key storage and cli auth 2026-02-14 00:43:12 -08:00
William Valentin 7df0569a39 feat(models): add Z.AI (GLM) credential integration and setup flow
Implement first-class Z.AI credential storage and authentication:

- New auth provider: src/auth/zai.ts for Z.AI API key management
- New CLI command: flynn zai-auth to store Z.AI API keys
- New TUI command: /login zai for interactive credential entry
- Modified src/auth/index.ts to register zai provider
- Modified src/cli/index.ts to register zai-auth command
- Modified src/cli/setup/providers.ts to include Z.AI in setup wizard
- Modified src/daemon/models.ts to support zhipuai use_oauth flag
- Modified src/daemon/clientFactory.test.ts to add Z.AI tests
- Modified src/frontends/tui/commands.ts to add login command
- Modified src/frontends/tui/minimal.ts to support credential prompts

This allows users to authenticate with Z.AI (GLM models) without
embedding secrets in config files. Credentials are stored securely in
~/.config/flynn/auth.json and resolved at runtime.

Updated state.json with new feature entry documenting the integration.
2026-02-13 16:23:49 -08:00
William Valentin 955b9e28e0 feat: add OpenAI OAuth, strict model overrides, and Gmail pull mode 2026-02-13 14:55:40 -08:00
William Valentin 6090508bad style: auto-fix ESLint issues (curly braces and formatting)
- Add curly braces to all if/else/for/while statements
- Fix indentation and trailing spaces
- Auto-fixed 372 linting errors using eslint --fix
- Remaining issues are warnings only (non-null assertions, explicit any types)
2026-02-11 10:30:24 -08:00
William Valentin 5c90640e2a fix: clear error messages for missing API keys on provider switch
Previously, switching to zhipuai/openrouter/xai via /model would throw a
confusing 'OPENAI_API_KEY missing' error from the OpenAI SDK. Now
createClientFromConfig validates API keys before constructing the client,
throwing errors that name the correct env var (e.g. ZHIPUAI_API_KEY).

Also fixes the misleading 'as anthropic' type cast in the /model handler
to validate against MODEL_PROVIDERS and use the ModelProvider type.
2026-02-10 21:32:44 -08:00
William Valentin 35f4cab0dc feat: add log-level system to suppress noisy fallback debug output
Replace console.debug/log/warn calls in model router, retry, and daemon
startup with a structured logger that respects a configurable log_level.
Default level is 'info', suppressing verbose fallback debug messages in
the TUI while keeping them available via config when needed.

- Add src/logger.ts with debug/info/warn/error/silent levels
- Wire log_level into config schema (default: 'info')
- Initialize log level in both daemon and TUI startup paths
- Convert all console.debug in router.ts and retry.ts to logger.debug
- Convert console.log/warn in daemon/models.ts to logger.info/warn
2026-02-09 21:23:07 -08:00
William Valentin 86cda91f6b refactor(01-01): extract model client logic into src/daemon/models.ts
- Move createClientFromConfig, anthropicToGitHubModel, createAutoFallbackClient, createModelRouter to dedicated module
- Add re-exports from daemon/index.ts for backward compatibility
- clientFactory.test.ts passes without modification
- Reduces daemon/index.ts by ~248 lines
2026-02-09 20:06:27 -08:00