@deepseek-harness-tui/dsh-tui 0.8.8 → 0.9.1

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 (467) hide show
  1. package/README.md +60 -238
  2. package/bin/dsh-tui.js +172 -5
  3. package/cordis.patch.yml +16 -4
  4. package/dsh-ecosystem-spec/protocols/profile-definitions.d.ts +13 -13
  5. package/dsh-ecosystem-spec/protocols/profile-definitions.js +59 -59
  6. package/dsh-ecosystem-spec/protocols/tui-channel-http.d.ts +15 -15
  7. package/dsh-ecosystem-spec/protocols/tui-channel-http.js +32 -32
  8. package/dsh-ecosystem-spec/protocols/tui-channel.d.ts +59 -59
  9. package/dsh-ecosystem-spec/protocols/tui-channel.js +166 -166
  10. package/dsh-ecosystem-spec/protocols/tui-contributions.d.ts +42 -42
  11. package/dsh-ecosystem-spec/protocols/tui-contributions.js +143 -143
  12. package/dsh-ecosystem-spec/registry/README.md +14 -14
  13. package/dsh-ecosystem-spec/registry/host-descriptor.tui.example.json +56 -56
  14. package/dsh-ecosystem-spec/registry/permissions-0.1.json +13 -13
  15. package/dsh-ecosystem-spec/registry/registry-0.15.json +149 -149
  16. package/lib/types/cc/hyperlink.d.ts +7 -1
  17. package/lib/types/cc/hyperlink.d.ts.map +1 -1
  18. package/lib/types/cc/hyperlink.js +3 -2
  19. package/lib/types/cc/markdown.d.ts.map +1 -1
  20. package/lib/types/cc/markdown.js +33 -3
  21. package/lib/types/cc/sessionColors.d.ts +27 -0
  22. package/lib/types/cc/sessionColors.d.ts.map +1 -0
  23. package/lib/types/cc/sessionColors.js +39 -0
  24. package/lib/types/commands.d.ts.map +1 -1
  25. package/lib/types/commands.js +10 -2
  26. package/lib/types/components/ActivityPicker.d.ts +4 -1
  27. package/lib/types/components/ActivityPicker.d.ts.map +1 -1
  28. package/lib/types/components/ActivityPicker.js +2 -2
  29. package/lib/types/components/AutoRecapRow.d.ts +23 -0
  30. package/lib/types/components/AutoRecapRow.d.ts.map +1 -0
  31. package/lib/types/components/AutoRecapRow.js +23 -0
  32. package/lib/types/components/BtwPanel.d.ts.map +1 -1
  33. package/lib/types/components/BtwPanel.js +1 -1
  34. package/lib/types/components/Chat/SubagentMessage.d.ts +2 -1
  35. package/lib/types/components/Chat/SubagentMessage.d.ts.map +1 -1
  36. package/lib/types/components/Chat/SubagentMessage.js +11 -3
  37. package/lib/types/components/ColorPicker.d.ts +17 -0
  38. package/lib/types/components/ColorPicker.d.ts.map +1 -0
  39. package/lib/types/components/ColorPicker.js +20 -0
  40. package/lib/types/components/CommandSuggestions.d.ts +23 -4
  41. package/lib/types/components/CommandSuggestions.d.ts.map +1 -1
  42. package/lib/types/components/CommandSuggestions.js +41 -14
  43. package/lib/types/components/ContextBarView.d.ts +33 -0
  44. package/lib/types/components/ContextBarView.d.ts.map +1 -0
  45. package/lib/types/components/ContextBarView.js +46 -0
  46. package/lib/types/components/EffortInputBorder.d.ts +12 -1
  47. package/lib/types/components/EffortInputBorder.d.ts.map +1 -1
  48. package/lib/types/components/EffortInputBorder.js +22 -5
  49. package/lib/types/components/EffortSlider.d.ts +4 -1
  50. package/lib/types/components/EffortSlider.d.ts.map +1 -1
  51. package/lib/types/components/EffortSlider.js +4 -2
  52. package/lib/types/components/ExtensionDialog.js +6 -2
  53. package/lib/types/components/FileActionsPanel.d.ts +22 -0
  54. package/lib/types/components/FileActionsPanel.d.ts.map +1 -0
  55. package/lib/types/components/FileActionsPanel.js +28 -0
  56. package/lib/types/components/FileSuggestions.d.ts +26 -7
  57. package/lib/types/components/FileSuggestions.d.ts.map +1 -1
  58. package/lib/types/components/FileSuggestions.js +39 -12
  59. package/lib/types/components/GoalTodoPanel.d.ts +26 -2
  60. package/lib/types/components/GoalTodoPanel.d.ts.map +1 -1
  61. package/lib/types/components/GoalTodoPanel.js +86 -17
  62. package/lib/types/components/HelpMenu.d.ts +7 -1
  63. package/lib/types/components/HelpMenu.d.ts.map +1 -1
  64. package/lib/types/components/HelpMenu.js +12 -4
  65. package/lib/types/components/HistorySearchDialog.d.ts +4 -1
  66. package/lib/types/components/HistorySearchDialog.d.ts.map +1 -1
  67. package/lib/types/components/HistorySearchDialog.js +2 -2
  68. package/lib/types/components/LangPicker.d.ts +14 -0
  69. package/lib/types/components/LangPicker.d.ts.map +1 -0
  70. package/lib/types/components/LangPicker.js +17 -0
  71. package/lib/types/components/LoadedContextPanel.d.ts.map +1 -1
  72. package/lib/types/components/LoadedContextPanel.js +3 -1
  73. package/lib/types/components/Markdown.d.ts.map +1 -1
  74. package/lib/types/components/Markdown.js +12 -3
  75. package/lib/types/components/MessageList.d.ts +45 -2
  76. package/lib/types/components/MessageList.d.ts.map +1 -1
  77. package/lib/types/components/MessageList.js +560 -41
  78. package/lib/types/components/ModelPicker.d.ts +27 -2
  79. package/lib/types/components/ModelPicker.d.ts.map +1 -1
  80. package/lib/types/components/ModelPicker.js +26 -6
  81. package/lib/types/components/PermissionsPicker.d.ts +21 -0
  82. package/lib/types/components/PermissionsPicker.d.ts.map +1 -0
  83. package/lib/types/components/PermissionsPicker.js +27 -0
  84. package/lib/types/components/PlanPicker.d.ts +15 -0
  85. package/lib/types/components/PlanPicker.d.ts.map +1 -0
  86. package/lib/types/components/PlanPicker.js +18 -0
  87. package/lib/types/components/PresetPicker.d.ts +4 -1
  88. package/lib/types/components/PresetPicker.d.ts.map +1 -1
  89. package/lib/types/components/PresetPicker.js +2 -2
  90. package/lib/types/components/PromptInput.d.ts +4 -3
  91. package/lib/types/components/PromptInput.d.ts.map +1 -1
  92. package/lib/types/components/PromptInput.js +602 -75
  93. package/lib/types/components/RecapPanel.d.ts +25 -0
  94. package/lib/types/components/RecapPanel.d.ts.map +1 -0
  95. package/lib/types/components/RecapPanel.js +55 -0
  96. package/lib/types/components/RewindPicker.d.ts +12 -1
  97. package/lib/types/components/RewindPicker.d.ts.map +1 -1
  98. package/lib/types/components/RewindPicker.js +6 -4
  99. package/lib/types/components/ScrollbarGutter.d.ts +28 -0
  100. package/lib/types/components/ScrollbarGutter.d.ts.map +1 -0
  101. package/lib/types/components/ScrollbarGutter.js +119 -0
  102. package/lib/types/components/Select.d.ts +8 -1
  103. package/lib/types/components/Select.d.ts.map +1 -1
  104. package/lib/types/components/Select.js +4 -2
  105. package/lib/types/components/SkillsPicker.d.ts +4 -1
  106. package/lib/types/components/SkillsPicker.d.ts.map +1 -1
  107. package/lib/types/components/SkillsPicker.js +2 -2
  108. package/lib/types/components/SubagentCard.d.ts +2 -1
  109. package/lib/types/components/SubagentCard.d.ts.map +1 -1
  110. package/lib/types/components/SubagentCard.js +9 -2
  111. package/lib/types/components/SubagentDashboard.d.ts +4 -0
  112. package/lib/types/components/SubagentDashboard.d.ts.map +1 -1
  113. package/lib/types/components/SubagentDashboard.js +9 -1
  114. package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
  115. package/lib/types/components/SubagentDetailScene.js +5 -4
  116. package/lib/types/components/SuggestionCard.d.ts +65 -0
  117. package/lib/types/components/SuggestionCard.d.ts.map +1 -0
  118. package/lib/types/components/SuggestionCard.js +77 -0
  119. package/lib/types/components/ThemePicker.d.ts +4 -1
  120. package/lib/types/components/ThemePicker.d.ts.map +1 -1
  121. package/lib/types/components/ThemePicker.js +2 -2
  122. package/lib/types/components/ThinkingToggle.d.ts +4 -1
  123. package/lib/types/components/ThinkingToggle.d.ts.map +1 -1
  124. package/lib/types/components/ThinkingToggle.js +2 -2
  125. package/lib/types/components/TimelineRail.d.ts +53 -0
  126. package/lib/types/components/TimelineRail.d.ts.map +1 -0
  127. package/lib/types/components/TimelineRail.js +197 -0
  128. package/lib/types/components/WorkspaceFlowPicker.d.ts +6 -1
  129. package/lib/types/components/WorkspaceFlowPicker.d.ts.map +1 -1
  130. package/lib/types/components/WorkspaceFlowPicker.js +4 -2
  131. package/lib/types/components/WorkspaceMenuPicker.d.ts +19 -0
  132. package/lib/types/components/WorkspaceMenuPicker.d.ts.map +1 -0
  133. package/lib/types/components/WorkspaceMenuPicker.js +19 -0
  134. package/lib/types/components/WorkspacePicker.d.ts +4 -1
  135. package/lib/types/components/WorkspacePicker.d.ts.map +1 -1
  136. package/lib/types/components/WorkspacePicker.js +2 -2
  137. package/lib/types/components/approvals/ApprovalPanel.d.ts.map +1 -1
  138. package/lib/types/components/approvals/ApprovalPanel.js +5 -1
  139. package/lib/types/components/design-system/ListItem.d.ts +8 -1
  140. package/lib/types/components/design-system/ListItem.d.ts.map +1 -1
  141. package/lib/types/components/design-system/ListItem.js +8 -3
  142. package/lib/types/components/design-system/ThemeProvider.d.ts +7 -0
  143. package/lib/types/components/design-system/ThemeProvider.d.ts.map +1 -1
  144. package/lib/types/components/design-system/ThemeProvider.js +2 -1
  145. package/lib/types/components/messages/AssistantTextMessage.d.ts +5 -2
  146. package/lib/types/components/messages/AssistantTextMessage.d.ts.map +1 -1
  147. package/lib/types/components/messages/AssistantTextMessage.js +6 -2
  148. package/lib/types/components/messages/AssistantThinkingMessage.d.ts +2 -1
  149. package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -1
  150. package/lib/types/components/messages/AssistantThinkingMessage.js +10 -4
  151. package/lib/types/components/messages/AssistantToolUseMessage.d.ts +15 -1
  152. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  153. package/lib/types/components/messages/AssistantToolUseMessage.js +37 -7
  154. package/lib/types/components/messages/UserPromptMessage.d.ts +2 -1
  155. package/lib/types/components/messages/UserPromptMessage.d.ts.map +1 -1
  156. package/lib/types/components/questions/AskUserQuestionPanel.d.ts +7 -3
  157. package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
  158. package/lib/types/components/questions/AskUserQuestionPanel.js +75 -11
  159. package/lib/types/components/questions/PlanReviewPanel.d.ts.map +1 -1
  160. package/lib/types/components/questions/PlanReviewPanel.js +13 -2
  161. package/lib/types/components/sessions/SessionListRow.d.ts +4 -1
  162. package/lib/types/components/sessions/SessionListRow.d.ts.map +1 -1
  163. package/lib/types/components/sessions/SessionListRow.js +4 -2
  164. package/lib/types/components/trajectory/HotspotView.d.ts +7 -1
  165. package/lib/types/components/trajectory/HotspotView.d.ts.map +1 -1
  166. package/lib/types/components/trajectory/HotspotView.js +8 -2
  167. package/lib/types/components/trajectory/Ledger.d.ts +9 -1
  168. package/lib/types/components/trajectory/Ledger.d.ts.map +1 -1
  169. package/lib/types/components/trajectory/Ledger.js +23 -5
  170. package/lib/types/components/trajectory/WaveBand.d.ts +10 -1
  171. package/lib/types/components/trajectory/WaveBand.d.ts.map +1 -1
  172. package/lib/types/components/trajectory/WaveBand.js +7 -2
  173. package/lib/types/dsh-adapter/channel.d.ts +117 -7
  174. package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
  175. package/lib/types/dsh-adapter/channel.js +1301 -122
  176. package/lib/types/dsh-adapter/compat/index.d.ts +8 -6
  177. package/lib/types/dsh-adapter/compat/index.d.ts.map +1 -1
  178. package/lib/types/dsh-adapter/compat/index.js +8 -6
  179. package/lib/types/dsh-adapter/compat/sessionLog.d.ts +150 -0
  180. package/lib/types/dsh-adapter/compat/sessionLog.d.ts.map +1 -1
  181. package/lib/types/dsh-adapter/compat/sessionLog.js +518 -41
  182. package/lib/types/dsh-adapter/contract.d.ts +1 -1
  183. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  184. package/lib/types/dsh-adapter/contract.js +1 -0
  185. package/lib/types/dsh-adapter/extension-events.d.ts +1 -1
  186. package/lib/types/dsh-adapter/extension-events.d.ts.map +1 -1
  187. package/lib/types/dsh-adapter/index.d.ts +20 -2
  188. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  189. package/lib/types/dsh-adapter/index.js +9 -1
  190. package/lib/types/dsh-adapter/plugin.d.ts +0 -9
  191. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  192. package/lib/types/dsh-adapter/plugin.js +453 -14
  193. package/lib/types/dsh-adapter/presets.d.ts +18 -0
  194. package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
  195. package/lib/types/dsh-adapter/presets.js +31 -0
  196. package/lib/types/dsh-adapter/providerWizard.d.ts +29 -1
  197. package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -1
  198. package/lib/types/dsh-adapter/providerWizard.js +89 -5
  199. package/lib/types/dsh-adapter/questions.d.ts +19 -2
  200. package/lib/types/dsh-adapter/questions.d.ts.map +1 -1
  201. package/lib/types/dsh-adapter/questions.js +53 -10
  202. package/lib/types/dsh-adapter/recap.d.ts +49 -0
  203. package/lib/types/dsh-adapter/recap.d.ts.map +1 -0
  204. package/lib/types/dsh-adapter/recap.js +121 -0
  205. package/lib/types/dsh-adapter/sessionTree.d.ts +314 -0
  206. package/lib/types/dsh-adapter/sessionTree.d.ts.map +1 -0
  207. package/lib/types/dsh-adapter/sessionTree.js +954 -0
  208. package/lib/types/dsh-adapter/shortcuts.d.ts +15 -44
  209. package/lib/types/dsh-adapter/shortcuts.d.ts.map +1 -1
  210. package/lib/types/dsh-adapter/shortcuts.js +28 -165
  211. package/lib/types/dsh-adapter/types.d.ts +1 -1
  212. package/lib/types/dsh-adapter/types.d.ts.map +1 -1
  213. package/lib/types/herdr.js +1 -1
  214. package/lib/types/i18n.d.ts +770 -181
  215. package/lib/types/i18n.d.ts.map +1 -1
  216. package/lib/types/i18n.js +257 -80
  217. package/lib/types/ink/components/AlternateScreen.d.ts.map +1 -1
  218. package/lib/types/ink/components/AlternateScreen.js +13 -1
  219. package/lib/types/ink/components/App.d.ts +12 -1
  220. package/lib/types/ink/components/App.d.ts.map +1 -1
  221. package/lib/types/ink/components/App.js +101 -4
  222. package/lib/types/ink/components/ClockContext.d.ts.map +1 -1
  223. package/lib/types/ink/components/ClockContext.js +2 -0
  224. package/lib/types/ink/components/ScrollBox.d.ts.map +1 -1
  225. package/lib/types/ink/components/ScrollBox.js +170 -91
  226. package/lib/types/ink/constants.d.ts +9 -0
  227. package/lib/types/ink/constants.d.ts.map +1 -1
  228. package/lib/types/ink/constants.js +9 -0
  229. package/lib/types/ink/events/click-event.d.ts +7 -16
  230. package/lib/types/ink/events/click-event.d.ts.map +1 -1
  231. package/lib/types/ink/events/click-event.js +16 -19
  232. package/lib/types/ink/events/event-handlers.d.ts +11 -1
  233. package/lib/types/ink/events/event-handlers.d.ts.map +1 -1
  234. package/lib/types/ink/events/event-handlers.js +2 -0
  235. package/lib/types/ink/events/input-event.d.ts +9 -0
  236. package/lib/types/ink/events/input-event.d.ts.map +1 -1
  237. package/lib/types/ink/events/input-event.js +4 -0
  238. package/lib/types/ink/events/pointer-event.d.ts +61 -0
  239. package/lib/types/ink/events/pointer-event.d.ts.map +1 -0
  240. package/lib/types/ink/events/pointer-event.js +61 -0
  241. package/lib/types/ink/events/wheel-event.d.ts +17 -0
  242. package/lib/types/ink/events/wheel-event.d.ts.map +1 -0
  243. package/lib/types/ink/events/wheel-event.js +20 -0
  244. package/lib/types/ink/geometry-trace.d.ts +51 -0
  245. package/lib/types/ink/geometry-trace.d.ts.map +1 -0
  246. package/lib/types/ink/geometry-trace.js +83 -0
  247. package/lib/types/ink/hit-test.d.ts +56 -1
  248. package/lib/types/ink/hit-test.d.ts.map +1 -1
  249. package/lib/types/ink/hit-test.js +146 -8
  250. package/lib/types/ink/ink.d.ts +58 -1
  251. package/lib/types/ink/ink.d.ts.map +1 -1
  252. package/lib/types/ink/ink.js +230 -29
  253. package/lib/types/ink/log-update.d.ts.map +1 -1
  254. package/lib/types/ink/log-update.js +21 -0
  255. package/lib/types/ink/node-cache.d.ts +5 -0
  256. package/lib/types/ink/node-cache.d.ts.map +1 -1
  257. package/lib/types/ink/parse-keypress.d.ts +8 -0
  258. package/lib/types/ink/parse-keypress.d.ts.map +1 -1
  259. package/lib/types/ink/parse-keypress.js +101 -12
  260. package/lib/types/ink/render-node-to-output.d.ts +10 -0
  261. package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
  262. package/lib/types/ink/render-node-to-output.js +111 -18
  263. package/lib/types/ink/timeline-rail.d.ts +138 -0
  264. package/lib/types/ink/timeline-rail.d.ts.map +1 -0
  265. package/lib/types/ink/timeline-rail.js +179 -0
  266. package/lib/types/ink/wrap-text.d.ts.map +1 -1
  267. package/lib/types/ink/wrap-text.js +47 -5
  268. package/lib/types/migrationPrefs.d.ts +60 -0
  269. package/lib/types/migrationPrefs.d.ts.map +1 -0
  270. package/lib/types/migrationPrefs.js +97 -0
  271. package/lib/types/modelGroups.d.ts +72 -0
  272. package/lib/types/modelGroups.d.ts.map +1 -0
  273. package/lib/types/modelGroups.js +97 -0
  274. package/lib/types/modelRecents.d.ts +39 -0
  275. package/lib/types/modelRecents.d.ts.map +1 -0
  276. package/lib/types/modelRecents.js +97 -0
  277. package/lib/types/native-ts/yoga-layout/index.d.ts +11 -0
  278. package/lib/types/native-ts/yoga-layout/index.d.ts.map +1 -1
  279. package/lib/types/native-ts/yoga-layout/index.js +31 -1
  280. package/lib/types/oauth.d.ts +15 -0
  281. package/lib/types/oauth.d.ts.map +1 -0
  282. package/lib/types/oauth.js +14 -0
  283. package/lib/types/reload.d.ts +109 -0
  284. package/lib/types/reload.d.ts.map +1 -0
  285. package/lib/types/reload.js +118 -0
  286. package/lib/types/screens/Chat.d.ts +3 -1
  287. package/lib/types/screens/Chat.d.ts.map +1 -1
  288. package/lib/types/screens/Chat.js +1377 -371
  289. package/lib/types/screens/SessionBrowser.d.ts.map +1 -1
  290. package/lib/types/screens/SessionBrowser.js +56 -29
  291. package/lib/types/screens/SessionTree.d.ts +27 -0
  292. package/lib/types/screens/SessionTree.d.ts.map +1 -0
  293. package/lib/types/screens/SessionTree.js +555 -0
  294. package/lib/types/screens/Settings.d.ts.map +1 -1
  295. package/lib/types/screens/Settings.js +64 -22
  296. package/lib/types/screens/StatusLine.d.ts +0 -8
  297. package/lib/types/screens/StatusLine.d.ts.map +1 -1
  298. package/lib/types/screens/StatusLine.js +224 -45
  299. package/lib/types/screens/StatusMetrics.d.ts +35 -3
  300. package/lib/types/screens/StatusMetrics.d.ts.map +1 -1
  301. package/lib/types/screens/StatusMetrics.js +63 -8
  302. package/lib/types/screens/TrajectoryScene.d.ts.map +1 -1
  303. package/lib/types/screens/TrajectoryScene.js +81 -14
  304. package/lib/types/screens/chatOverlay.d.ts +237 -0
  305. package/lib/types/screens/chatOverlay.d.ts.map +1 -0
  306. package/lib/types/screens/chatOverlay.js +116 -0
  307. package/lib/types/tips.d.ts.map +1 -1
  308. package/lib/types/tips.js +64 -10
  309. package/lib/types/tuiDisplayPrefs.d.ts +15 -0
  310. package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
  311. package/lib/types/tuiDisplayPrefs.js +9 -0
  312. package/lib/types/update.d.ts +139 -0
  313. package/lib/types/update.d.ts.map +1 -1
  314. package/lib/types/update.js +382 -30
  315. package/lib/types/utils/debug.d.ts +10 -0
  316. package/lib/types/utils/debug.d.ts.map +1 -1
  317. package/lib/types/utils/debug.js +24 -0
  318. package/lib/types/utils/fileTarget.d.ts +46 -0
  319. package/lib/types/utils/fileTarget.d.ts.map +1 -0
  320. package/lib/types/utils/fileTarget.js +178 -0
  321. package/lib/types/utils/keymap.d.ts +134 -0
  322. package/lib/types/utils/keymap.d.ts.map +1 -0
  323. package/lib/types/utils/keymap.js +311 -0
  324. package/lib/types/utils/mentions.d.ts +25 -2
  325. package/lib/types/utils/mentions.d.ts.map +1 -1
  326. package/lib/types/utils/mentions.js +69 -10
  327. package/lib/types/utils/openExternal.d.ts +50 -0
  328. package/lib/types/utils/openExternal.d.ts.map +1 -0
  329. package/lib/types/utils/openExternal.js +170 -0
  330. package/lib/types/utils/paths.d.ts.map +1 -1
  331. package/lib/types/utils/paths.js +1 -0
  332. package/node_modules/@deepseek-harness-tui/dsh-auth/LICENSE +21 -0
  333. package/node_modules/@deepseek-harness-tui/dsh-auth/README.md +140 -0
  334. package/node_modules/@deepseek-harness-tui/dsh-auth/cordis.patch.yml +11 -0
  335. package/node_modules/@deepseek-harness-tui/dsh-auth/dsh-plugin.json +44 -0
  336. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/command.d.ts +14 -0
  337. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/command.js +67 -0
  338. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/credentials.d.ts +64 -0
  339. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/credentials.js +170 -0
  340. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/index.d.ts +79 -0
  341. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/index.js +196 -0
  342. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/interaction.d.ts +68 -0
  343. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/interaction.js +193 -0
  344. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/opener.d.ts +32 -0
  345. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/opener.js +101 -0
  346. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/profiles.d.ts +31 -0
  347. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/profiles.js +68 -0
  348. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/service.d.ts +69 -0
  349. package/node_modules/@deepseek-harness-tui/dsh-auth/lib/service.js +129 -0
  350. package/node_modules/@deepseek-harness-tui/dsh-auth/package.json +70 -0
  351. package/node_modules/@dsh-std/command/CHANGELOG.md +8 -8
  352. package/node_modules/@dsh-std/command/LICENSE +21 -21
  353. package/node_modules/@dsh-std/command/README.md +26 -26
  354. package/node_modules/@dsh-std/command/README.zh.md +28 -28
  355. package/node_modules/@dsh-std/command/lib/index.js.map +1 -1
  356. package/node_modules/@dsh-std/command/package.json +22 -22
  357. package/node_modules/@dsh-std/connection/CHANGELOG.md +8 -8
  358. package/node_modules/@dsh-std/connection/LICENSE +21 -21
  359. package/node_modules/@dsh-std/connection/README.md +42 -42
  360. package/node_modules/@dsh-std/connection/README.zh.md +42 -42
  361. package/node_modules/@dsh-std/connection/lib/index.js.map +1 -1
  362. package/node_modules/@dsh-std/connection/lib/memory.js.map +1 -1
  363. package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -1
  364. package/node_modules/@dsh-std/connection/package.json +20 -20
  365. package/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
  366. package/node_modules/@dsh-std/core/LICENSE +21 -21
  367. package/node_modules/@dsh-std/core/README.md +13 -13
  368. package/node_modules/@dsh-std/core/README.zh.md +13 -13
  369. package/node_modules/@dsh-std/core/lib/index.js.map +1 -1
  370. package/node_modules/@dsh-std/core/package.json +21 -21
  371. package/node_modules/@dsh-std/manifest/CHANGELOG.md +9 -9
  372. package/node_modules/@dsh-std/manifest/LICENSE +21 -21
  373. package/node_modules/@dsh-std/manifest/README.md +5 -5
  374. package/node_modules/@dsh-std/manifest/README.zh.md +5 -5
  375. package/node_modules/@dsh-std/manifest/lib/index.js.map +1 -1
  376. package/node_modules/@dsh-std/manifest/package.json +20 -20
  377. package/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -144
  378. package/node_modules/@dsh-std/messages/CHANGELOG.md +8 -8
  379. package/node_modules/@dsh-std/messages/LICENSE +21 -21
  380. package/node_modules/@dsh-std/messages/README.md +5 -5
  381. package/node_modules/@dsh-std/messages/README.zh.md +7 -7
  382. package/node_modules/@dsh-std/messages/lib/index.js.map +1 -1
  383. package/node_modules/@dsh-std/messages/package.json +20 -20
  384. package/node_modules/@dsh-std/messages/schema/message-observer-envelope-0.15.schema.json +54 -54
  385. package/node_modules/@dsh-std/presentation/CHANGELOG.md +9 -9
  386. package/node_modules/@dsh-std/presentation/LICENSE +21 -21
  387. package/node_modules/@dsh-std/presentation/README.md +27 -27
  388. package/node_modules/@dsh-std/presentation/README.zh.md +29 -29
  389. package/node_modules/@dsh-std/presentation/lib/callback.js.map +1 -1
  390. package/node_modules/@dsh-std/presentation/lib/index.js.map +1 -1
  391. package/node_modules/@dsh-std/presentation/package.json +25 -25
  392. package/node_modules/@dsh-std/storage/CHANGELOG.md +8 -8
  393. package/node_modules/@dsh-std/storage/LICENSE +21 -21
  394. package/node_modules/@dsh-std/storage/README.md +5 -5
  395. package/node_modules/@dsh-std/storage/README.zh.md +7 -7
  396. package/node_modules/@dsh-std/storage/lib/index.js.map +1 -1
  397. package/node_modules/@dsh-std/storage/package.json +20 -20
  398. package/node_modules/@dsh-std/storage/schema/local-storage-0.15.schema.json +56 -56
  399. package/package.json +19 -5
  400. package/presets/liangshen/.dsh-tui-managed.json +1 -1
  401. package/presets/liangshen/instruction-hint.mjs +8 -0
  402. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/CHANGELOG.md +8 -8
  403. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/LICENSE +21 -21
  404. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.md +42 -42
  405. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.zh.md +42 -42
  406. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js.map +1 -1
  407. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js.map +1 -1
  408. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -1
  409. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/package.json +20 -20
  410. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
  411. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/LICENSE +21 -21
  412. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.md +13 -13
  413. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.zh.md +13 -13
  414. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js.map +1 -1
  415. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/package.json +21 -21
  416. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/CHANGELOG.md +9 -9
  417. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/LICENSE +21 -21
  418. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.md +5 -5
  419. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.zh.md +5 -5
  420. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js.map +1 -1
  421. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/package.json +20 -20
  422. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -144
  423. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/CHANGELOG.md +9 -9
  424. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/LICENSE +21 -21
  425. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.md +27 -27
  426. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.zh.md +29 -29
  427. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/callback.js.map +1 -1
  428. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js.map +1 -1
  429. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/package.json +25 -25
  430. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
  431. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/LICENSE +21 -21
  432. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.md +13 -13
  433. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.zh.md +13 -13
  434. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js.map +1 -1
  435. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/package.json +21 -21
  436. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
  437. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/LICENSE +21 -21
  438. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.md +13 -13
  439. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.zh.md +13 -13
  440. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js.map +1 -1
  441. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/package.json +21 -21
  442. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
  443. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/LICENSE +21 -21
  444. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.md +13 -13
  445. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.zh.md +13 -13
  446. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js.map +1 -1
  447. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/package.json +21 -21
  448. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/CHANGELOG.md +8 -8
  449. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/LICENSE +21 -21
  450. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.md +42 -42
  451. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.zh.md +42 -42
  452. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js.map +1 -1
  453. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js.map +1 -1
  454. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -1
  455. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/package.json +20 -20
  456. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
  457. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/LICENSE +21 -21
  458. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.md +13 -13
  459. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.zh.md +13 -13
  460. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js.map +1 -1
  461. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/package.json +21 -21
  462. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/CHANGELOG.md +8 -8
  463. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/LICENSE +21 -21
  464. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.md +13 -13
  465. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.zh.md +13 -13
  466. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js.map +1 -1
  467. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/package.json +21 -21
