Added npm overrides to force minimatch@^9.0.7 for all dependencies
that use vulnerable versions (<9.0.7). This addresses:
- SNYK-JS-MINIMATCH-15309438: ReDoS (High Severity)
- SNYK-JS-MINIMATCH-15353387: ReDoS (High Severity)
- SNYK-JS-MINIMATCH-15353389: Inefficient Algorithmic Complexity (High Severity)
The vulnerable minimatch@9.0.5 was introduced as a transitive dependency
of @sentry/profiling-node > @sentry/node.
Generated with [Continue](https://continue.dev)
Co-authored-by: Continue Agent <noreply@continue.dev>
* feat: add hooks system for CLI event interception
Adds a Claude Code-compatible hooks system that allows external handlers
(shell commands, HTTP endpoints) to intercept and respond to CLI events.
Supports 16 event types with regex-based matching, typed inputs/outputs,
sync/async execution, and multi-source config merging.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: register HookService in service container
The fireHook.ts module references services.hooks, which requires the
HookService to be registered in the service container and exposed in
the services object.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: resolve eslint errors in hooks files and services/index.ts
Fix unused imports, import ordering, and negated condition lint errors.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: handle EPIPE errors on hook stdin writes
When a hook command exits before we finish writing to stdin, an EPIPE
error is emitted. Add an error handler to suppress it gracefully.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: skip hookRunner tests on Windows
The hookRunner tests use /bin/sh syntax (>&2, single-quote echo, sleep)
that is incompatible with Windows cmd.exe.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address cubic review - utf8 encoding, regex, EPIPE handling
- Use setEncoding("utf8") on stdout/stderr instead of data.toString()
to prevent multi-byte character corruption at buffer boundaries
- Fix env var interpolation regex to use alternation instead of
independent optionals, preventing unbalanced brace matching
- Only suppress EPIPE errors on stdin, log other errors
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Remove AI slop from hookRunner.ts
* Update AGENTS.md to document hooks system
* Fix React hooks best practices in useService.ts
* fix: correct indentation in useService.ts for prettier
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: remove invalid eslint-disable for react-hooks/exhaustive-deps
The react-hooks eslint plugin is not configured in the CLI package,
so the disable comment causes an eslint error.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: continue[bot] <230936708+continue[bot]@users.noreply.github.com>
* fix: correct cache_hit_rate calculation and remove duplicate emission
Two bugs in prompt_cache_metrics telemetry:
1. Duplicate emission: prompt_cache_metrics was emitted twice per API
request — once using `actualInputTokens` and again using
`fullUsage.prompt_tokens`. This doubled all event counts in PostHog
and produced conflicting values.
2. Wrong denominator: cache_hit_rate was calculated as
`cacheReadTokens / prompt_tokens`, but the Anthropic adapter maps
`prompt_tokens` to only non-cached input tokens (`input_tokens`),
excluding cache reads and writes. When caching works well, this
produces ratios >> 1 (observed max: 89,892). The correct total is
`prompt_tokens + cache_read_tokens + cache_write_tokens`.
Fix: remove the first duplicate emission and compute total_prompt_tokens
as the sum of all three token types. cache_hit_rate is now a proper 0-1
ratio.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: emit tool call id/name from tool-input-start in Vercel stream converter
The Vercel AI SDK streams tool calls as tool-input-start → tool-input-delta
→ tool-input-end → tool-call. Previously, tool-input-start was ignored (returned
null) and tool-call emitted the full tool call at the end, which meant streaming
consumers never saw the tool call id on intermediate chunks.
Now tool-input-start emits the initial chunk with id and function name (matching
OpenAI's streaming format), and tool-call returns null to avoid duplicating args
already streamed via tool-input-delta.
Generated with [Continue](https://continue.dev)
Co-Authored-By: Continue <noreply@continue.dev>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Continue <noreply@continue.dev>
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>
Remove the getDirectoryStructure() function and its embedding in the
system prompt. This was walking up to 500 files and embedding them as a
static tree in every API request, adding ~3,500-5,000 tokens per call.
The LLM already has tools (listFiles, Glob, Grep) to discover files on
demand, making the embedded tree redundant. Claude Code does not include
directory structure in its system prompt for the same reason.
This also improves prompt cache hit rates since the system prompt no
longer varies by project directory contents.
Generated with [Continue](https://continue.dev)
Co-Authored-By: Continue <noreply@continue.dev>
Add cacheReadTokens and cacheWriteTokens to the existing apiRequest
PostHog event, and emit a new prompt_cache_metrics event with
cache_hit_rate, cache_read_tokens, cache_write_tokens,
total_prompt_tokens, tool_count, and model. This populates the
existing Prompt Cache Performance dashboard (ID: 1310089).
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>
- 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>
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>
- Add missing import for backgroundJobService in services/index.ts
- Add explicit type annotation for BackgroundJob parameter in checkBackgroundJob.ts
- Fix stale closure in JobsSelector useEffect by adding viewMode/selectedJob to deps
- Truncate stdout when moving command to background to prevent context overflow
- Detach stdout/stderr listeners after backgrounding to prevent memory growth
- Use setEncoding('utf8') on streams to prevent multi-byte character corruption
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
In remote mode, the component connects to a non-existent server, so
typed text may not appear in the rendered frame. Only assert text
content in local mode; the crash-safety check still runs in both modes.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The regex was checking for claude-sonnet-4-5 but the source code
uses claude-sonnet-4-6, causing a null match and test failure.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add claude-sonnet-4-6 and claude-opus-4-6 as the new default Sonnet and
Opus models across providers, GUI configs, schemas, cost calculation,
and CLI defaults. Update display names for all >= 4.5 models to use
name-first format (e.g. "Claude Sonnet 4.5" not "Claude 4.5 Sonnet").
Rewrite main, VS Code, and JetBrains READMEs to focus on
source-controlled AI checks enforceable in CI. Add community-maintained
notice to JetBrains plugin with CLI recommendation. Prefix IDE-specific
feature headings with platform names.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>