@deepseek-harness-tui/dsh-tui 0.7.3 → 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 (371) hide show
  1. package/README.md +15 -7
  2. package/bin/dsh-tui.js +19 -3
  3. package/cordis.patch.yml +43 -11
  4. package/cordis.yml +20 -1
  5. package/ecosystem-spec/registry/contracts/decision-events-v1alpha1.json +13 -0
  6. package/ecosystem-spec/registry/host-descriptor.tui.example.json +56 -0
  7. package/ecosystem-spec/registry/permissions-0.1.json +13 -0
  8. package/ecosystem-spec/registry/registry-0.15.json +57 -0
  9. package/ecosystem-spec/schemas/conformance-claim.schema.json +15 -0
  10. package/ecosystem-spec/schemas/effect-ledger-record.schema.json +16 -0
  11. package/ecosystem-spec/schemas/host-descriptor.schema.json +26 -0
  12. package/lib/types/cc/figures.d.ts +4 -0
  13. package/lib/types/cc/figures.d.ts.map +1 -1
  14. package/lib/types/cc/figures.js +4 -0
  15. package/lib/types/commands.d.ts.map +1 -1
  16. package/lib/types/commands.js +4 -1
  17. package/lib/types/components/ExtensionDialog.d.ts +40 -0
  18. package/lib/types/components/ExtensionDialog.d.ts.map +1 -0
  19. package/lib/types/components/ExtensionDialog.js +210 -0
  20. package/lib/types/components/HelpMenu.js +1 -1
  21. package/lib/types/components/LoadedContextPanel.d.ts +5 -10
  22. package/lib/types/components/LoadedContextPanel.d.ts.map +1 -1
  23. package/lib/types/components/LoadedContextPanel.js +7 -18
  24. package/lib/types/components/LogoV2.d.ts.map +1 -1
  25. package/lib/types/components/LogoV2.js +1 -2
  26. package/lib/types/components/MessageList.d.ts +3 -1
  27. package/lib/types/components/MessageList.d.ts.map +1 -1
  28. package/lib/types/components/MessageList.js +29 -5
  29. package/lib/types/components/PluginSceneBoundary.d.ts +31 -0
  30. package/lib/types/components/PluginSceneBoundary.d.ts.map +1 -0
  31. package/lib/types/components/PluginSceneBoundary.js +29 -0
  32. package/lib/types/components/RewindPicker.d.ts +13 -1
  33. package/lib/types/components/RewindPicker.d.ts.map +1 -1
  34. package/lib/types/components/RewindPicker.js +26 -2
  35. package/lib/types/components/SkillsPicker.d.ts +18 -0
  36. package/lib/types/components/SkillsPicker.d.ts.map +1 -0
  37. package/lib/types/components/SkillsPicker.js +50 -0
  38. package/lib/types/components/SplitDiffView.d.ts +28 -0
  39. package/lib/types/components/SplitDiffView.d.ts.map +1 -0
  40. package/lib/types/components/SplitDiffView.js +417 -0
  41. package/lib/types/components/ToolUseLoader.d.ts +8 -3
  42. package/lib/types/components/ToolUseLoader.d.ts.map +1 -1
  43. package/lib/types/components/ToolUseLoader.js +43 -9
  44. package/lib/types/components/messages/AssistantToolUseMessage.d.ts +3 -1
  45. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  46. package/lib/types/components/messages/AssistantToolUseMessage.js +17 -7
  47. package/lib/types/dsh-adapter/channel.d.ts +98 -7
  48. package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
  49. package/lib/types/dsh-adapter/channel.js +623 -26
  50. package/lib/types/dsh-adapter/command-attribution.d.ts +51 -0
  51. package/lib/types/dsh-adapter/command-attribution.d.ts.map +1 -0
  52. package/lib/types/dsh-adapter/command-attribution.js +93 -0
  53. package/lib/types/dsh-adapter/command-errors.d.ts +42 -0
  54. package/lib/types/dsh-adapter/command-errors.d.ts.map +1 -0
  55. package/lib/types/dsh-adapter/command-errors.js +63 -0
  56. package/lib/types/dsh-adapter/component-identity.d.ts +28 -0
  57. package/lib/types/dsh-adapter/component-identity.d.ts.map +1 -0
  58. package/lib/types/dsh-adapter/component-identity.js +108 -0
  59. package/lib/types/dsh-adapter/contract.d.ts +2 -2
  60. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  61. package/lib/types/dsh-adapter/contract.js +3 -2
  62. package/lib/types/dsh-adapter/decision-guard.d.ts +84 -0
  63. package/lib/types/dsh-adapter/decision-guard.d.ts.map +1 -0
  64. package/lib/types/dsh-adapter/decision-guard.js +354 -0
  65. package/lib/types/dsh-adapter/dialogs.d.ts +146 -0
  66. package/lib/types/dsh-adapter/dialogs.d.ts.map +1 -0
  67. package/lib/types/dsh-adapter/dialogs.js +262 -0
  68. package/lib/types/dsh-adapter/effect-ledger.d.ts +99 -0
  69. package/lib/types/dsh-adapter/effect-ledger.d.ts.map +1 -0
  70. package/lib/types/dsh-adapter/effect-ledger.js +231 -0
  71. package/lib/types/dsh-adapter/extension-events.d.ts +193 -0
  72. package/lib/types/dsh-adapter/extension-events.d.ts.map +1 -0
  73. package/lib/types/dsh-adapter/extension-events.js +169 -0
  74. package/lib/types/dsh-adapter/extensions.d.ts +32 -0
  75. package/lib/types/dsh-adapter/extensions.d.ts.map +1 -0
  76. package/lib/types/dsh-adapter/extensions.js +42 -0
  77. package/lib/types/dsh-adapter/grants.d.ts +25 -0
  78. package/lib/types/dsh-adapter/grants.d.ts.map +1 -0
  79. package/lib/types/dsh-adapter/grants.js +184 -0
  80. package/lib/types/dsh-adapter/host-descriptor.d.ts +24 -0
  81. package/lib/types/dsh-adapter/host-descriptor.d.ts.map +1 -0
  82. package/lib/types/dsh-adapter/host-descriptor.js +146 -0
  83. package/lib/types/dsh-adapter/index.d.ts +4 -0
  84. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  85. package/lib/types/dsh-adapter/index.js +1 -0
  86. package/lib/types/dsh-adapter/message-observer.d.ts +178 -0
  87. package/lib/types/dsh-adapter/message-observer.d.ts.map +1 -0
  88. package/lib/types/dsh-adapter/message-observer.js +509 -0
  89. package/lib/types/dsh-adapter/plugin-host.d.ts +103 -0
  90. package/lib/types/dsh-adapter/plugin-host.d.ts.map +1 -0
  91. package/lib/types/dsh-adapter/plugin-host.js +270 -0
  92. package/lib/types/dsh-adapter/plugin-storage.d.ts +113 -0
  93. package/lib/types/dsh-adapter/plugin-storage.d.ts.map +1 -0
  94. package/lib/types/dsh-adapter/plugin-storage.js +385 -0
  95. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  96. package/lib/types/dsh-adapter/plugin.js +106 -1
  97. package/lib/types/dsh-adapter/plugins-info.d.ts +43 -0
  98. package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -0
  99. package/lib/types/dsh-adapter/plugins-info.js +276 -0
  100. package/lib/types/dsh-adapter/promptDebug.d.ts +10 -0
  101. package/lib/types/dsh-adapter/promptDebug.d.ts.map +1 -0
  102. package/lib/types/dsh-adapter/promptDebug.js +148 -0
  103. package/lib/types/dsh-adapter/renderers.d.ts +65 -0
  104. package/lib/types/dsh-adapter/renderers.d.ts.map +1 -0
  105. package/lib/types/dsh-adapter/renderers.js +138 -0
  106. package/lib/types/dsh-adapter/sanitize.d.ts +36 -0
  107. package/lib/types/dsh-adapter/sanitize.d.ts.map +1 -0
  108. package/lib/types/dsh-adapter/sanitize.js +65 -0
  109. package/lib/types/dsh-adapter/scenes.d.ts +81 -0
  110. package/lib/types/dsh-adapter/scenes.d.ts.map +1 -0
  111. package/lib/types/dsh-adapter/scenes.js +93 -0
  112. package/lib/types/dsh-adapter/settings-sections.d.ts +116 -0
  113. package/lib/types/dsh-adapter/settings-sections.d.ts.map +1 -0
  114. package/lib/types/dsh-adapter/settings-sections.js +63 -0
  115. package/lib/types/dsh-adapter/settingsEditor.d.ts +128 -0
  116. package/lib/types/dsh-adapter/settingsEditor.d.ts.map +1 -0
  117. package/lib/types/dsh-adapter/settingsEditor.js +244 -0
  118. package/lib/types/dsh-adapter/shortcuts.d.ts +109 -0
  119. package/lib/types/dsh-adapter/shortcuts.d.ts.map +1 -0
  120. package/lib/types/dsh-adapter/shortcuts.js +268 -0
  121. package/lib/types/dsh-adapter/status.d.ts +75 -0
  122. package/lib/types/dsh-adapter/status.d.ts.map +1 -0
  123. package/lib/types/dsh-adapter/status.js +168 -0
  124. package/lib/types/extensions.d.ts +8 -0
  125. package/lib/types/extensions.d.ts.map +1 -0
  126. package/lib/types/extensions.js +15 -0
  127. package/lib/types/i18n.d.ts +299 -26
  128. package/lib/types/i18n.d.ts.map +1 -1
  129. package/lib/types/i18n.js +89 -8
  130. package/lib/types/ink/ink.d.ts +11 -0
  131. package/lib/types/ink/ink.d.ts.map +1 -1
  132. package/lib/types/ink/ink.js +33 -0
  133. package/lib/types/ink/log-update.d.ts.map +1 -1
  134. package/lib/types/ink/log-update.js +101 -51
  135. package/lib/types/ink/output.d.ts +7 -0
  136. package/lib/types/ink/output.d.ts.map +1 -1
  137. package/lib/types/ink/output.js +125 -4
  138. package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
  139. package/lib/types/ink/render-node-to-output.js +14 -6
  140. package/lib/types/ink/terminal.d.ts.map +1 -1
  141. package/lib/types/ink/terminal.js +18 -6
  142. package/lib/types/jsx-runtime.d.ts +2 -0
  143. package/lib/types/jsx-runtime.d.ts.map +1 -0
  144. package/lib/types/jsx-runtime.js +13 -0
  145. package/lib/types/modelRoute.d.ts +10 -2
  146. package/lib/types/modelRoute.d.ts.map +1 -1
  147. package/lib/types/modelRoute.js +33 -4
  148. package/lib/types/plugin-host.d.ts +13 -0
  149. package/lib/types/plugin-host.d.ts.map +1 -0
  150. package/lib/types/plugin-host.js +17 -0
  151. package/lib/types/plugin-spec/negotiate.d.ts +11 -0
  152. package/lib/types/plugin-spec/negotiate.d.ts.map +1 -0
  153. package/lib/types/plugin-spec/negotiate.js +97 -0
  154. package/lib/types/plugin-spec/permission-scope.d.ts +32 -0
  155. package/lib/types/plugin-spec/permission-scope.d.ts.map +1 -0
  156. package/lib/types/plugin-spec/permission-scope.js +90 -0
  157. package/lib/types/plugin-spec/registry.d.ts +23 -0
  158. package/lib/types/plugin-spec/registry.d.ts.map +1 -0
  159. package/lib/types/plugin-spec/registry.js +157 -0
  160. package/lib/types/plugin-spec/schema-check.d.ts +17 -0
  161. package/lib/types/plugin-spec/schema-check.d.ts.map +1 -0
  162. package/lib/types/plugin-spec/schema-check.js +165 -0
  163. package/lib/types/plugin-spec/tui-extension.d.ts +16 -0
  164. package/lib/types/plugin-spec/tui-extension.d.ts.map +1 -0
  165. package/lib/types/plugin-spec/tui-extension.js +77 -0
  166. package/lib/types/plugin-spec/types.d.ts +114 -0
  167. package/lib/types/plugin-spec/types.d.ts.map +1 -0
  168. package/lib/types/plugin-spec/types.js +10 -0
  169. package/lib/types/plugin-spec/validate.d.ts +21 -0
  170. package/lib/types/plugin-spec/validate.d.ts.map +1 -0
  171. package/lib/types/plugin-spec/validate.js +119 -0
  172. package/lib/types/scenes.d.ts +3 -0
  173. package/lib/types/scenes.d.ts.map +1 -0
  174. package/lib/types/scenes.js +4 -0
  175. package/lib/types/screens/Chat.d.ts +14 -1
  176. package/lib/types/screens/Chat.d.ts.map +1 -1
  177. package/lib/types/screens/Chat.js +247 -48
  178. package/lib/types/screens/Settings.d.ts +20 -0
  179. package/lib/types/screens/Settings.d.ts.map +1 -0
  180. package/lib/types/screens/Settings.js +333 -0
  181. package/lib/types/screens/StatusLine.js +1 -1
  182. package/lib/types/settings-sections.d.ts +3 -0
  183. package/lib/types/settings-sections.d.ts.map +1 -0
  184. package/lib/types/settings-sections.js +4 -0
  185. package/lib/types/theme.d.ts +17 -0
  186. package/lib/types/theme.d.ts.map +1 -1
  187. package/lib/types/theme.js +51 -0
  188. package/lib/types/update.d.ts +20 -0
  189. package/lib/types/update.d.ts.map +1 -1
  190. package/lib/types/update.js +54 -7
  191. package/lib/types/utils/loaded-context.d.ts +8 -3
  192. package/lib/types/utils/loaded-context.d.ts.map +1 -1
  193. package/lib/types/utils/loaded-context.js +39 -3
  194. package/lib/types/utils/modifiers.d.ts.map +1 -1
  195. package/lib/types/utils/modifiers.js +3 -2
  196. package/lib/types/working-activity.d.ts +12 -0
  197. package/lib/types/working-activity.d.ts.map +1 -1
  198. package/lib/types/working-activity.js +13 -0
  199. package/node_modules/@dsh-std/command/LICENSE +21 -0
  200. package/node_modules/@dsh-std/command/README.md +26 -0
  201. package/node_modules/@dsh-std/command/README.zh.md +28 -0
  202. package/node_modules/@dsh-std/command/lib/index.d.ts +144 -0
  203. package/node_modules/@dsh-std/command/lib/index.d.ts.map +1 -0
  204. package/node_modules/@dsh-std/command/lib/index.js +252 -0
  205. package/node_modules/@dsh-std/command/lib/index.js.map +1 -0
  206. package/node_modules/@dsh-std/command/package.json +22 -0
  207. package/node_modules/@dsh-std/connection/LICENSE +21 -0
  208. package/node_modules/@dsh-std/connection/README.md +42 -0
  209. package/node_modules/@dsh-std/connection/README.zh.md +42 -0
  210. package/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
  211. package/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
  212. package/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
  213. package/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
  214. package/node_modules/@dsh-std/connection/lib/index.js +158 -0
  215. package/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
  216. package/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
  217. package/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
  218. package/node_modules/@dsh-std/connection/lib/memory.js +257 -0
  219. package/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
  220. package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
  221. package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
  222. package/node_modules/@dsh-std/connection/package.json +20 -0
  223. package/node_modules/@dsh-std/core/LICENSE +21 -0
  224. package/node_modules/@dsh-std/core/README.md +13 -0
  225. package/node_modules/@dsh-std/core/README.zh.md +13 -0
  226. package/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  227. package/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  228. package/node_modules/@dsh-std/core/lib/index.js +424 -0
  229. package/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  230. package/node_modules/@dsh-std/core/package.json +21 -0
  231. package/node_modules/@dsh-std/manifest/LICENSE +21 -0
  232. package/node_modules/@dsh-std/manifest/README.md +5 -0
  233. package/node_modules/@dsh-std/manifest/README.zh.md +5 -0
  234. package/node_modules/@dsh-std/manifest/lib/index.d.ts +182 -0
  235. package/node_modules/@dsh-std/manifest/lib/index.d.ts.map +1 -0
  236. package/node_modules/@dsh-std/manifest/lib/index.js +625 -0
  237. package/node_modules/@dsh-std/manifest/lib/index.js.map +1 -0
  238. package/node_modules/@dsh-std/manifest/package.json +20 -0
  239. package/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -0
  240. package/node_modules/@dsh-std/messages/LICENSE +21 -0
  241. package/node_modules/@dsh-std/messages/README.md +5 -0
  242. package/node_modules/@dsh-std/messages/README.zh.md +7 -0
  243. package/node_modules/@dsh-std/messages/lib/index.d.ts +50 -0
  244. package/node_modules/@dsh-std/messages/lib/index.d.ts.map +1 -0
  245. package/node_modules/@dsh-std/messages/lib/index.js +151 -0
  246. package/node_modules/@dsh-std/messages/lib/index.js.map +1 -0
  247. package/node_modules/@dsh-std/messages/package.json +20 -0
  248. package/node_modules/@dsh-std/messages/schema/message-observer-envelope-0.15.schema.json +54 -0
  249. package/node_modules/@dsh-std/presentation/LICENSE +21 -0
  250. package/node_modules/@dsh-std/presentation/README.md +26 -0
  251. package/node_modules/@dsh-std/presentation/README.zh.md +28 -0
  252. package/node_modules/@dsh-std/presentation/lib/index.d.ts +219 -0
  253. package/node_modules/@dsh-std/presentation/lib/index.d.ts.map +1 -0
  254. package/node_modules/@dsh-std/presentation/lib/index.js +547 -0
  255. package/node_modules/@dsh-std/presentation/lib/index.js.map +1 -0
  256. package/node_modules/@dsh-std/presentation/lib/interaction.d.ts +2 -0
  257. package/node_modules/@dsh-std/presentation/lib/interaction.js +2 -0
  258. package/node_modules/@dsh-std/presentation/lib/operations.d.ts +2 -0
  259. package/node_modules/@dsh-std/presentation/lib/operations.js +2 -0
  260. package/node_modules/@dsh-std/presentation/package.json +21 -0
  261. package/node_modules/@dsh-std/storage/LICENSE +21 -0
  262. package/node_modules/@dsh-std/storage/README.md +5 -0
  263. package/node_modules/@dsh-std/storage/README.zh.md +7 -0
  264. package/node_modules/@dsh-std/storage/lib/index.d.ts +48 -0
  265. package/node_modules/@dsh-std/storage/lib/index.d.ts.map +1 -0
  266. package/node_modules/@dsh-std/storage/lib/index.js +104 -0
  267. package/node_modules/@dsh-std/storage/lib/index.js.map +1 -0
  268. package/node_modules/@dsh-std/storage/package.json +20 -0
  269. package/node_modules/@dsh-std/storage/schema/local-storage-0.15.schema.json +56 -0
  270. package/package.json +118 -67
  271. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/LICENSE +21 -0
  272. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.md +42 -0
  273. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.zh.md +42 -0
  274. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
  275. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
  276. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
  277. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
  278. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js +158 -0
  279. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
  280. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
  281. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
  282. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js +257 -0
  283. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
  284. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
  285. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
  286. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/package.json +20 -0
  287. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/LICENSE +21 -0
  288. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.md +13 -0
  289. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.zh.md +13 -0
  290. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  291. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  292. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js +424 -0
  293. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  294. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/package.json +21 -0
  295. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/LICENSE +21 -0
  296. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.md +5 -0
  297. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.zh.md +5 -0
  298. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.d.ts +182 -0
  299. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.d.ts.map +1 -0
  300. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js +625 -0
  301. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js.map +1 -0
  302. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/package.json +20 -0
  303. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -0
  304. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/LICENSE +21 -0
  305. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.md +26 -0
  306. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.zh.md +28 -0
  307. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.d.ts +219 -0
  308. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.d.ts.map +1 -0
  309. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js +547 -0
  310. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js.map +1 -0
  311. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/interaction.d.ts +2 -0
  312. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/interaction.js +2 -0
  313. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/operations.d.ts +2 -0
  314. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/operations.js +2 -0
  315. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/package.json +21 -0
  316. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/LICENSE +21 -0
  317. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.md +13 -0
  318. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.zh.md +13 -0
  319. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  320. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  321. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js +424 -0
  322. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  323. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/package.json +21 -0
  324. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/LICENSE +21 -0
  325. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.md +13 -0
  326. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.zh.md +13 -0
  327. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  328. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  329. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js +424 -0
  330. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  331. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/package.json +21 -0
  332. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/LICENSE +21 -0
  333. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.md +13 -0
  334. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.zh.md +13 -0
  335. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  336. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  337. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js +424 -0
  338. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  339. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/package.json +21 -0
  340. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/LICENSE +21 -0
  341. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.md +42 -0
  342. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.zh.md +42 -0
  343. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
  344. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
  345. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
  346. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
  347. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js +158 -0
  348. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
  349. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
  350. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
  351. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js +257 -0
  352. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
  353. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
  354. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
  355. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/package.json +20 -0
  356. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/LICENSE +21 -0
  357. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.md +13 -0
  358. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.zh.md +13 -0
  359. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  360. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  361. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js +424 -0
  362. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  363. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/package.json +21 -0
  364. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/LICENSE +21 -0
  365. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.md +13 -0
  366. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.zh.md +13 -0
  367. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  368. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  369. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js +424 -0
  370. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  371. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/package.json +21 -0
