@tencent-ai/agent-sdk 0.3.164 → 0.3.166

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/cli/CHANGELOG.md +50 -0
  2. package/cli/bin/codebuddy +35 -0
  3. package/cli/dist/codebuddy-headless.js +107 -107
  4. package/cli/dist/web-ui/docs/cn/cli/env-vars.md +2 -1
  5. package/cli/dist/web-ui/docs/cn/cli/release-notes/README.md +7 -0
  6. package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.100.0.md +42 -0
  7. package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.100.1.md +13 -0
  8. package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.100.2.md +18 -0
  9. package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.101.0.md +23 -0
  10. package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.102.0.md +39 -0
  11. package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.103.0.md +37 -0
  12. package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.103.1.md +31 -0
  13. package/cli/dist/web-ui/docs/cn/cli/troubleshooting.md +60 -0
  14. package/cli/dist/web-ui/docs/en/cli/env-vars.md +2 -1
  15. package/cli/dist/web-ui/docs/en/cli/release-notes/README.md +7 -0
  16. package/cli/dist/web-ui/docs/en/cli/release-notes/v2.100.0.md +42 -0
  17. package/cli/dist/web-ui/docs/en/cli/release-notes/v2.100.1.md +13 -0
  18. package/cli/dist/web-ui/docs/en/cli/release-notes/v2.100.2.md +18 -0
  19. package/cli/dist/web-ui/docs/en/cli/release-notes/v2.101.0.md +23 -0
  20. package/cli/dist/web-ui/docs/en/cli/release-notes/v2.102.0.md +39 -0
  21. package/cli/dist/web-ui/docs/en/cli/release-notes/v2.103.0.md +37 -0
  22. package/cli/dist/web-ui/docs/en/cli/release-notes/v2.103.1.md +31 -0
  23. package/cli/dist/web-ui/docs/en/cli/troubleshooting.md +60 -0
  24. package/cli/dist/web-ui/docs/search-index-en.json +1 -1
  25. package/cli/dist/web-ui/docs/search-index-zh.json +1 -1
  26. package/cli/dist/web-ui/docs/sidebar-en.json +1 -1
  27. package/cli/dist/web-ui/docs/sidebar-zh.json +1 -1
  28. package/cli/package.json +1 -1
  29. package/cli/product.cloudhosted.json +120 -25
  30. package/cli/product.internal.json +5 -5
  31. package/cli/product.ioa.json +136 -21
  32. package/cli/product.json +70 -17
  33. package/cli/product.selfhosted.json +3 -2
  34. package/package.json +1 -1
package/cli/CHANGELOG.md CHANGED
@@ -7,6 +7,56 @@ CodeBuddy Code 的所有重要更新都会记录在这里。
7
7
 
8
8
  ## [未发布]
9
9
 
