@frontmcp/ui 0.6.0 → 0.6.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 (445) hide show
  1. package/README.md +140 -362
  2. package/bridge/runtime/index.d.ts +2 -1
  3. package/bridge/runtime/index.d.ts.map +1 -1
  4. package/bundler/file-cache/component-builder.d.ts +1 -1
  5. package/bundler/file-cache/component-builder.d.ts.map +1 -1
  6. package/bundler/file-cache/hash-calculator.d.ts +1 -1
  7. package/bundler/file-cache/hash-calculator.d.ts.map +1 -1
  8. package/bundler/file-cache/storage/filesystem.d.ts +1 -1
  9. package/bundler/file-cache/storage/filesystem.d.ts.map +1 -1
  10. package/bundler/file-cache/storage/interface.d.ts +1 -1
  11. package/bundler/file-cache/storage/interface.d.ts.map +1 -1
  12. package/bundler/file-cache/storage/redis.d.ts +1 -1
  13. package/bundler/file-cache/storage/redis.d.ts.map +1 -1
  14. package/bundler/index.js +10 -1057
  15. package/components/alert.schema.d.ts +6 -6
  16. package/components/avatar.schema.d.ts +9 -9
  17. package/components/badge.schema.d.ts +9 -9
  18. package/components/button.schema.d.ts +9 -9
  19. package/components/card.schema.d.ts +7 -7
  20. package/components/form.schema.d.ts +24 -24
  21. package/components/index.js +128 -198
  22. package/components/modal.schema.d.ts +8 -8
  23. package/components/table.schema.d.ts +6 -6
  24. package/esm/bridge/runtime/index.d.ts +2 -1
  25. package/esm/bridge/runtime/index.d.ts.map +1 -1
  26. package/esm/bundler/file-cache/component-builder.d.ts +1 -1
  27. package/esm/bundler/file-cache/component-builder.d.ts.map +1 -1
  28. package/esm/bundler/file-cache/hash-calculator.d.ts +1 -1
  29. package/esm/bundler/file-cache/hash-calculator.d.ts.map +1 -1
  30. package/esm/bundler/file-cache/storage/filesystem.d.ts +1 -1
  31. package/esm/bundler/file-cache/storage/filesystem.d.ts.map +1 -1
  32. package/esm/bundler/file-cache/storage/interface.d.ts +1 -1
  33. package/esm/bundler/file-cache/storage/interface.d.ts.map +1 -1
  34. package/esm/bundler/file-cache/storage/redis.d.ts +1 -1
  35. package/esm/bundler/file-cache/storage/redis.d.ts.map +1 -1
  36. package/esm/bundler/index.js +3 -1050
  37. package/esm/components/alert.schema.d.ts +6 -6
  38. package/esm/components/avatar.schema.d.ts +9 -9
  39. package/esm/components/badge.schema.d.ts +9 -9
  40. package/esm/components/button.schema.d.ts +9 -9
  41. package/esm/components/card.schema.d.ts +7 -7
  42. package/esm/components/form.schema.d.ts +24 -24
  43. package/esm/components/index.js +136 -196
  44. package/esm/components/modal.schema.d.ts +8 -8
  45. package/esm/components/table.schema.d.ts +6 -6
  46. package/esm/index.d.ts +23 -39
  47. package/esm/index.d.ts.map +1 -1
  48. package/esm/index.js +4256 -16441
  49. package/esm/layouts/base.d.ts +2 -2
  50. package/esm/layouts/base.d.ts.map +1 -1
  51. package/esm/layouts/index.js +33 -516
  52. package/esm/package.json +8 -26
  53. package/esm/pages/index.js +100 -627
  54. package/esm/react/Alert.d.ts +1 -2
  55. package/esm/react/Alert.d.ts.map +1 -1
  56. package/esm/react/Badge.d.ts +1 -2
  57. package/esm/react/Badge.d.ts.map +1 -1
  58. package/esm/react/Button.d.ts +1 -2
  59. package/esm/react/Button.d.ts.map +1 -1
  60. package/esm/react/Card.d.ts +1 -2
  61. package/esm/react/Card.d.ts.map +1 -1
  62. package/esm/react/hooks/context.d.ts +1 -1
  63. package/esm/react/hooks/context.d.ts.map +1 -1
  64. package/esm/react/index.d.ts +5 -6
  65. package/esm/react/index.d.ts.map +1 -1
  66. package/esm/react/index.js +2074 -322
  67. package/esm/react/types.d.ts +1 -2
  68. package/esm/react/types.d.ts.map +1 -1
  69. package/esm/renderers/index.d.ts +10 -25
  70. package/esm/renderers/index.d.ts.map +1 -1
  71. package/esm/renderers/index.js +171 -1617
  72. package/esm/{runtime/adapters → renderers}/react.adapter.d.ts +2 -2
  73. package/esm/renderers/react.adapter.d.ts.map +1 -0
  74. package/esm/renderers/react.renderer.d.ts +3 -3
  75. package/esm/renderers/react.renderer.d.ts.map +1 -1
  76. package/esm/universal/index.js +1755 -0
  77. package/esm/web-components/index.js +232 -287
  78. package/esm/widgets/index.js +89 -147
  79. package/index.d.ts +23 -39
  80. package/index.d.ts.map +1 -1
  81. package/index.js +6123 -18539
  82. package/layouts/base.d.ts +2 -2
  83. package/layouts/base.d.ts.map +1 -1
  84. package/layouts/index.js +43 -536
  85. package/package.json +8 -26
  86. package/pages/index.js +111 -648
  87. package/react/Alert.d.ts +1 -2
  88. package/react/Alert.d.ts.map +1 -1
  89. package/react/Badge.d.ts +1 -2
  90. package/react/Badge.d.ts.map +1 -1
  91. package/react/Button.d.ts +1 -2
  92. package/react/Button.d.ts.map +1 -1
  93. package/react/Card.d.ts +1 -2
  94. package/react/Card.d.ts.map +1 -1
  95. package/react/hooks/context.d.ts +1 -1
  96. package/react/hooks/context.d.ts.map +1 -1
  97. package/react/index.d.ts +5 -6
  98. package/react/index.d.ts.map +1 -1
  99. package/react/index.js +2065 -335
  100. package/react/types.d.ts +1 -2
  101. package/react/types.d.ts.map +1 -1
  102. package/renderers/index.d.ts +10 -25
  103. package/renderers/index.d.ts.map +1 -1
  104. package/renderers/index.js +175 -1641
  105. package/{runtime/adapters → renderers}/react.adapter.d.ts +2 -2
  106. package/renderers/react.adapter.d.ts.map +1 -0
  107. package/renderers/react.renderer.d.ts +3 -3
  108. package/renderers/react.renderer.d.ts.map +1 -1
  109. package/universal/index.js +1841 -0
  110. package/web-components/index.js +224 -289
  111. package/widgets/index.js +80 -148
  112. package/adapters/index.d.ts +0 -13
  113. package/adapters/index.d.ts.map +0 -1
  114. package/adapters/index.js +0 -462
  115. package/adapters/platform-meta.d.ts +0 -166
  116. package/adapters/platform-meta.d.ts.map +0 -1
  117. package/adapters/response-builder.d.ts +0 -108
  118. package/adapters/response-builder.d.ts.map +0 -1
  119. package/adapters/serving-mode.d.ts +0 -107
  120. package/adapters/serving-mode.d.ts.map +0 -1
  121. package/base-template/bridge.d.ts +0 -90
  122. package/base-template/bridge.d.ts.map +0 -1
  123. package/base-template/default-base-template.d.ts +0 -92
  124. package/base-template/default-base-template.d.ts.map +0 -1
  125. package/base-template/index.d.ts +0 -15
  126. package/base-template/index.d.ts.map +0 -1
  127. package/base-template/index.js +0 -1398
  128. package/base-template/polyfills.d.ts +0 -31
  129. package/base-template/polyfills.d.ts.map +0 -1
  130. package/base-template/theme-styles.d.ts +0 -74
  131. package/base-template/theme-styles.d.ts.map +0 -1
  132. package/build/cdn-resources.d.ts +0 -243
  133. package/build/cdn-resources.d.ts.map +0 -1
  134. package/build/index.d.ts +0 -295
  135. package/build/index.d.ts.map +0 -1
  136. package/build/index.js +0 -7096
  137. package/build/widget-manifest.d.ts +0 -362
  138. package/build/widget-manifest.d.ts.map +0 -1
  139. package/dependency/cdn-registry.d.ts +0 -98
  140. package/dependency/cdn-registry.d.ts.map +0 -1
  141. package/dependency/import-map.d.ts +0 -186
  142. package/dependency/import-map.d.ts.map +0 -1
  143. package/dependency/import-parser.d.ts +0 -82
  144. package/dependency/import-parser.d.ts.map +0 -1
  145. package/dependency/index.d.ts +0 -17
  146. package/dependency/index.d.ts.map +0 -1
  147. package/dependency/resolver.d.ts +0 -164
  148. package/dependency/resolver.d.ts.map +0 -1
  149. package/dependency/schemas.d.ts +0 -486
  150. package/dependency/schemas.d.ts.map +0 -1
  151. package/dependency/template-loader.d.ts +0 -204
  152. package/dependency/template-loader.d.ts.map +0 -1
  153. package/dependency/template-processor.d.ts +0 -118
  154. package/dependency/template-processor.d.ts.map +0 -1
  155. package/dependency/types.d.ts +0 -739
  156. package/dependency/types.d.ts.map +0 -1
  157. package/esm/adapters/index.d.ts +0 -13
  158. package/esm/adapters/index.d.ts.map +0 -1
  159. package/esm/adapters/index.js +0 -427
  160. package/esm/adapters/platform-meta.d.ts +0 -166
  161. package/esm/adapters/platform-meta.d.ts.map +0 -1
  162. package/esm/adapters/response-builder.d.ts +0 -108
  163. package/esm/adapters/response-builder.d.ts.map +0 -1
  164. package/esm/adapters/serving-mode.d.ts +0 -107
  165. package/esm/adapters/serving-mode.d.ts.map +0 -1
  166. package/esm/base-template/bridge.d.ts +0 -90
  167. package/esm/base-template/bridge.d.ts.map +0 -1
  168. package/esm/base-template/default-base-template.d.ts +0 -92
  169. package/esm/base-template/default-base-template.d.ts.map +0 -1
  170. package/esm/base-template/index.d.ts +0 -15
  171. package/esm/base-template/index.d.ts.map +0 -1
  172. package/esm/base-template/index.js +0 -1364
  173. package/esm/base-template/polyfills.d.ts +0 -31
  174. package/esm/base-template/polyfills.d.ts.map +0 -1
  175. package/esm/base-template/theme-styles.d.ts +0 -74
  176. package/esm/base-template/theme-styles.d.ts.map +0 -1
  177. package/esm/build/cdn-resources.d.ts +0 -243
  178. package/esm/build/cdn-resources.d.ts.map +0 -1
  179. package/esm/build/index.d.ts +0 -295
  180. package/esm/build/index.d.ts.map +0 -1
  181. package/esm/build/index.js +0 -7021
  182. package/esm/build/widget-manifest.d.ts +0 -362
  183. package/esm/build/widget-manifest.d.ts.map +0 -1
  184. package/esm/dependency/cdn-registry.d.ts +0 -98
  185. package/esm/dependency/cdn-registry.d.ts.map +0 -1
  186. package/esm/dependency/import-map.d.ts +0 -186
  187. package/esm/dependency/import-map.d.ts.map +0 -1
  188. package/esm/dependency/import-parser.d.ts +0 -82
  189. package/esm/dependency/import-parser.d.ts.map +0 -1
  190. package/esm/dependency/index.d.ts +0 -17
  191. package/esm/dependency/index.d.ts.map +0 -1
  192. package/esm/dependency/resolver.d.ts +0 -164
  193. package/esm/dependency/resolver.d.ts.map +0 -1
  194. package/esm/dependency/schemas.d.ts +0 -486
  195. package/esm/dependency/schemas.d.ts.map +0 -1
  196. package/esm/dependency/template-loader.d.ts +0 -204
  197. package/esm/dependency/template-loader.d.ts.map +0 -1
  198. package/esm/dependency/template-processor.d.ts +0 -118
  199. package/esm/dependency/template-processor.d.ts.map +0 -1
  200. package/esm/dependency/types.d.ts +0 -739
  201. package/esm/dependency/types.d.ts.map +0 -1
  202. package/esm/handlebars/expression-extractor.d.ts +0 -147
  203. package/esm/handlebars/expression-extractor.d.ts.map +0 -1
  204. package/esm/handlebars/helpers.d.ts +0 -339
  205. package/esm/handlebars/helpers.d.ts.map +0 -1
  206. package/esm/handlebars/index.d.ts +0 -195
  207. package/esm/handlebars/index.d.ts.map +0 -1
  208. package/esm/handlebars/index.js +0 -587
  209. package/esm/registry/index.d.ts +0 -46
  210. package/esm/registry/index.d.ts.map +0 -1
  211. package/esm/registry/index.js +0 -6422
  212. package/esm/registry/render-template.d.ts +0 -91
  213. package/esm/registry/render-template.d.ts.map +0 -1
  214. package/esm/registry/tool-ui.registry.d.ts +0 -294
  215. package/esm/registry/tool-ui.registry.d.ts.map +0 -1
  216. package/esm/registry/uri-utils.d.ts +0 -56
  217. package/esm/registry/uri-utils.d.ts.map +0 -1
  218. package/esm/renderers/cache.d.ts +0 -145
  219. package/esm/renderers/cache.d.ts.map +0 -1
  220. package/esm/renderers/html.renderer.d.ts +0 -123
  221. package/esm/renderers/html.renderer.d.ts.map +0 -1
  222. package/esm/renderers/mdx.renderer.d.ts +0 -120
  223. package/esm/renderers/mdx.renderer.d.ts.map +0 -1
  224. package/esm/renderers/registry.d.ts +0 -134
  225. package/esm/renderers/registry.d.ts.map +0 -1
  226. package/esm/renderers/types.d.ts +0 -342
  227. package/esm/renderers/types.d.ts.map +0 -1
  228. package/esm/renderers/utils/detect.d.ts +0 -107
  229. package/esm/renderers/utils/detect.d.ts.map +0 -1
  230. package/esm/renderers/utils/hash.d.ts +0 -40
  231. package/esm/renderers/utils/hash.d.ts.map +0 -1
  232. package/esm/renderers/utils/index.d.ts +0 -9
  233. package/esm/renderers/utils/index.d.ts.map +0 -1
  234. package/esm/renderers/utils/transpiler.d.ts +0 -89
  235. package/esm/renderers/utils/transpiler.d.ts.map +0 -1
  236. package/esm/runtime/adapters/html.adapter.d.ts +0 -59
  237. package/esm/runtime/adapters/html.adapter.d.ts.map +0 -1
  238. package/esm/runtime/adapters/index.d.ts +0 -26
  239. package/esm/runtime/adapters/index.d.ts.map +0 -1
  240. package/esm/runtime/adapters/mdx.adapter.d.ts +0 -73
  241. package/esm/runtime/adapters/mdx.adapter.d.ts.map +0 -1
  242. package/esm/runtime/adapters/react.adapter.d.ts.map +0 -1
  243. package/esm/runtime/adapters/types.d.ts +0 -95
  244. package/esm/runtime/adapters/types.d.ts.map +0 -1
  245. package/esm/runtime/csp.d.ts +0 -48
  246. package/esm/runtime/csp.d.ts.map +0 -1
  247. package/esm/runtime/index.d.ts +0 -17
  248. package/esm/runtime/index.d.ts.map +0 -1
  249. package/esm/runtime/index.js +0 -5186
  250. package/esm/runtime/mcp-bridge.d.ts +0 -101
  251. package/esm/runtime/mcp-bridge.d.ts.map +0 -1
  252. package/esm/runtime/renderer-runtime.d.ts +0 -133
  253. package/esm/runtime/renderer-runtime.d.ts.map +0 -1
  254. package/esm/runtime/sanitizer.d.ts +0 -172
  255. package/esm/runtime/sanitizer.d.ts.map +0 -1
  256. package/esm/runtime/types.d.ts +0 -415
  257. package/esm/runtime/types.d.ts.map +0 -1
  258. package/esm/runtime/wrapper.d.ts +0 -421
  259. package/esm/runtime/wrapper.d.ts.map +0 -1
  260. package/esm/styles/index.d.ts +0 -8
  261. package/esm/styles/index.d.ts.map +0 -1
  262. package/esm/styles/index.js +0 -171
  263. package/esm/styles/variants.d.ts +0 -51
  264. package/esm/styles/variants.d.ts.map +0 -1
  265. package/esm/theme/cdn.d.ts +0 -195
  266. package/esm/theme/cdn.d.ts.map +0 -1
  267. package/esm/theme/index.d.ts +0 -18
  268. package/esm/theme/index.d.ts.map +0 -1
  269. package/esm/theme/index.js +0 -700
  270. package/esm/theme/platforms.d.ts +0 -107
  271. package/esm/theme/platforms.d.ts.map +0 -1
  272. package/esm/theme/presets/github-openai.d.ts +0 -50
  273. package/esm/theme/presets/github-openai.d.ts.map +0 -1
  274. package/esm/theme/presets/index.d.ts +0 -11
  275. package/esm/theme/presets/index.d.ts.map +0 -1
  276. package/esm/theme/theme.d.ts +0 -396
  277. package/esm/theme/theme.d.ts.map +0 -1
  278. package/esm/tool-template/builder.d.ts +0 -213
  279. package/esm/tool-template/builder.d.ts.map +0 -1
  280. package/esm/tool-template/index.d.ts +0 -16
  281. package/esm/tool-template/index.d.ts.map +0 -1
  282. package/esm/tool-template/index.js +0 -3515
  283. package/esm/types/index.d.ts +0 -14
  284. package/esm/types/index.d.ts.map +0 -1
  285. package/esm/types/index.js +0 -75
  286. package/esm/types/ui-config.d.ts +0 -639
  287. package/esm/types/ui-config.d.ts.map +0 -1
  288. package/esm/types/ui-runtime.d.ts +0 -1007
  289. package/esm/types/ui-runtime.d.ts.map +0 -1
  290. package/esm/typings/cache/cache-adapter.d.ts +0 -125
  291. package/esm/typings/cache/cache-adapter.d.ts.map +0 -1
  292. package/esm/typings/cache/index.d.ts +0 -10
  293. package/esm/typings/cache/index.d.ts.map +0 -1
  294. package/esm/typings/cache/memory-cache.d.ts +0 -92
  295. package/esm/typings/cache/memory-cache.d.ts.map +0 -1
  296. package/esm/typings/dts-parser.d.ts +0 -90
  297. package/esm/typings/dts-parser.d.ts.map +0 -1
  298. package/esm/typings/index.d.ts +0 -48
  299. package/esm/typings/index.d.ts.map +0 -1
  300. package/esm/typings/schemas.d.ts +0 -232
  301. package/esm/typings/schemas.d.ts.map +0 -1
  302. package/esm/typings/type-fetcher.d.ts +0 -89
  303. package/esm/typings/type-fetcher.d.ts.map +0 -1
  304. package/esm/typings/types.d.ts +0 -320
  305. package/esm/typings/types.d.ts.map +0 -1
  306. package/esm/utils/escape-html.d.ts +0 -58
  307. package/esm/utils/escape-html.d.ts.map +0 -1
  308. package/esm/utils/index.d.ts +0 -10
  309. package/esm/utils/index.d.ts.map +0 -1
  310. package/esm/utils/index.js +0 -40
  311. package/esm/utils/safe-stringify.d.ts +0 -30
  312. package/esm/utils/safe-stringify.d.ts.map +0 -1
  313. package/esm/validation/error-box.d.ts +0 -56
  314. package/esm/validation/error-box.d.ts.map +0 -1
  315. package/esm/validation/index.d.ts +0 -13
  316. package/esm/validation/index.d.ts.map +0 -1
  317. package/esm/validation/index.js +0 -562
  318. package/esm/validation/schema-paths.d.ts +0 -118
  319. package/esm/validation/schema-paths.d.ts.map +0 -1
  320. package/esm/validation/template-validator.d.ts +0 -143
  321. package/esm/validation/template-validator.d.ts.map +0 -1
  322. package/esm/validation/wrapper.d.ts +0 -97
  323. package/esm/validation/wrapper.d.ts.map +0 -1
  324. package/handlebars/expression-extractor.d.ts +0 -147
  325. package/handlebars/expression-extractor.d.ts.map +0 -1
  326. package/handlebars/helpers.d.ts +0 -339
  327. package/handlebars/helpers.d.ts.map +0 -1
  328. package/handlebars/index.d.ts +0 -195
  329. package/handlebars/index.d.ts.map +0 -1
  330. package/handlebars/index.js +0 -666
  331. package/registry/index.d.ts +0 -46
  332. package/registry/index.d.ts.map +0 -1
  333. package/registry/index.js +0 -6465
  334. package/registry/render-template.d.ts +0 -91
  335. package/registry/render-template.d.ts.map +0 -1
  336. package/registry/tool-ui.registry.d.ts +0 -294
  337. package/registry/tool-ui.registry.d.ts.map +0 -1
  338. package/registry/uri-utils.d.ts +0 -56
  339. package/registry/uri-utils.d.ts.map +0 -1
  340. package/renderers/cache.d.ts +0 -145
  341. package/renderers/cache.d.ts.map +0 -1
  342. package/renderers/html.renderer.d.ts +0 -123
  343. package/renderers/html.renderer.d.ts.map +0 -1
  344. package/renderers/mdx.renderer.d.ts +0 -120
  345. package/renderers/mdx.renderer.d.ts.map +0 -1
  346. package/renderers/registry.d.ts +0 -134
  347. package/renderers/registry.d.ts.map +0 -1
  348. package/renderers/types.d.ts +0 -342
  349. package/renderers/types.d.ts.map +0 -1
  350. package/renderers/utils/detect.d.ts +0 -107
  351. package/renderers/utils/detect.d.ts.map +0 -1
  352. package/renderers/utils/hash.d.ts +0 -40
  353. package/renderers/utils/hash.d.ts.map +0 -1
  354. package/renderers/utils/index.d.ts +0 -9
  355. package/renderers/utils/index.d.ts.map +0 -1
  356. package/renderers/utils/transpiler.d.ts +0 -89
  357. package/renderers/utils/transpiler.d.ts.map +0 -1
  358. package/runtime/adapters/html.adapter.d.ts +0 -59
  359. package/runtime/adapters/html.adapter.d.ts.map +0 -1
  360. package/runtime/adapters/index.d.ts +0 -26
  361. package/runtime/adapters/index.d.ts.map +0 -1
  362. package/runtime/adapters/mdx.adapter.d.ts +0 -73
  363. package/runtime/adapters/mdx.adapter.d.ts.map +0 -1
  364. package/runtime/adapters/react.adapter.d.ts.map +0 -1
  365. package/runtime/adapters/types.d.ts +0 -95
  366. package/runtime/adapters/types.d.ts.map +0 -1
  367. package/runtime/csp.d.ts +0 -48
  368. package/runtime/csp.d.ts.map +0 -1
  369. package/runtime/index.d.ts +0 -17
  370. package/runtime/index.d.ts.map +0 -1
  371. package/runtime/index.js +0 -5264
  372. package/runtime/mcp-bridge.d.ts +0 -101
  373. package/runtime/mcp-bridge.d.ts.map +0 -1
  374. package/runtime/renderer-runtime.d.ts +0 -133
  375. package/runtime/renderer-runtime.d.ts.map +0 -1
  376. package/runtime/sanitizer.d.ts +0 -172
  377. package/runtime/sanitizer.d.ts.map +0 -1
  378. package/runtime/types.d.ts +0 -415
  379. package/runtime/types.d.ts.map +0 -1
  380. package/runtime/wrapper.d.ts +0 -421
  381. package/runtime/wrapper.d.ts.map +0 -1
  382. package/styles/index.d.ts +0 -8
  383. package/styles/index.d.ts.map +0 -1
  384. package/styles/index.js +0 -222
  385. package/styles/variants.d.ts +0 -51
  386. package/styles/variants.d.ts.map +0 -1
  387. package/theme/cdn.d.ts +0 -195
  388. package/theme/cdn.d.ts.map +0 -1
  389. package/theme/index.d.ts +0 -18
  390. package/theme/index.d.ts.map +0 -1
  391. package/theme/index.js +0 -757
  392. package/theme/platforms.d.ts +0 -107
  393. package/theme/platforms.d.ts.map +0 -1
  394. package/theme/presets/github-openai.d.ts +0 -50
  395. package/theme/presets/github-openai.d.ts.map +0 -1
  396. package/theme/presets/index.d.ts +0 -11
  397. package/theme/presets/index.d.ts.map +0 -1
  398. package/theme/theme.d.ts +0 -396
  399. package/theme/theme.d.ts.map +0 -1
  400. package/tool-template/builder.d.ts +0 -213
  401. package/tool-template/builder.d.ts.map +0 -1
  402. package/tool-template/index.d.ts +0 -16
  403. package/tool-template/index.d.ts.map +0 -1
  404. package/tool-template/index.js +0 -3559
  405. package/types/index.d.ts +0 -14
  406. package/types/index.d.ts.map +0 -1
  407. package/types/index.js +0 -108
  408. package/types/ui-config.d.ts +0 -639
  409. package/types/ui-config.d.ts.map +0 -1
  410. package/types/ui-runtime.d.ts +0 -1007
  411. package/types/ui-runtime.d.ts.map +0 -1
  412. package/typings/cache/cache-adapter.d.ts +0 -125
  413. package/typings/cache/cache-adapter.d.ts.map +0 -1
  414. package/typings/cache/index.d.ts +0 -10
  415. package/typings/cache/index.d.ts.map +0 -1
  416. package/typings/cache/memory-cache.d.ts +0 -92
  417. package/typings/cache/memory-cache.d.ts.map +0 -1
  418. package/typings/dts-parser.d.ts +0 -90
  419. package/typings/dts-parser.d.ts.map +0 -1
  420. package/typings/index.d.ts +0 -48
  421. package/typings/index.d.ts.map +0 -1
  422. package/typings/schemas.d.ts +0 -232
  423. package/typings/schemas.d.ts.map +0 -1
  424. package/typings/type-fetcher.d.ts +0 -89
  425. package/typings/type-fetcher.d.ts.map +0 -1
  426. package/typings/types.d.ts +0 -320
  427. package/typings/types.d.ts.map +0 -1
  428. package/utils/escape-html.d.ts +0 -58
  429. package/utils/escape-html.d.ts.map +0 -1
  430. package/utils/index.d.ts +0 -10
  431. package/utils/index.d.ts.map +0 -1
  432. package/utils/index.js +0 -70
  433. package/utils/safe-stringify.d.ts +0 -30
  434. package/utils/safe-stringify.d.ts.map +0 -1
  435. package/validation/error-box.d.ts +0 -56
  436. package/validation/error-box.d.ts.map +0 -1
  437. package/validation/index.d.ts +0 -13
  438. package/validation/index.d.ts.map +0 -1
  439. package/validation/index.js +0 -603
  440. package/validation/schema-paths.d.ts +0 -118
  441. package/validation/schema-paths.d.ts.map +0 -1
  442. package/validation/template-validator.d.ts +0 -143
  443. package/validation/template-validator.d.ts.map +0 -1
  444. package/validation/wrapper.d.ts +0 -97
  445. package/validation/wrapper.d.ts.map +0 -1
