@deepseek-harness-tui/dsh-tui 0.16.1 → 0.18.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 (488) hide show
  1. package/README.md +213 -34
  2. package/assets/plugin-icon.svg +13 -0
  3. package/assets/windows-installer.cs +308 -0
  4. package/assets/windows-installer.ps1 +17 -0
  5. package/bin/dsh-tui.js +64 -5
  6. package/cli/adapters/dsh/index.mjs +111 -0
  7. package/cli/adapters/dsh/locate.mjs +73 -0
  8. package/cli/adapters/dsh/management-plugin.mjs +111 -0
  9. package/cli/args.mjs +154 -0
  10. package/cli/contracts.d.ts +48 -0
  11. package/cli/engine.mjs +92 -0
  12. package/cli/entry.mjs +48 -0
  13. package/cli/process.mjs +118 -0
  14. package/cli/protocol.mjs +23 -0
  15. package/cli/schema-v1.json +33 -0
  16. package/cordis.patch.yml +3 -1
  17. package/cordis.yml +3 -1
  18. package/guide/dsh-tui-guide/SKILL.md +1 -0
  19. package/guide/dsh-tui-guide/cli.en.md +114 -0
  20. package/guide/dsh-tui-guide/cli.md +114 -0
  21. package/guide/dsh-tui-guide/configuration.en.md +7 -5
  22. package/guide/dsh-tui-guide/configuration.md +7 -5
  23. package/guide/dsh-tui-guide/getting-started.en.md +33 -3
  24. package/guide/dsh-tui-guide/getting-started.md +23 -2
  25. package/guide/dsh-tui-guide/interaction.en.md +50 -17
  26. package/guide/dsh-tui-guide/interaction.md +35 -13
  27. package/guide/dsh-tui-guide/plugins.en.md +63 -11
  28. package/guide/dsh-tui-guide/plugins.md +41 -7
  29. package/guide/dsh-tui-guide/user-guide.en.md +55 -34
  30. package/guide/dsh-tui-guide/user-guide.md +45 -28
  31. package/lib/settings.json +85 -42
  32. package/lib/types/adapter/channel/plugins.d.ts.map +1 -1
  33. package/lib/types/adapter/channel/plugins.js +8 -0
  34. package/lib/types/adapter/channel/ui-policy.d.ts +2 -1
  35. package/lib/types/adapter/channel/ui-policy.d.ts.map +1 -1
  36. package/lib/types/adapter/channel/ui-policy.js +4 -0
  37. package/lib/types/adapter/ports/channel-display.d.ts +10 -0
  38. package/lib/types/adapter/ports/channel-display.d.ts.map +1 -1
  39. package/lib/types/adapter/ports/channel-session.d.ts +2 -0
  40. package/lib/types/adapter/ports/channel-session.d.ts.map +1 -1
  41. package/lib/types/adapter/ports/channel-settings.d.ts +20 -0
  42. package/lib/types/adapter/ports/channel-settings.d.ts.map +1 -1
  43. package/lib/types/adapter/ports/channel-ui.d.ts +22 -2
  44. package/lib/types/adapter/ports/channel-ui.d.ts.map +1 -1
  45. package/lib/types/adapter/ports/channel-view.d.ts +11 -1
  46. package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
  47. package/lib/types/adapter/ports/channel.d.ts +7 -0
  48. package/lib/types/adapter/ports/channel.d.ts.map +1 -1
  49. package/lib/types/adapter/standard/grants.d.ts +60 -0
  50. package/lib/types/adapter/standard/grants.d.ts.map +1 -1
  51. package/lib/types/adapter/standard/grants.js +74 -0
  52. package/lib/types/agent/capabilities.d.ts +2 -0
  53. package/lib/types/agent/capabilities.d.ts.map +1 -1
  54. package/lib/types/agent/events.d.ts +15 -1
  55. package/lib/types/agent/events.d.ts.map +1 -1
  56. package/lib/types/api.d.ts +2 -2
  57. package/lib/types/api.d.ts.map +1 -1
  58. package/lib/types/backends/claude/translate/events.d.ts.map +1 -1
  59. package/lib/types/backends/claude/translate/events.js +2 -1
  60. package/lib/types/backends/codex/auth/status.js +1 -1
  61. package/lib/types/backends/codex/session/controls.d.ts.map +1 -1
  62. package/lib/types/backends/codex/session/controls.js +6 -5
  63. package/lib/types/backends/codex/session/goals.d.ts.map +1 -1
  64. package/lib/types/backends/codex/session/side-query.d.ts.map +1 -1
  65. package/lib/types/backends/codex/translate/events.d.ts.map +1 -1
  66. package/lib/types/backends/codex/translate/events.js +3 -1
  67. package/lib/types/backends/shared/channel-tokens.d.ts.map +1 -1
  68. package/lib/types/backends/shared/channel-tokens.js +9 -8
  69. package/lib/types/channel/history-restore.d.ts.map +1 -1
  70. package/lib/types/channel/history-restore.js +2 -0
  71. package/lib/types/channel/interaction.d.ts.map +1 -1
  72. package/lib/types/channel/interaction.js +1 -0
  73. package/lib/types/channel/projection.d.ts +1 -1
  74. package/lib/types/channel/projection.d.ts.map +1 -1
  75. package/lib/types/channel/projection.js +19 -4
  76. package/lib/types/channel/questions.d.ts +2 -0
  77. package/lib/types/channel/questions.d.ts.map +1 -1
  78. package/lib/types/channel/sanitize.d.ts +14 -0
  79. package/lib/types/channel/sanitize.d.ts.map +1 -1
  80. package/lib/types/channel/sanitize.js +55 -0
  81. package/lib/types/channel/working-directory.d.ts +9 -0
  82. package/lib/types/channel/working-directory.d.ts.map +1 -0
  83. package/lib/types/channel/working-directory.js +7 -0
  84. package/lib/types/commands.d.ts +8 -1
  85. package/lib/types/commands.d.ts.map +1 -1
  86. package/lib/types/commands.js +14 -5
  87. package/lib/types/components/ChatTitle.d.ts +7 -0
  88. package/lib/types/components/ChatTitle.d.ts.map +1 -0
  89. package/lib/types/components/ChatTitle.js +15 -0
  90. package/lib/types/components/CodeBlockFrame.d.ts.map +1 -1
  91. package/lib/types/components/CodeBlockFrame.js +10 -5
  92. package/lib/types/components/CompactionStatusRow.d.ts.map +1 -1
  93. package/lib/types/components/CompactionStatusRow.js +24 -3
  94. package/lib/types/components/GoalTodoPanel.d.ts +73 -6
  95. package/lib/types/components/GoalTodoPanel.d.ts.map +1 -1
  96. package/lib/types/components/GoalTodoPanel.js +165 -17
  97. package/lib/types/components/Markdown.d.ts +9 -1
  98. package/lib/types/components/Markdown.d.ts.map +1 -1
  99. package/lib/types/components/Markdown.js +5 -4
  100. package/lib/types/components/MessageList.d.ts.map +1 -1
  101. package/lib/types/components/MessageList.js +20 -14
  102. package/lib/types/components/PluginGrantList.d.ts +45 -0
  103. package/lib/types/components/PluginGrantList.d.ts.map +1 -0
  104. package/lib/types/components/PluginGrantList.js +126 -0
  105. package/lib/types/components/PluginInstallPane.d.ts.map +1 -1
  106. package/lib/types/components/PluginInstallPane.js +35 -6
  107. package/lib/types/components/PluginManagePane.d.ts.map +1 -1
  108. package/lib/types/components/PluginManagePane.js +65 -8
  109. package/lib/types/components/PromptInput.d.ts +13 -5
  110. package/lib/types/components/PromptInput.d.ts.map +1 -1
  111. package/lib/types/components/PromptInput.js +190 -108
  112. package/lib/types/components/SplitDiffView.d.ts.map +1 -1
  113. package/lib/types/components/SplitDiffView.js +232 -22
  114. package/lib/types/components/SubagentDashboard.d.ts.map +1 -1
  115. package/lib/types/components/SubagentDashboard.js +10 -0
  116. package/lib/types/components/SubagentDetailScene.d.ts +3 -1
  117. package/lib/types/components/SubagentDetailScene.d.ts.map +1 -1
  118. package/lib/types/components/SubagentDetailScene.js +17 -1
  119. package/lib/types/components/Whale.d.ts.map +1 -1
  120. package/lib/types/components/Whale.js +8 -5
  121. package/lib/types/components/approvals/ApprovalPanel.d.ts +1 -1
  122. package/lib/types/components/approvals/ApprovalPanel.d.ts.map +1 -1
  123. package/lib/types/components/approvals/ApprovalPanel.js +93 -11
  124. package/lib/types/components/bigfont.d.ts.map +1 -1
  125. package/lib/types/components/bigfont.js +2 -1
  126. package/lib/types/components/messages/AssistantToolUseMessage.d.ts +2 -1
  127. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  128. package/lib/types/components/messages/AssistantToolUseMessage.js +24 -11
  129. package/lib/types/components/onboardingModel.d.ts +2 -2
  130. package/lib/types/components/onboardingModel.js +3 -3
  131. package/lib/types/components/onboardingProviderPlan.d.ts +110 -0
  132. package/lib/types/components/onboardingProviderPlan.d.ts.map +1 -0
  133. package/lib/types/components/onboardingProviderPlan.js +78 -0
  134. package/lib/types/components/previewRows.d.ts +19 -0
  135. package/lib/types/components/previewRows.d.ts.map +1 -0
  136. package/lib/types/components/previewRows.js +46 -0
  137. package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -1
  138. package/lib/types/components/questions/AskUserQuestionPanel.js +75 -10
  139. package/lib/types/components/sessions/ForeignSessionRow.d.ts +3 -9
  140. package/lib/types/components/sessions/ForeignSessionRow.d.ts.map +1 -1
  141. package/lib/types/components/sessions/ForeignSessionRow.js +6 -10
  142. package/lib/types/components/sessions/SessionListRow.d.ts +4 -9
  143. package/lib/types/components/sessions/SessionListRow.d.ts.map +1 -1
  144. package/lib/types/components/sessions/SessionListRow.js +18 -10
  145. package/lib/types/components/sidePanel/InfoPanel.d.ts.map +1 -1
  146. package/lib/types/components/sidePanel/InfoPanel.js +4 -3
  147. package/lib/types/components/sidePanel/SidePanelLayout.d.ts.map +1 -1
  148. package/lib/types/components/sidePanel/SidePanelLayout.js +5 -5
  149. package/lib/types/components/sidePanel/WorkspacePanel.d.ts.map +1 -1
  150. package/lib/types/components/sidePanel/WorkspacePanel.js +19 -7
  151. package/lib/types/components/sidePanel/btw/BtwComposer.d.ts +7 -0
  152. package/lib/types/components/sidePanel/btw/BtwComposer.d.ts.map +1 -1
  153. package/lib/types/components/sidePanel/btw/BtwComposer.js +16 -0
  154. package/lib/types/components/sidePanel/btw/BtwPanelAdapter.d.ts.map +1 -1
  155. package/lib/types/components/sidePanel/btw/BtwPanelAdapter.js +8 -1
  156. package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts +7 -1
  157. package/lib/types/components/sidePanel/btw/BtwThreadScene.d.ts.map +1 -1
  158. package/lib/types/components/sidePanel/btw/BtwThreadScene.js +8 -1
  159. package/lib/types/components/sidePanel/btw/useBtwComposerPaste.d.ts +30 -0
  160. package/lib/types/components/sidePanel/btw/useBtwComposerPaste.d.ts.map +1 -0
  161. package/lib/types/components/sidePanel/btw/useBtwComposerPaste.js +94 -0
  162. package/lib/types/components/sidePanel/builtinPanels.d.ts.map +1 -1
  163. package/lib/types/components/sidePanel/builtinPanels.js +36 -18
  164. package/lib/types/components/sidePanel/companion/CompanionPanel.d.ts.map +1 -1
  165. package/lib/types/components/sidePanel/companion/CompanionPanel.js +2 -1
  166. package/lib/types/components/sidePanel/panelMarkdown.d.ts +32 -0
  167. package/lib/types/components/sidePanel/panelMarkdown.d.ts.map +1 -0
  168. package/lib/types/components/sidePanel/panelMarkdown.js +45 -0
  169. package/lib/types/components/sidePanel/pluginPanelAdapter.d.ts.map +1 -1
  170. package/lib/types/components/sidePanel/pluginPanelAdapter.js +6 -1
  171. package/lib/types/components/sidePanel/subagentFailureRead.d.ts +21 -0
  172. package/lib/types/components/sidePanel/subagentFailureRead.d.ts.map +1 -0
  173. package/lib/types/components/sidePanel/subagentFailureRead.js +66 -0
  174. package/lib/types/components/sidePanel/types.d.ts +2 -0
  175. package/lib/types/components/sidePanel/types.d.ts.map +1 -1
  176. package/lib/types/components/sidePanel/useSidePanel.d.ts.map +1 -1
  177. package/lib/types/components/sidePanel/useSidePanel.js +39 -7
  178. package/lib/types/components/trajectory/MiniWake.d.ts +2 -2
  179. package/lib/types/components/trajectory/MiniWake.d.ts.map +1 -1
  180. package/lib/types/components/trajectory/MiniWake.js +7 -3
  181. package/lib/types/components/workspaces/HomeWorkspaceRow.d.ts.map +1 -1
  182. package/lib/types/components/workspaces/HomeWorkspaceRow.js +4 -7
  183. package/lib/types/dsh-adapter/backend/session.d.ts +7 -1
  184. package/lib/types/dsh-adapter/backend/session.d.ts.map +1 -1
  185. package/lib/types/dsh-adapter/backend/session.js +62 -6
  186. package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
  187. package/lib/types/dsh-adapter/backend/translate.js +18 -4
  188. package/lib/types/dsh-adapter/backend-admission.d.ts +3 -3
  189. package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts +1 -1
  190. package/lib/types/dsh-adapter/channel/agent-view-projection.d.ts.map +1 -1
  191. package/lib/types/dsh-adapter/channel/agent-view-projection.js +3 -1
  192. package/lib/types/dsh-adapter/channel/binding-events.d.ts +5 -1
  193. package/lib/types/dsh-adapter/channel/binding-events.d.ts.map +1 -1
  194. package/lib/types/dsh-adapter/channel/binding-events.js +18 -1
  195. package/lib/types/dsh-adapter/channel/command-completions.d.ts.map +1 -1
  196. package/lib/types/dsh-adapter/channel/command-completions.js +6 -8
  197. package/lib/types/dsh-adapter/channel/composer-images.d.ts +11 -1
  198. package/lib/types/dsh-adapter/channel/composer-images.d.ts.map +1 -1
  199. package/lib/types/dsh-adapter/channel/composer-images.js +121 -113
  200. package/lib/types/dsh-adapter/channel/composer-mentions.d.ts.map +1 -1
  201. package/lib/types/dsh-adapter/channel/composer-mentions.js +38 -17
  202. package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts +1 -1
  203. package/lib/types/dsh-adapter/channel/context-bookkeeping.d.ts.map +1 -1
  204. package/lib/types/dsh-adapter/channel/context-bookkeeping.js +9 -5
  205. package/lib/types/dsh-adapter/channel/core/actions.d.ts +1 -1
  206. package/lib/types/dsh-adapter/channel/core/actions.d.ts.map +1 -1
  207. package/lib/types/dsh-adapter/channel/core/actions.js +23 -2
  208. package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts +10 -1
  209. package/lib/types/dsh-adapter/channel/core/binding-feed.d.ts.map +1 -1
  210. package/lib/types/dsh-adapter/channel/core/binding-feed.js +48 -3
  211. package/lib/types/dsh-adapter/channel/core/compose.d.ts +5 -2
  212. package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
  213. package/lib/types/dsh-adapter/channel/core/compose.js +7 -0
  214. package/lib/types/dsh-adapter/channel/core/files.d.ts.map +1 -1
  215. package/lib/types/dsh-adapter/channel/core/files.js +2 -1
  216. package/lib/types/dsh-adapter/channel/core/host.d.ts +14 -10
  217. package/lib/types/dsh-adapter/channel/core/host.d.ts.map +1 -1
  218. package/lib/types/dsh-adapter/channel/core/host.js +192 -13
  219. package/lib/types/dsh-adapter/channel/core/local-actions.d.ts +1 -0
  220. package/lib/types/dsh-adapter/channel/core/local-actions.d.ts.map +1 -1
  221. package/lib/types/dsh-adapter/channel/core/local-actions.js +32 -3
  222. package/lib/types/dsh-adapter/channel/extensions.d.ts.map +1 -1
  223. package/lib/types/dsh-adapter/channel/extensions.js +31 -5
  224. package/lib/types/dsh-adapter/channel/input-actions.d.ts +2 -2
  225. package/lib/types/dsh-adapter/channel/input-actions.d.ts.map +1 -1
  226. package/lib/types/dsh-adapter/channel/input-actions.js +34 -0
  227. package/lib/types/dsh-adapter/channel/input-delivery.d.ts +5 -2
  228. package/lib/types/dsh-adapter/channel/input-delivery.d.ts.map +1 -1
  229. package/lib/types/dsh-adapter/channel/input-delivery.js +31 -4
  230. package/lib/types/dsh-adapter/channel/mentions.d.ts.map +1 -1
  231. package/lib/types/dsh-adapter/channel/mentions.js +21 -7
  232. package/lib/types/dsh-adapter/channel/model-actions.d.ts +1 -1
  233. package/lib/types/dsh-adapter/channel/model-actions.d.ts.map +1 -1
  234. package/lib/types/dsh-adapter/channel/model-actions.js +7 -1
  235. package/lib/types/dsh-adapter/channel/model-selection.d.ts.map +1 -1
  236. package/lib/types/dsh-adapter/channel/model-selection.js +6 -4
  237. package/lib/types/dsh-adapter/channel/paths.d.ts.map +1 -1
  238. package/lib/types/dsh-adapter/channel/paths.js +11 -9
  239. package/lib/types/dsh-adapter/channel/session-fork.d.ts.map +1 -1
  240. package/lib/types/dsh-adapter/channel/session-fork.js +1 -0
  241. package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts +1 -1
  242. package/lib/types/dsh-adapter/channel/session-live-adoption.d.ts.map +1 -1
  243. package/lib/types/dsh-adapter/channel/session-live-adoption.js +6 -1
  244. package/lib/types/dsh-adapter/channel/session-metadata.d.ts.map +1 -1
  245. package/lib/types/dsh-adapter/channel/session-metadata.js +15 -2
  246. package/lib/types/dsh-adapter/channel/session-reset.d.ts +1 -1
  247. package/lib/types/dsh-adapter/channel/session-reset.d.ts.map +1 -1
  248. package/lib/types/dsh-adapter/channel/session-reset.js +7 -1
  249. package/lib/types/dsh-adapter/channel/session-resume.d.ts +1 -1
  250. package/lib/types/dsh-adapter/channel/session-resume.d.ts.map +1 -1
  251. package/lib/types/dsh-adapter/channel/session-resume.js +56 -36
  252. package/lib/types/dsh-adapter/channel/session-rewind.d.ts +1 -1
  253. package/lib/types/dsh-adapter/channel/session-rewind.d.ts.map +1 -1
  254. package/lib/types/dsh-adapter/channel/session-rewind.js +3 -1
  255. package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts +1 -1
  256. package/lib/types/dsh-adapter/channel/session-tree-actions.d.ts.map +1 -1
  257. package/lib/types/dsh-adapter/channel/session-tree-actions.js +3 -1
  258. package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
  259. package/lib/types/dsh-adapter/channel/settings-host.js +10 -3
  260. package/lib/types/dsh-adapter/channel/state.d.ts +1 -1
  261. package/lib/types/dsh-adapter/channel/state.d.ts.map +1 -1
  262. package/lib/types/dsh-adapter/channel/state.js +2 -2
  263. package/lib/types/dsh-adapter/channel/types.d.ts +13 -1
  264. package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
  265. package/lib/types/dsh-adapter/compat/liveSession.d.ts +3 -3
  266. package/lib/types/dsh-adapter/compat/liveSession.js +3 -3
  267. package/lib/types/dsh-adapter/compat/sessionLog.d.ts +1 -1
  268. package/lib/types/dsh-adapter/compat/sessionLog.d.ts.map +1 -1
  269. package/lib/types/dsh-adapter/compat/sessionLog.js +17 -1
  270. package/lib/types/dsh-adapter/contract.d.ts +7 -5
  271. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  272. package/lib/types/dsh-adapter/contract.js +10 -5
  273. package/lib/types/dsh-adapter/effect-ledger.d.ts +1 -1
  274. package/lib/types/dsh-adapter/effect-ledger.d.ts.map +1 -1
  275. package/lib/types/dsh-adapter/effect-ledger.js +1 -0
  276. package/lib/types/dsh-adapter/entry-slot.d.ts +6 -0
  277. package/lib/types/dsh-adapter/entry-slot.d.ts.map +1 -1
  278. package/lib/types/dsh-adapter/experimental-bundles.d.ts +29 -0
  279. package/lib/types/dsh-adapter/experimental-bundles.d.ts.map +1 -0
  280. package/lib/types/dsh-adapter/experimental-bundles.js +15 -0
  281. package/lib/types/dsh-adapter/grant-file.d.ts +70 -0
  282. package/lib/types/dsh-adapter/grant-file.d.ts.map +1 -0
  283. package/lib/types/dsh-adapter/grant-file.js +178 -0
  284. package/lib/types/dsh-adapter/host-access.d.ts +4 -0
  285. package/lib/types/dsh-adapter/host-access.d.ts.map +1 -1
  286. package/lib/types/dsh-adapter/host-access.js +54 -4
  287. package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
  288. package/lib/types/dsh-adapter/host-contract.js +2 -2
  289. package/lib/types/dsh-adapter/host-dsh.js +3 -3
  290. package/lib/types/dsh-adapter/index.d.ts +8 -4
  291. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  292. package/lib/types/dsh-adapter/index.js +17 -12
  293. package/lib/types/dsh-adapter/panels.d.ts +28 -8
  294. package/lib/types/dsh-adapter/panels.d.ts.map +1 -1
  295. package/lib/types/dsh-adapter/panels.js +11 -56
  296. package/lib/types/dsh-adapter/plugin-declaration.d.ts +28 -0
  297. package/lib/types/dsh-adapter/plugin-declaration.d.ts.map +1 -1
  298. package/lib/types/dsh-adapter/plugin-declaration.js +43 -1
  299. package/lib/types/dsh-adapter/plugin-install.d.ts +28 -1
  300. package/lib/types/dsh-adapter/plugin-install.d.ts.map +1 -1
  301. package/lib/types/dsh-adapter/plugin-install.js +160 -13
  302. package/lib/types/dsh-adapter/plugin-manage.d.ts +53 -10
  303. package/lib/types/dsh-adapter/plugin-manage.d.ts.map +1 -1
  304. package/lib/types/dsh-adapter/plugin-manage.js +240 -51
  305. package/lib/types/dsh-adapter/plugin.d.ts +81 -0
  306. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  307. package/lib/types/dsh-adapter/plugin.js +378 -84
  308. package/lib/types/dsh-adapter/plugins-info.d.ts +6 -7
  309. package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -1
  310. package/lib/types/dsh-adapter/plugins-info.js +99 -31
  311. package/lib/types/dsh-adapter/presets.d.ts +19 -6
  312. package/lib/types/dsh-adapter/presets.d.ts.map +1 -1
  313. package/lib/types/dsh-adapter/presets.js +69 -12
  314. package/lib/types/dsh-adapter/process-exit.d.ts +1 -1
  315. package/lib/types/dsh-adapter/process-exit.js +1 -1
  316. package/lib/types/dsh-adapter/providerWizard.d.ts +2 -0
  317. package/lib/types/dsh-adapter/providerWizard.d.ts.map +1 -1
  318. package/lib/types/dsh-adapter/providerWizard.js +11 -5
  319. package/lib/types/dsh-adapter/row-attachment.d.ts +30 -0
  320. package/lib/types/dsh-adapter/row-attachment.d.ts.map +1 -0
  321. package/lib/types/dsh-adapter/row-attachment.js +29 -0
  322. package/lib/types/dsh-adapter/session-tools.d.ts +34 -0
  323. package/lib/types/dsh-adapter/session-tools.d.ts.map +1 -0
  324. package/lib/types/dsh-adapter/session-tools.js +39 -0
  325. package/lib/types/dsh-adapter/settings-sections.d.ts +18 -1
  326. package/lib/types/dsh-adapter/settings-sections.d.ts.map +1 -1
  327. package/lib/types/dsh-adapter/settings-sections.js +73 -0
  328. package/lib/types/dsh-adapter/status.d.ts +88 -1
  329. package/lib/types/dsh-adapter/status.d.ts.map +1 -1
  330. package/lib/types/dsh-adapter/status.js +318 -3
  331. package/lib/types/dsh-adapter/team-mode.d.ts +42 -33
  332. package/lib/types/dsh-adapter/team-mode.d.ts.map +1 -1
  333. package/lib/types/dsh-adapter/team-mode.js +76 -112
  334. package/lib/types/dsh-adapter/worktree-tool.d.ts +27 -0
  335. package/lib/types/dsh-adapter/worktree-tool.d.ts.map +1 -0
  336. package/lib/types/dsh-adapter/worktree-tool.js +87 -0
  337. package/lib/types/extensions.d.ts +1 -1
  338. package/lib/types/extensions.d.ts.map +1 -1
  339. package/lib/types/force-production-react.js +3 -3
  340. package/lib/types/heldInputs.d.ts +36 -0
  341. package/lib/types/heldInputs.d.ts.map +1 -0
  342. package/lib/types/heldInputs.js +173 -0
  343. package/lib/types/i18n.d.ts +543 -73
  344. package/lib/types/i18n.d.ts.map +1 -1
  345. package/lib/types/i18n.js +265 -46
  346. package/lib/types/ink/colorize.d.ts +7 -1
  347. package/lib/types/ink/colorize.d.ts.map +1 -1
  348. package/lib/types/ink/colorize.js +29 -8
  349. package/lib/types/ink/components/App.d.ts +2 -1
  350. package/lib/types/ink/components/App.d.ts.map +1 -1
  351. package/lib/types/ink/components/App.js +10 -3
  352. package/lib/types/ink/components/ScrollBox.d.ts.map +1 -1
  353. package/lib/types/ink/components/ScrollBox.js +1 -0
  354. package/lib/types/ink/dom.d.ts +1 -0
  355. package/lib/types/ink/dom.d.ts.map +1 -1
  356. package/lib/types/ink/hooks/use-program-status.d.ts +78 -0
  357. package/lib/types/ink/hooks/use-program-status.d.ts.map +1 -0
  358. package/lib/types/ink/hooks/use-program-status.js +96 -0
  359. package/lib/types/ink/ink.d.ts +13 -4
  360. package/lib/types/ink/ink.d.ts.map +1 -1
  361. package/lib/types/ink/ink.js +119 -25
  362. package/lib/types/ink/output.d.ts +17 -2
  363. package/lib/types/ink/output.d.ts.map +1 -1
  364. package/lib/types/ink/output.js +85 -2
  365. package/lib/types/ink/parse-keypress.d.ts +1 -0
  366. package/lib/types/ink/parse-keypress.d.ts.map +1 -1
  367. package/lib/types/ink/parse-keypress.js +5 -4
  368. package/lib/types/ink/render-node-to-output.d.ts +2 -0
  369. package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
  370. package/lib/types/ink/render-node-to-output.js +79 -10
  371. package/lib/types/ink/root.d.ts +8 -0
  372. package/lib/types/ink/root.d.ts.map +1 -1
  373. package/lib/types/ink/root.js +12 -3
  374. package/lib/types/ink/screen.d.ts +11 -0
  375. package/lib/types/ink/screen.d.ts.map +1 -1
  376. package/lib/types/ink/screen.js +44 -0
  377. package/lib/types/ink/selection.d.ts +7 -2
  378. package/lib/types/ink/selection.d.ts.map +1 -1
  379. package/lib/types/ink/selection.js +187 -44
  380. package/lib/types/ink/shutdown-input.d.ts +15 -0
  381. package/lib/types/ink/shutdown-input.d.ts.map +1 -0
  382. package/lib/types/ink/shutdown-input.js +28 -0
  383. package/lib/types/ink/sixel-cursor-heal.d.ts +21 -0
  384. package/lib/types/ink/sixel-cursor-heal.d.ts.map +1 -0
  385. package/lib/types/ink/sixel-cursor-heal.js +62 -0
  386. package/lib/types/ink/sixel-graphics.d.ts +6 -0
  387. package/lib/types/ink/sixel-graphics.d.ts.map +1 -1
  388. package/lib/types/ink/sixel-graphics.js +18 -0
  389. package/lib/types/ink/styles.d.ts +8 -1
  390. package/lib/types/ink/styles.d.ts.map +1 -1
  391. package/lib/types/ink/terminal-notification-windows.d.ts +195 -0
  392. package/lib/types/ink/terminal-notification-windows.d.ts.map +1 -0
  393. package/lib/types/ink/terminal-notification-windows.js +433 -0
  394. package/lib/types/ink/terminal-notification.d.ts +3 -1
  395. package/lib/types/ink/terminal-notification.d.ts.map +1 -1
  396. package/lib/types/ink/terminal-notification.js +4 -1
  397. package/lib/types/ink/terminal-querier.d.ts +9 -1
  398. package/lib/types/ink/terminal-querier.d.ts.map +1 -1
  399. package/lib/types/ink/terminal-querier.js +32 -1
  400. package/lib/types/ink/terminal.d.ts +23 -2
  401. package/lib/types/ink/terminal.d.ts.map +1 -1
  402. package/lib/types/ink/terminal.js +32 -2
  403. package/lib/types/ink/termio/osc.d.ts +2 -1
  404. package/lib/types/ink/termio/osc.d.ts.map +1 -1
  405. package/lib/types/ink/termio/osc.js +37 -8
  406. package/lib/types/ink/termio/osc7501.d.ts +102 -0
  407. package/lib/types/ink/termio/osc7501.d.ts.map +1 -0
  408. package/lib/types/ink/termio/osc7501.js +229 -0
  409. package/lib/types/ink/termio/tokenize.js +5 -7
  410. package/lib/types/onboardingDraft.d.ts +143 -0
  411. package/lib/types/onboardingDraft.d.ts.map +1 -0
  412. package/lib/types/onboardingDraft.js +71 -0
  413. package/lib/types/panels.d.ts +1 -1
  414. package/lib/types/panels.d.ts.map +1 -1
  415. package/lib/types/screens/AgentTranscriptScene.d.ts +3 -1
  416. package/lib/types/screens/AgentTranscriptScene.d.ts.map +1 -1
  417. package/lib/types/screens/AgentTranscriptScene.js +5 -1
  418. package/lib/types/screens/Chat.d.ts +6 -6
  419. package/lib/types/screens/Chat.d.ts.map +1 -1
  420. package/lib/types/screens/Chat.js +394 -141
  421. package/lib/types/screens/Launchpad.d.ts +8 -2
  422. package/lib/types/screens/Launchpad.d.ts.map +1 -1
  423. package/lib/types/screens/Launchpad.js +32 -12
  424. package/lib/types/screens/Onboarding.d.ts +22 -3
  425. package/lib/types/screens/Onboarding.d.ts.map +1 -1
  426. package/lib/types/screens/Onboarding.js +606 -36
  427. package/lib/types/screens/SessionSupervisor.d.ts.map +1 -1
  428. package/lib/types/screens/SessionSupervisor.js +31 -21
  429. package/lib/types/screens/Settings.d.ts +5 -1
  430. package/lib/types/screens/Settings.d.ts.map +1 -1
  431. package/lib/types/screens/Settings.js +528 -51
  432. package/lib/types/screens/StatusLine.d.ts +9 -3
  433. package/lib/types/screens/StatusLine.d.ts.map +1 -1
  434. package/lib/types/screens/StatusLine.js +91 -15
  435. package/lib/types/screens/StatusMetrics.d.ts +2 -11
  436. package/lib/types/screens/StatusMetrics.d.ts.map +1 -1
  437. package/lib/types/screens/StatusMetrics.js +20 -14
  438. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.d.ts.map +1 -1
  439. package/lib/types/screens/sessionSupervisor/ForeignSessionPanes.js +1 -1
  440. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts +1 -1
  441. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.d.ts.map +1 -1
  442. package/lib/types/screens/sessionSupervisor/useSessionSupervisor.js +13 -21
  443. package/lib/types/sessionMounts.d.ts +14 -0
  444. package/lib/types/sessionMounts.d.ts.map +1 -1
  445. package/lib/types/sessionMounts.js +20 -9
  446. package/lib/types/sessions/format.d.ts +39 -0
  447. package/lib/types/sessions/format.d.ts.map +1 -1
  448. package/lib/types/sessions/format.js +83 -0
  449. package/lib/types/sessions/resumeFailure.d.ts +4 -0
  450. package/lib/types/sessions/resumeFailure.d.ts.map +1 -1
  451. package/lib/types/sessions/resumeFailure.js +12 -4
  452. package/lib/types/sessions/workspaceCounts.d.ts +6 -0
  453. package/lib/types/sessions/workspaceCounts.d.ts.map +1 -0
  454. package/lib/types/sessions/workspaceCounts.js +24 -0
  455. package/lib/types/settings/definitions.d.ts +24 -0
  456. package/lib/types/settings/definitions.d.ts.map +1 -1
  457. package/lib/types/settings/definitions.js +40 -15
  458. package/lib/types/tips.js +2 -2
  459. package/lib/types/tuiDisplayPrefs.d.ts +113 -5
  460. package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
  461. package/lib/types/tuiDisplayPrefs.js +276 -14
  462. package/lib/types/update.d.ts +15 -14
  463. package/lib/types/update.d.ts.map +1 -1
  464. package/lib/types/update.js +163 -115
  465. package/lib/types/updateProcess.d.ts +28 -0
  466. package/lib/types/updateProcess.d.ts.map +1 -0
  467. package/lib/types/updateProcess.js +135 -0
  468. package/lib/types/utils/inputWordBoundary.d.ts +5 -0
  469. package/lib/types/utils/inputWordBoundary.d.ts.map +1 -0
  470. package/lib/types/utils/inputWordBoundary.js +18 -0
  471. package/lib/types/utils/keymap.d.ts +1 -1
  472. package/lib/types/utils/keymap.d.ts.map +1 -1
  473. package/lib/types/utils/keymap.js +6 -1
  474. package/lib/types/utils/paths.d.ts +15 -0
  475. package/lib/types/utils/paths.d.ts.map +1 -1
  476. package/lib/types/utils/paths.js +25 -0
  477. package/lib/types/windowsInstaller.d.ts +4 -0
  478. package/lib/types/windowsInstaller.d.ts.map +1 -0
  479. package/lib/types/windowsInstaller.js +237 -0
  480. package/locale/en.json +6 -0
  481. package/locale/zh.json +6 -0
  482. package/package.json +130 -111
  483. package/presets/liangshen/custom-bash.mjs +13 -1
  484. package/presets/liangshen/instruction-hint.mjs +4 -1
  485. package/presets/liangshen/skill-search.mjs +14 -2
  486. package/presets/winbash.mjs +16 -4
  487. package/tui-profile/feed/README.md +17 -8
  488. package/tui-profile/feed/first-party.json +1 -1
