@mcpview/compose 0.0.0-stage → 0.11.0

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 (450) hide show
  1. package/CHANGELOG.md +268 -0
  2. package/LICENSE +21 -0
  3. package/README.md +524 -2
  4. package/esm/_dnt.polyfills.d.ts +18 -0
  5. package/esm/_dnt.polyfills.d.ts.map +1 -0
  6. package/esm/_dnt.polyfills.js +15 -0
  7. package/esm/_dnt.shims.d.ts +2 -0
  8. package/esm/_dnt.shims.d.ts.map +1 -0
  9. package/esm/_dnt.shims.js +57 -0
  10. package/esm/deps/jsr.io/@std/yaml/1.3.0/_chars.d.ts +33 -0
  11. package/esm/deps/jsr.io/@std/yaml/1.3.0/_chars.d.ts.map +1 -0
  12. package/esm/deps/jsr.io/@std/yaml/1.3.0/_chars.js +48 -0
  13. package/esm/deps/jsr.io/@std/yaml/1.3.0/_dumper_state.d.ts +106 -0
  14. package/esm/deps/jsr.io/@std/yaml/1.3.0/_dumper_state.d.ts.map +1 -0
  15. package/esm/deps/jsr.io/@std/yaml/1.3.0/_dumper_state.js +636 -0
  16. package/esm/deps/jsr.io/@std/yaml/1.3.0/_loader_state.d.ts +67 -0
  17. package/esm/deps/jsr.io/@std/yaml/1.3.0/_loader_state.d.ts.map +1 -0
  18. package/esm/deps/jsr.io/@std/yaml/1.3.0/_loader_state.js +1393 -0
  19. package/esm/deps/jsr.io/@std/yaml/1.3.0/_schema.d.ts +44 -0
  20. package/esm/deps/jsr.io/@std/yaml/1.3.0/_schema.d.ts.map +1 -0
  21. package/esm/deps/jsr.io/@std/yaml/1.3.0/_schema.js +117 -0
  22. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/binary.d.ts +3 -0
  23. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/binary.d.ts.map +1 -0
  24. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/binary.js +103 -0
  25. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/bool.d.ts +3 -0
  26. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/bool.d.ts.map +1 -0
  27. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/bool.js +32 -0
  28. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/float.d.ts +3 -0
  29. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/float.d.ts.map +1 -0
  30. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/float.js +96 -0
  31. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/int.d.ts +3 -0
  32. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/int.d.ts.map +1 -0
  33. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/int.js +159 -0
  34. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/map.d.ts +3 -0
  35. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/map.d.ts.map +1 -0
  36. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/map.js +14 -0
  37. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/merge.d.ts +3 -0
  38. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/merge.d.ts.map +1 -0
  39. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/merge.js +10 -0
  40. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/nil.d.ts +3 -0
  41. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/nil.d.ts.map +1 -0
  42. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/nil.js +22 -0
  43. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/omap.d.ts +3 -0
  44. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/omap.d.ts.map +1 -0
  45. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/omap.js +29 -0
  46. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/pairs.d.ts +3 -0
  47. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/pairs.d.ts.map +1 -0
  48. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/pairs.js +19 -0
  49. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/regexp.d.ts +3 -0
  50. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/regexp.d.ts.map +1 -0
  51. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/regexp.js +30 -0
  52. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/seq.d.ts +3 -0
  53. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/seq.d.ts.map +1 -0
  54. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/seq.js +10 -0
  55. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/set.d.ts +3 -0
  56. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/set.d.ts.map +1 -0
  57. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/set.js +14 -0
  58. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/str.d.ts +3 -0
  59. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/str.d.ts.map +1 -0
  60. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/str.js +9 -0
  61. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/timestamp.d.ts +3 -0
  62. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/timestamp.d.ts.map +1 -0
  63. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/timestamp.js +81 -0
  64. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/undefined.d.ts +3 -0
  65. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/undefined.d.ts.map +1 -0
  66. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/undefined.js +20 -0
  67. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type.d.ts +32 -0
  68. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type.d.ts.map +1 -0
  69. package/esm/deps/jsr.io/@std/yaml/1.3.0/_type.js +6 -0
  70. package/esm/deps/jsr.io/@std/yaml/1.3.0/_utils.d.ts +4 -0
  71. package/esm/deps/jsr.io/@std/yaml/1.3.0/_utils.d.ts.map +1 -0
  72. package/esm/deps/jsr.io/@std/yaml/1.3.0/_utils.js +13 -0
  73. package/esm/deps/jsr.io/@std/yaml/1.3.0/mod.d.ts +51 -0
  74. package/esm/deps/jsr.io/@std/yaml/1.3.0/mod.d.ts.map +1 -0
  75. package/esm/deps/jsr.io/@std/yaml/1.3.0/mod.js +53 -0
  76. package/esm/deps/jsr.io/@std/yaml/1.3.0/parse.d.ts +79 -0
  77. package/esm/deps/jsr.io/@std/yaml/1.3.0/parse.d.ts.map +1 -0
  78. package/esm/deps/jsr.io/@std/yaml/1.3.0/parse.js +91 -0
  79. package/esm/deps/jsr.io/@std/yaml/1.3.0/stringify.d.ts +108 -0
  80. package/esm/deps/jsr.io/@std/yaml/1.3.0/stringify.d.ts.map +1 -0
  81. package/esm/deps/jsr.io/@std/yaml/1.3.0/stringify.js +33 -0
  82. package/esm/deps/jsr.io/@std/yaml/1.3.0/types.d.ts +111 -0
  83. package/esm/deps/jsr.io/@std/yaml/1.3.0/types.d.ts.map +1 -0
  84. package/esm/deps/jsr.io/@std/yaml/1.3.0/types.js +104 -0
  85. package/esm/mod.d.ts +49 -0
  86. package/esm/mod.d.ts.map +1 -0
  87. package/esm/mod.js +42 -0
  88. package/esm/package.json +3 -0
  89. package/esm/src/core/collector/collector.d.ts +58 -0
  90. package/esm/src/core/collector/collector.d.ts.map +1 -0
  91. package/esm/src/core/collector/collector.js +60 -0
  92. package/esm/src/core/collector/extractor.d.ts +33 -0
  93. package/esm/src/core/collector/extractor.d.ts.map +1 -0
  94. package/esm/src/core/collector/extractor.js +53 -0
  95. package/esm/src/core/collector/mod.d.ts +9 -0
  96. package/esm/src/core/collector/mod.d.ts.map +1 -0
  97. package/esm/src/core/collector/mod.js +7 -0
  98. package/esm/src/core/components/components.d.ts +4 -0
  99. package/esm/src/core/components/components.d.ts.map +1 -0
  100. package/esm/src/core/components/components.js +28 -0
  101. package/esm/src/core/components/mod.d.ts +2 -0
  102. package/esm/src/core/components/mod.d.ts.map +1 -0
  103. package/esm/src/core/components/mod.js +1 -0
  104. package/esm/src/core/composer/composer.d.ts +35 -0
  105. package/esm/src/core/composer/composer.d.ts.map +1 -0
  106. package/esm/src/core/composer/composer.js +72 -0
  107. package/esm/src/core/composer/mod.d.ts +7 -0
  108. package/esm/src/core/composer/mod.d.ts.map +1 -0
  109. package/esm/src/core/composer/mod.js +6 -0
  110. package/esm/src/core/mod.d.ts +15 -0
  111. package/esm/src/core/mod.d.ts.map +1 -0
  112. package/esm/src/core/mod.js +16 -0
  113. package/esm/src/core/sync/mod.d.ts +9 -0
  114. package/esm/src/core/sync/mod.d.ts.map +1 -0
  115. package/esm/src/core/sync/mod.js +7 -0
  116. package/esm/src/core/sync/resolver.d.ts +51 -0
  117. package/esm/src/core/sync/resolver.d.ts.map +1 -0
  118. package/esm/src/core/sync/resolver.js +88 -0
  119. package/esm/src/core/sync/validator.d.ts +39 -0
  120. package/esm/src/core/sync/validator.d.ts.map +1 -0
  121. package/esm/src/core/sync/validator.js +65 -0
  122. package/esm/src/core/types/components.d.ts +46 -0
  123. package/esm/src/core/types/components.d.ts.map +1 -0
  124. package/esm/src/core/types/components.js +2 -0
  125. package/esm/src/core/types/descriptor.d.ts +47 -0
  126. package/esm/src/core/types/descriptor.d.ts.map +1 -0
  127. package/esm/src/core/types/descriptor.js +6 -0
  128. package/esm/src/core/types/errors.d.ts +69 -0
  129. package/esm/src/core/types/errors.d.ts.map +1 -0
  130. package/esm/src/core/types/errors.js +32 -0
  131. package/esm/src/core/types/layout.d.ts +100 -0
  132. package/esm/src/core/types/layout.d.ts.map +1 -0
  133. package/esm/src/core/types/layout.js +49 -0
  134. package/esm/src/core/types/mcp-apps.d.ts +56 -0
  135. package/esm/src/core/types/mcp-apps.d.ts.map +1 -0
  136. package/esm/src/core/types/mcp-apps.js +16 -0
  137. package/esm/src/core/types/mod.d.ts +17 -0
  138. package/esm/src/core/types/mod.d.ts.map +1 -0
  139. package/esm/src/core/types/mod.js +7 -0
  140. package/esm/src/core/types/orchestration.d.ts +37 -0
  141. package/esm/src/core/types/orchestration.d.ts.map +1 -0
  142. package/esm/src/core/types/orchestration.js +6 -0
  143. package/esm/src/core/types/resources.d.ts +37 -0
  144. package/esm/src/core/types/resources.d.ts.map +1 -0
  145. package/esm/src/core/types/resources.js +1 -0
  146. package/esm/src/core/types/sync-rules.d.ts +80 -0
  147. package/esm/src/core/types/sync-rules.d.ts.map +1 -0
  148. package/esm/src/core/types/sync-rules.js +6 -0
  149. package/esm/src/deploy/mod.d.ts +12 -0
  150. package/esm/src/deploy/mod.d.ts.map +1 -0
  151. package/esm/src/deploy/mod.js +11 -0
  152. package/esm/src/deploy/types.d.ts +119 -0
  153. package/esm/src/deploy/types.d.ts.map +1 -0
  154. package/esm/src/deploy/types.js +19 -0
  155. package/esm/src/host/components-contract.d.ts +6 -0
  156. package/esm/src/host/components-contract.d.ts.map +1 -0
  157. package/esm/src/host/components-contract.js +5 -0
  158. package/esm/src/host/mod.d.ts +15 -0
  159. package/esm/src/host/mod.d.ts.map +1 -0
  160. package/esm/src/host/mod.js +14 -0
  161. package/esm/src/host/renderer/css/base.d.ts +23 -0
  162. package/esm/src/host/renderer/css/base.d.ts.map +1 -0
  163. package/esm/src/host/renderer/css/base.js +48 -0
  164. package/esm/src/host/renderer/css/layouts.d.ts +31 -0
  165. package/esm/src/host/renderer/css/layouts.d.ts.map +1 -0
  166. package/esm/src/host/renderer/css/layouts.js +129 -0
  167. package/esm/src/host/renderer/html-generator.d.ts +36 -0
  168. package/esm/src/host/renderer/html-generator.d.ts.map +1 -0
  169. package/esm/src/host/renderer/html-generator.js +227 -0
  170. package/esm/src/host/renderer/js/event-bus.d.ts +33 -0
  171. package/esm/src/host/renderer/js/event-bus.d.ts.map +1 -0
  172. package/esm/src/host/renderer/js/event-bus.js +592 -0
  173. package/esm/src/host/renderer/mod.d.ts +9 -0
  174. package/esm/src/host/renderer/mod.d.ts.map +1 -0
  175. package/esm/src/host/renderer/mod.js +7 -0
  176. package/esm/src/host/renderer/options.d.ts +126 -0
  177. package/esm/src/host/renderer/options.d.ts.map +1 -0
  178. package/esm/src/host/renderer/options.js +1 -0
  179. package/esm/src/host/serve.d.ts +55 -0
  180. package/esm/src/host/serve.d.ts.map +1 -0
  181. package/esm/src/host/serve.js +89 -0
  182. package/esm/src/host/types.d.ts +42 -0
  183. package/esm/src/host/types.d.ts.map +1 -0
  184. package/esm/src/host/types.js +9 -0
  185. package/esm/src/runtime/cluster.d.ts +92 -0
  186. package/esm/src/runtime/cluster.d.ts.map +1 -0
  187. package/esm/src/runtime/cluster.js +887 -0
  188. package/esm/src/runtime/compose.d.ts +67 -0
  189. package/esm/src/runtime/compose.d.ts.map +1 -0
  190. package/esm/src/runtime/compose.js +288 -0
  191. package/esm/src/runtime/host-dashboard-types.d.ts +79 -0
  192. package/esm/src/runtime/host-dashboard-types.d.ts.map +1 -0
  193. package/esm/src/runtime/host-dashboard-types.js +9 -0
  194. package/esm/src/runtime/host-dashboard.d.ts +29 -0
  195. package/esm/src/runtime/host-dashboard.d.ts.map +1 -0
  196. package/esm/src/runtime/host-dashboard.js +559 -0
  197. package/esm/src/runtime/manifest.d.ts +58 -0
  198. package/esm/src/runtime/manifest.d.ts.map +1 -0
  199. package/esm/src/runtime/manifest.js +144 -0
  200. package/esm/src/runtime/mod.d.ts +18 -0
  201. package/esm/src/runtime/mod.d.ts.map +1 -0
  202. package/esm/src/runtime/mod.js +21 -0
  203. package/esm/src/runtime/template.d.ts +79 -0
  204. package/esm/src/runtime/template.d.ts.map +1 -0
  205. package/esm/src/runtime/template.js +287 -0
  206. package/esm/src/runtime/types.d.ts +345 -0
  207. package/esm/src/runtime/types.d.ts.map +1 -0
  208. package/esm/src/runtime/types.js +28 -0
  209. package/esm/src/sdk/compose-events.d.ts +130 -0
  210. package/esm/src/sdk/compose-events.d.ts.map +1 -0
  211. package/esm/src/sdk/compose-events.js +127 -0
  212. package/esm/src/sdk/composition-validator.d.ts +97 -0
  213. package/esm/src/sdk/composition-validator.d.ts.map +1 -0
  214. package/esm/src/sdk/composition-validator.js +178 -0
  215. package/esm/src/sdk/mcp-sdk.d.ts +92 -0
  216. package/esm/src/sdk/mcp-sdk.d.ts.map +1 -0
  217. package/esm/src/sdk/mcp-sdk.js +54 -0
  218. package/esm/src/sdk/mod.d.ts +15 -0
  219. package/esm/src/sdk/mod.d.ts.map +1 -0
  220. package/esm/src/sdk/mod.js +10 -0
  221. package/esm/src/sdk/ui-meta-builder.d.ts +99 -0
  222. package/esm/src/sdk/ui-meta-builder.d.ts.map +1 -0
  223. package/esm/src/sdk/ui-meta-builder.js +53 -0
  224. package/esm/src/version.d.ts +30 -0
  225. package/esm/src/version.d.ts.map +1 -0
  226. package/esm/src/version.js +29 -0
  227. package/package.json +58 -4
  228. package/script/_dnt.polyfills.d.ts +18 -0
  229. package/script/_dnt.polyfills.d.ts.map +1 -0
  230. package/script/_dnt.polyfills.js +16 -0
  231. package/script/_dnt.shims.d.ts +2 -0
  232. package/script/_dnt.shims.d.ts.map +1 -0
  233. package/script/_dnt.shims.js +60 -0
  234. package/script/deps/jsr.io/@std/yaml/1.3.0/_chars.d.ts +33 -0
  235. package/script/deps/jsr.io/@std/yaml/1.3.0/_chars.d.ts.map +1 -0
  236. package/script/deps/jsr.io/@std/yaml/1.3.0/_chars.js +55 -0
  237. package/script/deps/jsr.io/@std/yaml/1.3.0/_dumper_state.d.ts +106 -0
  238. package/script/deps/jsr.io/@std/yaml/1.3.0/_dumper_state.d.ts.map +1 -0
  239. package/script/deps/jsr.io/@std/yaml/1.3.0/_dumper_state.js +640 -0
  240. package/script/deps/jsr.io/@std/yaml/1.3.0/_loader_state.d.ts +67 -0
  241. package/script/deps/jsr.io/@std/yaml/1.3.0/_loader_state.d.ts.map +1 -0
  242. package/script/deps/jsr.io/@std/yaml/1.3.0/_loader_state.js +1397 -0
  243. package/script/deps/jsr.io/@std/yaml/1.3.0/_schema.d.ts +44 -0
  244. package/script/deps/jsr.io/@std/yaml/1.3.0/_schema.d.ts.map +1 -0
  245. package/script/deps/jsr.io/@std/yaml/1.3.0/_schema.js +121 -0
  246. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/binary.d.ts +3 -0
  247. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/binary.d.ts.map +1 -0
  248. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/binary.js +106 -0
  249. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/bool.d.ts +3 -0
  250. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/bool.d.ts.map +1 -0
  251. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/bool.js +35 -0
  252. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/float.d.ts +3 -0
  253. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/float.d.ts.map +1 -0
  254. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/float.js +99 -0
  255. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/int.d.ts +3 -0
  256. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/int.d.ts.map +1 -0
  257. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/int.js +162 -0
  258. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/map.d.ts +3 -0
  259. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/map.d.ts.map +1 -0
  260. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/map.js +17 -0
  261. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/merge.d.ts +3 -0
  262. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/merge.d.ts.map +1 -0
  263. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/merge.js +13 -0
  264. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/nil.d.ts +3 -0
  265. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/nil.d.ts.map +1 -0
  266. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/nil.js +25 -0
  267. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/omap.d.ts +3 -0
  268. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/omap.d.ts.map +1 -0
  269. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/omap.js +32 -0
  270. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/pairs.d.ts +3 -0
  271. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/pairs.d.ts.map +1 -0
  272. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/pairs.js +22 -0
  273. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/regexp.d.ts +3 -0
  274. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/regexp.d.ts.map +1 -0
  275. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/regexp.js +33 -0
  276. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/seq.d.ts +3 -0
  277. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/seq.d.ts.map +1 -0
  278. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/seq.js +13 -0
  279. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/set.d.ts +3 -0
  280. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/set.d.ts.map +1 -0
  281. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/set.js +17 -0
  282. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/str.d.ts +3 -0
  283. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/str.d.ts.map +1 -0
  284. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/str.js +12 -0
  285. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/timestamp.d.ts +3 -0
  286. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/timestamp.d.ts.map +1 -0
  287. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/timestamp.js +84 -0
  288. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/undefined.d.ts +3 -0
  289. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/undefined.d.ts.map +1 -0
  290. package/script/deps/jsr.io/@std/yaml/1.3.0/_type/undefined.js +23 -0
  291. package/script/deps/jsr.io/@std/yaml/1.3.0/_type.d.ts +32 -0
  292. package/script/deps/jsr.io/@std/yaml/1.3.0/_type.d.ts.map +1 -0
  293. package/script/deps/jsr.io/@std/yaml/1.3.0/_type.js +7 -0
  294. package/script/deps/jsr.io/@std/yaml/1.3.0/_utils.d.ts +4 -0
  295. package/script/deps/jsr.io/@std/yaml/1.3.0/_utils.d.ts.map +1 -0
  296. package/script/deps/jsr.io/@std/yaml/1.3.0/_utils.js +18 -0
  297. package/script/deps/jsr.io/@std/yaml/1.3.0/mod.d.ts +51 -0
  298. package/script/deps/jsr.io/@std/yaml/1.3.0/mod.d.ts.map +1 -0
  299. package/script/deps/jsr.io/@std/yaml/1.3.0/mod.js +69 -0
  300. package/script/deps/jsr.io/@std/yaml/1.3.0/parse.d.ts +79 -0
  301. package/script/deps/jsr.io/@std/yaml/1.3.0/parse.d.ts.map +1 -0
  302. package/script/deps/jsr.io/@std/yaml/1.3.0/parse.js +95 -0
  303. package/script/deps/jsr.io/@std/yaml/1.3.0/stringify.d.ts +108 -0
  304. package/script/deps/jsr.io/@std/yaml/1.3.0/stringify.d.ts.map +1 -0
  305. package/script/deps/jsr.io/@std/yaml/1.3.0/stringify.js +36 -0
  306. package/script/deps/jsr.io/@std/yaml/1.3.0/types.d.ts +111 -0
  307. package/script/deps/jsr.io/@std/yaml/1.3.0/types.d.ts.map +1 -0
  308. package/script/deps/jsr.io/@std/yaml/1.3.0/types.js +108 -0
  309. package/script/mod.d.ts +49 -0
  310. package/script/mod.d.ts.map +1 -0
  311. package/script/mod.js +60 -0
  312. package/script/package.json +3 -0
  313. package/script/src/core/collector/collector.d.ts +58 -0
  314. package/script/src/core/collector/collector.d.ts.map +1 -0
  315. package/script/src/core/collector/collector.js +63 -0
  316. package/script/src/core/collector/extractor.d.ts +33 -0
  317. package/script/src/core/collector/extractor.d.ts.map +1 -0
  318. package/script/src/core/collector/extractor.js +56 -0
  319. package/script/src/core/collector/mod.d.ts +9 -0
  320. package/script/src/core/collector/mod.d.ts.map +1 -0
  321. package/script/src/core/collector/mod.js +12 -0
  322. package/script/src/core/components/components.d.ts +4 -0
  323. package/script/src/core/components/components.d.ts.map +1 -0
  324. package/script/src/core/components/components.js +31 -0
  325. package/script/src/core/components/mod.d.ts +2 -0
  326. package/script/src/core/components/mod.d.ts.map +1 -0
  327. package/script/src/core/components/mod.js +5 -0
  328. package/script/src/core/composer/composer.d.ts +35 -0
  329. package/script/src/core/composer/composer.d.ts.map +1 -0
  330. package/script/src/core/composer/composer.js +75 -0
  331. package/script/src/core/composer/mod.d.ts +7 -0
  332. package/script/src/core/composer/mod.d.ts.map +1 -0
  333. package/script/src/core/composer/mod.js +10 -0
  334. package/script/src/core/mod.d.ts +15 -0
  335. package/script/src/core/mod.d.ts.map +1 -0
  336. package/script/src/core/mod.js +30 -0
  337. package/script/src/core/sync/mod.d.ts +9 -0
  338. package/script/src/core/sync/mod.d.ts.map +1 -0
  339. package/script/src/core/sync/mod.js +12 -0
  340. package/script/src/core/sync/resolver.d.ts +51 -0
  341. package/script/src/core/sync/resolver.d.ts.map +1 -0
  342. package/script/src/core/sync/resolver.js +91 -0
  343. package/script/src/core/sync/validator.d.ts +39 -0
  344. package/script/src/core/sync/validator.d.ts.map +1 -0
  345. package/script/src/core/sync/validator.js +68 -0
  346. package/script/src/core/types/components.d.ts +46 -0
  347. package/script/src/core/types/components.d.ts.map +1 -0
  348. package/script/src/core/types/components.js +3 -0
  349. package/script/src/core/types/descriptor.d.ts +47 -0
  350. package/script/src/core/types/descriptor.d.ts.map +1 -0
  351. package/script/src/core/types/descriptor.js +7 -0
  352. package/script/src/core/types/errors.d.ts +69 -0
  353. package/script/src/core/types/errors.d.ts.map +1 -0
  354. package/script/src/core/types/errors.js +35 -0
  355. package/script/src/core/types/layout.d.ts +100 -0
  356. package/script/src/core/types/layout.d.ts.map +1 -0
  357. package/script/src/core/types/layout.js +55 -0
  358. package/script/src/core/types/mcp-apps.d.ts +56 -0
  359. package/script/src/core/types/mcp-apps.d.ts.map +1 -0
  360. package/script/src/core/types/mcp-apps.js +17 -0
  361. package/script/src/core/types/mod.d.ts +17 -0
  362. package/script/src/core/types/mod.d.ts.map +1 -0
  363. package/script/src/core/types/mod.js +15 -0
  364. package/script/src/core/types/orchestration.d.ts +37 -0
  365. package/script/src/core/types/orchestration.d.ts.map +1 -0
  366. package/script/src/core/types/orchestration.js +7 -0
  367. package/script/src/core/types/resources.d.ts +37 -0
  368. package/script/src/core/types/resources.d.ts.map +1 -0
  369. package/script/src/core/types/resources.js +2 -0
  370. package/script/src/core/types/sync-rules.d.ts +80 -0
  371. package/script/src/core/types/sync-rules.d.ts.map +1 -0
  372. package/script/src/core/types/sync-rules.js +7 -0
  373. package/script/src/deploy/mod.d.ts +12 -0
  374. package/script/src/deploy/mod.d.ts.map +1 -0
  375. package/script/src/deploy/mod.js +15 -0
  376. package/script/src/deploy/types.d.ts +119 -0
  377. package/script/src/deploy/types.d.ts.map +1 -0
  378. package/script/src/deploy/types.js +22 -0
  379. package/script/src/host/components-contract.d.ts +6 -0
  380. package/script/src/host/components-contract.d.ts.map +1 -0
  381. package/script/src/host/components-contract.js +8 -0
  382. package/script/src/host/mod.d.ts +15 -0
  383. package/script/src/host/mod.d.ts.map +1 -0
  384. package/script/src/host/mod.js +21 -0
  385. package/script/src/host/renderer/css/base.d.ts +23 -0
  386. package/script/src/host/renderer/css/base.d.ts.map +1 -0
  387. package/script/src/host/renderer/css/base.js +51 -0
  388. package/script/src/host/renderer/css/layouts.d.ts +31 -0
  389. package/script/src/host/renderer/css/layouts.d.ts.map +1 -0
  390. package/script/src/host/renderer/css/layouts.js +132 -0
  391. package/script/src/host/renderer/html-generator.d.ts +36 -0
  392. package/script/src/host/renderer/html-generator.d.ts.map +1 -0
  393. package/script/src/host/renderer/html-generator.js +231 -0
  394. package/script/src/host/renderer/js/event-bus.d.ts +33 -0
  395. package/script/src/host/renderer/js/event-bus.d.ts.map +1 -0
  396. package/script/src/host/renderer/js/event-bus.js +595 -0
  397. package/script/src/host/renderer/mod.d.ts +9 -0
  398. package/script/src/host/renderer/mod.d.ts.map +1 -0
  399. package/script/src/host/renderer/mod.js +12 -0
  400. package/script/src/host/renderer/options.d.ts +126 -0
  401. package/script/src/host/renderer/options.d.ts.map +1 -0
  402. package/script/src/host/renderer/options.js +2 -0
  403. package/script/src/host/serve.d.ts +55 -0
  404. package/script/src/host/serve.d.ts.map +1 -0
  405. package/script/src/host/serve.js +92 -0
  406. package/script/src/host/types.d.ts +42 -0
  407. package/script/src/host/types.d.ts.map +1 -0
  408. package/script/src/host/types.js +10 -0
  409. package/script/src/runtime/cluster.d.ts +92 -0
  410. package/script/src/runtime/cluster.d.ts.map +1 -0
  411. package/script/src/runtime/cluster.js +892 -0
  412. package/script/src/runtime/compose.d.ts +67 -0
  413. package/script/src/runtime/compose.d.ts.map +1 -0
  414. package/script/src/runtime/compose.js +292 -0
  415. package/script/src/runtime/host-dashboard-types.d.ts +79 -0
  416. package/script/src/runtime/host-dashboard-types.d.ts.map +1 -0
  417. package/script/src/runtime/host-dashboard-types.js +10 -0
  418. package/script/src/runtime/host-dashboard.d.ts +29 -0
  419. package/script/src/runtime/host-dashboard.d.ts.map +1 -0
  420. package/script/src/runtime/host-dashboard.js +563 -0
  421. package/script/src/runtime/manifest.d.ts +58 -0
  422. package/script/src/runtime/manifest.d.ts.map +1 -0
  423. package/script/src/runtime/manifest.js +150 -0
  424. package/script/src/runtime/mod.d.ts +18 -0
  425. package/script/src/runtime/mod.d.ts.map +1 -0
  426. package/script/src/runtime/mod.js +41 -0
  427. package/script/src/runtime/template.d.ts +79 -0
  428. package/script/src/runtime/template.d.ts.map +1 -0
  429. package/script/src/runtime/template.js +295 -0
  430. package/script/src/runtime/types.d.ts +345 -0
  431. package/script/src/runtime/types.d.ts.map +1 -0
  432. package/script/src/runtime/types.js +31 -0
  433. package/script/src/sdk/compose-events.d.ts +130 -0
  434. package/script/src/sdk/compose-events.d.ts.map +1 -0
  435. package/script/src/sdk/compose-events.js +154 -0
  436. package/script/src/sdk/composition-validator.d.ts +97 -0
  437. package/script/src/sdk/composition-validator.d.ts.map +1 -0
  438. package/script/src/sdk/composition-validator.js +181 -0
  439. package/script/src/sdk/mcp-sdk.d.ts +92 -0
  440. package/script/src/sdk/mcp-sdk.d.ts.map +1 -0
  441. package/script/src/sdk/mcp-sdk.js +57 -0
  442. package/script/src/sdk/mod.d.ts +15 -0
  443. package/script/src/sdk/mod.d.ts.map +1 -0
  444. package/script/src/sdk/mod.js +18 -0
  445. package/script/src/sdk/ui-meta-builder.d.ts +99 -0
  446. package/script/src/sdk/ui-meta-builder.d.ts.map +1 -0
  447. package/script/src/sdk/ui-meta-builder.js +56 -0
  448. package/script/src/version.d.ts +30 -0
  449. package/script/src/version.d.ts.map +1 -0
  450. package/script/src/version.js +33 -0