10
+ ## [2.103.1] - 2026-06-04
11
+
12
+ ### 🔧 改进
13
+
14
+ - **模型计费系数更新**:按最新计费策略调整 cli-saas 各部署形态下的默认模型、推理模型、图像模型及多个第三方模型的计费系数。
15
+ - **WorkBuddy 助理对话标识**:当环境变量 `PERSONAL_AGENT_ROLE` 存在时,ChatCompletion 请求的 `X-Agent-Purpose` 头自动设置为 `person_agent`,便于服务端识别来自 WorkBuddy 助理(orchestrator/specialist)的对话。
16
+ - **遥测 flush 配置可调**:新增 `galileo.aggregatorFlushIntervalSec` 配置项(默认 60 秒,范围 [5, 600]),短对话占比高的场景可调低到 10-20 秒。
17
+ - **hook session_id 统一**:新增 `resolveHookSessionId` 工具函数,`SessionHookManager` / `ToolHookManager` 全部 hook payload 切换到该工具,统一父子 session 解析路径。
18
+ - **故障排查文档补充**:新增"更新不到最新版"小节,说明在 npm 镜像缓存延迟场景下,可通过 `--registry=https://registry.npmjs.org/` 指定官方源重试。
19
+
20
+ ### 🐛 修复
21
+
22
+ - **进程退出前丢失监控数据**:放量后 WorkBuddy/IDE 集成场景下,短对话(< 60s 退出)的子进程会随 `process.exit()` 丢弃 aggregator 当前窗口 + OTel BatchProcessor buffer 中的监控数据。新增 `flushTelemetryBeforeExit()` helper 在 8 个进程退出关键点统一 flush metrics + trace + log 三类 buffer,并将 telemetry flush 提到 cleanup 队列最前面以抢占 2s 预算。
23
+ - **遥测 namespace 修正**:修复 Desktop sidecar 进程上报遥测时 namespace 始终为 Production 的问题。改为读取专用环境变量 `WORKBUDDY_NODE_ENV`,按真实运行环境动态判定 Production/Development,避免开发期数据混入正式监控库。
24
+ - **snappy 原生模块打包**:新增 galileo-node-sdk 和 galileo-semantic-conventions 显式依赖,使 rspack 打包时 snappy 原生 `.node` 模块可被正确排除。
25
+ - **历史压缩边界误识别**:修复对话中包含 HTML 折叠块(`<details><summary>...</summary>...</details>`)时,消息会被错误判定为历史压缩边界、进而被排除出真实用户输入的问题。仅保留更明确的边界标记,避免对常见 HTML 标签的通配匹配。
26
+ - **后台任务通知日志清理**:移除后台命令完成通知中遗留的临时排查日志(参数 dump / 历史快照 dump),降低日志噪音并避免敏感字段被打到日志。
27
+ - **IOA endpoint 漂移防御**:`ProductManager` 在并发刷新场景下可能短暂暴露错误的 endpoint,导致 IOA 用户的模型请求落到公共云域名(`codebuddy.ai`)。内部改为事务化更新避免中间态被读取;`ModelProvider` 增加二道防线 —— 当 `CODEBUDDY_INTERNET_ENVIRONMENT=ioa` 但解析后的 `baseURL` 落到公共云域名时打 warn。
28
+ - **sub-agent hook `session_id` 行为对齐**:在 sub-agent 内触发的 hook,其 `session_id` 现指向**主 agent** 的 session id,sub-agent 自身 id 通过 `agent_id` 字段单独暴露。修复前 sub-agent 的 hook 会把自己的 session id 当成主 session 上报,导致下游审计/统计无法跨主 session 聚合。
29
+ - **MCP 禁用持久化**:修复 IDE 插件提供的 MCP 服务通过 `/mcp` 禁用后,重启再次出现的问题。禁用状态现已持久化到本地配置,重启后保持禁用。
30
+
31
+ ### 📝 文档
32
+
33
+ - **CLI 文档归档**:补全 v2.100.0 ~ v2.103.0 共 6 个版本发布说明的英文翻译,更新中英文导航栏;同步更新 env-vars / http-api / troubleshooting / release-notes 索引等文档的中英文版本。
34
+
35
+ ## [2.103.0] - 2026-06-04
36
+
37
+ ### 🎉 新功能
38
+
39
+ - **DeepSeek V4 模型支持**:新增 DeepSeek V4 Pro 和 Flash 两个推理模型,支持 1M 上下文窗口、工具调用和图片理解。
40
+ - **Doctor 诊断面板增强**:新增 Session ID、Trace ID、Request ID 展示,方便问题定位。
41
+
42
+ ### 🔧 改进
43
+
44
+ - **messageErrorCode 对齐**:新版本 CLI 的 chat 遥测事件中 `messageErrorCode` 与旧版数据口径对齐,使用 10 级优先链映射原始错误到 CBC 业务错误码。
45
+ - **调试环境变量标准化**:统一使用 `CODEBUDDY_DEBUG` / `CODEBUDDY_DEBUG_SDK` 替代旧的 `DEBUG` / `DEBUG_SDK`。
46
+ - **Trace ID 持久化**:新增 `lastConversationTraceId` 字段,确保诊断面板在会话跨回合后仍可展示最近的 Trace ID。
47
+ - **模型切换配置**:每个模型独立声明 `relatedModels.lite` / `relatedModels.reasoning`,移除已无法覆盖新模型场景的 `defaultRelatedModels` 全局兜底,确保各模型在 lite / reasoning 切换时的目标模型符合预期。
48
+ - **沙箱审批超时可配置**:新增 `CBC_SANDBOX_APPROVAL_TIMEOUT_MS` 环境变量,便于测试和调试时自定义沙箱权限拦截等待超时时长(默认 120000ms)。
49
+
50
+ ### 🐛 修复
51
+
52
+ - **沙箱超时弹窗未消失**:修复沙箱权限拦截等待超时自动拒绝后,Desktop / Web UI 弹窗未同步消失的问题。现在超时拒绝时会广播 `permissionResolved` 事件,前端收到后正确清除弹窗状态。
53
+ - **遥测请求 ID 一致性**:简化对话请求 ID 的处理逻辑,统一其生成来源,移除冗余的兜底分支,避免影响上报数据的一致性。
54
+ - **思考强度同步性能问题**:修复客户端开会话后渲染层与 CLI 之间形成 ACP 反馈环,导致 `session/set_config_option` 在 1.4 秒内被反复调用 200+ 次、单会话日志爆量到数百 MB 的性能问题。在事件源头按 `(配置项, 值)` 维度去重相邻同值广播,避免任何客户端(含未做幂等去重的旧版本)触发重复推送。
55
+ - **ACP 鉴权恢复**:优化 ACP 掉授权后的异常上报与恢复提示,避免客户端收到不完整错误状态。
56
+ - **Compact 边界消息 replay**:修复 compact 后重启 session 时,边界消息 replay 异常导致前端缺失 compact 分割线、history 误改父子链的问题。compact 边界消息现在会下发带 meta 标记的 `agent_message_chunk` 让前端正确渲染 divider;history 重建仅对可恢复的 compact 消息执行修正,避免对纯边界 user message 误改父链。
57
+ - **路径超链接识别**:在 markdown 输出中主动给 POSIX 路径包 OSC 8 超链接,避免 VS Code / iTerm2 等终端在中英文混排场景把前缀汉字当成 URL 的一部分(例如「根因: /data/foo」误识别为「因: /data/foo」)。Cmd / Ctrl+Click 现在能精确跳到目标文件,并支持 `:line[:col]` 锚点。
58
+ - **Backspace 键兼容**:在 iTerm2 / VS Code 内置终端等会把 ⌫ 发送为 `\x7f` 的环境下,按 Backspace 现在能正常向前删除字符,不再走「向后删除」分支。
59
+
10
60
  ## [2.102.0] - 2026-06-03
