# 验收指南(PTC diff 卡片) ## 已经装好的测试环境 - profile:`ptcdiff`(`%USERPROFILE%\.dsh\profiles\ptcdiff`),bundles = `@deepseek-ai/dsh-base` + `@deepseek-ai/dsh-web-app` + `dsh-ptc-diff-card` - 服务:`dsh --profile ptcdiff --port 19399 --no-open` - 浏览器入口:启动日志里打印的 `http://127.0.0.1:19399/?token=...`(每次启动 token 会变) 重启服务: ```sh dsh --profile ptcdiff --port 19399 --no-open ``` ## 看什么 ### 1. PTC 模式(核心诉求) 打开侧栏 `dsh-plugins` → `PTC 模式 diff 卡片插件开发`(或 `winia` 的任意 PTC 会话)。 - 每个由 PTC 程序调用的 `edit`/`write` 现在渲染成标准文件卡片: `编辑 winia/src/xxx.rs 1KB +5 -2` / `写入 .refs/foo.mjs 2KB +30 -0` (标题 + 相对路径 + 输入大小 + 增删行数) - 点一下这行 → 展开的就是标准 `DiffBlock` diff 卡片(语言标签、换行/复制按钮、路径行、 绿色新增 / 红色删除、`⋯ 其余 N 行` 折叠)。 旧行为(对照):同一行展开后只有结果文本 `The file ... has been updated successfully`,没有增删统计。 > 历史轮次的工具行收在「运行了代码,…,已写入文件等」这类进程分组里:先点分组标题展开, > 再点卡片行展开 diff。最新一轮默认是展开的。 ### 2. 标准模式(回归) 打开 `any` 工作区的 `你好` 会话(真正的根级 `write`/`edit`)。 - 折叠行文本与官方渲染逐字一致:`写入 write-tool-test.txt 1KB +16 -0` (已在 desktop 官方 profile 用同一会话对照验证) - 展开后同样是 diff 卡片。 ### 3. 失败调用 `winia` 会话里有失败的 `edit`(`old_string matched 4 times`):行首显示「失败」+ 错误首行, 不渲染 diff,展开是原始错误输出 —— 与标准模式一致。 ## 已知边界 - 只接管 `edit` 和 `write`;`str_replace_editor` / `apply_patch` 这类构建里没有的工具不覆盖。 - 样式表是从 ui-tool 0.2.1-rc.3 vendor 的一份拷贝;应用大改版后如需同步外观需重新同步该文件。 - 插件通过 `tool.call.toolview` keyed slot 以 `priority: -1` 覆盖官方行;卸载或停用后自动回到官方渲染。 ## 装到 desktop profile(验收通过后) ```sh # 1) 依赖 dsh plugin --profile desktop add link:D:/dsh-plugins/dsh-ptc-diff-card # 2) 确认 %USERPROFILE%\.dsh\profiles\desktop\package.json 的 dsh.profile.bundles 末尾有 # "dsh-ptc-diff-card" # 3) 重启应用 ```