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

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 (434) hide show
  1. package/README.md +32 -15
  2. package/cordis.patch.yml +21 -2
  3. package/cordis.yml +12 -1
  4. package/dsh-ecosystem-spec/protocols/profile-definitions.d.ts +13 -0
  5. package/dsh-ecosystem-spec/protocols/profile-definitions.js +59 -0
  6. package/dsh-ecosystem-spec/protocols/tui-channel-http.d.ts +15 -0
  7. package/dsh-ecosystem-spec/protocols/tui-channel-http.js +32 -0
  8. package/dsh-ecosystem-spec/protocols/tui-channel.d.ts +59 -0
  9. package/dsh-ecosystem-spec/protocols/tui-channel.js +166 -0
  10. package/dsh-ecosystem-spec/protocols/tui-contributions.d.ts +42 -0
  11. package/dsh-ecosystem-spec/protocols/tui-contributions.js +143 -0
  12. package/dsh-ecosystem-spec/registry/README.md +14 -0
  13. package/dsh-ecosystem-spec/registry/contracts/decision-events-v1alpha1.json +13 -0
  14. package/dsh-ecosystem-spec/registry/contracts/scene-v1alpha1.json +13 -0
  15. package/dsh-ecosystem-spec/registry/contracts/settings-section-v1alpha1.json +13 -0
  16. package/dsh-ecosystem-spec/registry/contracts/tui-channel-v1alpha1.json +30 -0
  17. package/dsh-ecosystem-spec/registry/contracts/workspace-provider-v1alpha1.json +6 -0
  18. package/dsh-ecosystem-spec/registry/host-descriptor.tui.example.json +56 -0
  19. package/dsh-ecosystem-spec/registry/permissions-0.1.json +13 -0
  20. package/dsh-ecosystem-spec/registry/registry-0.15.json +149 -0
  21. package/dsh-ecosystem-spec/schemas/conformance-claim.schema.json +15 -0
  22. package/dsh-ecosystem-spec/schemas/effect-ledger-record.schema.json +16 -0
  23. package/dsh-ecosystem-spec/schemas/host-descriptor.schema.json +26 -0
  24. package/lib/types/cc/figures.d.ts +4 -0
  25. package/lib/types/cc/figures.d.ts.map +1 -1
  26. package/lib/types/cc/figures.js +4 -0
  27. package/lib/types/command-trees.d.ts +2 -1
  28. package/lib/types/command-trees.d.ts.map +1 -1
  29. package/lib/types/command-trees.js +1 -1
  30. package/lib/types/commands.d.ts.map +1 -1
  31. package/lib/types/commands.js +2 -0
  32. package/lib/types/components/ExtensionDialog.d.ts +40 -0
  33. package/lib/types/components/ExtensionDialog.d.ts.map +1 -0
  34. package/lib/types/components/ExtensionDialog.js +210 -0
  35. package/lib/types/components/HelpMenu.js +1 -1
  36. package/lib/types/components/LoadedContextPanel.d.ts +5 -5
  37. package/lib/types/components/LoadedContextPanel.js +6 -6
  38. package/lib/types/components/LogoV2.d.ts.map +1 -1
  39. package/lib/types/components/LogoV2.js +16 -8
  40. package/lib/types/components/Markdown.d.ts +13 -1
  41. package/lib/types/components/Markdown.d.ts.map +1 -1
  42. package/lib/types/components/Markdown.js +15 -1
  43. package/lib/types/components/MessageList.d.ts +3 -1
  44. package/lib/types/components/MessageList.d.ts.map +1 -1
  45. package/lib/types/components/MessageList.js +111 -6
  46. package/lib/types/components/PromptInput.d.ts.map +1 -1
  47. package/lib/types/components/PromptInput.js +26 -12
  48. package/lib/types/components/RewindPicker.d.ts +13 -1
  49. package/lib/types/components/RewindPicker.d.ts.map +1 -1
  50. package/lib/types/components/RewindPicker.js +26 -2
  51. package/lib/types/components/StreamingMarkdown.d.ts +2 -8
  52. package/lib/types/components/StreamingMarkdown.d.ts.map +1 -1
  53. package/lib/types/components/StreamingMarkdown.js +51 -9
  54. package/lib/types/components/ToolUseLoader.d.ts +8 -3
  55. package/lib/types/components/ToolUseLoader.d.ts.map +1 -1
  56. package/lib/types/components/ToolUseLoader.js +43 -9
  57. package/lib/types/components/activityFrames.d.ts +1 -1
  58. package/lib/types/components/activityFrames.d.ts.map +1 -1
  59. package/lib/types/components/activityFrames.js +4 -1
  60. package/lib/types/components/messages/AssistantThinkingMessage.d.ts +5 -1
  61. package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -1
  62. package/lib/types/components/messages/AssistantThinkingMessage.js +26 -3
  63. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  64. package/lib/types/components/messages/AssistantToolUseMessage.js +13 -2
  65. package/lib/types/dsh-adapter/channel.d.ts +61 -11
  66. package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
  67. package/lib/types/dsh-adapter/channel.js +767 -120
  68. package/lib/types/dsh-adapter/childStderr.d.ts.map +1 -1
  69. package/lib/types/dsh-adapter/childStderr.js +10 -0
  70. package/lib/types/dsh-adapter/command-attribution.d.ts +51 -0
  71. package/lib/types/dsh-adapter/command-attribution.d.ts.map +1 -0
  72. package/lib/types/dsh-adapter/command-attribution.js +93 -0
  73. package/lib/types/dsh-adapter/command-errors.d.ts +42 -0
  74. package/lib/types/dsh-adapter/command-errors.d.ts.map +1 -0
  75. package/lib/types/dsh-adapter/command-errors.js +63 -0
  76. package/lib/types/dsh-adapter/command-trees.d.ts +7 -1
  77. package/lib/types/dsh-adapter/command-trees.d.ts.map +1 -1
  78. package/lib/types/dsh-adapter/command-trees.js +70 -20
  79. package/lib/types/dsh-adapter/component-identity.d.ts +33 -0
  80. package/lib/types/dsh-adapter/component-identity.d.ts.map +1 -0
  81. package/lib/types/dsh-adapter/component-identity.js +108 -0
  82. package/lib/types/dsh-adapter/contract.d.ts +1 -1
  83. package/lib/types/dsh-adapter/contract.js +2 -2
  84. package/lib/types/dsh-adapter/decision-guard.d.ts +84 -0
  85. package/lib/types/dsh-adapter/decision-guard.d.ts.map +1 -0
  86. package/lib/types/dsh-adapter/decision-guard.js +348 -0
  87. package/lib/types/dsh-adapter/dialogs.d.ts +145 -0
  88. package/lib/types/dsh-adapter/dialogs.d.ts.map +1 -0
  89. package/lib/types/dsh-adapter/dialogs.js +316 -0
  90. package/lib/types/dsh-adapter/effect-ledger.d.ts +91 -0
  91. package/lib/types/dsh-adapter/effect-ledger.d.ts.map +1 -0
  92. package/lib/types/dsh-adapter/effect-ledger.js +251 -0
  93. package/lib/types/dsh-adapter/extension-events.d.ts +193 -0
  94. package/lib/types/dsh-adapter/extension-events.d.ts.map +1 -0
  95. package/lib/types/dsh-adapter/extension-events.js +207 -0
  96. package/lib/types/dsh-adapter/extensions.d.ts +32 -0
  97. package/lib/types/dsh-adapter/extensions.d.ts.map +1 -0
  98. package/lib/types/dsh-adapter/extensions.js +42 -0
  99. package/lib/types/dsh-adapter/grants.d.ts +25 -0
  100. package/lib/types/dsh-adapter/grants.d.ts.map +1 -0
  101. package/lib/types/dsh-adapter/grants.js +213 -0
  102. package/lib/types/dsh-adapter/host-access.d.ts +37 -0
  103. package/lib/types/dsh-adapter/host-access.d.ts.map +1 -0
  104. package/lib/types/dsh-adapter/host-access.js +652 -0
  105. package/lib/types/dsh-adapter/host-descriptor.d.ts +24 -0
  106. package/lib/types/dsh-adapter/host-descriptor.d.ts.map +1 -0
  107. package/lib/types/dsh-adapter/host-descriptor.js +169 -0
  108. package/lib/types/dsh-adapter/index.d.ts +4 -0
  109. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  110. package/lib/types/dsh-adapter/index.js +1 -0
  111. package/lib/types/dsh-adapter/message-observer.d.ts +173 -0
  112. package/lib/types/dsh-adapter/message-observer.d.ts.map +1 -0
  113. package/lib/types/dsh-adapter/message-observer.js +553 -0
  114. package/lib/types/dsh-adapter/plugin-host.d.ts +136 -0
  115. package/lib/types/dsh-adapter/plugin-host.d.ts.map +1 -0
  116. package/lib/types/dsh-adapter/plugin-host.js +365 -0
  117. package/lib/types/dsh-adapter/plugin-storage.d.ts +108 -0
  118. package/lib/types/dsh-adapter/plugin-storage.d.ts.map +1 -0
  119. package/lib/types/dsh-adapter/plugin-storage.js +397 -0
  120. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  121. package/lib/types/dsh-adapter/plugin.js +124 -14
  122. package/lib/types/dsh-adapter/plugins-info.d.ts +43 -0
  123. package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -0
  124. package/lib/types/dsh-adapter/plugins-info.js +276 -0
  125. package/lib/types/dsh-adapter/promptDebug.d.ts +0 -6
  126. package/lib/types/dsh-adapter/promptDebug.d.ts.map +1 -1
  127. package/lib/types/dsh-adapter/promptDebug.js +13 -4
  128. package/lib/types/dsh-adapter/renderers.d.ts +57 -0
  129. package/lib/types/dsh-adapter/renderers.d.ts.map +1 -0
  130. package/lib/types/dsh-adapter/renderers.js +173 -0
  131. package/lib/types/dsh-adapter/sanitize.d.ts +36 -0
  132. package/lib/types/dsh-adapter/sanitize.d.ts.map +1 -0
  133. package/lib/types/dsh-adapter/sanitize.js +65 -0
  134. package/lib/types/dsh-adapter/scenes.d.ts +15 -5
  135. package/lib/types/dsh-adapter/scenes.d.ts.map +1 -1
  136. package/lib/types/dsh-adapter/scenes.js +149 -35
  137. package/lib/types/dsh-adapter/settings-sections.d.ts +7 -3
  138. package/lib/types/dsh-adapter/settings-sections.d.ts.map +1 -1
  139. package/lib/types/dsh-adapter/settings-sections.js +106 -26
  140. package/lib/types/dsh-adapter/shortcuts.d.ts +107 -0
  141. package/lib/types/dsh-adapter/shortcuts.d.ts.map +1 -0
  142. package/lib/types/dsh-adapter/shortcuts.js +340 -0
  143. package/lib/types/dsh-adapter/status.d.ts +74 -0
  144. package/lib/types/dsh-adapter/status.d.ts.map +1 -0
  145. package/lib/types/dsh-adapter/status.js +234 -0
  146. package/lib/types/dsh-adapter/workspaces.d.ts +16 -5
  147. package/lib/types/dsh-adapter/workspaces.d.ts.map +1 -1
  148. package/lib/types/dsh-adapter/workspaces.js +287 -170
  149. package/lib/types/extensions.d.ts +13 -0
  150. package/lib/types/extensions.d.ts.map +1 -0
  151. package/lib/types/extensions.js +21 -0
  152. package/lib/types/force-production-react.d.ts +1 -0
  153. package/lib/types/force-production-react.d.ts.map +1 -0
  154. package/lib/types/force-production-react.js +12 -0
  155. package/lib/types/i18n.d.ts +174 -20
  156. package/lib/types/i18n.d.ts.map +1 -1
  157. package/lib/types/i18n.js +56 -6
  158. package/lib/types/index.d.ts +1 -0
  159. package/lib/types/index.d.ts.map +1 -1
  160. package/lib/types/index.js +1 -0
  161. package/lib/types/ink/components/App.d.ts +2 -0
  162. package/lib/types/ink/components/App.d.ts.map +1 -1
  163. package/lib/types/ink/components/App.js +4 -0
  164. package/lib/types/ink/ink.d.ts +31 -3
  165. package/lib/types/ink/ink.d.ts.map +1 -1
  166. package/lib/types/ink/ink.js +90 -5
  167. package/lib/types/ink/log-update.d.ts.map +1 -1
  168. package/lib/types/ink/log-update.js +225 -56
  169. package/lib/types/ink/output.d.ts +35 -2
  170. package/lib/types/ink/output.d.ts.map +1 -1
  171. package/lib/types/ink/output.js +281 -14
  172. package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
  173. package/lib/types/ink/render-node-to-output.js +14 -6
  174. package/lib/types/ink/screen.d.ts +39 -0
  175. package/lib/types/ink/screen.d.ts.map +1 -1
  176. package/lib/types/ink/screen.js +117 -0
  177. package/lib/types/ink/terminal.d.ts.map +1 -1
  178. package/lib/types/ink/terminal.js +26 -6
  179. package/lib/types/ink/wrapAnsi.d.ts +1 -1
  180. package/lib/types/ink/wrapAnsi.d.ts.map +1 -1
  181. package/lib/types/ink/wrapAnsi.js +29 -2
  182. package/lib/types/plugin-host.d.ts +15 -0
  183. package/lib/types/plugin-host.d.ts.map +1 -0
  184. package/lib/types/plugin-host.js +17 -0
  185. package/lib/types/plugin-spec/negotiate.d.ts +11 -0
  186. package/lib/types/plugin-spec/negotiate.d.ts.map +1 -0
  187. package/lib/types/plugin-spec/negotiate.js +97 -0
  188. package/lib/types/plugin-spec/permission-scope.d.ts +32 -0
  189. package/lib/types/plugin-spec/permission-scope.d.ts.map +1 -0
  190. package/lib/types/plugin-spec/permission-scope.js +90 -0
  191. package/lib/types/plugin-spec/registry.d.ts +23 -0
  192. package/lib/types/plugin-spec/registry.d.ts.map +1 -0
  193. package/lib/types/plugin-spec/registry.js +252 -0
  194. package/lib/types/plugin-spec/schema-check.d.ts +17 -0
  195. package/lib/types/plugin-spec/schema-check.d.ts.map +1 -0
  196. package/lib/types/plugin-spec/schema-check.js +165 -0
  197. package/lib/types/plugin-spec/tui-extension.d.ts +16 -0
  198. package/lib/types/plugin-spec/tui-extension.d.ts.map +1 -0
  199. package/lib/types/plugin-spec/tui-extension.js +79 -0
  200. package/lib/types/plugin-spec/types.d.ts +114 -0
  201. package/lib/types/plugin-spec/types.d.ts.map +1 -0
  202. package/lib/types/plugin-spec/types.js +10 -0
  203. package/lib/types/plugin-spec/validate.d.ts +21 -0
  204. package/lib/types/plugin-spec/validate.d.ts.map +1 -0
  205. package/lib/types/plugin-spec/validate.js +138 -0
  206. package/lib/types/scenes.d.ts +2 -1
  207. package/lib/types/scenes.d.ts.map +1 -1
  208. package/lib/types/scenes.js +1 -1
  209. package/lib/types/screens/Chat.d.ts +14 -1
  210. package/lib/types/screens/Chat.d.ts.map +1 -1
  211. package/lib/types/screens/Chat.js +173 -49
  212. package/lib/types/screens/SessionBrowser.d.ts.map +1 -1
  213. package/lib/types/screens/SessionBrowser.js +10 -3
  214. package/lib/types/sessions/view.d.ts +3 -2
  215. package/lib/types/sessions/view.d.ts.map +1 -1
  216. package/lib/types/sessions/view.js +18 -0
  217. package/lib/types/settings-sections.d.ts +2 -1
  218. package/lib/types/settings-sections.d.ts.map +1 -1
  219. package/lib/types/settings-sections.js +1 -1
  220. package/lib/types/theme.d.ts +5 -0
  221. package/lib/types/theme.d.ts.map +1 -1
  222. package/lib/types/theme.js +15 -0
  223. package/lib/types/update.d.ts +20 -0
  224. package/lib/types/update.d.ts.map +1 -1
  225. package/lib/types/update.js +54 -7
  226. package/lib/types/utils/execFileNoThrow.d.ts.map +1 -1
  227. package/lib/types/utils/execFileNoThrow.js +3 -0
  228. package/lib/types/utils/loaded-context.d.ts +8 -3
  229. package/lib/types/utils/loaded-context.d.ts.map +1 -1
  230. package/lib/types/utils/loaded-context.js +39 -3
  231. package/lib/types/utils/modifiers.d.ts.map +1 -1
  232. package/lib/types/utils/modifiers.js +3 -2
  233. package/lib/types/working-activity.d.ts +12 -0
  234. package/lib/types/working-activity.d.ts.map +1 -1
  235. package/lib/types/working-activity.js +13 -0
  236. package/lib/types/workspaces.d.ts +2 -1
  237. package/lib/types/workspaces.d.ts.map +1 -1
  238. package/lib/types/workspaces.js +1 -1
  239. package/node_modules/@dsh-std/command/CHANGELOG.md +8 -0
  240. package/node_modules/@dsh-std/command/LICENSE +21 -0
  241. package/node_modules/@dsh-std/command/README.md +26 -0
  242. package/node_modules/@dsh-std/command/README.zh.md +28 -0
  243. package/node_modules/@dsh-std/command/lib/index.d.ts +144 -0
  244. package/node_modules/@dsh-std/command/lib/index.d.ts.map +1 -0
  245. package/node_modules/@dsh-std/command/lib/index.js +252 -0
  246. package/node_modules/@dsh-std/command/lib/index.js.map +1 -0
  247. package/node_modules/@dsh-std/command/package.json +22 -0
  248. package/node_modules/@dsh-std/connection/CHANGELOG.md +8 -0
  249. package/node_modules/@dsh-std/connection/LICENSE +21 -0
  250. package/node_modules/@dsh-std/connection/README.md +42 -0
  251. package/node_modules/@dsh-std/connection/README.zh.md +42 -0
  252. package/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
  253. package/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
  254. package/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
  255. package/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
  256. package/node_modules/@dsh-std/connection/lib/index.js +158 -0
  257. package/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
  258. package/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
  259. package/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
  260. package/node_modules/@dsh-std/connection/lib/memory.js +258 -0
  261. package/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
  262. package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
  263. package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
  264. package/node_modules/@dsh-std/connection/package.json +20 -0
  265. package/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
  266. package/node_modules/@dsh-std/core/LICENSE +21 -0
  267. package/node_modules/@dsh-std/core/README.md +13 -0
  268. package/node_modules/@dsh-std/core/README.zh.md +13 -0
  269. package/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  270. package/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  271. package/node_modules/@dsh-std/core/lib/index.js +424 -0
  272. package/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  273. package/node_modules/@dsh-std/core/package.json +21 -0
  274. package/node_modules/@dsh-std/manifest/CHANGELOG.md +9 -0
  275. package/node_modules/@dsh-std/manifest/LICENSE +21 -0
  276. package/node_modules/@dsh-std/manifest/README.md +5 -0
  277. package/node_modules/@dsh-std/manifest/README.zh.md +5 -0
  278. package/node_modules/@dsh-std/manifest/lib/index.d.ts +182 -0
  279. package/node_modules/@dsh-std/manifest/lib/index.d.ts.map +1 -0
  280. package/node_modules/@dsh-std/manifest/lib/index.js +625 -0
  281. package/node_modules/@dsh-std/manifest/lib/index.js.map +1 -0
  282. package/node_modules/@dsh-std/manifest/package.json +20 -0
  283. package/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -0
  284. package/node_modules/@dsh-std/messages/CHANGELOG.md +8 -0
  285. package/node_modules/@dsh-std/messages/LICENSE +21 -0
  286. package/node_modules/@dsh-std/messages/README.md +5 -0
  287. package/node_modules/@dsh-std/messages/README.zh.md +7 -0
  288. package/node_modules/@dsh-std/messages/lib/index.d.ts +50 -0
  289. package/node_modules/@dsh-std/messages/lib/index.d.ts.map +1 -0
  290. package/node_modules/@dsh-std/messages/lib/index.js +151 -0
  291. package/node_modules/@dsh-std/messages/lib/index.js.map +1 -0
  292. package/node_modules/@dsh-std/messages/package.json +20 -0
  293. package/node_modules/@dsh-std/messages/schema/message-observer-envelope-0.15.schema.json +54 -0
  294. package/node_modules/@dsh-std/presentation/CHANGELOG.md +9 -0
  295. package/node_modules/@dsh-std/presentation/LICENSE +21 -0
  296. package/node_modules/@dsh-std/presentation/README.md +27 -0
  297. package/node_modules/@dsh-std/presentation/README.zh.md +29 -0
  298. package/node_modules/@dsh-std/presentation/lib/callback.d.ts +2 -0
  299. package/node_modules/@dsh-std/presentation/lib/callback.js +179 -0
  300. package/node_modules/@dsh-std/presentation/lib/callback.js.map +1 -0
  301. package/node_modules/@dsh-std/presentation/lib/index.d.ts +262 -0
  302. package/node_modules/@dsh-std/presentation/lib/index.d.ts.map +1 -0
  303. package/node_modules/@dsh-std/presentation/lib/index.js +550 -0
  304. package/node_modules/@dsh-std/presentation/lib/index.js.map +1 -0
  305. package/node_modules/@dsh-std/presentation/lib/interaction.d.ts +2 -0
  306. package/node_modules/@dsh-std/presentation/lib/interaction.js +2 -0
  307. package/node_modules/@dsh-std/presentation/lib/operations.d.ts +2 -0
  308. package/node_modules/@dsh-std/presentation/lib/operations.js +2 -0
  309. package/node_modules/@dsh-std/presentation/package.json +25 -0
  310. package/node_modules/@dsh-std/storage/CHANGELOG.md +8 -0
  311. package/node_modules/@dsh-std/storage/LICENSE +21 -0
  312. package/node_modules/@dsh-std/storage/README.md +5 -0
  313. package/node_modules/@dsh-std/storage/README.zh.md +7 -0
  314. package/node_modules/@dsh-std/storage/lib/index.d.ts +48 -0
  315. package/node_modules/@dsh-std/storage/lib/index.d.ts.map +1 -0
  316. package/node_modules/@dsh-std/storage/lib/index.js +104 -0
  317. package/node_modules/@dsh-std/storage/lib/index.js.map +1 -0
  318. package/node_modules/@dsh-std/storage/package.json +20 -0
  319. package/node_modules/@dsh-std/storage/schema/local-storage-0.15.schema.json +56 -0
  320. package/package.json +110 -70
  321. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/CHANGELOG.md +8 -0
  322. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/LICENSE +21 -0
  323. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.md +42 -0
  324. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.zh.md +42 -0
  325. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
  326. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
  327. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
  328. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
  329. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js +158 -0
  330. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
  331. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
  332. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
  333. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js +258 -0
  334. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
  335. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
  336. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
  337. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/package.json +20 -0
  338. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
  339. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/LICENSE +21 -0
  340. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.md +13 -0
  341. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.zh.md +13 -0
  342. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  343. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  344. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js +424 -0
  345. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  346. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/package.json +21 -0
  347. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/CHANGELOG.md +9 -0
  348. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/LICENSE +21 -0
  349. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.md +5 -0
  350. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.zh.md +5 -0
  351. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.d.ts +182 -0
  352. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.d.ts.map +1 -0
  353. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js +625 -0
  354. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js.map +1 -0
  355. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/package.json +20 -0
  356. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -0
  357. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/CHANGELOG.md +9 -0
  358. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/LICENSE +21 -0
  359. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.md +27 -0
  360. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.zh.md +29 -0
  361. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/callback.d.ts +2 -0
  362. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/callback.js +179 -0
  363. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/callback.js.map +1 -0
  364. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.d.ts +262 -0
  365. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.d.ts.map +1 -0
  366. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js +550 -0
  367. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js.map +1 -0
  368. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/interaction.d.ts +2 -0
  369. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/interaction.js +2 -0
  370. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/operations.d.ts +2 -0
  371. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/operations.js +2 -0
  372. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/package.json +25 -0
  373. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
  374. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/LICENSE +21 -0
  375. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.md +13 -0
  376. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.zh.md +13 -0
  377. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  378. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  379. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js +424 -0
  380. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  381. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/package.json +21 -0
  382. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
  383. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/LICENSE +21 -0
  384. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.md +13 -0
  385. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.zh.md +13 -0
  386. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  387. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  388. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js +424 -0
  389. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  390. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/package.json +21 -0
  391. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
  392. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/LICENSE +21 -0
  393. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.md +13 -0
  394. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.zh.md +13 -0
  395. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  396. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  397. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js +424 -0
  398. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  399. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/package.json +21 -0
  400. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/CHANGELOG.md +8 -0
  401. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/LICENSE +21 -0
  402. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.md +42 -0
  403. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.zh.md +42 -0
  404. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
  405. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
  406. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
  407. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
  408. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js +158 -0
  409. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
  410. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
  411. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
  412. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js +258 -0
  413. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
  414. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
  415. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
  416. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/package.json +20 -0
  417. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
  418. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/LICENSE +21 -0
  419. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.md +13 -0
  420. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.zh.md +13 -0
  421. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  422. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  423. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js +424 -0
  424. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  425. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/package.json +21 -0
  426. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/CHANGELOG.md +8 -0
  427. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/LICENSE +21 -0
  428. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.md +13 -0
  429. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.zh.md +13 -0
  430. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  431. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  432. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js +424 -0
  433. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  434. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/package.json +21 -0
