feat: 兼容 PTC 模式 diff 展示 - #2
Merged
Merged
Conversation
- 通过 callId 中的 :code: 标记识别 run_code 子调用 - 从 argsRaw 动态构建 edit/write 的 diff - 修复中文括号、更新注释为中文、版本升至 0.2.0
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.
概述
兼容 PTC 模式下 edit/write 工具卡片的 diff 展示。
背景
DSH 的 PTC 模式通过
run_code执行程序,程序内部调用tools.edit()/tools.write()。这些子调用记录为tool/code-dispatch事件,前端渲染时block.parentCallId未被设置,导致原有 PTC 检测条件失效,diff 不显示。修复
block.parentCallId !== undefined改为block.callId.includes(':code:'),可靠识别run_code子调用argsRaw中提取old_string/new_string或content,动态构建 diffwrite是全文件覆写,无旧内容,只能显示全新增;精确 diff 应使用edit改动文件
lib/client.jsextractDiffs新增 PTC 分支,头部注释中文化lib/index.jsREADME.mdpackage.json.github/workflows/ci.yml.github/workflows/release.yml测试