@deepseek-harness-tui/dsh-tui 0.17.0 → 0.19.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 +43 -16
  2. package/bin/dsh-tui.js +46 -3
  3. package/cli/adapters/dsh/index.mjs +2 -2
  4. package/guide/dsh-tui-guide/cli.en.md +1 -1
  5. package/guide/dsh-tui-guide/cli.md +1 -1
  6. package/guide/dsh-tui-guide/codex-backend.en.md +2 -2
  7. package/guide/dsh-tui-guide/codex-backend.md +2 -2
  8. package/guide/dsh-tui-guide/configuration.en.md +8 -2
  9. package/guide/dsh-tui-guide/configuration.md +8 -2
  10. package/guide/dsh-tui-guide/getting-started.en.md +174 -6
  11. package/guide/dsh-tui-guide/getting-started.md +125 -15
  12. package/guide/dsh-tui-guide/interaction.en.md +30 -8
  13. package/guide/dsh-tui-guide/interaction.md +18 -5
  14. package/guide/dsh-tui-guide/plugins.en.md +28 -7
  15. package/guide/dsh-tui-guide/plugins.md +18 -5
  16. package/guide/dsh-tui-guide/user-guide.en.md +32 -17
  17. package/guide/dsh-tui-guide/user-guide.md +23 -12
  18. package/lib/settings.json +3 -3
  19. package/lib/types/adapter/channel/ui-policy.d.ts +1 -0
  20. package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
  21. package/lib/types/adapter/channel/ui-policy.js +1 -0
  22. package/lib/types/adapter/ports/channel-ui.d.ts +10 -2
  23. package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
  24. package/lib/types/adapter/ports/channel-view.d.ts +31 -5
  25. package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
  26. package/lib/types/adapter/standard/grants.d.ts +60 -0
  27. package/lib/types/adapter/standard/grants.d.ts.map +1 -1
  28. package/lib/types/adapter/standard/grants.js +74 -0
  29. package/lib/types/agent/events.d.ts +16 -3
  30. package/lib/types/agent/events.d.ts.map +1 -1
  31. package/lib/types/agent/session.d.ts +5 -0
  32. package/lib/types/agent/session.d.ts.map +1 -1
  33. package/lib/types/backends/claude/translate/core.d.ts +2 -2
  34. package/lib/types/backends/claude/translate/core.d.ts.map +1 -1
  35. package/lib/types/backends/claude/translate/core.js +10 -6
  36. package/lib/types/backends/codex/session/commands.d.ts +2 -0
  37. package/lib/types/backends/codex/session/commands.d.ts.map +1 -1
  38. package/lib/types/backends/codex/session/commands.js +8 -4
  39. package/lib/types/backends/codex/session/input.d.ts +11 -7
  40. package/lib/types/backends/codex/session/input.d.ts.map +1 -1
  41. package/lib/types/backends/codex/session/input.js +68 -15
  42. package/lib/types/backends/codex/session/session.d.ts.map +1 -1
  43. package/lib/types/backends/codex/session/session.js +2 -3
  44. package/lib/types/channel/projection.d.ts.map +1 -1
  45. package/lib/types/channel/projection.js +78 -10
  46. package/lib/types/channel/questions.d.ts +19 -3
  47. package/lib/types/channel/questions.d.ts.map +1 -1
  48. package/lib/types/channel/sanitize.d.ts.map +1 -1
  49. package/lib/types/channel/sanitize.js +8 -4
  50. package/lib/types/channel/subagent-failure.d.ts +49 -0
  51. package/lib/types/channel/subagent-failure.d.ts.map +1 -0
  52. package/lib/types/channel/subagent-failure.js +59 -0
  53. package/lib/types/channel/transcript.d.ts +17 -0
  54. package/lib/types/channel/transcript.d.ts.map +1 -1
  55. package/lib/types/channel/transcript.js +35 -0
  56. package/lib/types/commands.js +2 -2
  57. package/lib/types/components/GoalTodoPanel.d.ts +71 -6
  58. package/lib/types/components/GoalTodoPanel.d.ts.map +1 -1
  59. package/lib/types/components/GoalTodoPanel.js +165 -17
  60. package/lib/types/components/MessageList.d.ts.map +1 -1
  61. package/lib/types/components/MessageList.js +14 -9
  62. package/lib/types/components/PluginGrantList.d.ts +45 -0
  63. package/lib/types/components/PluginGrantList.d.ts.map +1 -0
  64. package/lib/types/components/PluginGrantList.js +126 -0
  65. package/lib/types/components/PluginInstallPane.d.ts.map +1 -1
  66. package/lib/types/components/PluginInstallPane.js +35 -6
  67. package/lib/types/components/PluginManagePane.d.ts.map +1 -1
  68. package/lib/types/components/PluginManagePane.js +65 -8
  69. package/lib/types/components/PromptInput.d.ts.map +1 -1
  70. package/lib/types/components/PromptInput.js +63 -8
  71. package/lib/types/components/SubagentDashboard.d.ts.map +1 -1
  72. package/lib/types/components/SubagentDashboard.js +17 -1
  73. package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
  74. package/lib/types/components/SubagentDetailScene.js +12 -0
  75. package/lib/types/components/messages/AssistantToolUseMessage.d.ts +2 -1
  76. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  77. package/lib/types/components/messages/AssistantToolUseMessage.js +16 -7
  78. package/lib/types/components/onboardingModel.d.ts +2 -2
  79. package/lib/types/components/onboardingModel.js +3 -3
  80. package/lib/types/components/onboardingProviderPlan.d.ts +110 -0
  81. package/lib/types/components/onboardingProviderPlan.d.ts.map +1 -0
  82. package/lib/types/components/onboardingProviderPlan.js +78 -0
  83. package/lib/types/components/questions/AskUserQuestionPanel.d.ts +5 -8
  84. package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
  85. package/lib/types/components/questions/AskUserQuestionPanel.js +7 -4
  86. package/lib/types/components/questions/PlanReviewPanel.d.ts +3 -6
  87. package/lib/types/components/questions/PlanReviewPanel.d.ts.map +1 -1
  88. package/lib/types/components/revealScope.d.ts +15 -0
  89. package/lib/types/components/revealScope.d.ts.map +1 -0
  90. package/lib/types/components/revealScope.js +17 -0
  91. package/lib/types/components/sidePanel/btw/BtwComposer.d.ts +41 -1
  92. package/lib/types/components/sidePanel/btw/BtwComposer.d.ts.map +1 -1
  93. package/lib/types/components/sidePanel/btw/BtwComposer.js +123 -6
  94. package/lib/types/components/sidePanel/btw/BtwPanelAdapter.d.ts.map +1 -1
  95. package/lib/types/components/sidePanel/btw/BtwPanelAdapter.js +9 -2
  96. package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts +7 -1
  97. package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts.map +1 -1
  98. package/lib/types/components/sidePanel/btw/BtwThreadScene.js +9 -2
  99. package/lib/types/components/sidePanel/btw/useBtwComposerPaste.d.ts +30 -0
  100. package/lib/types/components/sidePanel/btw/useBtwComposerPaste.d.ts.map +1 -0
  101. package/lib/types/components/sidePanel/btw/useBtwComposerPaste.js +94 -0
  102. package/lib/types/components/sidePanel/builtinPanels.d.ts.map +1 -1
  103. package/lib/types/components/sidePanel/builtinPanels.js +14 -2
  104. package/lib/types/components/sidePanel/types.d.ts +2 -0
  105. package/lib/types/components/sidePanel/types.d.ts.map +1 -1
  106. package/lib/types/components/sidePanel/useSidePanel.d.ts.map +1 -1
  107. package/lib/types/components/sidePanel/useSidePanel.js +15 -1
  108. package/lib/types/components/smoothReveal.d.ts +36 -6
  109. package/lib/types/components/smoothReveal.d.ts.map +1 -1
  110. package/lib/types/components/smoothReveal.js +92 -21
  111. package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts +4 -14
  112. package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts.map +1 -1
  113. package/lib/types/components/workspaces/HomeWorkspaceRow.js +26 -17
  114. package/lib/types/dsh-adapter/backend/session.d.ts +7 -1
  115. package/lib/types/dsh-adapter/backend/session.d.ts.map +1 -1
  116. package/lib/types/dsh-adapter/backend/session.js +74 -6
  117. package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
  118. package/lib/types/dsh-adapter/backend/translate.js +15 -6
  119. package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts +1 -1
  120. package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts.map +1 -1
  121. package/lib/types/dsh-adapter/channel/agent-view-projection.js +3 -1
  122. package/lib/types/dsh-adapter/channel/attached-context.d.ts +15 -2
  123. package/lib/types/dsh-adapter/channel/attached-context.d.ts.map +1 -1
  124. package/lib/types/dsh-adapter/channel/attached-context.js +26 -3
  125. package/lib/types/dsh-adapter/channel/binding-events.d.ts +3 -0
  126. package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
  127. package/lib/types/dsh-adapter/channel/binding-events.js +43 -2
  128. package/lib/types/dsh-adapter/channel/composer-images.d.ts +2 -0
  129. package/lib/types/dsh-adapter/channel/composer-images.d.ts.map +1 -1
  130. package/lib/types/dsh-adapter/channel/composer-images.js +10 -2
  131. package/lib/types/dsh-adapter/channel/composer-mentions.d.ts.map +1 -1
  132. package/lib/types/dsh-adapter/channel/composer-mentions.js +22 -7
  133. package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts +3 -7
  134. package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts.map +1 -1
  135. package/lib/types/dsh-adapter/channel/context-bookkeeping.js +16 -6
  136. package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts +6 -0
  137. package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts.map +1 -1
  138. package/lib/types/dsh-adapter/channel/core/binding-feed.js +35 -1
  139. package/lib/types/dsh-adapter/channel/core/compose.d.ts +3 -7
  140. package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
  141. package/lib/types/dsh-adapter/channel/core/compose.js +6 -1
  142. package/lib/types/dsh-adapter/channel/core/local-actions.d.ts.map +1 -1
  143. package/lib/types/dsh-adapter/channel/core/local-actions.js +3 -26
  144. package/lib/types/dsh-adapter/channel/emitter.js +1 -1
  145. package/lib/types/dsh-adapter/channel/extensions.d.ts.map +1 -1
  146. package/lib/types/dsh-adapter/channel/extensions.js +8 -0
  147. package/lib/types/dsh-adapter/channel/input-actions.d.ts +4 -4
  148. package/lib/types/dsh-adapter/channel/input-actions.d.ts.map +1 -1
  149. package/lib/types/dsh-adapter/channel/input-actions.js +59 -5
  150. package/lib/types/dsh-adapter/channel/input-delivery.d.ts +3 -7
  151. package/lib/types/dsh-adapter/channel/input-delivery.d.ts.map +1 -1
  152. package/lib/types/dsh-adapter/channel/input-delivery.js +21 -8
  153. package/lib/types/dsh-adapter/channel/mentions.d.ts.map +1 -1
  154. package/lib/types/dsh-adapter/channel/mentions.js +21 -7
  155. package/lib/types/dsh-adapter/channel/model-actions.d.ts +4 -1
  156. package/lib/types/dsh-adapter/channel/model-actions.d.ts.map +1 -1
  157. package/lib/types/dsh-adapter/channel/model-actions.js +26 -9
  158. package/lib/types/dsh-adapter/channel/model-selection.d.ts +27 -2
  159. package/lib/types/dsh-adapter/channel/model-selection.d.ts.map +1 -1
  160. package/lib/types/dsh-adapter/channel/model-selection.js +81 -37
  161. package/lib/types/dsh-adapter/channel/model-switch.d.ts +1 -1
  162. package/lib/types/dsh-adapter/channel/model-switch.d.ts.map +1 -1
  163. package/lib/types/dsh-adapter/channel/paths.d.ts.map +1 -1
  164. package/lib/types/dsh-adapter/channel/paths.js +11 -9
  165. package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts +1 -1
  166. package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts.map +1 -1
  167. package/lib/types/dsh-adapter/channel/session-live-adoption.js +6 -1
  168. package/lib/types/dsh-adapter/channel/session-reset.d.ts.map +1 -1
  169. package/lib/types/dsh-adapter/channel/session-reset.js +3 -1
  170. package/lib/types/dsh-adapter/channel/session-resume.d.ts +1 -1
  171. package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
  172. package/lib/types/dsh-adapter/channel/session-resume.js +10 -3
  173. package/lib/types/dsh-adapter/channel/session-rewind.d.ts +1 -1
  174. package/lib/types/dsh-adapter/channel/session-rewind.d.ts.map +1 -1
  175. package/lib/types/dsh-adapter/channel/session-rewind.js +9 -3
  176. package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts +1 -1
  177. package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts.map +1 -1
  178. package/lib/types/dsh-adapter/channel/session-tree-actions.js +11 -5
  179. package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
  180. package/lib/types/dsh-adapter/channel/settings-host.js +6 -3
  181. package/lib/types/dsh-adapter/channel/transcript.d.ts +3 -2
  182. package/lib/types/dsh-adapter/channel/transcript.d.ts.map +1 -1
  183. package/lib/types/dsh-adapter/channel/transcript.js +13 -4
  184. package/lib/types/dsh-adapter/channel/types.d.ts +11 -2
  185. package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
  186. package/lib/types/dsh-adapter/contract.d.ts +27 -3
  187. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  188. package/lib/types/dsh-adapter/contract.js +47 -5
  189. package/lib/types/dsh-adapter/entry-slot.d.ts +6 -0
  190. package/lib/types/dsh-adapter/entry-slot.d.ts.map +1 -1
  191. package/lib/types/dsh-adapter/experimental-bundles.d.ts +3 -0
  192. package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -1
  193. package/lib/types/dsh-adapter/experimental-bundles.js +4 -0
  194. package/lib/types/dsh-adapter/fresh-agent.d.ts +1 -1
  195. package/lib/types/dsh-adapter/fresh-agent.d.ts.map +1 -1
  196. package/lib/types/dsh-adapter/fresh-agent.js +60 -11
  197. package/lib/types/dsh-adapter/grant-file.d.ts +70 -0
  198. package/lib/types/dsh-adapter/grant-file.d.ts.map +1 -0
  199. package/lib/types/dsh-adapter/grant-file.js +178 -0
  200. package/lib/types/dsh-adapter/host-access.d.ts +4 -0
  201. package/lib/types/dsh-adapter/host-access.d.ts.map +1 -1
  202. package/lib/types/dsh-adapter/host-access.js +114 -15
  203. package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
  204. package/lib/types/dsh-adapter/host-contract.d.ts.map +1 -1
  205. package/lib/types/dsh-adapter/host-contract.js +5 -3
  206. package/lib/types/dsh-adapter/host-dsh.d.ts +0 -8
  207. package/lib/types/dsh-adapter/host-dsh.d.ts.map +1 -1
  208. package/lib/types/dsh-adapter/host-dsh.js +27 -6
  209. package/lib/types/dsh-adapter/host-entry.js +4 -0
  210. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  211. package/lib/types/dsh-adapter/index.js +8 -5
  212. package/lib/types/dsh-adapter/oauth/profiles.d.ts.map +1 -1
  213. package/lib/types/dsh-adapter/oauth/profiles.js +14 -1
  214. package/lib/types/dsh-adapter/panels.d.ts +7 -1
  215. package/lib/types/dsh-adapter/panels.d.ts.map +1 -1
  216. package/lib/types/dsh-adapter/plugin-declaration.d.ts +28 -0
  217. package/lib/types/dsh-adapter/plugin-declaration.d.ts.map +1 -1
  218. package/lib/types/dsh-adapter/plugin-declaration.js +43 -1
  219. package/lib/types/dsh-adapter/plugin-install.d.ts +28 -1
  220. package/lib/types/dsh-adapter/plugin-install.d.ts.map +1 -1
  221. package/lib/types/dsh-adapter/plugin-install.js +160 -13
  222. package/lib/types/dsh-adapter/plugin-manage.d.ts +53 -10
  223. package/lib/types/dsh-adapter/plugin-manage.d.ts.map +1 -1
  224. package/lib/types/dsh-adapter/plugin-manage.js +240 -51
  225. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  226. package/lib/types/dsh-adapter/plugin.js +203 -58
  227. package/lib/types/dsh-adapter/plugins-info.d.ts +6 -7
  228. package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -1
  229. package/lib/types/dsh-adapter/plugins-info.js +34 -21
  230. package/lib/types/dsh-adapter/presets.d.ts +41 -10
  231. package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
  232. package/lib/types/dsh-adapter/presets.js +59 -12
  233. package/lib/types/dsh-adapter/process-exit.d.ts +1 -1
  234. package/lib/types/dsh-adapter/process-exit.js +1 -1
  235. package/lib/types/dsh-adapter/providerWizard.d.ts +2 -0
  236. package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -1
  237. package/lib/types/dsh-adapter/providerWizard.js +11 -5
  238. package/lib/types/dsh-adapter/questions.d.ts +3 -4
  239. package/lib/types/dsh-adapter/questions.d.ts.map +1 -1
  240. package/lib/types/dsh-adapter/questions.js +1 -1
  241. package/lib/types/dsh-adapter/row-attachment.d.ts +30 -0
  242. package/lib/types/dsh-adapter/row-attachment.d.ts.map +1 -0
  243. package/lib/types/dsh-adapter/row-attachment.js +29 -0
  244. package/lib/types/dsh-adapter/session-list-metadata.js +2 -2
  245. package/lib/types/dsh-adapter/subagents.d.ts +5 -0
  246. package/lib/types/dsh-adapter/subagents.d.ts.map +1 -1
  247. package/lib/types/dsh-adapter/subagents.js +22 -1
  248. package/lib/types/dsh-adapter/team-mode.d.ts +17 -10
  249. package/lib/types/dsh-adapter/team-mode.d.ts.map +1 -1
  250. package/lib/types/dsh-adapter/team-mode.js +19 -12
  251. package/lib/types/dsh-adapter/tool-scope.d.ts +24 -0
  252. package/lib/types/dsh-adapter/tool-scope.d.ts.map +1 -0
  253. package/lib/types/dsh-adapter/tool-scope.js +127 -0
  254. package/lib/types/dsh-adapter/types.d.ts +2 -1
  255. package/lib/types/dsh-adapter/types.d.ts.map +1 -1
  256. package/lib/types/dsh-adapter/worktree-tool.d.ts +27 -0
  257. package/lib/types/dsh-adapter/worktree-tool.d.ts.map +1 -0
  258. package/lib/types/dsh-adapter/worktree-tool.js +87 -0
  259. package/lib/types/heldInputs.d.ts +75 -0
  260. package/lib/types/heldInputs.d.ts.map +1 -0
  261. package/lib/types/heldInputs.js +409 -0
  262. package/lib/types/i18n.d.ts +577 -34
  263. package/lib/types/i18n.d.ts.map +1 -1
  264. package/lib/types/i18n.js +230 -22
  265. package/lib/types/ink/components/App.d.ts +2 -0
  266. package/lib/types/ink/components/App.d.ts.map +1 -1
  267. package/lib/types/ink/components/App.js +8 -0
  268. package/lib/types/ink/events/input-event.d.ts.map +1 -1
  269. package/lib/types/ink/events/input-event.js +7 -6
  270. package/lib/types/ink/hit-test.d.ts +2 -0
  271. package/lib/types/ink/hit-test.d.ts.map +1 -1
  272. package/lib/types/ink/hit-test.js +10 -0
  273. package/lib/types/ink/hooks/use-program-status.d.ts +1 -1
  274. package/lib/types/ink/hooks/use-program-status.d.ts.map +1 -1
  275. package/lib/types/ink/hooks/use-program-status.js +3 -2
  276. package/lib/types/ink/ink.d.ts +1 -0
  277. package/lib/types/ink/ink.d.ts.map +1 -1
  278. package/lib/types/ink/ink.js +5 -2
  279. package/lib/types/ink/parse-keypress.d.ts.map +1 -1
  280. package/lib/types/ink/parse-keypress.js +25 -0
  281. package/lib/types/ink/terminal.d.ts +13 -2
  282. package/lib/types/ink/terminal.d.ts.map +1 -1
  283. package/lib/types/ink/terminal.js +29 -5
  284. package/lib/types/onboardingDraft.d.ts +143 -0
  285. package/lib/types/onboardingDraft.d.ts.map +1 -0
  286. package/lib/types/onboardingDraft.js +71 -0
  287. package/lib/types/screens/Chat.d.ts.map +1 -1
  288. package/lib/types/screens/Chat.js +133 -32
  289. package/lib/types/screens/Onboarding.d.ts +22 -3
  290. package/lib/types/screens/Onboarding.d.ts.map +1 -1
  291. package/lib/types/screens/Onboarding.js +606 -36
  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.js +2 -2
  304. package/lib/types/update.d.ts +412 -20
  305. package/lib/types/update.d.ts.map +1 -1
  306. package/lib/types/update.js +2094 -193
  307. package/lib/types/updateHost.d.ts +198 -0
  308. package/lib/types/updateHost.d.ts.map +1 -0
  309. package/lib/types/updateHost.js +608 -0
  310. package/lib/types/utils/paths.d.ts +15 -0
  311. package/lib/types/utils/paths.d.ts.map +1 -1
  312. package/lib/types/utils/paths.js +25 -0
  313. package/lib/types/utils/processName.d.ts +16 -0
  314. package/lib/types/utils/processName.d.ts.map +1 -0
  315. package/lib/types/utils/processName.js +27 -0
  316. package/package.json +114 -108
  317. package/tui-profile/feed/README.md +1 -1
  318. package/tui-profile/feed/first-party.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import type { ChannelUi } from '../../adapter/ports/channel-ui.js';