@@ -29,7 +29,8 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
29
29
  */
30
30
  import React from 'react';
31
31
  import { t } from '../../i18n.js';
32
- import { Box, Text, useInput, useTerminalSize } from '../../ui.js';
32
+ import { Box, Text, ScrollBox, useInput, useTerminalSize } from '../../ui.js';
33
+ import wrapText from '../../ink/wrap-text.js';
33
34
  import { useDeclaredCursor, useNativeCursor } from '../../ink/hooks/use-declared-cursor.js';
34
35
  import { Divider } from '../design-system/Divider.js';
35
36
  import { POINTER } from '../../terminal-utils/figures.js';
@@ -42,6 +43,7 @@ import { flattenPasteInline } from '../../dsh-adapter/sanitize.js';
42
43
  import { readClipboard } from '../../utils/clipboard.js';
43
44
  import { createHyperlink } from '../../terminal-utils/hyperlink.js';
44
45
  import { listWindow } from '../listWindow.js';
46
+ import { clipPreviewRows, pagePreview } from '../previewRows.js';
45
47
  /** Unmodified arrows switch questions; Ctrl/Alt/Super/Shift stay caret motion. */
46
48
  function isPlainArrow(key) {
47
49
  return key.ctrl !== true && key.meta !== true && key.super !== true && key.shift !== true;
@@ -61,6 +63,14 @@ const SECRET_MASK = '•';
61
63
  * PlanReviewPanel (the two panels share the same input contract).
62
64
  */
63
65
  const ANSWER_PASTE_MAX_POINTS = 8000;
66
+ /**
67
+ * Preview caps (#1664): each field contributes at most these rows to the
68
+ * shared body viewport, keeping the option list and key hint on screen. A
69
+ * short terminal shrinks them further through QUESTION_CHROME_ROWS — the
70
+ * rows the chrome and the panel scaffolding need before any preview text.
71
+ */
72
+ const QUESTION_PREVIEW_MAX_ROWS = 6;
73
+ const QUESTION_CHROME_ROWS = 20;
64
74
  export function AskUserQuestionPanel({ question, position, total, answered, initialDraft, onAnswer, onCancel, onEscape, onBack, onForward, readClipboardOverride, collapsed = false, onExpand, onToggleFold, fullscreen = false, }) {
65
75
  // Plan-mode's exit_plan_mode ask carries a presentation intent: render
66
76
  // the plan decision card instead of the generic questionnaire. The
@@ -78,7 +88,7 @@ export function AskUserQuestionPanel({ question, position, total, answered, init
78
88
  // Opening Tab and later keys may share one stdin batch. Stop the list
79
89
  // synchronously, before the nested editor has had a chance to mount.
80
90
  const editingRef = React.useRef(false);
81
- const { rows: terminalRows } = useTerminalSize();
91
+ const { columns: terminalColumns, rows: terminalRows } = useTerminalSize();
82
92
  /** Rows: the real options plus the inline input row at the tail. */
83
93
  const rowCount = options.length + (hideCustomInput ? 0 : 1);
84
94
  // A saved draft wins over the wizard's default selection (returning to a
@@ -150,6 +160,7 @@ export function AskUserQuestionPanel({ question, position, total, answered, init
150
160
  };
151
161
  const onInputRow = () => !hideCustomInput && focusRef.current === options.length;
152
162
  const [error, setError] = React.useState(null);
163
+ const bodyScrollRef = React.useRef(null);
153
164
  const inputFocused = !hideCustomInput && focusIndex === options.length;
154
165
  // Chat chrome + panel scaffolding consume twelve rows before the option
155
166
  // list: status line, outer/divider/question/list/hint spacing and content.
@@ -157,16 +168,55 @@ export function AskUserQuestionPanel({ question, position, total, answered, init
157
168
  // lists then use fixed one/two-line rows so listWindow's budget is exact;
158
169
  // short questionnaires retain their existing wrapped presentation.
159
170
  const linkText = question.link === undefined || question.link === '' ? '' : createHyperlink(question.link);
160
- const detailRows = (question.detail === undefined ? 0 : question.detail.split('\n').length + 1)
161
- + (linkText === '' ? 0 : question.detail === undefined ? 2 : 1);
171
+ // The question and its detail are preview text above the option list, and
172
+ // `wrap` re-flows every long line: counting source lines undercounts the
173
+ // rows they really take, and neither text had a cap — a long question
174
+ // pushed the options and the hint off screen with nothing left to answer
175
+ // (#1664). Pre-wrap to the panel's content width, fold past the cap, and
176
+ // charge the REAL row count to the option budget below.
177
+ const contentCells = Math.max(8, terminalColumns - 4);
178
+ const previewMaxRows = Math.max(2, Math.min(QUESTION_PREVIEW_MAX_ROWS, terminalRows - QUESTION_CHROME_ROWS));
179
+ const questionView = clipPreviewRows(question.question, contentCells, previewMaxRows);
180
+ const questionBlockRows = questionView.rows.length + (questionView.omitted > 0 ? 1 : 0);
181
+ // The question's unused allowance flows to the detail — but only the rows
182
+ // the terminal frees up beyond the chrome floor. On a terminal already at
183
+ // that floor every preview row is contested, and the cap is what keeps the
184
+ // option list and the hint on screen; above it a one-line question must not
185
+ // fold the detail against a budget the question never needed.
186
+ const sparePreviewRows = Math.max(0, terminalRows - QUESTION_CHROME_ROWS - questionBlockRows);
187
+ const detailMaxRows = Math.max(2, Math.min(QUESTION_PREVIEW_MAX_ROWS, previewMaxRows + sparePreviewRows));
188
+ const detailView = question.detail === undefined
189
+ ? undefined
190
+ : clipPreviewRows(question.detail, contentCells, detailMaxRows);
191
+ const detailRows = detailView === undefined
192
+ ? (linkText === '' ? 0 : 2)
193
+ : detailView.rows.length + (detailView.omitted > 0 ? 1 : 0) + 1 + (linkText === '' ? 0 : 1);
194
+ // One viewport keeps the question and its detail independently reachable:
195
+ // a question without a detail must still be readable beyond its preview.
196
+ const bodyRows = questionView.rows.length + questionView.omitted
197
+ + (detailView === undefined ? 0 : detailView.rows.length + detailView.omitted)
198
+ + (question.detail !== undefined || linkText !== '' ? 1 : 0)
199
+ + (linkText === '' ? 0 : wrapText(linkText, contentCells, 'wrap').split('\n').length);
200
+ const previewRows = questionBlockRows + detailRows;
201
+ const bodyScrollRows = bodyRows > previewRows ? Math.max(1, previewRows - 1) : 0;
202
+ const submitRows = multiSelect && fullscreen && (checked.size > 0 || textRef.current !== '') ? 2 : 0;
162
203
  const reservedRows = 12
163
204
  + (question.header === undefined ? 0 : 1)
205
+ + (questionBlockRows - 1)
164
206
  + detailRows
165
207
  + (hideCustomInput ? 0 : 1)
166
- + (error === null ? 0 : 2);
208
+ + (error === null ? 0 : 2)
209
+ + submitRows;
167
210
  const optionBudget = Math.max(terminalRows - reservedRows, 2);
168
211
  const optionHeights = options.map(option => option.description === undefined ? 1 : 2);
169
- const windowedOptions = optionHeights.reduce((sum, height) => sum + height, 0) > optionBudget;
212
+ const optionLabels = options.map(option => option.label + (modelEditor?.edited(option.label) ? ` ${t('provider-model-edited')}` : ''));
213
+ // Non-windowed rows wrap at their actual text width. Reducing the preview
214
+ // must not disable windowing just because a multiline description was
215
+ // counted as one line. Windowed rows below still have fixed 1/2-row heights.
216
+ const optionCells = Math.max(1, contentCells - 3);
217
+ const wrappedOptionRows = options.reduce((sum, option, index) => sum + wrapText(optionLabels[index], optionCells, 'wrap').split('\n').length
218
+ + (option.description === undefined ? 0 : wrapText(option.description, optionCells, 'wrap').split('\n').length), 0);
219
+ const windowedOptions = wrappedOptionRows > optionBudget;
170
220
  const optionFocus = Math.min(focusIndex, Math.max(options.length - 1, 0));
171
221
  const optionWindow = windowedOptions
172
222
  ? listWindow(optionHeights, optionFocus, optionBudget)
@@ -372,6 +422,15 @@ export function AskUserQuestionPanel({ question, position, total, answered, init
372
422
  }
373
423
  return;
374
424
  }
425
+ if (bodyScrollRows > 0) {
426
+ const up = actionMatches('questionDetailUp', input, key);
427
+ const down = actionMatches('questionDetailDown', input, key);
428
+ if (up || down) {
429
+ pagePreview(bodyScrollRef.current, up ? -1 : 1);
430
+ event.stopImmediatePropagation();
431
+ return;
432
+ }
433
+ }
375
434
  if (key.ctrl && input === 'c') {
376
435
  onCancel();
377
436
  return;
@@ -596,12 +655,13 @@ export function AskUserQuestionPanel({ question, position, total, answered, init
596
655
  : absoluteIndex === optionWindow.end - 1 && optionWindow.end < options.length
597
656
  ? '↓'
598
657
  : ' ';
599
- const label = windowedOptions ? option.label.replace(/\s+/gu, ' ').trim() : option.label;
658
+ const optionLabel = optionLabels[absoluteIndex];
659
+ const label = windowedOptions ? optionLabel.replace(/\s+/gu, ' ').trim() : optionLabel;
600
660
  const description = windowedOptions
601
661
  ? option.description?.replace(/\s+/gu, ' ').trim()
602
662
  : option.description;
603
- return (_jsxs(Box, { flexDirection: "row", marginTop: !windowedOptions && focused ? 1 : 0, onClick: () => clickOption(absoluteIndex), onMouseEnter: () => setHoverIndex(absoluteIndex), onMouseLeave: () => setHoverIndex(current => (current === absoluteIndex ? -1 : current)), backgroundColor: hoverIndex === absoluteIndex && !focused ? 'userMessageBackgroundHover' : undefined, children: [_jsx(Box, { width: 1, flexShrink: 0, children: _jsx(Text, { color: focused ? 'accent' : undefined, bold: focused, children: pointer }) }), _jsx(Box, { width: 1, flexShrink: 0, children: _jsx(Text, { color: focused ? 'accent' : undefined, bold: selected, children: selected ? (multiSelect ? CHECKED : '●') : UNCHECKED }) }), _jsxs(Box, { flexDirection: "column", marginLeft: 1, children: [_jsxs(Text, { bold: focused || selected, color: focused ? 'accent' : undefined, wrap: windowedOptions ? 'truncate' : 'wrap', children: [label, modelEditor?.edited(option.label) ? ` ${t('provider-model-edited')}` : ''] }), description !== undefined && (_jsx(Text, { dimColor: true, wrap: windowedOptions ? 'truncate' : 'wrap', children: description }))] })] }, `${absoluteIndex}:${option.label}`));
604
- }), hideCustomInput ? null : renderInputRow(), multiSelect && fullscreen && (checked.size > 0 || textRef.current !== '') && (_jsxs(Box, { flexDirection: "row", height: 1, marginTop: 1, onClick: submitOptions, onMouseEnter: () => setSubmitHovered(true), onMouseLeave: () => setSubmitHovered(false), backgroundColor: submitHovered ? 'userMessageBackgroundHover' : undefined, children: [_jsx(Text, { color: "accent", children: "\u2713 " }), _jsx(Text, { dimColor: true, children: t('question-submit-selection') })] }))] }));
663
+ return (_jsxs(Box, { flexDirection: "row", marginTop: !windowedOptions && focused ? 1 : 0, onClick: () => clickOption(absoluteIndex), onMouseEnter: () => setHoverIndex(absoluteIndex), onMouseLeave: () => setHoverIndex(current => (current === absoluteIndex ? -1 : current)), backgroundColor: hoverIndex === absoluteIndex && !focused ? 'userMessageBackgroundHover' : undefined, children: [_jsx(Box, { width: 1, flexShrink: 0, children: _jsx(Text, { color: focused ? 'accent' : undefined, bold: focused, children: pointer }) }), _jsx(Box, { width: 1, flexShrink: 0, children: _jsx(Text, { color: focused ? 'accent' : undefined, bold: selected, children: selected ? (multiSelect ? CHECKED : '●') : UNCHECKED }) }), _jsxs(Box, { flexDirection: "column", marginLeft: 1, children: [_jsx(Text, { bold: focused || selected, color: focused ? 'accent' : undefined, wrap: windowedOptions ? 'truncate' : 'wrap', children: label }), description !== undefined && (_jsx(Text, { dimColor: true, wrap: windowedOptions ? 'truncate' : 'wrap', children: description }))] })] }, `${absoluteIndex}:${option.label}`));
664
+ }), hideCustomInput ? null : renderInputRow(), submitRows > 0 && (_jsxs(Box, { flexDirection: "row", height: 1, marginTop: 1, onClick: submitOptions, onMouseEnter: () => setSubmitHovered(true), onMouseLeave: () => setSubmitHovered(false), backgroundColor: submitHovered ? 'userMessageBackgroundHover' : undefined, children: [_jsx(Text, { color: "accent", children: "\u2713 " }), _jsx(Text, { dimColor: true, children: t('question-submit-selection') })] }))] }));
605
665
  const hintParts = inputFocused
