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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (330) hide show
  1. package/README.md +13 -5
  2. package/cordis.patch.yml +21 -2
  3. package/cordis.yml +12 -1
  4. package/ecosystem-spec/registry/contracts/decision-events-v1alpha1.json +13 -0
  5. package/ecosystem-spec/registry/host-descriptor.tui.example.json +56 -0
  6. package/ecosystem-spec/registry/permissions-0.1.json +13 -0
  7. package/ecosystem-spec/registry/registry-0.15.json +57 -0
  8. package/ecosystem-spec/schemas/conformance-claim.schema.json +15 -0
  9. package/ecosystem-spec/schemas/effect-ledger-record.schema.json +16 -0
  10. package/ecosystem-spec/schemas/host-descriptor.schema.json +26 -0
  11. package/lib/types/cc/figures.d.ts +4 -0
  12. package/lib/types/cc/figures.d.ts.map +1 -1
  13. package/lib/types/cc/figures.js +4 -0
  14. package/lib/types/commands.d.ts.map +1 -1
  15. package/lib/types/commands.js +2 -0
  16. package/lib/types/components/ExtensionDialog.d.ts +40 -0
  17. package/lib/types/components/ExtensionDialog.d.ts.map +1 -0
  18. package/lib/types/components/ExtensionDialog.js +210 -0
  19. package/lib/types/components/HelpMenu.js +1 -1
  20. package/lib/types/components/LoadedContextPanel.d.ts +5 -10
  21. package/lib/types/components/LoadedContextPanel.d.ts.map +1 -1
  22. package/lib/types/components/LoadedContextPanel.js +7 -18
  23. package/lib/types/components/LogoV2.d.ts.map +1 -1
  24. package/lib/types/components/LogoV2.js +1 -2
  25. package/lib/types/components/MessageList.d.ts.map +1 -1
  26. package/lib/types/components/MessageList.js +25 -1
  27. package/lib/types/components/RewindPicker.d.ts +13 -1
  28. package/lib/types/components/RewindPicker.d.ts.map +1 -1
  29. package/lib/types/components/RewindPicker.js +26 -2
  30. package/lib/types/components/ToolUseLoader.d.ts +8 -3
  31. package/lib/types/components/ToolUseLoader.d.ts.map +1 -1
  32. package/lib/types/components/ToolUseLoader.js +43 -9
  33. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  34. package/lib/types/components/messages/AssistantToolUseMessage.js +1 -1
  35. package/lib/types/dsh-adapter/channel.d.ts +30 -7
  36. package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
  37. package/lib/types/dsh-adapter/channel.js +503 -21
  38. package/lib/types/dsh-adapter/command-attribution.d.ts +51 -0
  39. package/lib/types/dsh-adapter/command-attribution.d.ts.map +1 -0
  40. package/lib/types/dsh-adapter/command-attribution.js +93 -0
  41. package/lib/types/dsh-adapter/command-errors.d.ts +42 -0
  42. package/lib/types/dsh-adapter/command-errors.d.ts.map +1 -0
  43. package/lib/types/dsh-adapter/command-errors.js +63 -0
  44. package/lib/types/dsh-adapter/component-identity.d.ts +28 -0
  45. package/lib/types/dsh-adapter/component-identity.d.ts.map +1 -0
  46. package/lib/types/dsh-adapter/component-identity.js +108 -0
  47. package/lib/types/dsh-adapter/contract.d.ts +1 -1
  48. package/lib/types/dsh-adapter/contract.js +2 -2
  49. package/lib/types/dsh-adapter/decision-guard.d.ts +84 -0
  50. package/lib/types/dsh-adapter/decision-guard.d.ts.map +1 -0
  51. package/lib/types/dsh-adapter/decision-guard.js +354 -0
  52. package/lib/types/dsh-adapter/dialogs.d.ts +146 -0
  53. package/lib/types/dsh-adapter/dialogs.d.ts.map +1 -0
  54. package/lib/types/dsh-adapter/dialogs.js +262 -0
  55. package/lib/types/dsh-adapter/effect-ledger.d.ts +99 -0
  56. package/lib/types/dsh-adapter/effect-ledger.d.ts.map +1 -0
  57. package/lib/types/dsh-adapter/effect-ledger.js +231 -0
  58. package/lib/types/dsh-adapter/extension-events.d.ts +193 -0
  59. package/lib/types/dsh-adapter/extension-events.d.ts.map +1 -0
  60. package/lib/types/dsh-adapter/extension-events.js +169 -0
  61. package/lib/types/dsh-adapter/extensions.d.ts +32 -0
  62. package/lib/types/dsh-adapter/extensions.d.ts.map +1 -0
  63. package/lib/types/dsh-adapter/extensions.js +42 -0
  64. package/lib/types/dsh-adapter/grants.d.ts +25 -0
  65. package/lib/types/dsh-adapter/grants.d.ts.map +1 -0
  66. package/lib/types/dsh-adapter/grants.js +184 -0
  67. package/lib/types/dsh-adapter/host-descriptor.d.ts +24 -0
  68. package/lib/types/dsh-adapter/host-descriptor.d.ts.map +1 -0
  69. package/lib/types/dsh-adapter/host-descriptor.js +146 -0
  70. package/lib/types/dsh-adapter/message-observer.d.ts +178 -0
  71. package/lib/types/dsh-adapter/message-observer.d.ts.map +1 -0
  72. package/lib/types/dsh-adapter/message-observer.js +509 -0
  73. package/lib/types/dsh-adapter/plugin-host.d.ts +103 -0
  74. package/lib/types/dsh-adapter/plugin-host.d.ts.map +1 -0
  75. package/lib/types/dsh-adapter/plugin-host.js +270 -0
  76. package/lib/types/dsh-adapter/plugin-storage.d.ts +113 -0
  77. package/lib/types/dsh-adapter/plugin-storage.d.ts.map +1 -0
  78. package/lib/types/dsh-adapter/plugin-storage.js +385 -0
  79. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  80. package/lib/types/dsh-adapter/plugin.js +47 -1
  81. package/lib/types/dsh-adapter/plugins-info.d.ts +43 -0
  82. package/lib/types/dsh-adapter/plugins-info.d.ts.map +1 -0
  83. package/lib/types/dsh-adapter/plugins-info.js +276 -0
  84. package/lib/types/dsh-adapter/renderers.d.ts +65 -0
  85. package/lib/types/dsh-adapter/renderers.d.ts.map +1 -0
  86. package/lib/types/dsh-adapter/renderers.js +138 -0
  87. package/lib/types/dsh-adapter/sanitize.d.ts +36 -0
  88. package/lib/types/dsh-adapter/sanitize.d.ts.map +1 -0
  89. package/lib/types/dsh-adapter/sanitize.js +65 -0
  90. package/lib/types/dsh-adapter/scenes.d.ts +7 -1
  91. package/lib/types/dsh-adapter/scenes.d.ts.map +1 -1
  92. package/lib/types/dsh-adapter/scenes.js +17 -2
  93. package/lib/types/dsh-adapter/shortcuts.d.ts +109 -0
  94. package/lib/types/dsh-adapter/shortcuts.d.ts.map +1 -0
  95. package/lib/types/dsh-adapter/shortcuts.js +268 -0
  96. package/lib/types/dsh-adapter/status.d.ts +75 -0
  97. package/lib/types/dsh-adapter/status.d.ts.map +1 -0
  98. package/lib/types/dsh-adapter/status.js +168 -0
  99. package/lib/types/extensions.d.ts +8 -0
  100. package/lib/types/extensions.d.ts.map +1 -0
  101. package/lib/types/extensions.js +15 -0
  102. package/lib/types/i18n.d.ts +162 -16
  103. package/lib/types/i18n.d.ts.map +1 -1
  104. package/lib/types/i18n.js +53 -5
  105. package/lib/types/ink/ink.d.ts +11 -0
  106. package/lib/types/ink/ink.d.ts.map +1 -1
  107. package/lib/types/ink/ink.js +33 -0
  108. package/lib/types/ink/log-update.d.ts.map +1 -1
  109. package/lib/types/ink/log-update.js +101 -51
  110. package/lib/types/ink/output.d.ts +7 -0
  111. package/lib/types/ink/output.d.ts.map +1 -1
  112. package/lib/types/ink/output.js +125 -4
  113. package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
  114. package/lib/types/ink/render-node-to-output.js +14 -6
  115. package/lib/types/ink/terminal.d.ts.map +1 -1
  116. package/lib/types/ink/terminal.js +18 -6
  117. package/lib/types/plugin-host.d.ts +13 -0
  118. package/lib/types/plugin-host.d.ts.map +1 -0
  119. package/lib/types/plugin-host.js +17 -0
  120. package/lib/types/plugin-spec/negotiate.d.ts +11 -0
  121. package/lib/types/plugin-spec/negotiate.d.ts.map +1 -0
  122. package/lib/types/plugin-spec/negotiate.js +97 -0
  123. package/lib/types/plugin-spec/permission-scope.d.ts +32 -0
  124. package/lib/types/plugin-spec/permission-scope.d.ts.map +1 -0
  125. package/lib/types/plugin-spec/permission-scope.js +90 -0
  126. package/lib/types/plugin-spec/registry.d.ts +23 -0
  127. package/lib/types/plugin-spec/registry.d.ts.map +1 -0
  128. package/lib/types/plugin-spec/registry.js +157 -0
  129. package/lib/types/plugin-spec/schema-check.d.ts +17 -0
  130. package/lib/types/plugin-spec/schema-check.d.ts.map +1 -0
  131. package/lib/types/plugin-spec/schema-check.js +165 -0
  132. package/lib/types/plugin-spec/tui-extension.d.ts +16 -0
  133. package/lib/types/plugin-spec/tui-extension.d.ts.map +1 -0
  134. package/lib/types/plugin-spec/tui-extension.js +77 -0
  135. package/lib/types/plugin-spec/types.d.ts +114 -0
  136. package/lib/types/plugin-spec/types.d.ts.map +1 -0
  137. package/lib/types/plugin-spec/types.js +10 -0
  138. package/lib/types/plugin-spec/validate.d.ts +21 -0
  139. package/lib/types/plugin-spec/validate.d.ts.map +1 -0
  140. package/lib/types/plugin-spec/validate.js +119 -0
  141. package/lib/types/screens/Chat.d.ts +14 -1
  142. package/lib/types/screens/Chat.d.ts.map +1 -1
  143. package/lib/types/screens/Chat.js +142 -39
  144. package/lib/types/theme.d.ts +5 -0
  145. package/lib/types/theme.d.ts.map +1 -1
  146. package/lib/types/theme.js +15 -0
  147. package/lib/types/update.d.ts +20 -0
  148. package/lib/types/update.d.ts.map +1 -1
  149. package/lib/types/update.js +54 -7
  150. package/lib/types/utils/loaded-context.d.ts +8 -3
  151. package/lib/types/utils/loaded-context.d.ts.map +1 -1
  152. package/lib/types/utils/loaded-context.js +39 -3
  153. package/lib/types/utils/modifiers.d.ts.map +1 -1
  154. package/lib/types/utils/modifiers.js +3 -2
  155. package/lib/types/working-activity.d.ts +12 -0
  156. package/lib/types/working-activity.d.ts.map +1 -1
  157. package/lib/types/working-activity.js +13 -0
  158. package/node_modules/@dsh-std/command/LICENSE +21 -0
  159. package/node_modules/@dsh-std/command/README.md +26 -0
  160. package/node_modules/@dsh-std/command/README.zh.md +28 -0
  161. package/node_modules/@dsh-std/command/lib/index.d.ts +144 -0
  162. package/node_modules/@dsh-std/command/lib/index.d.ts.map +1 -0
  163. package/node_modules/@dsh-std/command/lib/index.js +252 -0
  164. package/node_modules/@dsh-std/command/lib/index.js.map +1 -0
  165. package/node_modules/@dsh-std/command/package.json +22 -0
  166. package/node_modules/@dsh-std/connection/LICENSE +21 -0
  167. package/node_modules/@dsh-std/connection/README.md +42 -0
  168. package/node_modules/@dsh-std/connection/README.zh.md +42 -0
  169. package/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
  170. package/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
  171. package/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
  172. package/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
  173. package/node_modules/@dsh-std/connection/lib/index.js +158 -0
  174. package/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
  175. package/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
  176. package/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
  177. package/node_modules/@dsh-std/connection/lib/memory.js +257 -0
  178. package/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
  179. package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
  180. package/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
  181. package/node_modules/@dsh-std/connection/package.json +20 -0
  182. package/node_modules/@dsh-std/core/LICENSE +21 -0
  183. package/node_modules/@dsh-std/core/README.md +13 -0
  184. package/node_modules/@dsh-std/core/README.zh.md +13 -0
  185. package/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  186. package/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  187. package/node_modules/@dsh-std/core/lib/index.js +424 -0
  188. package/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  189. package/node_modules/@dsh-std/core/package.json +21 -0
  190. package/node_modules/@dsh-std/manifest/LICENSE +21 -0
  191. package/node_modules/@dsh-std/manifest/README.md +5 -0
  192. package/node_modules/@dsh-std/manifest/README.zh.md +5 -0
  193. package/node_modules/@dsh-std/manifest/lib/index.d.ts +182 -0
  194. package/node_modules/@dsh-std/manifest/lib/index.d.ts.map +1 -0
  195. package/node_modules/@dsh-std/manifest/lib/index.js +625 -0
  196. package/node_modules/@dsh-std/manifest/lib/index.js.map +1 -0
  197. package/node_modules/@dsh-std/manifest/package.json +20 -0
  198. package/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -0
  199. package/node_modules/@dsh-std/messages/LICENSE +21 -0
  200. package/node_modules/@dsh-std/messages/README.md +5 -0
  201. package/node_modules/@dsh-std/messages/README.zh.md +7 -0
  202. package/node_modules/@dsh-std/messages/lib/index.d.ts +50 -0
  203. package/node_modules/@dsh-std/messages/lib/index.d.ts.map +1 -0
  204. package/node_modules/@dsh-std/messages/lib/index.js +151 -0
  205. package/node_modules/@dsh-std/messages/lib/index.js.map +1 -0
  206. package/node_modules/@dsh-std/messages/package.json +20 -0
  207. package/node_modules/@dsh-std/messages/schema/message-observer-envelope-0.15.schema.json +54 -0
  208. package/node_modules/@dsh-std/presentation/LICENSE +21 -0
  209. package/node_modules/@dsh-std/presentation/README.md +26 -0
  210. package/node_modules/@dsh-std/presentation/README.zh.md +28 -0
  211. package/node_modules/@dsh-std/presentation/lib/index.d.ts +219 -0
  212. package/node_modules/@dsh-std/presentation/lib/index.d.ts.map +1 -0
  213. package/node_modules/@dsh-std/presentation/lib/index.js +547 -0
  214. package/node_modules/@dsh-std/presentation/lib/index.js.map +1 -0
  215. package/node_modules/@dsh-std/presentation/lib/interaction.d.ts +2 -0
  216. package/node_modules/@dsh-std/presentation/lib/interaction.js +2 -0
  217. package/node_modules/@dsh-std/presentation/lib/operations.d.ts +2 -0
  218. package/node_modules/@dsh-std/presentation/lib/operations.js +2 -0
  219. package/node_modules/@dsh-std/presentation/package.json +21 -0
  220. package/node_modules/@dsh-std/storage/LICENSE +21 -0
  221. package/node_modules/@dsh-std/storage/README.md +5 -0
  222. package/node_modules/@dsh-std/storage/README.zh.md +7 -0
  223. package/node_modules/@dsh-std/storage/lib/index.d.ts +48 -0
  224. package/node_modules/@dsh-std/storage/lib/index.d.ts.map +1 -0
  225. package/node_modules/@dsh-std/storage/lib/index.js +104 -0
  226. package/node_modules/@dsh-std/storage/lib/index.js.map +1 -0
  227. package/node_modules/@dsh-std/storage/package.json +20 -0
  228. package/node_modules/@dsh-std/storage/schema/local-storage-0.15.schema.json +56 -0
  229. package/package.json +105 -70
  230. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/LICENSE +21 -0
  231. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.md +42 -0
  232. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/README.zh.md +42 -0
  233. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
  234. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
  235. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
  236. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
  237. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js +158 -0
  238. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
  239. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
  240. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
  241. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js +257 -0
  242. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
  243. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
  244. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
  245. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/connection/package.json +20 -0
  246. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/LICENSE +21 -0
  247. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.md +13 -0
  248. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/README.zh.md +13 -0
  249. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  250. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  251. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js +424 -0
  252. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  253. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/core/package.json +21 -0
  254. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/LICENSE +21 -0
  255. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.md +5 -0
  256. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/README.zh.md +5 -0
  257. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.d.ts +182 -0
  258. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.d.ts.map +1 -0
  259. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js +625 -0
  260. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/lib/index.js.map +1 -0
  261. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/package.json +20 -0
  262. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/manifest/schema/dsh-plugin-0.15.schema.json +144 -0
  263. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/LICENSE +21 -0
  264. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.md +26 -0
  265. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/README.zh.md +28 -0
  266. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.d.ts +219 -0
  267. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.d.ts.map +1 -0
  268. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js +547 -0
  269. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/index.js.map +1 -0
  270. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/interaction.d.ts +2 -0
  271. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/interaction.js +2 -0
  272. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/operations.d.ts +2 -0
  273. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/lib/operations.js +2 -0
  274. package/vendor/dsh-std/packages/command/node_modules/@dsh-std/presentation/package.json +21 -0
  275. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/LICENSE +21 -0
  276. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.md +13 -0
  277. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/README.zh.md +13 -0
  278. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  279. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  280. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js +424 -0
  281. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  282. package/vendor/dsh-std/packages/connection/node_modules/@dsh-std/core/package.json +21 -0
  283. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/LICENSE +21 -0
  284. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.md +13 -0
  285. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/README.zh.md +13 -0
  286. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  287. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  288. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js +424 -0
  289. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  290. package/vendor/dsh-std/packages/manifest/node_modules/@dsh-std/core/package.json +21 -0
  291. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/LICENSE +21 -0
  292. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.md +13 -0
  293. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/README.zh.md +13 -0
  294. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  295. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  296. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js +424 -0
  297. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  298. package/vendor/dsh-std/packages/messages/node_modules/@dsh-std/core/package.json +21 -0
  299. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/LICENSE +21 -0
  300. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.md +42 -0
  301. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/README.zh.md +42 -0
  302. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts +125 -0
  303. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/connection-CdGcSQnu.d.ts.map +1 -0
  304. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.d.ts +89 -0
  305. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.d.ts.map +1 -0
  306. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js +158 -0
  307. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/index.js.map +1 -0
  308. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.d.ts +24 -0
  309. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.d.ts.map +1 -0
  310. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js +257 -0
  311. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/memory.js.map +1 -0
  312. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js +226 -0
  313. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/lib/resolve-3X6ausgz.js.map +1 -0
  314. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/connection/package.json +20 -0
  315. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/LICENSE +21 -0
  316. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.md +13 -0
  317. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/README.zh.md +13 -0
  318. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  319. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  320. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js +424 -0
  321. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  322. package/vendor/dsh-std/packages/presentation/node_modules/@dsh-std/core/package.json +21 -0
  323. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/LICENSE +21 -0
  324. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.md +13 -0
  325. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/README.zh.md +13 -0
  326. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.d.ts +112 -0
  327. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.d.ts.map +1 -0
  328. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js +424 -0
  329. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/lib/index.js.map +1 -0
  330. package/vendor/dsh-std/packages/storage/node_modules/@dsh-std/core/package.json +21 -0