2
- import type { RawTrajEvent, ChatRow, ToolCallView, ToolResultView, NotificationItem, TodoPanelItem, PendingMessage, StagedImageAdjustment, TrajectorySource } from '../../adapter/ports/channel-view.js';
3
- export type { ChatRow, ToolRow, ToolCallView, ToolFileDiff, ToolResultView, SubagentRow, JobGroupRow, JobRow, TokenUsage, TokenBucket, CostTokenBuckets, SessionCostByModel, SubagentCostEntry, NotificationItem, ChannelGoal, TodoPanelItem, LoadedContext, LoadedContextEntry, LoadedContextFile, LoadedContextSkill, LoadedContextTool, PendingMessage, SubagentControl, SubagentTranscriptView, JobControl, StagedImageInput, StagedImageAdjustment, StagedImageHandle, ComposerImageRef, ComposerSubmission, ExternalCommandOutcome, TranscriptImage, ResumeResult, EffortOption, PermissionPresetSnapshot, PermissionPresetAvailability, PermissionPresetOption, PermissionPresetCurrent, PresetOption, SkillInfo, CredentialStatus, AgentViewRow, AgentViewStatus, AgentViewDispatchResult, BackgroundResult, BackendModeOption, BackendChannelOption, TrajectorySource } from '../../adapter/ports/channel-view.js';
2
+ import type { AttachedContext, RawTrajEvent, ChatRow, ToolCallView, ToolResultView, NotificationItem, TodoPanelItem, PendingMessage, StagedImageAdjustment, ComposerImageRef, TrajectorySource } from '../../adapter/ports/channel-view.js';
3
+ export type { AttachedContext, ChatRow, ToolRow, ToolCallView, ToolFileDiff, ToolResultView, SubagentRow, JobGroupRow, JobRow, TokenUsage, TokenBucket, CostTokenBuckets, SessionCostByModel, SubagentCostEntry, NotificationItem, ChannelGoal, TodoPanelItem, LoadedContext, LoadedContextEntry, LoadedContextFile, LoadedContextSkill, LoadedContextTool, PendingMessage, SubagentControl, SubagentTranscriptView, JobControl, StagedImageInput, StagedImageAdjustment, StagedImageHandle, ComposerImageRef, ComposerSubmission, ExternalCommandOutcome, TranscriptImage, ResumeResult, EffortOption, PermissionPresetSnapshot, PermissionPresetAvailability, PermissionPresetOption, PermissionPresetCurrent, PresetOption, SkillInfo, CredentialStatus, AgentViewRow, AgentViewStatus, AgentViewDispatchResult, BackgroundResult, BackendModeOption, BackendChannelOption, TrajectorySource } from '../../adapter/ports/channel-view.js';
4
4
  import { type ContentBlock, type StreamChunk } from '@deepseek-ai/dsh-llm';
