Use setEncoding("utf8") on stdout/stderr streams instead of
per-chunk Buffer.toString() to avoid breaking multi-byte characters
at chunk boundaries.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move execa type import before vitest to satisfy eslint import/order.
Require SMOKE_PROXY_MODEL env var for continue-proxy test since the
proxy needs a 4-part model name (owner/package/provider/model) that
depends on org-specific configuration.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a new smoke-api test suite that proves the CLI can complete real LLM
round-trips against the Anthropic API. Tests cover headless mode,
serve mode, and all-tools execution. Runs sequentially to avoid rate
limits, skips gracefully when API keys are missing (fork PRs), and
is wired into CI as a required check with allowed-skips.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add --provenance flag to npm publish so it uses the GitHub OIDC token
exchange instead of the expired NODE_AUTH_TOKEN for authentication.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Preserve Vitest's default excludes (dist, node_modules, etc.) when
adding the live test exclusion pattern.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Live test files (*.live.test.ts) make real Anthropic API calls and are
intended for manual validation only. Exclude them from the default
vitest configuration to prevent flaky CI failures.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Clone message content blocks before mutating for cache_control
(prevents mutation of original input body)
- Add `void` prefix to async posthogService.capture call
- Fix duplicate assistant messages in Scenario 3 test loop
- Add unit test verifying original body is not mutated
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The systemAndTools caching strategy now adds cache_control to the last
two user messages via addCacheControlToLastTwoUserMessages(). Update
existing test expectations to include the cache_control field.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The OpenAI PromptTokensDetails type doesn't include cache_read_tokens
(it's an Anthropic extension). Add 'as any' casts to fix TypeScript
build errors in the battle test file.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7 distinct scenarios covering tool use round-trips, parallel tool calls,
long 8-turn conversations, large tool results (~200 lines), cache
invalidation on system message changes, identical request replays, and
multi-step agentic workflows with chained tool calls.
All scenarios validate cache hit rates >90% where expected and proper
cache misses when the system message changes.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add addCacheControlToLastTwoUserMessages call in systemAndToolsStrategy
so the CLI path caches conversation turns (matching VS Code extension behavior)
- Report prompt_cache_metrics to PostHog with cache_read/write tokens and hit rate
- Add live API integration test validating cache writes on turn 1 and 99%+ hit
rates on subsequent turns (guarded by ANTHROPIC_API_KEY env var)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Download the suggestions CLI binary from GitHub Releases during
blueprint build so it's available at /usr/local/bin/suggestions
without runtime downloads.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add latest model definitions across providers
Add new models for OpenAI (gpt-4.1, gpt-5.2, codex-mini, o1/o3/o4-mini),
Gemini (2.5 stable, 2.5-flash-lite, 3-flash-preview), Mistral (devstral,
magistral, ministral, mistral-nemo), xAI (grok-4-fast, grok-4-1-fast,
grok-3-fast), and Bedrock (Claude 4.5/4.6, Nova, Llama 4, DeepSeek).
Update tool support and reasoning detection for the new model families.
* Add Z.ai (GLM) provider, Kimi K2/K2.5 models, and fix OpenRouter tool support bug
- Add Z.ai as a new provider with GLM-5, GLM-4.7, GLM-4-plus, GLM-4.5 models
- Add Kimi K2 and K2.5 model packages to Moonshot provider
- Fix variable shadowing bug in OpenRouter tool support where loop
variables shadowed the outer model parameter, causing specificModels
and supportedContains checks to always return true
- Add moonshotai/kimi and zai-org/glm to OpenRouter supported prefixes
- Add Z.ai and Moonshot to docs navigation
* Clean up unnecessary import aliases for zAI
* Add Z.ai Coding Plan endpoint note to docs
* Replace placeholder zai.png icon with proper zAI.svg
* Add zAI provider to openai-adapters
* Fix Z.ai API key URL
Gemini and VertexAI can return rate-limit errors where the HTTP status
is not 429 but the error code is embedded in the response body JSON
(e.g., "code":429). Add regex-based detection of these embedded errors
in both retry paths so they trigger exponential backoff correctly.
ToolPermissionService imported ALL_BUILT_IN_TOOLS from allBuiltIns.ts,
which imports runTerminalCommand.ts, which imports services/index.ts,
which imports ToolPermissionService.ts - creating a circular dependency.
This caused "ToolPermissionService is not a constructor" errors in tests
because the module wasn't fully initialized when services/index.ts tried
to instantiate it.
Fix: Extract a lightweight builtInToolNames.ts with just the string names
(no heavy imports) and use that in ToolPermissionService instead. Also add
a vitest resolve alias for "src/" paths to match tsconfig baseUrl.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The tsconfig uses baseUrl: "." which allows imports like "src/..." to
resolve correctly for tsc, but vitest doesn't read tsconfig paths by
default. This adds a resolve.alias to map "src" to the actual source
directory so tests can resolve these imports.
Fixes ToolPermissionService test failures (TypeError: ToolPermissionService
is not a constructor) caused by failed module resolution of "src/..." paths.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>