claude-code-best/src/services
IronRookieCoder a8c8c533d0 fix(builtin-tools): handle undefined message_ids in SnipTool.call()
## Bug 详情
调用 Snip 工具时,若模型通过 ExecuteExtraTool 传入空 params,
SnipTool.call() 中访问 input.message_ids.length 会抛出
`Cannot read properties of undefined (reading 'length')`。

## 根因
Snip 是延迟工具(非 CORE_TOOLS),需通过 ExecuteExtraTool 间接调用。
ExecuteExtraTool 将 params 直接透传给目标工具,不做 Zod schema 验证。
当 params 为空对象 {} 时,input.message_ids 为 undefined。

## 修复方案
在 SnipTool.call() 中使用 optional chaining 安全访问 message_ids。

## 变更要点
- packages/builtin-tools/src/tools/SnipTool/SnipTool.ts: 防御性处理空 message_ids
- src/costrict/provider/auth.ts: 删除 unreachable continue(lint 自动修复)
- src/services/rawDump/worker.ts: Math.pow → **(lint 自动修复)

## 自测
- 已人工验证

Co-Authored-By: Auto <noreply@anthropic.com>
2026-05-14 15:47:35 +08:00
..
acp docs: 添加 ToolSearch 设计指南 + 禁用 turn-zero 工具推荐弹窗 2026-05-09 16:45:56 +08:00
AgentSummary style: 完成所有文件的lint 2026-05-01 21:39:30 +08:00
analytics style: 完成所有文件的lint 2026-05-01 21:39:30 +08:00
api chore: 合并社区 upstream/main 代码至 v2.4.2 2026-05-12 11:55:04 +08:00
auth fix: 修复 Bun mock.module 跨文件污染导致 87 个测试失败 2026-05-11 08:50:03 +08:00
autoDream feat: 工具层及 mcp 大重构 (#252) 2026-04-13 09:52:05 +08:00
compact feat(compact): add CoStrict model support and prevent infinite compaction loops 2026-05-12 20:07:24 +08:00
contextCollapse style: 完成所有文件的lint 2026-05-01 21:39:30 +08:00
extractMemories chore: 清理 src 下 113 项未使用导入和死代码 2026-05-05 20:05:15 +08:00
langfuse feat: 添加 Provider Registry、StatusLine、Cache Stats 和其他增强 2026-05-09 23:04:35 +08:00
localVault fix: 修复 Bun mock.module 跨文件污染导致 87 个测试失败 2026-05-11 08:50:03 +08:00
lsp chore: 合并社区 upstream/main 代码至 v2.4.2 2026-05-12 11:55:04 +08:00
MagicDocs feat: 添加 Provider Registry、StatusLine、Cache Stats 和其他增强 2026-05-09 23:04:35 +08:00
mcp chore: 合并社区 upstream/main 代码至 v2.4.2 2026-05-12 11:55:04 +08:00
oauth style: 完成所有文件的lint 2026-05-01 21:39:30 +08:00
plugins fix: resolve dependency audit findings precisely (#361) 2026-04-26 19:49:54 +08:00
policyLimits feat: build 2026-03-31 19:22:47 +08:00
PromptSuggestion docs: 添加 ToolSearch 设计指南 + 禁用 turn-zero 工具推荐弹窗 2026-05-09 16:45:56 +08:00
providerRegistry feat: 添加 Provider Registry、StatusLine、Cache Stats 和其他增强 2026-05-09 23:04:35 +08:00
providerUsage feat: 添加 provider usage 统计与余额查询 2026-04-22 22:38:09 +08:00
rawDump fix(builtin-tools): handle undefined message_ids in SnipTool.call() 2026-05-14 15:47:35 +08:00
remoteManagedSettings chore: 清理 src 下 113 项未使用导入和死代码 2026-05-05 20:05:15 +08:00
searchExtraTools fix: 修复 prefetch 测试 — turn-zero 推荐已禁用,测试期望值同步更新 2026-05-09 17:02:40 +08:00
SessionMemory feat: 添加 Session Memory 多存储支持 2026-05-09 23:04:09 +08:00
sessionTranscript style: 完成所有文件的lint 2026-05-01 21:39:30 +08:00
settingsSync feat: build 2026-03-31 19:22:47 +08:00
skillLearning chore: 清理 src 下 113 项未使用导入和死代码 2026-05-05 20:05:15 +08:00
skillSearch feat: 实现 Tool Search 基础设施层(CORE_TOOLS 白名单 + TF-IDF 索引 + ExecuteTool + 搜索增强) 2026-05-08 22:29:15 +08:00
teamMemorySync refactor: replace "Claude's" with "CoStrict's" in user-facing copy 2026-04-10 15:35:08 +08:00
tips chore: 合并社区 upstream/main 代码至 v2.4.2 2026-05-12 11:55:04 +08:00
tools docs: 添加 ToolSearch 设计指南 + 禁用 turn-zero 工具推荐弹窗 2026-05-09 16:45:56 +08:00
toolUseSummary style: 完成所有文件的lint 2026-05-01 21:39:30 +08:00
awaySummary.ts feat: 增强 auto mode 的易用性 (#312) 2026-04-20 21:13:09 +08:00
claudeAiLimits.ts feat: 添加 Bedrock API 客户端及 API 层增强 2026-04-22 22:38:09 +08:00
claudeAiLimitsHook.ts feat: build 2026-03-31 19:22:47 +08:00
diagnosticTracking.ts feat: build 2026-03-31 19:22:47 +08:00
doubaoSTT.ts chore: 清理 src 下 113 项未使用导入和死代码 2026-05-05 20:05:15 +08:00
internalLogging.ts feat: build 2026-03-31 19:22:47 +08:00
mcpServerApproval.tsx chore: 清理 src 下 113 项未使用导入和死代码 2026-05-05 20:05:15 +08:00
mockRateLimits.ts feat: build 2026-03-31 19:22:47 +08:00
notifier.ts chore: 合并社区 upstream/main 代码至 v2.4.2 2026-05-12 11:55:04 +08:00
preventSleep.ts feat: build 2026-03-31 19:22:47 +08:00
rateLimitMessages.ts rebrand: 将 Claude Code 品牌改为 CoStrict 2026-04-09 17:14:39 +08:00
rateLimitMocking.ts feat: build 2026-03-31 19:22:47 +08:00
tokenEstimation.ts chore: 合并社区 upstream/main 代码至 v2.4.2 2026-05-12 11:55:04 +08:00
vcr.ts style: 完成所有文件的lint 2026-05-01 21:39:30 +08:00
voice.ts rebrand: 将 Claude Code 品牌改为 CoStrict 2026-04-09 17:14:39 +08:00
voiceKeyterms.ts feat: build 2026-03-31 19:22:47 +08:00
voiceStreamSTT.ts feat: build 2026-03-31 19:22:47 +08:00