精选78Claude Agent SDK TypeScript(GitHub Releases)AI 编程与模型
Claude Agent SDK TypeScript v0.3.257:修复MCP配置与浏览器SDK
v0.3.257
What's changed
变更内容
- Added thinkingTokens to ModelUsage (a subset of outputTokens), and fixed result-message usage.output_tokens_details.thinking_tokens reporting 0 instead of the session's real count
- Added tool_use_result.resourceLinks on user messages carrying MCP tool results: the resource_link blocks the tool returned, so hosts can render returned files without parsing the result text
- Added optional resource_links to task_notification for an auto-backgrounded MCP tool call that completed, listing the files it returned by reference; join to the call via tool_use_id
- Fixed mcp_reconnect and mcp_toggle acting on a same-named .mcp.json / ~/.claude.json server instead of the --mcp-config or mcp_set_servers one
- Fixed mcp_toggle disable also removing the tools of a sibling MCP server whose name extends the disabled one's (disabling foo dropped foo__bar's tools)
- Changed mcp_set_servers to also list a server whose connection attempt throws under added (with a failed row in mcp_status), not only under errors
- Changed Agent tool calls to emit the periodic tool_progress heartbeat (heartbeat: true) like other long tools; heartbeat frames never clear a subagent_retry indicator
- Fixed the browser SDK bundle (@anthropic-ai/claude-agent-sdk/browser) never streaming any messages on engines without native Symbol.dispose (Safari/iOS, Firefox ESR, older Chromium)
- Fixed a background Bash task that is still running when a stream-json session ends right after an interrupt (stdin closed) never receiving its final task_notification
- Fixed -p giving up on a long-running background subagent without actually stopping it, so background_tasks_changed kept listing it and events for it arrived after its stopped notification
- Added detail option to Query.getContextUsage(): 'summary' answers from the last response's usage and local estimates without per-category token-count API calls (default 'full')
- Updated to parity with Claude Code v2.1.257
- 向 ModelUsage 添加了 thinkingTokens(outputTokens 的子集),并修复了 result-message 中 output_tokens_details.thinking_tokens 报告为 0 而非会话实际数量的问题。
- 在携带 MCP 工具结果的用户消息上,为 tool_use_result.resourceLinks 添加了资源链接:工具返回的 resource_link 块,使主机无需解析结果文本即可渲染返回的文件。
- 为已完成且自动后台运行的 MCP 工具调用的 task_notification 添加了可选的 resource_links,列出其通过引用返回的文件;通过 tool_use_id 关联到该调用。
- 修复了 mcp_reconnect 和 mcp_toggle 作用于同名 .mcp.json / ~/.claude.json 服务器,而非 --mcp-config 或 mcp_set_servers 指定的服务器的问题。
- 修复了 mcp_toggle disable 同时移除名称是已禁用服务器名称前缀的兄弟 MCP 服务器工具的问题(禁用 foo 会移除 foo__bar 的工具)。
- 更改 mcp_set_servers 以在添加项下也列出连接尝试抛出异常的服务器(在 mcp_status 中显示为失败行),而不仅是在 errors 下列出。
- 更改 Agent 工具调用以像其他长耗时工具一样发出周期性 tool_progress 心跳(heartbeat: true);心跳帧永远不会清除 subagent_retry 指示器。
- 修复了浏览器 SDK 包 (@anthropic-ai/claude-agent-sdk/browser) 在没有原生 Symbol.dispose 支持的引擎(Safari/iOS、Firefox ESR、旧版 Chromium)上从不流式传输任何消息的问题。
- 修复了在中断(stdin 关闭)后立即结束的 stream-json 会话中仍在运行的后台 Bash 任务从未收到最终 task_notification 的问题。
- 修复了 -p 在未实际停止长时间运行的后台子代理的情况下放弃等待,导致 background_tasks_changed 继续列出它,且在其停止通知之后仍收到相关事件的问题。
- 为 Query.getContextUsage() 添加了 detail 选项:'summary' 仅基于上一次响应的使用情况和本地估算给出答案,无需按类别进行 token-count API 调用(默认为 'full')。
- 更新至与 Claude Code v2.1.257 保持一致。
Update
更新
代码 · 7 行
npm install @anthropic-ai/[email protected]
# or
yarn add @anthropic-ai/[email protected]
# or
pnpm add @anthropic-ai/[email protected]
# or
bun add @anthropic-ai/[email protected]代码 · 7 行
npm install @anthropic-ai/[email protected]
# or
yarn add @anthropic-ai/[email protected]
# or
pnpm add @anthropic-ai/[email protected]
# or
bun add @anthropic-ai/[email protected]更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力