package/README.md CHANGED
@@ -1,3 +1,525 @@
1
- # Temporary Holding Version
1
+ # mcp-compose
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Lightweight Deno library for composing and synchronizing multiple MCP Apps UIs into composite
4
+ dashboards.
5
+
6
+ **Your MCP servers already have UIs. mcp-compose makes them talk to each other.**
7
+
8
+ ## Positioning
9
+
10
+ `mcp-compose` is a composition primitive for developers, integrators, and agents. It consumes
11
+ explicit orchestration plus MCP tool results and renders a composite UI. It does not provide an
12
+ end-user or no-code dashboard builder; intent-first authoring belongs in a higher product layer
13
+ built on top of this library.
14
+
15
+ ## Static composition and interactive local hosting
16
+
17
+ The core pipeline and `renderComposite()` remain deterministic, pure composition primitives. They
18
+ can produce a static iframe layout without connecting a browser back to MCP.
19
+
20
+ When an MCP App needs its initial tool result, `resources/read`, or an App-initiated tool call, use
21
+ the explicit runtime host:
22
+
23
+ ```ts
24
+ import { composeAndServeDashboard } from "@mcpview/compose/runtime";
25
+
26
+ const dashboard = await composeAndServeDashboard({ manifests, template });
27
+ console.log(dashboard.url);
28
+ // dashboard.shutdown() closes the local listeners and MCP cluster.
29
+ ```
30
+
31
+ It is a loopback-only host for one local dashboard, not a general MCP proxy. It resolves App
32
+ resources with MCP `resources/read`; it never assumes an upstream server-specific `/ui` route. See
33
+ the [runtime contract](./src/runtime/contract.md) and
34
+ [ADR 0004](./docs/decision-records/0004-local-multi-app-host-runtime.md) for the security and
35
+ deployment boundary.
36
+
37
+ ## Why mcp-compose?
38
+
39
+ MCP Apps (SEP-1865) let each MCP server expose its own UI via `_meta.ui.resourceUri`. But when an
40
+ agent calls 3 tools and gets 3 separate UIs, they sit in isolation — no shared state, no event
41
+ routing, no coordinated layout.
42
+
43
+ **mcp-compose** bridges that gap:
44
+
45
+ | Without mcp-compose | With mcp-compose |
46
+ | ------------------------------------------ | -------------------------------------------- |
47
+ | 3 separate iframes, no communication | Single dashboard with layout + event routing |
48
+ | Manual postMessage wiring per tool pair | Declarative sync rules (`from/event/to`) |
49
+ | Each UI builds its own host handshake | Automatic MCP Apps protocol compliance |
50
+ | Agent must manually track UI relationships | Pipeline: collect -> compose -> render |
51
+
52
+ **For agents:** the pipeline is three pure function calls with zero ambient knowledge required.
53
+ **For integrators:** you can render a working composite dashboard without hand-writing host HTML or
54
+ `postMessage` plumbing.
55
+
56
+ ## Install
57
+
58
+ ```bash
59
+ # Deno (JSR)
60
+ deno add jsr:@mcpview/compose
61
+
62
+ # Node (npm)
63
+ npm i @mcpview/compose
64
+ ```
65
+
66
+ ```typescript
67
+ import { buildCompositeUi, createCollector, renderComposite } from "@mcpview/compose";
68
+ ```
69
+
70
+ ## MCP SDK compatibility
71
+
72
+ Compose uses MCP Apps 2.x and the split MCP SDK 2.x packages. Integrations importing SDK types or
73
+ classes should use `@modelcontextprotocol/client` instead of the former monolithic SDK package. MCP
74
+ Apps 2.x requires `@modelcontextprotocol/client@^2.0.0` and `zod@^4.2.0`; this workspace uses
75
+ client/core `^2.3.1` and ext-apps `^2.0.3`. Node consumers require Node.js 20 or later. The
76
+ structural `createMcpSdkCollector()` adapter also accepts results from existing SDK clients without
77
+ importing those clients into the composition core.
78
+
79
+ The runtime retains its stateless-first transport selection and its initialized Streamable HTTP
80
+ fallback. Each connection owns its SDK client and session; closing it terminates the remote session
81
+ before closing the client. `listTools()` and `listResources()` return one page plus `nextCursor`,
82
+ and `readResource()` always reads from its source. Listed tool definitions retain SDK output-schema
83
+ validation across explicitly fetched pages; refreshing the first page, a tool-list change, or
84
+ closing the connection invalidates them. Tool results with `isError: true` remain results; remote
85
+ protocol failures and local request timeouts become the existing Compose `RuntimeError` codes, with
86
+ the original SDK error available as `cause`.
87
+
88
+ The Apps iframe protocol is unchanged by the dependency migration. Compose's conversation and
89
+ model-context host callbacks remain deferred; this migration adds no runtime agent or callbacks. See
90
+ the
91
+ [official MCP Apps migration guide](https://apps.extensions.modelcontextprotocol.io/api/documents/migrate-to-v2.html)
92
+ for SDK import, peer dependency, and error-class changes.
93
+
94
+ ## Quick Start
95
+
96
+ A complete, runnable example — from MCP tool results to rendered HTML:
97
+
98
+ ```typescript
99
+ import {
100
+ buildCompositeUi,
101
+ createCollector,
102
+ renderComposite,
103
+ validateSyncRules,
104
+ } from "@mcpview/compose";
105
+
106
+ // 1. Collect UI resources from MCP tool results
107
+ const collector = createCollector();
108
+
109
+ // Simulate MCP tool call results with _meta.ui.resourceUri
110
+ const pgResult = {
111
+ content: [{ type: "text", text: "Query executed" }],
112
+ _meta: { ui: { resourceUri: "ui://postgres/table/sales-q1" } },
113
+ };
114
+ const vizResult = {
115
+ content: [{ type: "text", text: "Chart rendered" }],
116
+ _meta: { ui: { resourceUri: "ui://viz/chart/bar-sales" } },
117
+ };
118
+
119
+ collector.collect("postgres:query", pgResult, { query: "SELECT * FROM sales" });
120
+ collector.collect("viz:render", vizResult);
121
+
122
+ const resources = collector.getResources();
123
+ // resources.length === 2, slots [0, 1]
124
+
125
+ // 2. (Optional) Validate sync rules before composing
126
+ const orchestration = {
127
+ layout: "split" as const,
128
+ sync: [
129
+ { from: "postgres:query", event: "filter", to: "viz:render", action: "update" },
130
+ ],
131
+ sharedContext: ["query"],
132
+ };
133
+
134
+ const validation = validateSyncRules(
135
+ orchestration.sync,
136
+ resources.map((r) => r.source),
137
+ );
138
+ // validation.valid === true
139
+
140
+ // 3. Build a composite descriptor
141
+ const descriptor = buildCompositeUi(resources, orchestration);
142
+ // descriptor.sync[0] === { from: 0, event: "filter", to: 1, action: "update" }
143
+ // descriptor.sharedContext === { query: "SELECT * FROM sales" }
144
+
145
+ // 4. Render to self-contained HTML
146
+ const html = renderComposite(descriptor);
147
+ // html is a complete HTML document with layout CSS, event bus JS, and iframes
148
+ ```
149
+
150
+ ## Pipeline
151
+
152
+ ```
153
+ Collector -> Composer -> Renderer
154
+ (collect) (build) (render)
155
+ ```
156
+
157
+ Each step is a pure function. Use them independently or together.
158
+
159
+ ## Layouts
160
+
161
+ | Layout | Description |
162
+ | ------- | ----------------------------- |
163
+ | `split` | Side-by-side panels (flexbox) |
164
+ | `tabs` | Tabbed interface with tab bar |
165
+ | `grid` | Auto-fit grid for dashboards |
166
+ | `stack` | Vertical stack (default) |
167
+
168
+ ## Sync Rules
169
+
170
+ Declarative event routing between UIs:
171
+
172
+ ```typescript
173
+ const orchestration = {
174
+ layout: "split",
175
+ sync: [
176
+ // When postgres:query emits "filter", update viz:render
177
+ { from: "postgres:query", event: "filter", to: "viz:render", action: "update" },
178
+
179
+ // Broadcast to all UIs when date changes
180
+ { from: "date:picker", event: "change", to: "*", action: "refresh" },
181
+ ],
182
+ // Extract and share context across all UIs
183
+ sharedContext: ["workflowId", "userId"],
184
+ };
185
+ ```
186
+
187
+ Stable component IDs may be used in routes, including when the same tool is instantiated more than
188
+ once. A repeated tool name without explicit IDs is rejected instead of silently routing to the last
189
+ panel.
190
+
191
+ ## Component surfaces
192
+
193
+ A componentized MCP App advertises small domain components and may expose a standalone default
194
+ surface. Component-only Apps omit the default and require Compose to select and arrange components
195
+ explicitly:
196
+
197
+ ```yaml
198
+ sources:
199
+ - id: thermal
200
+ manifest: mcp-modelica
201
+ surface:
202
+ layout: { type: grid, columns: 2, gap: sm }
203
+ components:
204
+ - { id: status, component: modelica.execution-status }
205
+ - { id: metrics, component: modelica.metrics }
206
+ calls:
207
+ - tool: modelica_simulate
208
+ ```
209
+
210
+ The viewer advertises `io.casys.mcp.view-components/v1` during `ui/initialize`. Compose sends the
211
+ requested surface under `io.casys.mcp.surface/v1`; without an explicit request, the viewer's
212
+ standalone default is used when one exists, otherwise resolution returns `surface-required`. Unknown
213
+ keys resolve explicitly instead of silently disappearing. Legacy Apps continue unchanged.
214
+ `ui/compose/event` remains the cross-view event plane.
215
+
216
+ Components may also advertise event ports. A host can declare one stable policy and let Compose
217
+ resolve it against the components active in the current session:
218
+
219
+ ```json
220
+ {
221
+ "orchestration": {
222
+ "layout": "split",
223
+ "portSync": [{
224
+ "event": "semantic.selection.changed",
225
+ "action": "semantic.selection.apply"
226
+ }]
227
+ }
228
+ }
229
+ ```
230
+
231
+ `portSync` is dynamic in topology, not in meaning. It routes only when the source surface currently
232
+ contains a component declaring the event and the target surface contains a distinct component
233
+ declaring the action. The payload is forwarded unchanged; Compose performs no identifier mapping.
234
+ Explicit `sync` rules remain available for named one-off routes.
235
+
236
+ For preflight, put the same `emits` / `accepts` names in the tool's `_meta.ui` or Compose manifest.
237
+ `validateComposition(tools, sync, portSync)` can then prove that at least one distinct source/target
238
+ pair exists before the Apps are opened. The runtime component catalog confirms the actual mounted
239
+ surface during `ui/initialize`.
240
+
241
+ See [`ADR 0005`](docs/decision-records/0005-component-surfaces-and-a2ui-boundary.md) for the
242
+ contract and A2UI boundary.
243
+
244
+ ## Validation
245
+
246
+ Validate sync rules before composition:
247
+
248
+ ```typescript
249
+ import { validateSyncRules } from "@mcpview/compose";
250
+
251
+ const result = validateSyncRules(
252
+ [{ from: "a", event: "click", to: "unknown", action: "update" }],
253
+ ["a", "b"],
254
+ );
255
+ // result.valid === false
256
+ // result.issues[0].code === "ORPHAN_SYNC_REFERENCE"
257
+ ```
258
+
259
+ For a dynamic port policy, validate the pre-open tool manifests as well:
260
+
261
+ ```ts
262
+ const result = validateComposition(tools, [], [{
263
+ event: "semantic.selection.changed",
264
+ action: "semantic.selection.apply",
265
+ }]);
266
+ ```
267
+
268
+ ## Collector API
269
+
270
+ ```typescript
271
+ import { createCollector } from "@mcpview/compose";
272
+
273
+ const collector = createCollector();
274
+
275
+ // Collect from MCP tool results (auto-extracts _meta.ui.resourceUri)
276
+ const resource = collector.collect("tool:name", mcpToolResult, optionalContext);
277
+ // Returns CollectedUiResource | null
278
+
279
+ collector.getResources(); // All collected resources in slot order
280
+ collector.clear(); // Reset
281
+ ```
282
+
283
+ ## MCP SDK Adapter
284
+
285
+ For projects using `CallToolResult` from `@modelcontextprotocol/client` (or an existing client with
286
+ the same result shape):
287
+
288
+ ```typescript
289
+ import { createMcpSdkCollector } from "@mcpview/compose";
290
+
291
+ const collector = createMcpSdkCollector();
292
+
293
+ // Accepts SDK CallToolResult objects directly
294
+ // Automatically skips error results (isError: true)
295
+ collector.collectFromSdk("postgres:query", sdkCallToolResult, { query: "..." });
296
+
297
+ // Access the underlying core collector if needed
298
+ collector.inner.collect("manual", rawResult);
299
+
300
+ const resources = collector.getResources();
301
+ ```
302
+
303
+ ## MCP Server Integration
304
+
305
+ ### Declaring composable tools
306
+
307
+ Use `uiMeta()` to declare `emits` and `accepts` on your tools:
308
+
309
+ ```typescript
310
+ import { uiMeta } from "@mcpview/compose/sdk";
311
+
312
+ const tools = [
313
+ {
314
+ name: "einvoice_invoice_search",
315
+ ...uiMeta({
316
+ resourceUri: "ui://mcp-einvoice/doclist-viewer",
317
+ emits: ["invoice.selected"],
318
+ accepts: ["filter.apply"],
319
+ }),
320
+ },
321
+ ];
322
+ ```
323
+
324
+ If your server uses `@mcpview/server`, import the helpers from the compose SDK:
325
+
326
+ ```typescript
327
+ import { composeEvents, uiMeta } from "@mcpview/compose/sdk";
328
+ ```
329
+
330
+ ### UI-side events with `composeEvents()`
331
+
332
+ UIs emit and listen to cross-UI events via a dedicated `ui/compose/event` channel, separate from the
333
+ MCP Apps protocol:
334
+
335
+ ```typescript
336
+ import { composeEvents } from "@mcpview/compose/sdk";
337
+
338
+ const events = composeEvents();
339
+ events.emit("invoice.selected", { invoiceId: "INV-001" });
340
+ events.on("filter.apply", (payload) => applyFilter(payload.data));
341
+ events.destroy(); // cleanup
342
+ ```
343
+
344
+ ## Runtime — Dashboard from templates
345
+
346
+ The runtime module starts MCP servers, calls tools, and feeds results through the core pipeline to
347
+ produce complete dashboards:
348
+
349
+ ```typescript
350
+ import { composeDashboardFromFiles } from "@mcpview/compose/runtime";
351
+
352
+ const result = await composeDashboardFromFiles(
353
+ "./manifests/", // directory of .json manifest files
354
+ "./dashboards/sales.json", // canonical agent-facing JSON manifest
355
+ { customer_id: "CUST-001" }, // runtime args (replaces {{placeholders}})
356
+ );
357
+ await Deno.writeTextFile("dashboard.html", result.html);
358
+ ```
359
+
360
+ The API above keeps the historical static rendering path. For a live local MCP Apps dashboard, load
361
+ the same template/manifests and call `composeAndServeDashboard()` instead:
362
+
363
+ ```ts
364
+ import { composeAndServeDashboard, loadManifests, loadTemplate } from "@mcpview/compose/runtime";
365
+
366
+ const manifests = await loadManifests("./manifests");
367
+ const template = await loadTemplate("./dashboards/sales.json");
368
+ const dashboard = await composeAndServeDashboard(
369
+ { manifests, template },
370
+ { open: true },
371
+ );
372
+ ```
373
+
374
+ The returned `ComposedDashboardHandle` owns its cluster until `dashboard.shutdown()` is called.
375
+ Standalone dashboards deny embedding by default. A trusted local product shell can opt in with an
376
+ exact reviewed origin:
377
+
378
+ ```ts
379
+ const dashboard = await composeAndServeDashboard(
380
+ { manifests, template },
381
+ { open: false, frameAncestors: ["http://127.0.0.1:60060"] },
382
+ );
383
+ ```
384
+
385
+ Only valid HTTP(S) origins are admitted to the generated `frame-ancestors` policy.
386
+
387
+ ### Manifest
388
+
389
+ Each MCP server has a JSON manifest describing its transport and tools. Generated at build time — no
390
+ server startup needed for discovery.
391
+
392
+ ```json
393
+ {
394
+ "name": "mcp-einvoice",
395
+ "transport": {
396
+ "type": "http",
397
+ "url": "http://localhost:3015",
398
+ "protocol": "auto"
399
+ },
400
+ "tools": [
401
+ {
402
+ "name": "invoice_search",
403
+ "emits": ["invoice.selected"],
404
+ "accepts": ["filter.apply"],
405
+ "appCallable": true
406
+ }
407
+ ]
408
+ }
409
+ ```
410
+
411
+ Transport: `"stdio"` (cluster starts the process with `--http --port=0`) or `"http"` (connect to an
412
+ existing server). HTTP `protocol` defaults to `"auto"`: stateless MCP `2026-07-28` is tried first,
413
+ then Compose falls back only for a compatible legacy response to initialized Streamable HTTP. Pin
414
+ `"streamable-http"` or `"stateless-2026-07-28"` when the endpoint is known.
415
+
416
+ `appCallable` is deny-by-default. Set it only for an MCP App method that may be invoked through a
417
+ local Compose panel. A panel can read only the original `ui://` resource that created it; it cannot
418
+ select another server or resource.
419
+
420
+ ### Template
421
+
422
+ Dashboard templates are YAML — typically generated by an agent, not written by hand.
423
+ `{{placeholders}}` are replaced with runtime args at compose time.
424
+
425
+ ```yaml
426
+ name: Sales Dashboard
427
+ sources:
428
+ - manifest: mcp-einvoice
429
+ calls:
430
+ - tool: invoice_search
431
+ args: { customer_id: "{{customer_id}}" }
432
+ - manifest: mcp-dataviz
433
+ calls:
434
+ - tool: render_chart
435
+ orchestration:
436
+ layout: split
437
+ sync:
438
+ - from: "mcp-einvoice:invoice_search"
439
+ event: invoice.selected
440
+ to: "mcp-dataviz:render_chart"
441
+ action: data.update
442
+ sharedContext:
443
+ - customer_id
444
+ ```
445
+
446
+ ## Event Bus Protocol
447
+
448
+ The rendered HTML includes a JavaScript event bus implementing:
449
+
450
+ - **`ui/initialize`** -- Handshake with host capabilities (MCP Apps SEP-1865)
451
+ - **`ui/notifications/initialized`** -- Gate before the full initial tool result is sent
452
+ - **`ui/compose/event`** -- Dedicated cross-UI event routing (mcp-compose protocol)
453
+ - **`ui/notifications/tool-result`** -- Full initiating result delivered after initialization
454
+ - **`tools/call` / `tools/list`** -- Only when the slot has a local route and manifest grant
455
+ - **`resources/read` / `resources/list`** -- Only for the resource bound to that slot
456
+
457
+ All messages use JSON-RPC 2.0 via `postMessage`.
458
+
459
+ Compose does not deliver messages to a conversation or model, so it does not advertise the `message`
460
+ host capability (including `message.text`). Viewers should treat this channel as unsupported. Direct
461
+ `ui/message` requests receive JSON-RPC error `-32601` (method not found), never a delivery
462
+ acknowledgement; notifications without an `id` receive no response. This follows the
463
+ [three-channel ADR's "No false success" rule](../view/docs/decision-records/0005-three-view-channels.md).
464
+
465
+ ## Error Codes
466
+
467
+ **Core errors (`ErrorCode`):**
468
+
469
+ | Code | Description |
470
+ | ----------------------- | -------------------------------------- |
471
+ | `ORPHAN_SYNC_REFERENCE` | Sync rule references unknown tool name |
472
+ | `CIRCULAR_SYNC_RULE` | Sync rule routes to itself |
473
+ | `INVALID_LAYOUT` | Invalid layout value |
474
+ | `MISSING_RESOURCE_URI` | Missing resourceUri in UI metadata |
475
+ | `NO_UI_METADATA` | Tool result has no UI metadata |
476
+ | `EMPTY_RESOURCES` | No resources provided to composer |
477
+
478
+ **Runtime errors (`RuntimeErrorCode`):**
479
+
480
+ | Code | Description |
481
+ | ----------------------- | ----------------------------------------- |
482
+ | `MANIFEST_PARSE_ERROR` | Invalid manifest JSON or structure |
483
+ | `TEMPLATE_PARSE_ERROR` | Invalid template YAML or structure |
484
+ | `MANIFEST_NOT_FOUND` | Template references unknown manifest |
485
+ | `PROCESS_START_FAILED` | MCP server failed to start |
486
+ | `TOOL_CALL_FAILED` | HTTP tool call returned an error |
487
+ | `TOOL_CALL_TIMEOUT` | Tool call exceeded timeout |
488
+ | `TOOL_LIST_FAILED` | MCP tools/list call returned an error |
489
+ | `TOOL_LIST_TIMEOUT` | MCP tools/list call exceeded timeout |
490
+ | `RESOURCE_READ_FAILED` | MCP resources/read call returned an error |
491
+ | `RESOURCE_READ_TIMEOUT` | MCP resources/read call exceeded timeout |
492
+ | `RESOURCE_LIST_FAILED` | MCP resources/list call returned an error |
493
+ | `RESOURCE_LIST_TIMEOUT` | MCP resources/list call exceeded timeout |
494
+ | `PROCESS_DIED` | Server process exited unexpectedly |
495
+
496
+ ## Development
497
+
498
+ ```bash
499
+ deno task test # Run the full test suite
500
+ deno task check # Type check
501
+ deno task lint # Lint
502
+ deno task fmt # Format
503
+ ```
504
+
505
+ See also [PRD.md](./PRD.md) and
506
+ [`docs/decision-records/0001-orchestration-authoring-boundary.md`](./docs/decision-records/0001-orchestration-authoring-boundary.md)
507
+ for the product boundary.
508
+
509
+ ## Design Principles (AX)
510
+
511
+ This library follows [AX (Agent Experience)](https://github.com/AXDesignPattern) principles:
512
+
513
+ - **Pure core** -- No I/O, network, filesystem, or runtime client dependency in `core/`
514
+ - **Narrow runtime dependency** -- The optional runtime uses the official MCP SDK for legacy
515
+ Streamable HTTP plus a small protocol-defined stateless adapter
516
+ - **Deterministic** -- Same inputs produce same outputs (UUID isolated)
517
+ - **Machine-readable errors** -- Structured `ErrorCode` + `ValidationIssue`, not string throws
518
+ - **Fail-fast** -- Invalid sync rules rejected upfront, no silent fallbacks
519
+ - **Composable primitives** -- Each pipeline step works independently
520
+ - **Narrow contracts** -- Functions take minimal inputs, maximal type safety
521
+ - **Co-located docs** -- JSDoc + @example on every public export
522
+
523
+ ## License
524
+
525
+ MIT
@@ -0,0 +1,18 @@
1
+ declare global {
2
+ interface Error {
3
+ cause?: unknown;
4
+ }
5
+ }
6
+ export {};
7
+ declare global {
8
+ interface Object {
9
+ /**
10
+ * Determines whether an object has a property with the specified name.
11
+ * @param o An object.
12
+ * @param v A property name.
13
+ */
14
+ hasOwn(o: object, v: PropertyKey): boolean;
15
+ }
16
+ }
17
+ export {};
18
+ //# sourceMappingURL=_dnt.polyfills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK;QACb,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB;CACF;AAED,OAAO,EAAE,CAAC;AAgBV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd;;;;WAIG;QACH,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;KAC5C;CACF;AAED,OAAO,EAAE,CAAC"}
@@ -0,0 +1,15 @@
1
+ // https://github.com/tc39/proposal-accessible-object-hasownproperty/blob/main/polyfill.js
2
+ if (!Object.hasOwn) {
3
+ Object.defineProperty(Object, "hasOwn", {
4
+ value: function (object, property) {
5
+ if (object == null) {
6
+ throw new TypeError("Cannot convert undefined or null to object");
7
+ }
8
+ return Object.prototype.hasOwnProperty.call(Object(object), property);
9
+ },
10
+ configurable: true,
11
+ enumerable: false,
12
+ writable: true,
13
+ });
14
+ }
15
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const dntGlobalThis: Omit<typeof globalThis, never>;
2
+ //# sourceMappingURL=_dnt.shims.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,gCAA2C,CAAC"}
@@ -0,0 +1,57 @@
1
+ const dntGlobals = {};
2
+ export const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
3
+ function createMergeProxy(baseObj, extObj) {
4
+ return new Proxy(baseObj, {
5
+ get(_target, prop, _receiver) {
6
+ if (prop in extObj) {
7
+ return extObj[prop];
8
+ }
9
+ else {
10
+ return baseObj[prop];
11
+ }
12
+ },
13
+ set(_target, prop, value) {
14
+ if (prop in extObj) {
15
+ delete extObj[prop];
16
+ }
17
+ baseObj[prop] = value;
18
+ return true;
19
+ },
20
+ deleteProperty(_target, prop) {
21
+ let success = false;
22
+ if (prop in extObj) {
23
+ delete extObj[prop];
24
+ success = true;
25
+ }
26
+ if (prop in baseObj) {
27
+ delete baseObj[prop];
28
+ success = true;
29
+ }
30
+ return success;
31
+ },
32
+ ownKeys(_target) {
33
+ const baseKeys = Reflect.ownKeys(baseObj);
34
+ const extKeys = Reflect.ownKeys(extObj);
35
+ const extKeysSet = new Set(extKeys);
36
+ return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
37
+ },
38
+ defineProperty(_target, prop, desc) {
39
+ if (prop in extObj) {
40
+ delete extObj[prop];
41
+ }
42
+ Reflect.defineProperty(baseObj, prop, desc);
43
+ return true;
44
+ },
45
+ getOwnPropertyDescriptor(_target, prop) {
46
+ if (prop in extObj) {
47
+ return Reflect.getOwnPropertyDescriptor(extObj, prop);
48
+ }
49
+ else {
50
+ return Reflect.getOwnPropertyDescriptor(baseObj, prop);
51
+ }
52
+ },
53
+ has(_target, prop) {
54
+ return prop in extObj || prop in baseObj;
55
+ },
56
+ });
57
+ }
@@ -0,0 +1,33 @@
1
+ export declare const BOM = 65279;
2
+ export declare const TAB = 9;
3
+ export declare const LINE_FEED = 10;
4
+ export declare const CARRIAGE_RETURN = 13;
5
+ export declare const SPACE = 32;
6
+ export declare const EXCLAMATION = 33;
7
+ export declare const DOUBLE_QUOTE = 34;
8
+ export declare const SHARP = 35;
9
+ export declare const PERCENT = 37;
10
+ export declare const AMPERSAND = 38;
11
+ export declare const SINGLE_QUOTE = 39;
12
+ export declare const ASTERISK = 42;
13
+ export declare const PLUS = 43;
14
+ export declare const COMMA = 44;
15
+ export declare const MINUS = 45;
16
+ export declare const DOT = 46;
17
+ export declare const COLON = 58;
18
+ export declare const SMALLER_THAN = 60;
19
+ export declare const GREATER_THAN = 62;
20
+ export declare const QUESTION = 63;
21
+ export declare const COMMERCIAL_AT = 64;
22
+ export declare const LEFT_SQUARE_BRACKET = 91;
23
+ export declare const BACKSLASH = 92;
24
+ export declare const RIGHT_SQUARE_BRACKET = 93;
25
+ export declare const GRAVE_ACCENT = 96;
26
+ export declare const LEFT_CURLY_BRACKET = 123;
27
+ export declare const VERTICAL_LINE = 124;
28
+ export declare const RIGHT_CURLY_BRACKET = 125;
29
+ export declare function isEOL(c: number): boolean;
30
+ export declare function isWhiteSpace(c: number): boolean;
31
+ export declare function isWhiteSpaceOrEOL(c: number): boolean;
32
+ export declare function isFlowIndicator(c: number): boolean;
33
+ //# sourceMappingURL=_chars.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_chars.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/yaml/1.3.0/_chars.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,GAAG,QAAS,CAAC;AAC1B,eAAO,MAAM,GAAG,IAAO,CAAC;AACxB,eAAO,MAAM,SAAS,KAAO,CAAC;AAC9B,eAAO,MAAM,eAAe,KAAO,CAAC;AACpC,eAAO,MAAM,KAAK,KAAO,CAAC;AAC1B,eAAO,MAAM,WAAW,KAAO,CAAC;AAChC,eAAO,MAAM,YAAY,KAAO,CAAC;AACjC,eAAO,MAAM,KAAK,KAAO,CAAC;AAC1B,eAAO,MAAM,OAAO,KAAO,CAAC;AAC5B,eAAO,MAAM,SAAS,KAAO,CAAC;AAC9B,eAAO,MAAM,YAAY,KAAO,CAAC;AACjC,eAAO,MAAM,QAAQ,KAAO,CAAC;AAC7B,eAAO,MAAM,IAAI,KAAO,CAAC;AACzB,eAAO,MAAM,KAAK,KAAO,CAAC;AAC1B,eAAO,MAAM,KAAK,KAAO,CAAC;AAC1B,eAAO,MAAM,GAAG,KAAO,CAAC;AACxB,eAAO,MAAM,KAAK,KAAO,CAAC;AAC1B,eAAO,MAAM,YAAY,KAAO,CAAC;AACjC,eAAO,MAAM,YAAY,KAAO,CAAC;AACjC,eAAO,MAAM,QAAQ,KAAO,CAAC;AAC7B,eAAO,MAAM,aAAa,KAAO,CAAC;AAClC,eAAO,MAAM,mBAAmB,KAAO,CAAC;AACxC,eAAO,MAAM,SAAS,KAAO,CAAC;AAC9B,eAAO,MAAM,oBAAoB,KAAO,CAAC;AACzC,eAAO,MAAM,YAAY,KAAO,CAAC;AACjC,eAAO,MAAM,kBAAkB,MAAO,CAAC;AACvC,eAAO,MAAM,aAAa,MAAO,CAAC;AAClC,eAAO,MAAM,mBAAmB,MAAO,CAAC;AAExC,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAExC;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAQlD"}