Changes on
14 changes detected
--- a/amazon-bedrock.md
+++ b/amazon-bedrock.md
@@ -146,8 +146,9 @@
export CLAUDE_CODE_USE_BEDROCK=1
export AWS_REGION=us-east-1 # or your preferred region
- # Optional: Override the region for the small/fast model (Haiku).
- # Also applies to Bedrock Mantle.
+ # Optional: Override the AWS region for the small/fast model (Bedrock and Mantle).
+ # On Bedrock, has no effect without ANTHROPIC_DEFAULT_HAIKU_MODEL
+ # or the deprecated ANTHROPIC_SMALL_FAST_MODEL set.
export ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION=us-west-2
# Optional: Override the Bedrock endpoint URL for custom endpoints or gateways
@@ -178,9 +179,9 @@
Model type| Default value
---|---
Primary model| `us.anthropic.claude-sonnet-4-5-20250929-v1:0`
-Small/fast model| `us.anthropic.claude-haiku-4-5-20251001-v1:0`
-
-To customize models further, use one of these methods:
+Small/fast model| Same as primary model
+
+Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Bedrock, Claude Code defaults this to the primary model because Haiku may not be enabled in every account or region. To use Haiku for background tasks, set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a model ID that is available in your account. To customize models further, use one of these methods:
# Using inference profile ID
export ANTHROPIC_MODEL='us.anthropic.claude-sonnet-4-6'
--- a/changelog.md
+++ b/changelog.md
@@ -5,6 +5,46 @@
> Use this file to discover all available pages before exploring further.
This page is generated from the [CHANGELOG.md on GitHub](<https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md>). Run `claude --version` to check your installed version.
+
+
+
+2.1.143
+
+May 15, 2026
+
+ * Added plugin dependency enforcement: `claude plugin disable` now refuses when another enabled plugin depends on the target (with a copy-pasteable disable-chain hint), and `claude plugin enable` force-enables transitive dependencies
+ * Added projected context cost (per-turn and per-invocation token estimates) to the `/plugin` marketplace browse pane
+ * Added `worktree.bgIsolation: "none"` setting to let background sessions edit the working copy directly without `EnterWorktree`, for repos where worktrees are impractical
+ * PowerShell tool now passes `-ExecutionPolicy Bypass`. Opt out with `CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY=1`
+ * Background sessions now preserve the model and effort level you set after waking from idle
+ * Shift+Tab in attached agent sessions now includes auto mode in the cycle
+ * Fixed a corrupt `.credentials.json` with a non-array `scopes` value hanging the CLI on startup or silently aborting OAuth token refresh
+ * Fixed right-click paste in `claude agents` on Windows Terminal and WSL
+ * Fixed stop hooks that block repeatedly looping forever — the turn now ends with a warning after 8 consecutive blocks (override via `CLAUDE_CODE_STOP_HOOK_BLOCK_CAP`)
+ * Fixed Esc/Ctrl+C not cancelling a pending `/loop` wakeup while Claude is idle between iterations
+ * Fixed `/goal` evaluator firing while background shells or delegated subagents are still running
+ * Fixed `NO_COLOR`/`FORCE_COLOR` in settings.json `env` stripping Claude Code’s own UI colors — they now apply to subprocesses only
+ * Fixed agent view spawning repeated PowerShell processes on Windows when listing sessions
+ * Fixed `/bg` without a prompt sending “continue” to the forked session — the fork now waits for input
+ * Fixed `--agent <name>` not finding plugin-contributed agents without the `plugin:` prefix
+ * Fixed deleting a session from agent view not removing its transcript file
+ * Fixed stale-fragment rendering when scrolling in attached background sessions on Windows Terminal
+ * Fixed background agents false-positive worker-stall detection storm after host sleep or macOS App Nap
+ * Fixed 5xx error messages pointing at status.claude.com instead of naming the configured gateway or cloud provider
+ * The PowerShell tool is now enabled by default on Windows for Bedrock, Vertex, and Foundry users. Opt out with `CLAUDE_CODE_USE_POWERSHELL_TOOL=0`.
+ * `claude agents` now accepts `--add-dir`, `--settings`, `--mcp-config`, and `--plugin-dir` and applies them to the dashboard and to background sessions dispatched from it
+ * `claude agents` accepts `--permission-mode`, `--model`, `--effort`, and `--dangerously-skip-permissions` to set defaults for sessions dispatched from the view
+ * `claude --bg --dangerously-skip-permissions` now persists across retire→wake
+ * Fixed background sessions silently capturing IDE file references into the warm spare’s input, which caused the reference to be prepended to the next prompt dispatched from `claude agents`
+ * Worktree cleanup no longer falls back to `rm -rf` when `git worktree remove` fails, preventing loss of gitignored or in-progress files
+ * Fixed background-job sessions on macOS getting “Operation not permitted” errors when reading files under `~/Documents`, `~/Desktop`, or `~/Downloads`, even with Full Disk Access granted.
+ * `/bg` now preserves `--mcp-config`, `--settings`, `--add-dir`, `--plugin-dir`, and `--strict-mcp-config`, so backgrounded sessions keep their MCP servers and settings across respawn.
+ * Background sessions launched from `claude agents` now honor `permissions.defaultMode` from settings.json (was previously overridden to auto mode)
+ * Fixed: on Windows, pressing ← in `claude agents` while a response was streaming could leave the agents list unresponsive to all input
+ * `/bg` and `←`-detach now preserve `--fallback-model`, so backgrounded workers degrade to the fallback model on overload instead of hard-failing.
+ * `/bg` and `←`-detach now preserve `--allow-dangerously-skip-permissions`, so the forked worker keeps bypass-permissions available in its Shift+Tab cycle.
+ * Fixed: background daemon spawn now falls back to the running binary when the `~/.local/bin/claude` launcher is missing or non-executable
+ * Fixed `claude agents --allow-dangerously-skip-permissions` defaulting dispatched sessions to bypass mode instead of making it available in the permission cycle
--- a/claude-directory.md
+++ b/claude-directory.md
@@ -123,6 +123,7 @@
`tasks/`| Per-session task lists written by the task tools
`shell-snapshots/`| Captured shell environment used by the Bash tool. Removed on clean exit. The sweep clears any left after a crash.
`backups/`| Timestamped copies of `~/.claude.json` taken before config migrations
+`feedback-bundles/`| Redacted transcript archives written by `/feedback` on third-party providers, for sending to your Anthropic account team
###
--- a/data-usage.md
+++ b/data-usage.md
@@ -114,7 +114,7 @@
Telemetry services
-Claude Code connects from users’ machines to Anthropic to log operational metrics such as latency, reliability, and usage patterns. This logging does not include any code or file paths. Data is encrypted in transit and at rest. To opt out of telemetry, set the `DISABLE_TELEMETRY` environment variable. Claude Code connects from users’ machines to Sentry for operational error logging. The data is encrypted in transit using TLS and at rest using 256-bit AES encryption. Read more in the [Sentry security documentation](<https://sentry.io/security/>). To opt out of error logging, set the `DISABLE_ERROR_REPORTING` environment variable. When users run the `/feedback` command, a copy of their full conversation history including code is sent to Anthropic. The data is encrypted in transit via TLS. Optionally, a GitHub issue is created in the public repository. To opt out, set the `DISABLE_FEEDBACK_COMMAND` environment variable to `1`.
+Claude Code connects from users’ machines to Anthropic to log operational metrics such as latency, reliability, and usage patterns. This logging does not include any code or file paths. Data is encrypted in transit and at rest. To opt out of telemetry, set the `DISABLE_TELEMETRY` environment variable. Claude Code connects from users’ machines to Sentry for operational error logging. The data is encrypted in transit using TLS and at rest using 256-bit AES encryption. Read more in the [Sentry security documentation](<https://sentry.io/security/>). To opt out of error logging, set the `DISABLE_ERROR_REPORTING` environment variable. When you run the `/feedback` command, a copy of your conversation history including code is sent to Anthropic. Before submitting, you choose how much history to include: the current session only, which is the default, or also other sessions from the same project over the last 24 hours or 7 days. The data is encrypted in transit via TLS. Optionally, a GitHub issue is created in the public repository. To opt out, set the `DISABLE_FEEDBACK_COMMAND` environment variable to `1`. When you use a third-party provider such as Bedrock or Vertex, or have no Anthropic credentials configured, `/feedback` writes the report to a local archive under `~/.claude/feedback-bundles/` instead of sending it to Anthropic. Known API key and token patterns are redacted before the archive is written. Nothing leaves your machine until you send that file to your Anthropic account representative or attach it to a support request.
##
--- a/env-vars.md
+++ b/env-vars.md
@@ -40,7 +40,7 @@
`ANTHROPIC_FOUNDRY_RESOURCE`| Foundry resource name (for example, `my-resource`). Required if `ANTHROPIC_FOUNDRY_BASE_URL` is not set (see [Microsoft Foundry](</docs/en/microsoft-foundry>))
`ANTHROPIC_MODEL`| Name of the model setting to use (see [Model Configuration](</docs/en/model-config#environment-variables>))
`ANTHROPIC_SMALL_FAST_MODEL`| [DEPRECATED] Name of [Haiku-class model for background tasks](</docs/en/costs>)
-`ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION`| Override AWS region for the Haiku-class model when using Bedrock or Bedrock Mantle
+`ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION`| Override AWS region for the Haiku-class model when using Bedrock or Bedrock Mantle. On Bedrock, this only takes effect when `ANTHROPIC_DEFAULT_HAIKU_MODEL` or the deprecated `ANTHROPIC_SMALL_FAST_MODEL` is also set, since Bedrock otherwise uses the primary model for background tasks
`ANTHROPIC_VERTEX_BASE_URL`| Override the Vertex AI endpoint URL. Use for custom Vertex endpoints or when routing through an [LLM gateway](</docs/en/llm-gateway>). See [Google Vertex AI](</docs/en/google-vertex-ai>)
`ANTHROPIC_VERTEX_PROJECT_ID`| GCP project ID for Vertex AI requests. Overridden by `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or the project in your `GOOGLE_APPLICATION_CREDENTIALS` credential file. See [Google Vertex AI](</docs/en/google-vertex-ai>)
`ANTHROPIC_WORKSPACE_ID`| Workspace ID for [workload identity federation](<https://platform.claude.com/docs/en/manage-claude/workload-identity-federation>). Set this when your federation rule is scoped to more than one workspace so the token exchange knows which workspace to target
@@ -208,7 +208,7 @@
`ENABLE_CLAUDEAI_MCP_SERVERS`| Set to `false` to disable [claude.ai MCP servers](</docs/en/mcp#use-mcp-servers-from-claude-ai>) in Claude Code. Enabled by default for logged-in users
`ENABLE_PROMPT_CACHING_1H`| Set to `1` to request a 1-hour prompt cache TTL instead of the default 5 minutes. Intended for API key, [Bedrock](</docs/en/amazon-bedrock>), [Vertex](</docs/en/google-vertex-ai>), [Foundry](</docs/en/microsoft-foundry>), and [Claude Platform on AWS](</docs/en/claude-platform-on-aws>) users. Subscription users receive 1-hour TTL automatically. 1-hour cache writes are billed at a higher rate
`ENABLE_PROMPT_CACHING_1H_BEDROCK`| Deprecated. Use `ENABLE_PROMPT_CACHING_1H` instead
-`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Vertex AI or when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer and send the beta header, requests fail on Vertex AI or proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront)
+`ENABLE_TOOL_SEARCH`| Controls [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>). Unset: all MCP tools deferred by default, but loaded upfront on Vertex AI or when `ANTHROPIC_BASE_URL` points to a non-first-party host. Values: `true` (always defer and send the beta header; supported on Vertex AI with Sonnet 4.5 and later or Opus 4.5 and later; requests fail on earlier Vertex AI models or on proxies that do not support `tool_reference`), `auto` (threshold mode: load upfront if tools fit within 10% of context), `auto:N` (custom threshold, e.g., `auto:5` for 5%), `false` (load all upfront)
`FALLBACK_FOR_ALL_PRIMARY_MODELS`| Set to any non-empty value to trigger fallback to [`--fallback-model`](</docs/en/cli-reference#cli-flags>) after repeated overload errors on any primary model. By default, only Opus models trigger the fallback
`FORCE_AUTOUPDATE_PLUGINS`| Set to `1` to force plugin auto-updates even when the main auto-updater is disabled via `DISABLE_AUTOUPDATER`
`FORCE_PROMPT_CACHING_5M`| Set to `1` to force the 5-minute prompt cache TTL even when 1-hour TTL would otherwise apply. Overrides `ENABLE_PROMPT_CACHING_1H`
--- a/errors.md
+++ b/errors.md
@@ -85,7 +85,7 @@
* Check [status.claude.com](<https://status.claude.com>) for active incidents
* Wait a minute, then send your message again. Your original message is still in the conversation, so for a long prompt you can type `try again` instead of pasting the whole thing.
- * If the error persists with no posted incident, run `/feedback` so Anthropic can investigate with your request details. See Report an error if `/feedback` is unavailable on your provider.
+ * If the error persists with no posted incident, run `/feedback` so Anthropic can investigate with your request details. See Report an error if `/feedback` is unavailable in your environment.
###
@@ -618,7 +618,7 @@
* **Context pressure** : run `/context` to see how full the window is. If it is near capacity, run `/compact` at a natural breakpoint or `/clear` to start fresh. See [Explore the context window](</docs/en/context-window>) for how auto-compact affects earlier turns.
* **Stale instructions** : large or outdated `CLAUDE.md` files and MCP tool definitions consume context and can steer responses. `/doctor` flags oversized memory files and subagent definitions; `/context` shows MCP tool token usage.
-When a response goes wrong, rewinding usually works better than replying with corrections. Press Esc twice or run `/rewind` to step back to before the bad turn, then rephrase the prompt with more specifics. Correcting in-thread keeps the wrong attempt in context, which can anchor later answers to it. See [Checkpointing](</docs/en/checkpointing>). If quality still seems off after checking the above, run `/feedback` and describe what you expected versus what you got. Feedback submitted this way includes the conversation transcript, which is the fastest way for Anthropic to diagnose a real regression. See Report an error if `/feedback` is unavailable on your provider.
+When a response goes wrong, rewinding usually works better than replying with corrections. Press Esc twice or run `/rewind` to step back to before the bad turn, then rephrase the prompt with more specifics. Correcting in-thread keeps the wrong attempt in context, which can anchor later answers to it. See [Checkpointing](</docs/en/checkpointing>). If quality still seems off after checking the above, run `/feedback` and describe what you expected versus what you got. Feedback submitted this way includes the conversation transcript, which is the fastest way for Anthropic to diagnose a real regression. See Report an error if `/feedback` is unavailable in your environment.
##
@@ -634,7 +634,7 @@
If an error is not listed here or the suggested fix does not help:
- * Run `/feedback` inside Claude Code to send the transcript and a description to Anthropic. The command also offers to open a prefilled GitHub issue. Feedback is unavailable on Bedrock, Vertex AI, and Foundry deployments.
+ * Run `/feedback` inside Claude Code to send the transcript and a description to Anthropic. The command also offers to open a prefilled GitHub issue. On Bedrock, Vertex AI, Foundry, and other third-party providers, `/feedback` saves a local archive you can send to your Anthropic account representative instead.
* Run `/doctor` to check for local configuration problems
* Check [status.claude.com](<https://status.claude.com>) for active incidents
* Search [existing issues](<https://github.com/anthropics/claude-code/issues>) on GitHub
--- a/google-vertex-ai.md
+++ b/google-vertex-ai.md
@@ -148,7 +148,7 @@
export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5
export VERTEX_REGION_CLAUDE_4_6_SONNET=europe-west1
-Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled by default on Vertex AI because the endpoint does not accept the required beta header. All MCP tool definitions load upfront instead. Setting `ENABLE_TOOL_SEARCH=true` forces Claude Code to send the header anyway, which causes Vertex AI to reject requests.
+Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. Claude Code disables [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) by default on Vertex AI, so MCP tool definitions load upfront. Vertex AI supports tool search for Claude Sonnet 4.5 and later and Claude Opus 4.5 and later. Set `ENABLE_TOOL_SEARCH=true` to enable it on those models. Earlier models on Vertex AI do not accept the required beta header, and requests fail if you enable tool search with them.
###
@@ -169,9 +169,9 @@
Model type| Default value
---|---
Primary model| `claude-sonnet-4-5@20250929`
-Small/fast model| `claude-haiku-4-5@20251001`
-
-To customize models further:
+Small/fast model| Same as primary model
+
+Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Vertex AI, Claude Code defaults this to the primary model because Haiku may not be enabled in every project or region. To use Haiku for background tasks, set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a model ID that is available in your project. To customize models further:
export ANTHROPIC_MODEL='claude-opus-4-7'
export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001'
--- a/mcp.md
+++ b/mcp.md
@@ -924,14 +924,14 @@
Configure tool search
-Tool search is enabled by default: MCP tools are deferred and discovered on demand. It is disabled by default on Vertex AI, which does not accept the tool search beta header, and when `ANTHROPIC_BASE_URL` points to a non-first-party host, since most proxies do not forward `tool_reference` blocks. If your proxy forwards `tool_reference` blocks, set `ENABLE_TOOL_SEARCH` explicitly to override the fallback. This feature requires models that support `tool_reference` blocks: Sonnet 4 and later, or Opus 4 and later. Haiku models do not support tool search. Control tool search behavior with the `ENABLE_TOOL_SEARCH` environment variable:
+Tool search is enabled by default: MCP tools are deferred and discovered on demand. Claude Code disables it by default on Vertex AI. It is also disabled when `ANTHROPIC_BASE_URL` points to a non-first-party host, since most proxies do not forward `tool_reference` blocks. Set `ENABLE_TOOL_SEARCH` explicitly to override either fallback. Tool search requires a model that supports `tool_reference` blocks: Sonnet 4 and later, or Opus 4 and later. Haiku models do not support it. On Vertex AI, tool search is supported for Claude Sonnet 4.5 and later and Claude Opus 4.5 and later. Control tool search behavior with the `ENABLE_TOOL_SEARCH` environment variable:
Value| Behavior
---|---
(unset)| All MCP tools deferred and loaded on demand. Falls back to loading upfront on Vertex AI or when `ANTHROPIC_BASE_URL` is a non-first-party host
-`true`| All MCP tools deferred. Claude Code sends the beta header even on Vertex AI and through proxies. Requests fail if the backend does not support `tool_reference` blocks
+`true`| All MCP tools deferred. Claude Code sends the beta header even on Vertex AI and through proxies. Requests fail on Vertex AI models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that do not support `tool_reference` blocks
`auto`| Threshold mode: tools load upfront if they fit within 10% of the context window, deferred otherwise
-`auto:<N>`| Threshold mode with a custom percentage, where `<N>` is 0-100 (e.g., `auto:5` for 5%)
+`auto:N`| Threshold mode with a custom percentage, where `N` is 0-100. For example, `auto:5` for 5%
`false`| All MCP tools loaded upfront, no deferral
# Use a custom 5% threshold
--- a/microsoft-foundry.md
+++ b/microsoft-foundry.md
@@ -90,7 +90,7 @@
export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-4-6'
export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5'
-For current and legacy model IDs, see [Models overview](<https://platform.claude.com/docs/en/about-claude/models/overview>). See [Model configuration](</docs/en/model-config#pin-models-for-third-party-deployments>) for the full list of environment variables. [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is enabled automatically. To request a 1-hour cache TTL instead of the 5-minute default, set the following variable; cache writes with a 1-hour TTL are billed at a higher rate:
+Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Foundry, Claude Code defaults this to the primary model because not every account has a Haiku deployment. To use Haiku for background tasks, set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a Haiku deployment that is available in your account, as shown above. For current and legacy model IDs, see [Models overview](<https://platform.claude.com/docs/en/about-claude/models/overview>). See [Model configuration](</docs/en/model-config#pin-models-for-third-party-deployments>) for the full list of environment variables. [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is enabled automatically. To request a 1-hour cache TTL instead of the 5-minute default, set the following variable; cache writes with a 1-hour TTL are billed at a higher rate:
export ENABLE_PROMPT_CACHING_1H=1
--- a/slash-commands.md
+++ b/slash-commands.md
@@ -49,7 +49,7 @@
prompt: "/compact",
options: { maxTurns: 1 }
})) {
- if (message.type === "result") {
+ if (message.type === "result" && message.subtype === "success") {
console.log("Command executed:", message.result);
}
}
@@ -231,7 +231,7 @@
options: { maxTurns: 5 }
})) {
// Command will process with $1="123" and $2="high"
- if (message.type === "result") {
+ if (message.type === "result" && message.subtype === "success") {
console.log("Issue fixed:", message.result);
}
}
--- a/streaming-vs-single-mode.md
+++ b/streaming-vs-single-mode.md
@@ -71,17 +71,18 @@
Python
- import { query } from "@anthropic-ai/claude-agent-sdk";
+ import { query, type SDKUserMessage } from "@anthropic-ai/claude-agent-sdk";
import { readFile } from "fs/promises";
- async function* generateMessages() {
+ async function* generateMessages(): AsyncGenerator<SDKUserMessage> {
// First message
yield {
- type: "user" as const,
+ type: "user",
message: {
- role: "user" as const,
+ role: "user",
content: "Analyze this codebase for security issues"
- }
+ },
+ parent_tool_use_id: null
};
// Wait for conditions or user input
@@ -89,9 +90,9 @@
// Follow-up with image
yield {
- type: "user" as const,
+ type: "user",
message: {
- role: "user" as const,
+ role: "user",
content: [
{
type: "text",
@@ -106,7 +107,8 @@
}
}
]
- }
+ },
+ parent_tool_use_id: null
};
}
@@ -118,7 +120,7 @@
allowedTools: ["Read", "Grep"]
}
})) {
- if (message.type === "result") {
+ if (message.type === "result" && message.subtype === "success") {
console.log(message.result);
}
}
@@ -177,7 +179,7 @@
allowedTools: ["Read", "Grep"]
}
})) {
- if (message.type === "result") {
+ if (message.type === "result" && message.subtype === "success") {
console.log(message.result);
}
}
@@ -190,7 +192,7 @@
maxTurns: 1
}
})) {
- if (message.type === "result") {
+ if (message.type === "result" && message.subtype === "success") {
console.log(message.result);
}
}
--- a/subagents.md
+++ b/subagents.md
@@ -265,7 +265,7 @@
TypeScript
import asyncio
- from claude_agent_sdk import query, ClaudeAgentOptions, AgentDefinition
+ from claude_agent_sdk import query, ClaudeAgentOptions, AgentDefinition, ToolUseBlock
async def main():
async for message in query(
@@ -285,7 +285,7 @@
# versions emitted "Task", current versions emit "Agent".
if hasattr(message, "content") and message.content:
for block in message.content:
- if getattr(block, "type", None) == "tool_use" and block.name in (
+ if isinstance(block, ToolUseBlock) and block.name in (
"Task",
"Agent",
):
@@ -325,7 +325,7 @@
// Helper to extract agentId from message content
// Stringify to avoid traversing different block types (TextBlock, ToolResultBlock, etc.)
function extractAgentId(message: SDKMessage): string | undefined {
- if (!("message" in message)) return undefined;
+ if (message.type !== "assistant" && message.type !== "user") return undefined;
// Stringify the content so we can search it without traversing nested blocks
const content = JSON.stringify(message.message.content);
const match = content.match(/agentId:\s*([a-f0-9-]+)/);
--- a/tool-search.md
+++ b/tool-search.md
@@ -27,12 +27,12 @@
Configure tool search
-Tool search is on by default. It is disabled by default on Vertex AI, which does not accept the tool search beta header, and when `ANTHROPIC_BASE_URL` points to a non-first-party host, since most proxies do not forward `tool_reference` blocks. You can override this with the `ENABLE_TOOL_SEARCH` environment variable:
+Tool search is on by default. It is disabled by default on Vertex AI, where it is supported for Claude Sonnet 4.5 and later and Claude Opus 4.5 and later. It is also disabled when `ANTHROPIC_BASE_URL` points to a non-first-party host, since most proxies do not forward `tool_reference` blocks. You can override either default with the `ENABLE_TOOL_SEARCH` environment variable:
Value| Behavior
---|---
(unset)| Tool search is on. Tool definitions are deferred and discovered on demand. Falls back to loading upfront on Vertex AI or a non-first-party `ANTHROPIC_BASE_URL`.
-`true`| Tool search is always on. The SDK sends the beta header even on Vertex AI and through proxies. Requests fail if the backend or proxy does not support `tool_reference` blocks.
+`true`| Tool search is always on. The SDK sends the beta header even on Vertex AI and through proxies. Requests fail on Vertex AI models earlier than Sonnet 4.5 or Opus 4.5, or on proxies that do not support `tool_reference` blocks.
`auto`| Checks the combined token count of all tool definitions against the model’s context window. If they exceed 10%, tool search activates. If they’re under 10%, all tools are loaded into context normally.
`auto:N`| Same as `auto` with a custom percentage. `auto:5` activates when tool definitions exceed 5% of the context window. Lower values activate sooner.
`false`| Tool search is off. All tool definitions are loaded into context on every turn.
--- a/typescript.md
+++ b/typescript.md
@@ -1087,7 +1087,7 @@
type SDKUserMessage = {
type: "user";
uuid?: UUID;
- session_id: string;
+ session_id?: string;
message: MessageParam; // From Anthropic SDK
parent_tool_use_id: string | null;
isSynthetic?: boolean;