5
5
  import { type SessionEvent } from '@deepseek-ai/dsh-session';
6
6
  import { type BackgroundJobState } from '../jobs.js';
@@ -114,6 +114,15 @@ export type FileSuggestionFs = {
114
114
  };
115
115
  }>>;
116
116
  };
117
+ /** One pending-row snapshot handed to `trackPending` before a submit: the
118
+ * dock re-sends it later, so everything the message needs to be rebuilt
119
+ * (`contexts` included) travels with it. */
120
+ export interface PendingTrackInput {
121
+ readonly id: string;
122
+ readonly text: string;
123
+ readonly images?: readonly ComposerImageRef[];
124
+ readonly contexts?: readonly AttachedContext[];
125
+ }
117
126
  /** The fs-service surface `@`-mention expansion consumes (dsh-fs-local). */
118
127
  export interface MentionFs {
119
128
  resolve(path: string): Promise<{
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAA;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAW,YAAY,EAAgB,cAAc,EAAsH,gBAAgB,EAAe,aAAa,EAA+F,cAAc,EAAyE,qBAAqB,EAAuY,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AACz4B,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAA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AClF,aAAa,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CACnD"}
@@ -1,9 +1,24 @@
1
1
  /** Primary validated upstream line (newest). */
2
- export declare const UPSTREAM_VALIDATED_VERSION = "0.2.1-rc.3";
2
+ export declare const UPSTREAM_VALIDATED_VERSION = "0.2.2-rc.1";
3
+ /**
4
+ * The host CLI package whose installation `/update` aligns with the TUI.
5
+ * Re-exported here (the literal stays in host-contract.ts) so engine planning
6
+ * can name it without importing the host-only module.
7
+ */
8
+ export declare const UPSTREAM_HOST_PACKAGE = "@deepseek-ai/dsh";
9
+ /**
10
+ * The host-side peer whose enumerated range defines the engine line a TUI
11
+ * release validates (`@deepseek-ai/dsh-app-boot`, lockstep with the CLI).
12
+ * Derived from the host contract: the literal lives only in host-contract.ts.
13
+ */
14
+ export declare const UPSTREAM_HOST_PEER_PACKAGE: "@deepseek-ai/dsh-app-boot";
3
15
  /**
4
16
  * Explicitly supported upstream prerelease lines, oldest first.
5
17
  *
6
- * 0.2.1-rc.3 = primary continuous-CI line; 0.2.1-rc.2 and
18
+ * 0.2.2-rc.1 = primary continuous-CI line (the model-selection projection,
19
+ * Agent.model seam and PromptPresentation split land here); 0.2.1-rc.5 =
20
+ * previous family still source-checked where CI covers it; 0.2.1-rc.4/rc.3/rc.2 = earlier
21
+ * prereleases of the same family (published code compared with the primary);
7
22
  * 0.2.0-rc.2/rc.1 = previous family (mapped compatibility);
8
23
  * 0.1.7-rc.2/rc.1 = previous family (mapped compatibility);
9
24
  * 0.1.5-rc.1/alpha.2/alpha.1 = mapped
@@ -18,7 +33,7 @@ export declare const UPSTREAM_VALIDATED_VERSION = "0.2.1-rc.3";
18
33
  * The peer range in package.json is deliberately wider than this list: an
19
34
  * install on an older or newer line is allowed but reports drift at boot.
20
35
  */
21
- export declare const UPSTREAM_VALIDATED_VERSIONS: readonly ["0.1.0-rc.6", "0.1.0-rc.7", "0.1.0-rc.8", "0.1.1-rc.1", "0.1.1-rc.2", "0.1.2-alpha.3", "0.1.2-alpha.4", "0.1.2-alpha.5", "0.1.2-rc.1", "0.1.3-alpha.2", "0.1.5-alpha.1", "0.1.5-alpha.2", "0.1.5-rc.1", "0.1.7-rc.1", "0.1.7-rc.2", "0.2.0-rc.1", "0.2.0-rc.2", "0.2.1-rc.2", "0.2.1-rc.3"];
36
+ export declare const UPSTREAM_VALIDATED_VERSIONS: readonly ["0.1.0-rc.6", "0.1.0-rc.7", "0.1.0-rc.8", "0.1.1-rc.1", "0.1.1-rc.2", "0.1.2-alpha.3", "0.1.2-alpha.4", "0.1.2-alpha.5", "0.1.2-rc.1", "0.1.3-alpha.2", "0.1.5-alpha.1", "0.1.5-alpha.2", "0.1.5-rc.1", "0.1.7-rc.1", "0.1.7-rc.2", "0.2.0-rc.1", "0.2.0-rc.2", "0.2.1-rc.2", "0.2.1-rc.3", "0.2.1-rc.4", "0.2.1-rc.5", "0.2.2-rc.1"];
22
37
  /**
23
38
  * Framework packages version on their own lines; the contract validates
24
39
  * their MAJOR (breaking surface), not the harness prerelease number.
@@ -64,6 +79,15 @@ export declare function installedUpstreamVersion(packageName: string): UpstreamV
64
79
  * 两级都读不到 → undefined(调用方只画 TUI 版本,不编造)。
65
80
  */
66
81
  export declare function installedKernelVersion(): string | undefined;
82
+ /**
83
+ * 已装宿主(`@deepseek-ai/dsh`)包的真实目录;源码 checkout(宿主不是本包
84
+ * 依赖)下为 undefined。
85
+ *
86
+ * `/update` 用它定位「这次该往哪个全局前缀里装引擎」:profile 副本的
87
+ * `node_modules/@deepseek-ai/dsh` 是指向全局安装的模块回退链接,realpath 后
88
+ * 就是布局判定的输入(`src/updateHost.ts` 的 `detectHostInstall`)。
89
+ */
90
+ export declare function installedKernelPackageDir(): string | undefined;
67
91
  /**
68
92
  * Whether the installed version of `packageName` is at or beyond `minimum`
69
93
  * (a literal like `'0.1.0-rc.8'`). Unparseable or older installs return
@@ -1 +1 @@
1
- {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M,EAAE,CAQV;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,iBAAiB,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAA+B,GAC5F,kBAAkB,EAAE,CAuBtB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAA;AAEtE,wEAAwE;AACxE,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,iBAAiB,CAAA;IACvB,sFAAsF;IACtF,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,iBAAiB,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAA+B,GAC5F,oBAAoB,GAAG,SAAS,CA0BlC"}
@@ -2,7 +2,7 @@
2
2
  * Upstream compatibility contract.
3
3
  *
4
4
  * The TUI is validated against a set of upstream prerelease lines — the
5
- * current primary (0.2.1-rc.3) plus older lines kept in backward
5
+ * current primary (0.2.2-rc.1) plus older lines kept in backward
6
6
  * compatibility across the 0.2.0, 0.1.7, 0.1.5, 0.1.3, 0.1.2, 0.1.1 and 0.1.0
7
7
  * release families.
8
8
  * Every official package this adapter touches is blessed here; anything
@@ -13,15 +13,38 @@
13
13
  * `upstreamDriftSummary()` collapses the per-package entries into the
14
14
  * single natural-language boot notice the logo header shows (see LogoV2).
15
15
  */
16
- import { readFileSync } from 'node:fs';
16
+ import { readFileSync, realpathSync } from 'node:fs';
17
+ import { dirname } from 'node:path';
17
18
  import { fileURLToPath } from 'node:url';
18
- import { ADAPTER_TYPE_PACKAGES, HOST_TYPE_PACKAGES } from './host-contract.js';
19
+ import { ADAPTER_TYPE_PACKAGES, HOST_MODULES, HOST_PACKAGE, HOST_TYPE_PACKAGES } from './host-contract.js';
19
20
  /** Primary validated upstream line (newest). */
20
- export const UPSTREAM_VALIDATED_VERSION = '0.2.1-rc.3';
21
+ export const UPSTREAM_VALIDATED_VERSION = '0.2.2-rc.1';
22
+ /**
23
+ * The host CLI package whose installation `/update` aligns with the TUI.
24
+ * Re-exported here (the literal stays in host-contract.ts) so engine planning
25
+ * can name it without importing the host-only module.
26
+ */
27
+ export const UPSTREAM_HOST_PACKAGE = HOST_PACKAGE;
28
+ const APP_BOOT_MODULE = HOST_MODULES.find(module => module.key === 'appBoot');
29
+ if (APP_BOOT_MODULE === undefined) {
30
+ // A broken host contract is a build-time fault, not a runtime state: the
31
+ // gate (verify:contract) fails on the same edit. Name it instead of letting
32
+ // a bare TypeError crash every boot.
33
+ throw new Error('host contract: HOST_MODULES has no appBoot entry (run pnpm verify:contract)');
34
+ }
35
+ /**
36
+ * The host-side peer whose enumerated range defines the engine line a TUI
37
+ * release validates (`@deepseek-ai/dsh-app-boot`, lockstep with the CLI).
38
+ * Derived from the host contract: the literal lives only in host-contract.ts.
39
+ */
40
+ export const UPSTREAM_HOST_PEER_PACKAGE = APP_BOOT_MODULE.specifier;
21
41
  /**
22
42
  * Explicitly supported upstream prerelease lines, oldest first.
23
43
  *
24
- * 0.2.1-rc.3 = primary continuous-CI line; 0.2.1-rc.2 and
44
+ * 0.2.2-rc.1 = primary continuous-CI line (the model-selection projection,
45
+ * Agent.model seam and PromptPresentation split land here); 0.2.1-rc.5 =
46
+ * previous family still source-checked where CI covers it; 0.2.1-rc.4/rc.3/rc.2 = earlier
47
+ * prereleases of the same family (published code compared with the primary);
25
48
  * 0.2.0-rc.2/rc.1 = previous family (mapped compatibility);
26
49
  * 0.1.7-rc.2/rc.1 = previous family (mapped compatibility);
27
50
  * 0.1.5-rc.1/alpha.2/alpha.1 = mapped
@@ -56,6 +79,9 @@ export const UPSTREAM_VALIDATED_VERSIONS = [
56
79
  '0.2.0-rc.2',
57
80
  '0.2.1-rc.2',
58
81
  '0.2.1-rc.3',
82
+ '0.2.1-rc.4',
83
+ '0.2.1-rc.5',
84
+ '0.2.2-rc.1',
59
85
  ];
60
86
  /**
61
87
  * Framework packages version on their own lines; the contract validates
@@ -227,6 +253,22 @@ export function installedKernelVersion() {
227
253
  }
228
254
  return installedUpstreamVersions()['@deepseek-ai/dsh-agent'];
229
255
  }
256
+ /**
257
+ * 已装宿主(`@deepseek-ai/dsh`)包的真实目录;源码 checkout(宿主不是本包
258
+ * 依赖)下为 undefined。
259
+ *
260
+ * `/update` 用它定位「这次该往哪个全局前缀里装引擎」:profile 副本的
261
+ * `node_modules/@deepseek-ai/dsh` 是指向全局安装的模块回退链接,realpath 后
262
+ * 就是布局判定的输入(`src/updateHost.ts` 的 `detectHostInstall`)。
263
+ */
264
+ export function installedKernelPackageDir() {
265
+ try {
266
+ return realpathSync(dirname(fileURLToPath(import.meta.resolve('@deepseek-ai/dsh/package.json'))));
267
+ }
268
+ catch {
269
+ return undefined;
270
+ }
271
+ }
230
272
  /**
231
273
  * Whether the installed version of `packageName` is at or beyond `minimum`
232
274
  * (a literal like `'0.1.0-rc.8'`). Unparseable or older installs return
@@ -18,6 +18,12 @@ export interface EntrySlot {
18
18
  /** The DSH side. The row calls it once, after the Loader settled; it never
19
19
  * throws (a failure lands in the mounted screen). */
20
20
  attachDsh?: (ctx: unknown, runtimeConfig: unknown, configOwner: unknown) => Promise<void>;
21
+ /** A row applied again after `attachDsh` was taken (its services came
22
+ * back after unloading under the screen, #1651): the hook that remounts
23
+ * the DSH seams on the new row and reopens the screen's session if it
24
+ * ended with the previous row, called like `attachDsh`. Undefined while
25
+ * the previous row is still mounted, and the new row stays idle. */
26
+ reattachDsh?: () => EntrySlot['attachDsh'];
21
27
  /** DSH: the composition failed or had no `dsh-tui` row, the startup session
22
28
  * will never come. `logPath` is the saved startup report, if any. */
23
29
  composeFailed?: (error: unknown, logPath?: string) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"entry-slot.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/entry-slot.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;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E,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACzF;;;;yEAIqE;IACrE,WAAW,CAAC,EAAE,MAAM,SAAS,CAAC,WAAW,CAAC,CAAA;IAC1C;0EACsE;IACtE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1D;;4DAEwD;IACxD,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAA;IAC7B;wDACoD;IACpD,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CACxC;AAMD,2EAA2E;AAC3E,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAI/E;AAED,sEAAsE;AACtE,wBAAgB,aAAa,IAAI,SAAS,GAAG,SAAS,CAErD;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,IAAI,SAAS,CAAC,WAAW,CAAC,CAKxD"}
@@ -15,6 +15,9 @@ import type { I18nKey } from '../i18n.js';
15
15
  export declare const AUTO_REVIEW_BUNDLE = "@deepseek-ai/dsh-experimental-auto-review";
16
16
  /** The bundle that mounts the five read-only session-search tools. */
17
17
  export declare const SESSION_SEARCH_BUNDLE = "@deepseek-ai/dsh-experimental-session-search";
18
+ /** The bundle that mounts `create_worktree` (a new Git branch and worktree the
19
+ * session then moves into; the TUI follows the move like any other cd). */
20
+ export declare const WORKTREE_BUNDLE = "@deepseek-ai/dsh-experimental-tool-worktree";
18
21
  /** One experimental feature the TUI knows how to switch on and use. */
19
22
  export interface TuiExperimentalBundle {
20
23
  readonly name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"experimental-bundles.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/experimental-bundles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAGzC,2DAA2D;AAC3D,eAAO,MAAM,kBAAkB,8CAA8C,CAAA;AAE7E,sEAAsE;AACtE,eAAO,MAAM,qBAAqB,iDAAiD,CAAA;AAEnF,uEAAuE;AACvE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CACvB;AAED,gEAAgE;AAChE,eAAO,MAAM,wBAAwB,EAAE,SAAS,qBAAqB,EAIpE,CAAA"}
1
+ {"version":3,"file":"experimental-bundles.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/experimental-bundles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAGzC,2DAA2D;AAC3D,eAAO,MAAM,kBAAkB,8CAA8C,CAAA;AAE7E,sEAAsE;AACtE,eAAO,MAAM,qBAAqB,iDAAiD,CAAA;AAEnF;4EAC4E;AAC5E,eAAO,MAAM,eAAe,gDAAgD,CAAA;AAE5E,uEAAuE;AACvE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CACvB;AAED,gEAAgE;AAChE,eAAO,MAAM,wBAAwB,EAAE,SAAS,qBAAqB,EAKpE,CAAA"}
@@ -3,9 +3,13 @@ import { TEAM_BUNDLE } from './team-roster.js';
3
3
  export const AUTO_REVIEW_BUNDLE = '@deepseek-ai/dsh-experimental-auto-review';
4
4
  /** The bundle that mounts the five read-only session-search tools. */
5
5
  export const SESSION_SEARCH_BUNDLE = '@deepseek-ai/dsh-experimental-session-search';
6
+ /** The bundle that mounts `create_worktree` (a new Git branch and worktree the
7
+ * session then moves into; the TUI follows the move like any other cd). */
8
+ export const WORKTREE_BUNDLE = '@deepseek-ai/dsh-experimental-tool-worktree';
6
9
  /** The features `/plugin list` advertises, in product order. */
7
10
  export const TUI_EXPERIMENTAL_BUNDLES = [
8
11
  { name: TEAM_BUNDLE, hint: 'plugins-experimental-team-hint' },
9
12
  { name: AUTO_REVIEW_BUNDLE, hint: 'plugins-experimental-auto-review-hint' },
10
13
  { name: SESSION_SEARCH_BUNDLE, hint: 'plugins-experimental-session-search-hint' },
14
+ { name: WORKTREE_BUNDLE, hint: 'plugins-experimental-worktree-hint' },
11
15
  ];
@@ -4,7 +4,7 @@ import type { Session, SessionEvent } from '@deepseek-ai/dsh-session';
4
4
  type AgentCreator = {
5
5
  create(options: CreateAgentOptions): Promise<AgentHandle>;
6
6
  };
7
- /** Policy facts held in memory until the session has further activity. */
7
+ /** Policy and model-route facts held until the session has further activity. */
8
8
  export declare const INITIAL_POLICY_EVENTS: ReadonlySet<string>;
9
9
  /** Source-less legacy messages and explicit user messages count as human input. */
10
10
  export declare function isHumanSource(source: unknown): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"fresh-agent.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/fresh-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAc,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AACzF,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAiB,MAAM,0BAA0B,CAAA;AAkBpF,KAAK,YAAY,GAAG;IAAE,MAAM,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;CAAE,CAAA;AAyCjF,0EAA0E;AAC1E,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAAkF,CAAA;AAKxI,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAItD;AAED,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAWlE;AAID,2EAA2E;AAC3E,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAE5E;AA4FD;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAsB5H"}
