@deepseek-harness-tui/dsh-tui 0.18.0 → 0.20.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 (318) hide show
  1. package/README.md +90 -59
  2. package/bin/dsh-tui.js +46 -3
  3. package/cordis.patch.yml +5 -3
  4. package/cordis.yml +3 -2
  5. package/guide/dsh-tui-guide/codex-backend.en.md +2 -2
  6. package/guide/dsh-tui-guide/codex-backend.md +2 -2
  7. package/guide/dsh-tui-guide/configuration.en.md +7 -2
  8. package/guide/dsh-tui-guide/configuration.md +7 -2
  9. package/guide/dsh-tui-guide/getting-started.en.md +168 -4
  10. package/guide/dsh-tui-guide/getting-started.md +121 -14
  11. package/guide/dsh-tui-guide/interaction.en.md +11 -10
  12. package/guide/dsh-tui-guide/interaction.md +5 -4
  13. package/guide/dsh-tui-guide/user-guide.en.md +12 -6
  14. package/guide/dsh-tui-guide/user-guide.md +12 -6
  15. package/lib/settings.json +24 -8
  16. package/lib/types/adapter/ports/channel-ui.d.ts +10 -7
  17. package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
  18. package/lib/types/adapter/ports/channel-view.d.ts +67 -8
  19. package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
  20. package/lib/types/agent/events.d.ts +14 -5
  21. package/lib/types/agent/events.d.ts.map +1 -1
  22. package/lib/types/agent/session.d.ts +5 -0
  23. package/lib/types/agent/session.d.ts.map +1 -1
  24. package/lib/types/backends/claude/tools.d.ts.map +1 -1
  25. package/lib/types/backends/claude/tools.js +8 -3
  26. package/lib/types/backends/claude/translate/core.d.ts +2 -2
  27. package/lib/types/backends/claude/translate/core.d.ts.map +1 -1
  28. package/lib/types/backends/claude/translate/core.js +10 -6
  29. package/lib/types/backends/codex/session/commands.d.ts +2 -0
  30. package/lib/types/backends/codex/session/commands.d.ts.map +1 -1
  31. package/lib/types/backends/codex/session/commands.js +8 -4
  32. package/lib/types/backends/codex/session/input.d.ts +11 -7
  33. package/lib/types/backends/codex/session/input.d.ts.map +1 -1
  34. package/lib/types/backends/codex/session/input.js +68 -15
  35. package/lib/types/backends/codex/session/session.d.ts.map +1 -1
  36. package/lib/types/backends/codex/session/session.js +2 -3
  37. package/lib/types/backends/codex/translate/presentation.d.ts.map +1 -1
  38. package/lib/types/backends/codex/translate/presentation.js +5 -2
  39. package/lib/types/channel/interaction.d.ts.map +1 -1
  40. package/lib/types/channel/interaction.js +1 -0
  41. package/lib/types/channel/permissions.d.ts +15 -0
  42. package/lib/types/channel/permissions.d.ts.map +1 -1
  43. package/lib/types/channel/permissions.js +28 -0
  44. package/lib/types/channel/projection.d.ts.map +1 -1
  45. package/lib/types/channel/projection.js +89 -11
  46. package/lib/types/channel/questions.d.ts +45 -3
  47. package/lib/types/channel/questions.d.ts.map +1 -1
  48. package/lib/types/channel/questions.js +43 -0
  49. package/lib/types/channel/sanitize.d.ts.map +1 -1
  50. package/lib/types/channel/sanitize.js +8 -4
  51. package/lib/types/channel/subagent-failure.d.ts +49 -0
  52. package/lib/types/channel/subagent-failure.d.ts.map +1 -0
  53. package/lib/types/channel/subagent-failure.js +59 -0
  54. package/lib/types/channel/transcript.d.ts +17 -0
  55. package/lib/types/channel/transcript.d.ts.map +1 -1
  56. package/lib/types/channel/transcript.js +35 -0
  57. package/lib/types/commands.js +2 -2
  58. package/lib/types/components/MessageList.d.ts.map +1 -1
  59. package/lib/types/components/MessageList.js +14 -10
  60. package/lib/types/components/PromptInput.d.ts.map +1 -1
  61. package/lib/types/components/PromptInput.js +61 -6
  62. package/lib/types/components/SplitDiffView.d.ts.map +1 -1
  63. package/lib/types/components/SplitDiffView.js +3 -2
  64. package/lib/types/components/StarPrompt.d.ts +5 -3
  65. package/lib/types/components/StarPrompt.d.ts.map +1 -1
  66. package/lib/types/components/StarPrompt.js +56 -6
  67. package/lib/types/components/SubagentCard.d.ts.map +1 -1
  68. package/lib/types/components/SubagentCard.js +1 -1
  69. package/lib/types/components/SubagentDashboard.d.ts.map +1 -1
  70. package/lib/types/components/SubagentDashboard.js +9 -2
  71. package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
  72. package/lib/types/components/SubagentDetailScene.js +1 -1
  73. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  74. package/lib/types/components/messages/AssistantToolUseMessage.js +126 -25
  75. package/lib/types/components/questions/AskUserQuestionPanel.d.ts +5 -8
  76. package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
  77. package/lib/types/components/questions/AskUserQuestionPanel.js +7 -4
  78. package/lib/types/components/questions/PlanReviewPanel.d.ts +3 -6
  79. package/lib/types/components/questions/PlanReviewPanel.d.ts.map +1 -1
  80. package/lib/types/components/revealScope.d.ts +15 -0
  81. package/lib/types/components/revealScope.d.ts.map +1 -0
  82. package/lib/types/components/revealScope.js +17 -0
  83. package/lib/types/components/sidePanel/btw/BtwComposer.d.ts +34 -1
  84. package/lib/types/components/sidePanel/btw/BtwComposer.d.ts.map +1 -1
  85. package/lib/types/components/sidePanel/btw/BtwComposer.js +108 -7
  86. package/lib/types/components/sidePanel/btw/BtwPanelAdapter.d.ts.map +1 -1
  87. package/lib/types/components/sidePanel/btw/BtwPanelAdapter.js +1 -1
  88. package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts.map +1 -1
  89. package/lib/types/components/sidePanel/btw/BtwThreadScene.js +1 -1
  90. package/lib/types/components/smoothReveal.d.ts +36 -6
  91. package/lib/types/components/smoothReveal.d.ts.map +1 -1
  92. package/lib/types/components/smoothReveal.js +92 -21
  93. package/lib/types/components/teamRoster.d.ts +6 -3
  94. package/lib/types/components/teamRoster.d.ts.map +1 -1
  95. package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts +4 -14
  96. package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts.map +1 -1
  97. package/lib/types/components/workspaces/HomeWorkspaceRow.js +26 -17
  98. package/lib/types/dsh-adapter/approvals.d.ts +19 -0
  99. package/lib/types/dsh-adapter/approvals.d.ts.map +1 -1
  100. package/lib/types/dsh-adapter/approvals.js +17 -1
  101. package/lib/types/dsh-adapter/backend/session.d.ts.map +1 -1
  102. package/lib/types/dsh-adapter/backend/session.js +12 -0
  103. package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
  104. package/lib/types/dsh-adapter/backend/translate.js +21 -4
  105. package/lib/types/dsh-adapter/channel/attached-context.d.ts +15 -2
  106. package/lib/types/dsh-adapter/channel/attached-context.d.ts.map +1 -1
  107. package/lib/types/dsh-adapter/channel/attached-context.js +26 -3
  108. package/lib/types/dsh-adapter/channel/binding-events.d.ts +3 -0
  109. package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
  110. package/lib/types/dsh-adapter/channel/binding-events.js +43 -2
  111. package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts +2 -6
  112. package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts.map +1 -1
  113. package/lib/types/dsh-adapter/channel/context-bookkeeping.js +7 -1
  114. package/lib/types/dsh-adapter/channel/core/compose.d.ts +2 -6
  115. package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
  116. package/lib/types/dsh-adapter/channel/core/compose.js +1 -1
  117. package/lib/types/dsh-adapter/channel/core/local-actions.d.ts.map +1 -1
  118. package/lib/types/dsh-adapter/channel/core/local-actions.js +3 -26
  119. package/lib/types/dsh-adapter/channel/emitter.js +1 -1
  120. package/lib/types/dsh-adapter/channel/extensions.d.ts.map +1 -1
  121. package/lib/types/dsh-adapter/channel/extensions.js +15 -4
  122. package/lib/types/dsh-adapter/channel/input-actions.d.ts +2 -2
  123. package/lib/types/dsh-adapter/channel/input-actions.d.ts.map +1 -1
  124. package/lib/types/dsh-adapter/channel/input-actions.js +34 -10
  125. package/lib/types/dsh-adapter/channel/input-delivery.d.ts +3 -7
  126. package/lib/types/dsh-adapter/channel/input-delivery.d.ts.map +1 -1
  127. package/lib/types/dsh-adapter/channel/input-delivery.js +14 -5
  128. package/lib/types/dsh-adapter/channel/local-actions.d.ts.map +1 -1
  129. package/lib/types/dsh-adapter/channel/local-actions.js +7 -3
  130. package/lib/types/dsh-adapter/channel/model-actions.d.ts +4 -1
  131. package/lib/types/dsh-adapter/channel/model-actions.d.ts.map +1 -1
  132. package/lib/types/dsh-adapter/channel/model-actions.js +26 -9
  133. package/lib/types/dsh-adapter/channel/model-selection.d.ts +27 -2
  134. package/lib/types/dsh-adapter/channel/model-selection.d.ts.map +1 -1
  135. package/lib/types/dsh-adapter/channel/model-selection.js +81 -37
  136. package/lib/types/dsh-adapter/channel/model-switch.d.ts +1 -1
  137. package/lib/types/dsh-adapter/channel/model-switch.d.ts.map +1 -1
  138. package/lib/types/dsh-adapter/channel/projection-helpers.d.ts.map +1 -1
  139. package/lib/types/dsh-adapter/channel/projection-helpers.js +4 -2
  140. package/lib/types/dsh-adapter/channel/session-rewind.d.ts.map +1 -1
  141. package/lib/types/dsh-adapter/channel/session-rewind.js +6 -2
  142. package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts.map +1 -1
  143. package/lib/types/dsh-adapter/channel/session-tree-actions.js +8 -4
  144. package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
  145. package/lib/types/dsh-adapter/channel/settings-host.js +185 -36
  146. package/lib/types/dsh-adapter/channel/subagent-projection.d.ts +55 -4
  147. package/lib/types/dsh-adapter/channel/subagent-projection.d.ts.map +1 -1
  148. package/lib/types/dsh-adapter/channel/subagent-projection.js +80 -16
  149. package/lib/types/dsh-adapter/channel/subagent-transcript.d.ts +1 -1
  150. package/lib/types/dsh-adapter/channel/subagent-transcript.d.ts.map +1 -1
  151. package/lib/types/dsh-adapter/channel/subagent-transcript.js +6 -5
  152. package/lib/types/dsh-adapter/channel/task-completion.js +2 -10
  153. package/lib/types/dsh-adapter/channel/transcript.d.ts +3 -2
  154. package/lib/types/dsh-adapter/channel/transcript.d.ts.map +1 -1
  155. package/lib/types/dsh-adapter/channel/transcript.js +13 -4
  156. package/lib/types/dsh-adapter/channel/types.d.ts +11 -2
  157. package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
  158. package/lib/types/dsh-adapter/compat/compaction-previews.d.ts +11 -0
  159. package/lib/types/dsh-adapter/compat/compaction-previews.d.ts.map +1 -0
  160. package/lib/types/dsh-adapter/compat/compaction-previews.js +38 -0
  161. package/lib/types/dsh-adapter/compat/messages.d.ts +1 -1
  162. package/lib/types/dsh-adapter/compat/messages.d.ts.map +1 -1
  163. package/lib/types/dsh-adapter/compat/messages.js +2 -2
  164. package/lib/types/dsh-adapter/contract.d.ts +29 -3
  165. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  166. package/lib/types/dsh-adapter/contract.js +48 -5
  167. package/lib/types/dsh-adapter/experimental-bundles.d.ts +5 -0
  168. package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -1
  169. package/lib/types/dsh-adapter/experimental-bundles.js +0 -2
  170. package/lib/types/dsh-adapter/fresh-agent.d.ts +1 -1
  171. package/lib/types/dsh-adapter/fresh-agent.d.ts.map +1 -1
  172. package/lib/types/dsh-adapter/fresh-agent.js +60 -11
  173. package/lib/types/dsh-adapter/host-access.d.ts.map +1 -1
  174. package/lib/types/dsh-adapter/host-access.js +60 -11
  175. package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
  176. package/lib/types/dsh-adapter/host-contract.d.ts.map +1 -1
  177. package/lib/types/dsh-adapter/host-contract.js +5 -3
  178. package/lib/types/dsh-adapter/host-dsh.d.ts +2 -8
  179. package/lib/types/dsh-adapter/host-dsh.d.ts.map +1 -1
  180. package/lib/types/dsh-adapter/host-dsh.js +30 -6
  181. package/lib/types/dsh-adapter/host-entry.js +4 -0
  182. package/lib/types/dsh-adapter/index.d.ts +9 -1
  183. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  184. package/lib/types/dsh-adapter/index.js +5 -0
  185. package/lib/types/dsh-adapter/oauth/account-notifications.d.ts +73 -0
  186. package/lib/types/dsh-adapter/oauth/account-notifications.d.ts.map +1 -0
  187. package/lib/types/dsh-adapter/oauth/account-notifications.js +250 -0
  188. package/lib/types/dsh-adapter/oauth/bonus.d.ts +34 -9
  189. package/lib/types/dsh-adapter/oauth/bonus.d.ts.map +1 -1
  190. package/lib/types/dsh-adapter/oauth/bonus.js +47 -5
  191. package/lib/types/dsh-adapter/oauth/deepseek.d.ts +7 -2
  192. package/lib/types/dsh-adapter/oauth/deepseek.d.ts.map +1 -1
  193. package/lib/types/dsh-adapter/oauth/deepseek.js +6 -1
  194. package/lib/types/dsh-adapter/oauth/index.d.ts.map +1 -1
  195. package/lib/types/dsh-adapter/oauth/index.js +44 -0
  196. package/lib/types/dsh-adapter/oauth/profiles.d.ts.map +1 -1
  197. package/lib/types/dsh-adapter/oauth/profiles.js +14 -1
  198. package/lib/types/dsh-adapter/oauth/service.d.ts.map +1 -1
  199. package/lib/types/dsh-adapter/oauth/service.js +5 -6
  200. package/lib/types/dsh-adapter/plugin-manage.d.ts +6 -4
  201. package/lib/types/dsh-adapter/plugin-manage.d.ts.map +1 -1
  202. package/lib/types/dsh-adapter/plugin-manage.js +3 -2
  203. package/lib/types/dsh-adapter/plugin.d.ts +237 -6
  204. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  205. package/lib/types/dsh-adapter/plugin.js +751 -67
  206. package/lib/types/dsh-adapter/presets.d.ts +38 -11
  207. package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
  208. package/lib/types/dsh-adapter/presets.js +46 -17
  209. package/lib/types/dsh-adapter/process-exit.d.ts +1 -1
  210. package/lib/types/dsh-adapter/process-exit.js +1 -1
  211. package/lib/types/dsh-adapter/questions.d.ts +3 -4
  212. package/lib/types/dsh-adapter/questions.d.ts.map +1 -1
  213. package/lib/types/dsh-adapter/questions.js +1 -1
  214. package/lib/types/dsh-adapter/session-list-metadata.js +2 -2
  215. package/lib/types/dsh-adapter/session-projection-store.d.ts +1 -1
  216. package/lib/types/dsh-adapter/session-projection-store.d.ts.map +1 -1
  217. package/lib/types/dsh-adapter/session-projection-store.js +30 -23
  218. package/lib/types/dsh-adapter/sessionTree.d.ts.map +1 -1
  219. package/lib/types/dsh-adapter/sessionTree.js +4 -1
  220. package/lib/types/dsh-adapter/subagents.d.ts +6 -0
  221. package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
  222. package/lib/types/dsh-adapter/subagents.js +32 -3
  223. package/lib/types/dsh-adapter/team-mode.d.ts +46 -27
  224. package/lib/types/dsh-adapter/team-mode.d.ts.map +1 -1
  225. package/lib/types/dsh-adapter/team-mode.js +157 -29
  226. package/lib/types/dsh-adapter/team-roster.d.ts +53 -18
  227. package/lib/types/dsh-adapter/team-roster.d.ts.map +1 -1
  228. package/lib/types/dsh-adapter/team-roster.js +206 -39
  229. package/lib/types/dsh-adapter/team-tools.d.ts +25 -12
  230. package/lib/types/dsh-adapter/team-tools.d.ts.map +1 -1
  231. package/lib/types/dsh-adapter/team-tools.js +81 -26
  232. package/lib/types/dsh-adapter/tool-scope.d.ts +24 -0
  233. package/lib/types/dsh-adapter/tool-scope.d.ts.map +1 -0
  234. package/lib/types/dsh-adapter/tool-scope.js +127 -0
  235. package/lib/types/dsh-adapter/types.d.ts +2 -1
  236. package/lib/types/dsh-adapter/types.d.ts.map +1 -1
  237. package/lib/types/heldInputs.d.ts +55 -16
  238. package/lib/types/heldInputs.d.ts.map +1 -1
  239. package/lib/types/heldInputs.js +277 -41
  240. package/lib/types/i18n.d.ts +292 -20
  241. package/lib/types/i18n.d.ts.map +1 -1
  242. package/lib/types/i18n.js +89 -13
  243. package/lib/types/ink/components/App.d.ts +2 -0
  244. package/lib/types/ink/components/App.d.ts.map +1 -1
  245. package/lib/types/ink/components/App.js +8 -0
  246. package/lib/types/ink/dom.d.ts.map +1 -1
  247. package/lib/types/ink/dom.js +13 -3
  248. package/lib/types/ink/events/input-event.d.ts.map +1 -1
  249. package/lib/types/ink/events/input-event.js +7 -6
  250. package/lib/types/ink/flush-tick.d.ts +6 -0
  251. package/lib/types/ink/flush-tick.d.ts.map +1 -1
  252. package/lib/types/ink/flush-tick.js +31 -0
  253. package/lib/types/ink/hit-test.d.ts +2 -0
  254. package/lib/types/ink/hit-test.d.ts.map +1 -1
  255. package/lib/types/ink/hit-test.js +10 -0
  256. package/lib/types/ink/hooks/use-program-status.d.ts +1 -1
  257. package/lib/types/ink/hooks/use-program-status.d.ts.map +1 -1
  258. package/lib/types/ink/hooks/use-program-status.js +3 -2
  259. package/lib/types/ink/hooks/use-terminal-title.d.ts +15 -0
  260. package/lib/types/ink/hooks/use-terminal-title.d.ts.map +1 -1
  261. package/lib/types/ink/hooks/use-terminal-title.js +23 -3
  262. package/lib/types/ink/ink.d.ts +1 -0
  263. package/lib/types/ink/ink.d.ts.map +1 -1
  264. package/lib/types/ink/ink.js +7 -4
  265. package/lib/types/ink/jumpback-state.d.ts +33 -0
  266. package/lib/types/ink/jumpback-state.d.ts.map +1 -0
  267. package/lib/types/ink/jumpback-state.js +51 -0
  268. package/lib/types/ink/jumpback.d.ts +78 -0
  269. package/lib/types/ink/jumpback.d.ts.map +1 -0
  270. package/lib/types/ink/jumpback.js +515 -0
  271. package/lib/types/ink/log-update.js +37 -14
  272. package/lib/types/ink/notify-helper/activate.cs +836 -0
  273. package/lib/types/ink/notify-helper/compile.d.ts +30 -0
  274. package/lib/types/ink/notify-helper/compile.d.ts.map +1 -0
  275. package/lib/types/ink/notify-helper/compile.js +235 -0
  276. package/lib/types/ink/parse-keypress.d.ts.map +1 -1
  277. package/lib/types/ink/parse-keypress.js +25 -0
  278. package/lib/types/ink/terminal-notification-windows.d.ts +8 -4
  279. package/lib/types/ink/terminal-notification-windows.d.ts.map +1 -1
  280. package/lib/types/ink/terminal-notification-windows.js +14 -21
  281. package/lib/types/ink/terminal-notification.d.ts +31 -2
  282. package/lib/types/ink/terminal-notification.d.ts.map +1 -1
  283. package/lib/types/ink/terminal-notification.js +51 -0
  284. package/lib/types/ink/terminal.d.ts +15 -3
  285. package/lib/types/ink/terminal.d.ts.map +1 -1
  286. package/lib/types/ink/terminal.js +38 -9
  287. package/lib/types/screens/AgentTranscriptScene.d.ts.map +1 -1
  288. package/lib/types/screens/AgentTranscriptScene.js +1 -1
  289. package/lib/types/screens/Chat.d.ts +4 -3
  290. package/lib/types/screens/Chat.d.ts.map +1 -1
  291. package/lib/types/screens/Chat.js +81 -11
  292. package/lib/types/screens/SessionSupervisor.d.ts +3 -6
  293. package/lib/types/screens/SessionSupervisor.d.ts.map +1 -1
  294. package/lib/types/screens/SessionSupervisor.js +5 -8
  295. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts +1 -2
  296. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts.map +1 -1
  297. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.js +2 -2
  298. package/lib/types/screens/sessionSupervisor/model.d.ts +1 -1
  299. package/lib/types/screens/sessionSupervisor/model.js +1 -1
  300. package/lib/types/sessionMounts.d.ts +12 -5
  301. package/lib/types/sessionMounts.d.ts.map +1 -1
  302. package/lib/types/sessionMounts.js +33 -6
  303. package/lib/types/settings/definitions.d.ts +12 -0
  304. package/lib/types/settings/definitions.d.ts.map +1 -1
  305. package/lib/types/settings/definitions.js +15 -7
  306. package/lib/types/update.d.ts +412 -20
  307. package/lib/types/update.d.ts.map +1 -1
  308. package/lib/types/update.js +2094 -193
  309. package/lib/types/updateHost.d.ts +198 -0
  310. package/lib/types/updateHost.d.ts.map +1 -0
  311. package/lib/types/updateHost.js +608 -0
  312. package/lib/types/utils/processName.d.ts +16 -0
  313. package/lib/types/utils/processName.d.ts.map +1 -0
  314. package/lib/types/utils/processName.js +27 -0
  315. package/package.json +114 -111
  316. package/presets/liangshen/agent.cordis.yml +4 -0
  317. package/tui-profile/feed/README.md +1 -1
  318. package/tui-profile/feed/first-party.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"host-contract.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/host-contract.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,+DAA+D;AAC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,IAAI,EAAE,MAAM,CAAA;CAAE,EAapF,CAAA"}
