@deepseek-harness-tui/dsh-tui 0.11.2 → 0.12.0

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 (168) hide show
  1. package/README.md +21 -5
  2. package/bin/dsh-tui.js +30 -3
  3. package/cordis.patch.yml +24 -5
  4. package/guide/dsh-tui-guide/SKILL.md +37 -0
  5. package/guide/dsh-tui-guide/configuration.en.md +410 -0
  6. package/guide/dsh-tui-guide/configuration.md +349 -0
  7. package/guide/dsh-tui-guide/getting-started.en.md +398 -0
  8. package/guide/dsh-tui-guide/getting-started.md +397 -0
  9. package/guide/dsh-tui-guide/interaction.en.md +674 -0
  10. package/guide/dsh-tui-guide/interaction.md +747 -0
  11. package/guide/dsh-tui-guide/migrate.en.md +166 -0
  12. package/guide/dsh-tui-guide/migrate.md +132 -0
  13. package/guide/dsh-tui-guide/plugins.en.md +68 -0
  14. package/guide/dsh-tui-guide/plugins.md +56 -0
  15. package/guide/dsh-tui-guide/themes.en.md +192 -0
  16. package/guide/dsh-tui-guide/themes.md +185 -0
  17. package/guide/dsh-tui-guide/user-guide.en.md +608 -0
  18. package/guide/dsh-tui-guide/user-guide.md +586 -0
  19. package/guide/dsh-tui-guide/vscode.en.md +301 -0
  20. package/guide/dsh-tui-guide/vscode.md +272 -0
  21. package/lib/settings.json +5 -5
  22. package/lib/types/adapter/channel/ui-policy.d.ts +3 -2
  23. package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
  24. package/lib/types/adapter/channel/ui-policy.js +4 -0
  25. package/lib/types/adapter/ports/channel-settings.d.ts +2 -1
  26. package/lib/types/adapter/ports/channel-settings.d.ts.map +1 -1
  27. package/lib/types/adapter/ports/channel-ui.d.ts +29 -2
  28. package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
  29. package/lib/types/adapter/ports/channel-view.d.ts +43 -9
  30. package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
  31. package/lib/types/components/Chat/JobCard.d.ts +9 -0
  32. package/lib/types/components/Chat/JobCard.d.ts.map +1 -1
  33. package/lib/types/components/Chat/JobCard.js +42 -15
  34. package/lib/types/components/Chat/SubagentMessage.js +6 -6
  35. package/lib/types/components/JobsPanel.d.ts.map +1 -1
  36. package/lib/types/components/JobsPanel.js +80 -33
  37. package/lib/types/components/MessageList.js +3 -3
  38. package/lib/types/components/PresetPicker.d.ts +4 -0
  39. package/lib/types/components/PresetPicker.d.ts.map +1 -1
  40. package/lib/types/components/PresetPicker.js +5 -1
  41. package/lib/types/components/PromptInput.d.ts.map +1 -1
  42. package/lib/types/components/PromptInput.js +12 -1
  43. package/lib/types/components/StarPrompt.d.ts +6 -0
  44. package/lib/types/components/StarPrompt.d.ts.map +1 -1
  45. package/lib/types/components/StarPrompt.js +45 -0
  46. package/lib/types/components/SubagentCard.d.ts.map +1 -1
  47. package/lib/types/components/SubagentCard.js +8 -8
  48. package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
  49. package/lib/types/components/SubagentDetailScene.js +108 -10
  50. package/lib/types/components/WhaleGirl.d.ts +6 -0
  51. package/lib/types/components/WhaleGirl.d.ts.map +1 -1
  52. package/lib/types/components/WhaleGirl.js +18 -0
  53. package/lib/types/components/messages/AssistantThinkingMessage.js +4 -4
  54. package/lib/types/components/trajectory/MiniWake.d.ts +11 -1
  55. package/lib/types/components/trajectory/MiniWake.d.ts.map +1 -1
  56. package/lib/types/components/trajectory/MiniWake.js +9 -3
  57. package/lib/types/dsh-adapter/channel/external-commands.d.ts.map +1 -1
  58. package/lib/types/dsh-adapter/channel/external-commands.js +8 -2
  59. package/lib/types/dsh-adapter/channel/job-projection.d.ts +1 -0
  60. package/lib/types/dsh-adapter/channel/job-projection.d.ts.map +1 -1
  61. package/lib/types/dsh-adapter/channel/job-projection.js +88 -3
  62. package/lib/types/dsh-adapter/channel/mode-actions.d.ts +13 -0
  63. package/lib/types/dsh-adapter/channel/mode-actions.d.ts.map +1 -1
  64. package/lib/types/dsh-adapter/channel/mode-actions.js +48 -7
  65. package/lib/types/dsh-adapter/channel/mode-permission-actions.d.ts.map +1 -1
  66. package/lib/types/dsh-adapter/channel/mode-permission-actions.js +25 -9
  67. package/lib/types/dsh-adapter/channel/preferences.d.ts +1 -1
  68. package/lib/types/dsh-adapter/channel/preferences.d.ts.map +1 -1
  69. package/lib/types/dsh-adapter/channel/preferences.js +17 -7
  70. package/lib/types/dsh-adapter/channel/state.d.ts +4 -2
  71. package/lib/types/dsh-adapter/channel/state.d.ts.map +1 -1
  72. package/lib/types/dsh-adapter/channel/state.js +1 -1
  73. package/lib/types/dsh-adapter/channel/subagent-projection.d.ts.map +1 -1
  74. package/lib/types/dsh-adapter/channel/subagent-projection.js +5 -0
  75. package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
  76. package/lib/types/dsh-adapter/channel.js +16 -1
  77. package/lib/types/dsh-adapter/contract.d.ts +5 -4
  78. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  79. package/lib/types/dsh-adapter/contract.js +9 -3
  80. package/lib/types/dsh-adapter/jobs.d.ts +82 -16
  81. package/lib/types/dsh-adapter/jobs.d.ts.map +1 -1
  82. package/lib/types/dsh-adapter/jobs.js +104 -9
  83. package/lib/types/dsh-adapter/oauth/bonus.d.ts +27 -0
  84. package/lib/types/dsh-adapter/oauth/bonus.d.ts.map +1 -0
  85. package/lib/types/dsh-adapter/oauth/bonus.js +69 -0
  86. package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/command.d.ts +2 -1
  87. package/lib/types/dsh-adapter/oauth/command.d.ts.map +1 -0
  88. package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/command.js +7 -4
  89. package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/credentials.d.ts +13 -10
  90. package/lib/types/dsh-adapter/oauth/credentials.d.ts.map +1 -0
  91. package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/credentials.js +61 -23
  92. package/lib/types/dsh-adapter/oauth/deepseek.d.ts +39 -0
  93. package/lib/types/dsh-adapter/oauth/deepseek.d.ts.map +1 -0
  94. package/lib/types/dsh-adapter/oauth/deepseek.js +189 -0
  95. package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/index.d.ts +24 -16
  96. package/lib/types/dsh-adapter/oauth/index.d.ts.map +1 -0
  97. package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/index.js +34 -20
  98. package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/interaction.d.ts +14 -12
  99. package/lib/types/dsh-adapter/oauth/interaction.d.ts.map +1 -0
  100. package/lib/types/dsh-adapter/oauth/interaction.js +283 -0
  101. package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/opener.d.ts +2 -1
  102. package/lib/types/dsh-adapter/oauth/opener.d.ts.map +1 -0
  103. package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/opener.js +1 -1
  104. package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/pi-ai.d.ts +10 -3
  105. package/lib/types/dsh-adapter/oauth/pi-ai.d.ts.map +1 -0
  106. package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/pi-ai.js +8 -3
  107. package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/profiles.d.ts +6 -3
  108. package/lib/types/dsh-adapter/oauth/profiles.d.ts.map +1 -0
  109. package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/profiles.js +11 -3
  110. package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/service.d.ts +14 -7
  111. package/lib/types/dsh-adapter/oauth/service.d.ts.map +1 -0
  112. package/{node_modules/@deepseek-harness-tui/dsh-auth/lib → lib/types/dsh-adapter/oauth}/service.js +82 -17
  113. package/lib/types/dsh-adapter/plugin.d.ts +8 -1
  114. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  115. package/lib/types/dsh-adapter/plugin.js +72 -12
  116. package/lib/types/dsh-adapter/presets.d.ts +6 -4
  117. package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
  118. package/lib/types/dsh-adapter/presets.js +6 -4
  119. package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -1
  120. package/lib/types/dsh-adapter/providerWizard.js +6 -2
  121. package/lib/types/dsh-adapter/subagents.d.ts +1 -0
  122. package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
  123. package/lib/types/dsh-adapter/subagents.js +10 -1
  124. package/lib/types/i18n.d.ts +174 -18
  125. package/lib/types/i18n.d.ts.map +1 -1
  126. package/lib/types/i18n.js +53 -11
  127. package/lib/types/ink/components/App.d.ts.map +1 -1
  128. package/lib/types/ink/components/App.js +10 -1
  129. package/lib/types/ink/parse-keypress.d.ts +35 -0
  130. package/lib/types/ink/parse-keypress.d.ts.map +1 -1
  131. package/lib/types/ink/parse-keypress.js +611 -83
  132. package/lib/types/ink/terminal-querier.d.ts +25 -0
  133. package/lib/types/ink/terminal-querier.d.ts.map +1 -1
  134. package/lib/types/ink/terminal-querier.js +42 -0
  135. package/lib/types/ink/update-overflow-guard.d.ts +24 -0
  136. package/lib/types/ink/update-overflow-guard.d.ts.map +1 -1
  137. package/lib/types/ink/update-overflow-guard.js +25 -3
  138. package/lib/types/minimalUiMode.d.ts +19 -0
  139. package/lib/types/minimalUiMode.d.ts.map +1 -0
  140. package/lib/types/minimalUiMode.js +23 -0
  141. package/lib/types/oauth.d.ts +5 -10
  142. package/lib/types/oauth.d.ts.map +1 -1
  143. package/lib/types/oauth.js +5 -10
  144. package/lib/types/screens/Chat.d.ts +4 -1
  145. package/lib/types/screens/Chat.d.ts.map +1 -1
  146. package/lib/types/screens/Chat.js +27 -7
  147. package/lib/types/screens/StatusLine.d.ts +4 -0
  148. package/lib/types/screens/StatusLine.d.ts.map +1 -1
  149. package/lib/types/screens/StatusLine.js +12 -12
  150. package/lib/types/settings/definitions.js +4 -4
  151. package/lib/types/tips.d.ts.map +1 -1
  152. package/lib/types/tips.js +10 -4
  153. package/lib/types/update.js +2 -2
  154. package/lib/types/utils/pastedImagePath.d.ts +8 -0
  155. package/lib/types/utils/pastedImagePath.d.ts.map +1 -1
  156. package/lib/types/utils/pastedImagePath.js +29 -5
  157. package/package.json +111 -100
  158. package/presets/liangshen/agent.cordis.yml +4 -1
  159. package/presets/liangshen/preset.yml +1 -1
  160. package/lib/types/minimalMode.d.ts +0 -13
  161. package/lib/types/minimalMode.d.ts.map +0 -1
  162. package/lib/types/minimalMode.js +0 -17
  163. package/node_modules/@deepseek-harness-tui/dsh-auth/LICENSE +0 -21
  164. package/node_modules/@deepseek-harness-tui/dsh-auth/README.md +0 -143
  165. package/node_modules/@deepseek-harness-tui/dsh-auth/cordis.patch.yml +0 -11
  166. package/node_modules/@deepseek-harness-tui/dsh-auth/dsh-plugin.json +0 -44
  167. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/interaction.js +0 -193
  168. package/node_modules/@deepseek-harness-tui/dsh-auth/package.json +0 -69