11
61
 
12
62
  ### 🎉 新功能
package/cli/bin/codebuddy CHANGED
@@ -49,6 +49,41 @@ if (compareVersions(process.versions.node, minNode) < 0) {
49
49
 
50
50
  require('events').EventEmitter.defaultMaxListeners = 50;
51
51
 
52
+ // Enable V8 compile cache so the large bundle's parse/compile cost (~130ms for the
53
+ // ~16MB TUI bundle) is paid only on the first run. Subsequent starts reuse the cached
54
+ // bytecode, cutting bundle load time by ~37% (measured ~400ms -> ~254ms).
55
+ //
56
+ // `module.enableCompileCache` is available on Node.js >= 22.8.0. On older runtimes the
57
+ // API is absent, so we guard it and silently skip (no extra dependency, no behavior change).
58
+ //
59
+ // Set CODEBUDDY_DISABLE_COMPILE_CACHE=1 to opt out (e.g. for troubleshooting a suspected
60
+ // stale-cache issue, or on read-only filesystems where writing the cache is undesirable).
61
+ if (process.env.CODEBUDDY_DISABLE_COMPILE_CACHE !== '1') {
62
+ try {
63
+ const { enableCompileCache, getCompileCacheDir, constants } = require('module');
64
+
65
+ if (typeof enableCompileCache === 'function') {
66
+ // No directory argument => Node picks a per-user temp location keyed by the
67
+ // module's mtime + Node version, so a stale cache after an upgrade is invalidated.
68
+ const cacheRet = enableCompileCache();
69
+
70
+ if (process.env.CODEBUDDY_COMPILE_CACHE_DEBUG === '1') {
71
+ console.log('compileCacheInfo', cacheRet);
72
+ }
73
+ }
74
+ } catch (_e) {
75
+ // Compile cache is a pure optimization; never let it block startup.
76
+ }
77
+ }
78
+
79
+ // windows数据
80
+ // 之前
81
+ // 8.12s + 8.41s + 8.06s + 8.45s + 8.15s
82
+ // v8cache 热启动
83
+ // 6.97s + 7.32s + 7.14s + 7.15s + 7.34s
84
+ // v8cache 冷启动
85
+ // 10.2s + 9.48s + 8.96s
86
+
52
87
  // Fast path for --version / -v: print version and exit before loading any bundle.
53
88
  // This avoids the full DI container initialization (~150 components), network requests,
54
89
  // and stdin reads that can cause multi-second startup delays on first install.