@@ -0,0 +1,136 @@
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 { Context, Service } from '@deepseek-ai/cordis';
36
+ import type { CommandDefinition } from '@deepseek-ai/dsh-commands';
37
+ import type { HostDescriptor } from '../plugin-spec/types.js';
38
+ import { type GrantStore } from './grants.js';
39
+ import { type HostDescriptorBuild } from './host-descriptor.js';
40
+ import { type DecisionRegistrationOptions } from './decision-guard.js';
41
+ import { type VerifiedComponentIdentity } from './component-identity.js';
42
+ /** Public, mediated plugin-host capability. Loader-only admission remains
43
+ * behind getHostAdmission(), which is deliberately omitted from the package
44
+ * export surface. */
45
+ export interface TuiPluginHost {
46
+ readonly generationId: string;
47
+ readonly grants: GrantStore;
48
+ hostDescriptor(): HostDescriptor;
49
+ describe(): HostDescriptorBuild;
50
+ subscribeDecision(pluginCtx: Context, event: string, listener: (payload: Record<string, unknown>) => unknown, options?: {
51
+ scope?: string;
52
+ order?: string;
53
+ }): () => boolean;
54
+ registerCommand(pluginCtx: Context, definition: CommandDefinition): () => void;
55
+ registerCommand(pluginCtx: Context, contributionId: string, definition: CommandDefinition): () => void;
56
+ selfCheck(): string[];
57
+ }
58
+ declare module '@deepseek-ai/cordis' {
59
+ interface Context {
60
+ tuiPluginHost: TuiPluginHost;
61
+ }
62
+ }
63
+ /** `ctx.tuiPluginHost` — plugin-interop anchor (generation, grants, descriptor). */
64
+ export declare class TuiPluginHostRuntime extends Service implements TuiPluginHost {
65
+ /** Runtime generation id (C-050): fresh per activation of this row. */
66
+ get generationId(): string;
67
+ /** Live scoped grant store; every operation observes the current file. */
68
+ get grants(): GrantStore;
69
+ constructor(ctx: Context);
70
+ /**
71
+ * The C-010 Host Descriptor, built lazily and cached while the
72
+ * runtime-dependent commands capability remains unchanged.
73
+ */
74
+ hostDescriptor(): HostDescriptor;
75
+ /** The full build result (descriptor + dropped coordinates + warnings). */
76
+ describe(): HostDescriptorBuild;
77
+ private build;
78
+ /**
79
+ * Parse, project, validate, negotiate, and bind one activation's Component
80
+ * identity before any mediated runtime capability can be used.
81
+ */
82
+ admit(pluginCtx: Context, source: string, options?: {
83
+ source?: string;
84
+ activationId?: string;
85
+ }): VerifiedComponentIdentity;
86
+ /** @internal Host loader entry; the unexported token prevents proxy calls. */
87
+ admitInternal(pluginCtx: Context, source: string, options?: {
88
+ source?: string;
89
+ activationId?: string;
90
+ }, token?: symbol): VerifiedComponentIdentity;
91
+ /**
92
+ * Host-mediated DecisionEvents activation surface. A plugin cannot use a
93
+ * raw `ctx.on` for these points: the verified Component identity, static
94
+ * requirement, scope and current grant are all checked before insertion in
95
+ * the registry. The returned disposer is idempotent and is also owned by
96
+ * the activation so deactivation cannot leave an effect behind.
97
+ */
98
+ subscribeDecision(pluginCtx: Context, event: string, listener: (payload: Record<string, unknown>) => unknown, options?: DecisionRegistrationOptions): () => boolean;
99
+ /**
100
+ * Mediated command registration (C-041 attribution): registers through
101
+ * the commands service and, on success, stamps the command's owner as
102
+ * the verified Component identity — so the channel's invoke checkpoint
103
+ * can enforce per-owner `commands.invoke` denies on the host-mediated
104
+ * path. Mirrors the honest-identity pattern of storage.open /
105
+ * messages.observe subscribe: there is no parameter to impersonate
106
+ * another plugin. The returned disposer unregisters AND lifts the stamp
107
+ * (idempotent). Duplicates throw the mapped DUPLICATE_CONTRIBUTION_ID
108
+ * error; a missing commands service fails loud (the descriptor's
109
+ * Command contract is excluded in that situation anyway).
110
+ */
111
+ registerCommand(pluginCtx: Context, definition: CommandDefinition): () => void;
112
+ registerCommand(pluginCtx: Context, contributionId: string, definition: CommandDefinition): () => void;
113
+ /**
114
+ * Vendored registry + contract-profile self-check (C-020 definition/profile
115
+ * pins, C-040 ten-point completeness, coordinate/permission parity). Empty =
116
+ * clean; violations are strings, never thrown.
117
+ */
118
+ selfCheck(): string[];
119
+ }
120
+ /**
121
+ * Loader-only admission capability. It is intentionally omitted from the
122
+ * package `plugin-host` export; tests and the in-process loader can obtain it
123
+ * from this adapter module, while a plugin calling the public service proxy
124
+ * receives a deterministic denial instead of being able to impersonate a
125
+ * different manifest identity.
126
+ */
127
+ export interface HostAdmission {
128
+ admit(pluginCtx: Context, source: string, options?: {
129
+ source?: string;
130
+ activationId?: string;
131
+ }): VerifiedComponentIdentity;
132
+ }
133
+ export declare function getHostAdmission(runtime: TuiPluginHost | TuiPluginHostRuntime | undefined): HostAdmission | undefined;
134
+ export declare const name = "dsh-tui-plugin-host";
135
+ export declare function apply(ctx: Context): void;
136
+ //# sourceMappingURL=plugin-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-host.d.ts","sourceRoot":"","sources":["../../../src/dsh-adapter/plugin-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAEtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAElE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAI7D,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7D,OAAO,EAAiD,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAM9G,OAAO,EAKL,KAAK,2BAA2B,EACjC,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAML,KAAK,yBAAyB,EAC/B,MAAM,yBAAyB,CAAA;AAGhC;;qBAEqB;AACrB,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;IAC3B,cAAc,IAAI,cAAc,CAAA;IAChC,QAAQ,IAAI,mBAAmB,CAAA;IAC/B,iBAAiB,CACf,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,EACvD,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAC3C,MAAM,OAAO,CAAA;IAChB,eAAe,CAAC,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,iBAAiB,GAAG,MAAM,IAAI,CAAA;IAC9E,eAAe,CAAC,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,GAAG,MAAM,IAAI,CAAA;IACtG,SAAS,IAAI,MAAM,EAAE,CAAA;CACtB;AAED,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,aAAa,EAAE,aAAa,CAAA;KAC7B;CACF;AAED,oFAAoF;AACpF,qBAAa,oBAAqB,SAAQ,OAAQ,YAAW,aAAa;IACxE,uEAAuE;IACvE,IAAI,YAAY,IAAI,MAAM,CAA2C;IACrE,0EAA0E;IAC1E,IAAI,MAAM,IAAI,UAAU,CAAqC;gBAEjD,GAAG,EAAE,OAAO;IAqBxB;;;OAGG;IACH,cAAc,IAAI,cAAc;IAIhC,2EAA2E;IAC3E,QAAQ,IAAI,mBAAmB;IAI/B,OAAO,CAAC,KAAK;IAyCb;;;OAGG;IACH,KAAK,CACH,SAAS,EAAE,OAAO,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAO,GACvD,yBAAyB;IAa5B,8EAA8E;IAC9E,aAAa,CACX,SAAS,EAAE,OAAO,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAO,EACxD,KAAK,CAAC,EAAE,MAAM,GACb,yBAAyB;IAqC5B;;;;;;OAMG;IACH,iBAAiB,CACf,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,EACvD,OAAO,GAAE,2BAAgC,GACxC,MAAM,OAAO;IAmDhB;;;;;;;;;;;MAWE;IACF,eAAe,CAAC,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,iBAAiB,GAAG,MAAM,IAAI;IAC9E,eAAe,CAAC,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,GAAG,MAAM,IAAI;IA6FtG;;;;OAIG;IACH,SAAS,IAAI,MAAM,EAAE;CAKtB;AAwBD;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,CACH,SAAS,EAAE,OAAO,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GACnD,yBAAyB,CAAA;CAC7B;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,oBAAoB,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAUrH;AA0BD,eAAO,MAAM,IAAI,wBAAwB,CAAA;AAEzC,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAaxC"}
@@ -0,0 +1,365 @@
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 { Context, 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, requiresContract, requireComponentIdentity, } from './component-identity.js';
50
+ import { activationContext, activationFiber, assertCallerContext, bindCallerEffect, compositionRoot, concreteService } from './host-access.js';
51
+ /** `ctx.tuiPluginHost` — plugin-interop anchor (generation, grants, descriptor). */
52
+ export class TuiPluginHostRuntime extends Service {
53
+ /** Runtime generation id (C-050): fresh per activation of this row. */
54
+ get generationId() { return hostStateFor(this).generationId; }
55
+ /** Live scoped grant store; every operation observes the current file. */
56
+ get grants() { return hostStateFor(this).grants; }
57
+ constructor(ctx) {
58
+ super(ctx, 'tuiPluginHost');
59
+ hostStates.set(this, {
60
+ hostContext: compositionRoot(ctx),
61
+ generationId: randomUUID(),
62
+ grants: Object.freeze(readGrantStore()),
63
+ descriptorBuild: undefined,
64
+ descriptorTopology: undefined,
65
+ });
66
+ // The host row may be mounted without the extensions row or a channel;
67
+ // decision registration must remain mediated in that degraded topology.
68
+ installDecisionGuard(ctx, this.grants);
69
+ const violations = this.selfCheck();
70
+ if (violations.length > 0) {
71
+ ctx.logger.warn(`dsh-tui: vendored plugin-spec registry failed self-check (${violations.length} violation(s)); ` +
72
+ `affected contracts are dropped from the Host Descriptor fail-closed: ${violations.join(' | ')}`);
73
+ }
74
+ }
75
+ /**
76
+ * The C-010 Host Descriptor, built lazily and cached while the
77
+ * runtime-dependent commands capability remains unchanged.
78
+ */
79
+ hostDescriptor() {
80
+ return this.build().descriptor;
81
+ }
82
+ /** The full build result (descriptor + dropped coordinates + warnings). */
83
+ describe() {
84
+ return this.build();
85
+ }
86
+ build() {
87
+ const state = hostStateFor(this);
88
+ const host = state.hostContext;
89
+ // C-010 honesty: advertise a runtime capability only while its service is
90
+ // actually mounted. Probed on every descriptor request because sibling
91
+ // rows can mount after this service, and embedders can unload them later.
92
+ const commandsMounted = host.get('commands') !== undefined;
93
+ const storageMounted = host.get('tuiPluginStorage') !== undefined;
94
+ const observerMounted = host.get('tuiMessageObserver') !== undefined;
95
+ const topology = `${Number(commandsMounted)}:${Number(storageMounted)}:${Number(observerMounted)}`;
96
+ if (state.descriptorBuild === undefined || state.descriptorTopology !== topology) {
97
+ const supported = HOST_SUPPORTED_CONTRACTS.filter(contract => {
98
+ if (contract.kind === 'Command')
99
+ return commandsMounted;
100
+ if (contract.kind === 'LocalStorage')
101
+ return storageMounted;
102
+ if (contract.kind === 'MessageObserver')
103
+ return observerMounted;
104
+ return true;
105
+ });
106
+ state.descriptorBuild = buildHostDescriptor({ generationId: state.generationId, supported });
107
+ state.descriptorTopology = topology;
108
+ if (!commandsMounted) {
109
+ host.logger.warn('dsh-tui: host descriptor: commands.dsh/v1alpha1#Command excluded — the commands service is not mounted on this context');
110
+ }
111
+ if (!storageMounted) {
112
+ host.logger.warn('dsh-tui: host descriptor: storage.dsh/v1alpha1#LocalStorage excluded — the tuiPluginStorage service is not mounted on this context');
113
+ }
114
+ if (!observerMounted) {
115
+ host.logger.warn('dsh-tui: host descriptor: messages.dsh/v1alpha1#MessageObserver excluded — the tuiMessageObserver service is not mounted on this context');
116
+ }
117
+ for (const warning of state.descriptorBuild.warnings) {
118
+ host.logger.warn(`dsh-tui: host descriptor: ${warning}`);
119
+ }
120
+ }
121
+ return state.descriptorBuild;
122
+ }
123
+ /**
124
+ * Parse, project, validate, negotiate, and bind one activation's Component
125
+ * identity before any mediated runtime capability can be used.
126
+ */
127
+ admit(pluginCtx, source, options = {}) {
128
+ // Admission binds an untrusted manifest to a privileged activation. A
129
+ // plugin-facing service proxy must not be able to choose another
130
+ // component's id and inherit its grants, so the loader uses the
131
+ // host-only accessor below instead of this public compatibility method.
132
+ void pluginCtx;
133
+ void source;
134
+ void options;
135
+ throw new Error('dsh-tui: admission is host-owned; the loader must use its admission capability');
136
+ }
137
+ /** @internal Host loader entry; the unexported token prevents proxy calls. */
138
+ admitInternal(pluginCtx, source, options = {}, token) {
139
+ if (token !== HOST_ADMISSION_TOKEN) {
140
+ throw new Error('dsh-tui: admission capability is host-owned');
141
+ }
142
+ const host = hostContextFor(this);
143
+ const caller = assertActivationContext(host, pluginCtx);
144
+ const manifest = parseManifest(source, { source: options.source });
145
+ // The host owns the activation instance identity. Embedders may provide a
146
+ // pre-issued id when policy has an activation-scoped grant; otherwise a
147
+ // fresh opaque id is generated once and bound to this Cordis activation.
148
+ const activationId = options.activationId ?? randomUUID();
149
+ const data = loadSpecData();
150
+ if (data === undefined)
151
+ throw new Error('dsh-tui: admission profile is unavailable');
152
+ const specViolations = [...verifyRegistry(data), ...verifyContractProfiles(data)];
153
+ if (specViolations.length > 0) {
154
+ throw new Error(`dsh-tui: admission profile self-check failed: ${specViolations.join(' | ')}`);
155
+ }
156
+ const index = createContractIndex(data.registry, data.permissions);
157
+ validatePlugin(index, manifest);
158
+ const projection = projectManifest(manifest);
159
+ const grants = manifest.permissions
160
+ .map(request => ({
161
+ name: request.name,
162
+ scope: request.scope,
163
+ granted: hostStateFor(this).grants.allows({ componentId: manifest.id, activationId }, request.name, request.scope),
164
+ }));
165
+ const decision = negotiate(index, manifest, this.hostDescriptor(), grants);
166
+ if (decision.decision !== 'compatible' && decision.decision !== 'compatible_degraded') {
167
+ throw new Error(`dsh-tui: Component ${manifest.id} admission ${decision.decision}: ${'reasonCode' in decision ? decision.reasonCode : 'incompatible'}`);
168
+ }
169
+ return bindComponentIdentity(caller, manifest, projection, activationId);
170
+ }
171
+ /**
172
+ * Host-mediated DecisionEvents activation surface. A plugin cannot use a
173
+ * raw `ctx.on` for these points: the verified Component identity, static
174
+ * requirement, scope and current grant are all checked before insertion in
175
+ * the registry. The returned disposer is idempotent and is also owned by
176
+ * the activation so deactivation cannot leave an effect behind.
177
+ */
178
+ subscribeDecision(pluginCtx, event, listener, options = {}) {
179
+ const host = hostContextFor(this);
180
+ const caller = assertActivationContext(host, pluginCtx);
181
+ assertCallerContext(this.ctx, caller, 'DecisionEvents.subscribe', this);
182
+ const identity = requireComponentIdentity(caller);
183
+ if (!requiresDecisionEvents(identity)) {
184
+ throw new Error(`dsh-tui: Component "${identity.componentId}" must require tui.dsh/v1alpha1#DecisionEvents before subscribing`);
185
+ }
186
+ const previousMetadata = decisionHandlerMetadataOf(listener);
187
+ const release = withDecisionRegistration(caller, () => registerDecisionHandler(caller, identity, event, listener, options, () => {
188
+ host.get('tuiEffectLedger')?.record({ operation: 'release', resource: { kind: 'decision-handler', id: `${identity.componentId}:${event}` }, result: 'applied' }, caller);
189
+ }));
190
+ // A missing live grant is represented by a no-op disposer rather than an
191
+ // exception. Do not write a successful bind record for that path; the
192
+ // ledger must describe effects that actually entered the registry.
193
+ const metadata = decisionHandlerMetadataOf(listener);
194
+ const registered = metadata !== previousMetadata
195
+ && metadata?.componentId === identity.componentId
196
+ && metadata.activationId === identity.activationId
197
+ && metadata.event === event;
198
+ if (!registered) {
199
+ host.get('tuiEffectLedger')?.record({
200
+ operation: 'bind',
201
+ resource: { kind: 'permission', id: `${event}` },
202
+ result: 'failed',
203
+ errorCode: 'PERMISSION_NOT_GRANTED',
204
+ }, caller);
205
+ return () => false;
206
+ }
207
+ host.get('tuiEffectLedger')?.record({ operation: 'bind', resource: { kind: 'decision-handler', id: `${identity.componentId}:${event}` }, result: 'applied' }, caller);
208
+ return release;
209
+ }
210
+ registerCommand(pluginCtx, contributionOrDefinition, explicitDefinition) {
211
+ const host = hostContextFor(this);
212
+ const caller = assertActivationContext(host, pluginCtx);
213
+ assertCallerContext(this.ctx, caller, 'commands.register', this);
214
+ // Resolve through the registrant context so dsh-commands attaches the
215
+ // registration to that agent's scoped layer rather than the host-global
216
+ // layer. Its traceable service proxy carries this context into register().
217
+ const commands = caller.get('commands');
218
+ if (commands === undefined) {
219
+ throw new Error('dsh-tui: registerCommand unavailable — the commands service is not mounted on this context');
220
+ }
221
+ const identity = requireComponentIdentity(caller);
222
+ if (!requiresContract(identity, 'commands.dsh/v1alpha1', 'Command')) {
223
+ throw new Error(`dsh-tui: Component "${identity.componentId}" must require commands.dsh/v1alpha1#Command before registering commands`);
224
+ }
225
+ const definition = typeof contributionOrDefinition === 'string' ? explicitDefinition : contributionOrDefinition;
226
+ if (definition === undefined)
227
+ throw new TypeError('dsh-tui: registerCommand requires a command definition');
228
+ const name = typeof definition.name === 'string' ? definition.name : 'unknown';
229
+ const inferred = identity.manifest.contributes.commands.filter(command => command.id === name || command.id.endsWith(`.${name}`));
230
+ const contributionId = typeof contributionOrDefinition === 'string'
231
+ ? contributionOrDefinition
232
+ : inferred.length === 1 ? inferred[0].id : '';
233
+ if (contributionId === '' || !declaresCommand(identity, contributionId)) {
234
+ throw new TypeError(`dsh-tui: command "${name}" is not bound to a declared contribution id`);
235
+ }
236
+ // dsh-commands normalizes into a fresh definition and intentionally drops
237
+ // unknown fields. A per-registration handler wrapper survives that copy,
238
+ // giving the invoke checkpoint a collision-free identity for the actual
239
+ // resolved definition (including agent-scoped shadows).
240
+ const handler = definition?.handler;
241
+ const attributedDefinition = typeof handler === 'function'
242
+ ? {
243
+ ...definition,
244
+ handler: function (invocation) {
245
+ return handler.call(this, invocation);
246
+ },
247
+ }
248
+ : definition;
249
+ let dispose;
250
+ try {
251
+ dispose = commands.register(attributedDefinition);
252
+ }
253
+ catch (error) {
254
+ const mapped = mapCommandError(error);
255
+ host.get('tuiEffectLedger')?.record({
256
+ operation: 'create',
257
+ resource: { kind: 'command', id: contributionId },
258
+ result: 'failed',
259
+ errorCode: hasCommandErrorCode(mapped, 'DUPLICATE_CONTRIBUTION_ID') ? 'DUPLICATE_CONTRIBUTION_ID' : 'COMMAND_FAILED',
260
+ }, caller);
261
+ throw mapped;
262
+ }
263
+ stampCommandOwner(host, attributedDefinition, identity, contributionId);
264
+ host.get('tuiEffectLedger')?.record({ operation: 'create', resource: { kind: 'command', id: contributionId }, result: 'applied' }, caller);
265
+ let released = false;
266
+ const release = () => {
267
+ if (released)
268
+ return;
269
+ released = true;
270
+ unstampCommandOwner(host, attributedDefinition, identity.activationId);
271
+ host.get('tuiEffectLedger')?.record({ operation: 'release', resource: { kind: 'command', id: contributionId }, result: 'applied' }, caller);
272
+ };
273
+ // commands.register() already belongs to pluginCtx and therefore removes
274
+ // the definition on fiber teardown. Keep the attribution in that same
275
+ // lifecycle even when the caller never invokes our returned wrapper.
276
+ bindCallerEffect(caller, release);
277
+ let disposed = false;
278
+ return () => {
279
+ if (disposed)
280
+ return;
281
+ disposed = true;
282
+ try {
283
+ dispose();
284
+ }
285
+ finally {
286
+ release();
287
+ }
288
+ };
289
+ }
290
+ /**
291
+ * Vendored registry + contract-profile self-check (C-020 definition/profile
292
+ * pins, C-040 ten-point completeness, coordinate/permission parity). Empty =
293
+ * clean; violations are strings, never thrown.
294
+ */
295
+ selfCheck() {
296
+ const data = loadSpecData();
297
+ if (data === undefined)
298
+ return ['vendored spec data unavailable (dsh-ecosystem-spec/)'];
299
+ return [...verifyRegistry(data), ...verifyContractProfiles(data)];
300
+ }
301
+ }
302
+ const HOST_ADMISSION_TOKEN = Symbol('dsh-tui.host-admission');
303
+ const hostStates = new WeakMap();
304
+ function hostStateFor(runtime) {
305
+ const state = hostStates.get(concreteService(runtime));
306
+ if (state === undefined)
307
+ throw new Error('tuiPluginHost host state is unavailable');
308
+ return state;
309
+ }
310
+ function hostContextFor(runtime) {
311
+ return hostStateFor(runtime).hostContext;
312
+ }
313
+ export function getHostAdmission(runtime) {
314
+ if (runtime === undefined)
315
+ return undefined;
316
+ try {
317
+ const concrete = concreteService(runtime);
318
+ return {
319
+ admit: (pluginCtx, source, options = {}) => concrete.admitInternal(pluginCtx, source, options, HOST_ADMISSION_TOKEN),
320
+ };
321
+ }
322
+ catch {
323
+ return undefined;
324
+ }
325
+ }
326
+ /** A mediated capability must be bound to a live non-root activation in the
327
+ * same Cordis composition as the host row. In particular, accepting
328
+ * `ctx.root` would leave identity, commands, or handlers alive after the
329
+ * plugin fiber unloads. */
330
+ function assertActivationContext(hostCtx, pluginCtx) {
331
+ try {
332
+ const root = compositionRoot(hostCtx);
333
+ const caller = Context.is(pluginCtx) ? activationContext(pluginCtx) : undefined;
334
+ const rootFiber = activationFiber(root);
335
+ const callerFiber = caller === undefined ? undefined : activationFiber(caller);
336
+ if (caller === undefined
337
+ || compositionRoot(caller) !== root
338
+ || caller === root
339
+ || callerFiber === undefined
340
+ || callerFiber === rootFiber) {
341
+ throw new Error('dsh-tui: mediated capability requires a non-root activation context from the host composition');
342
+ }
343
+ return caller;
344
+ }
345
+ catch (error) {
346
+ if (error instanceof Error && error.message.startsWith('dsh-tui:'))
347
+ throw error;
348
+ throw new Error('dsh-tui: mediated capability requires a live activation context');
349
+ }
350
+ }
351
+ export const name = 'dsh-tui-plugin-host';
352
+ export function apply(ctx) {
353
+ // The plugin-host service first — the contract surfaces mounted below
354
+ // read its grant store (they fall back to a private read only when mounted
355
+ // standalone, e.g. in tests).
356
+ ctx.plugin(TuiPluginHostRuntime);
357
+ // Effect ledger (C-060): mounted before the surfaces below so they can
358
+ // soft-probe it at construction; generation comes from the host service.
359
+ ctx.plugin(TuiEffectLedgerRuntime);
360
+ // storage.local (C-040): per-plugin private persistence.
361
+ ctx.plugin(TuiPluginStorageRuntime);
362
+ // messages.observe (C-042): the grant-gated observation broker the
363
+ // channel publishes mapped session events into.
364
+ ctx.plugin(TuiMessageObserverRuntime);
365
+ }
@@ -0,0 +1,108 @@
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
+ constructor(ctx: Context, options?: {
89
+ dir?: string;
90
+ grants?: GrantStore;
91
+ ledger?: TuiEffectLedgerRuntime;
92
+ });
93
+ /** Grants: the plugin-host row's store when mounted, else a private read.
94
+ * Resolved PER CALL — sibling services mounted later by the same apply()
95
+ * are not visible to constructors (cordis), so a constructor-time probe
96
+ * would silently stick to the fallback. */
97
+ private grants;
98
+ /** Optional observability; a bare mount (tests) simply records nothing. */
99
+ private ledger;
100
+ /**
101
+ * Open the caller's private namespace. Identity = the PASSED context's
102
+ * verified Component identity (no way to name another plugin). The handle
103
+ * closes automatically when the caller's context unloads (idempotent
104
+ * disposer); data is retained (contract cleanup rule).
105
+ */
106
+ open(pluginCtx: Context): TuiPluginStorage;
107
+ }
108
+ //# 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;AAYtD,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;AAmBD,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;gBACtC,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;IAY9G;;;gDAG4C;IAC5C,OAAO,CAAC,MAAM;IAKd,2EAA2E;IAC3E,OAAO,CAAC,MAAM;IAKd;;;;;OAKG;IACH,IAAI,CAAC,SAAS,EAAE,OAAO,GAAG,gBAAgB;CAiL3C"}