@@ -19,6 +19,7 @@ import type { Context } from '@deepseek-ai/cordis';
19
19
  import type { AgentSetup } from '@deepseek-ai/dsh-agent';
20
20
  import type { SessionId } from '@deepseek-ai/dsh-session';
21
21
  import type { PromptAssembly } from '@deepseek-ai/dsh-system-prompt';
22
+ import { type ModelRoute } from '../modelRoute.js';
22
23
  /** One roster entry, as returned by `agentPresets.list()`/`resolve()`. */
23
24
  export interface AgentPresetInfo {
24
25
  readonly id: string;
@@ -94,6 +95,23 @@ export declare function runningPresetOf(session: {
94
95
  data: unknown;
95
96
  }[];
96
97
  }): string | undefined;
98
+ /**
99
+ * The route a PERSISTED session actually ran, read from its log: the last
100
+ * `request/header` snapshot. undefined when the log records none (a session
101
+ * that never started a turn) or the artifact is unreadable.
102
+ *
103
+ * Resume feeds this back into `agents.resume({ agentOptions })` so the
104
+ * resumed agent's `options.model` is populated again — a cordis.yml that
105
+ * pins only `provider` (issue #67: a half-pin never merges) leaves
106
+ * agentOptions.model undefined, which breaks the `{{model}}` persona variable
107
+ * for the resumed agent's own assembly AND for every subagent it spawns
108
+ * (dsh-subagent's `resolveChildAgentOptions` inherits `parent.options.model`).
109
+ *
110
+ * @param ctx - The plugin context (persistence lookup).
111
+ * @param sessionId - The persisted session to inspect.
112
+ * @returns The recorded model route, or undefined when unrecorded/unreadable.
113
+ */
114
+ export declare function resolvePersistedRoute(ctx: Context, sessionId: SessionId): Promise<ModelRoute | undefined>;
97
115
  /**
98
116
  * Keep the official Minimal preset's model-facing contract at exactly two
99
117
  * tools. The TUI mounts ask_user_question at the host layer so every other
@@ -1 +1 @@
1
- {"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/presets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAKpE,0EAA0E;AAC1E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAAA;IACjC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,+DAA+D;AAC/D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,IAAI,IAAI,OAAO,CAAC,SAAS,eAAe,EAAE,CAAC,CAAA;IAC3C,OAAO,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;IAC9C,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;IAC/D,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;IAClE,yEAAyE;IACzE,UAAU,CAAC,CAAC,KAAK,EAAE;QAAE,GAAG,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E,MAAM,GAAG,CAAC,GAAG,SAAS,CAKpG"}
@@ -16,6 +16,7 @@
16
16
  * before presets existed.
17
17
  */
