♻️ refactor(sdk): 简化批——token 估算口径统一、五组重复实现收敛单源 (#389) - #481
Merged
Conversation
estimateToolSchemaTokens 只算 name+description 系统性偏低,改委托 getDeferredToolTokenCount(含 inputSchema、原生计数);getContextUsage 内联 reduce 与 systemTools/deferredBuiltinTools 明细三处同病灶一并统一,estimateToolTokens 单工具口径导出复用。retry 错误分类三元链流式/非流式两份提取 classifyRetryError 共用,api_retry 事件 phase 差异保留。新增 inputSchema 口径测试。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
session/notebook-edit 直接删本地副本改 import;file-checkpoints 保留 mkdir -p 前置于调用点;公共签名 content 扩 string | Uint8Array。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
全局单例函数组与 SkillRegistry 类平行维护两套注册/别名/归一化逻辑,收敛为委托 globalRegistry 实例;overwrite 警告(含大小写碰撞)与 unregister 语义保留,导出面不变。新增单轨回归测试。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
agent.ts 与 session.ts 两份逐字符相同副本合一,保留可选参数守卫超集版导出,依赖方向无环。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CavinHuang
pushed a commit
that referenced
this pull request
Aug 23, 2026
This was referenced Aug 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #389
已修 7 项
string | Uint8Array。随既有 PR 消失 3 项
不在本批范围 2 项(#388 认领域)
核实为零改动 1 项
| string吸收字面量:原 stopReason 命中点随 🔥 移除 SDK 内置 LLM providers,统一宿主注入契约 #283 消失;现存命中均为设计内开放值域(runtime-event trigger/callerKind 反序列化兜底、threadType 含 "main"、chatType 含 IM 渠道值),收窄会破编译与 IM 渠道,其余为函数返回类型或外部 API 解析联合,非污染。留评估 1 项(详见 issue 评论)
验证
bun run typecheck六包(shared/ui/sdk/sidecar/web/desktop)全绿🤖 Generated with Claude Code