feat: 新增第 8 个内置 tab「文件追踪」——移植 dsh-file-trace 插件

- 数据层:直接折叠会话事件日志(tool/call + tool/result 对)提取文件操作,
  与仓库「读事件日志而非动注册表」的取向一致;含错误文本捕获与
  running 态实时更新(ctx.on('session/event'),不可见时暂停、恢复时追平)
- 视图:操作列表 + 底部可拖拽 diff 面板;行级 diff(删红/增绿/改蓝)+
  行内字符级高亮;读取视图带真实行号;失败操作统一展示真实错误文本
- 语法着色:轻量分词器(关键字/字符串/数字/类型/函数/注释/预处理),
  色相经 color-mix 落在 diff 三色之间的空档;跨行块注释状态按行序推导
- 单实例 tab,+ 菜单 order 55,角标显示操作数;设置页可整体关闭
  (与独立维护的 dsh-file-trace 插件共存)
- i18n:10 个新 key 同步全部 21 个词典;builtins 测试 7→8;
  README/指南内置清单同步
This commit is contained in:
lhh010
2026-08-30 20:59:50 +08:00
parent 3aab7ca3a5
commit 02d3936b92
31 changed files with 1658 additions and 15 deletions
+12 -3
View File
@@ -1,5 +1,5 @@
/**
* Built-in registration tests: the plugin registers 7 tabs and 6 file
* Built-in registration tests: the plugin registers 8 tabs and 6 file
* viewers through the same service external plugins use (dogfooding);
* the catch-all `code` viewer, the NUL-sniffing `binary-download` viewer,
* and the html sandbox settings pin the registry's behavior. (Office
@@ -27,13 +27,22 @@ function setup(options: BuiltinTabOptions = {}): { service: ReturnType<typeof cr
}
describe('built-in tab registrations', () => {
it('registers the 7 built-in tabs', () => {
it('registers the 8 built-in tabs', () => {
const { service } = setup()
expect(service.getTabs().map(t => t.id).sort()).toEqual(
['browser', 'diff', 'editor', 'git', 'sidechat', 'subagent', 'terminal'],
['browser', 'diff', 'editor', 'file-trace', 'git', 'sidechat', 'subagent', 'terminal'],
)
})
it('the file-trace tab is a single-instance badge-carrying visible tab', () => {
const { service } = setup()
const trace = service.getTab('file-trace')
expect(trace?.single).toBe(true)
expect(trace?.hidden).not.toBe(true)
expect(trace?.badge).toBeDefined()
expect(trace?.component).toBeDefined()
})
it('only diff is hidden from the + menu; editor is the visible files window (order 10)', () => {
const { service } = setup()
expect(service.getTabs().filter(t => t.hidden).map(t => t.id)).toEqual(['diff'])