606
666
  ? [
607
667
  t('question-hint-type'),
@@ -639,5 +699,10 @@ export function AskUserQuestionPanel({ question, position, total, answered, init
639
699
  setEditingModel(null);
640
700
  }, onAbort: onCancel, readClipboardOverride: readClipboardOverride });
641
701
  }
642
- return (_jsxs(Box, { flexDirection: "column", marginTop: 1, paddingLeft: 2, paddingRight: 2, width: "100%", children: [_jsx(Box, { flexDirection: "column", onClick: onToggleFold, onMouseEnter: () => setHeaderHovered(true), onMouseLeave: () => setHeaderHovered(false), backgroundColor: headerHovered ? 'userMessageBackgroundHover' : undefined, children: _jsx(Divider, { color: "permission", title: `▾${headerTitle}` }) }), _jsxs(Box, { flexDirection: "column", marginTop: 1, children: [question.header !== undefined && (_jsxs(Text, { color: "suggestion", bold: true, children: ["\u25C8 ", question.header] })), _jsx(Text, { bold: true, wrap: "wrap", children: question.question }), (question.detail !== undefined || linkText !== '') && (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [question.detail?.split('\n').map((line, index) => (_jsx(Text, { dimColor: true, italic: true, wrap: "wrap", children: line }, index))), linkText !== '' && _jsx(Text, { wrap: "wrap", children: linkText })] }))] }), renderOptions(), error !== null && (_jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "error", children: error }) })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: hintParts.join(' · ') }) })] }));
702
+ const body = (_jsxs(_Fragment, { children: [_jsx(Text, { bold: true, wrap: "wrap", children: question.question }), (question.detail !== undefined || linkText !== '') && (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [question.detail !== undefined && _jsx(Text, { dimColor: true, italic: true, wrap: "wrap", children: question.detail }), linkText !== '' && _jsx(Text, { wrap: "wrap", children: linkText })] }))] }));
703
+ return (_jsxs(Box, { flexDirection: "column", marginTop: 1, paddingLeft: 2, paddingRight: 2, width: "100%", children: [_jsx(Box, { flexDirection: "column", onClick: onToggleFold, onMouseEnter: () => setHeaderHovered(true), onMouseLeave: () => setHeaderHovered(false), backgroundColor: headerHovered ? 'userMessageBackgroundHover' : undefined, children: _jsx(Divider, { color: "permission", title: `▾${headerTitle}` }) }), _jsxs(Box, { flexDirection: "column", marginTop: 1, children: [question.header !== undefined && (_jsxs(Text, { color: "suggestion", bold: true, children: ["\u25C8 ", question.header] })), bodyScrollRows > 0 ? (_jsxs(_Fragment, { children: [_jsx(ScrollBox, { ref: bodyScrollRef, flexDirection: "column", height: bodyScrollRows, flexShrink: 0, children: body }), _jsx(Text, { dimColor: true, wrap: "truncate-end", children: t('question-detail-scroll', {
704
+ count: bodyRows - bodyScrollRows,
705
+ up: effectiveComboDisplay('questionDetailUp'),
706
+ down: effectiveComboDisplay('questionDetailDown'),
707
+ }) })] })) : body] }), renderOptions(), error !== null && (_jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "error", children: error }) })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: hintParts.join(' · ') }) })] }));
643
708
  }