@@ -7,7 +7,7 @@
7
7
  /** The host CLI package whose installation the entry loads. */
8
8
  export const HOST_PACKAGE = '@deepseek-ai/dsh';
9
9
  /** The host line the reproduced pieces were checked against (host-replica.snapshot.json). */
10
- export const HOST_REPLICA_VERSION = '0.2.1-rc.5';
10
+ export const HOST_REPLICA_VERSION = '0.2.2-rc.2';
11
11
  /** The host modules the entry loads, all from one installation, in load order. */
12
12
  export const HOST_MODULES = [
13
13
  { key: 'cordis', specifier: '@deepseek-ai/cordis', via: 'host', exports: ['Context'] },
@@ -57,8 +57,8 @@ export const HOST_REPLICAS = [
57
57
  { id: 'process-shutdown-timeout', package: HOST_PACKAGE, symbol: 'PROCESS_SHUTDOWN_TIMEOUT_MS', kind: 'const', local: 'process-exit.ts PROCESS_SHUTDOWN_TIMEOUT_MS' },
58
58
  { id: 'app-ready', package: HOST_PACKAGE, symbol: 'createAppReady', kind: 'function', local: 'createAppReady' },
59
59
  { id: 'compose-profile', package: HOST_PACKAGE, symbol: 'composeProfile', kind: 'function', local: 'prepareHostRoot steps 1–2 (no overlays, no resolvedProfile)' },
60
- { id: 'run-profile', package: HOST_PACKAGE, symbol: 'runProfile', kind: 'function', local: 'prepareHostRoot (PluginPackages), HostRoot.selectKernel (proxy, fail-loud, profileContext, launch environment, provideCmdline) and HostRoot.compose\'s appReady.commit' },
61
- { id: 'boot', package: '@deepseek-ai/dsh-app-boot', symbol: 'boot', kind: 'function', local: 'prepareHostRoot step 4 (baseUrl, dshHomePath, internal/update, Loader) and HostRoot.compose (startup-log exporter, mountRootInclude, loader.await, auditStartupEntries, StartupError.startup)' },
60
+ { id: 'run-profile', package: HOST_PACKAGE, symbol: 'runProfile', kind: 'function', local: 'prepareHostRoot (DSH_USER_AGENT_SUFFIX from its first line only when the selected host exports userAgentProfile, PluginPackages), HostRoot.selectKernel (proxy, fail-loud, profileContext, launch environment, provideCmdline) and HostRoot.compose\'s appReady.commit' },
61
+ { id: 'boot', package: '@deepseek-ai/dsh-app-boot', symbol: 'boot', kind: 'function', local: 'prepareHostRoot step 4 (baseUrl, dshHomePath, Loader — the pre-0.2.2 internal/update hook is version-gated) and HostRoot.compose (startup-log exporter, mountRootInclude, loader.await, auditStartupEntries, StartupError.startup)' },
62
62
  { id: 'startup-report', package: HOST_PACKAGE, symbol: 'reportStartupFailure', kind: 'function', local: 'writeStartupReport: the file half' },
63
63
  { id: 'run-cli', package: HOST_PACKAGE, symbol: 'runCli', kind: 'function', local: 'prepareHostRoot\'s loadLayeredEnv call before the profile; the StartupError-only report' },
64
64
  ];
@@ -67,11 +67,13 @@ export const HOST_DEVIATIONS = [
67
67
  { id: 'no-interrupt', what: 'runProfile\'s SIGTERM/SIGINT handlers and createProcessShutdown().interrupt are not reproduced: the entry owns SIGTERM/SIGHUP/SIGINT (process-exit.ts installEntrySignals) and ends by the signal after the TUI\'s exit funnel, where interrupt exits 0 (TERM) / 130 (INT) — the launcher reads a numeric 130 as a crash (verify-entry-process-exit)' },
68
68
  { id: 'exit-seam', what: 'ctx.appExit (provideCmdline exit) goes to the TUI\'s exit funnel through ProcessExitSeam first, and to the reproduced shutdown only when the funnel refuses (prepareHostRoot exitSeam)' },
69
69
  { id: 'fail-loud-removable', what: 'installFailLoud\'s uninstaller is kept and called once apply() returned and processGuardActive() (host-entry.ts): from then on the TUI\'s process guard is the single owner of a fatal error; DSH_TUI_NO_185_PROCESS_GUARD=1 keeps fail-loud (verify-entry-process-exit)' },
70
+ { id: 'no-startup-composition', what: 'boot\'s 0.2.2 captureStartupComposition (StartupError.composition) is not reproduced: the capture is not exported and runs before teardown, which only boot owns. The entry composes the profile itself and writes its own startup report instead (verify-host-contract pins the fingerprint; re-check this deviation when the symbol changes)' },
70
71
  { id: 'startup-report-always', what: 'bin.js saves a report for a StartupError only and lets other startup errors crash; the entry saves one for every composition failure (HostComposeError carries the path) because the screen stays up' },
71
72
  { id: 'startup-report-no-terminal', what: 'reportStartupFailure\'s terminal half is not reproduced: the screen is up, the failure row names the report' },
72
73
  { id: 'no-overlays', what: '--patch overlays, --from-default-profile and resolvedProfile are not reproduced (the launcher passes none)' },
73
74
  { id: 'defer-root-guard', what: 'deferRootCapabilityGuard(root) (host-access.ts) keeps the TUI\'s root-capability guard off from the entry\'s binding of the root through the screen\'s mount; armRootCapabilityGuard then lets the first TUI row activation install it, as on the profile path, and the composition\'s settling installs it if no TUI row activated. Installing the guard also materializes the root-owned `invocation` accessor dsh-typert-protocol otherwise registers from the first Remote service, so a dsh-base row that resumes after the first TUI row (issue #1616) still activates; the guard itself is unchanged (verify-plugin-lifecycle)' },
74
75
  { id: 'report-exclude-network', what: 'host-entry.ts sets process.report.excludeNetwork = true for the process: DSH\'s flock libc probe (process.report.getReport) otherwise blocked ~10s on reverse lookups of sockets the mounted screen already opened' },
76
+ { id: 'process-name', what: 'host-entry.ts names the process dsh-tui right after start (#1831) by writing /proc/self/comm on Linux: Node leaves the thread group leader as "MainThread", which is what ps -o comm, top and desktop process monitors show, while `dsh --profile` keeps the inherited name; argv is left alone, so cmdline still names the entry script (verify-entry-process-exit)' },
75
77
  { id: 'hijack-before-tui', what: 'the host\'s PluginPackages resolution is installed before any TUI module loads, for both kernels; runProfile installs it inside boot()\'s prepare' },
76
78
  { id: 'kernel-after-discovery', what: 'prepareHostRoot first supplies only the neutral Loader/resolution root; after backend assembly, HostRoot.selectKernel prepares DSH-only proxy, failure handlers and services from the same final kernel the entry uses for its slot and composition' },
77
79
  ];
@@ -14,6 +14,8 @@ type AppBootModule = Pick<typeof AppBoot, ContractExports<'appBoot'>>;
14
14
  /** `@deepseek-ai/dsh/profile-boot`, declared locally: the host CLI is not a dependency. */
15
15
  interface ProfileBootModule {
16
16
  prepareProfile(name: string, userLayer?: boolean, fromDefaultProfile?: string): AppBoot.Profile;
17
+ /** Added in 0.2.2-rc.2; older hosts keep their existing attribution. */
18
+ userAgentProfile?(name: string): string;
17
19
  readonly INSTALL_ANCHOR: string;
18
20
  readonly PROFILE_ROOT_FILENAME: 'cordis.yml';
19
21
  }
@@ -93,14 +95,6 @@ export interface PrepareHostRootOptions {
93
95
  /** Routes `ctx.appExit(code)` to the TUI's exit funnel; the bounded `shutdown` when unfilled or refused. */
94
96
  readonly exitSeam?: ProcessExitSeam;
95
97
  }
96
- /**
97
- * Build the entry's root from the host's `cordis` and install the host's
98
- * module resolution on it before any TUI module is imported, so the TUI and
99
- * the DSH plugins resolve shared packages (react, schemastery, the
100
- * `@deepseek-ai/*` peers) the same way. Both kernels: otherwise the peers
101
- * resolve only through `$DSH_HOME/profiles/node_modules`, which a fresh
102
- * install may not have. The DSH kernel also gets the rest of `runProfile`'s prepare.
103
- */
104
98
  export declare function prepareHostRoot(host: HostDsh, options: PrepareHostRootOptions): Promise<HostRoot>;
105
99
  /** A composition failure, with the startup report saved for it. */
106
100
  export declare class HostComposeError extends Error {
@@ -1 +1 @@
1
- {"version":3,"file":"host-dsh.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/host-dsh.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,KAAK,OAAO,MAAM,2BAA2B,CAAA;AACzD,OAAO,KAAK,KAAK,SAAS,MAAM,6BAA6B,CAAA;AAC7D,OAAO,KAAK,KAAK,OAAO,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,KAAK,SAAS,MAAM,6BAA6B,CAAA;AAE7D,OAAO,EAAE,YAAY,EAAgB,MAAM,oBAAoB,CAAA;AAE/D,OAAO,EAA+B,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAOrF,KAAK,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;AAElC,sGAAsG;AACtG,KAAK,eAAe,CAAC,CAAC,SAAS,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,YAAY,C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WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,yBAAyB;IACzB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IAChC,4GAA4G;IAC5G,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAA;CACpC;AAuBD,wBAAsB,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAqJvG;AAED,mEAAmE;AACnE,qBAAa,gBAAiB,SAAQ,KAAK;IAE7B,QAAQ,CAAC,QAAQ,EAAE,OAAO;IADtC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;gBACf,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS;CAKpE"}
@@ -12,6 +12,7 @@ import { createRequire } from 'node:module';
12
12
  import { basename, delimiter, dirname, join, posix, win32 } from 'node:path';
13
13
  import { pathToFileURL } from 'node:url';
14
14
  import { inspect } from 'node:util';
15
+ import { compareVersions, parseUpstreamVersion } from './contract.js';
15
16
  import { HOST_MODULES, HOST_PACKAGE } from './host-contract.js';
16
17
  import { LITE_PROFILE_EXCLUDED_BUNDLES, liteProfilePlan } from './lite-profile.js';
17
18
  import { PROCESS_SHUTDOWN_TIMEOUT_MS } from './process-exit.js';
@@ -221,6 +222,19 @@ export async function loadHostDsh(packageDir = undefined) {
221
222
  * resolve only through `$DSH_HOME/profiles/node_modules`, which a fresh
222
223
  * install may not have. The DSH kernel also gets the rest of `runProfile`'s prepare.
223
224
  */
225
+ /** Whether the loaded kernel predates `minimum` (unparseable counts as current). */
226
+ function kernelBefore(host, minimum) {
227
+ let version;
228
+ try {
229
+ version = host.appBoot.getDshRuntimeVersion();
230
+ }
231
+ catch {
232
+ version = undefined;
233
+ }
234
+ const installed = parseUpstreamVersion(version);
235
+ const floor = parseUpstreamVersion(minimum);
236
+ return installed !== undefined && floor !== undefined && compareVersions(installed, floor) < 0;
237
+ }
224
238
  export async function prepareHostRoot(host, options) {
225
239
  const { appBoot, profileBoot } = host;
226
240
  // bin.js: the `.env` layers fill unset variables before anything reads them
@@ -235,9 +249,16 @@ export async function prepareHostRoot(host, options) {
235
249
  const ctx = new host.Context();
236
250
  ctx.baseUrl = pathToFileURL(dirname(rootConfig)).href + '/';
237
251
  ctx.provide('dshHomePath', host.homePaths.dshHomePath);
238
- ctx.on('internal/update', ((_config, _noSave, next) => {
239
- Promise.resolve(next()).catch((error) => { ctx.logger.error(error); });
240
- }), { global: true, prepend: true });
252
+ // `boot` registered this hook until 0.2.1: a live profile reload's failures
253
+ // were swallowed instead of escaping into the TUI. 0.2.2 dropped it when the
254
+ // waterfall became `(resolvedConfig, next)` and started awaiting the restart
255
+ // itself; registering the old three-argument handler there would pass `next`
256
+ // as `noSave` and leave the restart unawaited.
257
+ if (kernelBefore(host, '0.2.2-rc.1')) {
258
+ ctx.on('internal/update', ((_config, _noSave, next) => {
259
+ Promise.resolve(next()).catch((error) => { ctx.logger.error(error); });
260
+ }), { global: true, prepend: true });
261
+ }
241
262
  await ctx.plugin(host.Loader, undefined);
242
263
  const shutdown = createProcessShutdown(() => ctx.fiber.dispose());
243
264
  const appReady = createAppReady();
@@ -273,6 +294,9 @@ export async function prepareHostRoot(host, options) {
273
294
  // uses the same final answer for its slot and for this composition mode.
274
295
  try {
275
296
  if (dsh) {
297
+ if (typeof profileBoot.userAgentProfile === 'function') {
298
+ process.env.DSH_USER_AGENT_SUFFIX = `dsh-profile/${profileBoot.userAgentProfile(options.profile)}`;
299
+ }
276
300
  const disposeProxy = await host.httpProxy.installProxyFromEnvironment(environment, message => { process.stderr.write(`${BIN_NAME}: ${message}\n`); });
277
301
  if (disposeProxy !== undefined)
278
302
  ctx.effect(() => () => { void Promise.resolve(disposeProxy()).catch(() => undefined); }, 'dsh-tui host proxy');
@@ -391,7 +415,7 @@ function hostVersion(host) {
391
415
  }
392
416
  }
393
417
  /**
394
- * dsh `bin.js` reportStartupFailure (0.2.1-rc.5), the file half only: the
418
+ * dsh `bin.js` reportStartupFailure (0.2.2-rc.1), the file half only: the
395
419
  * screen is up, so never stderr. Undefined when it could not be written.
396
420
  */
397
421
  async function writeStartupReport(error, context) {
@@ -425,7 +449,7 @@ async function writeStartupReport(error, context) {
425
449
  }
426
450
  return logPath;
427
451
  }
428
- /** dsh `profile-boot` createAppReady (0.2.1-rc.5). */
452
+ /** dsh `profile-boot` createAppReady (0.2.2-rc.1). */
429
453
  function createAppReady() {
430
454
  let ready = false;
431
455
  const listeners = new Set();
@@ -450,7 +474,7 @@ function createAppReady() {
450
474
  },
451
475
  };
452
476
  }
453
- /** dsh `process-shutdown` createProcessShutdown (0.2.1-rc.5), the `shutdown` half only. */
477
+ /** dsh `process-shutdown` createProcessShutdown (0.2.2-rc.1), the `shutdown` half only. */
454
478
  function createProcessShutdown(dispose, timeoutMs = PROCESS_SHUTDOWN_TIMEOUT_MS) {
455
479
  let pending;
456
480
  let settled = false;
@@ -12,12 +12,16 @@ import { configuredBackend, delegatesToProfile, entryKernel, hostProfile } from
12
12
  import { HANDOFF_ACK_FD_ENV } from '../handoffAck.js';
13
13
  import { HOST_NOTICE_ENV } from '../kernelPrefs.js';
14
14
  import { logForDebugging } from '../utils/debug.js';
15
+ import { setProcessName } from '../utils/processName.js';
15
16
  import { cmdEscapeArgument } from '../utils/shellQuote.js';
16
17
  import { ENTRY_ROW_DEFAULTS } from './lite-profile.js';
17
18
  import { HostComposeError, loadHostDsh, NO_DSH_ON_PATH, prepareHostRoot } from './host-dsh.js';
18
19
  import { installEntrySignals } from './process-exit.js';
19
20
  import { disposeRootSettled, trackComposition } from './root-dispose.js';
20
21
  markBoot('entry-start');
22
+ // #1831: process listings show the inherited main-thread name ("MainThread");
23
+ // the process that becomes the screen names itself as early as it can.
24
+ setProcessName('dsh-tui');
21
25
  // DSH's native flock loader reads `process.report.getReport()`; with sockets
22
26
  // already open, the network section's reverse lookups block the event loop.
23
27
  if (process.report !== undefined)
@@ -170,11 +170,19 @@ export interface Config {
170
170
  * a ~30fps reveal instead of jumping per provider burst — bursty or
171
171
  * one-shot deliveries read as an even flow. On by default. */
172
172
  smoothStreaming?: boolean;
173
- /** Successful task notifications: off, unfocused (default), or always. */
173
+ /** System notifications for successful task completions, waiting
174
+ * approvals, waiting questions and waiting plan reviews: off, unfocused
175
+ * (default), or always. */
174
176
  taskNotifications?: TaskNotifications;
175
177
  /** Notification transport: auto (default), OSC 9, BEL, or the native Windows
176
178
  * toast, which off Windows resolves back to the probed terminal protocol. */
177
179
  notificationMethod?: NotificationMethod;
180
+ /** Jump back from notification toasts (settings `dsh-tui.jumpBack`): on
181
+ * Windows the pane title gains a ` [dsh-tui:<16 hex>]` suffix so a toast can
182
+ * reopen this exact pane; enabling also registers a per-user HKCU protocol
183
+ * key on the first toast. Off by default — the title stays untouched and
184
+ * nothing is registered. */
185
+ jumpBack?: boolean;
178
186
  /** Mermaid diagrams (settings `dsh-tui.mermaidDiagrams`): ```mermaid
179
187
  * fences in replies render as Unicode box-drawing art — flowcharts,
180
188
  * sequence/state/class/ER diagrams, pie, mindmap, timeline, gitGraph —
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,MAAM,MAAM,0BAA0B,CAAA;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAE5F,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACxE,OAAO,EAA2Q,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,KAAK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EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BtF;AAqCD,OAAO,EACL,OAAO,EACP,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,KAAK,oBAAoB,EACzB,KAAK,WAAW,GACjB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC3G,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA"}
@@ -85,6 +85,11 @@ export const Config = editableConfig(Schema.object({
85
85
  smoothStreaming: Schema.boolean().default(true),
86
86
  taskNotifications: Schema.union(['off', 'unfocused', 'always']),
87
87
  notificationMethod: Schema.union(['auto', 'osc9', 'bel', 'windows']),
88
+ // No `.default()` on purpose (same rule as recapOnOpen): an unset key must
89
+ // stay distinguishable from an explicit `false` so cordis.yml keeps the
90
+ // deciding vote; the setting parser resolves `value.jumpBack ??
91
+ // config.jumpBack ?? false` at the read site.
92
+ jumpBack: Schema.boolean(),
88
93
  mermaidDiagrams: Schema.boolean().default(true),
89
94
  codeFrameStyle: Schema.union(['light', 'full']),
90
95
  mathRendering: Schema.union(['auto', 'image', 'unicode', 'source']),
@@ -0,0 +1,73 @@
1
+ import type { AccountClientMetadata } from '@deepseek-ai/dsh-deepseek-account';
2
+ /** Structural public rc.2 protocol; older hosts do not export its types. */
3
+ export interface AccountNotificationNotice {
4
+ readonly kind: 'account-notification';
5
+ readonly orderId: string;
6
+ readonly title: string;
7
+ readonly body: string;
8
+ readonly displayUntil: string | null;
9
+ readonly amount?: string;
10
+ readonly currency?: 'CNY' | 'USD';
11
+ readonly expiresAt?: string;
12
+ readonly actions: readonly {
13
+ readonly label: string;
14
+ readonly style: 'primary' | 'secondary';
15
+ readonly target: {
16
+ readonly type: 'dismiss';
17
+ } | {
18
+ readonly type: 'app_route';
19
+ readonly name: 'account';
20
+ };
21
+ }[];
22
+ }
23
+ interface NotificationContent extends Omit<AccountNotificationNotice, 'kind' | 'orderId'> {
24
+ readonly id: string;
25
+ readonly data?: unknown;
26
+ }
27
+ export interface AccountNotifications {
28
+ getNotifications(client: AccountClientMetadata): Promise<{
29
+ readonly nextPollAfterSeconds: number;
30
+ readonly notifications: readonly NotificationContent[];
31
+ } | null>;
32
+ getNotificationContent(id: string, client: AccountClientMetadata): Promise<NotificationContent | null>;
33
+ reportNotificationEvent(id: string, event: 'displayed' | 'cta_clicked' | 'dismissed', client: AccountClientMetadata): Promise<boolean>;
34
+ }
35
+ export declare function accountNotificationsOf(account: unknown): AccountNotifications | undefined;
36
+ /** Account-owned cards: reads never acknowledge; only the presented card reports display. */
37
+ export declare class AccountNotificationStore {
38
+ private readonly changed;
39
+ private readonly diagnose;
40
+ private account;
41
+ private generation;
42
+ private pollEpoch;
43
+ private localeGeneration;
44
+ private timer;
45
+ private expiryTimer;
46
+ private intervalMs;
47
+ private cards;
48
+ private readonly displayed;
49
+ private readonly pendingDismissals;
50
+ private localeRefresh;
51
+ constructor(changed: () => void, diagnose?: (operation: 'read' | 'content' | 'report') => void);
52
+ getSnapshot(): AccountNotificationNotice | null;
53
+ begin(account: AccountNotifications): void;
54
+ /** Explicit refresh uses the same generation fence and server-paced poll. */
55
+ refresh(account: AccountNotifications): Promise<void>;
56
+ clear(): void;
57
+ /** A language change refreshes content without consuming it or changing card order. */
58
+ localeChanged(): Promise<void>;
59
+ /** A poll finished with copy from before a language change: reuse an
60
+ * in-flight refresh instead of invalidating its successful request. */
61
+ private staleLocaleRefresh;
62
+ private startLocaleRefresh;
63
+ private refreshLocale;
64
+ shown(id: string): void;
65
+ dismiss(id: string): void;
66
+ private report;
67
+ private dropExpired;
68
+ private publish;
69
+ private scheduleExpiry;
70
+ private poll;
71
+ }
72
+ export {};
73
+ //# sourceMappingURL=account-notifications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-notifications.d.ts","sourceRoot":"","sources":["../../../../src/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OAAO,CAAC,IAAI,CAAC;IAM9B;2EACuE;IACvE,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,kBAAkB;YAQZ,aAAa;IAkB3B,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAOvB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAoBzB,OAAO,CAAC,MAAM;IAMd,OAAO,CAAC,WAAW;IAEnB,OAAO,CAAC,OAAO;IAef,OAAO,CAAC,cAAc;YAkBR,IAAI;CAmDnB"}
@@ -0,0 +1,250 @@
1
+ import { deepSeekClientMetadata } from './deepseek.js';
2
+ export function accountNotificationsOf(account) {
3
+ const value = account;
4
+ return typeof value?.getNotifications === 'function'
5
+ && typeof value.getNotificationContent === 'function'
6
+ && typeof value.reportNotificationEvent === 'function' ? value : undefined;
7
+ }
8
+ const expired = (notice) => notice.displayUntil !== null
9
+ && Date.parse(notice.displayUntil) <= Date.now();
10
+ // Preserve the existing coupon presentation only for explicit complete data.
11
+ // These optional business fields are not inferred from localized server copy.
12
+ function couponFields(data) {
13
+ if (data === null || typeof data !== 'object' || Array.isArray(data))
14
+ return {};
15
+ const value = data;
16
+ const expiresAt = value.expiresAt ?? value.expires_at;
17
+ return value.campaign === 'dsh_login_bonus' && typeof value.amount === 'string'
18
+ && (value.currency === 'CNY' || value.currency === 'USD') && typeof expiresAt === 'string'
19
+ && (Number.isNaN(Date.parse(expiresAt)) || Date.parse(expiresAt) > Date.now())
20
+ ? { amount: value.amount, currency: value.currency, expiresAt } : {};
21
+ }
22
+ const noticeOf = (content) => ({
23
+ kind: 'account-notification', orderId: content.id, title: content.title,
24
+ body: content.body, displayUntil: content.displayUntil, actions: content.actions,
25
+ ...couponFields(content.data),
26
+ });
27
+ /** Account-owned cards: reads never acknowledge; only the presented card reports display. */
28
+ export class AccountNotificationStore {
29
+ changed;
30
+ diagnose;
31
+ account;
32
+ generation = 0;
33
+ pollEpoch = 0;
34
+ localeGeneration = 0;
35
+ timer;
36
+ expiryTimer;
37
+ intervalMs = 600_000;
38
+ cards = [];
39
+ displayed = new Set();
40
+ pendingDismissals = new Map();
41
+ localeRefresh;
42
+ constructor(changed, diagnose = () => { }) {
43
+ this.changed = changed;
44
+ this.diagnose = diagnose;
45
+ }
46
+ getSnapshot() { return this.cards[0] ?? null; }
47
+ begin(account) {
48
+ if (this.account === account)
49
+ return;
50
+ this.clear();
51
+ this.account = account;
52
+ void this.poll(this.generation);
53
+ }
54
+ /** Explicit refresh uses the same generation fence and server-paced poll. */
55
+ async refresh(account) {
56
+ if (this.account !== account) {
57
+ this.clear();
58
+ this.account = account;
59
+ }
60
+ else {
61
+ this.generation++;
62
+ if (this.timer !== undefined)
63
+ clearTimeout(this.timer);
64
+ this.timer = undefined;
65
+ }
66
+ await this.poll(this.generation);
67
+ }
68
+ clear() {
69
+ this.generation++;
70
+ this.localeGeneration++;
71
+ if (this.timer !== undefined)
72
+ clearTimeout(this.timer);
73
+ if (this.expiryTimer !== undefined)
74
+ clearTimeout(this.expiryTimer);
75
+ this.timer = undefined;
76
+ this.expiryTimer = undefined;
77
+ this.account = undefined;
78
+ this.intervalMs = 600_000;
79
+ this.displayed.clear();
80
+ this.pendingDismissals.clear();
81
+ this.localeRefresh = undefined;
82
+ this.publish([]);
83
+ }
84
+ /** A language change refreshes content without consuming it or changing card order. */
85
+ localeChanged() {
86
+ // An explicit language change always fetches again: a rapid second switch
87
+ // must not reuse copy fetched for the previous language.
88
+ return this.startLocaleRefresh();
89
+ }
90
+ /** A poll finished with copy from before a language change: reuse an
91
+ * in-flight refresh instead of invalidating its successful request. */
92
+ staleLocaleRefresh() {
93
+ return this.localeRefresh ?? this.startLocaleRefresh();
94
+ }
95
+ startLocaleRefresh() {
96
+ const run = this.refreshLocale();
97
+ this.localeRefresh = run;
98
+ const settle = () => { if (this.localeRefresh === run)
99
+ this.localeRefresh = undefined; };
100
+ void run.then(settle, settle);
101
+ return run;
102
+ }
103
+ async refreshLocale() {
104
+ const account = this.account;
105
+ if (account === undefined)
106
+ return;
107
+ const generation = this.generation;
108
+ const localeGeneration = ++this.localeGeneration;
109
+ const updates = await Promise.allSettled(this.cards.map(card => account.getNotificationContent(card.orderId, deepSeekClientMetadata())));
110
+ if (generation !== this.generation || localeGeneration !== this.localeGeneration)
111
+ return;
112
+ if (updates.some(update => update.status === 'rejected'))
113
+ this.diagnose('content');
114
+ const byId = new Map(updates.flatMap(update => update.status === 'fulfilled' && update.value !== null
115
+ ? [[update.value.id, noticeOf(update.value)]] : []));
116
+ this.publish(this.cards.map(card => {
117
+ const content = byId.get(card.orderId);
118
+ // Like the public controller, content refresh changes localized copy
119
+ // only. The list owns deadlines and optional business metadata.
120
+ return content === undefined ? card : { ...card, title: content.title, body: content.body, actions: content.actions };
121
+ }).filter(card => !expired(card)));
122
+ }
123
+ shown(id) {
124
+ this.dropExpired();
125
+ if (this.cards[0]?.orderId !== id || this.displayed.has(id))
126
+ return;
127
+ this.displayed.add(id);
128
+ void this.report(id, 'displayed');
129
+ }
130
+ dismiss(id) {
131
+ this.dropExpired();
132
+ if (this.cards[0]?.orderId !== id)
133
+ return;
134
+ // A poll issued before this dismissal must not publish its stale reply:
135
+ // the closed card would reappear and report `displayed` again. Expiry and
136
+ // account cleanup fence polls through `generation`; a dismissal keeps the
137
+ // same account lifetime, so it needs its own fence.
138
+ this.pollEpoch++;
139
+ // Until the server processes the dismissal it may keep offering the id;
140
+ // suppress that id so a fast poll cannot reopen the closed card. Fence
141
+ // cleanup to this report: an older report that finishes after a newer
142
+ // dismissal of the same id must not clear the newer fence.
143
+ const token = Symbol(id);
144
+ this.pendingDismissals.set(id, token);
145
+ void this.report(id, 'dismissed').finally(() => {
146
+ if (this.pendingDismissals.get(id) === token)
147
+ this.pendingDismissals.delete(id);
148
+ });
149
+ this.publish(this.cards.slice(1));
150
+ }
151
+ report(id, event) {
152
+ // Server acceptance controls consumption; a failed report never fabricates success.
153
+ return this.account?.reportNotificationEvent(id, event, deepSeekClientMetadata())
154
+ .catch(() => { this.diagnose('report'); return false; }) ?? Promise.resolve(false);
155
+ }
156
+ dropExpired() { this.publish(this.cards.filter(card => !expired(card))); }
157
+ publish(cards) {
158
+ // Preserve React external-store snapshot identity for unchanged server copies.
159
+ const previous = new Map(this.cards.map(card => [card.orderId, card]));
160
+ cards = cards.map(card => {
161
+ const old = previous.get(card.orderId);
162
+ return old !== undefined && JSON.stringify(old) === JSON.stringify(card) ? old : card;
163
+ });
164
+ if (cards.length === this.cards.length && cards.every((card, index) => card === this.cards[index]))
165
+ return;
166
+ const ids = new Set(cards.map(card => card.orderId));
167
+ for (const id of this.displayed)
168
+ if (!ids.has(id))
169
+ this.displayed.delete(id);
170
+ this.cards = cards;
171
+ this.scheduleExpiry();
172
+ this.changed();
173
+ }
174
+ scheduleExpiry() {
175
+ if (this.expiryTimer !== undefined)
176
+ clearTimeout(this.expiryTimer);
177
+ this.expiryTimer = undefined;
178
+ const deadlines = this.cards.flatMap(card => {
179
+ const at = card.displayUntil === null ? NaN : Date.parse(card.displayUntil);
180
+ return Number.isFinite(at) ? [at] : [];
181
+ });
182
+ if (deadlines.length > 0) {
183
+ this.expiryTimer = setTimeout(() => {
184
+ this.expiryTimer = undefined;
185
+ this.dropExpired();
186
+ // A capped timer can wake before the deadline while polling is pending.
187
+ this.scheduleExpiry();
188
+ }, Math.min(2_147_483_647, Math.max(1, Math.min(...deadlines) - Date.now())));
189
+ this.expiryTimer.unref?.();
190
+ }
191
+ }
192
+ async poll(generation) {
193
+ const account = this.account;
194
+ if (account === undefined || generation !== this.generation)
195
+ return;
196
+ const localeGeneration = this.localeGeneration;
197
+ const epoch = this.pollEpoch;
198
+ try {
199
+ const batch = await account.getNotifications(deepSeekClientMetadata());
200
+ if (generation !== this.generation)
201
+ return;
202
+ if (batch !== null) {
203
+ // The server owns the cadence even when a dismissal retires the card
204
+ // content below; honour a changed interval before the epoch gate.
205
+ const requestedDelay = batch.nextPollAfterSeconds * 1000;
206
+ if (Number.isFinite(requestedDelay) && requestedDelay > 0)
207
+ this.intervalMs = Math.min(requestedDelay, 2_147_483_647);
208
+ // A dismissal during the read retires this reply; keep polling on the
209
+ // server-provided interval instead of resurrecting the closed card.
210
+ if (epoch === this.pollEpoch) {
211
+ const current = new Map(this.cards.map(card => [card.orderId, card]));
212
+ const offered = batch.notifications.map(content => {
213
+ const card = noticeOf(content);
214
+ const translated = current.get(card.orderId);
215
+ // An in-flight poll carries its original locale. Keep newer copy even
216
+ // if the follow-up content refresh fails; server expiry remains current.
217
+ return localeGeneration !== this.localeGeneration && translated !== undefined
218
+ ? { ...card, title: translated.title, body: translated.body, actions: translated.actions }
219
+ : card;
220
+ }).filter(card => !this.pendingDismissals.has(card.orderId));
221
+ const candidates = offered.filter(card => !expired(card));
222
+ const foreground = this.cards[0];
223
+ // The backend may consume on displayed. Keep the already-presented card
224
+ // until explicit dismissal or expiry, not until the next polling reply.
225
+ // A same-ID response can explicitly shorten its deadline. Only an
226
+ // omitted card keeps its old metadata; an expired offer must retire it.
227
+ const refreshed = foreground === undefined ? undefined
228
+ : offered.find(card => card.orderId === foreground.orderId) ?? foreground;
229
+ const retained = refreshed !== undefined && this.displayed.has(refreshed.orderId) && !expired(refreshed)
230
+ ? refreshed : undefined;
231
+ this.publish(retained === undefined ? candidates : [retained, ...candidates.filter(card => card.orderId !== retained.orderId)]);
232
+ // Never make the next poll wait for localized copy: a pending
233
+ // content request must not stall notification delivery.
234
+ if (localeGeneration !== this.localeGeneration)
235
+ void this.staleLocaleRefresh();
236
+ }
237
+ }
238
+ }
239
+ catch {
240
+ if (generation === this.generation)
241
+ this.diagnose('read');
242
+ // Keep visible content; retry only at the server-provided interval.
243
+ }
244
+ if (generation !== this.generation)
245
+ return;
246
+ this.dropExpired();
247
+ this.timer = setTimeout(() => { void this.poll(generation); }, this.intervalMs);
248
+ this.timer.unref?.();
249
+ }
250
+ }
@@ -1,12 +1,27 @@
1
- import type { DeepSeekAccount, AccountBonusOrderId, AccountUserId } from '@deepseek-ai/dsh-deepseek-account';
1
+ import type { AccountClientMetadata, AccountUserId } from '@deepseek-ai/dsh-deepseek-account';
2
+ import { type AccountNotificationNotice, type AccountNotifications } from './account-notifications.js';
2
3
  export interface WhaleCouponNotice {
3
- readonly accountId: AccountUserId;
4
- readonly orderId: AccountBonusOrderId;
4
+ readonly kind?: undefined;
5
+ readonly accountId?: AccountUserId;
6
+ readonly orderId: string;
5
7
  readonly amount: string;
6
8
  readonly currency: 'CNY' | 'USD';
7
9
  readonly expiresAt: string;
8
10
  }
9
- type BonusAccount = Pick<DeepSeekAccount, 'getUnnotifiedBonuses' | 'ackBonusNotified'>;
11
+ /** The pre-0.2.2-rc.2 bonus API; newer hosts expose a different notification protocol. */
12
+ export interface LegacyBonusAccount {
13
+ getUnnotifiedBonuses(client: AccountClientMetadata): Promise<{
14
+ readonly accountId: AccountUserId;
15
+ readonly bonuses: readonly {
16
+ readonly orderId: string;
17
+ readonly campaign?: unknown;
18
+ readonly amount?: unknown;
19
+ readonly currency?: unknown;
20
+ readonly expiresAt: string;
21
+ }[];
22
+ } | null>;
23
+ ackBonusNotified(accountId: AccountUserId, orderId: string, client: AccountClientMetadata): Promise<boolean>;
24
+ }
10
25
  /** TUI-only presentation of a Platform-confirmed login grant. */
11
26
  export declare class WhaleCouponStore {
12
27
  private readonly listeners;
@@ -14,14 +29,24 @@ export declare class WhaleCouponStore {
14
29
  private notice;
15
30
  private account;
16
31
  private generation;
32
+ private notificationOwner;
33
+ private readonly notifications;
34
+ constructor(diagnose?: (operation: 'read' | 'content' | 'report') => void);
17
35
  readonly subscribe: (listener: () => void) => (() => void);
18
- readonly getSnapshot: () => WhaleCouponNotice | null;
19
- refresh(account: BonusAccount): Promise<void>;
36
+ readonly getSnapshot: () => WhaleCouponNotice | AccountNotificationNotice | null;
37
+ /** New hosts provide server-authored cards instead of structured login bonuses. */
38
+ refreshNotifications(account: AccountNotifications): void;
39
+ /** An obsolete injected plugin must not clear or publish for its successor. */
40
+ claimNotificationOwner(): {
41
+ current: () => boolean;
42
+ dispose: () => void;
43
+ };
44
+ notificationLocaleChanged(): Promise<void>;
45
+ refresh(value: unknown): Promise<void>;
20
46
  /** Called only after the modal has painted; a read alone never acknowledges. */
21
- shown(orderId: AccountBonusOrderId): void;
22
- dismiss(orderId: AccountBonusOrderId): void;
47
+ shown(orderId: string, expected?: WhaleCouponNotice | AccountNotificationNotice): void;
48
+ dismiss(orderId: string, expected?: WhaleCouponNotice | AccountNotificationNotice): void;
23
49
  clear(): void;
24
50
  private emit;
25
51
  }
26
- export {};
27
52
  //# sourceMappingURL=bonus.d.ts.map