@@ -0,0 +1,185 @@
1
+ # 主题系统
2
+
3
+ [文档索引](README.md) · [English](themes.en.md)
4
+
5
+ ## 内置主题
6
+
7
+ dsh-TUI 提供三套 Gentle Mist Blue 色板,外加一个 `auto` 伪主题:
8
+
9
+ | 名称 | 用途 |
10
+ | --- | --- |
11
+ | `auto` | 伪主题:跟随系统/终端背景,自动解析为 `light` 或 `dark` |
12
+ | `light` | 白色面板、墨色正文、雾蓝交互色 |
13
+ | `dark` | 深色终端适配,暖灰正文与柔雾蓝强调色 |
14
+ | `dark-ansi` | 只依赖 16 色 ANSI 的兼容回退 |
15
+
16
+ 未明确指定主题时,TUI 通过 OSC 11 查询终端背景,
17
+ 在 `light` 与 `dark` 之间选择;终端不响应时回退到 `dark`。
18
+
19
+ 浅色主题的面板、工具卡和图片预览默认用纯白底色(`#FFFFFF`),
20
+ 图片预览用中性边框。深色主题及强调色保持原样。
21
+ 此设置不修改终端自身的背景色或壁纸。
22
+
23
+ `auto` 把这一次性启动检测变成常驻选择:
24
+
25
+ - 在 `/theme`、`DSH_TUI_THEME`、`~/.dsh-tui/theme.json` 中都是合法值。
26
+ - 选中时立即应用上次检测结果,并在后台重新查询 OSC 11。
27
+ - 跟随系统主题的终端切换深浅色后,再次选择 `auto`(或重启)即可跟上。
28
+ - `/theme status` 显示 `auto` 当前解析到的色板。
29
+ - 解析结果通过 `getTheme('auto')` 对所有消费方生效。
30
+ - 用户自定义主题若命名为 `auto`,会被内置伪主题遮蔽(选择器中不列出)。
31
+
32
+ 选择优先级:
33
+
34
+ ```text
35
+ DSH_TUI_THEME
36
+ > ~/.dsh-tui/theme.json 中的持久化选择
37
+ > OSC 11 背景检测
38
+ > dark 回退
39
+ ```
40
+
41
+ ## 切换主题
42
+
43
+ - `/theme`:打开主题选择器。`auto` 与内置主题在前,
44
+ 静态 JSON 主题和插件主题在后。
45
+ - `/theme <name>`:直接切换静态或运行时插件主题。
46
+ - `/theme status`:显示当前主题与持久化位置。
47
+
48
+ 选择器确认后立即热切换,并把选择写入 `~/.dsh-tui/theme.json`。
49
+ 如果设置了 `DSH_TUI_THEME`,它在下一次启动时仍然优先。
50
+
51
+ ## 自定义主题
52
+
53
+ 在 `~/.dsh-tui/themes/` 下放置 JSON 文件。每个文件定义一个主题,
54
+ 并从一个内置色板开始覆盖:
55
+
56
+ ```json
57
+ {
58
+ "name": "sakura",
59
+ "displayName": "樱花粉",
60
+ "base": "dark",
61
+ "colors": {
62
+ "accent": "#FF9EC7",
63
+ "accentShimmer": "#FFC0D5",
64
+ "activity": "#7DA1DE",
65
+ "activityShimmer": "#ABC2EC",
66
+ "mascotBody": "#D98A63",
67
+ "inputBackground": "#000000",
68
+ "permission": "#FFB3CC",
69
+ "promptBorder": "#B08B99",
70
+ "text": "#E8E6E0",
71
+ "inactive": "#A99BA0",
72
+ "subtle": "#8A7A80",
73
+ "selectionBg": "#5C3A44",
74
+ "success": "#9CC7A8",
75
+ "error": "#E08591",
76
+ "warning": "#E0C08A"
77
+ }
78
+ }
79
+ ```
80
+
81
+ 字段:
82
+
83
+ | 字段 | 必需 | 说明 |
84
+ | --- | --- | --- |
85
+ | `base` | 是 | `light`、`dark` 或 `dark-ansi`,作为未覆盖颜色的来源 |
86
+ | `colors` | 是 | Theme 颜色键的部分覆盖 |
87
+ | `name` | 否 | 主题 ID;缺省使用文件名 |
88
+ | `displayName` | 否 | 选择器显示名称;缺省使用 `name` |
89
+
90
+ 可用颜色键按用途分组:
91
+
92
+ - 品牌/焦点/活动:`accent`、`accentShimmer`、`activity`、`activityShimmer`
93
+ - 品牌/焦点/活动(续):`suggestion`、`remember`
94
+ - 面板/边框:`permission`、`permissionShimmer`、`promptBorder`、`promptBorderShimmer`
95
+ - 面板/边框(续):`bashBorder`、`planMode`、`ide`、`background`
96
+ - 正文:`text`、`inverseText`、`inactive`、`inactiveShimmer`、`subtle`
97
+ - 工具名与状态点:`toolNameMutate`、`toolNameExec`、`toolDotExec`、`toolDotRead`
98
+ - 工具名与状态点(续):`toolDotWrite`、`toolDotWeb`、`toolDotTask`
99
+ - 工具卡衬底:`toolCardBackground`、`toolCardBackgroundDim`
100
+ - 状态:`autoAccept`、`success`、`error`、`warning`、`warningShimmer`、`merged`
101
+ - diff:`diffAdded`、`diffRemoved`、`diffAddedDimmed`、`diffRemovedDimmed`
102
+ - diff(续):`diffAddedWord`、`diffRemovedWord`
103
+ - diff 语法高亮:`syntaxKeyword`、`syntaxString`、`syntaxComment`、`syntaxNumber`
104
+ - diff 语法高亮(续):`syntaxFunction`、`syntaxType`、`syntaxVariable`、`syntaxOperator`
105
+ - diff 语法高亮(续):`syntaxPunctuation`、`syntaxConstant`
106
+ - 徽标/强调:`mascotBody`、`inputBackground`、`professionalBlue`、`chromeYellow`
107
+ - 消息/输入:`userMessageBackground`、`userMessageBackgroundHover`
108
+ - 消息/输入(续):`messageActionsBackground`、`selectionBg`、`bashMessageBackgroundColor`
109
+ - 消息/输入(续):`memoryBackgroundColor`、`rate_limit_fill`、`rate_limit_empty`
110
+ - 消息/输入(续):`fastMode`、`fastModeShimmer`、`userPromptLabel`
111
+ - 子代理消息:`subagentBullet`、`subagentDescription`、`subagentModel`
112
+ - 子代理消息(续):`subagentElapsed`、`subagentToolName`、`subagentStatusRunning`
113
+ - 子代理消息(续):`subagentStatusCompleted`、`subagentStatusFailed`
114
+
115
+ 如果文件声明了 `name`,文件名仍可作为加载别名。完整颜色键见
116
+ [`src/theme.ts`](../src/theme.ts) 中的 `Theme` 类型。
117
+
118
+ ## npm 插件主题
119
+
120
+ npm 插件通过 `tuiThemes` 服务注册运行时主题,不必写入
121
+ `~/.dsh-tui/themes/`。最小示例:
122
+
123
+ ```ts
124
+ import type { Context } from '@deepseek-ai/cordis'
125
+
126
+ export function apply(ctx: Context): void {
127
+ ctx.get('tuiThemes', false)?.register({
128
+ name: 'my-plugin:night',
129
+ base: 'dark',
130
+ colors: { accent: '#88AAFF' },
131
+ }, ctx)
132
+ }
133
+ ```
134
+
135
+ - 使用 `plugin-id:theme-id` 形式的小写安全 ID。
136
+ - `auto`、内置主题名和 `status` 是保留字,不能作为插件主题名。
137
+ - 注册随插件 activation 自动清理,返回的 disposer 可以提前注销。
138
+ - 插件主题出现在 `/theme` 选择器和补全里,名字沿用
139
+ `~/.dsh-tui/theme.json` 持久化。
140
+ - 优先级:内置主题 > 静态 JSON > 同名插件主题。
141
+ - 旧 profile 没有 `tuiThemes` 时插件静默降级,静态主题不受影响。
142
+
143
+ 完整的可覆盖键、旧键映射与注册契约见
144
+ [终端交互生态插件准入与开发指南](https://github.com/T-Auto/dsh-ecosystem-spec/blob/main/docs/plugin-admission-and-development.md)。
145
+
146
+ ## 颜色格式
147
+
148
+ 支持:
149
+
150
+ - `#rgb`
151
+ - `#rrggbb`
152
+ - `#rrggbbaa`
153
+ - `rgb(r,g,b)`
154
+ - `ansi256(n)`
155
+ - `ansi:black`、`ansi:redBright` 等 16 色 ANSI 名称
156
+
157
+ 颜色必须是具体值,不能使用 CSS 变量、渐变或任意 CSS 颜色名。
158
+
159
+ ## 校验与失败策略
160
+
161
+ - 未知 Theme 键:跳过该键并写入警告,其余颜色继续生效。
162
+ - 非法颜色:跳过该值并写入警告。
163
+ - 非法 `base`、损坏的 JSON、非对象 `colors`:跳过整个文件。
164
+ - 环境变量或偏好文件引用不存在的主题:写入警告并继续背景自动检测。
165
+ - 一个坏主题不会阻止 TUI 启动,也不会影响其他主题。
166
+
167
+ 主题名来自用户输入。加载器检查路径是否仍位于主题目录内,防止
168
+ 通过名称跳出 `~/.dsh-tui/themes/`。修改这部分实现时必须保留路径约束。
169
+
170
+ ## 设计建议
171
+
172
+ - 使用颜色键,而不是只替换 `text` 与 `background`。至少检查正文、
173
+ 非活动文字、焦点、选择、成功、警告、错误和 diff 色。
174
+ - 浅色主题应在真正的浅色终端验证;深色主题同理。
175
+ - 检查 16 色、256 色和 truecolor 终端的回退表现。
176
+ - 在窄终端、工具 diff、问卷、多行输入与选区状态下检查对比度。
177
+ - 不要把密钥或其他用户数据写进主题文件;主题只应包含显示元数据和颜色。
178
+
179
+ 开发主题系统时运行:
180
+
181
+ ```sh
182
+ node --import tsx/esm scripts/verify-themes.mjs
183
+ ```
184
+
185
+ 进一步的终端能力与渲染说明见[架构与限制](architecture.md)。