@@ -2,8 +2,8 @@ import React from 'react';
2
2
  import type { ClickEvent } from '../../ink/events/click-event.js';
3
3
  import type { ForeignSessionRow as ForeignSessionSummary } from '../../adapter/ports/channel-session.js';
4
4
  /**
5
- * One conversation of another agent in a source tab: its title, and a facts
6
- * line with when it last moved and where it ran.
5
+ * One conversation of another agent in a source tab: its title and age.
6
+ * The directory is shown once for the selected group above both panes.
7
7
  *
8
8
  * It looks like a DSH session row on purpose — the same two lines, the same
9
9
  * `❯`, green selection and blue hover (see SessionListRow) — so the tabs read
@@ -14,20 +14,14 @@ import type { ForeignSessionRow as ForeignSessionSummary } from '../../adapter/p
14
14
  * opens the copy an earlier selection made), so "imported or not" is a detail
15
15
  * of the selection, not a fact the user has to read before choosing; showing it
16
16
  * would also invite a sync the feature does not do.
17
- *
18
- * The working directory rides on the facts line here, unlike the DSH row: the
19
- * rail groups by directory, but a search spans every group of the source and
20
- * "which project was this" is the question a foreign title answers worst.
21
17
  */
22
- export declare function ForeignSessionRow({ session, width, focused, declareCursor, home, now, onClick, }: {
18
+ export declare function ForeignSessionRow({ session, width, focused, declareCursor, now, onClick, }: {
23
19
  session: ForeignSessionSummary;
24
20
  /** Columns available to the row. */
25
21
  width: number;
26
22
  focused: boolean;
27
23
  /** Park the native caret on this row while the list owns it. */
28
24
  declareCursor?: boolean;
29
- /** Home directory, for collapsing the path to `~`. */
30
- home: string;
31
25
  /** Epoch ms used for every relative time in this render pass. */
32
26
  now: number;
33
27
  /** Mouse click: import and open (same path as Enter). */
@@ -1 +1 @@
1
- {"version":3,"file":"ForeignSessionRow.d.ts","sourceRoot":"","sources":["../../../../src/components/sessions/ForeignSessionRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAGjE,OAAO,KAAK,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,MAAM,wCAAwC,CAAA;AAGxG;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,KAAK,EACL,OAAO,EACP,aAAqB,EACrB,IAAI,EACJ,GAAG,EACH,OAAO,GACR,EAAE;IACD,OAAO,EAAE,qBAAqB,CAAA;IAC9B,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,gEAAgE;IAChE,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAA;IACZ,iEAAiE;IACjE,GAAG,EAAE,MAAM,CAAA;IACX,yDAAyD;IACzD,OAAO,CAAC,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAA;CAClC,GAAG,KAAK,CAAC,SAAS,CAqClB"}
1
+ {"version":3,"file":"ForeignSessionRow.d.ts","sourceRoot":"","sources":["../../../../src/components/sessions/ForeignSessionRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAGjE,OAAO,KAAK,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,MAAM,wCAAwC,CAAA;AAGxG;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,KAAK,EACL,OAAO,EACP,aAAqB,EACrB,GAAG,EACH,OAAO,GACR,EAAE;IACD,OAAO,EAAE,qBAAqB,CAAA;IAC9B,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,gEAAgE;IAChE,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,iEAAiE;IACjE,GAAG,EAAE,MAAM,CAAA;IACX,yDAAyD;IACzD,OAAO,CAAC,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAA;CAClC,GAAG,KAAK,CAAC,SAAS,CAqClB"}
@@ -2,11 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import { Box, Text } from '../../ui.js';
4
4
  import { useTooltip } from '../Tooltip.js';
5
- import { formatAbsolute, formatProject, formatWhen, truncateWidth } from '../../sessions/format.js';
5
+ import { formatAbsolute, formatWhen, truncateWidth } from '../../sessions/format.js';
6
6
  import { useDeclaredCursor, useNativeCursor } from '../../ink/hooks/use-declared-cursor.js';
7
7
  /**
8
- * One conversation of another agent in a source tab: its title, and a facts
9
- * line with when it last moved and where it ran.
8
+ * One conversation of another agent in a source tab: its title and age.
9
+ * The directory is shown once for the selected group above both panes.
10
10
  *
11
11
  * It looks like a DSH session row on purpose — the same two lines, the same
12
12
  * `❯`, green selection and blue hover (see SessionListRow) — so the tabs read
@@ -17,12 +17,8 @@ import { useDeclaredCursor, useNativeCursor } from '../../ink/hooks/use-declared
17
17
  * opens the copy an earlier selection made), so "imported or not" is a detail
18
18
  * of the selection, not a fact the user has to read before choosing; showing it
19
19
  * would also invite a sync the feature does not do.
20
- *
21
- * The working directory rides on the facts line here, unlike the DSH row: the
22
- * rail groups by directory, but a search spans every group of the source and
23
- * "which project was this" is the question a foreign title answers worst.
24
20
  */
25
- export function ForeignSessionRow({ session, width, focused, declareCursor = false, home, now, onClick, }) {
21
+ export function ForeignSessionRow({ session, width, focused, declareCursor = false, now, onClick, }) {
26
22
  const [hovered, setHovered] = useState(false);
27
23
  const nativeCursor = useNativeCursor();
28
24
  const cursorRef = useDeclaredCursor({ line: 0, column: 0, active: focused && declareCursor, visible: nativeCursor, hideOnIdle: true });
@@ -38,9 +34,9 @@ export function ForeignSessionRow({ session, width, focused, declareCursor = fal
38
34
  parts.push(session.cwd);
39
35
  return parts.join('\n');
40
36
  });
41
- const facts = [formatWhen(session.updatedAt, now), formatProject(session.cwd, home)];
37
+ const when = formatWhen(session.updatedAt, now);
42
38
  return (_jsxs(Box, { flexDirection: "column", flexShrink: 0, onClick: onClick, onMouseEnter: onClick === undefined ? undefined : () => setHovered(true), onMouseLeave: onClick === undefined ? undefined : () => setHovered(false),
43
39
  // Hover is the blue prompt and never marks the focused row; selection is
44
40
  // the green foreground below, as on the DSH row.
45
- backgroundColor: hovered && !focused ? 'userMessageBackgroundHover' : undefined, children: [_jsxs(Box, { ref: cursorRef, children: [_jsx(Text, { color: focused ? 'success' : 'subtle', children: focused ? '❯ ' : ' ' }), _jsx(Box, { ...titleTooltip, children: _jsx(Text, { color: focused ? 'success' : undefined, bold: focused, children: shownTitle }) })] }), _jsx(Text, { color: focused ? 'success' : undefined, dimColor: !focused, children: ` ${truncateWidth(facts.join(' · '), body)}` })] }));
41
+ backgroundColor: hovered && !focused ? 'userMessageBackgroundHover' : undefined, children: [_jsxs(Box, { ref: cursorRef, children: [_jsx(Text, { color: focused ? 'success' : 'subtle', children: focused ? '❯ ' : ' ' }), _jsx(Box, { ...titleTooltip, children: _jsx(Text, { color: focused ? 'success' : undefined, bold: focused, children: shownTitle }) })] }), _jsx(Text, { color: focused ? 'success' : undefined, dimColor: !focused, children: ` ${truncateWidth(when, body)}` })] }));
46
42
  }
@@ -7,16 +7,16 @@ import type { AgentViewStatus } from '../../adapter/ports/channel-view.js';
7
7
  * One session in the browser's list: a title line and a metadata line.
8
8
  *
9
9
  * Two lines rather than one because the two carry different jobs. The title
10
- * answers "is this the conversation I mean"; the metadata answers "which of
11
- * the three that look alike is it" — when it was, on what branch, how big,
12
- * under which model. Folding both onto one line makes the title compete with
10
+ * answers "is this the conversation I mean"; the metadata gives its age and
11
+ * branch. Size and model are available in the title tooltip rather than taking
12
+ * space in every row. Folding both lines into one makes the title compete with
13
13
  * facts nobody reads first, and on a narrow terminal the title is what loses.
14
14
  *
15
15
  * Widths are resolved here rather than delegated to flexbox: the row must
16
16
  * stay exactly two lines at every terminal width, and a row that wraps
17
17
  * destroys the alignment that lets the eye scan a list at all.
18
18
  */
19
- export declare function SessionListRow({ session, width, depth, focused, declareCursor, pinned, now, onClick, onContextMenu, onTogglePin, liveStatus, current, occupiedPid, spinner, }: {
19
+ export declare function SessionListRow({ session, width, depth, focused, declareCursor, pinned, now, onClick, onContextMenu, onTogglePin, liveStatus, current, occupiedPid, }: {
20
20
  session: SessionSummary;
21
21
  /** Columns available to the row, indentation included. */
22
22
  width: number;
@@ -51,10 +51,5 @@ export declare function SessionListRow({ session, width, depth, focused, declare
51
51
  * not break. Undefined means free, or already ours.
52
52
  */
53
53
  occupiedPid?: number;
54
- /** Shared animation clock for the working glyph. */
55
- spinner?: {
56
- frame: number;
57
- time: number;
58
- };
59
54
  }): React.ReactNode;
60
55
  //# sourceMappingURL=SessionListRow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SessionListRow.d.ts","sourceRoot":"","sources":["../../../../src/components/sessions/SessionListRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAGvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAA;AAa9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AA0B1E;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,KAAK,EACL,KAAK,EACL,OAAO,EACP,aAAqB,EACrB,MAAM,EACN,GAAG,EACH,OAAO,EACP,aAAa,EACb,WAAW,EACX,UAAU,EACV,OAAO,EACP,WAAW,EACX,OAAO,GACR,EAAE;IACD,OAAO,EAAE,cAAc,CAAA;IACvB,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAA;IACb,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,gEAAgE;IAChE,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,sEAAsE;IACtE,MAAM,EAAE,OAAO,CAAA;IACf,iEAAiE;IACjE,GAAG,EAAE,MAAM,CAAA;IACX,4CAA4C;IAC5C,OAAO,CAAC,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAA;IACjC,gDAAgD;IAChD,aAAa,CAAC,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAA;IAC7C,8CAA8C;IAC9C,WAAW,CAAC,IAAI,IAAI,CAAA;IACpB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oDAAoD;IACpD,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAC1C,GAAG,KAAK,CAAC,SAAS,CA+HlB"}
1
+ {"version":3,"file":"SessionListRow.d.ts","sourceRoot":"","sources":["../../../../src/components/sessions/SessionListRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAGvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAA;AAe9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAqC1E;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,KAAK,EACL,KAAK,EACL,OAAO,EACP,aAAqB,EACrB,MAAM,EACN,GAAG,EACH,OAAO,EACP,aAAa,EACb,WAAW,EACX,UAAU,EACV,OAAO,EACP,WAAW,GACZ,EAAE;IACD,OAAO,EAAE,cAAc,CAAA;IACvB,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAA;IACb,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,gEAAgE;IAChE,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,sEAAsE;IACtE,MAAM,EAAE,OAAO,CAAA;IACf,iEAAiE;IACjE,GAAG,EAAE,MAAM,CAAA;IACX,4CAA4C;IAC5C,OAAO,CAAC,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAA;IACjC,gDAAgD;IAChD,aAAa,CAAC,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAA;IAC7C,8CAA8C;IAC9C,WAAW,CAAC,IAAI,IAAI,CAAA;IACpB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,KAAK,CAAC,SAAS,CA0HlB"}
@@ -4,6 +4,8 @@ import { Box, Text } from '../../ui.js';
4
4
  import { t } from '../../i18n.js';
5
5
  import { useTooltip } from '../Tooltip.js';
6
6
  import { SpinnerGlyph } from '../Spinner/SpinnerGlyph.js';
7
+ import { useAnimationFrame } from '../../ink/hooks/use-animation-frame.js';
8
+ import { useTerminalFocus } from '../../ink/hooks/use-terminal-focus.js';
7
9
  import { stringWidth } from '../../ink/stringWidth.js';
8
10
  import { useDeclaredCursor, useNativeCursor } from '../../ink/hooks/use-declared-cursor.js';
9
11
  import { formatAbsolute, formatBytes, formatWhen, kindMark, titleColor, truncateWidth, } from '../../sessions/format.js';
@@ -29,20 +31,26 @@ const LIVE_STATUS_COLOR = {
29
31
  idle: undefined,
30
32
  stopped: undefined,
31
33
  };
34
+ /** Only a visible working glyph subscribes; the session list does not tick. */
35
+ function WorkingGlyph() {
36
+ const focused = useTerminalFocus();
37
+ const [ref, time] = useAnimationFrame(focused ? 120 : null);
38
+ return (_jsx(Box, { ref: ref, children: _jsx(SpinnerGlyph, { frame: Math.floor(time / 120), time: time, messageColor: "suggestion", reducedMotion: false }) }));
39
+ }
32
40
  /**
33
41
  * One session in the browser's list: a title line and a metadata line.
34
42
  *
35
43
  * Two lines rather than one because the two carry different jobs. The title
36
- * answers "is this the conversation I mean"; the metadata answers "which of
37
- * the three that look alike is it" — when it was, on what branch, how big,
38
- * under which model. Folding both onto one line makes the title compete with
44
+ * answers "is this the conversation I mean"; the metadata gives its age and
45
+ * branch. Size and model are available in the title tooltip rather than taking
46
+ * space in every row. Folding both lines into one makes the title compete with
39
47
  * facts nobody reads first, and on a narrow terminal the title is what loses.
40
48
  *
41
49
  * Widths are resolved here rather than delegated to flexbox: the row must
42
50
  * stay exactly two lines at every terminal width, and a row that wraps
43
51
  * destroys the alignment that lets the eye scan a list at all.
44
52
  */
45
- export function SessionListRow({ session, width, depth, focused, declareCursor = false, pinned, now, onClick, onContextMenu, onTogglePin, liveStatus, current, occupiedPid, spinner, }) {
53
+ export function SessionListRow({ session, width, depth, focused, declareCursor = false, pinned, now, onClick, onContextMenu, onTogglePin, liveStatus, current, occupiedPid, }) {
46
54
  const indent = depth * 2;
47
55
  const nativeCursor = useNativeCursor();
48
56
  const cursorRef = useDeclaredCursor({ line: 0, column: indent, active: focused && declareCursor, visible: nativeCursor, hideOnIdle: true });
@@ -84,16 +92,16 @@ export function SessionListRow({ session, width, depth, focused, declareCursor =
84
92
  parts.push(formatAbsolute(session.updatedAt));
85
93
  if (session.cwd !== '')
86
94
  parts.push(session.cwd);
95
+ const size = formatBytes(session.bytes);
96
+ if (size !== undefined)
97
+ parts.push(size);
98
+ if (session.model !== undefined)
99
+ parts.push(session.model);
87
100
  return parts.join('\n');
88
101
  });
89
102
  const facts = [formatWhen(session.updatedAt, now)];
90
103
  if (session.branch !== undefined)
91
104
  facts.push(session.branch);
92
- const size = formatBytes(session.bytes);
93
- if (size !== undefined)
94
- facts.push(size);
95
- if (session.model !== undefined)
96
- facts.push(session.model);
97
105
  if (session.childCount > 0 && depth === 0) {
98
106
  facts.push(t('session-children', { n: session.childCount }));
99
107
  }
@@ -107,5 +115,5 @@ export function SessionListRow({ session, width, depth, focused, declareCursor =
107
115
  // toggles the pin and must never fall through to resume.
108
116
  event.stopImmediatePropagation();
109
117
  onTogglePin();
110
- }, children: _jsx(Text, { color: pinned ? 'remember' : undefined, dimColor: !pinned, children: pinned ? '★ ' : '☆ ' }) }), _jsx(Box, { children: liveStatus === 'working' && !occupied && spinner !== undefined ? (_jsx(SpinnerGlyph, { frame: spinner.frame, messageColor: "suggestion", reducedMotion: false, time: spinner.time })) : (_jsx(Text, { color: stateColor, dimColor: liveStatus === undefined && !occupied, children: `${stateGlyph} ` })) }), mark !== undefined && _jsx(Text, { color: mark.color, children: `${mark.glyph} ` }), _jsx(Box, { ...titleTooltip, children: _jsx(Text, { color: occupied ? 'error' : titleColor(session.title.source, focused), bold: focused, children: shownTitle }) }), occupiedText !== '' && _jsx(Text, { color: "error", children: occupiedText }), currentText !== '' && _jsx(Text, { color: "success", children: currentText })] }), _jsx(Box, { children: _jsx(Text, { color: focused ? 'success' : undefined, dimColor: !focused, children: `${' '.repeat(indent + 2)}${truncateWidth(facts.join(' · '), body)}` }) })] }));
118
+ }, children: _jsx(Text, { color: pinned ? 'remember' : undefined, dimColor: !pinned, children: pinned ? '★ ' : '☆ ' }) }), _jsx(Box, { children: liveStatus === 'working' && !occupied ? (_jsx(WorkingGlyph, {})) : (_jsx(Text, { color: stateColor, dimColor: liveStatus === undefined && !occupied, children: `${stateGlyph} ` })) }), mark !== undefined && _jsx(Text, { color: mark.color, children: `${mark.glyph} ` }), _jsx(Box, { ...titleTooltip, children: _jsx(Text, { color: occupied ? 'error' : titleColor(session.title.source, focused), bold: focused, children: shownTitle }) }), occupiedText !== '' && _jsx(Text, { color: "error", children: occupiedText }), currentText !== '' && _jsx(Text, { color: "success", children: currentText })] }), _jsx(Box, { children: _jsx(Text, { color: focused ? 'success' : undefined, dimColor: !focused, children: `${' '.repeat(indent + 2)}${truncateWidth(facts.join(' · '), body)}` }) })] }));
111
119
  }