@@ -0,0 +1,24 @@
1
+ /** Build the current dsh-TUI Host Descriptor from the pinned admission profile. */
2
+ import type { ContractCoordinate, HostDescriptor } from '../plugin-spec/types.js';
3
+ export declare const HOST_SUPPORTED_CONTRACTS: readonly ContractCoordinate[];
4
+ /** The facet version is part of the host identity, not a protocol definition.
5
+ * Keep a conservative fallback so a descriptor remains schema-valid when the
6
+ * optional vendored registry is unavailable; the contract list is still
7
+ * empty in that degraded state. */
8
+ export declare const HOST_FACET_API_VERSIONS: readonly string[];
9
+ export interface HostDescriptorOptions {
10
+ hostId?: string;
11
+ hostVersion?: string;
12
+ generationId: string;
13
+ headless?: boolean;
14
+ supported?: readonly ContractCoordinate[];
15
+ specDir?: string;
16
+ }
17
+ export interface HostDescriptorBuild {
18
+ descriptor: HostDescriptor;
19
+ dropped: string[];
20
+ warnings: string[];
21
+ }
22
+ export declare function readOwnPackageVersion(): string;
23
+ export declare function buildHostDescriptor(options: HostDescriptorOptions): HostDescriptorBuild;
24
+ //# sourceMappingURL=host-descriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-descriptor.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/host-descriptor.ts"],"names":[],"mappings":"AAAA,mFAAmF;AAKnF,OAAO,KAAK,EAAE,kBAAkB,EAAgB,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAM/F,eAAO,MAAM,wBAAwB,EAAE,SAAS,kBAAkB,EAKhE,CAAA;AAEF;;;mCAGmC;AACnC,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAAgC,CAAA;AAErF,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAA;IACzC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,cAAc,CAAA;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAyB9C;AASD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,GAAG,mBAAmB,CAwFvF"}
@@ -0,0 +1,146 @@
1
+ /** Build the current dsh-TUI Host Descriptor from the pinned admission profile. */
2
+ import { readFileSync } from 'node:fs';
3
+ import { dirname, join } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { digestFile, loadSpecData } from '../plugin-spec/registry.js';
6
+ import { TUI_DECISION_EVENT_NAMES } from '../plugin-spec/tui-extension.js';
7
+ import { createContractIndex, validateHost } from '../plugin-spec/validate.js';
8
+ import { check } from '../plugin-spec/schema-check.js';
9
+ export const HOST_SUPPORTED_CONTRACTS = Object.freeze([
10
+ { apiVersion: 'commands.dsh/v1alpha1', kind: 'Command' },
11
+ { apiVersion: 'storage.dsh/v1alpha1', kind: 'LocalStorage' },
12
+ { apiVersion: 'messages.dsh/v1alpha1', kind: 'MessageObserver' },
13
+ { apiVersion: 'tui.dsh/v1alpha1', kind: 'DecisionEvents' },
14
+ ]);
15
+ /** The facet version is part of the host identity, not a protocol definition.
16
+ * Keep a conservative fallback so a descriptor remains schema-valid when the
17
+ * optional vendored registry is unavailable; the contract list is still
18
+ * empty in that degraded state. */
19
+ export const HOST_FACET_API_VERSIONS = Object.freeze(['v1alpha1']);
20
+ export function readOwnPackageVersion() {
21
+ const candidates = [];
22
+ try {
23
+ candidates.push(fileURLToPath(import.meta.resolve('@deepseek-harness-tui/dsh-tui/package.json')));
24
+ }
25
+ catch {
26
+ // Fall through to the source/package walk-up path.
27
+ }
28
+ let dir = dirname(fileURLToPath(import.meta.url));
29
+ for (let index = 0; index < 8; index++) {
30
+ candidates.push(join(dir, 'package.json'));
31
+ const parent = dirname(dir);
32
+ if (parent === dir)
33
+ break;
34
+ dir = parent;
35
+ }
36
+ for (const candidate of candidates) {
37
+ try {
38
+ const manifest = JSON.parse(readFileSync(candidate, 'utf8'));
39
+ if (manifest.name === '@deepseek-harness-tui/dsh-tui'
40
+ && typeof manifest.version === 'string'
41
+ && manifest.version !== '')
42
+ return manifest.version;
43
+ }
44
+ catch {
45
+ // Keep looking.
46
+ }
47
+ }
48
+ return '0.0.0';
49
+ }
50
+ function supportSpec(coordinate) {
51
+ if (coordinate.apiVersion === 'tui.dsh/v1alpha1' && coordinate.kind === 'DecisionEvents') {
52
+ return { features: [...TUI_DECISION_EVENT_NAMES] };
53
+ }
54
+ return undefined;
55
+ }
56
+ export function buildHostDescriptor(options) {
57
+ const warnings = [];
58
+ const dropped = [];
59
+ const contracts = [];
60
+ const data = loadSpecData(options.specDir);
61
+ const advertisedFacets = data?.registry.facetApiVersions
62
+ ?.filter(version => /^v[0-9]+(?:alpha[0-9]+|beta[0-9]+)$/u.test(version));
63
+ const facetApiVersions = advertisedFacets !== undefined && advertisedFacets.length > 0
64
+ ? advertisedFacets
65
+ : [...HOST_FACET_API_VERSIONS];
66
+ if (data === undefined) {
67
+ warnings.push('admission profile unavailable (ecosystem-spec/); advertising an empty protocol surface');
68
+ }
69
+ else {
70
+ const index = createContractIndex(data.registry, data.permissions);
71
+ for (const coordinate of options.supported ?? HOST_SUPPORTED_CONTRACTS) {
72
+ const key = `${coordinate.apiVersion}#${coordinate.kind}`;
73
+ const entry = index.lookupContract(coordinate);
74
+ const definition = index.protocols.resolve(coordinate);
75
+ if (entry === undefined || definition === undefined) {
76
+ dropped.push(key);
77
+ warnings.push(`${key}: live implementation has no pinned ProtocolCatalog definition`);
78
+ continue;
79
+ }
80
+ if ('profile' in entry) {
81
+ let actual;
82
+ try {
83
+ actual = digestFile(data.dir, entry.profile);
84
+ }
85
+ catch {
86
+ dropped.push(key);
87
+ warnings.push(`${key}: TUI profile is unreadable (${entry.profile})`);
88
+ continue;
89
+ }
90
+ if (actual !== entry.profileHash) {
91
+ dropped.push(key);
92
+ warnings.push(`${key}: TUI profile hash drifted (expected ${entry.profileHash}, actual ${actual})`);
93
+ continue;
94
+ }
95
+ }
96
+ const spec = supportSpec(coordinate);
97
+ try {
98
+ definition.validateSupport(spec);
99
+ }
100
+ catch (error) {
101
+ dropped.push(key);
102
+ warnings.push(`${key}: support spec rejected by its definition (${error instanceof Error ? error.message : String(error)})`);
103
+ continue;
104
+ }
105
+ contracts.push({
106
+ ...coordinate,
107
+ ...(spec === undefined ? {} : { spec }),
108
+ definition: 'package' in entry
109
+ ? { source: 'dsh-std', package: entry.package }
110
+ : { source: 'tui-profile', profileHash: entry.profileHash },
111
+ permissions: [...entry.permissions],
112
+ });
113
+ }
114
+ }
115
+ const descriptor = {
116
+ $schema: 'urn:dsh-tui:host-descriptor:0.15',
117
+ hostId: options.hostId ?? 'dsh-tui',
118
+ hostVersion: options.hostVersion ?? readOwnPackageVersion(),
119
+ facetApiVersions: [...facetApiVersions],
120
+ contracts,
121
+ runtime: {
122
+ location: 'local',
123
+ generationId: options.generationId,
124
+ headless: options.headless ?? false,
125
+ },
126
+ trustLevel: 'trusted-in-process',
127
+ platform: { os: process.platform, arch: process.arch, node: process.version },
128
+ };
129
+ if (data !== undefined) {
130
+ try {
131
+ validateHost(createContractIndex(data.registry, data.permissions), descriptor);
132
+ }
133
+ catch (error) {
134
+ warnings.push(`constructed descriptor failed semantic validation: ${error instanceof Error ? error.message : String(error)}`);
135
+ descriptor.contracts.length = 0;
136
+ }
137
+ try {
138
+ check(descriptor, data.schemas.host, data.schemas.host);
139
+ }
140
+ catch (error) {
141
+ warnings.push(`constructed descriptor failed schema validation: ${error instanceof Error ? error.message : String(error)}`);
142
+ descriptor.contracts.length = 0;
143
+ }
144
+ }
145
+ return { descriptor, dropped, warnings };
146
+ }
@@ -62,6 +62,10 @@ export interface Config {
62
62
  * persisted in `~/.dsh-tui/agent-preset.json` wins, then the roster
63
63
  * default (`standard`). */
64
64
  preset?: string;
65
+ /** Edit/Write diff presentation: `auto` picks side-by-side on wide
66
+ * terminals (≥110 cols) and unified below; `split`/`unified` force one
67
+ * layout. Editable live from the `/settings` screen. */
68
+ diffLayout?: 'auto' | 'split' | 'unified';
65
69
  /** Shift+Tab session-mode cycle (array order IS the cycle order; index 0
66
70
  * is the unmarked base mode). Each entry bundles any subset of the
67
71
  * `plan`/`sandbox`/`approval` atoms; absent → the built-in
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,MAAM,MAAM,0BAA0B,CAAA;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEzD,eAAO,MAAM,IAAI,YAAY,CAAA;AAU7B,eAAO,MAAM,MAAM,UAAa,CAAA;AAEhC;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;yEAKqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;gDAC4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;gFAE4E;IAC5E,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;oCACgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;sBAIkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;4BAGwB;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;wDAEoD;IACpD,UAAU,CAAC,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U,CAAC,EAAE,OAAO,CAAA;IACpB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;kFAC8E;IAC9E,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;gCAG4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;6DAEyD;IACzD,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;IACzC;;;yDAGqD;IACrD,KAAK,CAAC,EAAE,eAAe,EAAE,CAAA;CAC1B;AAED,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,CA2BhC,CAAA;AAEF;;;;;;GAMG;AACH,wBAAsB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAWvE"}
@@ -27,6 +27,7 @@ export const Config = Schema.object({
27
27
  fullscreen: Schema.boolean().default(false),
28
28
  lang: Schema.string().required(false),
29
29
  preset: Schema.string().required(false),
30
+ diffLayout: Schema.union(['auto', 'split', 'unified']).default('auto'),
30
31
  modes: Schema.array(Schema.object({
31
32
  id: Schema.string(),
32
33
  label: Schema.string().required(false),
@@ -0,0 +1,178 @@
1
+ /**
2
+ * messages.observe contract surface (C-042,
3
+ * `messages.dsh/v1alpha1#MessageObserver`): the host event broker, mounted
4
+ * by the dsh-tui-plugin-host row as `ctx.tuiMessageObserver`.
5
+ *
6
+ * Mapping (deliberately narrow):
7
+ *
8
+ * - `user/message` → `message.received` (the user's prompt)
9
+ * - `assistant/message` → `message.sent` (the assembled step reply)
10
+ * - EVERYTHING ELSE (assistant/chunk streaming, tool/*, turn/*, mode
11
+ * events, …) produces NO envelope — observation starts conservative.
12
+ *
13
+ * Envelope rules (the pinned `@dsh-std/messages` v0.15 definition):
14
+ *
15
+ * - `scope` = `session:<sessionId>`; `sequence` = the session event's own
16
+ * `seq` (monotonic within scope, gaps allowed — unmapped events simply
17
+ * leave holes); `eventId` = `<sessionId>:<seq>` with schema-unsafe
18
+ * characters flattened to `_`.
19
+ * - privacyClass is ALWAYS `sensitive` for now (conservative and
20
+ * irreversible-safe; finer classification is a future, documented step).
21
+ * - Content carries the text/image subset (MCP ContentBlock): text runs
22
+ * join (a pure-text message keeps the single trimmed block); session
23
+ * image blocks are `{type:'image', attachment}` REFERENCES resolved via
24
+ * the attachments service into base64 `data` with a 192 KiB budget —
25
+ * an unreadable/oversize image is dropped and marks `truncated`.
26
+ * `summary` is the sanitized first 200 cells of the joined text;
27
+ * `truncated` marks summary, content, or image-drop truncation.
28
+ * - EVERY produced envelope passes the official pinned validator before delivery;
29
+ * a malformed envelope is dropped with a warning, never delivered.
30
+ *
31
+ * Scope isolation (C-042): `subscribe` requires an exact `scope` string
32
+ * and an envelope is delivered ONLY to subscriptions of the same scope —
33
+ * a plugin moving between sessions subscribes per scope and never
34
+ * receives another session's sensitive content.
35
+ *
36
+ * Grant gating (`messages.observe.read`, default deny):
37
+ *
38
+ * - SUBSCRIBE time: a denied plugin gets a no-op disposer + a warning
39
+ * naming plugin and grant (fast fail, as-if-unsubscribed).
40
+ * - DELIVER time: every publish re-checks each subscription; a revoked
41
+ * grant RELEASES the subscription (contract cleanup rule) with one
42
+ * warning.
43
+ *
44
+ * Delivery semantics: at-most-once, no replay; envelope builds serialize
45
+ * broker-wide (image reads are async — delivery order stays the publish
46
+ * order, so sequence stays monotonic); callbacks of ONE subscription run
47
+ * serially (per-subscription promise chain); a throwing listener is
48
+ * isolated (warn, name the plugin, keep delivering to the rest). The host
49
+ * MUST NOT persist payload through this contract — the broker keeps no
50
+ * history.
51
+ *
52
+ * privacyClass: sensitive — envelope content is never logged.
53
+ */
54
+ import { Context, Service } from '@deepseek-ai/cordis';
55
+ import { type GrantStore } from './grants.js';
56
+ import type { TuiEffectLedgerRuntime } from './effect-ledger.js';
57
+ /** Envelope content block (MCP ContentBlock text/image subset). */
58
+ export type MessagesObserveContentBlock = {
59
+ type: 'text';
60
+ text: string;
61
+ } | {
62
+ type: 'image';
63
+ data: string;
64
+ mimeType: string;
65
+ };
66
+ export interface MessagesObservePayload {
67
+ kind: 'message.created' | 'message.received' | 'message.sent';
68
+ messageId?: string;
69
+ author?: string;
70
+ content: MessagesObserveContentBlock[];
71
+ truncated?: boolean;
72
+ }
73
+ /** The vendored `messages-observe-envelope-0.15.json` shape. */
74
+ export interface MessagesObserveEnvelope {
75
+ eventType: 'messages.observe';
76
+ eventVersion: '0.15';
77
+ eventId: string;
78
+ scope: string;
79
+ sequence: number;
80
+ privacyClass: 'public' | 'internal' | 'sensitive';
81
+ summary: string;
82
+ payload: MessagesObservePayload;
83
+ }
84
+ export type MessagesObserveListener = (envelope: MessagesObserveEnvelope) => void | Promise<void>;
85
+ /** Summary bound (cells; schema maxLength 1024 chars — 200 cells ≤ 1024). */
86
+ export declare const OBSERVE_SUMMARY_CELLS = 200;
87
+ /** Content text bound (chars; schema maxLength 262144). */
88
+ export declare const OBSERVE_CONTENT_MAX_CHARS = 262144;
89
+ /** Scope bound (schema maxLength 256). */
90
+ export declare const OBSERVE_SCOPE_MAX_CHARS = 256;
91
+ /** messageId bound (schema maxLength 256). */
92
+ export declare const OBSERVE_ID_MAX_CHARS = 256;
93
+ /** Raw image byte budget per block (192 KiB → ≤262144 base64 chars). */
94
+ export declare const OBSERVE_IMAGE_MAX_BYTES: number;
95
+ /** Base64 length bound implied by OBSERVE_IMAGE_MAX_BYTES. */
96
+ export declare const OBSERVE_IMAGE_BASE64_MAX_CHARS = 262144;
97
+ /** Per-callback budget; timeout closes the subscription deterministically. */
98
+ export declare const OBSERVE_CALLBACK_TIMEOUT_MS = 1500;
99
+ /** Bound queued callbacks per subscription so a stalled listener cannot grow
100
+ * an unbounded Promise chain before its timeout closes the subscription. */
101
+ export declare const OBSERVE_CALLBACK_QUEUE_LIMIT = 32;
102
+ declare module '@deepseek-ai/cordis' {
103
+ interface Context {
104
+ tuiMessageObserver: TuiMessageObserverRuntime;
105
+ }
106
+ }
107
+ /**
108
+ * `ctx.tuiMessageObserver` — the messages.observe broker. The channel
109
+ * publishes mapped session events; plugins subscribe with their own
110
+ * context. When the vendored envelope schema is unavailable (packaging
111
+ * accident) the broker fails CLOSED: subscriptions are accepted but nothing
112
+ * is ever delivered (a host that cannot self-check must not emit).
113
+ */
114
+ export declare class TuiMessageObserverRuntime extends Service {
115
+ private readonly grantsOption;
116
+ private readonly fallbackGrants;
117
+ private readonly ledgerOption;
118
+ private readonly subscriptions;
119
+ private readonly validateEnvelope;
120
+ private readonly validatorUnavailable;
121
+ private validatorWarned;
122
+ private buildChain;
123
+ constructor(ctx: Context, options?: {
124
+ grants?: GrantStore;
125
+ ledger?: TuiEffectLedgerRuntime;
126
+ validateEnvelope?: (value: unknown) => void;
127
+ /** @deprecated compatibility alias; prefer validateEnvelope. */
128
+ envelopeSchema?: Record<string, unknown>;
129
+ });
130
+ /** Grants: the plugin-host row's store when mounted, else a private read.
131
+ * Resolved PER CALL — sibling services mounted later by the same apply()
132
+ * are not visible to constructors (cordis), so a constructor-time probe
133
+ * would silently stick to the fallback. */
134
+ private grants;
135
+ /** Optional observability; a bare mount (tests) simply records nothing. */
136
+ private ledger;
137
+ /**
138
+ * Subscribe to observation envelopes for ONE scope. Identity = the verified
139
+ * Component bound to the PASSED activation (the same identity rule as
140
+ * storage); the scope
141
+ * is required and matched exactly — a plugin moving between sessions
142
+ * subscribes per scope and never receives another scope's sensitive
143
+ * content (C-042 isolation). A denied subscription fast-fails: no-op
144
+ * disposer + warning. The subscription releases when the caller's context
145
+ * unloads.
146
+ */
147
+ subscribe(pluginCtx: Context, listener: MessagesObserveListener, options: {
148
+ scope: string;
149
+ }): () => void;
150
+ /**
151
+ * Publish a session event (channel `session/event` arm). Non-mapped
152
+ * event types return immediately; everything else never throws into the
153
+ * caller — problems are warned, not raised.
154
+ */
155
+ publish(session: unknown, event: unknown): void;
156
+ private publishGuarded;
157
+ private buildAndDeliver;
158
+ /** Release a subscription exactly once (disposer, ctx unload, revoke). */
159
+ private drop;
160
+ /** Join the text blocks of a session message's content (text-only view). */
161
+ private textOf;
162
+ /**
163
+ * Map session content blocks to envelope blocks in order (text/image
164
+ * subset). Consecutive text runs join into one block (capped at
165
+ * OBSERVE_CONTENT_MAX_CHARS, pure-text messages keep the exact legacy
166
+ * shape: a single trimmed block); image blocks resolve through the
167
+ * attachments service (soft-probe) with a byte budget. A failed or
168
+ * oversize image becomes NO block plus the truncation mark; zero
169
+ * surviving blocks collapse to a single empty text block (schema
170
+ * minItems 1).
171
+ */
172
+ private contentOf;
173
+ /** Resolve a session image block (`{type:'image', attachment}` — a
174
+ * REFERENCE, never inline data) to an envelope image block; undefined =
175
+ * drop (unreadable, oversize, bad media type, no attachment store). */
176
+ private imageBlockOf;
177
+ }
178
+ //# sourceMappingURL=message-observer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-observer.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/message-observer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAItD,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAahE,mEAAmE;AACnE,MAAM,MAAM,2BAA2B,GACnC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAA;AAErD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB,GAAG,cAAc,CAAA;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO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