@@ -1,101 +0,0 @@
1
- /**
2
- * MCP Bridge Runtime
3
- *
4
- * Universal JavaScript runtime injected into UI templates that adapts
5
- * to the host environment (OpenAI Apps SDK, ext-apps, Claude, etc.).
6
- *
7
- * This script is designed to be embedded directly into HTML templates
8
- * via the MCP_BRIDGE_RUNTIME constant.
9
- *
10
- * Architecture:
11
- * - On OpenAI: Proxy directly to native window.openai API
12
- * - On Claude: Polyfill with limited functionality (network-blocked)
13
- * - On ext-apps: JSON-RPC postMessage bridge (SEP-1865 compliant)
14
- * - On Gemini: Gemini SDK integration
15
- * - On Unknown: LocalStorage-based state, basic functionality
16
- *
17
- * @see https://developers.openai.com/apps-sdk/build/chatgpt-ui
18
- * @see https://github.com/modelcontextprotocol/ext-apps (SEP-1865)
19
- */
20
- /**
21
- * The MCP Bridge runtime script.
22
- * This is injected into UI templates to provide a unified API across providers.
23
- *
24
- * Uses the new FrontMcpBridge adapter system which supports:
25
- * - OpenAI ChatGPT Apps SDK
26
- * - ext-apps (SEP-1865 protocol)
27
- * - Claude (Anthropic)
28
- * - Gemini (Google)
29
- * - Generic fallback
30
- *
31
- * The bridge exposes:
32
- * - window.FrontMcpBridge - New unified bridge API
33
- * - window.mcpBridge - Legacy compatibility bridge
34
- * - window.openai - OpenAI polyfill for non-OpenAI platforms
35
- *
36
- * Provides full OpenAI window.openai API compatibility:
37
- * - Properties: theme, userAgent, locale, maxHeight, displayMode, safeArea,
38
- * toolInput, toolOutput, toolResponseMetadata, widgetState
39
- * - Methods: callTool, requestDisplayMode, requestClose, openExternal,
40
- * sendFollowUpMessage, setWidgetState
41
- */
42
- export declare const MCP_BRIDGE_RUNTIME = "\n<script>\n(function() {\n 'use strict';\n\n // ==================== Environment Detection ====================\n\n var isOpenAI = typeof window.openai !== 'undefined';\n var isExtApps = window.parent !== window && !isOpenAI;\n var isClaude = typeof window.claude !== 'undefined' ||\n (window.__mcpPlatform === 'claude');\n var isGemini = window.__mcpPlatform === 'gemini';\n\n // ==================== Internal State ====================\n\n var messageId = 0;\n var pendingRequests = new Map();\n var contextChangeListeners = [];\n var toolResultListeners = [];\n\n // Default values for polyfilled properties\n var defaultSafeArea = { top: 0, bottom: 0, left: 0, right: 0 };\n var defaultUserAgent = { type: 'web', hover: true, touch: false };\n\n // Host context (for ext-apps and polyfill mode)\n var hostContext = window.__mcpHostContext || {\n theme: 'light',\n displayMode: 'inline'\n };\n\n // Trusted origin for postMessage validation (set during ext-apps initialization)\n var trustedOrigin = null;\n\n // Detect device capabilities\n var detectUserAgent = function() {\n var ua = navigator.userAgent || '';\n var isMobile = /iPhone|iPad|iPod|Android/i.test(ua);\n var hasTouch = 'ontouchstart' in window || navigator.maxTouchPoints > 0;\n var hasHover = window.matchMedia && window.matchMedia('(hover: hover)').matches;\n return {\n type: isMobile ? 'mobile' : 'web',\n hover: hasHover !== false,\n touch: hasTouch\n };\n };\n\n // Detect theme from system preference\n var detectTheme = function() {\n if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {\n return 'dark';\n }\n return 'light';\n };\n\n // ==================== Bridge Implementation ====================\n\n /**\n * MCP Bridge provides full OpenAI API compatibility.\n * On OpenAI, it proxies directly to window.openai.\n * On other platforms, it provides polyfills.\n */\n var bridge = {\n // ==================== Environment Info ====================\n\n get provider() {\n if (isOpenAI) return 'openai';\n if (isClaude) return 'claude';\n if (isGemini) return 'gemini';\n if (isExtApps) return 'ext-apps';\n return 'unknown';\n },\n\n // ==================== OpenAI-Compatible Properties ====================\n\n get theme() {\n if (isOpenAI && window.openai) {\n return window.openai.theme || 'light';\n }\n return hostContext.theme || detectTheme();\n },\n\n get userAgent() {\n if (isOpenAI && window.openai && window.openai.userAgent) {\n return window.openai.userAgent;\n }\n return hostContext.userAgent || detectUserAgent();\n },\n\n get locale() {\n if (isOpenAI && window.openai && window.openai.locale) {\n return window.openai.locale;\n }\n return navigator.language || 'en-US';\n },\n\n get maxHeight() {\n if (isOpenAI && window.openai) {\n return window.openai.maxHeight;\n }\n return hostContext.viewport ? hostContext.viewport.maxHeight : undefined;\n },\n\n get displayMode() {\n if (isOpenAI && window.openai) {\n return window.openai.displayMode || 'inline';\n }\n return hostContext.displayMode || 'inline';\n },\n\n get safeArea() {\n if (isOpenAI && window.openai && window.openai.safeArea) {\n return window.openai.safeArea;\n }\n return hostContext.safeArea || defaultSafeArea;\n },\n\n get toolInput() {\n if (isOpenAI && window.openai && window.openai.toolInput) {\n return window.openai.toolInput;\n }\n return window.__mcpToolInput || {};\n },\n\n get toolOutput() {\n if (isOpenAI && window.openai) {\n return window.openai.toolOutput;\n }\n return window.__mcpToolOutput;\n },\n\n get structuredContent() {\n // Alias for toolOutput to maintain compatibility\n if (isOpenAI && window.openai) {\n return window.openai.toolOutput;\n }\n return window.__mcpStructuredContent;\n },\n\n get toolResponseMetadata() {\n if (isOpenAI && window.openai && window.openai.toolResponseMetadata) {\n return window.openai.toolResponseMetadata;\n }\n return window.__mcpToolResponseMetadata || {};\n },\n\n get widgetState() {\n if (isOpenAI && window.openai) {\n return window.openai.widgetState || {};\n }\n // Polyfill: use localStorage\n try {\n var stored = localStorage.getItem('__mcpWidgetState');\n return stored ? JSON.parse(stored) : {};\n } catch (e) {\n return {};\n }\n },\n\n // ==================== OpenAI-Compatible Methods ====================\n\n callTool: function(name, params) {\n if (isOpenAI && window.openai && window.openai.callTool) {\n return window.openai.callTool(name, params);\n }\n if (isClaude) {\n return Promise.reject(new Error(\n 'Tool calls are not supported in Claude widgets (network-blocked sandbox)'\n ));\n }\n if (isGemini) {\n return Promise.reject(new Error(\n 'Tool calls are not supported in Gemini widgets'\n ));\n }\n if (isExtApps) {\n return this._sendRequest('tools/call', { name: name, arguments: params });\n }\n return Promise.reject(new Error('Tool calls not supported in this environment'));\n },\n\n requestDisplayMode: function(options) {\n if (isOpenAI && window.openai && window.openai.requestDisplayMode) {\n return window.openai.requestDisplayMode(options);\n }\n if (isExtApps) {\n return this._sendRequest('ui/request-display-mode', options);\n }\n // Polyfill: just update local state\n if (options && options.mode) {\n hostContext.displayMode = options.mode;\n contextChangeListeners.forEach(function(cb) {\n try { cb({ displayMode: options.mode }); } catch (e) {}\n });\n }\n return Promise.resolve();\n },\n\n requestClose: function() {\n if (isOpenAI && window.openai && window.openai.requestClose) {\n return window.openai.requestClose();\n }\n if (isExtApps) {\n return this._sendRequest('ui/request-close', {});\n }\n // Polyfill: dispatch event for parent to handle\n window.dispatchEvent(new CustomEvent('mcp:request-close'));\n return Promise.resolve();\n },\n\n openExternal: function(options) {\n var href = typeof options === 'string' ? options : (options && options.href);\n if (!href) {\n return Promise.reject(new Error('URL required'));\n }\n if (isOpenAI && window.openai && window.openai.openExternal) {\n return window.openai.openExternal({ href: href });\n }\n if (isExtApps) {\n return this._sendRequest('ui/open-link', { url: href });\n }\n // Fallback: open in new window\n window.open(href, '_blank', 'noopener,noreferrer');\n return Promise.resolve();\n },\n\n // Alias for openExternal (backwards compatibility)\n openLink: function(url) {\n return this.openExternal({ href: url });\n },\n\n sendFollowUpMessage: function(options) {\n var prompt = typeof options === 'string' ? options : (options && options.prompt);\n if (!prompt) {\n return Promise.reject(new Error('Prompt required'));\n }\n if (isOpenAI && window.openai && window.openai.sendFollowUpMessage) {\n return window.openai.sendFollowUpMessage({ prompt: prompt });\n }\n if (isClaude) {\n return Promise.reject(new Error(\n 'Follow-up messages are not supported in Claude widgets (network-blocked sandbox)'\n ));\n }\n if (isGemini) {\n return Promise.reject(new Error(\n 'Follow-up messages are not supported in Gemini widgets'\n ));\n }\n if (isExtApps) {\n return this._sendRequest('ui/message', {\n role: 'user',\n content: { type: 'text', text: prompt }\n });\n }\n return Promise.reject(new Error('Messages not supported in this environment'));\n },\n\n // Alias for sendFollowUpMessage (backwards compatibility)\n sendMessage: function(content) {\n return this.sendFollowUpMessage({ prompt: content });\n },\n\n setWidgetState: function(state) {\n if (isOpenAI && window.openai && window.openai.setWidgetState) {\n window.openai.setWidgetState(state);\n return;\n }\n // Polyfill: persist to localStorage\n try {\n localStorage.setItem('__mcpWidgetState', JSON.stringify(state));\n } catch (e) {\n console.warn('Failed to persist widget state:', e);\n }\n },\n\n // ==================== Context API (MCP-specific) ====================\n\n get context() {\n return {\n theme: this.theme,\n displayMode: this.displayMode,\n viewport: this.maxHeight ? { maxHeight: this.maxHeight } : undefined,\n userAgent: this.userAgent,\n locale: this.locale,\n safeArea: this.safeArea\n };\n },\n\n onContextChange: function(callback) {\n contextChangeListeners.push(callback);\n return function() {\n var index = contextChangeListeners.indexOf(callback);\n if (index > -1) contextChangeListeners.splice(index, 1);\n };\n },\n\n onToolResult: function(callback) {\n toolResultListeners.push(callback);\n return function() {\n var index = toolResultListeners.indexOf(callback);\n if (index > -1) toolResultListeners.splice(index, 1);\n };\n },\n\n // ==================== Internal Methods ====================\n\n _sendRequest: function(method, params) {\n return new Promise(function(resolve, reject) {\n var id = ++messageId;\n pendingRequests.set(id, { resolve: resolve, reject: reject });\n\n window.parent.postMessage({\n jsonrpc: '2.0',\n id: id,\n method: method,\n params: params\n }, '*');\n\n // Timeout after 30s\n setTimeout(function() {\n if (pendingRequests.has(id)) {\n pendingRequests.delete(id);\n reject(new Error('Request timeout'));\n }\n }, 30000);\n });\n },\n\n _initExtApps: function() {\n var self = this;\n return this._sendRequest('ui/initialize', {}).then(function(result) {\n if (result && result.hostContext) {\n hostContext = Object.assign(hostContext, result.hostContext);\n }\n // Note: trustedOrigin is now set from first message event origin (trust-on-first-use)\n // Send initialized notification\n window.parent.postMessage({\n jsonrpc: '2.0',\n method: 'ui/notifications/initialized',\n params: {}\n }, '*');\n return result;\n });\n }\n };\n\n // ==================== Event Handling ====================\n\n window.addEventListener('message', function(event) {\n var data = event.data;\n if (!data || data.jsonrpc !== '2.0') return;\n\n // Trust-on-first-use: Establish trusted origin from the first valid message\n if (isExtApps && !trustedOrigin && event.origin) {\n trustedOrigin = event.origin;\n }\n\n // Validate origin for ext-apps environment to prevent spoofed messages\n if (isExtApps && trustedOrigin && event.origin !== trustedOrigin) {\n console.warn('MCP Bridge: Ignoring message from untrusted origin:', event.origin);\n return;\n }\n\n // Handle responses\n if (data.id && pendingRequests.has(data.id)) {\n var pending = pendingRequests.get(data.id);\n pendingRequests.delete(data.id);\n\n if (data.error) {\n var err = new Error(data.error.message || 'Unknown error');\n err.code = data.error.code;\n err.data = data.error.data;\n pending.reject(err);\n } else {\n pending.resolve(data.result);\n }\n return;\n }\n\n // Handle notifications\n switch (data.method) {\n case 'ui/notifications/tool-input':\n window.__mcpToolInput = data.params && data.params.arguments;\n window.dispatchEvent(new CustomEvent('mcp:tool-input', { detail: data.params }));\n break;\n\n case 'ui/notifications/tool-input-partial':\n if (data.params && data.params.arguments) {\n window.__mcpToolInput = Object.assign(window.__mcpToolInput || {}, data.params.arguments);\n }\n break;\n\n case 'ui/notifications/tool-result':\n window.__mcpToolOutput = data.params && data.params.content;\n window.__mcpStructuredContent = data.params && data.params.structuredContent;\n toolResultListeners.forEach(function(cb) {\n try { cb(data.params); } catch (e) { console.error('Tool result listener error:', e); }\n });\n window.dispatchEvent(new CustomEvent('mcp:tool-result', { detail: data.params }));\n break;\n\n case 'ui/notifications/tool-cancelled':\n window.dispatchEvent(new CustomEvent('mcp:tool-cancelled', { detail: data.params }));\n break;\n\n case 'ui/host-context-change':\n hostContext = Object.assign(hostContext, data.params);\n contextChangeListeners.forEach(function(cb) {\n try { cb(data.params); } catch (e) { console.error('Context change listener error:', e); }\n });\n window.dispatchEvent(new CustomEvent('mcp:context-change', { detail: data.params }));\n break;\n\n case 'ui/size-change':\n if (hostContext.viewport) {\n hostContext.viewport = Object.assign(hostContext.viewport, data.params);\n } else {\n hostContext.viewport = data.params;\n }\n break;\n }\n });\n\n // ==================== Initialize ====================\n\n // Export bridge\n window.mcpBridge = bridge;\n\n // Also create window.openai polyfill for non-OpenAI platforms\n // This allows code written for OpenAI to work on other platforms\n if (!isOpenAI) {\n window.openai = {\n get theme() { return bridge.theme; },\n get userAgent() { return bridge.userAgent; },\n get locale() { return bridge.locale; },\n get maxHeight() { return bridge.maxHeight; },\n get displayMode() { return bridge.displayMode; },\n get safeArea() { return bridge.safeArea; },\n get toolInput() { return bridge.toolInput; },\n get toolOutput() { return bridge.toolOutput; },\n get toolResponseMetadata() { return bridge.toolResponseMetadata; },\n get widgetState() { return bridge.widgetState; },\n callTool: function(n, a) { return bridge.callTool(n, a); },\n requestDisplayMode: function(o) { return bridge.requestDisplayMode(o); },\n requestClose: function() { return bridge.requestClose(); },\n openExternal: function(o) { return bridge.openExternal(o); },\n sendFollowUpMessage: function(o) { return bridge.sendFollowUpMessage(o); },\n setWidgetState: function(s) { return bridge.setWidgetState(s); }\n };\n }\n\n // Auto-initialize for ext-apps\n if (isExtApps) {\n bridge._initExtApps().catch(function(err) {\n console.warn('Failed to initialize MCP bridge:', err);\n });\n }\n\n // Dispatch ready event\n window.dispatchEvent(new CustomEvent('mcp:bridge-ready'));\n})();\n</script>\n";
43
- /**
44
- * Get the MCP Bridge runtime script as a string (without script tags)
45
- * Useful for inline embedding in specific scenarios.
46
- */
47
- export declare function getMCPBridgeScript(): string;
48
- /**
49
- * Check if the current environment supports the MCP bridge
50
- */
51
- export declare function isMCPBridgeSupported(): boolean;
52
- /**
53
- * The new FrontMcpBridge runtime script (universal - includes all adapters).
54
- * This is the recommended bridge for new integrations.
55
- *
56
- * @example
57
- * ```typescript
58
- * import { FRONTMCP_BRIDGE_RUNTIME } from '@frontmcp/ui/runtime';
59
- * const html = `<!DOCTYPE html><html><head>${FRONTMCP_BRIDGE_RUNTIME}</head>...</html>`;
60
- * ```
61
- */
62
- export declare const FRONTMCP_BRIDGE_RUNTIME: string;
63
- /**
64
- * Platform-specific bridge scripts.
65
- *
66
- * Use these for smaller bundle sizes when targeting a specific platform.
67
- *
68
- * @example
69
- * ```typescript
70
- * import { PLATFORM_BRIDGE_SCRIPTS } from '@frontmcp/ui/runtime';
71
- *
72
- * // For ChatGPT only
73
- * const chatgptHtml = `<html><head>${PLATFORM_BRIDGE_SCRIPTS.chatgpt}</head>...</html>`;
74
- *
75
- * // For Claude only
76
- * const claudeHtml = `<html><head>${PLATFORM_BRIDGE_SCRIPTS.claude}</head>...</html>`;
77
- * ```
78
- */
79
- export declare const PLATFORM_BRIDGE_SCRIPTS: {
80
- universal: string;
81
- chatgpt: string;
82
- claude: string;
83
- gemini: string;
84
- };
85
- /**
86
- * Generate a custom bridge script with specific options.
87
- *
88
- * @example
89
- * ```typescript
90
- * import { generateCustomBridge } from '@frontmcp/ui/runtime';
91
- *
92
- * const script = generateCustomBridge({
93
- * adapters: ['openai', 'ext-apps'],
94
- * debug: true,
95
- * trustedOrigins: ['https://my-host.com']
96
- * });
97
- * ```
98
- */
99
- export { generateBridgeIIFE as generateCustomBridge } from '../bridge/runtime/iife-generator';
100
- export type { IIFEGeneratorOptions } from '../bridge/runtime/iife-generator';
101
- //# sourceMappingURL=mcp-bridge.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcp-bridge.d.ts","sourceRoot":"","sources":["../../src/runtime/mcp-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,kBAAkB,koeA8c9B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAI3C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAW9C;AAMD;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,QAA+B,CAAC;AAEpE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,uBAAuB;;;;;CAAqB,CAAC;AAE1D;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,kBAAkB,IAAI,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAG9F,YAAY,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC"}
@@ -1,133 +0,0 @@
1
- /**
2
- * Renderer Runtime
3
- *
4
- * Client-side runtime that manages renderer adapters and handles
5
- * communication with the FrontMCP Bridge.
6
- *
7
- * @packageDocumentation
8
- */
9
- import type { UIType, WidgetManifest } from '../types/ui-runtime';
10
- import type { RenderContext, RenderResult } from './adapters/types';
11
- /**
12
- * Runtime configuration.
13
- */
14
- export interface RendererRuntimeConfig {
15
- /** The manifest embedded in the page */
16
- manifest?: Partial<WidgetManifest>;
17
- /** Initial tool input */
18
- input?: Record<string, unknown>;
19
- /** Initial tool output */
20
- output?: unknown;
21
- /** Initial structured content */
22
- structuredContent?: unknown;
23
- /** Tool name */
24
- toolName?: string;
25
- /** Enable debug logging */
26
- debug?: boolean;
27
- }
28
- /**
29
- * Renderer Runtime.
30
- *
31
- * Client-side runtime that:
32
- * - Reads manifest from the page
33
- * - Lazy-loads the appropriate renderer adapter
34
- * - Handles tool output updates from the Bridge
35
- * - Re-renders when data changes
36
- *
37
- * @example
38
- * ```typescript
39
- * // Bootstrap from manifest in page
40
- * const runtime = new RendererRuntime();
41
- * await runtime.init();
42
- *
43
- * // Listen for updates
44
- * runtime.onUpdate((context) => {
45
- * console.log('Tool output updated:', context.output);
46
- * });
47
- * ```
48
- */
49
- export declare class RendererRuntime {
50
- private config;
51
- private adapters;
52
- private state;
53
- private updateCallbacks;
54
- private bridgeUnsubscribe;
55
- constructor(config?: RendererRuntimeConfig);
56
- /**
57
- * Initialize the runtime.
58
- * Reads manifest, sets up Bridge listeners, and prepares adapters.
59
- */
60
- init(): Promise<void>;
61
- /**
62
- * Get the current render context.
63
- */
64
- get context(): RenderContext;
65
- /**
66
- * Get the manifest.
67
- */
68
- get manifest(): Partial<WidgetManifest> | undefined;
69
- /**
70
- * Get the resolved UI type.
71
- */
72
- get uiType(): UIType;
73
- /**
74
- * Render content to a target element.
75
- *
76
- * @param target - Element to render into
77
- * @param content - Content to render (optional, uses existing innerHTML)
78
- * @param options - Render options
79
- */
80
- render(target: HTMLElement, content?: string, options?: {
81
- hydrate?: boolean;
82
- }): Promise<RenderResult>;
83
- /**
84
- * Update the render context and re-render if needed.
85
- */
86
- updateContext(updates: Partial<RenderContext>): Promise<void>;
87
- /**
88
- * Subscribe to context updates.
89
- */
90
- onUpdate(callback: (context: RenderContext) => void): () => void;
91
- /**
92
- * Clean up resources.
93
- */
94
- destroy(): void;
95
- /**
96
- * Read manifest from page.
97
- */
98
- private readManifest;
99
- /**
100
- * Read initial data from page globals.
101
- */
102
- private readPageGlobals;
103
- /**
104
- * Set up Bridge event listeners.
105
- */
106
- private setupBridgeListeners;
107
- /**
108
- * Get or load an adapter for a UI type.
109
- */
110
- private getAdapter;
111
- /**
112
- * Auto-detect UI type from content.
113
- */
114
- private detectType;
115
- /**
116
- * Log message if debug enabled.
117
- */
118
- private log;
119
- }
120
- /**
121
- * Create and initialize a renderer runtime.
122
- */
123
- export declare function createRendererRuntime(config?: RendererRuntimeConfig): Promise<RendererRuntime>;
124
- /**
125
- * Bootstrap the renderer runtime from page manifest.
126
- * This is the main entry point for the IIFE bootstrap script.
127
- */
128
- export declare function bootstrapRendererRuntime(): Promise<RendererRuntime | null>;
129
- /**
130
- * Generate the bootstrap IIFE script for embedding in HTML.
131
- */
132
- export declare function generateBootstrapScript(): string;
133
- //# sourceMappingURL=renderer-runtime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderer-runtime.d.ts","sourceRoot":"","sources":["../../src/runtime/renderer-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,KAAK,EAAmB,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrF;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,wCAAwC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACnC,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,0BAA0B;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,iCAAiC;IACjC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAYD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,QAAQ,CAAsC;IACtD,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,eAAe,CAA+C;IACtE,OAAO,CAAC,iBAAiB,CAA6B;gBAE1C,MAAM,GAAE,qBAA0B;IAe9C;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB3B;;OAEG;IACH,IAAI,OAAO,IAAI,aAAa,CAE3B;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,OAAO,CAAC,cAAc,CAAC,GAAG,SAAS,CAElD;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;;;;;OAMG;IACG,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,CAAC;IAkC3G;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAyBnE;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,GAAG,MAAM,IAAI;IAUhE;;OAEG;IACH,OAAO,IAAI,IAAI;IAmBf;;OAEG;IACH,OAAO,CAAC,YAAY;IAiCpB;;OAEG;IACH,OAAO,CAAC,eAAe;IAuCvB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAoB5B;;OAEG;YACW,UAAU;IA8BxB;;OAEG;IACH,OAAO,CAAC,UAAU;IAwBlB;;OAEG;IACH,OAAO,CAAC,GAAG;CAKZ;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAIpG;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAiChF;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAwBhD"}
@@ -1,172 +0,0 @@
1
- /**
2
- * Input Sanitizer
3
- *
4
- * Provides PII detection and redaction for tool inputs before they are
5
- * exposed to widget code. This protects sensitive data from being
6
- * accidentally exposed in client-side widgets.
7
- *
8
- * Built-in patterns:
9
- * - Email addresses → [EMAIL]
10
- * - Phone numbers → [PHONE]
11
- * - Credit card numbers → [CARD]
12
- * - SSN / National IDs → [ID]
13
- * - IP addresses → [IP]
14
- *
15
- * @example
16
- * ```typescript
17
- * import { sanitizeInput, createSanitizer } from './sanitizer';
18
- *
19
- * // Auto-detect and redact PII
20
- * const sanitized = sanitizeInput({
21
- * user: 'john@example.com',
22
- * phone: '555-123-4567',
23
- * message: 'Hello world',
24
- * });
25
- * // Result: { user: '[EMAIL]', phone: '[PHONE]', message: 'Hello world' }
26
- *
27
- * // Redact specific fields
28
- * const sanitized2 = sanitizeInput(data, ['email', 'ssn']);
29
- *
30
- * // Custom sanitizer
31
- * const sanitized3 = sanitizeInput(data, (key, value) => {
32
- * if (key === 'secret') return '[REDACTED]';
33
- * return value;
34
- * });
35
- * ```
36
- */
37
- /**
38
- * Redaction placeholder tokens
39
- */
40
- export declare const REDACTION_TOKENS: {
41
- readonly EMAIL: "[EMAIL]";
42
- readonly PHONE: "[PHONE]";
43
- readonly CARD: "[CARD]";
44
- readonly ID: "[ID]";
45
- readonly IP: "[IP]";
46
- readonly REDACTED: "[REDACTED]";
47
- };
48
- /**
49
- * PII detection patterns
50
- */
51
- export declare const PII_PATTERNS: {
52
- email: RegExp;
53
- emailInText: RegExp;
54
- phone: RegExp;
55
- phoneInText: RegExp;
56
- creditCard: RegExp;
57
- creditCardInText: RegExp;
58
- ssn: RegExp;
59
- ssnInText: RegExp;
60
- ipv4: RegExp;
61
- ipv4InText: RegExp;
62
- };
63
- /**
64
- * Custom sanitizer function type
65
- */
66
- export type SanitizerFn = (key: string, value: unknown, path: string[]) => unknown;
67
- /**
68
- * Sanitizer options
69
- */
70
- export interface SanitizeOptions {
71
- /**
72
- * How to handle PII detection:
73
- * - true: Auto-detect and redact common PII patterns
74
- * - string[]: Only redact values in fields with these names
75
- * - SanitizerFn: Custom sanitizer function
76
- */
77
- mode: true | string[] | SanitizerFn;
78
- /**
79
- * Maximum depth for recursive sanitization
80
- * @default 10
81
- */
82
- maxDepth?: number;
83
- /**
84
- * Whether to sanitize PII patterns within string values
85
- * @default true
86
- */
87
- sanitizeInText?: boolean;
88
- }
89
- /**
90
- * Check if a string matches an email pattern
91
- */
92
- export declare function isEmail(value: string): boolean;
93
- /**
94
- * Check if a string matches a phone pattern
95
- */
96
- export declare function isPhone(value: string): boolean;
97
- /**
98
- * Check if a string matches a credit card pattern
99
- */
100
- export declare function isCreditCard(value: string): boolean;
101
- /**
102
- * Check if a string matches an SSN pattern
103
- */
104
- export declare function isSSN(value: string): boolean;
105
- /**
106
- * Check if a string matches an IPv4 pattern
107
- */
108
- export declare function isIPv4(value: string): boolean;
109
- /**
110
- * Detect PII type in a string value
111
- */
112
- export declare function detectPIIType(value: string): keyof typeof REDACTION_TOKENS | null;
113
- /**
114
- * Redact PII patterns from text
115
- */
116
- export declare function redactPIIFromText(text: string): string;
117
- /**
118
- * Sanitize input data by redacting PII.
119
- *
120
- * @param input - The input data to sanitize
121
- * @param mode - Sanitization mode:
122
- * - `true`: Auto-detect and redact common PII patterns
123
- * - `string[]`: Redact values in fields with these names
124
- * - `SanitizerFn`: Custom sanitizer function
125
- * @returns Sanitized copy of the input
126
- *
127
- * @example
128
- * ```typescript
129
- * // Auto-detect PII
130
- * sanitizeInput({ email: 'test@example.com' });
131
- * // { email: '[EMAIL]' }
132
- *
133
- * // Redact specific fields
134
- * sanitizeInput({ password: 'secret', name: 'John' }, ['password']);
135
- * // { password: '[REDACTED]', name: 'John' }
136
- *
137
- * // Custom sanitizer
138
- * sanitizeInput(data, (key, value) => key === 'token' ? '[TOKEN]' : value);
139
- * ```
140
- */
141
- export declare function sanitizeInput(input: Record<string, unknown>, mode?: true | string[] | SanitizerFn): Record<string, unknown>;
142
- /**
143
- * Create a reusable sanitizer function with preset options.
144
- *
145
- * @param mode - Sanitization mode
146
- * @returns Sanitizer function
147
- *
148
- * @example
149
- * ```typescript
150
- * const sanitizer = createSanitizer(['email', 'phone', 'ssn']);
151
- *
152
- * const clean1 = sanitizer(userData1);
153
- * const clean2 = sanitizer(userData2);
154
- * ```
155
- */
156
- export declare function createSanitizer(mode?: true | string[] | SanitizerFn): (input: Record<string, unknown>) => Record<string, unknown>;
157
- /**
158
- * Check if an object contains any detected PII.
159
- * Does not modify the input.
160
- *
161
- * @param input - The input to check
162
- * @param options - Optional configuration
163
- * @param options.maxDepth - Maximum recursion depth (default: 10)
164
- * @returns Object with boolean `hasPII` and `fields` array of field paths
165
- */
166
- export declare function detectPII(input: Record<string, unknown>, options?: {
167
- maxDepth?: number;
168
- }): {
169
- hasPII: boolean;
170
- fields: string[];
171
- };
172
- //# sourceMappingURL=sanitizer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sanitizer.d.ts","sourceRoot":"","sources":["../../src/runtime/sanitizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;CAOnB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;CA8BxB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC;AAEnF;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,GAAG,WAAW,CAAC;IAEpC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE9C;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE9C;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAInD;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE5C;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE7C;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,OAAO,gBAAgB,GAAG,IAAI,CAOjF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAWtD;AA0FD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,IAAI,GAAE,IAAI,GAAG,MAAM,EAAE,GAAG,WAAkB,GACzC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAczB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,IAAI,GAAE,IAAI,GAAG,MAAM,EAAE,GAAG,WAAkB,GACzC,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE7D;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9B;IACD,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CA0CA"}