@@ -1 +1 @@
1
- {"version":3,"file":"InfoPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/sidePanel/InfoPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,MAAM,OAAO,CAAA;AAezB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAwB5C,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,UAAU,GAAG,KAAK,CAAC,SAAS,CA2J1F"}
1
+ {"version":3,"file":"InfoPanel.d.ts","sourceRoot":"","sources":["../../../../src/components/sidePanel/InfoPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,MAAM,OAAO,CAAA;AAezB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAwB5C,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,UAAU,GAAG,KAAK,CAAC,SAAS,CA4J1F"}
@@ -22,7 +22,7 @@ import { modeDisplayName } from '../../sessionModes.js';
22
22
  import { estimateSessionCostSnapshotCny, isDeepSeekOfficialProvider, isPeakHour } from '../../deepseekPricing.js';
23
23
  import { formatCacheHitRate, formatCostReport } from '../../screens/StatusLine.js';
24
24
  import { contextPressureStep, speedColor } from '../../screens/StatusMetrics.js';
25
- import { formatProject } from '../../sessions/format.js';
25
+ import { displayWorkingDirectory, formatProject } from '../../sessions/format.js';
26
26
  import { homeDir } from '../../utils/paths.js';
27
27
  import { Divider } from '../design-system/Divider.js';
28
28
  import { useSidePanelChannel } from './SidePanelRuntimeContext.js';
@@ -68,9 +68,10 @@ export function InfoPanel({ width, height, focused, visible }) {
68
68
  usePanelInput(panelKeyHandler, { active: focused && visible });
69
69
  const usage = channel.lastUsage;
70
70
  const used = contextUsedOf(channel);
71
+ const currentCwd = displayWorkingDirectory(channel);
71
72
  const displayCwd = channel.displayCwd === channel.cwd
72
- ? formatProject(channel.displayCwd, homeDir())
73
- : channel.displayCwd;
73
+ ? formatProject(currentCwd, homeDir())
74
+ : currentCwd;
74
75
  // --- 值构造(全部复用状态栏口径) -------------------------------------
75
76
  const none = t('info-value-none');
76
77
  const modeName = modeDisplayName(channel.mode);
@@ -1 +1 @@
1
- {"version":3,"file":"SidePanelLayout.d.ts","sourceRoot":"","sources":["../../../../src/components/sidePanel/SidePanelLayout.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAErD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAA;IACxC,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAA;IAC9B,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAA;IACpC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IACrC,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IACjD,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CACnC;AAqED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,cAAc,EACd,eAAe,EACf,QAAQ,EACR,QAAQ,GACT,EAAE,oBAAoB,GAAG,KAAK,CAAC,SAAS,CA2ExC"}
1
+ {"version":3,"file":"SidePanelLayout.d.ts","sourceRoot":"","sources":["../../../../src/components/sidePanel/SidePanelLayout.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAErD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAA;IACxC,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAA;IAC9B,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAA;IACpC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IACrC,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IACjD,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CACnC;AAqED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,cAAc,EACd,eAAe,EACf,QAAQ,EACR,QAAQ,GACT,EAAE,oBAAoB,GAAG,KAAK,CAAC,SAAS,CA8ExC"}
@@ -85,6 +85,7 @@ function DividerColumn({ focused, rows, junctionRows, chatColumns, onResize, })
85
85
  }, children: _jsx(Text, { color: focused || hovered || dragging ? 'accent' : 'inactive', children: glyphs.join('\n') }) }));