1
+ {"version":3,"file":"fresh-agent.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/fresh-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAc,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AACzF,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAiB,MAAM,0BAA0B,CAAA;AAkBpF,KAAK,YAAY,GAAG;IAAE,MAAM,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;CAAE,CAAA;AAmFjF,gFAAgF;AAChF,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAAqG,CAAA;AAK3J,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAItD;AAED,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAWlE;AAID,2EAA2E;AAC3E,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAE5E;AA4FD;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CA8B5H"}
@@ -38,8 +38,44 @@ function captureWriter(source, id, receive) {
38
38
  capture.restore();
39
39
  };
40
40
  }
41
- /** Policy facts held in memory until the session has further activity. */
42
- export const INITIAL_POLICY_EVENTS = new Set(['permission/preset', 'sandbox/mode', 'approval/policy', 'plan/mode']);
41
+ const entryCaptures = new WeakMap();
42
+ /** Install the filter before newer stores snapshot it into their event carrier. */
43
+ function captureSessionEntry(store, id, receive) {
44
+ let capture = entryCaptures.get(store);
45
+ if (capture === undefined) {
46
+ const descriptor = Object.getOwnPropertyDescriptor(store, 'enter');
47
+ const enter = store.enter;
48
+ const receivers = new Map();
49
+ const tapped = function (session) {
50
+ receivers.get(String(session.id))?.(this.ctx, session);
51
+ return enter.call(this, session);
52
+ };
53
+ store.enter = tapped;
54
+ capture = {
55
+ receivers,
56
+ restore() {
57
+ if (store.enter === tapped) {
58
+ if (descriptor === undefined)
59
+ delete store.enter;
60
+ else
61
+ Object.defineProperty(store, 'enter', descriptor);
62
+ }
63
+ entryCaptures.delete(store);
64
+ },
65
+ };
66
+ entryCaptures.set(store, capture);
67
+ }
68
+ if (capture.receivers.has(id))
69
+ throw new Error(`dsh-tui: fresh session "${id}" is already entering the store`);
70
+ capture.receivers.set(id, receive);
71
+ return () => {
72
+ capture.receivers.delete(id);
73
+ if (capture.receivers.size === 0)
74
+ capture.restore();
75
+ };
76
+ }
77
+ /** Policy and model-route facts held until the session has further activity. */
78
+ export const INITIAL_POLICY_EVENTS = new Set(['permission/preset', 'sandbox/mode', 'approval/policy', 'plan/mode', 'model/selection']);
43
79
  /** The command envelope a session-policy switch runs through. */
