Commit Graph

24 Commits

  • feat(ai): switch xiaomi default to api billing, add per-region token plan providers (#4112)
    Built-in `xiaomi` provider now targets the API billing endpoint (https://api.xiaomimimo.com/anthropic) — a single stable URL for keys issued at platform.xiaomimimo.com. The Token Plan endpoints are exposed as three sibling providers, each with its own env var:
    
    - xiaomi-token-plan-cn: XIAOMI_TOKEN_PLAN_CN_API_KEY
    - xiaomi-token-plan-ams: XIAOMI_TOKEN_PLAN_AMS_API_KEY
    - xiaomi-token-plan-sgp: XIAOMI_TOKEN_PLAN_SGP_API_KEY
    
    BREAKING CHANGE: users who previously set XIAOMI_API_KEY against the Token Plan AMS endpoint must move to xiaomi-token-plan-ams and set XIAOMI_TOKEN_PLAN_AMS_API_KEY. This also resolves the 401 reported by on #4005, where a platform.xiaomimimo.com key fails against the Token Plan endpoint.
    
    closes #4082
  • feat(ai): add Xiaomi MiMo provider (#4005)
    * fix(ai): include minimax-cn in cross-provider-handoff matrix
    
    * feat(ai): add Xiaomi MiMo provider
    
    Adds Xiaomi MiMo as an openai-completions-compatible provider.
    
    - packages/ai: register provider in types/KnownProvider, env-api-keys (XIAOMI_API_KEY), generate-models, models.generated.ts, overflow util, README, CHANGELOG
    - packages/ai/test: extend stream, tokens, abort, empty, context-overflow, overflow, image-tool-result, tool-call-without-result, total-tokens, unicode-surrogate, cross-provider-handoff matrices with Xiaomi
    - packages/coding-agent: default model (mimo-v2.5-pro), display name (Xiaomi MiMo), CLI env var docs, README, docs/providers.md
    
    closes #3912
    
    ---------
    
    Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
  • fix(typebox): migrate to v1 with extension compat (#3474)
    * fix(typebox): migrate to v1 with extension compat
    
    Replace AJV-based validation with TypeBox-native validation, keep legacy extension imports working (including @sinclair/typebox/compiler), and restore coercion for serialized/plain JSON schemas.
    
    This change closes #3112.
    
    * fix(typebox): use canonical imports and harden coercion
    
    Switch first-party code to canonical typebox imports while retaining legacy extension aliases in the loader.
    
    Remove obsolete runtime codegen guards, expand serialized JSON-schema coercion coverage, and update related tests and fixtures.
    
    Fixes #3112.
    
    ---------
    
    Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
  • feat(ai): add Kimi For Coding provider support
    - Add kimi-coding provider using Anthropic Messages API
    - API endpoint: https://api.kimi.com/coding/v1
    - Environment variable: KIMI_API_KEY
    - Models: kimi-k2-thinking (text), k2p5 (text + image)
    - Add context overflow detection pattern for Kimi errors
    - Add tests for all standard test suites
  • feat(ai): add strictResponsesPairing for Azure OpenAI Responses API
    Split OpenAICompat into OpenAICompletionsCompat and OpenAIResponsesCompat
    for type-safe API-specific compat settings. Added strictResponsesPairing
    option to suppress orphaned reasoning/tool calls on incomplete turns,
    fixing 400 errors on Azure's Responses API which requires strict pairing.
    
    Closes #768
  • Fix PR #689: Add changelog attribution, coding-agent changelog, fix test types, add provider to test suites
    - Fix ai/CHANGELOG.md: add PR link and author attribution
    - Add coding-agent/CHANGELOG.md entry for vercel-ai-gateway provider
    - Fix model-resolver.test.ts: use anthropic-messages API type to match generated models
    - Add vercel-ai-gateway to test suites: tokens, abort, empty, context-overflow, unicode-surrogate, tool-call-without-result, image-tool-result, total-tokens, image-limits
  • feat(ai): Add Amazon Bedrock provider (#494)
    Adds support for Amazon Bedrock with Claude models including:
    - Full streaming support via Converse API
    - Reasoning/thinking support for Claude models
    - Cross-region inference model ID handling
    - Multiple AWS credential sources (profile, IAM keys, API keys)
    - Image support in messages and tool results
    - Unicode surrogate sanitization
    
    Also adds 'Adding a New Provider' documentation to AGENTS.md and README.
    
    Co-authored-by: nickchan2 <nickchan2@users.noreply.github.com>
  • fix(ai): append system prompt to codex bridge message instead of converting to input
    Previously the system prompt was converted to an input message in convertMessages,
    then stripped out by filterPiSystemPrompts. Now the system prompt is passed directly
    to transformRequestBody and appended after CODEX_PI_BRIDGE in the bridge message.
  • WIP: Remove global state from pi-ai OAuth/API key handling
    - Remove setApiKey, resolveApiKey, and global apiKeys Map from stream.ts
    - Rename getApiKey to getApiKeyFromEnv (only checks env vars)
    - Remove OAuth storage layer (storage.ts deleted)
    - OAuth login/refresh functions now return credentials instead of saving
    - getOAuthApiKey/refreshOAuthToken now take credentials as params
    - Add test/oauth.ts helper for ai package tests
    - Simplify root npm run check (single biome + tsgo pass)
    - Remove redundant check scripts from most packages
    - Add web-ui and coding-agent examples to biome/tsgo includes
    
    coding-agent still has compile errors - needs refactoring for new API
  • Add OAuth providers to test suite and improve test coverage
    Tests updated:
    - abort.test.ts: Add Google Gemini CLI, add retries
    - agent.test.ts: Add OAuth providers (Anthropic, GitHub Copilot, Gemini CLI, Antigravity), add retries, remove timeouts
    - context-overflow.test.ts: Handle Cerebras 429 status code
    - image-tool-result.test.ts: Add OAuth providers
    - overflow.ts: Detect 429 as overflow for Cerebras
    
    Removed obsolete debug/one-off tests:
    - copilot-initiator.test.ts
    - gemini-3-flash-tool-calling.test.ts
    - google-thought-signature.test.ts
    - mistral-debug.test.ts
    - mistral-empty-assistant.test.ts
    - mistral-sdk.test.ts
  • Add Mistral as AI provider
    - Add Mistral to KnownProvider type and model generation
    - Implement Mistral-specific compat handling in openai-completions:
      - requiresToolResultName: tool results need name field
      - requiresAssistantAfterToolResult: synthetic assistant message between tool/user
      - requiresThinkingAsText: thinking blocks as <thinking> text
      - requiresMistralToolIds: tool IDs must be exactly 9 alphanumeric chars
    - Add MISTRAL_API_KEY environment variable support
    - Add Mistral tests across all test files
    - Update documentation (README, CHANGELOG) for both ai and coding-agent packages
    - Remove client IDs from gemini.md, reference upstream source instead
    
    Closes #165
  • Add image support in tool results across all providers
    Tool results now use content blocks and can include both text and images.
    All providers (Anthropic, Google, OpenAI Completions, OpenAI Responses)
    correctly pass images from tool results to LLMs.
    
    - Update ToolResultMessage type to use content blocks
    - Add placeholder text for image-only tool results in Google/Anthropic
    - OpenAI providers send tool result + follow-up user message with images
    - Fix Anthropic JSON parsing for empty tool arguments
    - Add comprehensive tests for image-only and text+image tool results
    - Update README with tool result content blocks API