@deepseek-harness-tui/dsh-tui 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (330) hide show
  1. package/README.md +13 -5
  2. package/cordis.patch.yml +21 -2
  3. package/cordis.yml +12 -1
  4. package/ecosystem-spec/registry/contracts/decision-events-v1alpha1.json +13 -0
  5. package/ecosystem-spec/registry/host-descriptor.tui.example.json +56 -0
  6. package/ecosystem-spec/registry/permissions-0.1.json +13 -0
  7. package/ecosystem-spec/registry/registry-0.15.json +57 -0
  8. package/ecosystem-spec/schemas/conformance-claim.schema.json +15 -0
  9. package/ecosystem-spec/schemas/effect-ledger-record.schema.json +16 -0
  10. package/ecosystem-spec/schemas/host-descriptor.schema.json +26 -0
  11. package/lib/types/cc/figures.d.ts +4 -0
  12. package/lib/types/cc/figures.d.ts.map +1 -1
  13. package/lib/types/cc/figures.js +4 -0
  14. package/lib/types/commands.d.ts.map +1 -1
  15. package/lib/types/commands.js +2 -0
  16. package/lib/types/components/ExtensionDialog.d.ts +40 -0
  17. package/lib/types/components/ExtensionDialog.d.ts.map +1 -0
  18. package/lib/types/components/ExtensionDialog.js +210 -0
  19. package/lib/types/components/HelpMenu.js +1 -1
  20. package/lib/types/components/LoadedContextPanel.d.ts +5 -10
  21. package/lib/types/components/LoadedContextPanel.d.ts.map +1 -1
  22. package/lib/types/components/LoadedContextPanel.js +7 -18
  23. package/lib/types/components/LogoV2.d.ts.map +1 -1
  24. package/lib/types/components/LogoV2.js +1 -2
  25. package/lib/types/components/MessageList.d.ts.map +1 -1
  26. package/lib/types/components/MessageList.js +25 -1
  27. package/lib/types/components/RewindPicker.d.ts +13 -1
  28. package/lib/types/components/RewindPicker.d.ts.map +1 -1
  29. package/lib/types/components/RewindPicker.js +26 -2
  30. package/lib/types/components/ToolUseLoader.d.ts +8 -3
  31. package/lib/types/components/ToolUseLoader.d.ts.map +1 -1
  32. package/lib/types/components/ToolUseLoader.js +43 -9
  33. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  34. package/lib/types/components/messages/AssistantToolUseMessage.js +1 -1
  35. package/lib/types/dsh-adapter/channel.d.ts +30 -7
  36. package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
  37. package/lib/types/dsh-adapter/channel.js +503 -21
  38. package/lib/types/dsh-adapter/command-attribution.d.ts +51 -0
  39. package/lib/types/dsh-adapter/command-attribution.d.ts.map +1 -0
  40. package/lib/types/dsh-adapter/command-attribution.js +93 -0
  41. package/lib/types/dsh-adapter/command-errors.d.ts +42 -0
  42. package/lib/types/dsh-adapter/command-errors.d.ts.map +1 -0
  43. package/lib/types/dsh-adapter/command-errors.js +63 -0
  44. package/lib/types/dsh-adapter/component-identity.d.ts +28 -0
  45. package/lib/types/dsh-adapter/component-identity.d.ts.map +1 -0
  46. package/lib/types/dsh-adapter/component-identity.js +108 -0
  47. package/lib/types/dsh-adapter/contract.d.ts +1 -1
  48. package/lib/types/dsh-adapter/contract.js +2 -2
  49. package/lib/types/dsh-adapter/decision-guard.d.ts +84 -0
  50. package/lib/types/dsh-adapter/decision-guard.d.ts.map +1 -0
  51. package/lib/types/dsh-adapter/decision-guard.js +354 -0
  52. package/lib/types/dsh-adapter/dialogs.d.ts +146 -0
  53. package/lib/types/dsh-adapter/dialogs.d.ts.map +1 -0
  54. package/lib/types/dsh-adapter/dialogs.js +262 -0
  55. package/lib/types/dsh-adapter/effect-ledger.d.ts +99 -0
  56. package/lib/types/dsh-adapter/effect-ledger.d.ts.map +1 -0
  57. package/lib/types/dsh-adapter/effect-ledger.js +231 -0
  58. package/lib/types/dsh-adapter/extension-events.d.ts +193 -0
  59. package/lib/types/dsh-adapter/extension-events.d.ts.map +1 -0
  60. package/lib/types/dsh-adapter/extension-events.js +169 -0
  61. package/lib/types/dsh-adapter/extensions.d.ts +32 -0
  62. package/lib/types/dsh-adapter/extensions.d.ts.map +1 -0
  63. package/lib/types/dsh-adapter/extensions.js +42 -0
  64. package/lib/types/dsh-adapter/grants.d.ts +25 -0
  65. package/lib/types/dsh-adapter/grants.d.ts.map +1 -0
  66. package/lib/types/dsh-adapter/grants.js +184 -0
  67. package/lib/types/dsh-adapter/host-descriptor.d.ts +24 -0
  68. package/lib/types/dsh-adapter/host-descriptor.d.ts.map +1 -0
  69. package/lib/types/dsh-adapter/host-descriptor.js +146 -0
  70. package/lib/types/dsh-adapter/message-observer.d.ts +178 -0
  71. package/lib/types/dsh-adapter/message-observer.d.ts.map +1 -0
  72. package/lib/types/dsh-adapter/message-observer.js +509 -0
  73. package/lib/types/dsh-adapter/plugin-host.d.ts +103 -0
  74. package/lib/types/dsh-adapter/plugin-host.d.ts.map +1 -0
  75. package/lib/types/dsh-adapter/plugin-host.js +270 -0
  76. package/lib/types/dsh-adapter/plugin-storage.d.ts +113 -0
  77. package/lib/types/dsh-adapter/plugin-storage.d.ts.map +1 -0
  78. package/lib/types/dsh-adapter/plugin-storage.js +385 -0
  79. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  80. package/lib/types/dsh-adapter/plugin.js +47 -1
  81. package/lib/types/dsh-adapter/plugins-info.d.ts +43 -0
  82. package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -0
  83. package/lib/types/dsh-adapter/plugins-info.js +276 -0
  84. package/lib/types/dsh-adapter/renderers.d.ts +65 -0
  85. package/lib/types/dsh-adapter/renderers.d.ts.map +1 -0
  86. package/lib/types/dsh-adapter/renderers.js +138 -0
  87. package/lib/types/dsh-adapter/sanitize.d.ts +36 -0
  88. package/lib/types/dsh-adapter/sanitize.d.ts.map +1 -0
  89. package/lib/types/dsh-adapter/sanitize.js +65 -0
  90. package/lib/types/dsh-adapter/scenes.d.ts +7 -1
  91. package/lib/types/dsh-adapter/scenes.d.ts.map +1 -1
  92. package/lib/types/dsh-adapter/scenes.js +17 -2
  93. package/lib/types/dsh-adapter/shortcuts.d.ts +109 -0
  94. package/lib/types/dsh-adapter/shortcuts.d.ts.map +1 -0
  95. package/lib/types/dsh-adapter/shortcuts.js +268 -0
  96. package/lib/types/dsh-adapter/status.d.ts +75 -0
  97. package/lib/types/dsh-adapter/status.d.ts.map +1 -0
  98. package/lib/types/dsh-adapter/status.js +168 -0
  99. package/lib/types/extensions.d.ts +8 -0
  100. package/lib/types/extensions.d.ts.map +1 -0
  101. package/lib/types/extensions.js +15 -0
  102. package/lib/types/i18n.d.ts +162 -16
  103. package/lib/types/i18n.d.ts.map +1 -1
  104. package/lib/types/i18n.js +53 -5
  105. package/lib/types/ink/ink.d.ts +11 -0
  106. package/lib/types/ink/ink.d.ts.map +1 -1
  107. package/lib/types/ink/ink.js +33 -0
  108. package/lib/types/ink/log-update.d.ts.map +1 -1
  109. package/lib/types/ink/log-update.js +101 -51
  110. package/lib/types/ink/output.d.ts +7 -0
  111. package/lib/types/ink/output.d.ts.map +1 -1
  112. package/lib/types/ink/output.js +125 -4
  113. package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
  114. package/lib/types/ink/render-node-to-output.js +14 -6
  115. package/lib/types/ink/terminal.d.ts.map +1 -1
  116. package/lib/types/ink/terminal.js +18 -6
  117. package/lib/types/plugin-host.d.ts +13 -0
  118. package/lib/types/plugin-host.d.ts.map +1 -0
  119. package/lib/types/plugin-host.js +17 -0
  120. package/lib/types/plugin-spec/negotiate.d.ts +11 -0
  121. package/lib/types/plugin-spec/negotiate.d.ts.map +1 -0
  122. package/lib/types/plugin-spec/negotiate.js +97 -0
  123. package/lib/types/plugin-spec/permission-scope.d.ts +32 -0
  124. package/lib/types/plugin-spec/permission-scope.d.ts.map +1 -0
  125. package/lib/types/plugin-spec/permission-scope.js +90 -0
  126. package/lib/types/plugin-spec/registry.d.ts +23 -0
  127. package/lib/types/plugin-spec/registry.d.ts.map +1 -0
  128. package/lib/types/plugin-spec/registry.js +157 -0
  129. package/lib/types/plugin-spec/schema-check.d.ts +17 -0
  130. package/lib/types/plugin-spec/schema-check.d.ts.map +1 -0
  131. package/lib/types/plugin-spec/schema-check.js +165 -0
  132. package/lib/types/plugin-spec/tui-extension.d.ts +16 -0
  133. package/lib/types/plugin-spec/tui-extension.d.ts.map +1 -0
  134. package/lib/types/plugin-spec/tui-extension.js +77 -0
  135. package/lib/types/plugin-spec/types.d.ts +114 -0
  136. package/lib/types/plugin-spec/types.d.ts.map +1 -0
  137. package/lib/types/plugin-spec/types.js +10 -0
  138. package/lib/types/plugin-spec/validate.d.ts +21 -0
  139. package/lib/types/plugin-spec/validate.d.ts.map +1 -0
  140. package/lib/types/plugin-spec/validate.js +119 -0
  141. package/lib/types/screens/Chat.d.ts +14 -1
  142. package/lib/types/screens/Chat.d.ts.map +1 -1
  143. package/lib/types/screens/Chat.js +142 -39
  144. package/lib/types/theme.d.ts +5 -0
  145. package/lib/types/theme.d.ts.map +1 -1
  146. package/lib/types/theme.js +15 -0
  147. package/lib/types/update.d.ts +20 -0
  148. package/lib/types/update.d.ts.map +1 -1
  149. package/lib/types/update.js +54 -7
  150. package/lib/types/utils/loaded-context.d.ts +8 -3
  151. package/lib/types/utils/loaded-context.d.ts.map +1 -1
  152. package/lib/types/utils/loaded-context.js +39 -3
  153. package/lib/types/utils/modifiers.d.ts.map +1 -1
  154. package/lib/types/utils/modifiers.js +3 -2
  155. package/lib/types/working-activity.d.ts +12 -0
  156. package/lib/types/working-activity.d.ts.map +1 -1
  157. package/lib/types/working-activity.js +13 -0
  158. package/node_modules/@dsh-std/command/LICENSE +21 -0
  159. package/node_modules/@dsh-std/command/README.md +26 -0
  160. package/node_modules/@dsh-std/command/README.zh.md +28 -0
  161. package/node_modules/@dsh-std/command/lib/index.d.ts +144 -0
  162. package/node_modules/@dsh-std/command/lib/index.d.ts.map +1 -0
  163. package/node_modules/@dsh-std/command/lib/index.js +252 -0
  164. package/node_modules/@dsh-std/command/lib/index.js.map +1 -0
  165. package/node_modules/@dsh-std/command/package.json +22 -0
  166. package/node_modules/@dsh-std/connection/LICENSE +21 -0
  167. package/node_modules/@dsh-std/connection/README.md +42 -0
  168. package/node_modules/@dsh-std/connection/README.zh.md +42 -0
  169. package/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
  170. package/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
  171. package/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
  172. package/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
  173. package/node_modules/@dsh-std/connection/lib/index.js +158 -0
  174. package/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
  175. package/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
  176. package/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
  177. package/node_modules/@dsh-std/connection/lib/memory.js +257 -0
  178. package/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
  179. package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
  180. package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
  181. package/node_modules/@dsh-std/connection/package.json +20 -0
  182. package/node_modules/@dsh-std/core/LICENSE +21 -0
  183. package/node_modules/@dsh-std/core/README.md +13 -0
  184. package/node_modules/@dsh-std/core/README.zh.md +13 -0
  185. package/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  186. package/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  187. package/node_modules/@dsh-std/core/lib/index.js +424 -0
  188. package/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  189. package/node_modules/@dsh-std/core/package.json +21 -0
  190. package/node_modules/@dsh-std/manifest/LICENSE +21 -0
  191. package/node_modules/@dsh-std/manifest/README.md +5 -0
  192. package/node_modules/@dsh-std/manifest/README.zh.md +5 -0
  193. package/node_modules/@dsh-std/manifest/lib/index.d.ts +182 -0
  194. package/node_modules/@dsh-std/manifest/lib/index.d.ts.map +1 -0
  195. package/node_modules/@dsh-std/manifest/lib/index.js +625 -0
  196. package/node_modules/@dsh-std/manifest/lib/index.js.map +1 -0
  197. package/node_modules/@dsh-std/manifest/package.json +20 -0
  198. package/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -0
  199. package/node_modules/@dsh-std/messages/LICENSE +21 -0
  200. package/node_modules/@dsh-std/messages/README.md +5 -0
  201. package/node_modules/@dsh-std/messages/README.zh.md +7 -0
  202. package/node_modules/@dsh-std/messages/lib/index.d.ts +50 -0
  203. package/node_modules/@dsh-std/messages/lib/index.d.ts.map +1 -0
  204. package/node_modules/@dsh-std/messages/lib/index.js +151 -0
  205. package/node_modules/@dsh-std/messages/lib/index.js.map +1 -0
  206. package/node_modules/@dsh-std/messages/package.json +20 -0
  207. package/node_modules/@dsh-std/messages/schema/message-observer-envelope-0.15.schema.json +54 -0
  208. package/node_modules/@dsh-std/presentation/LICENSE +21 -0
  209. package/node_modules/@dsh-std/presentation/README.md +26 -0
  210. package/node_modules/@dsh-std/presentation/README.zh.md +28 -0
  211. package/node_modules/@dsh-std/presentation/lib/index.d.ts +219 -0
  212. package/node_modules/@dsh-std/presentation/lib/index.d.ts.map +1 -0
  213. package/node_modules/@dsh-std/presentation/lib/index.js +547 -0
  214. package/node_modules/@dsh-std/presentation/lib/index.js.map +1 -0
  215. package/node_modules/@dsh-std/presentation/lib/interaction.d.ts +2 -0
  216. package/node_modules/@dsh-std/presentation/lib/interaction.js +2 -0
  217. package/node_modules/@dsh-std/presentation/lib/operations.d.ts +2 -0
  218. package/node_modules/@dsh-std/presentation/lib/operations.js +2 -0
  219. package/node_modules/@dsh-std/presentation/package.json +21 -0
  220. package/node_modules/@dsh-std/storage/LICENSE +21 -0
  221. package/node_modules/@dsh-std/storage/README.md +5 -0
  222. package/node_modules/@dsh-std/storage/README.zh.md +7 -0
  223. package/node_modules/@dsh-std/storage/lib/index.d.ts +48 -0
  224. package/node_modules/@dsh-std/storage/lib/index.d.ts.map +1 -0
  225. package/node_modules/@dsh-std/storage/lib/index.js +104 -0
  226. package/node_modules/@dsh-std/storage/lib/index.js.map +1 -0
  227. package/node_modules/@dsh-std/storage/package.json +20 -0
  228. package/node_modules/@dsh-std/storage/schema/local-storage-0.15.schema.json +56 -0
  229. package/package.json +105 -70
  230. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/LICENSE +21 -0
  231. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.md +42 -0
  232. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.zh.md +42 -0
  233. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
  234. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
  235. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
  236. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
  237. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js +158 -0
  238. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
  239. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
  240. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
  241. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js +257 -0
  242. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
  243. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
  244. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
  245. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/package.json +20 -0
  246. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/LICENSE +21 -0
  247. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.md +13 -0
  248. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.zh.md +13 -0
  249. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  250. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  251. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js +424 -0
  252. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  253. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/package.json +21 -0
  254. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/LICENSE +21 -0
  255. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.md +5 -0
  256. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.zh.md +5 -0
  257. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.d.ts +182 -0
  258. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.d.ts.map +1 -0
  259. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js +625 -0
  260. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js.map +1 -0
  261. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/package.json +20 -0
  262. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -0
  263. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/LICENSE +21 -0
  264. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.md +26 -0
  265. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.zh.md +28 -0
  266. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.d.ts +219 -0
  267. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.d.ts.map +1 -0
  268. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js +547 -0
  269. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js.map +1 -0
  270. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/interaction.d.ts +2 -0
  271. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/interaction.js +2 -0
  272. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/operations.d.ts +2 -0
  273. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/operations.js +2 -0
  274. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/package.json +21 -0
  275. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/LICENSE +21 -0
  276. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.md +13 -0
  277. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.zh.md +13 -0
  278. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  279. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  280. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js +424 -0
  281. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  282. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/package.json +21 -0
  283. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/LICENSE +21 -0
  284. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.md +13 -0
  285. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.zh.md +13 -0
  286. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  287. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  288. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js +424 -0
  289. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  290. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/package.json +21 -0
  291. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/LICENSE +21 -0
  292. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.md +13 -0
  293. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.zh.md +13 -0
  294. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  295. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  296. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js +424 -0
  297. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  298. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/package.json +21 -0
  299. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/LICENSE +21 -0
  300. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.md +42 -0
  301. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.zh.md +42 -0
  302. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
  303. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
  304. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
  305. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
  306. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js +158 -0
  307. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
  308. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
  309. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
  310. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js +257 -0
  311. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
  312. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
  313. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
  314. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/package.json +20 -0
  315. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/LICENSE +21 -0
  316. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.md +13 -0
  317. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.zh.md +13 -0
  318. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  319. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  320. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js +424 -0
  321. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  322. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/package.json +21 -0
  323. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/LICENSE +21 -0
  324. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.md +13 -0
  325. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.zh.md +13 -0
  326. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  327. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  328. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js +424 -0
  329. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  330. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/package.json +21 -0
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Plugin keyboard shortcuts — pi's `pi.registerShortcut`. A plugin binds a
3
+ * combo (`ctrl+shift+p`, `alt+k`, …) to a handler; the chat screen matches
4
+ * combos against keypresses that survived every built-in binding and runs
5
+ * the handler, consuming the key.
6
+ *
7
+ * Precedence rule (same philosophy as the command list: a plugin shadows
8
+ * nothing built in):
9
+ *
10
+ * - Combos must carry ctrl or alt (meta) — bare letters are typing, and
11
+ * bare Esc/arrows are navigation. Rejected at registration.
12
+ * - A RESERVED list (every combo the TUI itself binds globally or in the
13
+ * prompt editor) is refused at registration with a warning. The list is
14
+ * the enforcement of "locals win": collisions can never reach the matcher.
15
+ * - Overlays (pickers, dialogs, scenes, the session browser) own the
16
+ * keyboard while open; shortcuts match only in the plain chat state.
17
+ *
18
+ * Handlers are fire-and-forget from the UI's point of view: async handlers
19
+ * are awaited but their rejection is caught and toasted — a throwing
20
+ * handler must never break the keyboard for everyone else.
21
+ */
22
+ import { Context, Service } from '@deepseek-ai/cordis';
23
+ /** Minimal shape of the ink Key flags the matcher reads (kept structurally
24
+ * compatible with `Key` from the ui kit without importing React-facing
25
+ * modules into the adapter). */
26
+ export interface TuiShortcutKey {
27
+ ctrl?: boolean;
28
+ meta?: boolean;
29
+ super?: boolean;
30
+ shift?: boolean;
31
+ return?: boolean;
32
+ escape?: boolean;
33
+ tab?: boolean;
34
+ backspace?: boolean;
35
+ delete?: boolean;
36
+ upArrow?: boolean;
37
+ downArrow?: boolean;
38
+ leftArrow?: boolean;
39
+ rightArrow?: boolean;
40
+ home?: boolean;
41
+ end?: boolean;
42
+ pageUp?: boolean;
43
+ pageDown?: boolean;
44
+ }
45
+ export interface TuiShortcutOptions {
46
+ /** One-line description (shown by future /help surfaces; required so
47
+ * every binding is discoverable). */
48
+ description: string;
49
+ handler: () => void | Promise<void>;
50
+ }
51
+ interface ParsedCombo {
52
+ readonly raw: string;
53
+ readonly ctrl: boolean;
54
+ readonly meta: boolean;
55
+ readonly shift: boolean;
56
+ /** Named key flag on the Key object, or undefined for a character key. */
57
+ readonly named?: keyof TuiShortcutKey;
58
+ /** Character to match against the ink `input` string (lowercased). */
59
+ readonly char?: string;
60
+ }
61
+ /**
62
+ * Parse `ctrl+shift+p` style combos. Returns undefined on anything
63
+ * malformed or disallowed (no modifier, unknown key name); `allowReserved`
64
+ * is exposed for tests only.
65
+ */
66
+ export declare function parseShortcutCombo(raw: string): ParsedCombo | undefined;
67
+ /** Match a keypress against a parsed combo. `input` is ink's input string
68
+ * (already the resolved character; ctrl+space arrives as ' '). */
69
+ export declare function matchShortcut(combo: ParsedCombo, input: string, key: TuiShortcutKey): boolean;
70
+ declare module '@deepseek-ai/cordis' {
71
+ interface Context {
72
+ tuiShortcuts: TuiShortcutRuntime;
73
+ }
74
+ }
75
+ /** `ctx.tuiShortcuts` — plugin keyboard shortcut registry. */
76
+ export declare class TuiShortcutRuntime extends Service {
77
+ private readonly shortcuts;
78
+ /** Handler invocation errors are surfaced through this hook — the chat
79
+ * screen wires it to its notification toast. */
80
+ onError: ((combo: string, error: unknown) => void) | undefined;
81
+ constructor(ctx: Context);
82
+ /**
83
+ * Bind `combo` to `handler`. Invalid, modifier-less, reserved, or
84
+ * duplicate combos are refused with a logger warning rather than a throw
85
+ * — a bad binding must not fail the plugin's whole boot.
86
+ *
87
+ * Returns the dispose function; the CALLER scopes it to its own fiber
88
+ * (`ctx.effect(() => dispose)`) — the same contract as `tuiScenes`
89
+ * registration. (A service method only sees the service's own ctx, so
90
+ * caller-fiber cleanup cannot happen here.)
91
+ *
92
+ * The optional trailing `identity` (the plugin's own ctx) only feeds the
93
+ * effect ledger's pluginId — omitting it records `undeclared` (C-060).
94
+ */
95
+ register(combo: string, options: TuiShortcutOptions, identity?: Context): () => void;
96
+ /** Registered combos with descriptions (diagnostics / future /help). */
97
+ list(): readonly {
98
+ combo: string;
99
+ description: string;
100
+ }[];
101
+ /**
102
+ * Match a keypress; on a hit, run the handler and return true (the UI
103
+ * consumes the key). Handler rejections are caught and reported through
104
+ * {@link onError} — never propagated into the input path.
105
+ */
106
+ dispatch(input: string, key: TuiShortcutKey): boolean;
107
+ }
108
+ export default TuiShortcutRuntime;
109
+ //# sourceMappingURL=shortcuts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shortcuts.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/shortcuts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGtD;;iCAEiC;AACjC,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC;0CACsC;IACtC,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACpC;AAED,UAAU,WAAW;IACnB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,cAAc,CAAA;IACrC,sEAAsE;IACtE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CACvB;AA6DD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CA8CvE;AAkBD;mEACmE;AACnE,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAiB7F;AAED,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,YAAY,EAAE,kBAAkB,CAAA;KACjC;CACF;AAED,8DAA8D;AAC9D,qBAAa,kBAAmB,SAAQ,OAAO;IAC7C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwC;IAClE;qDACiD;IACjD,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAA;gBAElD,GAAG,EAAE,OAAO;IAIxB;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,IAAI;IAoDpF,wEAAwE;IACxE,IAAI,IAAI,SAAS;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE;IAIzD;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO;CAatD;AAED,eAAe,kBAAkB,CAAA"}
@@ -0,0 +1,268 @@
1
+ /**
2
+ * Plugin keyboard shortcuts — pi's `pi.registerShortcut`. A plugin binds a
3
+ * combo (`ctrl+shift+p`, `alt+k`, …) to a handler; the chat screen matches
4
+ * combos against keypresses that survived every built-in binding and runs
5
+ * the handler, consuming the key.
6
+ *
7
+ * Precedence rule (same philosophy as the command list: a plugin shadows
8
+ * nothing built in):
9
+ *
10
+ * - Combos must carry ctrl or alt (meta) — bare letters are typing, and
11
+ * bare Esc/arrows are navigation. Rejected at registration.
12
+ * - A RESERVED list (every combo the TUI itself binds globally or in the
13
+ * prompt editor) is refused at registration with a warning. The list is
14
+ * the enforcement of "locals win": collisions can never reach the matcher.
15
+ * - Overlays (pickers, dialogs, scenes, the session browser) own the
16
+ * keyboard while open; shortcuts match only in the plain chat state.
17
+ *
18
+ * Handlers are fire-and-forget from the UI's point of view: async handlers
19
+ * are awaited but their rejection is caught and toasted — a throwing
20
+ * handler must never break the keyboard for everyone else.
21
+ */
22
+ import { Service } from '@deepseek-ai/cordis';
23
+ import { cleanScalarText } from './sanitize.js';
24
+ const NAMED_KEYS = {
25
+ enter: 'return',
26
+ return: 'return',
27
+ esc: 'escape',
28
+ escape: 'escape',
29
+ tab: 'tab',
30
+ backspace: 'backspace',
31
+ delete: 'delete',
32
+ up: 'upArrow',
33
+ down: 'downArrow',
34
+ left: 'leftArrow',
35
+ right: 'rightArrow',
36
+ home: 'home',
37
+ end: 'end',
38
+ pageup: 'pageUp',
39
+ pagedown: 'pageDown',
40
+ };
41
+ /**
42
+ * Combos the TUI owns, globally or inside the prompt editor (the editor's
43
+ * bindings are checked AFTER plugin shortcuts, so refusing them here is
44
+ * what keeps "locals win" true). Built-in handlers match a MODIFIER SUBSET
45
+ * (`isMod(key) && input === 'x'` — they never exclude an extra Shift), so
46
+ * the reserved check below refuses a plugin combo whose SHIFTLESS form is
47
+ * reserved: ctrl+shift+x would shadow Ctrl+X on terminals that report both
48
+ * as the same keypress (ConPTY does), and would be dead weight on terminals
49
+ * that don't.
50
+ */
51
+ const RESERVED_COMBOS = new Set([
52
+ 'ctrl+c', // interrupt / clear
53
+ 'ctrl+d', // exit on empty input
54
+ 'ctrl+t', // startup context panel
55
+ 'ctrl+r', // history search
56
+ 'ctrl+x', // external editor
57
+ 'ctrl+o', // transcript mode toggle
58
+ 'ctrl+l', // terminal redraw
59
+ 'ctrl+e', // show all messages / line end
60
+ 'ctrl+v', // paste
61
+ 'ctrl+a', // line start
62
+ 'ctrl+u', // kill line
63
+ 'ctrl+k', // kill to end
64
+ 'ctrl+w', // kill word
65
+ 'ctrl+left', // word jump
66
+ 'ctrl+right', // word jump
67
+ 'ctrl+return', // newline (multi-line input)
68
+ 'ctrl+shift+return', // shift+Enter newline (CSI 13;6u) — same editor binding
69
+ 'alt+return', // newline fallback on terminals without shift reporting
70
+ 'alt+up', // pull the last pending message back for editing
71
+ 'escape', // pickers / interrupt / rewind double-tap
72
+ 'tab', // command completion
73
+ 'shift+tab', // session-mode cycle
74
+ ]);
75
+ /**
76
+ * Parse `ctrl+shift+p` style combos. Returns undefined on anything
77
+ * malformed or disallowed (no modifier, unknown key name); `allowReserved`
78
+ * is exposed for tests only.
79
+ */
80
+ export function parseShortcutCombo(raw) {
81
+ const parts = String(raw ?? '')
82
+ .toLowerCase()
83
+ .split('+')
84
+ .map(part => part.trim())
85
+ .filter(part => part !== '');
86
+ if (parts.length === 0)
87
+ return undefined;
88
+ let ctrl = false;
89
+ let meta = false;
90
+ let shift = false;
91
+ let named;
92
+ let char;
93
+ for (const part of parts) {
94
+ if (part === 'ctrl' || part === 'control') {
95
+ if (ctrl)
96
+ return undefined;
97
+ ctrl = true;
98
+ }
99
+ else if (part === 'alt' || part === 'meta' || part === 'option') {
100
+ if (meta)
101
+ return undefined;
102
+ meta = true;
103
+ }
104
+ else if (part === 'shift') {
105
+ if (shift)
106
+ return undefined;
107
+ shift = true;
108
+ }
109
+ else if (part === 'space') {
110
+ if (char !== undefined || named !== undefined)
111
+ return undefined;
112
+ char = ' ';
113
+ }
114
+ else if (part in NAMED_KEYS) {
115
+ if (char !== undefined || named !== undefined)
116
+ return undefined;
117
+ named = NAMED_KEYS[part];
118
+ }
119
+ else if ([...part].length === 1) {
120
+ if (char !== undefined || named !== undefined)
121
+ return undefined;
122
+ char = part;
123
+ }
124
+ else {
125
+ return undefined;
126
+ }
127
+ }
128
+ if (char === undefined && named === undefined)
129
+ return undefined;
130
+ // Bare keys are typing/navigation; a modifier is what makes a shortcut.
131
+ if (!ctrl && !meta)
132
+ return undefined;
133
+ // Escape combos are refused outright: the input layer sets key.meta = true
134
+ // for EVERY Escape (ink/events/input-event.ts — `keypress.meta ||
135
+ // keypress.name === 'escape' || keypress.option`), so an alt+escape combo
136
+ // would match every bare Esc press and shadow clear-input / the double-Esc
137
+ // rewind. Esc is fully owned by the TUI; there is no unambiguous way to
138
+ // bind it.
139
+ if (named === 'escape')
140
+ return undefined;
141
+ return { raw: parts.join('+'), ctrl, meta, shift, ...(named === undefined ? {} : { named }), ...(char === undefined ? {} : { char }) };
142
+ }
143
+ /** Canonical form for dedupe/reserved checks: modifiers sorted, key last. */
144
+ function comboKey(combo) {
145
+ const mods = [combo.ctrl ? 'ctrl' : '', combo.meta ? 'alt' : '', combo.shift ? 'shift' : '']
146
+ .filter(part => part !== '')
147
+ .sort();
148
+ return [...mods, combo.named === undefined ? (combo.char ?? '') : String(combo.named)].join('+');
149
+ }
150
+ /** Reserved lookup accepts user-spelled combos too (`ctrl+c`). */
151
+ function reservedKey(raw) {
152
+ const combo = parseShortcutCombo(raw);
153
+ return combo === undefined ? raw.toLowerCase() : comboKey(combo);
154
+ }
155
+ const RESERVED_CANONICAL = new Set([...RESERVED_COMBOS].map(reservedKey));
156
+ /** Match a keypress against a parsed combo. `input` is ink's input string
157
+ * (already the resolved character; ctrl+space arrives as ' '). */
158
+ export function matchShortcut(combo, input, key) {
159
+ if (Boolean(key.ctrl) !== combo.ctrl)
160
+ return false;
161
+ // ink reports Alt as meta; Esc itself also sets meta, which is why the
162
+ // modifier check runs against the combo, not a bare flag read.
163
+ if (Boolean(key.meta) !== combo.meta)
164
+ return false;
165
+ if (key.super)
166
+ return false;
167
+ // Shift must match for NAMED keys exactly as for characters — otherwise a
168
+ // registered ctrl+shift+enter would also match a plain ctrl+enter press,
169
+ // letting a plugin shadow the editor's built-in Ctrl+Enter delivery.
170
+ if (Boolean(key.shift) !== combo.shift)
171
+ return false;
172
+ if (combo.named !== undefined) {
173
+ return key[combo.named] === true;
174
+ }
175
+ if (combo.char === undefined)
176
+ return false;
177
+ // Shift+letter arrives as the uppercase character; compare case-folded
178
+ // (the shift FLAG equality above already pinned the modifier state).
179
+ return input.toLowerCase() === combo.char;
180
+ }
181
+ /** `ctx.tuiShortcuts` — plugin keyboard shortcut registry. */
182
+ export class TuiShortcutRuntime extends Service {
183
+ shortcuts = new Map();
184
+ /** Handler invocation errors are surfaced through this hook — the chat
185
+ * screen wires it to its notification toast. */
186
+ onError;
187
+ constructor(ctx) {
188
+ super(ctx, 'tuiShortcuts');
189
+ }
190
+ /**
191
+ * Bind `combo` to `handler`. Invalid, modifier-less, reserved, or
192
+ * duplicate combos are refused with a logger warning rather than a throw
193
+ * — a bad binding must not fail the plugin's whole boot.
194
+ *
195
+ * Returns the dispose function; the CALLER scopes it to its own fiber
196
+ * (`ctx.effect(() => dispose)`) — the same contract as `tuiScenes`
197
+ * registration. (A service method only sees the service's own ctx, so
198
+ * caller-fiber cleanup cannot happen here.)
199
+ *
200
+ * The optional trailing `identity` (the plugin's own ctx) only feeds the
201
+ * effect ledger's pluginId — omitting it records `undeclared` (C-060).
202
+ */
203
+ register(combo, options, identity) {
204
+ const parsed = parseShortcutCombo(combo);
205
+ if (parsed === undefined) {
206
+ this.ctx.logger.warn(`dsh-tui: tuiShortcuts.register rejected ${JSON.stringify(combo)} — need ctrl/alt plus one key (e.g. "ctrl+shift+p")`);
207
+ return () => { };
208
+ }
209
+ const key = comboKey(parsed);
210
+ // Built-ins match a modifier subset (see RESERVED_COMBOS): a combo whose
211
+ // SHIFTLESS form is reserved collides with the built-in on terminals that
212
+ // don't report Shift distinctly, so it is refused too. The exact form is
213
+ // still checked for combos reserved WITH shift (ctrl+shift+return).
214
+ const shiftlessKey = comboKey({ ...parsed, shift: false });
215
+ if (RESERVED_CANONICAL.has(key) || RESERVED_CANONICAL.has(shiftlessKey)) {
216
+ this.ctx.logger.warn(`dsh-tui: tuiShortcuts.register rejected "${combo}" — reserved by a built-in binding`);
217
+ return () => { };
218
+ }
219
+ if (this.shortcuts.has(key)) {
220
+ this.ctx.logger.warn(`dsh-tui: tuiShortcuts.register rejected "${combo}" — already registered`);
221
+ this.ctx.get('tuiEffectLedger')?.record({
222
+ operation: 'bind',
223
+ resource: { kind: 'shortcut', id: key },
224
+ result: 'failed',
225
+ errorCode: 'DUPLICATE_CONTRIBUTION_ID',
226
+ }, identity);
227
+ return () => { };
228
+ }
229
+ const description = cleanScalarText(options?.description, 120);
230
+ if (typeof options?.handler !== 'function' || description === '') {
231
+ this.ctx.logger.warn(`dsh-tui: tuiShortcuts.register rejected "${combo}" — needs a description and a handler`);
232
+ return () => { };
233
+ }
234
+ const entry = { combo: parsed, description, handler: options.handler };
235
+ this.shortcuts.set(key, entry);
236
+ this.ctx.get('tuiEffectLedger')?.record({ operation: 'bind', resource: { kind: 'shortcut', id: key }, result: 'applied' }, identity);
237
+ return () => {
238
+ if (this.shortcuts.get(key) !== entry)
239
+ return;
240
+ this.shortcuts.delete(key);
241
+ this.ctx.get('tuiEffectLedger')?.record({ operation: 'release', resource: { kind: 'shortcut', id: key }, result: 'applied' }, identity);
242
+ };
243
+ }
244
+ /** Registered combos with descriptions (diagnostics / future /help). */
245
+ list() {
246
+ return [...this.shortcuts.values()].map(entry => ({ combo: entry.combo.raw, description: entry.description }));
247
+ }
248
+ /**
249
+ * Match a keypress; on a hit, run the handler and return true (the UI
250
+ * consumes the key). Handler rejections are caught and reported through
251
+ * {@link onError} — never propagated into the input path.
252
+ */
253
+ dispatch(input, key) {
254
+ for (const entry of this.shortcuts.values()) {
255
+ if (!matchShortcut(entry.combo, input, key))
256
+ continue;
257
+ Promise.resolve()
258
+ .then(() => entry.handler())
259
+ .catch((error) => {
260
+ this.onError?.(entry.combo.raw, error);
261
+ this.ctx.logger.warn(`dsh-tui: shortcut "${entry.combo.raw}" handler failed: %o`, error);
262
+ });
263
+ return true;
264
+ }
265
+ return false;
266
+ }
267
+ }
268
+ export default TuiShortcutRuntime;
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Keyed status-line contributions — pi's `ctx.ui.setStatus(key, text)`.
3
+ * Each plugin owns a key; setting text shows it, setting undefined clears
4
+ * it. The TUI renders all contributions as one joined line above the prompt
5
+ * (host-owned rendering: plugins supply text, never layout).
6
+ *
7
+ * Same split as the dialogs seam: a cordis-free store the chat screen
8
+ * subscribes to, and a thin cordis service validating untrusted text.
9
+ */
10
+ import { Context, Service } from '@deepseek-ai/cordis';
11
+ /** One rendered contribution. */
12
+ export interface TuiStatusEntry {
13
+ readonly key: string;
14
+ readonly text: string;
15
+ }
16
+ /** Cordis-free keyed-text store. Render order is first-set order (Map
17
+ * insertion order), so a plugin's line never jumps around on updates. */
18
+ export declare class TuiStatusStore {
19
+ private readonly listeners;
20
+ private readonly entries;
21
+ private snapshot;
22
+ /** Set or clear (undefined/empty) one key. */
23
+ set(key: string, text: string | undefined, token?: number): void;
24
+ /** Current contributions, first-set first (stable between changes). */
25
+ getSnapshot(): readonly TuiStatusEntry[];
26
+ /** Clear `key` only while it still holds the write tagged `token` — a
27
+ * stale disposer must not wipe a newer contribution (even one with
28
+ * identical text). Returns true when this call actually cleared. */
29
+ clearIf(key: string, token: number): boolean;
30
+ /** Drop everything (teardown). */
31
+ clear(): void;
32
+ subscribe(listener: () => void): () => void;
33
+ private emit;
34
+ }
35
+ declare module '@deepseek-ai/cordis' {
36
+ interface Context {
37
+ tuiStatus: TuiStatusRuntime;
38
+ }
39
+ }
40
+ /**
41
+ * `ctx.tuiStatus` — plugin-facing status contributions. Invalid keys and
42
+ * oversized text are rejected with a logger warning instead of throwing:
43
+ * a status line must never take the TUI down.
44
+ */
45
+ export declare class TuiStatusRuntime extends Service {
46
+ /** The store the chat screen renders. Exposed for the host, not plugins. */
47
+ readonly store: TuiStatusStore;
48
+ /** Monotonic per-write token; a disposer only clears ITS write (see the
49
+ * store's token comment for the same-value ABA this prevents). */
50
+ private nextToken;
51
+ constructor(ctx: Context);
52
+ /**
53
+ * Set (or clear with `undefined`) the contribution for `key`. Keys are
54
+ * plugin-namespaced by convention (`my-plugin`, `my-plugin:detail`);
55
+ * control chars are stripped and text is capped at 200 cells. Text is
56
+ * scalar-only: string/number/boolean are coerced to string, anything else
57
+ * is refused with a warning (never rendered as "[object Object]", never
58
+ * silently treated as a clear).
59
+ *
60
+ * Returns a disposer that clears the contribution IF the key still holds
61
+ * exactly this write (a later set — even of identical text — wins over a
62
+ * stale disposer). The CALLER scopes it to its own fiber
63
+ * (`ctx.effect(() => dispose)`) — the same contract as
64
+ * `tuiShortcuts`/`tuiScenes`: a service method only sees the service's own
65
+ * ctx, so per-plugin cleanup cannot happen here. Without that, an unloaded
66
+ * or hot-reloaded plugin would leave its line behind forever.
67
+ *
68
+ * The optional trailing `identity` (the plugin's own ctx) only feeds the
69
+ * effect ledger's pluginId — omitting it records `undeclared`, never a
70
+ * guess (C-060 honest identity).
71
+ */
72
+ set(key: string, text: string | number | boolean | undefined, identity?: Context): () => void;
73
+ }
74
+ export default TuiStatusRuntime;
75
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGtD,iCAAiC;AACjC,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAQD;0EAC0E;AAC1E,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwB;IAKlD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqD;IAG7E,OAAO,CAAC,QAAQ,CAAgC;IAEhD,8CAA8C;IAC9C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,SAAI,GAAG,IAAI;IAmB3D,uEAAuE;IACvE,WAAW,IAAI,SAAS,cAAc,EAAE;IAIxC;;yEAEqE;IACrE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAQ5C,kCAAkC;IAClC,KAAK,IAAI,IAAI;IAOb,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAO3C,OAAO,CAAC,IAAI;CAGb;AAED,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,SAAS,EAAE,gBAAgB,CAAA;KAC5B;CACF;AAED;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,OAAO;IAC3C,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,iBAAuB;IAErC;uEACmE;IACnE,OAAO,CAAC,SAAS,CAAI;gBAET,GAAG,EAAE,OAAO;IAKxB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,IAAI;CAoD9F;AAED,eAAe,gBAAgB,CAAA"}
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Keyed status-line contributions — pi's `ctx.ui.setStatus(key, text)`.
3
+ * Each plugin owns a key; setting text shows it, setting undefined clears
4
+ * it. The TUI renders all contributions as one joined line above the prompt
5
+ * (host-owned rendering: plugins supply text, never layout).
6
+ *
7
+ * Same split as the dialogs seam: a cordis-free store the chat screen
8
+ * subscribes to, and a thin cordis service validating untrusted text.
9
+ */
10
+ import { Service } from '@deepseek-ai/cordis';
11
+ import { cleanScalarText } from './sanitize.js';
12
+ // Colon-separated segments are the documented namespacing convention
13
+ // (`plugin:sub-item`); each segment stays a lowercase slug.
14
+ const KEY_PATTERN = /^[a-z][a-z0-9_-]*(:[a-z][a-z0-9_-]*)*$/u;
15
+ const TEXT_CELLS = 200;
16
+ const MAX_ENTRIES = 20;
17
+ /** Cordis-free keyed-text store. Render order is first-set order (Map
18
+ * insertion order), so a plugin's line never jumps around on updates. */
19
+ export class TuiStatusStore {
20
+ listeners = new Set();
21
+ // Each write carries a token: a disposer compares TOKENS, not text —
22
+ // value comparison has an ABA hole (set 'x', set 'x' again, the first
23
+ // disposer would wipe the second write, e.g. a hot reload restoring the
24
+ // same status text).
25
+ entries = new Map();
26
+ // useSyncExternalStore requires a referentially stable snapshot between
27
+ // emits — a fresh array per call would re-render in an infinite loop.
28
+ snapshot = [];
29
+ /** Set or clear (undefined/empty) one key. */
30
+ set(key, text, token = 0) {
31
+ const had = this.entries.has(key);
32
+ if (text === undefined || text === '') {
33
+ if (!had)
34
+ return;
35
+ this.entries.delete(key);
36
+ }
37
+ else {
38
+ const existing = this.entries.get(key);
39
+ if (existing?.text === text) {
40
+ // Same text, new write: adopt the new token so the newest disposer
41
+ // is the one that owns the line (no re-emit — nothing visible changed).
42
+ existing.token = token;
43
+ return;
44
+ }
45
+ this.entries.set(key, { text, token });
46
+ }
47
+ this.snapshot = [...this.entries].map(([entryKey, entry]) => ({ key: entryKey, text: entry.text }));
48
+ this.emit();
49
+ }
50
+ /** Current contributions, first-set first (stable between changes). */
51
+ getSnapshot() {
52
+ return this.snapshot;
53
+ }
54
+ /** Clear `key` only while it still holds the write tagged `token` — a
55
+ * stale disposer must not wipe a newer contribution (even one with
56
+ * identical text). Returns true when this call actually cleared. */
57
+ clearIf(key, token) {
58
+ if (this.entries.get(key)?.token !== token)
59
+ return false;
60
+ this.entries.delete(key);
61
+ this.snapshot = [...this.entries].map(([entryKey, entry]) => ({ key: entryKey, text: entry.text }));
62
+ this.emit();
63
+ return true;
64
+ }
65
+ /** Drop everything (teardown). */
66
+ clear() {
67
+ if (this.entries.size === 0)
68
+ return;
69
+ this.entries.clear();
70
+ this.snapshot = [];
71
+ this.emit();
72
+ }
73
+ subscribe(listener) {
74
+ this.listeners.add(listener);
75
+ return () => {
76
+ this.listeners.delete(listener);
77
+ };
78
+ }
79
+ emit() {
80
+ for (const listener of this.listeners)
81
+ listener();
82
+ }
83
+ }
84
+ /**
85
+ * `ctx.tuiStatus` — plugin-facing status contributions. Invalid keys and
86
+ * oversized text are rejected with a logger warning instead of throwing:
87
+ * a status line must never take the TUI down.
88
+ */
89
+ export class TuiStatusRuntime extends Service {
90
+ /** The store the chat screen renders. Exposed for the host, not plugins. */
91
+ store = new TuiStatusStore();
92
+ /** Monotonic per-write token; a disposer only clears ITS write (see the
93
+ * store's token comment for the same-value ABA this prevents). */
94
+ nextToken = 1;
95
+ constructor(ctx) {
96
+ super(ctx, 'tuiStatus');
97
+ ctx.effect(() => () => this.store.clear());
98
+ }
99
+ /**
100
+ * Set (or clear with `undefined`) the contribution for `key`. Keys are
101
+ * plugin-namespaced by convention (`my-plugin`, `my-plugin:detail`);
102
+ * control chars are stripped and text is capped at 200 cells. Text is
103
+ * scalar-only: string/number/boolean are coerced to string, anything else
104
+ * is refused with a warning (never rendered as "[object Object]", never
105
+ * silently treated as a clear).
106
+ *
107
+ * Returns a disposer that clears the contribution IF the key still holds
108
+ * exactly this write (a later set — even of identical text — wins over a
109
+ * stale disposer). The CALLER scopes it to its own fiber
110
+ * (`ctx.effect(() => dispose)`) — the same contract as
111
+ * `tuiShortcuts`/`tuiScenes`: a service method only sees the service's own
112
+ * ctx, so per-plugin cleanup cannot happen here. Without that, an unloaded
113
+ * or hot-reloaded plugin would leave its line behind forever.
114
+ *
115
+ * The optional trailing `identity` (the plugin's own ctx) only feeds the
116
+ * effect ledger's pluginId — omitting it records `undeclared`, never a
117
+ * guess (C-060 honest identity).
118
+ */
119
+ set(key, text, identity) {
120
+ const noop = () => { };
121
+ const normalized = String(key ?? '').trim().toLowerCase();
122
+ if (!KEY_PATTERN.test(normalized)) {
123
+ this.ctx.logger.warn(`dsh-tui: tuiStatus.set rejected invalid key ${JSON.stringify(key)}`);
124
+ return noop;
125
+ }
126
+ if (text !== undefined && !this.store.getSnapshot().some(e => e.key === normalized)) {
127
+ // New key beyond the cap: the line is one row of terminal — an
128
+ // unbounded count would push the prompt off screen.
129
+ if (this.store.getSnapshot().length >= MAX_ENTRIES) {
130
+ this.ctx.logger.warn(`dsh-tui: tuiStatus.set rejected "${normalized}": ${MAX_ENTRIES} contributions already shown`);
131
+ return noop;
132
+ }
133
+ }
134
+ let cleaned;
135
+ if (text !== undefined) {
136
+ // Scalar-only coercion (Track A contract): a non-scalar text (an
137
+ // object would otherwise render as "[object Object]") is REFUSED with
138
+ // a warning — it must not silently become a clear, either.
139
+ if (typeof text !== 'string' && typeof text !== 'number' && typeof text !== 'boolean') {
140
+ this.ctx.logger.warn(`dsh-tui: tuiStatus.set rejected non-scalar text for "${normalized}"`);
141
+ return noop;
142
+ }
143
+ cleaned = cleanScalarText(text, TEXT_CELLS);
144
+ }
145
+ const token = this.nextToken++;
146
+ const had = this.store.getSnapshot().some(entry => entry.key === normalized);
147
+ this.store.set(normalized, cleaned, token);
148
+ const ledger = this.ctx.get('tuiEffectLedger');
149
+ if (cleaned === undefined) {
150
+ if (had)
151
+ ledger?.record({ operation: 'release', resource: { kind: 'status', id: normalized }, result: 'applied' }, identity);
152
+ }
153
+ else {
154
+ ledger?.record({
155
+ operation: had ? 'replace' : 'bind',
156
+ resource: { kind: 'status', id: normalized },
157
+ result: 'applied',
158
+ ...(had ? { replaces: { resourceId: normalized } } : {}),
159
+ }, identity);
160
+ }
161
+ return () => {
162
+ if (this.store.clearIf(normalized, token)) {
163
+ this.ctx.get('tuiEffectLedger')?.record({ operation: 'release', resource: { kind: 'status', id: normalized }, result: 'applied' }, identity);
164
+ }
165
+ };
166
+ }
167
+ }
168
+ export default TuiStatusRuntime;
@@ -0,0 +1,8 @@
1
+ export * from './dsh-adapter/extensions.js';
2
+ export * from './dsh-adapter/extension-events.js';
3
+ export * from './dsh-adapter/dialogs.js';
4
+ export * from './dsh-adapter/status.js';
5
+ export * from './dsh-adapter/shortcuts.js';
6
+ export * from './dsh-adapter/renderers.js';
7
+ export { DECISION_EVENT_PERMISSIONS } from './dsh-adapter/decision-guard.js';
8
+ //# sourceMappingURL=extensions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../src/extensions.ts"],"names":[],"mappings":"AAMA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,mCAAmC,CAAA;AACjD,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AACvC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,4BAA4B,CAAA;AAG1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA"}
@@ -0,0 +1,15 @@
1
+ // Re-export shim: the Cordis-backed implementation lives behind the adapter
2
+ // boundary so UI consumers never import official @deepseek-ai/* packages.
3
+ // Plugin authors import the seam types from here
4
+ // (`@deepseek-harness-tui/dsh-tui/extensions`); importing the module also
5
+ // applies the `declare module '@deepseek-ai/cordis'` augmentation for the
6
+ // decision events and the four service properties on Context.
7
+ export * from './dsh-adapter/extensions.js';
8
+ export * from './dsh-adapter/extension-events.js';
9
+ export * from './dsh-adapter/dialogs.js';
10
+ export * from './dsh-adapter/status.js';
11
+ export * from './dsh-adapter/shortcuts.js';
12
+ export * from './dsh-adapter/renderers.js';
13
+ // The D-7 permission vocabulary (which grant each decision event needs) is
14
+ // part of the plugin-facing contract too.
15
+ export { DECISION_EVENT_PERMISSIONS } from './dsh-adapter/decision-guard.js';