44
80
  const POLICY_ACTIVITY_EVENTS = new Set(['command/run', 'command/done']);
45
81
  /** Source-less legacy messages and explicit user messages count as human input. */
@@ -202,25 +238,38 @@ export async function createFreshAgent(ctx, agents, options) {
202
238
  return agents.create(options);
203
239
  const source = concreteService(service);
204
240
  let writer;
241
+ let deferred = false;
242
+ const defer = (owner, session) => {
243
+ if (deferred || writer === undefined || session.seq !== 0)
244
+ return;
245
+ deferInitialPolicy(owner, session, writer, source);
246
+ deferred = true;
247
+ };
205
248
  const stopCapture = captureWriter(source, String(options.sessionId), value => { writer = value; });
249
+ let stopEntry = () => { };
206
250
  const setup = async (agentCtx, agent) => {
207
251
  const commit = await options.setup?.(agentCtx, agent);
208
- const defer = () => {
209
- if (writer !== undefined)
210
- deferInitialPolicy(agentCtx, agent.session, writer, source);
211
- };
212
252
  if (commit === undefined) {
213
- defer();
253
+ defer(agentCtx, agent.session);
214
254
  return;
215
255
  }
216
- // Setup history belongs to the factory's pre-publication append. Install
217
- // the gate only after the original commit has finished composing it.
218
- return { commit() { commit.commit(); defer(); } };
256
+ // Older stores do not capture a carrier at entry; retain their original
257
+ // post-commit fallback. New stores already own the gate before setup.
258
+ return { commit() { commit.commit(); defer(agentCtx, agent.session); } };
219
259
  };
220
260
  try {
261
+ const sessions = ctx.get('sessions');
262
+ if (typeof sessions?.enter === 'function') {
263
+ stopEntry = captureSessionEntry(concreteService(sessions), String(options.sessionId), defer);
264
+ }
221
265
  return await agents.create({ ...options, setup });
222
266
  }
223
267
  finally {
224
- stopCapture();
268
+ try {
269
+ stopEntry();
270
+ }
271
+ finally {
272
+ stopCapture();
273
+ }
225
274
  }
226
275
  }
