@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,270 @@
1
+ /**
2
+ * The dsh-tui-plugin-host row: the plugin-interop anchor every later
3
+ * contract surface hangs off (storage.local, messages.observe, effect
4
+ * ledger — each lands as a sibling service mounted by THIS row's apply, so
5
+ * the patch surface changed exactly once for the whole v0.15 alignment).
6
+ *
7
+ * What it provides on `ctx.tuiPluginHost`:
8
+ *
9
+ * - `generationId` — the runtime generation id (C-050), a fresh UUID per
10
+ * row activation; ledger records and the Host Descriptor stamp it so
11
+ * effects from different process generations can never be confused.
12
+ * - `grants` — the unified 8-permission live GrantStore (./grants.js).
13
+ * - `hostDescriptor()` — the C-010 Host Descriptor (./host-descriptor.js),
14
+ * built lazily and cached; drifted contracts are dropped fail-closed.
15
+ * - `selfCheck()` — vendored registry + contract-profile violations
16
+ * (definition/profile drift, ten-point incompleteness, parity mismatches).
17
+ * - `registerCommand(pluginCtx, definition)` — the MEDIATED command
18
+ * registration surface (C-041 attribution): stamps each command with the
19
+ * verified Component identity so the invoke checkpoint can enforce per-owner
20
+ * denies (./command-attribution.js). Direct `ctx.get('commands')`
21
+ * registrations stay unattributed — the documented C-070 boundary.
22
+ *
23
+ * Discipline notes:
24
+ *
25
+ * - #183: consumers NEVER get this service via inject — always
26
+ * `ctx.get('tuiPluginHost', false)` soft probing, with the skew warning in
27
+ * plugin.ts covering profile launches on a stale patch.
28
+ * - The D-7 decision gate does NOT depend on this row: the extensions row
29
+ * and the channel each install it with their own GrantStore read, so a
30
+ * missing plugin-host row never relaxes interception gating.
31
+ * - Boot-time self-check failures are logged once here (fail closed happens
32
+ * per-contract at descriptor build time; boot must not die on drifted
33
+ * vendored data).
34
+ */
35
+ import { Service } from '@deepseek-ai/cordis';
36
+ import { randomUUID } from 'node:crypto';
37
+ import { parseManifest, projectManifest } from '@dsh-std/manifest';
38
+ import { loadSpecData, verifyContractProfiles, verifyRegistry } from '../plugin-spec/registry.js';
39
+ import { createContractIndex, validatePlugin } from '../plugin-spec/validate.js';
40
+ import { negotiate } from '../plugin-spec/negotiate.js';
41
+ import { readGrantStore } from './grants.js';
42
+ import { buildHostDescriptor, HOST_SUPPORTED_CONTRACTS } from './host-descriptor.js';
43
+ import { TuiEffectLedgerRuntime } from './effect-ledger.js';
44
+ import { TuiPluginStorageRuntime } from './plugin-storage.js';
45
+ import { TuiMessageObserverRuntime } from './message-observer.js';
46
+ import { stampCommandOwner, unstampCommandOwner } from './command-attribution.js';
47
+ import { hasCommandErrorCode, mapCommandError } from './command-errors.js';
48
+ import { installDecisionGuard, decisionHandlerMetadataOf, registerDecisionHandler, withDecisionRegistration, } from './decision-guard.js';
49
+ import { bindComponentIdentity, declaresCommand, requiresDecisionEvents, requireComponentIdentity, } from './component-identity.js';
50
+ /** `ctx.tuiPluginHost` — plugin-interop anchor (generation, grants, descriptor). */
51
+ export class TuiPluginHostRuntime extends Service {
52
+ /** Runtime generation id (C-050): fresh per activation of this row. */
53
+ generationId = randomUUID();
54
+ /** Live scoped grant store; every operation observes the current file. */
55
+ grants;
56
+ descriptorBuild;
57
+ descriptorCommandsMounted;
58
+ constructor(ctx) {
59
+ super(ctx, 'tuiPluginHost');
60
+ this.grants = readGrantStore();
61
+ // The host row may be mounted without the extensions row or a channel;
62
+ // decision registration must remain mediated in that degraded topology.
63
+ installDecisionGuard(ctx, this.grants);
64
+ const violations = this.selfCheck();
65
+ if (violations.length > 0) {
66
+ ctx.logger.warn(`dsh-tui: vendored plugin-spec registry failed self-check (${violations.length} violation(s)); ` +
67
+ `affected contracts are dropped from the Host Descriptor fail-closed: ${violations.join(' | ')}`);
68
+ }
69
+ }
70
+ /**
71
+ * The C-010 Host Descriptor, built lazily and cached while the
72
+ * runtime-dependent commands capability remains unchanged.
73
+ */
74
+ hostDescriptor() {
75
+ return this.build().descriptor;
76
+ }
77
+ /** The full build result (descriptor + dropped coordinates + warnings). */
78
+ describe() {
79
+ return this.build();
80
+ }
81
+ build() {
82
+ // C-010 honesty: advertise Command only when the commands service is
83
+ // actually mounted — a bare/embedded context without dsh-commands must
84
+ // not negotiate `compatible` for a capability plugins will never get.
85
+ // Probed on every descriptor request: the service can mount or unmount
86
+ // after the first lazy build.
87
+ const commandsMounted = this.ctx.get('commands') !== undefined;
88
+ if (this.descriptorBuild === undefined || this.descriptorCommandsMounted !== commandsMounted) {
89
+ const supported = HOST_SUPPORTED_CONTRACTS.filter(contract => contract.kind !== 'Command' || commandsMounted);
90
+ this.descriptorBuild = buildHostDescriptor({ generationId: this.generationId, supported });
91
+ this.descriptorCommandsMounted = commandsMounted;
92
+ if (!commandsMounted) {
93
+ this.ctx.logger.warn('dsh-tui: host descriptor: commands.dsh/v1alpha1#Command excluded — the commands service is not mounted on this context');
94
+ }
95
+ for (const warning of this.descriptorBuild.warnings) {
96
+ this.ctx.logger.warn(`dsh-tui: host descriptor: ${warning}`);
97
+ }
98
+ }
99
+ return this.descriptorBuild;
100
+ }
101
+ /**
102
+ * Parse, project, validate, negotiate, and bind one activation's Component
103
+ * identity before any mediated runtime capability can be used.
104
+ */
105
+ admit(pluginCtx, source, options = {}) {
106
+ const manifest = parseManifest(source, { source: options.source });
107
+ // The host owns the activation instance identity. Embedders may provide a
108
+ // pre-issued id when policy has an activation-scoped grant; otherwise a
109
+ // fresh opaque id is generated once and bound to this Cordis activation.
110
+ const activationId = options.activationId ?? randomUUID();
111
+ const data = loadSpecData();
112
+ if (data === undefined)
113
+ throw new Error('dsh-tui: admission profile is unavailable');
114
+ const index = createContractIndex(data.registry, data.permissions);
115
+ validatePlugin(index, manifest);
116
+ const projection = projectManifest(manifest);
117
+ const grants = manifest.permissions
118
+ .map(request => ({
119
+ name: request.name,
120
+ scope: request.scope,
121
+ granted: this.grants.allows({ componentId: manifest.id, activationId }, request.name, request.scope),
122
+ }));
123
+ const decision = negotiate(index, manifest, this.hostDescriptor(), grants);
124
+ if (decision.decision !== 'compatible' && decision.decision !== 'compatible_degraded') {
125
+ throw new Error(`dsh-tui: Component ${manifest.id} admission ${decision.decision}: ${'reasonCode' in decision ? decision.reasonCode : 'incompatible'}`);
126
+ }
127
+ return bindComponentIdentity(pluginCtx, manifest, projection, activationId);
128
+ }
129
+ /**
130
+ * Host-mediated DecisionEvents activation surface. A plugin cannot use a
131
+ * raw `ctx.on` for these points: the verified Component identity, static
132
+ * requirement, scope and current grant are all checked before insertion in
133
+ * the registry. The returned disposer is idempotent and is also owned by
134
+ * the activation so deactivation cannot leave an effect behind.
135
+ */
136
+ subscribeDecision(pluginCtx, event, listener, options = {}) {
137
+ const identity = requireComponentIdentity(pluginCtx);
138
+ if (!requiresDecisionEvents(identity)) {
139
+ throw new Error(`dsh-tui: Component "${identity.componentId}" must require tui.dsh/v1alpha1#DecisionEvents before subscribing`);
140
+ }
141
+ const previousMetadata = decisionHandlerMetadataOf(listener);
142
+ const release = withDecisionRegistration(pluginCtx, () => registerDecisionHandler(pluginCtx, identity, event, listener, options, () => {
143
+ this.ctx.get('tuiEffectLedger')?.record({ operation: 'release', resource: { kind: 'decision-handler', id: `${identity.componentId}:${event}` }, result: 'applied' }, pluginCtx);
144
+ }));
145
+ // A missing live grant is represented by a no-op disposer rather than an
146
+ // exception. Do not write a successful bind record for that path; the
147
+ // ledger must describe effects that actually entered the registry.
148
+ const metadata = decisionHandlerMetadataOf(listener);
149
+ const registered = metadata !== previousMetadata
150
+ && metadata?.componentId === identity.componentId
151
+ && metadata.activationId === identity.activationId
152
+ && metadata.event === event;
153
+ if (!registered) {
154
+ this.ctx.get('tuiEffectLedger')?.record({
155
+ operation: 'bind',
156
+ resource: { kind: 'permission', id: `${event}` },
157
+ result: 'failed',
158
+ errorCode: 'PERMISSION_NOT_GRANTED',
159
+ }, pluginCtx);
160
+ return () => false;
161
+ }
162
+ this.ctx.get('tuiEffectLedger')?.record({ operation: 'bind', resource: { kind: 'decision-handler', id: `${identity.componentId}:${event}` }, result: 'applied' }, pluginCtx);
163
+ return release;
164
+ }
165
+ registerCommand(pluginCtx, contributionOrDefinition, explicitDefinition) {
166
+ // Resolve through the registrant context so dsh-commands attaches the
167
+ // registration to that agent's scoped layer rather than the host-global
168
+ // layer. Its traceable service proxy carries this context into register().
169
+ const commands = pluginCtx.get('commands');
170
+ if (commands === undefined) {
171
+ throw new Error('dsh-tui: registerCommand unavailable — the commands service is not mounted on this context');
172
+ }
173
+ const identity = requireComponentIdentity(pluginCtx);
174
+ const definition = typeof contributionOrDefinition === 'string' ? explicitDefinition : contributionOrDefinition;
175
+ if (definition === undefined)
176
+ throw new TypeError('dsh-tui: registerCommand requires a command definition');
177
+ const name = typeof definition.name === 'string' ? definition.name : 'unknown';
178
+ const inferred = identity.manifest.contributes.commands.filter(command => command.id === name || command.id.endsWith(`.${name}`));
179
+ const contributionId = typeof contributionOrDefinition === 'string'
180
+ ? contributionOrDefinition
181
+ : inferred.length === 1 ? inferred[0].id : '';
182
+ if (contributionId === '' || !declaresCommand(identity, contributionId)) {
183
+ throw new TypeError(`dsh-tui: command "${name}" is not bound to a declared contribution id`);
184
+ }
185
+ // dsh-commands normalizes into a fresh definition and intentionally drops
186
+ // unknown fields. A per-registration handler wrapper survives that copy,
187
+ // giving the invoke checkpoint a collision-free identity for the actual
188
+ // resolved definition (including agent-scoped shadows).
189
+ const handler = definition?.handler;
190
+ const attributedDefinition = typeof handler === 'function'
191
+ ? {
192
+ ...definition,
193
+ handler: function (invocation) {
194
+ return handler.call(this, invocation);
195
+ },
196
+ }
197
+ : definition;
198
+ let dispose;
199
+ try {
200
+ dispose = commands.register(attributedDefinition);
201
+ }
202
+ catch (error) {
203
+ const mapped = mapCommandError(error);
204
+ this.ctx.get('tuiEffectLedger')?.record({
205
+ operation: 'create',
206
+ resource: { kind: 'command', id: contributionId },
207
+ result: 'failed',
208
+ errorCode: hasCommandErrorCode(mapped, 'DUPLICATE_CONTRIBUTION_ID') ? 'DUPLICATE_CONTRIBUTION_ID' : 'COMMAND_FAILED',
209
+ }, pluginCtx);
210
+ throw mapped;
211
+ }
212
+ stampCommandOwner(this.ctx, attributedDefinition, identity, contributionId);
213
+ this.ctx.get('tuiEffectLedger')?.record({ operation: 'create', resource: { kind: 'command', id: contributionId }, result: 'applied' }, pluginCtx);
214
+ let released = false;
215
+ const release = () => {
216
+ if (released)
217
+ return;
218
+ released = true;
219
+ unstampCommandOwner(this.ctx, attributedDefinition, identity.activationId);
220
+ this.ctx.get('tuiEffectLedger')?.record({ operation: 'release', resource: { kind: 'command', id: contributionId }, result: 'applied' }, pluginCtx);
221
+ };
222
+ // commands.register() already belongs to pluginCtx and therefore removes
223
+ // the definition on fiber teardown. Keep the attribution in that same
224
+ // lifecycle even when the caller never invokes our returned wrapper.
225
+ try {
226
+ pluginCtx.effect(() => release);
227
+ }
228
+ catch {
229
+ // Degraded contexts retain the wrapper-only cleanup path below.
230
+ }
231
+ let disposed = false;
232
+ return () => {
233
+ if (disposed)
234
+ return;
235
+ disposed = true;
236
+ try {
237
+ dispose();
238
+ }
239
+ finally {
240
+ release();
241
+ }
242
+ };
243
+ }
244
+ /**
245
+ * Vendored registry + contract-profile self-check (C-020 definition/profile
246
+ * pins, C-040 ten-point completeness, coordinate/permission parity). Empty =
247
+ * clean; violations are strings, never thrown.
248
+ */
249
+ selfCheck() {
250
+ const data = loadSpecData();
251
+ if (data === undefined)
252
+ return ['vendored spec data unavailable (ecosystem-spec/)'];
253
+ return [...verifyRegistry(data), ...verifyContractProfiles(data)];
254
+ }
255
+ }
256
+ export const name = 'dsh-tui-plugin-host';
257
+ export function apply(ctx) {
258
+ // The plugin-host service first — the contract surfaces mounted below
259
+ // read its grant store (they fall back to a private read only when mounted
260
+ // standalone, e.g. in tests).
261
+ ctx.plugin(TuiPluginHostRuntime);
262
+ // Effect ledger (C-060): mounted before the surfaces below so they can
263
+ // soft-probe it at construction; generation comes from the host service.
264
+ ctx.plugin(TuiEffectLedgerRuntime);
265
+ // storage.local (C-040): per-plugin private persistence.
266
+ ctx.plugin(TuiPluginStorageRuntime);
267
+ // messages.observe (C-042): the grant-gated observation broker the
268
+ // channel publishes mapped session events into.
269
+ ctx.plugin(TuiMessageObserverRuntime);
270
+ }
@@ -0,0 +1,113 @@
1
+ /**
2
+ * storage.local contract surface (C-040, `storage.dsh/v1alpha1#LocalStorage`):
3
+ * per-plugin private persistence, mounted by the dsh-tui-plugin-host row as
4
+ * `ctx.tuiPluginStorage`.
5
+ *
6
+ * The plugin-facing API is `open(ctx)` → `{ get, set, delete }`:
7
+ *
8
+ * - VERIFIED IDENTITY: the namespace is derived from the admitted Component
9
+ * identity bound to the PASSED activation — there is no parameter to name
10
+ * another plugin, so cross-plugin access is rejected by construction.
11
+ * - GRANTS AT CALL TIME: `get` requires `storage.local.read`, `set`/`delete`
12
+ * require `storage.local.write` — checked per call against the live grant
13
+ * store (a revoked grant blocks the very next operation without restart).
14
+ * - Backend: `~/.dsh-tui/plugin-storage/<namespace>.json`, one flat JSON
15
+ * object per namespace. Writes go through dsh-atomic-write (`withFileLock`
16
+ * for the read-modify-write cycle + `writeFileAtomic` for the commit), and
17
+ * an in-process per-namespace promise chain serializes operations in
18
+ * invocation order (contract concurrency rule — the lock alone does not
19
+ * order contenders).
20
+ * - QUOTA (host-defined): 256 keys AND 256 KiB of serialized content per
21
+ * namespace; a `set` that would cross either fails with QUOTA_EXCEEDED and
22
+ * changes nothing.
23
+ * - Keys stay ordinary data even when they collide with Object.prototype
24
+ * names ("__proto__", "toString", "constructor"): namespace tables are
25
+ * null-prototype and membership is decided with Object.hasOwn. Values
26
+ * must be EXACT JSON values — inputs JSON.stringify would silently
27
+ * mutate (undefined, NaN/±Infinity, functions, class instances, sparse
28
+ * arrays, cycles) are rejected instead of round-tripping a lie.
29
+ * - A corrupt namespace file is NEVER overwritten silently: every operation
30
+ * fails with STORAGE_UNAVAILABLE and the bytes stay on disk for manual
31
+ * recovery. Closing a handle (plugin unload) retains data (contract
32
+ * cleanup rule); later calls on a closed handle fail STORAGE_UNAVAILABLE.
33
+ * - privacyClass: sensitive — keys AND values are never logged.
34
+ */
35
+ import { Context, Service } from '@deepseek-ai/cordis';
36
+ import { type GrantStore } from './grants.js';
37
+ import type { TuiEffectLedgerRuntime } from './effect-ledger.js';
38
+ /** Quota: max distinct keys per namespace. */
39
+ export declare const STORAGE_MAX_KEYS = 256;
40
+ /** Quota: max serialized file size per namespace (bytes). */
41
+ export declare const STORAGE_MAX_BYTES: number;
42
+ /** Max key length (characters). */
43
+ export declare const STORAGE_KEY_MAX_LENGTH = 128;
44
+ export type PluginStorageErrorCode = 'PERMISSION_NOT_GRANTED' | 'INVALID_KEY' | 'INVALID_VALUE' | 'QUOTA_EXCEEDED' | 'STORAGE_UNAVAILABLE';
45
+ /** Storage failure with the contract's error code on `.code`. */
46
+ export declare class PluginStorageError extends Error {
47
+ readonly code: PluginStorageErrorCode;
48
+ constructor(code: PluginStorageErrorCode, message: string);
49
+ }
50
+ /** The per-namespace handle returned by {@link TuiPluginStorageRuntime.open}. */
51
+ export interface TuiPluginStorage {
52
+ get(input: {
53
+ key: string;
54
+ }): Promise<{
55
+ value: unknown | null;
56
+ }>;
57
+ set(input: {
58
+ key: string;
59
+ value: unknown;
60
+ }): Promise<{
61
+ stored: true;
62
+ }>;
63
+ delete(input: {
64
+ key: string;
65
+ }): Promise<{
66
+ deleted: boolean;
67
+ }>;
68
+ }
69
+ declare module '@deepseek-ai/cordis' {
70
+ interface Context {
71
+ tuiPluginStorage: TuiPluginStorageRuntime;
72
+ }
73
+ }
74
+ /** Namespace directory under the data dir. */
75
+ export declare const PLUGIN_STORAGE_DIR = "plugin-storage";
76
+ /**
77
+ * Plugin name → safe, collision-free file name. encodeURIComponent keeps
78
+ * alphanumerics and `- _ . ! ~ * ' ( )`, so scoped names like `@foo/bar`
79
+ * encode reversibly; pathological results ('', '.', '..') map to '_'.
80
+ */
81
+ export declare function storageFileName(plugin: string): string;
82
+ /**
83
+ * `ctx.tuiPluginStorage` — storage.local contract surface. Mounted by the
84
+ * dsh-tui-plugin-host row; grants come from that row's store when present
85
+ * (normal path) or a private read otherwise (bare mounts in tests).
86
+ */
87
+ export declare class TuiPluginStorageRuntime extends Service {
88
+ private readonly grantsOption;
89
+ private readonly fallbackGrants;
90
+ private readonly ledgerOption;
91
+ private readonly namespaces;
92
+ private readonly dir;
93
+ constructor(ctx: Context, options?: {
94
+ dir?: string;
95
+ grants?: GrantStore;
96
+ ledger?: TuiEffectLedgerRuntime;
97
+ });
98
+ /** Grants: the plugin-host row's store when mounted, else a private read.
99
+ * Resolved PER CALL — sibling services mounted later by the same apply()
100
+ * are not visible to constructors (cordis), so a constructor-time probe
101
+ * would silently stick to the fallback. */
102
+ private grants;
103
+ /** Optional observability; a bare mount (tests) simply records nothing. */
104
+ private ledger;
105
+ /**
106
+ * Open the caller's private namespace. Identity = the PASSED context's
107
+ * verified Component identity (no way to name another plugin). The handle
108
+ * closes automatically when the caller's context unloads (idempotent
109
+ * disposer); data is retained (contract cleanup rule).
110
+ */
111
+ open(pluginCtx: Context): TuiPluginStorage;
112
+ }
113
+ //# sourceMappingURL=plugin-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-storage.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/plugin-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAKH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAWtD,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAEhE,8CAA8C;AAC9C,eAAO,MAAM,gBAAgB,MAAM,CAAA;AACnC,6DAA6D;AAC7D,eAAO,MAAM,iBAAiB,QAAa,CAAA;AAC3C,mCAAmC;AACnC,eAAO,MAAM,sBAAsB,MAAM,CAAA;AAEzC,MAAM,MAAM,sBAAsB,GAC9B,wBAAwB,GACxB,aAAa,GACb,eAAe,GACf,gBAAgB,GAChB,qBAAqB,CAAA;AAEzB,iEAAiE;AACjE,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAA;gBACzB,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,MAAM;CAK1D;AAED,iFAAiF;AACjF,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAA;KAAE,CAAC,CAAA;IAC/D,GAAG,CAAC,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,IAAI,CAAA;KAAE,CAAC,CAAA;IACtE,MAAM,CAAC,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;CAC9D;AAED,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,gBAAgB,EAAE,uBAAuB,CAAA;KAC1C;CACF;AAED,8CAA8C;AAC9C,eAAO,MAAM,kBAAkB,mBAAmB,CAAA;AAElD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAGtD;AAgID;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,OAAO;IAClD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAwB;IACrD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAY;IAC3C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAoC;IACjE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoC;IAC/D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;gBAEhB,GAAG,EAAE,OAAO,EAAE,OAAO,GAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,UAAU,CAAC;QAAC,MAAM,CAAC,EAAE,sBAAsB,CAAA;KAAO;IAQ9G;;;gDAG4C;IAC5C,OAAO,CAAC,MAAM;IAId,2EAA2E;IAC3E,OAAO,CAAC,MAAM;IAId;;;;;OAKG;IACH,IAAI,CAAC,SAAS,EAAE,OAAO,GAAG,gBAAgB;CA2K3C"}