* feat: enable reasoning for Claude models via Kilo Gateway
Enable extended thinking/reasoning support for Claude models when using
Kilo Gateway (OpenRouter-based). This includes:
- Add Kilo Gateway to OpenRouter SDK key mapping
- Skip toolCallId normalization for OpenRouter/Kilo to preserve thinking blocks
- Strip thinking/reasoning blocks from messages before sending to avoid
Anthropic API signature validation errors (blocks must be unchanged)
- Skip caching for OpenRouter/Kilo to avoid modifying thinking blocks
- Add Claude-specific reasoning effort variants for Kilo Gateway
- Enable default medium reasoning effort for Claude via Kilo Gateway
- Add proper smallOptions handling for Claude vs other models
The key insight is that Anthropic's API requires thinking blocks to be
EXACTLY unchanged with valid signatures. Since our storage reconstructs
messages, we strip thinking blocks (already shown to user) rather than
risk signature validation failures.
* fix: drop empty messages after stripping thinking blocks
* feat: re-enable auto-update for npm with @kilocode/cli
- Re-enable auto-upgrade but only for npm installations
- Update method detection to check for @kilocode/cli
- Update upgrade commands to use @kilocode/cli for npm/pnpm/bun
- Fetch latest version from @kilocode/cli on npm registry
* Also allow pnpm and bun
GPT models accessed through Kilo Gateway were missing the
'include: ["reasoning.encrypted_content"]' option, causing
organization_id mismatch errors when encrypted reasoning content
was passed back in multi-turn conversations.
- Add reasoningSummary and include options to effortVariants for Kilo Gateway
- Extend options() condition to include @kilocode/kilo-gateway npm package
Enable reasoning effort level cycling (Ctrl+T) for Claude models through
Kilo Gateway by:
- Adding @kilocode/kilo-gateway to sdkKey() to use 'openrouter' key for
provider options
- Adding dedicated variants() case for Claude/Anthropic models with full
effort levels (none, minimal, low, medium, high, xhigh)
- Supporting grok-3-mini reasoning variants through Kilo Gateway
- Fixing smallOptions() to use correct reasoning.effort format
OpenRouter maps effort levels to budget_tokens percentages:
- xhigh: 95%, high: 80%, medium: 50%, low: 20%, minimal: 10%, none: 0%
Wrap callback execution in a promise microtask so synchronous errors flow
through the existing `.catch()` and the in-flight entry is reliably cleaned
up. Update tests to await the microtask before asserting call count.
Add an in-flight cache entry for getClient to avoid repeated token
validation and client recreation, and use a single ttl constant for
token and org lookups.
Use in-flight cache for token retrieval and token validity checks, and
centralize cache clearing on auth errors to avoid reusing invalid
credentials while still allowing retries after transient failures.