@@ -0,0 +1,70 @@
1
+ import { type GrantMutation, type GrantStore } from '../adapter/standard/grants.js';
2
+ import type { DeclaredGrants } from './plugin-declaration.js';
3
+ /** The grants-file operations the lifecycle flows ask for. */
4
+ export type { GrantMutation, GrantPermissionWrite } from '../adapter/standard/grants.js';
5
+ export interface GrantWriteResult {
6
+ readonly ok: true;
7
+ /** False when the document already had every requested rule (no write happened). */
8
+ readonly changed: boolean;
9
+ /**
10
+ * Restore the bytes this write replaced; only while the file still contains
11
+ * exactly what was written. Returns false when it was edited since, when the
12
+ * previous state cannot be restored, or when the lock cannot be taken.
13
+ */
14
+ readonly undo: () => Promise<boolean>;
15
+ }
16
+ export type GrantWriteFailure = {
17
+ readonly ok: false;
18
+ readonly reason: 'corrupt' | 'unreadable' | 'write-failed';
19
+ readonly detail?: string;
20
+ };
21
+ /** The grants file a lifecycle action writes (`~/.dsh-tui/extension-grants.json`). */
22
+ export declare function grantsFilePath(dataDir?: string): string;
23
+ /** Why one write failed, localized, with the filesystem's own words bounded and sanitized. */
24
+ export declare function grantFailureText(failure: GrantWriteFailure): string;
25
+ /** Test overrides; production resolves the packaged paths. */
26
+ export interface GrantWriteOptions {
27
+ readonly dataDir?: string | undefined;
28
+ /** The registry's known permission names; defaults to the packaged spec data. */
29
+ readonly knownPermissions?: readonly string[] | undefined;
30
+ }
31
+ /** One permission a plan lists: what the package declares, and what is true now. */
32
+ export interface GrantPlanEntry {
33
+ readonly name: string;
34
+ readonly scope: string;
35
+ readonly default: 'allow' | 'deny';
36
+ /** Whether the live store already allows this exact operation scope. */
37
+ readonly granted: boolean;
38
+ }
39
+ /**
40
+ * What the confirmation pane shows before a lifecycle action. `unknown` names
41
+ * the declarations this host's registry does not know: they are never written
42
+ * (the store would ignore them) and are reported instead of dropped.
43
+ */
44
+ export interface GrantPlan {
45
+ /** The component id the rules are keyed by — never the bundle name. */
46
+ readonly id: string;
47
+ readonly entries: readonly GrantPlanEntry[];
48
+ readonly unknown: readonly string[];
49
+ }
50
+ /**
51
+ * The plan for one package declaration, evaluated with the same
52
+ * activation-less principal `/plugin check` uses. Activation-scoped rules in
53
+ * the file therefore fail closed here, while the write is a global rule — the
54
+ * same split the report has always had.
55
+ *
56
+ * Unknown permission names never enter `entries`: writing one would produce a
57
+ * rule the store ignores, and this host cannot say what it authorizes.
58
+ */
59
+ export declare function planGrants(grants: GrantStore, declared: DeclaredGrants): GrantPlan;
60
+ /**
61
+ * Apply one mutation to the grants file.
62
+ *
63
+ * A missing file is the empty document (`{}`), exactly as `readGrantStore`
64
+ * reads it; an existing zero-byte file is corruption and is refused, also
65
+ * exactly as the store reads it. The read-modify-write runs under
66
+ * `extension-grants.json.lock`; the reader stays lock-free because the
67
+ * same-directory rename makes it see either the old or the new complete bytes.
68
+ */
69
+ export declare function applyGrantMutation(mutation: GrantMutation, options?: GrantWriteOptions): Promise<GrantWriteResult | GrantW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AQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAA;IAClC,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,CAAA;IAC3C,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CACpC;AAWD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,GAAG,SAAS,CAiBlF;AAwBD;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,aAAa,EACvB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,gBAAgB,GAAG,iBAAiB,CAAC,CA0D/C"}
@@ -0,0 +1,178 @@
1
+ /**
2
+ * The write half of the plugin grant file (`~/.dsh-tui/extension-grants.json`).
3
+ *
4
+ * `../adapter/standard/grants.ts` answers "may this operation run"; it has
5
+ * always been read-only, and the only writer used to be the person editing the
6
+ * file. The lifecycle flows (`./plugin-install.ts`, `./plugin-manage.ts`) need
7
+ * to grant a package's declared permissions on install/enable, revoke them on
8
+ * disable and forget them on removal, so this module owns the file I/O and
9
+ * nothing else: the document's shape and what a valid rewrite looks like stay
10
+ * in the reader's own module.
11
+ *
12
+ * Three rules decide the shape of this file:
13
+ *
14
+ * - **Never repair the person's file.** A corrupt document (bad JSON, an
15
+ * unknown root key, a malformed rule, zero bytes) is refused with a reason;
16
+ * the caller reports it and carries on with the install/enable, because an
17
+ * authorization is an enhancement, not a precondition.
18
+ * - **Never write a document the reader would call corrupt.** The rewritten
19
+ * text is parsed again before it reaches the disk.
20
+ * - **Atomic, undoable, and serialized across processes.** Same-directory
21
+ * temporary file + rename, like `usageStats.ts`, under the same sibling file
22
+ * lock (`extension-grants.json.lock`) the profile's atomic writes use, so a
23
+ * second TUI instance cannot lose an ensure/revoke/forget between our read
24
+ * and our rename. `undo()` restores the previous bytes only while the file
25
+ * still holds what this writer put there, so a hand edit in between is
26
+ * reported rather than overwritten.
27
+ */
28
+ import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
29
+ import { join } from 'node:path';
30
+ import { withFileLock } from '@deepseek-ai/dsh-atomic-write';
31
+ import { loadSpecData } from '../adapter/standard/registry.js';
32
+ import { EXTENSION_GRANTS_FILE, parseGrantStore, rewriteGrantDocument, } from '../adapter/standard/grants.js';
33
+ import { t } from '../i18n.js';
34
+ import { DATA_DIR } from '../utils/paths.js';
35
+ import { cleanScalarText } from './sanitize.js';
36
+ /** The grants file a lifecycle action writes (`~/.dsh-tui/extension-grants.json`). */
37
+ export function grantsFilePath(dataDir = DATA_DIR) {
38
+ return join(dataDir, EXTENSION_GRANTS_FILE);
39
+ }
40
+ /** Why one write failed, localized, with the filesystem's own words bounded and sanitized. */
41
+ export function grantFailureText(failure) {
42
+ const key = failure.reason === 'corrupt'
43
+ ? 'plugins-grant-reason-corrupt'
44
+ : failure.reason === 'unreadable' ? 'plugins-grant-reason-unreadable' : 'plugins-grant-reason-write-failed';
45
+ const detail = failure.detail === undefined ? '' : ` (${cleanScalarText(failure.detail, 200)})`;
46
+ return `${t(key)}${detail}`;
47
+ }
48
+ /** The registry's known permission names, or none when the spec data is unusable. */
49
+ function knownPermissionNames() {
50
+ try {
51
+ return (loadSpecData()?.permissions.permissions ?? []).map(permission => permission.name);
52
+ }
53
+ catch {
54
+ return [];
55
+ }
56
+ }
57
+ /**
58
+ * The plan for one package declaration, evaluated with the same
59
+ * activation-less principal `/plugin check` uses. Activation-scoped rules in
60
+ * the file therefore fail closed here, while the write is a global rule — the
61
+ * same split the report has always had.
62
+ *
63
+ * Unknown permission names never enter `entries`: writing one would produce a
64
+ * rule the store ignores, and this host cannot say what it authorizes.
65
+ */
66
+ export function planGrants(grants, declared) {
67
+ const known = new Set(grants.knownPermissions());
68
+ const entries = [];
69
+ const unknown = new Set();
70
+ for (const permission of declared.permissions) {
71
+ if (!known.has(permission.name)) {
72
+ unknown.add(permission.name);
73
+ continue;
74
+ }
75
+ entries.push({
76
+ name: permission.name,
77
+ scope: permission.scope,
78
+ default: grants.defaultOf(permission.name),
79
+ granted: grants.allows({ componentId: declared.id }, permission.name, permission.scope),
80
+ });
81
+ }
82
+ return { id: declared.id, entries, unknown: [...unknown] };
83
+ }
84
+ /** Atomically replace `file` with `text`, leaving no temporary behind on failure. */
85
+ function writeAtomically(file, text) {
86
+ const temp = `${file}.tmp`;
87
+ try {
88
+ writeFileSync(temp, text);
89
+ renameSync(temp, file);
90
+ }
91
+ catch (error) {
92
+ try {
93
+ rmSync(temp, { force: true });
94
+ }
95
+ catch {
96
+ // The rename is the real failure; a leftover temporary is the temp dir's.
97
+ }
98
+ throw error;
99
+ }
100
+ }
101
+ /**
102
+ * Apply one mutation to the grants file.
103
+ *
104
+ * A missing file is the empty document (`{}`), exactly as `readGrantStore`
105
+ * reads it; an existing zero-byte file is corruption and is refused, also
106
+ * exactly as the store reads it. The read-modify-write runs under
107
+ * `extension-grants.json.lock`; the reader stays lock-free because the
108
+ * same-directory rename makes it see either the old or the new complete bytes.
109
+ */
110
+ export async function applyGrantMutation(mutation, options = {}) {
111
+ if (mutation.id === '')
112
+ return { ok: false, reason: 'write-failed', detail: 'empty component id' };
113
+ const dir = options.dataDir ?? DATA_DIR;
114
+ const file = join(dir, EXTENSION_GRANTS_FILE);
115
+ try {
116
+ mkdirSync(dir, { recursive: true });
117
+ return await withFileLock(file, async () => {
118
+ let previous;
119
+ try {
120
+ previous = { text: readFileSync(file, 'utf8'), existed: true };
121
+ }
122
+ catch (error) {
123
+ if (error.code !== 'ENOENT') {
124
+ return { ok: false, reason: 'unreadable', detail: error instanceof Error ? error.message : String(error) };
125
+ }
126
+ previous = { text: '{}', existed: false };
127
+ }
128
+ // The document this mutation targets, with declared permission names this
129
+ // host does not know removed: a rule the store ignores must not be written.
130
+ const applied = mutation.kind === 'ensure'
131
+ ? {
132
+ ...mutation,
133
+ permissions: mutation.permissions.filter(permission => (options.knownPermissions ?? knownPermissionNames()).includes(permission.name)),
134
+ }
135
+ : mutation;
136
+ const rewritten = rewriteGrantDocument(previous.text, applied);
137
+ if ('error' in rewritten)
138
+ return { ok: false, reason: 'corrupt' };
139
+ if (!rewritten.changed)
140
+ return { ok: true, changed: false, undo: async () => true };
141
+ if (parseGrantStore(rewritten.text).corrupt)
142
+ return { ok: false, reason: 'write-failed', detail: 'the rewrite did not round-trip' };
143
+ writeAtomically(file, rewritten.text);
144
+ return {
145
+ ok: true,
146
+ changed: true,
147
+ undo: async () => {
148
+ try {
149
+ return await withFileLock(file, async () => {
150
+ let current;
151
+ try {
152
+ current = readFileSync(file, 'utf8');
153
+ }
154
+ catch {
155
+ return false;
156
+ }
157
+ // Someone edited the file after this write: restoring the old
158
+ // bytes would silently throw their change away.
159
+ if (current !== rewritten.text)
160
+ return false;
161
+ if (previous.existed)
162
+ writeAtomically(file, previous.text);
163
+ else
164
+ rmSync(file, { force: true });
165
+ return true;
166
+ });
167
+ }
168
+ catch {
169
+ return false;
170
+ }
171
+ },
172
+ };
173
+ });
174
+ }
175
+ catch (error) {
176
+ return { ok: false, reason: 'write-failed', detail: error instanceof Error ? error.message : String(error) };
177
+ }
178
+ }