@adia-ai/gen-ui 0.8.37

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 (631) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +77 -0
  3. package/compose/CHANGELOG.md +1707 -0
  4. package/compose/README.md +215 -0
  5. package/compose/core/artifacts.js +262 -0
  6. package/compose/core/context-store.js +218 -0
  7. package/compose/core/generator.d.ts +4 -0
  8. package/compose/core/generator.js +602 -0
  9. package/compose/core/pipeline/engine.js +289 -0
  10. package/compose/core/pipeline/types.js +91 -0
  11. package/compose/core/plan-primitives.js +120 -0
  12. package/compose/core/plan-turn.js +145 -0
  13. package/compose/core/reference.js +150 -0
  14. package/compose/core/state.js +15 -0
  15. package/compose/evals/harness.d.ts +4 -0
  16. package/compose/evals/harness.mjs +193 -0
  17. package/compose/index.d.ts +4 -0
  18. package/compose/index.js +16 -0
  19. package/compose/shared/validate-and-repair.js +122 -0
  20. package/compose/strategies/_shared/chunk-loader.js +282 -0
  21. package/compose/strategies/cascade.d.ts +67 -0
  22. package/compose/strategies/cascade.js +165 -0
  23. package/compose/strategies/escalation.d.ts +13 -0
  24. package/compose/strategies/escalation.js +132 -0
  25. package/compose/strategies/free-form-composer/index.js +254 -0
  26. package/compose/strategies/free-form-composer/system-prompt.js +205 -0
  27. package/compose/strategies/free-form-composer/transpile.js +279 -0
  28. package/compose/strategies/monolithic/_shared.js +1619 -0
  29. package/compose/strategies/monolithic/generate-instant.js +228 -0
  30. package/compose/strategies/monolithic/generate-pro.js +490 -0
  31. package/compose/strategies/monolithic/generate-thinking.js +206 -0
  32. package/compose/strategies/registry.d.ts +20 -0
  33. package/compose/strategies/registry.js +495 -0
  34. package/compose/strategies/zettel/_smoke.js +27 -0
  35. package/compose/strategies/zettel/chunk-composer.js +214 -0
  36. package/compose/strategies/zettel/chunk-refiner.js +582 -0
  37. package/compose/strategies/zettel/chunk-synthesizer.js +458 -0
  38. package/compose/strategies/zettel/composer.js +78 -0
  39. package/compose/strategies/zettel/composition-library.js +418 -0
  40. package/compose/strategies/zettel/generate.js +15 -0
  41. package/compose/strategies/zettel/generator-adapter.d.ts +4 -0
  42. package/compose/strategies/zettel/generator-adapter.js +242 -0
  43. package/compose/strategies/zettel/issue-reporter.js +607 -0
  44. package/compose/strategies/zettel/session-store.js +121 -0
  45. package/compose/strategies/zettel/state-cache.js +158 -0
  46. package/compose/transpiler/transpiler-maps.js +675 -0
  47. package/compose/transpiler/transpiler.d.ts +4 -0
  48. package/compose/transpiler/transpiler.js +962 -0
  49. package/corpus/CHANGELOG.md +1957 -0
  50. package/corpus/README.md +279 -0
  51. package/corpus/catalog-a2ui_0_9.d.ts +4 -0
  52. package/corpus/catalog-a2ui_0_9.json +29571 -0
  53. package/corpus/catalog-a2ui_0_9_rules.txt +1215 -0
  54. package/corpus/chunk-embeddings.d.ts +4 -0
  55. package/corpus/chunk-embeddings.json +1 -0
  56. package/corpus/chunks/_index.json +16658 -0
  57. package/corpus/chunks/_source-hashes.json +571 -0
  58. package/corpus/chunks/access-denied-with-request.json +124 -0
  59. package/corpus/chunks/access-request-form.json +166 -0
  60. package/corpus/chunks/access-request-pending.json +133 -0
  61. package/corpus/chunks/accordion-settings.json +176 -0
  62. package/corpus/chunks/achievement-badges.json +413 -0
  63. package/corpus/chunks/achievement-unlock.json +104 -0
  64. package/corpus/chunks/action-list-record-actions.json +84 -0
  65. package/corpus/chunks/activity-feed.json +390 -0
  66. package/corpus/chunks/admin-page-header-flush.json +83 -0
  67. package/corpus/chunks/admin-page-header-title-description.json +80 -0
  68. package/corpus/chunks/admin-page-header-with-actions.json +107 -0
  69. package/corpus/chunks/admin-page-header-with-tabs.json +144 -0
  70. package/corpus/chunks/admin-shell-rounded-borderless.json +287 -0
  71. package/corpus/chunks/admin-shell-standard.json +310 -0
  72. package/corpus/chunks/admin-sidebar-brand-signin.json +158 -0
  73. package/corpus/chunks/admin-sidebar-brand-version.json +130 -0
  74. package/corpus/chunks/admin-sidebar-flat-nav.json +131 -0
  75. package/corpus/chunks/admin-sidebar-nav-dividers.json +150 -0
  76. package/corpus/chunks/admin-sidebar-nav-groups.json +171 -0
  77. package/corpus/chunks/admin-sidebar-workspace-switcher.json +139 -0
  78. package/corpus/chunks/admin-topbar-breadcrumb-actions.json +130 -0
  79. package/corpus/chunks/admin-topbar-breadcrumb-minimal.json +79 -0
  80. package/corpus/chunks/admin-topbar-deep-breadcrumb.json +129 -0
  81. package/corpus/chunks/admin-topbar-search.json +104 -0
  82. package/corpus/chunks/admin-topbar-status-indicator.json +122 -0
  83. package/corpus/chunks/admin-topbar-trailing-toggle.json +114 -0
  84. package/corpus/chunks/agent-activity-feed.json +163 -0
  85. package/corpus/chunks/agent-artifact-stub-card.json +115 -0
  86. package/corpus/chunks/agent-canvas-shell.json +305 -0
  87. package/corpus/chunks/agent-citations-source-chips.json +82 -0
  88. package/corpus/chunks/agent-command-palette-search.json +120 -0
  89. package/corpus/chunks/agent-cost-detailed.json +260 -0
  90. package/corpus/chunks/agent-cost-inline.json +78 -0
  91. package/corpus/chunks/agent-memory-detail.json +181 -0
  92. package/corpus/chunks/agent-memory-editor.json +173 -0
  93. package/corpus/chunks/agent-memory-list.json +207 -0
  94. package/corpus/chunks/agent-pipeline-status-stages.json +61 -0
  95. package/corpus/chunks/agent-prompt-card.json +179 -0
  96. package/corpus/chunks/agent-prompt-library-grid.json +341 -0
  97. package/corpus/chunks/agent-prompt-picker.json +282 -0
  98. package/corpus/chunks/agent-rate-limit.json +100 -0
  99. package/corpus/chunks/agent-reasoning-collapsed.json +128 -0
  100. package/corpus/chunks/agent-tool-call-accordion.json +109 -0
  101. package/corpus/chunks/agent-tool-call-collapsed.json +98 -0
  102. package/corpus/chunks/agent-tool-call-error.json +112 -0
  103. package/corpus/chunks/agent-tool-call-result.json +145 -0
  104. package/corpus/chunks/agent-tool-call-running.json +85 -0
  105. package/corpus/chunks/agent-tool-call-success.json +137 -0
  106. package/corpus/chunks/agent-trace-timeline.json +244 -0
  107. package/corpus/chunks/ai-streaming-response.json +147 -0
  108. package/corpus/chunks/alert-banner-stack.json +78 -0
  109. package/corpus/chunks/alert-banner.json +55 -0
  110. package/corpus/chunks/alert-dialog-simple.json +72 -0
  111. package/corpus/chunks/alert-dialog-typed.json +107 -0
  112. package/corpus/chunks/alert-dialog-unsaved.json +81 -0
  113. package/corpus/chunks/analytics-chart.json +213 -0
  114. package/corpus/chunks/analytics-sparklines-dashboard.json +259 -0
  115. package/corpus/chunks/anchor-bar-selection-bar.json +226 -0
  116. package/corpus/chunks/api-key-table.json +148 -0
  117. package/corpus/chunks/api-keys-create.json +140 -0
  118. package/corpus/chunks/api-keys-list.json +271 -0
  119. package/corpus/chunks/app-nav-badges-counts.json +77 -0
  120. package/corpus/chunks/app-nav-badges-group-rollup-badges.json +100 -0
  121. package/corpus/chunks/app-nav-badges-plan-tiers.json +76 -0
  122. package/corpus/chunks/app-nav-badges-status-callouts.json +75 -0
  123. package/corpus/chunks/app-nav-full-example.json +195 -0
  124. package/corpus/chunks/app-nav-groups.json +103 -0
  125. package/corpus/chunks/app-nav-items.json +74 -0
  126. package/corpus/chunks/app-nav-labels-and-dividers.json +92 -0
  127. package/corpus/chunks/app-nav-spacer.json +77 -0
  128. package/corpus/chunks/app-product-listing-card.json +214 -0
  129. package/corpus/chunks/approvals-detail.json +240 -0
  130. package/corpus/chunks/approvals-queue.json +321 -0
  131. package/corpus/chunks/audit-log-basic.json +184 -0
  132. package/corpus/chunks/audit-log.json +174 -0
  133. package/corpus/chunks/auth-account-deleted-actions.json +51 -0
  134. package/corpus/chunks/auth-account-deleted.json +202 -0
  135. package/corpus/chunks/auth-card-content.json +260 -0
  136. package/corpus/chunks/auth-card-header.json +205 -0
  137. package/corpus/chunks/auth-email-entry.json +65 -0
  138. package/corpus/chunks/auth-email-verify-confirm.json +52 -0
  139. package/corpus/chunks/auth-email-verify.json +196 -0
  140. package/corpus/chunks/auth-forbidden-actions.json +59 -0
  141. package/corpus/chunks/auth-forbidden.json +203 -0
  142. package/corpus/chunks/auth-invite-actions.json +49 -0
  143. package/corpus/chunks/auth-invite-team-card.json +86 -0
  144. package/corpus/chunks/auth-link-expired-form.json +65 -0
  145. package/corpus/chunks/auth-link-expired.json +196 -0
  146. package/corpus/chunks/auth-locked-account.json +211 -0
  147. package/corpus/chunks/auth-locked-recovery-options.json +60 -0
  148. package/corpus/chunks/auth-mfa-enrollment-submit.json +54 -0
  149. package/corpus/chunks/auth-mfa-enrollment.json +284 -0
  150. package/corpus/chunks/auth-mfa-fallback-actions.json +52 -0
  151. package/corpus/chunks/auth-mfa-recovery.json +61 -0
  152. package/corpus/chunks/auth-new-password-form.json +75 -0
  153. package/corpus/chunks/auth-new-password.json +217 -0
  154. package/corpus/chunks/auth-oauth-fallback-actions.json +52 -0
  155. package/corpus/chunks/auth-oauth-interstitial.json +160 -0
  156. package/corpus/chunks/auth-password-challenge.json +94 -0
  157. package/corpus/chunks/auth-password-reset-form.json +64 -0
  158. package/corpus/chunks/auth-password-reset.json +195 -0
  159. package/corpus/chunks/auth-profile-form.json +72 -0
  160. package/corpus/chunks/auth-profile-setup.json +194 -0
  161. package/corpus/chunks/auth-reset-sent.json +188 -0
  162. package/corpus/chunks/auth-session-expired-actions.json +52 -0
  163. package/corpus/chunks/auth-session-expired.json +201 -0
  164. package/corpus/chunks/auth-signin-card-email.json +245 -0
  165. package/corpus/chunks/auth-signin-card-magic-link.json +147 -0
  166. package/corpus/chunks/auth-signin-card-mfa.json +231 -0
  167. package/corpus/chunks/auth-signin-card-otp.json +205 -0
  168. package/corpus/chunks/auth-signin-card-password.json +264 -0
  169. package/corpus/chunks/auth-signin-card-recovery.json +218 -0
  170. package/corpus/chunks/auth-signout-actions.json +51 -0
  171. package/corpus/chunks/auth-signout.json +184 -0
  172. package/corpus/chunks/auth-signup-email-entry.json +66 -0
  173. package/corpus/chunks/auth-signup-entry.json +281 -0
  174. package/corpus/chunks/auth-signup-social-auths.json +54 -0
  175. package/corpus/chunks/auth-signup-verify.json +227 -0
  176. package/corpus/chunks/auth-social-auths.json +62 -0
  177. package/corpus/chunks/auth-sso-providers.json +55 -0
  178. package/corpus/chunks/auth-sso-required.json +213 -0
  179. package/corpus/chunks/auth-team-invite.json +288 -0
  180. package/corpus/chunks/avatar-group-overflow.json +137 -0
  181. package/corpus/chunks/avatar-stack-overflow.json +124 -0
  182. package/corpus/chunks/banner-announcement-beta.json +99 -0
  183. package/corpus/chunks/banner-announcement-promo.json +102 -0
  184. package/corpus/chunks/banner-live-update.json +102 -0
  185. package/corpus/chunks/banner-system-maintenance.json +101 -0
  186. package/corpus/chunks/banner-system-offline.json +85 -0
  187. package/corpus/chunks/banner-system-update.json +102 -0
  188. package/corpus/chunks/bell-menu-empty.json +107 -0
  189. package/corpus/chunks/bell-menu-unread.json +395 -0
  190. package/corpus/chunks/billing-cancel-subscription-danger.json +61 -0
  191. package/corpus/chunks/billing-invoice-history-table.json +75 -0
  192. package/corpus/chunks/billing-overview.json +202 -0
  193. package/corpus/chunks/billing-payment-method-card-on-file.json +157 -0
  194. package/corpus/chunks/billing-progress-label.json +101 -0
  195. package/corpus/chunks/blog-post-card.json +212 -0
  196. package/corpus/chunks/breadcrumb-navigation.json +72 -0
  197. package/corpus/chunks/bulk-action-toolbar-floating.json +199 -0
  198. package/corpus/chunks/bulk-action-toolbar-swap.json +158 -0
  199. package/corpus/chunks/bulk-selection-actions-bar.json +162 -0
  200. package/corpus/chunks/business-address-form.json +953 -0
  201. package/corpus/chunks/calendar-month-view.json +74 -0
  202. package/corpus/chunks/card-grid-images.json +459 -0
  203. package/corpus/chunks/card-header-with-description.json +47 -0
  204. package/corpus/chunks/card-with-empty-state.json +96 -0
  205. package/corpus/chunks/card-with-form.json +143 -0
  206. package/corpus/chunks/card-with-sparkline.json +90 -0
  207. package/corpus/chunks/card-with-stat-kpi.json +86 -0
  208. package/corpus/chunks/changelog-feed-basic.json +470 -0
  209. package/corpus/chunks/chart-in-card-chart-plus-breakdown.json +188 -0
  210. package/corpus/chunks/chart-in-card-chart-plus-stat.json +89 -0
  211. package/corpus/chunks/chart-in-card-chart-with-filter-pills.json +124 -0
  212. package/corpus/chunks/chart-in-card-full-bleed-legend.json +116 -0
  213. package/corpus/chunks/chart-in-card-full-chart.json +107 -0
  214. package/corpus/chunks/chart-in-card-sparkline-tile.json +93 -0
  215. package/corpus/chunks/chart-in-card-stat-with-sparkline.json +73 -0
  216. package/corpus/chunks/chart-in-card-trend-footer.json +115 -0
  217. package/corpus/chunks/chart-with-filter-pills.json +169 -0
  218. package/corpus/chunks/chat-empty-state-hero.json +102 -0
  219. package/corpus/chunks/chat-message-assistant-byline.json +85 -0
  220. package/corpus/chunks/chat-message-user-byline.json +84 -0
  221. package/corpus/chunks/chat-page-shell.json +379 -0
  222. package/corpus/chunks/chat-streaming-surface.json +169 -0
  223. package/corpus/chunks/checkout-order-summary-card.json +140 -0
  224. package/corpus/chunks/code-snippet.json +107 -0
  225. package/corpus/chunks/col-form-stack.json +93 -0
  226. package/corpus/chunks/col-heading-body-action.json +79 -0
  227. package/corpus/chunks/col-stat-label.json +63 -0
  228. package/corpus/chunks/color-picker-swatches.json +153 -0
  229. package/corpus/chunks/command-palette.json +327 -0
  230. package/corpus/chunks/comments-composer.json +158 -0
  231. package/corpus/chunks/comments-mention-menu.json +237 -0
  232. package/corpus/chunks/comments-thread.json +344 -0
  233. package/corpus/chunks/commerce-pricing-tiers.json +401 -0
  234. package/corpus/chunks/comparison-table.json +246 -0
  235. package/corpus/chunks/contact-form-card.json +197 -0
  236. package/corpus/chunks/contact-form.json +157 -0
  237. package/corpus/chunks/contact-support-form.json +702 -0
  238. package/corpus/chunks/conversion-funnel-4-step-funnel.json +139 -0
  239. package/corpus/chunks/conversion-funnel-6step.json +151 -0
  240. package/corpus/chunks/conversion-funnel-wide-summary.json +192 -0
  241. package/corpus/chunks/conversion-funnel-with-segment-compare.json +202 -0
  242. package/corpus/chunks/cta-banner-centered.json +102 -0
  243. package/corpus/chunks/dashboard-acquisition-panel.json +212 -0
  244. package/corpus/chunks/dashboard-admin-page.json +104 -0
  245. package/corpus/chunks/dashboard-audience-kpis.json +165 -0
  246. package/corpus/chunks/dashboard-audience-panel.json +756 -0
  247. package/corpus/chunks/dashboard-behavior-panel.json +114 -0
  248. package/corpus/chunks/dashboard-chart-recent.json +566 -0
  249. package/corpus/chunks/dashboard-cohort-retention.json +83 -0
  250. package/corpus/chunks/dashboard-conversion-panel.json +234 -0
  251. package/corpus/chunks/dashboard-country-list.json +304 -0
  252. package/corpus/chunks/dashboard-filter-bar.json +118 -0
  253. package/corpus/chunks/dashboard-funnel.json +142 -0
  254. package/corpus/chunks/dashboard-notifications-panel.json +423 -0
  255. package/corpus/chunks/dashboard-overview-panel.json +1644 -0
  256. package/corpus/chunks/dashboard-page-header.json +166 -0
  257. package/corpus/chunks/dashboard-pages-table.json +86 -0
  258. package/corpus/chunks/dashboard-quick-actions.json +116 -0
  259. package/corpus/chunks/dashboard-reports-panel.json +166 -0
  260. package/corpus/chunks/dashboard-reports-table.json +138 -0
  261. package/corpus/chunks/dashboard-storage-card.json +117 -0
  262. package/corpus/chunks/dashboard-tabs.json +86 -0
  263. package/corpus/chunks/dashboard-team-actions-storage.json +605 -0
  264. package/corpus/chunks/dashboard-team-list.json +334 -0
  265. package/corpus/chunks/dashboard-traffic-channels.json +184 -0
  266. package/corpus/chunks/dashboard-transactions-table.json +145 -0
  267. package/corpus/chunks/data-export-history.json +192 -0
  268. package/corpus/chunks/data-export-request.json +197 -0
  269. package/corpus/chunks/data-import-wizard.json +391 -0
  270. package/corpus/chunks/date-range-picker.json +156 -0
  271. package/corpus/chunks/date-time-picker-form.json +222 -0
  272. package/corpus/chunks/departments-checkbox-form.json +390 -0
  273. package/corpus/chunks/destructive-confirm-modal.json +149 -0
  274. package/corpus/chunks/diff-inline.json +84 -0
  275. package/corpus/chunks/diff-side-by-side.json +131 -0
  276. package/corpus/chunks/diff-structured.json +216 -0
  277. package/corpus/chunks/digest-email-preview.json +374 -0
  278. package/corpus/chunks/divider-text-label.json +87 -0
  279. package/corpus/chunks/doc-editor-shell.json +356 -0
  280. package/corpus/chunks/drawer-2fa-key.json +273 -0
  281. package/corpus/chunks/drawer-2fa-sms.json +261 -0
  282. package/corpus/chunks/drawer-2fa-totp.json +385 -0
  283. package/corpus/chunks/drawer-cancel-sub.json +636 -0
  284. package/corpus/chunks/drawer-change-plan.json +561 -0
  285. package/corpus/chunks/drawer-custom-roles.json +696 -0
  286. package/corpus/chunks/drawer-data-start.json +171 -0
  287. package/corpus/chunks/drawer-delete-account.json +341 -0
  288. package/corpus/chunks/drawer-delete-workspace.json +362 -0
  289. package/corpus/chunks/drawer-discord.json +434 -0
  290. package/corpus/chunks/drawer-figma.json +401 -0
  291. package/corpus/chunks/drawer-first-dashboard.json +220 -0
  292. package/corpus/chunks/drawer-gcal.json +475 -0
  293. package/corpus/chunks/drawer-github.json +589 -0
  294. package/corpus/chunks/drawer-invite.json +397 -0
  295. package/corpus/chunks/drawer-record-detail.json +44 -0
  296. package/corpus/chunks/drawer-report.json +528 -0
  297. package/corpus/chunks/drawer-revoke-session.json +331 -0
  298. package/corpus/chunks/drawer-role.json +190 -0
  299. package/corpus/chunks/drawer-slack.json +429 -0
  300. package/corpus/chunks/drawer-smtp.json +476 -0
  301. package/corpus/chunks/drawer-source.json +294 -0
  302. package/corpus/chunks/drawer-transaction.json +493 -0
  303. package/corpus/chunks/drawer-with-create-form.json +43 -0
  304. package/corpus/chunks/editor-code-pane.json +204 -0
  305. package/corpus/chunks/editor-page-shell.json +149 -0
  306. package/corpus/chunks/editor-preview-pane.json +136 -0
  307. package/corpus/chunks/editor-statusbar-ready.json +99 -0
  308. package/corpus/chunks/editor-toolbar-import-export.json +195 -0
  309. package/corpus/chunks/email-inbox-list.json +678 -0
  310. package/corpus/chunks/empty-state-danger.json +58 -0
  311. package/corpus/chunks/empty-state-minimal.json +44 -0
  312. package/corpus/chunks/empty-state-warning.json +53 -0
  313. package/corpus/chunks/empty-state.json +65 -0
  314. package/corpus/chunks/error-404-actions.json +54 -0
  315. package/corpus/chunks/error-404.json +204 -0
  316. package/corpus/chunks/error-500-actions.json +61 -0
  317. package/corpus/chunks/error-500.json +220 -0
  318. package/corpus/chunks/error-maintenance-actions.json +53 -0
  319. package/corpus/chunks/error-maintenance.json +203 -0
  320. package/corpus/chunks/error-page-shell.json +132 -0
  321. package/corpus/chunks/export-flow-async.json +210 -0
  322. package/corpus/chunks/export-flow-delivery.json +163 -0
  323. package/corpus/chunks/export-flow-sync.json +162 -0
  324. package/corpus/chunks/extended-profile-form.json +512 -0
  325. package/corpus/chunks/faq-accordion.json +123 -0
  326. package/corpus/chunks/feature-grid-icons.json +314 -0
  327. package/corpus/chunks/feature-grid-three-cards.json +187 -0
  328. package/corpus/chunks/feature-toggle-switch-grid.json +213 -0
  329. package/corpus/chunks/file-upload-dnd.json +166 -0
  330. package/corpus/chunks/file-upload-field.json +97 -0
  331. package/corpus/chunks/file-upload-form.json +251 -0
  332. package/corpus/chunks/filter-bar-active-filters.json +176 -0
  333. package/corpus/chunks/filter-bar-filter-bar-with-table.json +113 -0
  334. package/corpus/chunks/filter-bar-saved-views.json +117 -0
  335. package/corpus/chunks/filter-popover-form.json +137 -0
  336. package/corpus/chunks/footer-multi-column.json +270 -0
  337. package/corpus/chunks/footer-primary-only.json +41 -0
  338. package/corpus/chunks/form-checkbox-group.json +65 -0
  339. package/corpus/chunks/form-drawer-edit-form.json +178 -0
  340. package/corpus/chunks/form-drawer-simple-form.json +151 -0
  341. package/corpus/chunks/form-drawer-tall-form.json +325 -0
  342. package/corpus/chunks/form-field-email-hint.json +53 -0
  343. package/corpus/chunks/form-field-range.json +54 -0
  344. package/corpus/chunks/form-field-required.json +52 -0
  345. package/corpus/chunks/form-field-select.json +66 -0
  346. package/corpus/chunks/form-field-textarea.json +51 -0
  347. package/corpus/chunks/form-field-with-error.json +151 -0
  348. package/corpus/chunks/form-fields-two-column.json +69 -0
  349. package/corpus/chunks/form-page-shell.json +146 -0
  350. package/corpus/chunks/form-switch-toggle.json +41 -0
  351. package/corpus/chunks/form-system-live-demo.json +123 -0
  352. package/corpus/chunks/forms-address-autocomplete.json +277 -0
  353. package/corpus/chunks/forms-address-fields.json +221 -0
  354. package/corpus/chunks/forms-conditional-reveal.json +195 -0
  355. package/corpus/chunks/gallery-page-shell.json +444 -0
  356. package/corpus/chunks/grid-2col-entry-cards.json +140 -0
  357. package/corpus/chunks/grid-kpi-4col.json +164 -0
  358. package/corpus/chunks/grid-responsive-kpi.json +165 -0
  359. package/corpus/chunks/hero-cta-simple.json +107 -0
  360. package/corpus/chunks/hero-cta-split.json +183 -0
  361. package/corpus/chunks/hero-section-split.json +111 -0
  362. package/corpus/chunks/icon-text-row.json +60 -0
  363. package/corpus/chunks/image-caption-tile.json +99 -0
  364. package/corpus/chunks/image-carousel.json +156 -0
  365. package/corpus/chunks/image-thumbnail-grid.json +77 -0
  366. package/corpus/chunks/image-upload-preview.json +118 -0
  367. package/corpus/chunks/import-mapping-flow.json +972 -0
  368. package/corpus/chunks/inline-dialog-rename.json +128 -0
  369. package/corpus/chunks/inline-dialog-schedule.json +154 -0
  370. package/corpus/chunks/inline-dialog-status.json +179 -0
  371. package/corpus/chunks/integrations-api-keys-card-list.json +475 -0
  372. package/corpus/chunks/integrations-connect-form.json +550 -0
  373. package/corpus/chunks/integrations-grid.json +141 -0
  374. package/corpus/chunks/integrations-webhooks-empty-state.json +66 -0
  375. package/corpus/chunks/inventory-list-stock.json +137 -0
  376. package/corpus/chunks/invite-members.json +153 -0
  377. package/corpus/chunks/invoice-line-items.json +493 -0
  378. package/corpus/chunks/kanban-board-3col.json +713 -0
  379. package/corpus/chunks/kanban-page-shell.json +671 -0
  380. package/corpus/chunks/key-value-detail-list.json +242 -0
  381. package/corpus/chunks/keyboard-shortcut-display.json +250 -0
  382. package/corpus/chunks/labeled-textarea.json +45 -0
  383. package/corpus/chunks/leaderboard-table.json +140 -0
  384. package/corpus/chunks/library-browser-search-filter.json +109 -0
  385. package/corpus/chunks/linked-record-row.json +61 -0
  386. package/corpus/chunks/loading-skeleton-placeholder.json +387 -0
  387. package/corpus/chunks/login-form-card.json +207 -0
  388. package/corpus/chunks/logo-cloud-trusted-by.json +235 -0
  389. package/corpus/chunks/map-with-location-list.json +293 -0
  390. package/corpus/chunks/marketing-hero-cta.json +102 -0
  391. package/corpus/chunks/marketing-page-shell.json +352 -0
  392. package/corpus/chunks/masonry-gallery.json +154 -0
  393. package/corpus/chunks/member-edit-drawer.json +236 -0
  394. package/corpus/chunks/members-active-table-search-filter.json +184 -0
  395. package/corpus/chunks/members-pending-invites-cards.json +251 -0
  396. package/corpus/chunks/members-roles-permissions-list.json +146 -0
  397. package/corpus/chunks/menu-context-actions.json +113 -0
  398. package/corpus/chunks/metadata-description-list.json +178 -0
  399. package/corpus/chunks/modal-create-project-form.json +133 -0
  400. package/corpus/chunks/modal-preferences-tabs.json +147 -0
  401. package/corpus/chunks/multi-field-form-validation.json +394 -0
  402. package/corpus/chunks/nav-menu-icons.json +74 -0
  403. package/corpus/chunks/newsletter-subscription.json +190 -0
  404. package/corpus/chunks/notification-badges-feed.json +411 -0
  405. package/corpus/chunks/notification-preferences-panel.json +238 -0
  406. package/corpus/chunks/onb-completion.json +139 -0
  407. package/corpus/chunks/onb-extension-install.json +172 -0
  408. package/corpus/chunks/onb-hero-welcome.json +156 -0
  409. package/corpus/chunks/onb-import-picker.json +86 -0
  410. package/corpus/chunks/onb-mobile-handoff.json +121 -0
  411. package/corpus/chunks/onb-notification-prefs.json +83 -0
  412. package/corpus/chunks/onb-persona-picker.json +82 -0
  413. package/corpus/chunks/onb-provider-tiles.json +137 -0
  414. package/corpus/chunks/onb-settings-review.json +257 -0
  415. package/corpus/chunks/onb-step-footer.json +121 -0
  416. package/corpus/chunks/onb-step-header.json +121 -0
  417. package/corpus/chunks/onb-step-progress.json +140 -0
  418. package/corpus/chunks/onb-step-shell.json +380 -0
  419. package/corpus/chunks/onb-story-pane.json +121 -0
  420. package/corpus/chunks/onb-tutorial-steps.json +193 -0
  421. package/corpus/chunks/order-confirmation-success-card.json +177 -0
  422. package/corpus/chunks/order-tracking-timeline.json +131 -0
  423. package/corpus/chunks/pagination-controls.json +82 -0
  424. package/corpus/chunks/pane-settings-sidebar.json +204 -0
  425. package/corpus/chunks/patient-visit-shell.json +191 -0
  426. package/corpus/chunks/payment-checkout-form.json +341 -0
  427. package/corpus/chunks/payment-method-form.json +328 -0
  428. package/corpus/chunks/period-comparison.json +236 -0
  429. package/corpus/chunks/permission-matrix-table.json +438 -0
  430. package/corpus/chunks/permissions-matrix-grid.json +111 -0
  431. package/corpus/chunks/permissions-matrix-summary.json +157 -0
  432. package/corpus/chunks/permissions-role-picker-radio.json +107 -0
  433. package/corpus/chunks/permissions-role-picker-select.json +101 -0
  434. package/corpus/chunks/permissions-share-link.json +256 -0
  435. package/corpus/chunks/permissions-share-people.json +297 -0
  436. package/corpus/chunks/permissions-sharing-scopes.json +109 -0
  437. package/corpus/chunks/plan-selection-form.json +529 -0
  438. package/corpus/chunks/playground-a2ui.json +181 -0
  439. package/corpus/chunks/playground-agent-admin.json +117 -0
  440. package/corpus/chunks/playground-agent-chat.json +126 -0
  441. package/corpus/chunks/playground-app-shell.json +488 -0
  442. package/corpus/chunks/playground-chat.json +265 -0
  443. package/corpus/chunks/playground-construct-canvas.json +118 -0
  444. package/corpus/chunks/playground-css-channel.json +487 -0
  445. package/corpus/chunks/playground-gen-ui.json +224 -0
  446. package/corpus/chunks/playground-render-preview.json +369 -0
  447. package/corpus/chunks/playground-streams-bridge.json +437 -0
  448. package/corpus/chunks/playground-table-toolbar.json +38 -0
  449. package/corpus/chunks/popover-with-content.json +118 -0
  450. package/corpus/chunks/pricing-tiers.json +561 -0
  451. package/corpus/chunks/product-tour.json +158 -0
  452. package/corpus/chunks/profile-public.json +297 -0
  453. package/corpus/chunks/progress-tracker-milestones.json +294 -0
  454. package/corpus/chunks/radio-button-group.json +83 -0
  455. package/corpus/chunks/rating-stars-review-summary.json +259 -0
  456. package/corpus/chunks/reactions-bar.json +75 -0
  457. package/corpus/chunks/reactions-picker.json +245 -0
  458. package/corpus/chunks/real-time-metrics-dashboard.json +344 -0
  459. package/corpus/chunks/record-detail-drawer-simple-detail.json +296 -0
  460. package/corpus/chunks/record-detail-drawer-tabbed-detail.json +443 -0
  461. package/corpus/chunks/referral-share-link.json +128 -0
  462. package/corpus/chunks/referral-status.json +243 -0
  463. package/corpus/chunks/reg-address-form.json +825 -0
  464. package/corpus/chunks/reg-billing-card.json +210 -0
  465. package/corpus/chunks/reg-brand-scrape.json +599 -0
  466. package/corpus/chunks/reg-departments-toggle.json +259 -0
  467. package/corpus/chunks/reg-extended-profile.json +356 -0
  468. package/corpus/chunks/reg-final-done.json +457 -0
  469. package/corpus/chunks/reg-helpdesk-grid.json +571 -0
  470. package/corpus/chunks/reg-import-picker.json +112 -0
  471. package/corpus/chunks/reg-integrations-grid.json +418 -0
  472. package/corpus/chunks/reg-invite-form.json +245 -0
  473. package/corpus/chunks/reg-legal-entity.json +260 -0
  474. package/corpus/chunks/reg-org-chart-review.json +891 -0
  475. package/corpus/chunks/reg-profile-identity.json +188 -0
  476. package/corpus/chunks/reg-step-footer.json +201 -0
  477. package/corpus/chunks/reg-step-header.json +201 -0
  478. package/corpus/chunks/reg-step-progress.json +236 -0
  479. package/corpus/chunks/reg-step-shell.json +605 -0
  480. package/corpus/chunks/reg-story-pane.json +201 -0
  481. package/corpus/chunks/reg-success-summary.json +257 -0
  482. package/corpus/chunks/reg-team-size.json +128 -0
  483. package/corpus/chunks/reg-usecase-picker.json +104 -0
  484. package/corpus/chunks/reg-workspace-name.json +159 -0
  485. package/corpus/chunks/responsive-grid-pattern.json +71 -0
  486. package/corpus/chunks/responsive-kpi-grid.json +166 -0
  487. package/corpus/chunks/responsive-row-pattern.json +71 -0
  488. package/corpus/chunks/responsive-shell-sidebar.json +308 -0
  489. package/corpus/chunks/responsive-wrap-at-pattern.json +124 -0
  490. package/corpus/chunks/retention-cohort-default-retention.json +80 -0
  491. package/corpus/chunks/retention-cohort-stat-pair.json +163 -0
  492. package/corpus/chunks/retention-cohort-with-legend.json +135 -0
  493. package/corpus/chunks/revenue-heatmap.json +82 -0
  494. package/corpus/chunks/role-management.json +272 -0
  495. package/corpus/chunks/row-action-cluster.json +54 -0
  496. package/corpus/chunks/row-avatar-name-role.json +71 -0
  497. package/corpus/chunks/row-icon-label.json +52 -0
  498. package/corpus/chunks/row-spread-label-value.json +54 -0
  499. package/corpus/chunks/row-wrap-tags.json +72 -0
  500. package/corpus/chunks/schedule-meeting-form-card.json +229 -0
  501. package/corpus/chunks/search-recents-menu.json +195 -0
  502. package/corpus/chunks/search-results-grouped.json +357 -0
  503. package/corpus/chunks/search-results-list.json +202 -0
  504. package/corpus/chunks/search-saved-views.json +356 -0
  505. package/corpus/chunks/search-with-filters.json +311 -0
  506. package/corpus/chunks/searchable-picker-modal.json +164 -0
  507. package/corpus/chunks/section-with-stack.json +48 -0
  508. package/corpus/chunks/security-active-sessions-devices.json +287 -0
  509. package/corpus/chunks/security-change-password-form.json +102 -0
  510. package/corpus/chunks/security-delete-account-danger.json +79 -0
  511. package/corpus/chunks/segmented-control-billing-tabs.json +164 -0
  512. package/corpus/chunks/select-multiple-preselected.json +70 -0
  513. package/corpus/chunks/settings-2fa-setup.json +307 -0
  514. package/corpus/chunks/settings-admin-page.json +1205 -0
  515. package/corpus/chunks/settings-appearance-primitives.json +145 -0
  516. package/corpus/chunks/settings-appearance-theme-panel.json +55 -0
  517. package/corpus/chunks/settings-appearance.json +81 -0
  518. package/corpus/chunks/settings-danger-zone-delete-workspace.json +93 -0
  519. package/corpus/chunks/settings-general-form.json +69 -0
  520. package/corpus/chunks/settings-integrations.json +298 -0
  521. package/corpus/chunks/settings-members-invite.json +112 -0
  522. package/corpus/chunks/settings-notification-activity-checkboxes.json +108 -0
  523. package/corpus/chunks/settings-notification-channels-switches.json +101 -0
  524. package/corpus/chunks/settings-page-shell.json +190 -0
  525. package/corpus/chunks/settings-privacy.json +83 -0
  526. package/corpus/chunks/settings-profile-security.json +122 -0
  527. package/corpus/chunks/settings-toggle-switches.json +66 -0
  528. package/corpus/chunks/sidebar-nav.json +120 -0
  529. package/corpus/chunks/sidebar-navigation-panel.json +165 -0
  530. package/corpus/chunks/signup-form-card.json +218 -0
  531. package/corpus/chunks/signup-team-size-form.json +259 -0
  532. package/corpus/chunks/single-select-card-form.json +231 -0
  533. package/corpus/chunks/slider-range-controls.json +119 -0
  534. package/corpus/chunks/social-media-post-card.json +159 -0
  535. package/corpus/chunks/sortable-list.json +307 -0
  536. package/corpus/chunks/sortable-search-paginate-table.json +162 -0
  537. package/corpus/chunks/split-pane-editor.json +146 -0
  538. package/corpus/chunks/stack-avatar-badge-overlay.json +53 -0
  539. package/corpus/chunks/stack-image-shimmer.json +51 -0
  540. package/corpus/chunks/stat-cards-kpi-dashboard.json +178 -0
  541. package/corpus/chunks/stats-band-big-numbers.json +175 -0
  542. package/corpus/chunks/status-dashboard.json +282 -0
  543. package/corpus/chunks/stepper-form-wizard.json +165 -0
  544. package/corpus/chunks/subscription-status-renewal-card.json +285 -0
  545. package/corpus/chunks/survey-rating-form.json +165 -0
  546. package/corpus/chunks/swiper-product-carousel.json +349 -0
  547. package/corpus/chunks/swiper-testimonial-carousel.json +279 -0
  548. package/corpus/chunks/table-empty-state.json +116 -0
  549. package/corpus/chunks/table-inline-edit-row.json +269 -0
  550. package/corpus/chunks/table-spreadsheet-cells.json +334 -0
  551. package/corpus/chunks/table-toolbar-no-search.json +42 -0
  552. package/corpus/chunks/table-toolbar-with-table.json +208 -0
  553. package/corpus/chunks/table-with-toolbar-card.json +80 -0
  554. package/corpus/chunks/tabs-with-panels.json +187 -0
  555. package/corpus/chunks/tag-chips-filter.json +100 -0
  556. package/corpus/chunks/team-invite-form.json +380 -0
  557. package/corpus/chunks/team-members-list.json +341 -0
  558. package/corpus/chunks/testimonial-grid.json +269 -0
  559. package/corpus/chunks/testimonial-pull-quote.json +137 -0
  560. package/corpus/chunks/testimonials-avatar-cards.json +286 -0
  561. package/corpus/chunks/timeline-events.json +89 -0
  562. package/corpus/chunks/timezone-selector-basic.json +99 -0
  563. package/corpus/chunks/timezone-selector-preview.json +104 -0
  564. package/corpus/chunks/toolbar-icons.json +216 -0
  565. package/corpus/chunks/toolbar-rich-text-editor.json +230 -0
  566. package/corpus/chunks/toolbar-tooltips.json +191 -0
  567. package/corpus/chunks/tooltip-hover-button.json +106 -0
  568. package/corpus/chunks/tree-file-explorer.json +136 -0
  569. package/corpus/chunks/tree-table-basic.json +171 -0
  570. package/corpus/chunks/trial-banner.json +158 -0
  571. package/corpus/chunks/url-import-form.json +728 -0
  572. package/corpus/chunks/usage-quota-meter-card.json +217 -0
  573. package/corpus/chunks/user-identity-row.json +81 -0
  574. package/corpus/chunks/user-onboarding-checklist.json +301 -0
  575. package/corpus/chunks/user-profile-card.json +192 -0
  576. package/corpus/chunks/users-table-badge.json +135 -0
  577. package/corpus/chunks/verification-document-upload.json +179 -0
  578. package/corpus/chunks/verification-status.json +97 -0
  579. package/corpus/chunks/verification-stepper.json +111 -0
  580. package/corpus/chunks/video-player-controls.json +120 -0
  581. package/corpus/chunks/webhook-config.json +209 -0
  582. package/corpus/chunks/webhooks-list.json +204 -0
  583. package/corpus/chunks/wizard-drawer-three-step-wizard.json +443 -0
  584. package/corpus/manifest.d.ts +4 -0
  585. package/corpus/manifest.json +6 -0
  586. package/corpus/scripts/chunk-library.d.ts +4 -0
  587. package/corpus/scripts/chunk-library.js +335 -0
  588. package/node-shims.d.ts +48 -0
  589. package/package.json +215 -0
  590. package/retrieval/CHANGELOG.md +1073 -0
  591. package/retrieval/README.md +71 -0
  592. package/retrieval/anti-patterns.js +189 -0
  593. package/retrieval/authoring/index.d.ts +4 -0
  594. package/retrieval/authoring/index.js +9 -0
  595. package/retrieval/authoring/web-research.js +220 -0
  596. package/retrieval/catalog.js +250 -0
  597. package/retrieval/component-catalog.js +168 -0
  598. package/retrieval/component-entry.js +80 -0
  599. package/retrieval/context-assembler.js +174 -0
  600. package/retrieval/domain-router.js +417 -0
  601. package/retrieval/embedding/chunk-embedding-retriever.js +117 -0
  602. package/retrieval/embedding/embedding-provider.js +72 -0
  603. package/retrieval/embedding/index.d.ts +4 -0
  604. package/retrieval/embedding/index.js +2 -0
  605. package/retrieval/feedback/dialog-recorder.js +107 -0
  606. package/retrieval/feedback/feedback-analyzer.js +180 -0
  607. package/retrieval/feedback/feedback-store.js +194 -0
  608. package/retrieval/feedback/feedback.js +117 -0
  609. package/retrieval/feedback/gap-registry.js +80 -0
  610. package/retrieval/feedback/human-signal.js +113 -0
  611. package/retrieval/feedback/index.d.ts +4 -0
  612. package/retrieval/feedback/index.js +24 -0
  613. package/retrieval/feedback/submit-feedback.js +45 -0
  614. package/retrieval/index.d.ts +4 -0
  615. package/retrieval/index.js +53 -0
  616. package/retrieval/intent/clarity.js +139 -0
  617. package/retrieval/intent/decomposer.js +124 -0
  618. package/retrieval/intent/index.d.ts +4 -0
  619. package/retrieval/intent/index.js +18 -0
  620. package/retrieval/intent/intent-alignment.js +172 -0
  621. package/retrieval/intent/intent-categorizer.js +69 -0
  622. package/retrieval/intent/intent-gate.js +96 -0
  623. package/retrieval/intent/prompt-analyzer.js +162 -0
  624. package/retrieval/wiring-catalog.js +168 -0
  625. package/validate/catalog-validator.d.ts +4 -0
  626. package/validate/catalog-validator.js +327 -0
  627. package/validate/semantic/cache.js +54 -0
  628. package/validate/semantic/classify-intent.js +128 -0
  629. package/validate/semantic/index.js +163 -0
  630. package/validate/semantic/intent-specs.js +162 -0
  631. package/validate/semantic/judge.js +180 -0