86
86
  }
87
87
  export function SidePanelLayout({ geometry, focus, side, onActivateChat, onActivatePanel, onResize, children, }) {
88
+ const paneId = React.useId();
88
89
  const outerEdges = useSurfaceEdges();
89
90
  const parentSize = useTerminalSize();
90
91
  const rows = parentSize.rows;
@@ -99,9 +100,8 @@ export function SidePanelLayout({ geometry, focus, side, onActivateChat, onActiv
99
100
  // eslint-disable-next-line react-hooks/exhaustive-deps -- geometry identity changes with the split
100
101
  [parentSize, geometry, rows, screenRows]);
101
102
  const panelSize = React.useMemo(() => ({ columns: panelColumns, rows, screenRows }), [panelColumns, rows, screenRows]);
102
- return (_jsxs(Box, { flexDirection: "row", flexGrow: 1, flexShrink: 1, overflow: split ? 'hidden' : undefined, children: [_jsx(SurfaceEdgesContext.Provider, { value: split ? chatEdges : outerEdges, children: _jsx(TerminalSizeContext.Provider, { value: chatSize, children: _jsx(Box, { flexDirection: "column", flexGrow: split ? 0 : 1, width: geometry === null ? undefined : geometry.chat, flexShrink: 0, overflow: split ? 'hidden' : undefined, onClick: split ? onActivateChat : undefined, children: children }) }) }), split && (_jsxs(_Fragment, { children: [_jsx(DividerColumn, { focused: focus === 'panel', rows: rows, junctionRows: [1, Math.max(1, rows - 2)], chatColumns: geometry.chat, onResize: onResize }), _jsx(SurfaceEdgesContext.Provider, { value: panelEdges, children: _jsx(TerminalSizeContext.Provider, { value: panelSize, children: _jsx(Box, { flexDirection: "column", width: panelColumns, flexShrink: 0, overflow: "hidden", onClick: onActivatePanel,
103
- /* The right column is fenced out of the fullscreen linear text
104
- selection: a drag across chat rows must not capture panel
105
- glyphs (design doc §4.6). Panels carry their own copy action. */
106
- noSelect: true, children: side }) }) })] }))] }));
103
+ return (_jsxs(Box, { flexDirection: "row", flexGrow: 1, flexShrink: 1, overflow: split ? 'hidden' : undefined, children: [_jsx(SurfaceEdgesContext.Provider, { value: split ? chatEdges : outerEdges, children: _jsx(TerminalSizeContext.Provider, { value: chatSize, children: _jsx(Box, { flexDirection: "column", flexGrow: split ? 0 : 1, width: geometry === null ? undefined : geometry.chat, flexShrink: 0, overflow: split ? 'hidden' : undefined, selectionPane: split ? paneId + '-chat' : undefined, selectionPaneViewport: true, onClick: split ? onActivateChat : undefined, children: children }) }) }), split && (_jsxs(_Fragment, { children: [_jsx(DividerColumn, { focused: focus === 'panel', rows: rows, junctionRows: [1, Math.max(1, rows - 2)], chatColumns: geometry.chat, onResize: onResize }), _jsx(SurfaceEdgesContext.Provider, { value: panelEdges, children: _jsx(TerminalSizeContext.Provider, { value: panelSize, children: _jsx(Box, { flexDirection: "column", width: panelColumns, flexShrink: 0, overflow: "hidden", onClick: onActivatePanel,
104
+ /* Ownership fences both directions; nested noSelect gutters
105
+ and copyRegion sources retain their existing semantics. */
106
+ selectionPane: paneId + '-panel', selectionPaneViewport: true, children: side }) }) })] }))] }));
107
107
  }
@@ -1 +1 @@
1
- {"version":3,"file":"WorkspacePanel.d.ts","sourceRoot":"","sources":["../../../../src/components/sidePanel/WorkspacePanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAWzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAgD5C,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,UAAU,GAAG,KAAK,CAAC,SAAS,CAgK/F"}
1
+ {"version":3,"file":"WorkspacePanel.d.ts","sourceRoot":"","sources":["../../../../src/components/sidePanel/WorkspacePanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAYzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAgD5C,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,UAAU,GAAG,KAAK,CAAC,SAAS,CA2K/F"}
@@ -5,6 +5,7 @@ import { t } from '../../i18n.js';
5
5
  import { truncateWidth, spreadRow } from '../../sessions/format.js';
6
6
  import { stringWidth } from '../../ink/stringWidth.js';
7
7
  import { normalizeWorkspaceCwd } from '../../sessions/view.js';
8
+ import { visibleWorkspaceSessions, workspaceSessionCounts } from '../../sessions/workspaceCounts.js';
8
9
  import { useSidePanelChannel, useSidePanelFullscreen } from './SidePanelRuntimeContext.js';
9
10
  import { usePanelInput } from './usePanelInput.js';
10
11
  /**
@@ -71,25 +72,36 @@ export function WorkspacePanel({ width, height, focused, visible }) {
71
72
  setFetchTick(tick => tick + 1);
72
73
  }, [visible]);
73
74
  React.useEffect(() => {
74
- if (fetchTick === 0)
75
+ if (fetchTick === 0 || visible === false)
75
76
  return;
76
77
  const nonce = nonceRef.current + 1;
77
78
  nonceRef.current = nonce;
78
79
  let live = true;
80
+ const bindingGeneration = channel.agentBindingGeneration;
81
+ const agentId = channel.agentId;
82
+ const sessionId = channel.sessionId;
83
+ const cwd = channel.cwd;
84
+ const backendId = channel.backendCapabilities?.backendId;
85
+ const current = () => live && nonce === nonceRef.current
86
+ && channel.agentBindingGeneration === bindingGeneration
87
+ && channel.agentId === agentId && channel.sessionId === sessionId
88
+ && channel.cwd === cwd && channel.backendCapabilities?.backendId === backendId;
79
89
  setLoadError(null);
80
- channel.listWorkspaceRegistry()
81
- .then(list => {
82
- if (!live || nonce !== nonceRef.current)
90
+ setEntries(null);
91
+ Promise.all([channel.listWorkspaceRegistry(), channel.listSessions()])
92
+ .then(([list, sessions]) => {
93
+ if (!current())
83
94
  return;
84
- setEntries(list);
95
+ const counts = workspaceSessionCounts(visibleWorkspaceSessions(sessions, agentId));
96
+ setEntries(list.map(entry => ({ ...entry, sessionCount: counts.get(normalizeWorkspaceCwd(entry.path)) ?? 0 })));
85
97
  })
86
98
  .catch((error) => {
87
- if (!live || nonceRef.current !== nonce)
99
+ if (!current())
88
100
  return;
89
101
  setLoadError(error instanceof Error ? error.message : String(error));
90
102
  });
91
103
  return () => { live = false; };
92
- }, [channel, fetchTick]);
104
+ }, [channel, fetchTick, visible, channel.agentBindingGeneration, channel.agentId, channel.sessionId, channel.cwd, channel.backendCapabilities?.backendId, channel.ready]);
93
105
  // ── 选中 / hover / 自管窗口滚动 ──────────────────────────────────────────
94
106
  // 不用 ScrollBox:它的内容平移/裁剪会让滚动后的指针事件错位
95
107
  // (TrajectoryPanel 的 ledger 同样自己管窗口)。行恒定 2 行,
@@ -19,6 +19,11 @@ export interface BtwComposerKeyResult {
19
19
  readonly submit?: boolean;
20
20
  /** Esc/Tab:退出编辑焦点(草稿保留),焦点回落线程列表/宿主。 */
21
21
  readonly exitFocus?: boolean;
22
+ /**
23
+ * Ctrl+V / Alt+V:读剪贴板是异步的,纯函数只交出意图——surface 侧
24
+ * (useBtwComposerPaste)读完再按实时草稿与 caret 落字。
25
+ */
26
+ readonly paste?: true;
22
27
  }
23
28
  /** 运行时补充键位(ink Key 实际携带;SidePanelKeyFlags 类型面未列)。 */
24
29
  type BtwKeyFlags = SidePanelKeyFlags & {
@@ -28,6 +33,8 @@ type BtwKeyFlags = SidePanelKeyFlags & {
28
33
  readonly home?: boolean;
29
34
  readonly end?: boolean;
30
35
  readonly return?: boolean;
36
+ /** 终端原生粘贴(bracketed paste)整块到达时置位。 */
37
+ readonly isPasted?: boolean;
31
38
  };
32
39
  /**
33
40
  * 单行 composer 的键语义。返回 null = 未消费(面板形态交宿主回退键,
@@ -1 +1 @@
1
- {"version":3,"file":"BtwComposer.d.ts","sourceRoot":"","sources":["../../../../../src/components/sidePanel/btw/BtwComposer.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAGpD,+CAA+C;AAC/C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,8DAA8D;AAC9D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,gBAAgB,CAAA;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,wCAAwC;IACxC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAC7B;AAED,qDAAqD;AACrD,KAAK,WAAW,GAAG,iBAAiB,GAAG;IACrC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,GAAG,oBAAoB,GAAG,IAAI,CAsCpH;AAED,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,OAAO,EACP,IAAI,EACJ,MAAM,EACN,UAAU,GACX,EAAE;IACD,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAA;IAChC,2BAA2B;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,6BAA6B;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAA;IAClF,iCAAiC;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;CACjC,GAAG,KAAK,CAAC,SAAS,CA6ClB"}
1
+ {"version":3,"file":"BtwComposer.d.ts","sourceRoot":"","sources":["../../../../../src/components/sidePanel/btw/BtwComposer.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAGpD,+CAA+C;AAC/C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,8DAA8D;AAC9D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,gBAAgB,CAAA;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,wCAAwC;IACxC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,CAAA;CACtB;AAED,qDAAqD;AACrD,KAAK,WAAW,GAAG,iBAAiB,GAAG;IACrC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,sCAAsC;IACtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAC5B,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,GAAG,oBAAoB,GAAG,IAAI,CAkDpH;AAED,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,OAAO,EACP,IAAI,EACJ,MAAM,EACN,UAAU,GACX,EAAE;IACD,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAA;IAChC,2BAA2B;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,6BAA6B;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAA;IAClF,iCAAiC;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;CACjC,GAAG,KAAK,CAAC,SAAS,CA6ClB"}
@@ -1,6 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Box, Text, InputCaret } from '../../../ui.js';
3
3
  import { t } from '../../../i18n.js';
4
+ import { actionMatches } from '../../../utils/keymap.js';
5
+ import { flattenPasteInline } from '../../../channel/sanitize.js';
4
6
  import { nextCodePoint, previousCodePoint } from '../../AgentMessageComposer.js';
5
7
  /**
6
8
  * 单行 composer 的键语义。返回 null = 未消费(面板形态交宿主回退键,
@@ -15,6 +17,20 @@ export function btwComposerKey(state, input, key) {
15
17
  // The caret is per surface while the draft is shared through the store:
16
18
  // an edit on the other surface can leave this caret past the end.
17
19
  const caret = Math.min(state.caret, state.text.length);
20
+ // 终端原生粘贴(Ctrl+Shift+V / 右键 / 终端自己接管的 Ctrl+V)整块到达并
21
+ // 打上 isPasted:单行框先压成一行再插,纯换行的块是文本、绝不是 Enter。
22
+ // 必须排在 plainReturn 之前——粘贴块也可能带着 return 标记。
23
+ if (key.isPasted === true) {
24
+ const text = flattenPasteInline(input);
25
+ // 纯换行/空白压完是空格,trim 后为空 = 没有可插入的文本(不是 Enter)。
26
+ if (text.trim() === '')
27
+ return {};
28
+ return { state: { text: state.text.slice(0, caret) + text + state.text.slice(caret), caret: caret + text.length } };
29
+ }
30
+ // Ctrl+V / Alt+V(keymap 的 paste 动作,可在 /settings 重映射):读剪贴板
31
+ // 是异步的,纯函数只交出意图,由 surface 侧按实时草稿与 caret 落字。
32
+ if (actionMatches('paste', input, key))
33
+ return { paste: true };
18
34
  const plainReturn = (key.return_ === true || key.return === true || /^[\r\n]+$/u.test(input))
19
35
  && key.ctrl !== true && key.meta !== true && key.shift !== true;
20
36
  if (plainReturn)
@@ -1 +1 @@
1
- {"version":3,"file":"BtwPanelAdapter.d.ts","sourceRoot":"","sources":["../../../../../src/components/sidePanel/btw/BtwPanelAdapter.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,MAAM,OAAO,CAAA;AAazB,OAAO,KAAK,EAAmB,UAAU,EAAE,MAAM,aAAa,CAAA;AAY9D,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,UAAU,GAAG,KAAK,CAAC,SAAS,CAiRhG"}
1
+ {"version":3,"file":"BtwPanelAdapter.d.ts","sourceRoot":"","sources":["../../../../../src/components/sidePanel/btw/BtwPanelAdapter.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,MAAM,OAAO,CAAA;AAczB,OAAO,KAAK,EAAmB,UAAU,EAAE,MAAM,aAAa,CAAA;AAY9D,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,UAAU,GAAG,KAAK,CAAC,SAAS,CAoRhG"}
@@ -21,6 +21,7 @@ import { setClipboard } from '../../../ink/termio/osc.js';
21
21
  import { btwThreads } from './threads.js';
22
22
  import { getBtwContextBudget, getBtwContextTurns } from '../../../tuiDisplayPrefs.js';
23
23
  import { BtwComposer, btwComposerKey } from './BtwComposer.js';
24
+ import { useBtwComposerPaste } from './useBtwComposerPaste.js';
24
25
  import { BtwThreadView } from './BtwThreadView.js';
25
26
  function useBtwThread(sessionId) {
26
27
  return React.useSyncExternalStore(btwThreads.subscribe, () => btwThreads.get(sessionId));
@@ -59,6 +60,8 @@ export function BtwPanelAdapter({ width, height, focused, visible }) {
59
60
  setCaretState(next);
60
61
  }, []);
61
62
  const [notice, setNotice] = React.useState(null);
63
+ // Ctrl+V / Alt+V:读剪贴板是异步的,落点用实时草稿与 caret(见 hook)。
64
+ const paste = useBtwComposerPaste({ sessionId, caretRef, setCaret, setNotice });
62
65
  // 列表态的滚动句柄(阅读态:↑/↓/PgUp/PgDn 归线程,编辑态仍归输入框)。
63
66
  const scrollRef = React.useRef(null);
64
67
  // badge(镜像 jobs:version/visible 驱动;可见即已读)。
@@ -184,6 +187,10 @@ export function BtwPanelAdapter({ width, height, focused, visible }) {
184
187
  submitDraft();
185
188
  return true;
186
189
  }
190
+ if (result.paste === true) {
191
+ paste();
192
+ return true;
193
+ }
187
194
  if (result.state !== undefined) {
188
195
  btwThreads.setDraft(sessionId, result.state.text);
189
196
  setCaret(result.state.caret);
@@ -244,7 +251,7 @@ export function BtwPanelAdapter({ width, height, focused, visible }) {
244
251
  // 其余不独占:返回 false 交宿主(Esc 回聊天、←/→ 切面板、1-9 跳面板)。
245
252
  return false;
246
253
  // eslint-disable-next-line react-hooks/exhaustive-deps
247
- }, [sessionId, submitDraft, newTopic, sendToChat, copySelected, moveSelection, selectedTurnNow, height, setCaret]);
254
+ }, [sessionId, submitDraft, newTopic, sendToChat, copySelected, moveSelection, selectedTurnNow, height, setCaret, paste]);
248
255
  usePanelInput(onKey, { active: focused && visible });
249
256
  // ── 头部(只有线程后才画):首问标题 + 状态徽 + 新话题,下压一条细线 ──
250
257
  // 空线程不画头部:标题没有内容,`新话题` 在空线程上也无事可做(清空/换题的
@@ -9,10 +9,16 @@
9
9
  */
10
10
  import React from 'react';
11
11
  import type { ChannelUi } from '../../../adapter/channel/ui-policy.js';
12
- export declare function BtwThreadScene({ channel, onClose, onFocusChat, }: {
12
+ import type { ClipboardRead } from '../../../utils/clipboard.js';
13
+ export declare function BtwThreadScene({ channel, onClose, onFocusChat, readClipboardOverride, }: {
13
14
  readonly channel: ChannelUi;
14
15
  readonly onClose: () => void;
15
16
  /** 送聊天之后把焦点交回主输入框(宿主没接时只关场景)。 */
16
17
  readonly onFocusChat?: (() => void) | undefined;
18
+ /**
19
+ * 测试缝:composer 的 Ctrl+V 走这里读剪贴板(默认真实平台读取),
20
+ * 无头回归注入假 reader——与问卷面板 #786 的契约同型。
21
+ */
22
+ readonly readClipboardOverride?: (() => Promise<ClipboardRead>) | undefined;
17
23
  }): React.ReactNode;
18
24
  //# sourceMappingURL=BtwThreadScene.d.ts.map