18
18
  import { resolveSessionPreset } from '@deepseek-ai/dsh-agent-presets';
19
+ import { recordedModelRoute } from '../modelRoute.js';
19
20
  const ASK_USER_TOOL = 'ask_user_question';
20
21
  /**
21
22
  * The mounted preset roster, or undefined when the composition has no
@@ -95,6 +96,36 @@ export async function resolvePersistedPreset(ctx, sessionId) {
95
96
  export function runningPresetOf(session) {
96
97
  return resolveSessionPreset(session);
97
98
  }
99
+ /**
100
+ * The route a PERSISTED session actually ran, read from its log: the last
101
+ * `request/header` snapshot. undefined when the log records none (a session
102
+ * that never started a turn) or the artifact is unreadable.
103
+ *
104
+ * Resume feeds this back into `agents.resume({ agentOptions })` so the
105
+ * resumed agent's `options.model` is populated again — a cordis.yml that
106
+ * pins only `provider` (issue #67: a half-pin never merges) leaves
107
+ * agentOptions.model undefined, which breaks the `{{model}}` persona variable
108
+ * for the resumed agent's own assembly AND for every subagent it spawns
109
+ * (dsh-subagent's `resolveChildAgentOptions` inherits `parent.options.model`).
110
+ *
111
+ * @param ctx - The plugin context (persistence lookup).
112
+ * @param sessionId - The persisted session to inspect.
113
+ * @returns The recorded model route, or undefined when unrecorded/unreadable.
114
+ */
115
+ export async function resolvePersistedRoute(ctx, sessionId) {
116
+ const persistence = ctx.get('sessionPersistence');
117
+ if (persistence === undefined)
118
+ return undefined;
119
+ try {
120
+ const { events } = await persistence.load(sessionId);
121
+ return recordedModelRoute(events);
122
+ }
123
+ catch {
124
+ // A missing/corrupt artifact leaves resume itself to report the failure;
125
+ // the route lookup must not mask it with a second, misleading error.
126
+ return undefined;
127
+ }
128
+ }
98
129
  /**
99
130
  * Keep the official Minimal preset's model-facing contract at exactly two
100
131
  * tools. The TUI mounts ask_user_question at the host layer so every other
@@ -31,6 +31,32 @@ export interface CatalogProviderCandidate {
31
31
  readonly provider: string;
32
32
  readonly displayName: string;
33
33
  }
34
+ /** One OAuth-capable provider a dsh-auth-style plugin mounts (masked state only). */
35
+ export interface OAuthProviderStatus {
36
+ readonly provider: string;
37
+ readonly label: string;
38
+ readonly oauthLabel: string;
39
+ readonly loginLabel: string | undefined;
40
+ readonly signedIn: boolean;
41
+ readonly expiresAt: number | undefined;
42
+ readonly expired: boolean;
43
+ }
44
+ /** One successful OAuth login. */
45
+ export interface OAuthLoginResult {
46
+ readonly provider: string;
47
+ readonly oauthLabel: string;
48
+ readonly expiresAt: number;
49
+ }
50
+ /**
51
+ * The `ctx.dshAuth` api, structural so this tree never imports the plugin:
52
+ * mounting dsh-auth (or anything exporting this shape) lights up the wizard's
53
+ * OAuth branch; absent it, the wizard behaves exactly as before.
54
+ */
55
+ export interface OAuthSetupHost {
56
+ providers(): Promise<readonly OAuthProviderStatus[]>;
57
+ login(provider?: string, signal?: AbortSignal): Promise<OAuthLoginResult>;
58
+ logout(provider: string): Promise<boolean>;
59
+ }
34
60
  /**
35
61
  * Runtime capabilities the wizard needs, implemented by the channel over
36
62
  * `ctx.settings` / `ctx.credentials` / `ctx.llm`. `undefined` from
@@ -66,6 +92,8 @@ export interface ProviderSetupHost {
66
92
  * rejects when the adapter's validation deems it unserviceable.
67
93
  */