@@ -0,0 +1,97 @@
1
+ /** Five-state admission decision using dsh-std projection and ProtocolCatalog. */
2
+ import { defineProtocolDeclaration } from '@dsh-std/core';
3
+ import { projectManifest } from '@dsh-std/manifest';
4
+ import { rawScopeCovers } from './permission-scope.js';
5
+ const coordinateKey = (ref) => `${ref.apiVersion}#${ref.kind}`;
6
+ export function negotiate(index, manifest, host, grants = []) {
7
+ const supported = new Map(host.contracts.map(contract => [coordinateKey(contract), contract]));
8
+ const required = manifest.requires.contracts.filter(reference => reference.optional !== true);
9
+ const optional = manifest.requires.contracts.filter(reference => reference.optional === true);
10
+ const unknown = manifest.requires.contracts.filter(reference => {
11
+ try {
12
+ return index.resolveContractRef(reference).unregisteredVersion;
13
+ }
14
+ catch {
15
+ return false;
16
+ }
17
+ });
18
+ if (unknown.length > 0) {
19
+ return {
20
+ decision: 'unknown',
21
+ reasonCode: 'UNKNOWN_PROTOCOL_VERSION',
22
+ unknownContracts: unknown.map(coordinateKey),
23
+ };
24
+ }
25
+ if (!host.facetApiVersions.includes(manifest.facets.host.apiVersion)) {
26
+ return {
27
+ decision: 'rejected',
28
+ reasonCode: 'FACET_API_VERSION_UNAVAILABLE',
29
+ facetApiVersion: manifest.facets.host.apiVersion,
30
+ hostFacetApiVersions: host.facetApiVersions,
31
+ };
32
+ }
33
+ const missingRequired = required.filter(reference => !supported.has(coordinateKey(reference)));
34
+ const missingOptional = optional.filter(reference => !supported.has(coordinateKey(reference)));
35
+ if (missingRequired.length > 0) {
36
+ return {
37
+ decision: 'rejected',
38
+ reasonCode: 'REQUIRED_PROTOCOL_UNAVAILABLE',
39
+ missingRequired: missingRequired.map(coordinateKey),
40
+ };
41
+ }
42
+ const projected = projectManifest(manifest);
43
+ const facet = projected.spec.facets.find(candidate => candidate.name === 'host');
44
+ const supportedKeys = new Set(host.contracts.map(contract => coordinateKey(contract)));
45
+ const declaration = defineProtocolDeclaration({
46
+ participant: { id: manifest.id },
47
+ // An optional protocol that is absent is intentionally omitted from the
48
+ // evaluator input; its degraded state was already recorded above. This
49
+ // keeps ProtocolCatalog's required-support error meaningful for every
50
+ // remaining requirement.
51
+ requires: (facet?.protocols?.requires ?? []).filter(reference => reference.optional !== true || supportedKeys.has(coordinateKey(reference))),
52
+ });
53
+ const hostDeclaration = defineProtocolDeclaration({
54
+ participant: { id: host.hostId },
55
+ supports: host.contracts.map(contract => ({
56
+ apiVersion: contract.apiVersion,
57
+ kind: contract.kind,
58
+ ...(Object.hasOwn(contract, 'spec') ? { spec: contract.spec } : {}),
59
+ })),
60
+ });
61
+ const report = index.protocols.negotiate([declaration, hostDeclaration]);
62
+ if (!report.compatible) {
63
+ return {
64
+ decision: 'rejected',
65
+ reasonCode: 'PROTOCOL_NEGOTIATION_FAILED',
66
+ issues: report.issues,
67
+ };
68
+ }
69
+ const hostPermissions = new Set(host.contracts.flatMap(contract => contract.permissions));
70
+ const denied = manifest.permissions.filter((request) => {
71
+ if (!hostPermissions.has(request.name))
72
+ return true;
73
+ const definition = index.permissions.permissions.find(permission => permission.name === request.name);
74
+ if (definition === undefined)
75
+ return true;
76
+ const matching = grants.filter(grant => grant.name === request.name
77
+ && rawScopeCovers(grant.name, grant.scope, request.scope, manifest.id));
78
+ // Explicit revocation wins over an allow-default permission. This keeps
79
+ // admission diagnostics aligned with the runtime checkpoint instead of
80
+ // reporting a plugin as compatible until its first invocation fails.
81
+ if (matching.some(grant => grant.granted === false))
82
+ return true;
83
+ if (definition.default === 'allow')
84
+ return false;
85
+ return !matching.some(grant => grant.granted !== false);
86
+ });
87
+ if (denied.length > 0) {
88
+ return {
89
+ decision: 'waiting_authorization',
90
+ reasonCode: 'PERMISSION_NOT_GRANTED',
91
+ deniedPermissions: denied.map(request => `${request.name}@${request.scope}`),
92
+ };
93
+ }
94
+ return missingOptional.length > 0
95
+ ? { decision: 'compatible_degraded', missingOptional: missingOptional.map(coordinateKey) }
96
+ : { decision: 'compatible' };
97
+ }
@@ -0,0 +1,32 @@
1
+ /** Permission scope normalization shared by admission and runtime checks. */
2
+ export declare const STORAGE_PERMISSIONS: Set<string>;
3
+ export declare const INTERCEPT_PERMISSIONS: Set<string>;
4
+ /** The decision point controlled by each intercept permission. Keeping this
5
+ * mapping in the scope adapter (rather than accepting every `tui/*` name for
6
+ * every permission) prevents a manifest or grant from silently crossing an
7
+ * event boundary. */
8
+ export declare const INTERCEPT_EVENT_SCOPE_BY_PERMISSION: Readonly<Record<string, string>>;
9
+ /** A session scope is carried through the message envelope and may also be
10
+ * used by an intercept grant. Keep the canonical bound here so admission,
11
+ * grant evaluation, and runtime delivery cannot disagree about whether a
12
+ * scope is executable. */
13
+ export declare const SESSION_SCOPE_MAX_CHARS = 256;
14
+ export type ScopeKind = 'component' | 'command' | 'session' | 'event';
15
+ export interface NormalizedPermissionScope {
16
+ kind: ScopeKind;
17
+ value: string;
18
+ }
19
+ /** Return undefined when this adapter cannot enforce the supplied scope. */
20
+ export declare function normalizePermissionScope(permission: string, scope: string, componentId: string): NormalizedPermissionScope | undefined;
21
+ export declare function scopeCovers(declared: NormalizedPermissionScope, actual: NormalizedPermissionScope): boolean;
22
+ /**
23
+ * Permission-aware containment. An event-point grant is the parent scope of
24
+ * the sessions delivered through that point, while a session grant can never
25
+ * be promoted into an event-point grant. This relation is also used for
26
+ * denies, so a narrow `session:<id>` deny wins over a broad event grant.
27
+ */
28
+ export declare function permissionScopeCovers(permission: string, declared: NormalizedPermissionScope, actual: NormalizedPermissionScope): boolean;
29
+ /** Decision permission scopes may be expressed as one named event point. */
30
+ export declare const TUI_EVENT_SCOPE_NAMES: Set<string>;
31
+ export declare function rawScopeCovers(permission: string, declared: string, actual: string, componentId: string): boolean;
32
+ //# sourceMappingURL=permission-scope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permission-scope.d.ts","sourceRoot":"","sources":["../../../src/plugin-spec/permission-scope.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAE7E,eAAO,MAAM,mBAAmB,aAAyD,CAAA;AACzF,eAAO,MAAM,qBAAqB,aAKhC,CAAA;AAEF;;;qBAGqB;AACrB,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAK/E,CAAA;AAEF;;;0BAG0B;AAC1B,eAAO,MAAM,uBAAuB,MAAM,CAAA;AAI1C,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;AAErE,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,SAAS,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AAED,4EAA4E;AAC5E,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAClB,yBAAyB,GAAG,SAAS,CA2BvC;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,yBAAyB,EAAE,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAI3G;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,yBAAyB,EACnC,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAKT;AAED,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,aAOhC,CAAA;AAEF,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAMjH"}
@@ -0,0 +1,90 @@
1
+ /** Permission scope normalization shared by admission and runtime checks. */
2
+ export const STORAGE_PERMISSIONS = new Set(['storage.local.read', 'storage.local.write']);
3
+ export const INTERCEPT_PERMISSIONS = new Set([
4
+ 'session.input.intercept',
5
+ 'session.rewind.intercept',
6
+ 'session.switch.intercept',
7
+ 'session.compact.intercept',
8
+ ]);
9
+ /** The decision point controlled by each intercept permission. Keeping this
10
+ * mapping in the scope adapter (rather than accepting every `tui/*` name for
11
+ * every permission) prevents a manifest or grant from silently crossing an
12
+ * event boundary. */
13
+ export const INTERCEPT_EVENT_SCOPE_BY_PERMISSION = Object.freeze({
14
+ 'session.input.intercept': 'tui/input',
15
+ 'session.rewind.intercept': 'tui/rewind-prompt',
16
+ 'session.switch.intercept': 'tui/session-switch',
17
+ 'session.compact.intercept': 'tui/compact',
18
+ });
19
+ /** A session scope is carried through the message envelope and may also be
20
+ * used by an intercept grant. Keep the canonical bound here so admission,
21
+ * grant evaluation, and runtime delivery cannot disagree about whether a
22
+ * scope is executable. */
23
+ export const SESSION_SCOPE_MAX_CHARS = 256;
24
+ const CONTROL_CHARS = /[\x00-\x1f\x7f-\x9f]/u;
25
+ /** Return undefined when this adapter cannot enforce the supplied scope. */
26
+ export function normalizePermissionScope(permission, scope, componentId) {
27
+ if (typeof scope !== 'string' || scope === '')
28
+ return undefined;
29
+ if (STORAGE_PERMISSIONS.has(permission)) {
30
+ return scope === componentId ? { kind: 'component', value: componentId } : undefined;
31
+ }
32
+ if (permission === 'commands.invoke') {
33
+ return /^[a-z][a-z0-9]*(?:[.-][a-z0-9][a-z0-9-]*)+$/u.test(scope)
34
+ ? { kind: 'command', value: scope }
35
+ : undefined;
36
+ }
37
+ if (INTERCEPT_PERMISSIONS.has(permission) && TUI_EVENT_SCOPE_NAMES.has(scope)) {
38
+ return INTERCEPT_EVENT_SCOPE_BY_PERMISSION[permission] === scope
39
+ ? { kind: 'event', value: scope }
40
+ : undefined;
41
+ }
42
+ if (permission === 'messages.observe.read' || INTERCEPT_PERMISSIONS.has(permission)) {
43
+ if (scope === 'session:*')
44
+ return { kind: 'session', value: scope };
45
+ if (scope.startsWith('session:')
46
+ && scope.length <= SESSION_SCOPE_MAX_CHARS
47
+ && scope.length > 'session:'.length
48
+ && !scope.includes('*')
49
+ && !CONTROL_CHARS.test(scope)) {
50
+ return { kind: 'session', value: scope };
51
+ }
52
+ return undefined;
53
+ }
54
+ return undefined;
55
+ }
56
+ export function scopeCovers(declared, actual) {
57
+ if (declared.kind !== actual.kind)
58
+ return false;
59
+ return declared.value === actual.value
60
+ || (declared.kind === 'session' && declared.value === 'session:*' && actual.value.startsWith('session:'));
61
+ }
62
+ /**
63
+ * Permission-aware containment. An event-point grant is the parent scope of
64
+ * the sessions delivered through that point, while a session grant can never
65
+ * be promoted into an event-point grant. This relation is also used for
66
+ * denies, so a narrow `session:<id>` deny wins over a broad event grant.
67
+ */
68
+ export function permissionScopeCovers(permission, declared, actual) {
69
+ if (scopeCovers(declared, actual))
70
+ return true;
71
+ return INTERCEPT_PERMISSIONS.has(permission)
72
+ && declared.kind === 'event'
73
+ && actual.kind === 'session';
74
+ }
75
+ /** Decision permission scopes may be expressed as one named event point. */
76
+ export const TUI_EVENT_SCOPE_NAMES = new Set([
77
+ 'tui/input',
78
+ 'tui/rewind-prompt',
79
+ 'tui/rewind-done',
80
+ 'tui/session-switch',
81
+ 'tui/session-switched',
82
+ 'tui/compact',
83
+ ]);
84
+ export function rawScopeCovers(permission, declared, actual, componentId) {
85
+ const normalizedDeclared = normalizePermissionScope(permission, declared, componentId);
86
+ const normalizedActual = normalizePermissionScope(permission, actual, componentId);
87
+ return normalizedDeclared !== undefined
88
+ && normalizedActual !== undefined
89
+ && permissionScopeCovers(permission, normalizedDeclared, normalizedActual);
90
+ }
@@ -0,0 +1,23 @@
1
+ /** Load and verify the pinned dsh-TUI admission profile. */
2
+ import type { ContractRegistry, PermissionRegistry, RegistryEntry } from './types.js';
3
+ export declare const DSH_STD_REVISION = "a2faa86243a5693ee4970e3d8b3aaf361edea298";
4
+ export declare const ECOSYSTEM_SPEC_REVISION = "be1e9a219bd01decf79d825e0c3ac1685bde2be4";
5
+ export interface SpecData {
6
+ dir: string;
7
+ registry: ContractRegistry;
8
+ permissions: PermissionRegistry;
9
+ schemas: {
10
+ host: Record<string, unknown>;
11
+ ledger: Record<string, unknown>;
12
+ claim: Record<string, unknown>;
13
+ };
14
+ }
15
+ export declare function locateSpecDir(start?: string): string | undefined;
16
+ export declare function loadSpecData(dir?: string | undefined): SpecData | undefined;
17
+ export declare function registryEntries(registry: ContractRegistry): RegistryEntry[];
18
+ export declare function digestFile(dir: string, relative: string): `sha256:${string}`;
19
+ /** Verify definition availability and private profile digest pins. */
20
+ export declare function verifyRegistry(data: SpecData): string[];
21
+ /** Verify the TUI-owned definitions; public definitions live in dsh-std. */
22
+ export declare function verifyContractProfiles(data: SpecData): string[];
23
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/plugin-spec/registry.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAO5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAErF,eAAO,MAAM,gBAAgB,6CAA6C,CAAA;AAC1E,eAAO,MAAM,uBAAuB,6CAA6C,CAAA;AAEjF,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,WAAW,EAAE,kBAAkB,CAAA;IAC/B,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAC/B,CAAA;CACF;AAID,wBAAgB,aAAa,CAAC,KAAK,GAAE,MAAgD,GAAG,MAAM,GAAG,SAAS,CASzG;AA0CD,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAM,GAAG,SAA2B,GAAG,QAAQ,GAAG,SAAS,CAiB5F;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,gBAAgB,GAAG,aAAa,EAAE,CAI3E;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,MAAM,EAAE,CAE5E;AAED,sEAAsE;AACtE,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,EAAE,CAsBvD;AAED,4EAA4E;AAC5E,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,EAAE,CAiC/D"}
@@ -0,0 +1,157 @@
1
+ /** Load and verify the pinned dsh-TUI admission profile. */
2
+ import { createHash } from 'node:crypto';
3
+ import { existsSync, readFileSync } from 'node:fs';
4
+ import { dirname, join } from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+ import { createAdmissionCatalog } from './tui-extension.js';
7
+ export const DSH_STD_REVISION = 'a2faa86243a5693ee4970e3d8b3aaf361edea298';
8
+ export const ECOSYSTEM_SPEC_REVISION = 'be1e9a219bd01decf79d825e0c3ac1685bde2be4';
9
+ const REGISTRY_FILE = join('registry', 'registry-0.15.json');
10
+ export function locateSpecDir(start = dirname(fileURLToPath(import.meta.url))) {
11
+ let dir = start;
12
+ for (let index = 0; index < 8; index++) {
13
+ if (existsSync(join(dir, 'ecosystem-spec', REGISTRY_FILE)))
14
+ return join(dir, 'ecosystem-spec');
15
+ const parent = dirname(dir);
16
+ if (parent === dir)
17
+ return undefined;
18
+ dir = parent;
19
+ }
20
+ return undefined;
21
+ }
22
+ function loadJson(dir, relative) {
23
+ return JSON.parse(readFileSync(join(dir, relative), 'utf8'));
24
+ }
25
+ function isRecord(value) {
26
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
27
+ }
28
+ function soundEntry(value, privateDefinition) {
29
+ if (!isRecord(value) || typeof value.name !== 'string' || typeof value.kind !== 'string')
30
+ return false;
31
+ if (!isRecord(value.coordinates)
32
+ || typeof value.coordinates.apiVersion !== 'string'
33
+ || typeof value.coordinates.kind !== 'string')
34
+ return false;
35
+ if (!Array.isArray(value.permissions) || !value.permissions.every(permission => typeof permission === 'string'))
36
+ return false;
37
+ if (privateDefinition) {
38
+ return value.authority === 'dsh-tui'
39
+ && typeof value.profile === 'string'
40
+ && typeof value.profileHash === 'string';
41
+ }
42
+ return typeof value.package === 'string' && value.package.startsWith('@dsh-std/');
43
+ }
44
+ function structurallySound(data) {
45
+ if (!isRecord(data.registry)
46
+ || typeof data.registry.profileVersion !== 'string'
47
+ || !isRecord(data.registry.std)
48
+ || !Array.isArray(data.registry.imports)
49
+ || !Array.isArray(data.registry.definitions)
50
+ || !Array.isArray(data.registry.facetApiVersions)
51
+ || !data.registry.facetApiVersions.every(version => typeof version === 'string'))
52
+ return false;
53
+ if (!data.registry.imports.every(entry => soundEntry(entry, false)))
54
+ return false;
55
+ if (!data.registry.definitions.every(entry => soundEntry(entry, true)))
56
+ return false;
57
+ if (!isRecord(data.permissions) || !Array.isArray(data.permissions.permissions))
58
+ return false;
59
+ for (const permission of data.permissions.permissions) {
60
+ if (!isRecord(permission) || typeof permission.name !== 'string'
61
+ || (permission.default !== 'allow' && permission.default !== 'deny'))
62
+ return false;
63
+ }
64
+ return Object.values(data.schemas).every(isRecord);
65
+ }
66
+ export function loadSpecData(dir = locateSpecDir()) {
67
+ if (dir === undefined)
68
+ return undefined;
69
+ try {
70
+ const data = {
71
+ dir,
72
+ registry: loadJson(dir, REGISTRY_FILE),
73
+ permissions: loadJson(dir, join('registry', 'permissions-0.1.json')),
74
+ schemas: {
75
+ host: loadJson(dir, join('schemas', 'host-descriptor.schema.json')),
76
+ ledger: loadJson(dir, join('schemas', 'effect-ledger-record.schema.json')),
77
+ claim: loadJson(dir, join('schemas', 'conformance-claim.schema.json')),
78
+ },
79
+ };
80
+ return structurallySound(data) ? data : undefined;
81
+ }
82
+ catch {
83
+ return undefined;
84
+ }
85
+ }
86
+ export function registryEntries(registry) {
87
+ return Array.isArray(registry.imports) && Array.isArray(registry.definitions)
88
+ ? [...registry.imports, ...registry.definitions]
89
+ : [];
90
+ }
91
+ export function digestFile(dir, relative) {
92
+ return `sha256:${createHash('sha256').update(readFileSync(join(dir, relative))).digest('hex')}`;
93
+ }
94
+ /** Verify definition availability and private profile digest pins. */
95
+ export function verifyRegistry(data) {
96
+ const failures = [];
97
+ if (!Array.isArray(data.registry.imports)
98
+ || !Array.isArray(data.registry.definitions)) {
99
+ return ['registry imports/definitions are malformed'];
100
+ }
101
+ const { protocols } = createAdmissionCatalog();
102
+ for (const entry of registryEntries(data.registry)) {
103
+ const key = `${entry.coordinates.apiVersion}#${entry.coordinates.kind}`;
104
+ if (!protocols.understands(entry.coordinates))
105
+ failures.push(`${key}: ProtocolCatalog definition unavailable`);
106
+ if ('profile' in entry) {
107
+ let actual;
108
+ try {
109
+ actual = digestFile(data.dir, entry.profile);
110
+ }
111
+ catch {
112
+ failures.push(`${entry.name}: private profile unreadable (${entry.profile})`);
113
+ continue;
114
+ }
115
+ if (actual !== entry.profileHash)
116
+ failures.push(`${entry.name}: profileHash drifted (registry ${entry.profileHash}, actual ${actual})`);
117
+ }
118
+ }
119
+ return failures;
120
+ }
121
+ /** Verify the TUI-owned definitions; public definitions live in dsh-std. */
122
+ export function verifyContractProfiles(data) {
123
+ const requiredKeys = [
124
+ 'name', 'version', 'kind', 'coordinates', 'caller', 'permissions',
125
+ 'errors', 'concurrency', 'timeout', 'cleanup', 'privacyClass', 'securityBoundary',
126
+ ];
127
+ const failures = [];
128
+ if (!Array.isArray(data.registry.definitions)) {
129
+ return ['registry definitions are malformed'];
130
+ }
131
+ for (const entry of data.registry.definitions) {
132
+ let profile;
133
+ try {
134
+ profile = loadJson(data.dir, entry.profile);
135
+ }
136
+ catch {
137
+ failures.push(`${entry.name}: private profile unreadable (${entry.profile})`);
138
+ continue;
139
+ }
140
+ for (const key of requiredKeys) {
141
+ if (!(key in profile))
142
+ failures.push(`${entry.name}: contract profile missing "${key}"`);
143
+ }
144
+ const coordinates = profile.coordinates;
145
+ if (coordinates?.apiVersion !== entry.coordinates.apiVersion || coordinates.kind !== entry.coordinates.kind) {
146
+ failures.push(`${entry.name}: profile/registry coordinates mismatch`);
147
+ }
148
+ const actualPermissions = [...(profile.permissions ?? [])].sort();
149
+ if (JSON.stringify(actualPermissions) !== JSON.stringify([...entry.permissions].sort())) {
150
+ failures.push(`${entry.name}: profile/registry permissions mismatch`);
151
+ }
152
+ if (!('operations' in profile) || profile.securityBoundary !== false) {
153
+ failures.push(`${entry.name}: capability boundary is incomplete`);
154
+ }
155
+ }
156
+ return failures;
157
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * 零依赖 JSON Schema 校验器——上游 `conformance/tests/run.js` 的 check()
3
+ * 的保真 TS 移植。刻意只实现 vendored schemas 用到的子集:本地 $ref、
4
+ * oneOf(恰好一个匹配)、const/enum、object(required/additionalProperties:
5
+ * false/patternProperties)、array(min/maxItems/items/uniqueItems)、
6
+ * string(min/maxLength/pattern/format uri|date-time)、integer(minimum)、
7
+ * boolean。遇到子集之外的构件不静默放行——schema 更新引入新构件时这里
8
+ * 必须显式扩展(fixtures 矩阵会当场抓住)。
9
+ */
10
+ type JsonSchema = Record<string, unknown>;
11
+ /**
12
+ * Validate `value` against `schema`; throws an Error with the failing path
13
+ * (`$.a.b[0]: reason`) on the first violation.
14
+ */
15
+ export declare function check(value: unknown, schema: JsonSchema, rootSchema?: JsonSchema, where?: string): void;
16
+ export {};
17
+ //# sourceMappingURL=schema-check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-check.d.ts","sourceRoot":"","sources":["../../../src/plugin-spec/schema-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAqCzC;;;GAGG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAE,UAAmB,EAAE,KAAK,SAAM,GAAG,IAAI,CA0G5G"}
@@ -0,0 +1,165 @@
1
+ /**
2
+ * 零依赖 JSON Schema 校验器——上游 `conformance/tests/run.js` 的 check()
3
+ * 的保真 TS 移植。刻意只实现 vendored schemas 用到的子集:本地 $ref、
4
+ * oneOf(恰好一个匹配)、const/enum、object(required/additionalProperties:
5
+ * false/patternProperties)、array(min/maxItems/items/uniqueItems)、
6
+ * string(min/maxLength/pattern/format uri|date-time)、integer(minimum)、
7
+ * boolean。遇到子集之外的构件不静默放行——schema 更新引入新构件时这里
8
+ * 必须显式扩展(fixtures 矩阵会当场抓住)。
9
+ */
10
+ /** Canonical JSON encoding for `uniqueItems`. JSON object member order is not
11
+ * semantically significant, while `JSON.stringify` preserves insertion order
12
+ * and therefore lets equivalent objects evade duplicate detection. */
13
+ function canonicalJson(value) {
14
+ if (value === null)
15
+ return 'null';
16
+ if (Array.isArray(value))
17
+ return `[${value.map(canonicalJson).join(',')}]`;
18
+ switch (typeof value) {
19
+ case 'object': {
20
+ const record = value;
21
+ return `{${Object.keys(record).sort().map(key => `${JSON.stringify(key)}:${canonicalJson(record[key])}`).join(',')}}`;
22
+ }
23
+ case 'string': return JSON.stringify(value);
24
+ case 'number': return JSON.stringify(value) ?? 'null';
25
+ case 'boolean': return value ? 'true' : 'false';
26
+ case 'undefined': return 'undefined';
27
+ default: return `${typeof value}:${String(value)}`;
28
+ }
29
+ }
30
+ function resolveRef(rootSchema, ref) {
31
+ if (!ref.startsWith('#/')) {
32
+ throw new Error(`external ref is not supported by the zero-dependency checker: ${ref}`);
33
+ }
34
+ return ref
35
+ .slice(2)
36
+ .split('/')
37
+ .reduce((value, key) => {
38
+ const child = value[key.replace(/~1/g, '/').replace(/~0/g, '~')];
39
+ if (child === null || typeof child !== 'object') {
40
+ throw new Error(`unresolvable $ref segment "${key}" in ${ref}`);
41
+ }
42
+ return child;
43
+ }, rootSchema);
44
+ }
45
+ /**
46
+ * Validate `value` against `schema`; throws an Error with the failing path
47
+ * (`$.a.b[0]: reason`) on the first violation.
48
+ */
49
+ export function check(value, schema, rootSchema = schema, where = '$') {
50
+ if (typeof schema.$ref === 'string') {
51
+ return check(value, resolveRef(rootSchema, schema.$ref), rootSchema, where);
52
+ }
53
+ // oneOf: exactly one variant must match (JSON Schema semantics). Variants
54
+ // are currently mutually exclusive by design; exact-one keeps future
55
+ // overlap from being silently accepted.
56
+ if (Array.isArray(schema.oneOf)) {
57
+ let matched = 0;
58
+ const errors = [];
59
+ for (const variant of schema.oneOf) {
60
+ try {
61
+ check(value, variant, rootSchema, where);
62
+ matched += 1;
63
+ }
64
+ catch (error) {
65
+ errors.push(error instanceof Error ? error.message : String(error));
66
+ }
67
+ }
68
+ if (matched !== 1) {
69
+ throw new Error(`${where}: expected exactly one oneOf match, got ${matched}: ${errors.join(' | ')}`);
70
+ }
71
+ return;
72
+ }
73
+ if (schema.const !== undefined && value !== schema.const) {
74
+ throw new Error(`${where}: expected ${JSON.stringify(schema.const)}`);
75
+ }
76
+ if (Array.isArray(schema.enum) && !schema.enum.includes(value)) {
77
+ throw new Error(`${where}: value is not in enum`);
78
+ }
79
+ if (schema.type === 'object') {
80
+ if (value === null || typeof value !== 'object' || Array.isArray(value)) {
81
+ throw new Error(`${where}: expected object`);
82
+ }
83
+ const record = value;
84
+ for (const key of schema.required ?? []) {
85
+ if (!(key in record))
86
+ throw new Error(`${where}.${key}: required`);
87
+ }
88
+ // draft-2020-12: additionalProperties consults properties AND
89
+ // patternProperties — a key matching a declared pattern is not
90
+ // "additional".
91
+ if (schema.additionalProperties === false) {
92
+ const patterns = Object.keys(schema.patternProperties ?? {});
93
+ for (const key of Object.keys(record)) {
94
+ const declared = schema.properties?.[key] !== undefined;
95
+ const patterned = patterns.some(pattern => new RegExp(pattern).test(key));
96
+ if (!declared && !patterned)
97
+ throw new Error(`${where}.${key}: additional property`);
98
+ }
99
+ }
100
+ for (const [key, child] of Object.entries(schema.properties ?? {})) {
101
+ if (key in record)
102
+ check(record[key], child, rootSchema, `${where}.${key}`);
103
+ }
104
+ if (schema.patternProperties !== undefined) {
105
+ for (const [pattern, child] of Object.entries(schema.patternProperties)) {
106
+ for (const name of Object.keys(record)) {
107
+ if (new RegExp(pattern).test(name))
108
+ check(record[name], child, rootSchema, `${where}.${name}`);
109
+ }
110
+ }
111
+ }
112
+ return;
113
+ }
114
+ if (schema.type === 'array') {
115
+ if (!Array.isArray(value))
116
+ throw new Error(`${where}: expected array`);
117
+ if (schema.minItems !== undefined && value.length < schema.minItems) {
118
+ throw new Error(`${where}: too few items`);
119
+ }
120
+ if (schema.maxItems !== undefined && value.length > schema.maxItems) {
121
+ throw new Error(`${where}: too many items`);
122
+ }
123
+ for (let i = 0; i < value.length; i++) {
124
+ check(value[i], schema.items, rootSchema, `${where}[${i}]`);
125
+ }
126
+ if (schema.uniqueItems === true) {
127
+ const encoded = value.map(canonicalJson);
128
+ if (new Set(encoded).size !== encoded.length)
129
+ throw new Error(`${where}: duplicate items`);
130
+ }
131
+ return;
132
+ }
133
+ if (schema.type === 'string') {
134
+ if (typeof value !== 'string')
135
+ throw new Error(`${where}: expected string`);
136
+ if (schema.minLength !== undefined && value.length < schema.minLength) {
137
+ throw new Error(`${where}: too short`);
138
+ }
139
+ if (schema.maxLength !== undefined && value.length > schema.maxLength) {
140
+ throw new Error(`${where}: too long`);
141
+ }
142
+ if (schema.pattern !== undefined && !new RegExp(schema.pattern).test(value)) {
143
+ throw new Error(`${where}: pattern mismatch`);
144
+ }
145
+ if (schema.format === 'uri' && !/^[A-Za-z][A-Za-z0-9+.-]*:\/\//.test(value)) {
146
+ throw new Error(`${where}: invalid URI`);
147
+ }
148
+ if (schema.format === 'date-time' && Number.isNaN(Date.parse(value))) {
149
+ throw new Error(`${where}: invalid date-time`);
150
+ }
151
+ return;
152
+ }
153
+ if (schema.type === 'integer') {
154
+ if (!Number.isInteger(value))
155
+ throw new Error(`${where}: expected integer`);
156
+ if (schema.minimum !== undefined && value < schema.minimum) {
157
+ throw new Error(`${where}: below minimum`);
158
+ }
159
+ return;
160
+ }
161
+ if (schema.type === 'boolean') {
162
+ if (typeof value !== 'boolean')
163
+ throw new Error(`${where}: expected boolean`);
164
+ }
165
+ }
@@ -0,0 +1,16 @@
1
+ /** dsh-TUI private protocol registration on the shared dsh-std catalog. */
2
+ import { ProtocolCatalog, type ProtocolDefinition } from '@dsh-std/core';
3
+ import { ManifestDefinitionCatalog } from '@dsh-std/manifest';
4
+ import type { ContractCoordinate } from './types.js';
5
+ export declare const TUI_EXTENSION_API_VERSION = "tui.dsh/v1alpha1";
6
+ export declare const DECISION_EVENTS_COORDINATE: Readonly<ContractCoordinate>;
7
+ export declare const TUI_DECISION_EVENT_NAMES: readonly ["tui/input", "tui/rewind-prompt", "tui/rewind-done", "tui/session-switch", "tui/session-switched", "tui/compact"];
8
+ export declare const TUI_EXTENSION_PERMISSION_NAMES: readonly ["session.input.intercept", "session.rewind.intercept", "session.switch.intercept", "session.compact.intercept"];
9
+ export declare const decisionEventsDefinition: ProtocolDefinition;
10
+ export interface AdmissionCatalog {
11
+ protocols: ProtocolCatalog;
12
+ manifests: ManifestDefinitionCatalog;
13
+ }
14
+ /** Register public and private definitions into one evaluator-owned catalog. */
15
+ export declare function createAdmissionCatalog(): AdmissionCatalog;
16
+ //# sourceMappingURL=tui-extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tui-extension.d.ts","sourceRoot":"","sources":["../../../src/plugin-spec/tui-extension.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAE3E,OAAO,EAAE,eAAe,EAAE,KAAK,kBAAkB,EAAsB,MAAM,eAAe,CAAA;AAC5F,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAK7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpD,eAAO,MAAM,yBAAyB,qBAAqB,CAAA;AAE3D,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,kBAAkB,CAGlE,CAAA;AAEF,eAAO,MAAM,wBAAwB,6HAO1B,CAAA;AAEX,eAAO,MAAM,8BAA8B,2HAKhC,CAAA;AAiBX,eAAO,MAAM,wBAAwB,EAAE,kBAsBrC,CAAA;AAEF,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,eAAe,CAAA;IAC1B,SAAS,EAAE,yBAAyB,CAAA;CACrC;AAED,gFAAgF;AAChF,wBAAgB,sBAAsB,IAAI,gBAAgB,CASzD"}