@@ -0,0 +1,172 @@
1
+ const FIELD_PATTERNS = [
2
+ /\b(email|password|username|name|phone|address|city|state|zip|country|company|title|role|bio|url|website|date|time|description|message|subject|amount|price|quantity|search|notes?)\b/gi
3
+ ];
4
+ const COMPONENT_PATTERNS = [
5
+ /\b(button|form|table|chart|card|avatar|badge|alert|modal|drawer|tabs?|sidebar|navbar|breadcrumb|pagination|progress|slider|toggle|checkbox|radio|dropdown|select|upload|calendar|timeline|steps?|accordion)\b/gi
6
+ ];
7
+ const QUANTITY_MAP = { one: 1, two: 2, three: 3, four: 4, five: 5, six: 6, seven: 7, eight: 8, nine: 9, ten: 10 };
8
+ const QUANTITY_PATTERN = /\b(\d+|one|two|three|four|five|six|seven|eight|nine|ten)\s+(cards?|columns?|items?|fields?|buttons?|sections?|rows?|tiles?|steps?|tabs?|metrics?|stats?)\b/gi;
9
+ const ACTION_PATTERNS = [
10
+ /\b(submit|cancel|save|delete|edit|close|open|search|filter|sort|login|signup|register|checkout|confirm|reset|send|upload|download|share|copy|print)\b/gi
11
+ ];
12
+ const CONTENT_PATTERNS = [
13
+ /["']([^"']+)["']/g,
14
+ // quoted strings
15
+ /\$[\d,.]+/g,
16
+ // dollar amounts
17
+ /\d+%/g
18
+ // percentages
19
+ ];
20
+ function extractExpectations(intent) {
21
+ const lower = intent.toLowerCase();
22
+ const fields = [];
23
+ for (const pattern of FIELD_PATTERNS) {
24
+ pattern.lastIndex = 0;
25
+ let match;
26
+ while (match = pattern.exec(lower)) {
27
+ const f = (match[1] ?? "").toLowerCase();
28
+ if (!fields.includes(f)) fields.push(f);
29
+ }
30
+ }
31
+ const componentTypes = [];
32
+ for (const pattern of COMPONENT_PATTERNS) {
33
+ pattern.lastIndex = 0;
34
+ let match;
35
+ while (match = pattern.exec(lower)) {
36
+ const t = (match[1] ?? "").toLowerCase();
37
+ if (!componentTypes.includes(t)) componentTypes.push(t);
38
+ }
39
+ }
40
+ const quantities = [];
41
+ QUANTITY_PATTERN.lastIndex = 0;
42
+ let qMatch;
43
+ while (qMatch = QUANTITY_PATTERN.exec(lower)) {
44
+ const raw = qMatch[1] ?? "";
45
+ const num = QUANTITY_MAP[raw] ?? parseInt(raw, 10);
46
+ const type = (qMatch[2] ?? "").replace(/s$/, "");
47
+ if (!isNaN(num)) quantities.push({ count: num, type });
48
+ }
49
+ const actions = [];
50
+ for (const pattern of ACTION_PATTERNS) {
51
+ pattern.lastIndex = 0;
52
+ let match;
53
+ while (match = pattern.exec(lower)) {
54
+ const a = (match[1] ?? "").toLowerCase();
55
+ if (!actions.includes(a)) actions.push(a);
56
+ }
57
+ }
58
+ const content = [];
59
+ for (const pattern of CONTENT_PATTERNS) {
60
+ pattern.lastIndex = 0;
61
+ let match;
62
+ while (match = pattern.exec(intent)) {
63
+ content.push(match[1] ?? match[0]);
64
+ }
65
+ }
66
+ return { fields, componentTypes, quantities, actions, content };
67
+ }
68
+ const TYPE_MAP = {
69
+ button: ["Button"],
70
+ form: ["FormContainer", "TextField", "Column"],
71
+ table: ["Table"],
72
+ chart: ["Chart"],
73
+ card: ["Card"],
74
+ avatar: ["Avatar"],
75
+ badge: ["Badge"],
76
+ alert: ["Alert"],
77
+ modal: ["Modal", "Dialog"],
78
+ drawer: ["Drawer"],
79
+ tab: ["Tabs", "Tab"],
80
+ sidebar: ["Sidebar"],
81
+ navbar: ["Nav"],
82
+ breadcrumb: ["Breadcrumb"],
83
+ pagination: ["Pagination"],
84
+ progress: ["Progress"],
85
+ slider: ["Slider"],
86
+ toggle: ["Toggle"],
87
+ checkbox: ["CheckBox"],
88
+ radio: ["Radio"],
89
+ dropdown: ["ChoicePicker", "Select"],
90
+ select: ["ChoicePicker", "Select"],
91
+ upload: ["Upload"],
92
+ calendar: ["CalendarPicker", "DateTimeInput"],
93
+ timeline: ["Timeline"],
94
+ step: ["Steps"],
95
+ accordion: ["Accordion"]
96
+ };
97
+ function verifyAlignment(components, expectations) {
98
+ const checks = [];
99
+ const gaps = [];
100
+ const allText = components.map((c) => {
101
+ const texts = [c["textContent"], c["text"], c["label"], c["placeholder"], c["description"], c["name"]];
102
+ return texts.filter(Boolean).join(" ").toLowerCase();
103
+ }).join(" ");
104
+ const allTypes = new Set(components.map((c) => c.component));
105
+ for (const field of expectations.fields) {
106
+ const found = allText.includes(field) || components.some((c) => (c["label"] ?? "").toLowerCase().includes(field) || (c["placeholder"] ?? "").toLowerCase().includes(field) || (c["name"] ?? "").toLowerCase().includes(field));
107
+ checks.push({
108
+ category: "field",
109
+ expected: field,
110
+ found,
111
+ detail: found ? `Found "${field}" in component properties` : `Missing field: "${field}"`
112
+ });
113
+ if (!found) gaps.push(`Missing field "${field}"`);
114
+ }
115
+ for (const type of expectations.componentTypes) {
116
+ const mappedTypes = TYPE_MAP[type] ?? [type.charAt(0).toUpperCase() + type.slice(1)];
117
+ const found = mappedTypes.some((t) => allTypes.has(t));
118
+ checks.push({
119
+ category: "componentType",
120
+ expected: type,
121
+ found,
122
+ detail: found ? `Found ${type} component` : `Missing component type: ${type}`
123
+ });
124
+ if (!found) gaps.push(`Missing ${type} component`);
125
+ }
126
+ for (const { count, type } of expectations.quantities) {
127
+ const mappedTypes = TYPE_MAP[type] ?? [type.charAt(0).toUpperCase() + type.slice(1)];
128
+ const actual = components.filter((c) => mappedTypes.some((t) => c.component === t)).length;
129
+ const found = actual >= count;
130
+ checks.push({
131
+ category: "quantity",
132
+ expected: `${count} ${type}(s)`,
133
+ found,
134
+ detail: found ? `Found ${actual} ${type}(s) (expected ${count})` : `Only ${actual} ${type}(s), expected ${count}`
135
+ });
136
+ if (!found) gaps.push(`Expected ${count} ${type}(s), found ${actual}`);
137
+ }
138
+ for (const action of expectations.actions) {
139
+ const found = allText.includes(action) || components.some((c) => c.component === "Button" && (c["text"] ?? "").toLowerCase().includes(action));
140
+ checks.push({
141
+ category: "action",
142
+ expected: action,
143
+ found,
144
+ detail: found ? `Found "${action}" action` : `Missing action: "${action}"`
145
+ });
146
+ if (!found) gaps.push(`Missing "${action}" action`);
147
+ }
148
+ for (const text of expectations.content) {
149
+ const found = allText.includes(text.toLowerCase());
150
+ checks.push({
151
+ category: "content",
152
+ expected: text,
153
+ found,
154
+ detail: found ? `Found content "${text}"` : `Missing content: "${text}"`
155
+ });
156
+ if (!found) gaps.push(`Missing content "${text}"`);
157
+ }
158
+ const total = checks.length;
159
+ const passed = checks.filter((c) => c.found).length;
160
+ const score = total > 0 ? Math.round(passed / total * 100) / 100 : 1;
161
+ return { score, checks, gaps };
162
+ }
163
+ function checkIntentAlignment(intent, components) {
164
+ const expectations = extractExpectations(intent);
165
+ const result = verifyAlignment(components, expectations);
166
+ return { ...result, expectations };
167
+ }
168
+ export {
169
+ checkIntentAlignment,
170
+ extractExpectations,
171
+ verifyAlignment
172
+ };
@@ -0,0 +1,69 @@
1
+ const CATEGORY_RULES = [
2
+ // Form categories
3
+ { category: "form/login", keywords: ["login", "sign in", "signin", "log in", "authentication"] },
4
+ { category: "form/signup", keywords: ["signup", "sign up", "register", "registration", "create account", "onboarding"] },
5
+ { category: "form/contact", keywords: ["contact", "contact us", "reach out", "get in touch", "enquiry", "inquiry"] },
6
+ { category: "form/settings", keywords: ["settings", "preferences", "config", "configuration", "account settings", "profile edit"] },
7
+ { category: "form/checkout", keywords: ["checkout", "check out", "payment", "billing", "purchase"] },
8
+ // Data categories
9
+ { category: "data/table", keywords: ["table", "data table", "spreadsheet", "grid view", "list view", "datagrid"] },
10
+ { category: "data/dashboard", keywords: ["dashboard", "kpi", "metrics", "analytics", "overview", "summary panel", "stats"] },
11
+ { category: "data/chart", keywords: ["chart", "graph", "visualization", "pie chart", "bar chart", "line chart", "histogram"] },
12
+ // Layout categories
13
+ { category: "layout/landing", keywords: ["landing", "landing page", "homepage", "hero", "splash"] },
14
+ { category: "layout/profile", keywords: ["profile", "user profile", "avatar", "bio", "about me"] },
15
+ { category: "layout/pricing", keywords: ["pricing", "pricing table", "plans", "subscription", "tier"] },
16
+ // Navigation categories
17
+ { category: "nav/sidebar", keywords: ["sidebar", "side nav", "navigation menu", "drawer", "side panel"] },
18
+ { category: "nav/tabs", keywords: ["tabs", "tab bar", "tabbed", "tab navigation", "tab panel"] },
19
+ // Agent categories
20
+ { category: "agent/chat", keywords: ["chat", "chatbot", "messenger", "conversation", "messaging", "chat interface"] },
21
+ { category: "agent/notification", keywords: ["notification", "alert", "toast", "snackbar", "banner", "announcement"] },
22
+ // Content categories
23
+ { category: "content/blog", keywords: ["blog", "article", "post", "news", "editorial", "content feed"] },
24
+ { category: "content/faq", keywords: ["faq", "frequently asked", "questions", "help center", "knowledge base", "accordion"] },
25
+ // Commerce categories
26
+ { category: "commerce/product", keywords: ["product", "product card", "product page", "product detail", "item detail", "catalog"] },
27
+ { category: "commerce/cart", keywords: ["cart", "shopping cart", "basket", "bag"] },
28
+ { category: "commerce/order", keywords: ["order", "order history", "order summary", "receipt", "invoice", "order tracking"] },
29
+ // Workflow categories
30
+ { category: "workflow/wizard", keywords: ["wizard", "stepper", "multi-step", "step form", "onboard flow", "setup wizard"] },
31
+ { category: "workflow/kanban", keywords: ["kanban", "board", "task board", "trello", "project board", "drag and drop"] },
32
+ // Status categories
33
+ { category: "status/error", keywords: ["error", "error page", "404", "500", "not found", "something went wrong"] },
34
+ { category: "status/empty", keywords: ["empty state", "no results", "no data", "zero state", "blank slate"] },
35
+ { category: "status/loading", keywords: ["loading", "skeleton", "spinner", "progress", "placeholder"] }
36
+ ];
37
+ function categorizeIntent(intent) {
38
+ if (!intent || typeof intent !== "string") {
39
+ return { category: "other", confidence: 0 };
40
+ }
41
+ const lower = intent.toLowerCase().trim();
42
+ let bestCategory = "other";
43
+ let bestScore = 0;
44
+ for (const rule of CATEGORY_RULES) {
45
+ let matchCount = 0;
46
+ let longestMatch = 0;
47
+ for (const kw of rule.keywords) {
48
+ if (lower.includes(kw)) {
49
+ matchCount++;
50
+ longestMatch = Math.max(longestMatch, kw.length);
51
+ }
52
+ }
53
+ if (matchCount === 0) continue;
54
+ const kwLenBonus = longestMatch / lower.length;
55
+ const multiMatchBonus = Math.min(matchCount * 0.15, 0.3);
56
+ const score = 0.5 + kwLenBonus * 0.3 + multiMatchBonus;
57
+ if (score > bestScore) {
58
+ bestScore = score;
59
+ bestCategory = rule.category;
60
+ }
61
+ }
62
+ return {
63
+ category: bestCategory,
64
+ confidence: Math.min(Math.round(bestScore * 100) / 100, 1)
65
+ };
66
+ }
67
+ export {
68
+ categorizeIntent
69
+ };
@@ -0,0 +1,96 @@
1
+ const QUESTION_STARTERS = /^\s*(what|how|why|can you|could you|tell me|explain|describe|help|who|where|when|is there|are there|do you|does|did|will|should|would|which|list|show me how)\b/i;
2
+ const GREETINGS = /^\s*(hi|hey|hello|thanks|thank you|bye|goodbye|ok|okay|sure|great|nice|cool|awesome|good|perfect)\b/i;
3
+ const META_PATTERNS = [
4
+ /what\s+(components?|types?|elements?)\s+(are|do|can)/i,
5
+ /available\s+(components?|types?|elements?)/i,
6
+ /how\s+(does|do)\s+(this|it|the system|gen ui|a2ui)/i,
7
+ /what\s+can\s+(you|this|it)\s+(do|generate|create|build)/i,
8
+ /help\s+me\s+understand/i,
9
+ /list\s+(of\s+)?(components?|types?|elements?)/i,
10
+ /what\s+(is|are)\s+(a2ui|agentui|agent ui|gen ui)/i,
11
+ /show\s+me\s+(the\s+)?(components?|options?|catalog)/i,
12
+ /explain\s+(the|how|what|a)/i,
13
+ /how\s+(to|do\s+I)\s+(use|create|build|make)/i,
14
+ /what\s+would\s+.+\s+look\s+like/i,
15
+ /show\s+me\s+how/i
16
+ ];
17
+ const NOISE_PATTERNS = [
18
+ /^<[^>]+>/,
19
+ // Starts with HTML tag
20
+ /^\s*[^\w\s]{3,}/
21
+ // Starts with 3+ non-word chars
22
+ ];
23
+ const VAGUE_PATTERNS = [
24
+ /^(do|just|go|let'?s|get|keep|stay|stop|try|move|make it|finish|start|begin|end|run)\b.{0,30}$/i,
25
+ // short imperative without UI nouns
26
+ /\b(you gotta|gotta do|no excuses|believe|motivat|inspir|goal|dream|life|love|hate|feel|think about)\b/i,
27
+ /\b(what is preventing|what stops|why can't|why won't)\b/i,
28
+ // philosophical/motivational questions
29
+ /\b(do it|get it done|let'?s go|make it happen|just do it|never give up)\b/i
30
+ // motivational slogans
31
+ ];
32
+ const TOOL_USE_PATTERNS = [
33
+ /\b(create|file|write|open|submit|log)\s+(a\s+)?(ticket|bug|issue|report|feature request)/i,
34
+ /\b(report|flag)\s+(a\s+)?(bug|issue|problem|error|regression)/i,
35
+ /\b(why|how come)\s+(does|did|is|was|are)\b/i,
36
+ // "why does X do Y" — asking for rationale
37
+ /\bthis\s+(is|looks?)\s+(broken|wrong|buggy|off|weird|strange)/i,
38
+ /\b(fix|repair|debug|investigate)\s+(this|the|that)/i,
39
+ /\bsomething\s+(is|seems|looks?)\s+(wrong|broken|off)/i,
40
+ /\bmark\s+(this|it)\s+as\b/i,
41
+ /\b(save|bookmark|pin)\s+(this|the)\s+(pattern|output|result)/i
42
+ ];
43
+ function isConversational(text, classifyResult) {
44
+ const trimmed = (text ?? "").trim();
45
+ let cls = classifyResult && typeof classifyResult === "object" ? classifyResult : { confidence: 0, matchedSignals: [] };
46
+ if (trimmed.length < 5 && cls.confidence === 0) {
47
+ return { conversational: true, reason: "short-input" };
48
+ }
49
+ for (const pattern of NOISE_PATTERNS) {
50
+ if (pattern.test(trimmed) && cls.confidence === 0) {
51
+ return { conversational: true, reason: "noise-input" };
52
+ }
53
+ }
54
+ for (const pattern of META_PATTERNS) {
55
+ if (pattern.test(trimmed)) {
56
+ return { conversational: true, reason: "meta-question" };
57
+ }
58
+ }
59
+ for (const pattern of TOOL_USE_PATTERNS) {
60
+ if (pattern.test(trimmed)) {
61
+ return { conversational: true, reason: "tool-use" };
62
+ }
63
+ }
64
+ if (cls.confidence < 0.2) {
65
+ for (const pattern of VAGUE_PATTERNS) {
66
+ if (pattern.test(trimmed)) {
67
+ return { conversational: true, reason: "vague-or-abstract" };
68
+ }
69
+ }
70
+ }
71
+ if (GREETINGS.test(trimmed) && cls.confidence === 0) {
72
+ return { conversational: true, reason: "greeting" };
73
+ }
74
+ if (cls.confidence >= 0.3) {
75
+ return { conversational: false, reason: "high-domain-confidence" };
76
+ }
77
+ if ((cls.matchedSignals?.length ?? 0) >= 2) {
78
+ return { conversational: false, reason: "multiple-domain-signals" };
79
+ }
80
+ if (QUESTION_STARTERS.test(trimmed) && (cls.matchedSignals?.length ?? 0) <= 1) {
81
+ return { conversational: true, reason: "question-single-signal" };
82
+ }
83
+ if (GREETINGS.test(trimmed) && cls.confidence < 0.2) {
84
+ return { conversational: true, reason: "greeting-low-confidence" };
85
+ }
86
+ if (cls.confidence > 0) {
87
+ return { conversational: false, reason: "has-domain-signal" };
88
+ }
89
+ if (trimmed.endsWith("?")) {
90
+ return { conversational: true, reason: "ends-with-question-mark" };
91
+ }
92
+ return { conversational: true, reason: "no-ui-signals" };
93
+ }
94
+ export {
95
+ isConversational
96
+ };
@@ -0,0 +1,162 @@
1
+ let _vocab = null;
2
+ async function getVocab() {
3
+ if (_vocab) return _vocab;
4
+ let catalogJson = {};
5
+ try {
6
+ const IS_NODE = typeof process !== "undefined" && process.versions?.node;
7
+ if (IS_NODE) {
8
+ const fs = await import(
9
+ /* @vite-ignore */
10
+ "node:fs/promises"
11
+ );
12
+ const path = await import(
13
+ /* @vite-ignore */
14
+ "node:path"
15
+ );
16
+ const url = await import(
17
+ /* @vite-ignore */
18
+ "node:url"
19
+ );
20
+ const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
21
+ const raw = await fs.readFile(path.join(__dirname, "../../corpus/catalog-a2ui_0_9.json"), "utf8");
22
+ catalogJson = JSON.parse(raw);
23
+ } else {
24
+ const resp = await fetch(new URL("../../corpus/catalog-a2ui_0_9.json", import.meta.url));
25
+ if (resp.ok) catalogJson = await resp.json();
26
+ }
27
+ } catch {
28
+ }
29
+ const comps = catalogJson?.["components"] ?? {};
30
+ const displayList = [];
31
+ const allowedSet = /* @__PURE__ */ new Set();
32
+ for (const [name, def] of Object.entries(comps)) {
33
+ allowedSet.add(name);
34
+ const ext = def?.["x-adiaui"] ?? {};
35
+ const syns = ext && typeof ext === "object" ? ext["synonyms"] : null;
36
+ const tags = syns && typeof syns === "object" ? syns["tags"] : null;
37
+ const aliases = Array.isArray(tags) ? tags.filter((t) => typeof t === "string") : [];
38
+ for (const a of aliases) allowedSet.add(a);
39
+ displayList.push(aliases.length ? `${name} (also: ${aliases.join(", ")})` : name);
40
+ }
41
+ _vocab = { displayList, allowedSet };
42
+ return _vocab;
43
+ }
44
+ async function analyzePrompt({ intent, llmAdapter, domain }) {
45
+ const passthrough = {
46
+ raw: intent,
47
+ concepts: [],
48
+ entities: [],
49
+ impliedComponents: [],
50
+ styleHints: [],
51
+ steelman: intent,
52
+ analyzed: false
53
+ };
54
+ if (!intent || !llmAdapter) return passthrough;
55
+ const { displayList, allowedSet } = await getVocab();
56
+ const componentList = displayList.length ? displayList.join(", ") : "Card, Section, Header, Footer, Column, Row, Grid, Button, Input, Text, Image, Badge, Icon, Avatar, Alert, Modal, Tabs, Accordion";
57
+ const domainHint = domain?.["domain"] && (domain?.["confidence"] ?? 0) > 0 ? `
58
+ Domain classifier suggests: ${domain["domain"]} (confidence ${domain["confidence"]})` : "";
59
+ const systemPrompt = `You are a UI brief enricher for the AdiaUI design system. Given a terse or under-specified user prompt, you extract structured signals and produce an enriched brief that a downstream UI generator can use to produce a polished, complete UI.
60
+
61
+ Your output is JSON with this exact shape \u2014 no markdown, no explanation:
62
+ {
63
+ "concepts": [string], // 2-5 short concept tags (e.g. "commerce", "authentication", "data-display", "navigation")
64
+ "entities": [string], // explicit nouns from the prompt (lowercase, singular)
65
+ "implied_components": [string],// 4-12 AdiaUI components a good designer would include
66
+ "style_hints": [string], // visual/style adjectives ("minimal", "dense", "3D", "playful"), [] if none stated
67
+ "steelman": string // 1-2 sentence enriched brief
68
+ }
69
+
70
+ AdiaUI components you may name in implied_components (use these names exactly): ${componentList}
71
+
72
+ Rules:
73
+ - Extract entities verbatim from the prompt \u2014 do not invent.
74
+ - implied_components should include both the obvious (Card, Button) AND the ones a thoughtful designer would add (Badge for sale tag on a product, Avatar for a user row, EmptyState for empty data).
75
+ - The steelman expands the prompt into what the user MEANT, not what they SAID. Add the implicit requirements: typical sub-elements, sensible defaults, a header, a footer, common variants. Do NOT add scope the user wouldn't want (e.g. don't turn "login form" into "login form with social auth" unless that's a near-universal expectation).
76
+ - Keep steelman under 250 characters.
77
+ - If the prompt is already well-specified (>15 words, multiple entities), the steelman is mostly a faithful restatement.
78
+
79
+ Examples:
80
+ Input: "product card"
81
+ Output: {"concepts":["commerce","product-display"],"entities":["product"],"implied_components":["Card","Image","Text","Badge","Button"],"style_hints":[],"steelman":"E-commerce product card with image, title, price, optional sale badge, and primary 'Add to cart' button. Card layout, single product."}
82
+
83
+ Input: "settings page with toggles for notifications, dark mode, and privacy"
84
+ Output: {"concepts":["settings","preferences"],"entities":["notifications","dark mode","privacy","toggles"],"implied_components":["Card","Header","Section","Toggle","Text","Divider"],"style_hints":[],"steelman":"Settings page with three toggle rows for notifications, dark mode, and privacy. Each row has a label, description, and toggle. Grouped under a header card."}
85
+
86
+ Input: "make it 3D"
87
+ Output: {"concepts":["style-modifier"],"entities":[],"implied_components":[],"style_hints":["3D","depth","shadow"],"steelman":"Modify the existing canvas to feel three-dimensional \u2014 add elevation, layered shadows, and depth-suggesting transforms. Apply to existing components without changing structure."}`;
88
+ const userMsg = `Prompt: "${intent}"${domainHint}`;
89
+ let response;
90
+ try {
91
+ response = await llmAdapter.complete({
92
+ messages: [{ role: "user", content: userMsg }],
93
+ systemPrompt
94
+ });
95
+ } catch {
96
+ return passthrough;
97
+ }
98
+ const text = response?.content;
99
+ if (!text) return passthrough;
100
+ if (response.stopReason && response.stopReason !== "end" && response.stopReason !== "end_turn" && response.stopReason !== "stop") {
101
+ return passthrough;
102
+ }
103
+ let parsed = null;
104
+ try {
105
+ parsed = JSON.parse(text.trim());
106
+ } catch {
107
+ }
108
+ if (!parsed) {
109
+ const fence = text.match(/```(?:json)?\s*\n?([\s\S]*?)```/);
110
+ if (fence) try {
111
+ parsed = JSON.parse((fence[1] ?? "").trim());
112
+ } catch {
113
+ }
114
+ }
115
+ if (!parsed) {
116
+ const start = text.indexOf("{");
117
+ const end = text.lastIndexOf("}");
118
+ if (start >= 0 && end > start) {
119
+ try {
120
+ parsed = JSON.parse(text.slice(start, end + 1));
121
+ } catch {
122
+ }
123
+ }
124
+ }
125
+ if (!parsed || typeof parsed !== "object") return passthrough;
126
+ const p = parsed;
127
+ const impliedComponents = Array.isArray(p["implied_components"]) ? p["implied_components"].filter((c) => typeof c === "string" && (allowedSet.size === 0 || allowedSet.has(c))) : [];
128
+ return {
129
+ raw: intent,
130
+ concepts: asStringArray(p["concepts"]).slice(0, 8),
131
+ entities: asStringArray(p["entities"]).slice(0, 16),
132
+ impliedComponents: impliedComponents.slice(0, 16),
133
+ styleHints: asStringArray(p["style_hints"]).slice(0, 8),
134
+ steelman: typeof p["steelman"] === "string" && p["steelman"].trim() || intent,
135
+ analyzed: true
136
+ };
137
+ }
138
+ function asStringArray(v) {
139
+ if (!Array.isArray(v)) return [];
140
+ return v.filter((x) => typeof x === "string" && x.trim().length > 0).map((x) => x.trim());
141
+ }
142
+ function formatAnalysisForPrompt(analysis) {
143
+ if (!analysis || !analysis.analyzed) return "";
144
+ const parts = [];
145
+ if (analysis.steelman && analysis.steelman !== analysis.raw) {
146
+ parts.push(`ENRICHED BRIEF: ${analysis.steelman}`);
147
+ }
148
+ if (analysis.impliedComponents?.length) {
149
+ parts.push(`EXPECTED COMPONENTS: ${analysis.impliedComponents.join(", ")}`);
150
+ }
151
+ if (analysis.concepts?.length) {
152
+ parts.push(`CONCEPTS: ${analysis.concepts.join(", ")}`);
153
+ }
154
+ if (analysis.styleHints?.length) {
155
+ parts.push(`STYLE HINTS: ${analysis.styleHints.join(", ")}`);
156
+ }
157
+ return parts.join("\n");
158
+ }
159
+ export {
160
+ analyzePrompt,
161
+ formatAnalysisForPrompt
162
+ };
@@ -0,0 +1,168 @@
1
+ const adiaEvents = [
2
+ { event: "press", payload: null, description: "Button or interactive element activated." },
3
+ { event: "submit", payload: "form-values", description: "Form submission with validated field values." },
4
+ { event: "input", payload: "target-value", description: "Value changed (fires on every keystroke)." },
5
+ { event: "change", payload: "event-detail", description: "Value committed (fires on blur or selection)." },
6
+ { event: "select", payload: "event-detail", description: "Item selected from list, table, or menu." },
7
+ { event: "toggle", payload: "boolean", description: "Boolean state flipped (switch, checkbox)." },
8
+ { event: "dismiss", payload: null, description: "Close/dismiss (dialog, toast, popover)." },
9
+ { event: "navigate", payload: "route", description: "Internal navigation request." },
10
+ { event: "mount", payload: null, description: "Surface or component entered the DOM." },
11
+ { event: "unmount", payload: null, description: "Surface or component left the DOM." },
12
+ { event: "focus", payload: null, description: "Element received focus." },
13
+ { event: "blur", payload: null, description: "Element lost focus." },
14
+ { event: "drag", payload: "event-detail", description: "Drag operation on a sortable/draggable." },
15
+ { event: "drop", payload: "event-detail", description: "Drop completed on a sortable/draggable." }
16
+ ];
17
+ function getWiringCatalog() {
18
+ return {
19
+ // ── ADIA EVENTS ──
20
+ adiaEvents,
21
+ // ── DATA: how the surface gets its data ──
22
+ data: {
23
+ description: "Fetch external data into the surface model. Sources are URI-based with refresh strategies.",
24
+ paramSources: ["route", "store", "literal", "query", "parent"],
25
+ uriSchemes: ["resource://", "api://", "mock://", "ws://", "sse://"],
26
+ refreshStrategies: ["once", "on-focus", "interval:{ms}", "stream"],
27
+ example: {
28
+ params: { userId: { from: "route", key: "id" } },
29
+ sources: [
30
+ { id: "user", uri: "resource://users/{userId}", path: "/user", refresh: "once" },
31
+ { id: "activity", uri: "resource://users/{userId}/activity", path: "/activity", refresh: "on-focus" }
32
+ ]
33
+ }
34
+ },
35
+ // ── STATE: controllers that manage component behavior ──
36
+ controllers: [
37
+ {
38
+ type: "FormController",
39
+ description: "Manages field values, validation, dirty/pristine tracking. Attach to a Column/Section containing form fields.",
40
+ config: {
41
+ validateOn: { type: "string", enum: ["blur", "change", "submit"], default: "blur" }
42
+ },
43
+ commands: ["validate", "reset", "setFieldError"],
44
+ bind: { values: "/form/values", valid: "/form/valid", dirty: "/form/dirty" }
45
+ },
46
+ {
47
+ type: "DataStreamController",
48
+ description: "Live data buffer for charts, tables, feeds. Supports push, SSE, WebSocket, polling.",
49
+ config: {
50
+ max: { type: "number", default: 100, description: "FIFO buffer size" },
51
+ throttle: { type: "number", default: 0, description: "Min ms between renders" }
52
+ },
53
+ commands: ["push", "pushMany", "connect", "poll", "consume", "stop", "clear"],
54
+ bind: { data: "/stream/data", status: "/stream/status" }
55
+ },
56
+ {
57
+ type: "SelectionController",
58
+ description: "Single or multi-select state for lists, tables, grids.",
59
+ config: { mode: { type: "string", enum: ["single", "multi"], default: "single" } },
60
+ commands: ["select", "deselect", "toggle", "selectAll", "clear"],
61
+ bind: { selected: "/selection/items", count: "/selection/count" }
62
+ },
63
+ {
64
+ type: "ToggleController",
65
+ description: "Boolean on/off state with attribute reflection.",
66
+ config: {},
67
+ commands: ["toggle", "set"],
68
+ bind: { value: "/toggle/on" }
69
+ },
70
+ {
71
+ type: "AccordionController",
72
+ description: "Panel expand/collapse with mutual exclusion.",
73
+ config: { multiple: { type: "boolean", default: false } },
74
+ commands: ["open", "close", "toggle"],
75
+ bind: { openPanels: "/accordion/open" }
76
+ },
77
+ // ADR-0048 P4: this entry was MISSING. The runtime has resolved
78
+ // StateMachineController since it was registered, but this hand-written
79
+ // list never gained a row, so every generation reading the wiring
80
+ // catalog was told a controller it could legally emit did not exist.
81
+ // Found by diffing this list against `@adia-ai/a2ui`'s live
82
+ // wiringRegistry (6 controllers vs the 5 listed here) while building the
83
+ // protocol MCP's registry-derived get_wiring_catalog.
84
+ //
85
+ // Fields below mirror `packages/a2ui/controllers/state-machine.js`'s
86
+ // `static schema` — `commands` and `config` verbatim, `bind` keyed on
87
+ // its two state keys (`current`, `history`) with example model paths in
88
+ // the same shape as its siblings above. If a controller is added to the
89
+ // registry again, this list is what goes stale: check it against
90
+ // wiringRegistry.controllers, not against memory.
91
+ {
92
+ type: "StateMachineController",
93
+ description: "Named finite-state machine for multi-step flows (wizards, checkout, approval states). Transitions on events; reflects the active state to data-state on the host for CSS targeting.",
94
+ config: {
95
+ initial: { type: "string", description: "Starting state name (defaults to the first key of `states`)" },
96
+ states: { type: "object", description: "State graph: { [name]: { on: { [event]: targetState } } }" }
97
+ },
98
+ commands: ["send", "transition", "reset"],
99
+ bind: { current: "/flow/state", history: "/flow/history" }
100
+ }
101
+ ],
102
+ // ── ACTIONS: event → handler chains ──
103
+ handlers: [
104
+ { name: "submit-resource", description: "POST/PUT/PATCH/DELETE to a resource URI.", config: ["uri", "method", "body"] },
105
+ { name: "update-model", description: "Update the surface data model at a path.", config: ["path", "value"] },
106
+ { name: "navigate", description: "Route to a path (supports {param} templates).", config: ["navigate"] },
107
+ { name: "navigate-back", description: "Go back in browser history.", config: [] },
108
+ { name: "controller-command", description: "Invoke a command on a controller.", config: ["controllerId", "command", "args"] },
109
+ { name: "emit-event", description: "Dispatch a named CustomEvent on the surface.", config: ["eventName", "detail"] },
110
+ { name: "refresh-source", description: "Re-fetch a named data source.", config: ["sourceId"] },
111
+ { name: "notify", description: "Show a toast/alert notification.", config: ["message", "variant"] }
112
+ ],
113
+ // ── ACTION SHAPE (UIEvent → handler) ──
114
+ actionShape: {
115
+ event: "UIEvent object: { event, target?, debounce?, throttle?, condition? }",
116
+ handler: "Handler name from the handlers list.",
117
+ config: "Handler-specific configuration object.",
118
+ onSuccess: "Follow-up actions array (each is { handler, config }).",
119
+ onError: "Follow-up actions array on failure."
120
+ },
121
+ // ── PROVIDES: context injection ──
122
+ provides: {
123
+ description: "Inject shared state into a component subtree via a2ui-provider. Children consume via context name.",
124
+ example: { name: "auth", host: "root", value: { user: null, token: null } }
125
+ },
126
+ // ── LIFECYCLE hooks ──
127
+ lifecycle: {
128
+ onMount: "Actions to run when the surface first renders (fetch initial data, start streams).",
129
+ onUnmount: "Cleanup actions when the surface is destroyed (close WebSocket, stop polling).",
130
+ onModelChange: "Watch a model path and fire actions when it changes (debounce supported)."
131
+ },
132
+ // ── VALUE EXTRACTION (how actions read data) ──
133
+ valueSources: [
134
+ { from: "event-detail", description: "Read from event.detail (key = property)" },
135
+ { from: "event-target", description: "Read from event.target (key = property, e.g., value)" },
136
+ { from: "model", description: "Read from data model (path = JSON Pointer)" },
137
+ { from: "literal", description: "Static value (value = the value)" },
138
+ { from: "param", description: "Read from resolved parameters (key = param name)" },
139
+ { from: "controller", description: "Read from a controller state (controllerId + key)" }
140
+ ],
141
+ // ── MULTI-SURFACE ASSOCIATIONS ──
142
+ associations: [
143
+ { name: "routes-to", description: "Navigation \u2014 source links to target." },
144
+ { name: "feeds", description: "Data flow \u2014 source output \u2192 target input." },
145
+ { name: "shares-context", description: "Shared state \u2014 both read/write same context." },
146
+ { name: "depends-on", description: "Lifecycle \u2014 source waits for target." },
147
+ { name: "triggers", description: "Side effect \u2014 source event \u2192 target update." },
148
+ { name: "contains", description: "Composition \u2014 target renders inside source." }
149
+ ]
150
+ };
151
+ }
152
+ function getAdiaEvent(type) {
153
+ return adiaEvents.find((e) => e.event === type) ?? void 0;
154
+ }
155
+ function getControllerInfo(type) {
156
+ const catalog = getWiringCatalog();
157
+ return catalog["controllers"].find((c) => c.type === type) ?? void 0;
158
+ }
159
+ function getHandlerInfo(name) {
160
+ const catalog = getWiringCatalog();
161
+ return catalog["handlers"].find((h) => h.name === name) ?? void 0;
162
+ }
163
+ export {
164
+ getAdiaEvent,
165
+ getControllerInfo,
166
+ getHandlerInfo,
167
+ getWiringCatalog
168
+ };