68
94
  writeProfile(route: string, profile: Record<string, unknown>): Promise<void>;
95
+ /** The OAuth sign-in surface; absent when no dsh-auth-style plugin is mounted. */
96
+ readonly oauth?: OAuthSetupHost;
69
97
  }
70
98
  export interface ProviderWizardDeps {
71
99
  readonly host: ProviderSetupHost;
@@ -81,7 +109,7 @@ export interface ProviderWizardDeps {
81
109
  readonly working: () => boolean;
82
110
  readonly switchModel: (provider: string, model: string) => Promise<boolean>;
83
111
  }
84
- export type ProviderWizardOutcome = 'added' | 'cancelled' | 'failed';
112
+ export type ProviderWizardOutcome = 'added' | 'signed-out' | 'cancelled' | 'failed';
85
113
  /**
86
114
  * Run the add-provider wizard. Resolves 'cancelled' when the user dismisses
87
115
  * any question (Esc) — nothing has been written at that point by design:
@@ -1 +1 @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kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAA;IAChC,QAAQ,CAAC,GAAG,EAAE,CACZ,OAAO,EAAE,sBAAsB,EAC/B,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,KAC3B,OAAO,CAAC,qBAAqB,CAAC,CAAA;IACnC,QAAQ,CAAC,MAAM,EAAE,CACf,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,KACtE,IAAI,CAAA;IACT,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,KAAK,IAAI,CAAA;IACrE,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAA;IAC/B,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAC5E;AAED,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,YAAY,GAAG,WAAW,GAAG,QAAQ,CAAA;AAgDnF;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,qBAAqB,CAAC,CAwNhC"}
@@ -69,13 +69,23 @@ export async function runProviderWizard(deps) {
69
69
  const { host, ask, notify, pushLocal } = deps;
70
70
  try {
71
71
  // ── 1. mode ────────────────────────────────────────────────────────
72
+ const modeOptions = [
73
+ { label: t('provider-opt-catalog'), description: t('provider-opt-catalog-desc') },
74
+ { label: t('provider-opt-custom'), description: t('provider-opt-custom-desc') },
75
+ ];
76
+ // The OAuth branch exists only while a dsh-auth-style plugin is mounted;
77
+ // without the service the mode question stays exactly two options.
78
+ if (host.oauth !== undefined) {
79
+ modeOptions.push({ label: t('provider-opt-oauth'), description: t('provider-opt-oauth-desc') });
80
+ }
72
81
  const modeAnswer = await ask({
73
- questions: [optionQuestion('mode', t('provider-q-mode'), [
74
- { label: t('provider-opt-catalog'), description: t('provider-opt-catalog-desc') },
75
- { label: t('provider-opt-custom'), description: t('provider-opt-custom-desc') },
76
- ], { hideCustomInput: true })],
82
+ questions: [optionQuestion('mode', t('provider-q-mode'), modeOptions, { hideCustomInput: true })],
77
83
  });
78
- const isCatalog = answerSelected(modeAnswer, 'mode')[0] === t('provider-opt-catalog');
84
+ const pickedMode = answerSelected(modeAnswer, 'mode')[0];
85
+ if (host.oauth !== undefined && pickedMode === t('provider-opt-oauth')) {
86
+ return runOAuthWizard(deps, host.oauth);
87
+ }
88
+ const isCatalog = pickedMode === t('provider-opt-catalog');
79
89
  // ── 2. route ───────────────────────────────────────────────────────
80
90
  let route = '';
81
91
  if (isCatalog) {
@@ -267,6 +277,80 @@ export async function runProviderWizard(deps) {
267
277
  return 'failed';
268
278
  }
269
279
  }
280
+ /** Masked state line for one provider row in the OAuth pick question. */
281
+ function oauthStateDescription(status) {
282
+ if (status.signedIn) {
283
+ return t('provider-oauth-state-in', { time: new Date(status.expiresAt ?? 0).toISOString() });
284
+ }
285
+ return status.expired
286
+ ? t('provider-oauth-state-expired')
287
+ : (status.loginLabel ?? status.oauthLabel);
288
+ }
289
+ /**
290
+ * The OAuth branch of `/provider`: pick a subscription provider, then sign
291
+ * in (the plugin's own question panels carry the flow — device codes,
292
+ * authorization URLs), or re-login / sign out when one is already signed in.
293
+ * No settings or credential writes happen here; the plugin owns its store.
294
+ */
295
+ async function runOAuthWizard(deps, oauth) {
296
+ const { ask, notify, pushLocal } = deps;
297
+ try {
298
+ const statuses = await oauth.providers();
299
+ if (statuses.length === 0) {
300
+ notify(t('provider-oauth-none'), { color: 'warning' });
301
+ return 'failed';
302
+ }
303
+ const pickAnswer = await ask({
304
+ questions: [optionQuestion('oauth-provider', t('provider-q-oauth'), statuses.map(status => ({
305
+ label: status.provider,
306
+ description: oauthStateDescription(status),
307
+ })), { hideCustomInput: true })],
308
+ });
309
+ const providerId = answerSelected(pickAnswer, 'oauth-provider')[0];
310
+ const status = statuses.find(row => row.provider === providerId);
311
+ if (status === undefined)
312
+ return 'cancelled';
313
+ if (status.signedIn) {
314
+ const actionAnswer = await ask({
315
+ questions: [optionQuestion('oauth-signed-action', t('provider-q-oauth-signed', { provider: status.provider }), [
316
+ { label: t('provider-opt-oauth-relogin'), description: t('provider-opt-oauth-relogin-desc') },
317
+ { label: t('provider-opt-oauth-logout'), description: t('provider-opt-oauth-logout-desc') },
318
+ { label: t('provider-opt-confirm-cancel') },
319
+ ], { hideCustomInput: true })],
320
+ });
321
+ const action = answerSelected(actionAnswer, 'oauth-signed-action')[0];
322
+ if (action === t('provider-opt-oauth-logout')) {
323
+ await oauth.logout(status.provider);
324
+ pushLocal('/provider', [
325
+ t('provider-line-oauth-provider', { provider: status.provider }),
326
+ t('provider-line-oauth-out'),
327
+ ]);
328
+ notify(t('provider-oauth-logout-ok', { provider: status.provider }), { color: 'success' });
329
+ return 'signed-out';
330
+ }
331
+ if (action !== t('provider-opt-oauth-relogin'))
332
+ return 'cancelled';
333
+ }
334
+ const result = await oauth.login(status.provider);
335
+ pushLocal('/provider', [
336
+ t('provider-line-oauth-provider', { provider: result.provider }),
337
+ t('provider-line-oauth-flow', { flow: result.oauthLabel }),
338
+ t('provider-line-oauth-expires', { time: new Date(result.expiresAt).toISOString() }),
339
+ t('provider-switch-hint'),
340
+ ]);
341
+ notify(t('provider-oauth-login-ok', { provider: result.provider }), { color: 'success' });
342
+ return 'added';
343
+ }
344
+ catch (error) {
345
+ if (error instanceof UserQuestionError) {
346
+ notify(t('provider-cancelled'));
347
+ return 'cancelled';
348
+ }
349
+ const err = error instanceof Error ? error.message : String(error);
350
+ notify(t('provider-oauth-login-failed', { err }), { color: 'error', timeoutMs: 8000 });
351
+ return 'failed';
352
+ }
353
+ }
270
354
  /** Prompt for a route id until it validates or the retry budget runs out. */
271
355
  async function promptRouteId(ask, notify) {
272
356
  for (let attempt = 0; attempt < MAX_RETRY; attempt += 1) {
@@ -18,6 +18,12 @@ export interface QuestionSelection {
18
18
  readonly selected: string[];
19
19
  readonly custom?: string;
20
20
  }
21
+ /**
22
+ * In-progress answer state kept while navigating between questions. Drafts
23
+ * are deliberately separate from committed answers: leaving a question
24
+ * should preserve what the user typed without making it count as answered.
25
+ */
26
+ export type QuestionDraft = QuestionSelection;
21
27
  /** What the TUI renders while a question is pending. */
22
28
  export interface QuestionSnapshot {
23
29
  /** Stable key so the panel remounts (fresh selection state) per question. */
@@ -29,6 +35,10 @@ export interface QuestionSnapshot {
29
35
  readonly total: number;
30
36
  /** Questions answered before the current one. */
31
37
  readonly answered: number;
38
+ /** Previously saved answer or draft for the current question. */
39
+ readonly draft?: QuestionDraft;
40
+ /** Whether Esc should navigate to the previous question. */
41
+ readonly canGoBack: boolean;
32
42
  }
33
43
  /** Completed batch summary, pushed into the transcript by the caller. */
34
44
  export interface QuestionSummary {
@@ -88,11 +98,18 @@ export declare class QuestionStore {
88
98
  /** Advance to the next queued ask, if any. */
89
99
  private startNext;
90
100
  /**
91
- * The user submitted an answer for the current question; advances the
92
- * batch and settles it once every question is answered.
101
+ * The user submitted an answer for the current question; replaces any
102
+ * previous answer at that position, advances the batch, and settles it once
103
+ * every question is answered.
93
104
  * @param selection - Selected option labels plus optional custom text.
94
105
  */
95
106
  answerCurrent(selection: QuestionSelection): void;
107
+ /**
108
+ * Navigate to the previous question without cancelling the batch. The
109
+ * caller supplies the panel's current draft so partially typed text can be
110
+ * restored when the user returns.
111
+ */
112
+ backCurrent(draft?: QuestionDraft): void;
96
113
  /** The user interrupted the questionnaire (Esc / Ctrl+C). */
97
114
  cancelCurrent(): void;
98
115
  /** Reject the active and all queued asks (plugin teardown). */
@@ -1 +1 @@
1
- {"version":3,"file":"questions.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/questions.ts"],"names":[],"mapp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;IAOd,yEAAyE;IACzE,OAAO,CAAC,IAAI;CAMb"}
@@ -27,9 +27,23 @@ function clip(text, max = 140) {
27
27
  return text;
28
28
  return `${text.slice(0, max)}…`;
29
29
  }
30
+ function isDefined(value) {
31
+ return value !== undefined;
32
+ }
33
+ function copyDraft(draft) {
34
+ return {
35
+ selected: [...draft.selected],
36
+ ...(draft.custom !== undefined ? { custom: draft.custom } : {}),
37
+ };
38
+ }
39
+ function selectionFromAnswer(answer) {
40
+ return copyDraft(answer);
41
+ }
30
42
  function buildSummary(pending) {
31
- const lines = pending.answers.map(answer => {
32
- const question = pending.request.questions.find(q => q.id === answer.id);
43
+ const lines = pending.request.questions.flatMap((question, index) => {
44
+ const answer = pending.answers[index];
45
+ if (answer === undefined)
46
+ return [];
33
47
  const text = pending.redact
34
48
  ? '••••••'
35
49
  : (() => {
@@ -38,7 +52,7 @@ function buildSummary(pending) {
38
52
  ? labels === '' ? answer.custom : `${labels}:${answer.custom}`
39
53
  : labels;
40
54
  })();
41
- return `· ${question?.question ?? answer.id} → ${clip(text)}`;
55
+ return `· ${question.question} → ${clip(text)}`;
42
56
  });
43
57
  const total = pending.request.questions.length;
44
58
  return {
@@ -103,12 +117,20 @@ export class QuestionStore {
103
117
  return;
104
118
  }
105
119
  const question = pending.request.questions[pending.index];
120
+ const savedDraft = pending.drafts[pending.index];
121
+ const savedAnswer = pending.answers[pending.index];
106
122
  this.snapshotCache = question === undefined ? null : {
107
123
  key: `${pending.batchId}-${pending.index}`,
108
124
  question,
109
125
  position: pending.index + 1,
110
126
  total: pending.request.questions.length,
111
- answered: pending.answers.length,
127
+ answered: pending.index,
128
+ ...(savedDraft !== undefined
129
+ ? { draft: savedDraft }
130
+ : savedAnswer !== undefined
131
+ ? { draft: selectionFromAnswer(savedAnswer) }
132
+ : {}),
133
+ canGoBack: pending.index > 0,
112
134
  };
113
135
  }
114
136
  /**
@@ -127,7 +149,8 @@ export class QuestionStore {
127
149
  request,
128
150
  batchId: ++this.batchSeq,
129
151
  index: 0,
130
- answers: [],
152
+ answers: new Array(request.questions.length),
153
+ drafts: new Array(request.questions.length),
131
154
  ...(options?.redact ? { redact: true } : {}),
132
155
  resolve,
133
156
  reject,
@@ -160,8 +183,9 @@ export class QuestionStore {
160
183
  this.emit();
161
184
  }
162
185
  /**
163
- * The user submitted an answer for the current question; advances the
164
- * batch and settles it once every question is answered.
186
+ * The user submitted an answer for the current question; replaces any
187
+ * previous answer at that position, advances the batch, and settles it once
188
+ * every question is answered.
165
189
  * @param selection - Selected option labels plus optional custom text.
166
190
  */
167
191
  answerCurrent(selection) {
@@ -169,25 +193,44 @@ export class QuestionStore {
169
193
  const question = pending?.request.questions[pending.index];
170
194
  if (pending === undefined || question === undefined)
171
195
  return;
172
- pending.answers.push({
196
+ const answer = {
173
197
  id: question.id,
174
198
  selected: [...selection.selected],
175
199
  ...(selection.custom !== undefined && selection.custom !== ''
176
200
  ? { custom: selection.custom }
177
201
  : {}),
178
- });
202
+ };
203
+ pending.answers[pending.index] = answer;
204
+ pending.drafts[pending.index] = copyDraft(selection);
179
205
  pending.index += 1;
180
206
  if (pending.index >= pending.request.questions.length) {
181
207
  // Batch complete: settle the harness promise, remember a transcript
182
208
  // summary, and drain the next queued ask if any.
209
+ const answers = pending.answers.filter(isDefined);
183
210
  this.active = undefined;
184
- pending.resolve({ answers: [...pending.answers] });
211
+ pending.resolve({ answers });
185
212
  this.summaries.push(buildSummary(pending));
186
213
  this.startNext();
187
214
  }
188
215
  this.rebuildSnapshot();
189
216
  this.emit();
190
217
  }
218
+ /**
219
+ * Navigate to the previous question without cancelling the batch. The
220
+ * caller supplies the panel's current draft so partially typed text can be
221
+ * restored when the user returns.
222
+ */
223
+ backCurrent(draft) {
224
+ const pending = this.active;
225
+ if (pending === undefined || pending.index <= 0)
226
+ return;
227
+ if (draft !== undefined) {
228
+ pending.drafts[pending.index] = copyDraft(draft);
229
+ }
230
+ pending.index -= 1;
231
+ this.rebuildSnapshot();
232
+ this.emit();
233
+ }
191
234
  /** The user interrupted the questionnaire (Esc / Ctrl+C). */
192
235
  cancelCurrent() {
193
236
  const pending = this.active;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Session recap (`/recap`, pi-recap semantics): a single TOOL-LESS LLM
3
+ * call that summarizes the session's RECENT activity into one line and
4
+ * proposes a short title. Unlike `/btw` it does not replay the full
5
+ * derived history — the recent-activity excerpt below IS the payload, so
6
+ * the call stays cheap and the recap is about the tail of the session,
7
+ * which is exactly what a glance at a resumed/unknown session needs.
8
+ *
9
+ * The answer never enters the session log — it is pure UI state (the
10
+ * RecapPanel in the Chat screen); applying the proposed title goes
11
+ * through the normal `/rename` path (channel.renameSession).
12
+ *
13
+ * @module
14
+ */
15
+ import type { SessionEvent } from '@deepseek-ai/dsh-session';
16
+ /** Max chars of recent activity fed to the recap call. */
17
+ export declare const RECAP_RECENT_CHARS = 6000;
18
+ /**
19
+ * Collect the most recent user/assistant exchanges from a session event
20
+ * log as plain `role: text` lines, capped to the tail turns and a char
21
+ * budget. Rows derived from the log (tool cards, notices) are skipped —
22
+ * the recap wants the conversation, not the chrome.
23
+ */
24
+ export declare function collectRecentActivity(events: readonly SessionEvent[], limitChars: number): string;
25
+ /**
26
+ * Wrap the recent-activity excerpt with the single-response, JSON-only
27
+ * recap contract. The model answers with a title + one-line summary in
28
+ * the language of the activity (matching the user's own words).
29
+ */
30
+ export declare function wrapRecapPrompt(activity: string): string;
31
+ /**
32
+ * Parse the model's recap response: extract the JSON object (tolerating
33
+ * stray prose around it); on failure the whole text becomes the summary
34
+ * and no title is proposed.
35
+ */
36
+ export declare function parseRecapResponse(raw: string): {
37
+ summary: string;
38
+ title?: string;
39
+ };
40
+ /** Outcome of one recap call, as surfaced on the Channel. */
41
+ export interface RecapOutcome {
42
+ /** The one-line summary, or null when the call failed. */
43
+ summary: string | null;
44
+ /** Proposed session title, when the model offered one. */
45
+ title?: string;
46
+ /** Human-readable failure reason (llm missing, stream error, …). */
47
+ error?: string;
48
+ }
49
+ //# sourceMappingURL=recap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recap.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/recap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAE5D,0DAA0D;AAC1D,eAAO,MAAM,kBAAkB,OAAO,CAAA;AAkBtC;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CA4BjG;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAYxD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAyBnF;AAED,6DAA6D;AAC7D,MAAM,WAAW,YAAY;IAC3B,0DAA0D;IAC1D,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAA;CACf"}
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Session recap (`/recap`, pi-recap semantics): a single TOOL-LESS LLM
3
+ * call that summarizes the session's RECENT activity into one line and
4
+ * proposes a short title. Unlike `/btw` it does not replay the full
5
+ * derived history — the recent-activity excerpt below IS the payload, so
6
+ * the call stays cheap and the recap is about the tail of the session,
7
+ * which is exactly what a glance at a resumed/unknown session needs.
8
+ *
9
+ * The answer never enters the session log — it is pure UI state (the
10
+ * RecapPanel in the Chat screen); applying the proposed title goes
11
+ * through the normal `/rename` path (channel.renameSession).
12
+ *
13
+ * @module
14
+ */
15
+ /** Max chars of recent activity fed to the recap call. */
16
+ export const RECAP_RECENT_CHARS = 6000;
17
+ /** How many exchanges (user + assistant) the recap looks back. */
18
+ const RECAP_RECENT_TURNS = 6;
19
+ /** The first text block of a message `content` payload. */
20
+ function textOfContent(content) {
21
+ if (typeof content === 'string')
22
+ return content.trim() || undefined;
23
+ if (!Array.isArray(content))
24
+ return undefined;
25
+ for (const block of content) {
26
+ if (block === null || typeof block !== 'object')
27
+ continue;
28
+ const record = block;
29
+ if (record['type'] !== 'text')
30
+ continue;
31
+ const value = record['text'];
32
+ if (typeof value === 'string' && value.trim().length > 0)
33
+ return value.trim();
34
+ }
35
+ return undefined;
36
+ }
37
+ /**
38
+ * Collect the most recent user/assistant exchanges from a session event
39
+ * log as plain `role: text` lines, capped to the tail turns and a char
40
+ * budget. Rows derived from the log (tool cards, notices) are skipped —
41
+ * the recap wants the conversation, not the chrome.
42
+ */
43
+ export function collectRecentActivity(events, limitChars) {
44
+ const entries = [];
45
+ for (const event of events) {
46
+ const record = event;
47
+ if (record['type'] === 'user/message') {
48
+ const data = record['data'];
49
+ const text = textOfContent(data?.['content']);
50
+ if (text !== undefined)
51
+ entries.push({ role: 'user', text });
52
+ continue;
53
+ }
54
+ if (record['type'] === 'assistant/message') {
55
+ const data = record['data'];
56
+ const message = data?.['message'];
57
+ const text = textOfContent(message?.['content']);
58
+ if (text !== undefined)
59
+ entries.push({ role: 'assistant', text });
60
+ }
61
+ }
62
+ const tail = entries.slice(-RECAP_RECENT_TURNS * 2);
63
+ let budget = limitChars;
64
+ const lines = [];
65
+ for (const entry of tail) {
66
+ const text = entry.text.length > budget ? entry.text.slice(0, budget) : entry.text;
67
+ lines.push(`${entry.role}: ${text}`);
68
+ budget -= text.length + entry.role.length + 2;
69
+ if (budget <= 0)
70
+ break;
71
+ }
72
+ return lines.join('\n');
73
+ }
74
+ /**
75
+ * Wrap the recent-activity excerpt with the single-response, JSON-only
76
+ * recap contract. The model answers with a title + one-line summary in
77
+ * the language of the activity (matching the user's own words).
78
+ */
79
+ export function wrapRecapPrompt(activity) {
80
+ return `<system-reminder>You are a thoughtful assistant helping the user wrap up this session. Look at the recent activity below and give it a quick human review — like a colleague summarizing what the two of you just worked on.
81
+
82
+ TASK — do BOTH:
83
+ 1. Write ONE short line (about 10-20 words) recapping the RECENT ACTIVITY: what was being worked on and where things stand. Write it in the same language the user writes in. Sound natural and professional — a warm recap, not a dry log.
84
+ 2. Propose a short session title (about 2-6 words, same language) that captures what this session is about.
85
+
86
+ Respond with ONLY a JSON object, no markdown fences, no extra text:
87
+ {"title": "<short title>", "summary": "<one-line summary>"}
88
+
89
+ RECENT ACTIVITY:
90
+ ${activity}</system-reminder>`;
91
+ }
92
+ /**
93
+ * Parse the model's recap response: extract the JSON object (tolerating
94
+ * stray prose around it); on failure the whole text becomes the summary
95
+ * and no title is proposed.
96
+ */
97
+ export function parseRecapResponse(raw) {
98
+ const start = raw.indexOf('{');
99
+ const end = raw.lastIndexOf('}');
100
+ if (start !== -1 && end > start) {
101
+ try {
102
+ const parsed = JSON.parse(raw.slice(start, end + 1));
103
+ if (parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed)) {
104
+ const record = parsed;
105
+ const summary = typeof record['summary'] === 'string' && record['summary'].trim() !== ''
106
+ ? record['summary'].trim()
107
+ : undefined;
108
+ const title = typeof record['title'] === 'string' && record['title'].trim() !== ''
109
+ ? record['title'].trim()
110
+ : undefined;
111
+ if (summary !== undefined) {
112
+ return title === undefined ? { summary } : { summary, title };
113
+ }
114
+ }
115
+ }
116
+ catch {
117
+ // Fall through to the raw-text fallback below.
118
+ }
119
+ }
120
+ return { summary: raw.trim() };
121
+ }