@datalayer/agent-runtimes 1.0.4 → 1.0.5

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 (267) hide show
  1. package/README.md +34 -0
  2. package/lib/App.js +1 -1
  3. package/lib/agents/AgentDetails.d.ts +22 -1
  4. package/lib/agents/AgentDetails.js +34 -47
  5. package/lib/api/index.d.ts +0 -1
  6. package/lib/api/index.js +4 -2
  7. package/lib/chat/Chat.d.ts +5 -106
  8. package/lib/chat/Chat.js +4 -4
  9. package/lib/chat/ChatFloating.d.ts +7 -140
  10. package/lib/chat/ChatFloating.js +2 -2
  11. package/lib/chat/ChatPopupStandalone.d.ts +8 -47
  12. package/lib/chat/ChatPopupStandalone.js +3 -3
  13. package/lib/chat/ChatSidebar.d.ts +4 -69
  14. package/lib/chat/ChatSidebar.js +2 -2
  15. package/lib/chat/ChatStandalone.d.ts +4 -54
  16. package/lib/chat/ChatStandalone.js +3 -3
  17. package/lib/chat/base/ChatBase.js +1083 -157
  18. package/lib/chat/header/ChatHeaderBase.d.ts +11 -6
  19. package/lib/chat/header/ChatHeaderBase.js +18 -16
  20. package/lib/chat/indicators/McpStatusIndicator.d.ts +7 -4
  21. package/lib/chat/indicators/McpStatusIndicator.js +7 -32
  22. package/lib/chat/indicators/SandboxStatusIndicator.d.ts +4 -1
  23. package/lib/chat/indicators/SandboxStatusIndicator.js +9 -9
  24. package/lib/chat/indicators/SkillsStatusIndicator.d.ts +7 -0
  25. package/lib/chat/indicators/SkillsStatusIndicator.js +88 -0
  26. package/lib/chat/indicators/index.d.ts +1 -0
  27. package/lib/chat/indicators/index.js +1 -0
  28. package/lib/chat/messages/ChatMessageList.d.ts +1 -1
  29. package/lib/chat/messages/ChatMessageList.js +108 -113
  30. package/lib/chat/prompt/InputFooter.d.ts +19 -6
  31. package/lib/chat/prompt/InputFooter.js +71 -18
  32. package/lib/chat/prompt/InputPrompt.d.ts +3 -1
  33. package/lib/chat/prompt/InputPrompt.js +4 -4
  34. package/lib/chat/prompt/InputPromptFooter.js +1 -1
  35. package/lib/chat/prompt/InputPromptLexical.d.ts +3 -1
  36. package/lib/chat/prompt/InputPromptLexical.js +12 -5
  37. package/lib/chat/prompt/InputPromptText.d.ts +3 -1
  38. package/lib/chat/prompt/InputPromptText.js +2 -2
  39. package/lib/chat/tools/ToolApprovalBanner.js +1 -1
  40. package/lib/chat/tools/ToolCallDisplay.d.ts +3 -1
  41. package/lib/chat/tools/ToolCallDisplay.js +2 -2
  42. package/lib/chat/usage/TokenUsageBar.js +20 -2
  43. package/lib/client/AgentRuntimesClientContext.d.ts +53 -0
  44. package/lib/client/AgentRuntimesClientContext.js +55 -0
  45. package/lib/client/AgentsMixin.d.ts +0 -18
  46. package/lib/client/AgentsMixin.js +6 -30
  47. package/lib/client/IAgentRuntimesClient.d.ts +215 -0
  48. package/lib/client/IAgentRuntimesClient.js +5 -0
  49. package/lib/client/SdkAgentRuntimesClient.d.ts +151 -0
  50. package/lib/client/SdkAgentRuntimesClient.js +134 -0
  51. package/lib/client/index.d.ts +4 -1
  52. package/lib/client/index.js +3 -1
  53. package/lib/components/NotificationEventCard.js +5 -1
  54. package/lib/config/AgentConfiguration.js +3 -3
  55. package/lib/context/ContextDistribution.d.ts +3 -1
  56. package/lib/context/ContextDistribution.js +8 -27
  57. package/lib/context/ContextInspector.d.ts +3 -1
  58. package/lib/context/ContextInspector.js +19 -67
  59. package/lib/context/ContextPanel.d.ts +3 -1
  60. package/lib/context/ContextPanel.js +104 -64
  61. package/lib/context/ContextUsage.d.ts +3 -1
  62. package/lib/context/ContextUsage.js +3 -3
  63. package/lib/context/CostTracker.d.ts +9 -3
  64. package/lib/context/CostTracker.js +26 -47
  65. package/lib/context/CostUsageChart.d.ts +12 -0
  66. package/lib/context/CostUsageChart.js +378 -0
  67. package/lib/context/GraphFlowChart.d.ts +16 -0
  68. package/lib/context/GraphFlowChart.js +182 -0
  69. package/lib/context/TokenUsageChart.d.ts +8 -1
  70. package/lib/context/TokenUsageChart.js +349 -211
  71. package/lib/context/TurnGraphChart.d.ts +39 -0
  72. package/lib/context/TurnGraphChart.js +538 -0
  73. package/lib/context/otelWsPool.d.ts +20 -0
  74. package/lib/context/otelWsPool.js +69 -0
  75. package/lib/examples/A2UiComponentGalleryExample.d.ts +0 -17
  76. package/lib/examples/A2UiComponentGalleryExample.js +315 -522
  77. package/lib/examples/A2UiContactCardExample.d.ts +0 -18
  78. package/lib/examples/A2UiContactCardExample.js +154 -411
  79. package/lib/examples/A2UiRestaurantExample.d.ts +0 -30
  80. package/lib/examples/A2UiRestaurantExample.js +114 -212
  81. package/lib/examples/A2UiViewerExample.d.ts +0 -18
  82. package/lib/examples/A2UiViewerExample.js +283 -532
  83. package/lib/examples/AgUiBackendToolRenderingExample.js +1 -1
  84. package/lib/examples/AgUiHaikuGenUiExample.d.ts +1 -1
  85. package/lib/examples/AgUiHaikuGenUiExample.js +1 -1
  86. package/lib/examples/AgentCheckpointsExample.js +13 -27
  87. package/lib/examples/AgentCodemodeExample.d.ts +4 -6
  88. package/lib/examples/AgentCodemodeExample.js +591 -169
  89. package/lib/examples/AgentEvalsExample.js +12 -16
  90. package/lib/examples/AgentGuardrailsExample.js +370 -64
  91. package/lib/examples/AgentHooksExample.d.ts +3 -0
  92. package/lib/examples/AgentHooksExample.js +104 -0
  93. package/lib/examples/AgentMCPExample.d.ts +3 -0
  94. package/lib/examples/AgentMCPExample.js +480 -0
  95. package/lib/examples/AgentMemoryExample.js +13 -17
  96. package/lib/examples/AgentMonitoringExample.js +260 -199
  97. package/lib/examples/AgentNotificationsExample.js +49 -17
  98. package/lib/examples/AgentOtelExample.js +2 -3
  99. package/lib/examples/AgentOutputsExample.d.ts +11 -6
  100. package/lib/examples/AgentOutputsExample.js +382 -81
  101. package/lib/examples/AgentParametersExample.d.ts +3 -0
  102. package/lib/examples/AgentParametersExample.js +246 -0
  103. package/lib/examples/AgentSandboxExample.d.ts +2 -2
  104. package/lib/examples/AgentSandboxExample.js +68 -40
  105. package/lib/examples/AgentSkillsExample.js +91 -99
  106. package/lib/examples/{AgentspecExample.js → AgentSpecsExample.js} +10 -21
  107. package/lib/examples/AgentSubagentsExample.d.ts +14 -0
  108. package/lib/examples/AgentSubagentsExample.js +228 -0
  109. package/lib/examples/AgentToolApprovalsExample.js +29 -557
  110. package/lib/examples/AgentTriggersExample.js +819 -565
  111. package/lib/examples/ChatCustomExample.js +11 -24
  112. package/lib/examples/ChatExample.js +7 -24
  113. package/lib/examples/CopilotKitLexicalExample.js +2 -1
  114. package/lib/examples/CopilotKitNotebookExample.js +2 -1
  115. package/lib/examples/HomeExample.d.ts +15 -0
  116. package/lib/examples/HomeExample.js +77 -0
  117. package/lib/examples/Lexical2Example.js +4 -2
  118. package/lib/examples/{LexicalExample.d.ts → LexicalAgentExample.d.ts} +4 -4
  119. package/lib/examples/{LexicalExample.js → LexicalAgentExample.js} +65 -16
  120. package/lib/examples/{LexicalSidebarExample.d.ts → LexicalAgentSidebarExample.d.ts} +5 -5
  121. package/lib/examples/LexicalAgentSidebarExample.js +261 -0
  122. package/lib/examples/NotebookAgentExample.d.ts +9 -0
  123. package/lib/examples/NotebookAgentExample.js +192 -0
  124. package/lib/examples/{NotebookSidebarExample.d.ts → NotebookAgentSidebarExample.d.ts} +2 -2
  125. package/lib/examples/NotebookAgentSidebarExample.js +221 -0
  126. package/lib/examples/{DatalayerNotebookExample.d.ts → NotebookCollaborationExample.d.ts} +4 -4
  127. package/lib/examples/{DatalayerNotebookExample.js → NotebookCollaborationExample.js} +3 -3
  128. package/lib/examples/NotebookExample.d.ts +4 -7
  129. package/lib/examples/NotebookExample.js +14 -146
  130. package/lib/examples/components/AuthRequiredView.d.ts +6 -0
  131. package/lib/examples/components/AuthRequiredView.js +33 -0
  132. package/lib/examples/components/ExampleWrapper.d.ts +7 -0
  133. package/lib/examples/components/ExampleWrapper.js +25 -6
  134. package/lib/examples/{ag-ui → components}/haiku/HaikuDisplay.js +1 -1
  135. package/lib/examples/{ag-ui → components}/haiku/InlineHaikuCard.js +1 -1
  136. package/lib/examples/{ag-ui → components}/haiku/index.d.ts +1 -1
  137. package/lib/examples/{ag-ui → components}/haiku/index.js +1 -1
  138. package/lib/examples/components/index.d.ts +3 -0
  139. package/lib/examples/components/index.js +4 -0
  140. package/lib/examples/{ag-ui → components}/weather/index.d.ts +1 -1
  141. package/lib/examples/{ag-ui → components}/weather/index.js +1 -1
  142. package/lib/examples/example-selector.d.ts +17 -4
  143. package/lib/examples/example-selector.js +107 -41
  144. package/lib/examples/index.d.ts +9 -6
  145. package/lib/examples/index.js +9 -6
  146. package/lib/examples/main.js +217 -27
  147. package/lib/examples/utils/a2ui.d.ts +18 -0
  148. package/lib/examples/utils/a2ui.js +69 -0
  149. package/lib/examples/utils/a2uiMarkdownProvider.d.ts +7 -0
  150. package/lib/examples/utils/a2uiMarkdownProvider.js +9 -0
  151. package/lib/examples/utils/agentId.d.ts +18 -0
  152. package/lib/examples/utils/agentId.js +54 -0
  153. package/lib/examples/utils/agents/earthquake-detector.json +11 -11
  154. package/lib/examples/utils/agents/sales-forecaster.json +11 -11
  155. package/lib/examples/utils/agents/social-post-generator.json +11 -11
  156. package/lib/examples/utils/agents/stock-market.json +11 -11
  157. package/lib/examples/utils/examplesStore.js +82 -27
  158. package/lib/hooks/index.d.ts +8 -8
  159. package/lib/hooks/index.js +7 -7
  160. package/lib/hooks/useA2A.d.ts +2 -3
  161. package/lib/hooks/useAIAgentsWebSocket.d.ts +43 -4
  162. package/lib/hooks/useAIAgentsWebSocket.js +118 -12
  163. package/lib/hooks/useAcp.d.ts +1 -2
  164. package/lib/hooks/useAgUi.d.ts +1 -1
  165. package/lib/hooks/{useAgents.d.ts → useAgentRuntimes.d.ts} +39 -2
  166. package/lib/hooks/{useAgents.js → useAgentRuntimes.js} +125 -15
  167. package/lib/hooks/useAgentsCatalog.js +1 -1
  168. package/lib/hooks/useAgentsService.d.ts +2 -2
  169. package/lib/hooks/useAgentsService.js +7 -7
  170. package/lib/hooks/useCheckpoints.js +1 -1
  171. package/lib/hooks/useConfig.d.ts +4 -1
  172. package/lib/hooks/useConfig.js +10 -3
  173. package/lib/hooks/useContextSnapshot.d.ts +9 -4
  174. package/lib/hooks/useContextSnapshot.js +9 -37
  175. package/lib/hooks/useMonitoring.js +3 -0
  176. package/lib/hooks/useSandbox.d.ts +20 -8
  177. package/lib/hooks/useSandbox.js +105 -40
  178. package/lib/hooks/useSkills.d.ts +23 -5
  179. package/lib/hooks/useSkills.js +94 -39
  180. package/lib/hooks/useToolApprovals.d.ts +60 -36
  181. package/lib/hooks/useToolApprovals.js +318 -69
  182. package/lib/hooks/useVercelAI.d.ts +1 -1
  183. package/lib/index.d.ts +2 -1
  184. package/lib/index.js +1 -0
  185. package/lib/inference/index.d.ts +0 -1
  186. package/lib/middleware/index.d.ts +0 -1
  187. package/lib/protocols/AGUIAdapter.js +6 -0
  188. package/lib/protocols/VercelAIAdapter.d.ts +7 -0
  189. package/lib/protocols/VercelAIAdapter.js +59 -7
  190. package/lib/specs/agents/agents.d.ts +10 -0
  191. package/lib/specs/agents/agents.js +2139 -262
  192. package/lib/specs/agents/index.js +3 -1
  193. package/lib/specs/envvars.d.ts +1 -0
  194. package/lib/specs/envvars.js +38 -20
  195. package/lib/specs/evals.js +6 -6
  196. package/lib/specs/events.d.ts +3 -10
  197. package/lib/specs/events.js +127 -84
  198. package/lib/specs/frontendTools.js +2 -2
  199. package/lib/specs/guardrails.d.ts +0 -7
  200. package/lib/specs/guardrails.js +240 -159
  201. package/lib/specs/index.d.ts +1 -0
  202. package/lib/specs/index.js +1 -0
  203. package/lib/specs/mcpServers.js +35 -6
  204. package/lib/specs/memory.d.ts +0 -2
  205. package/lib/specs/memory.js +4 -17
  206. package/lib/specs/models.js +25 -5
  207. package/lib/specs/notifications.js +102 -18
  208. package/lib/specs/outputs.js +15 -9
  209. package/lib/specs/personas.d.ts +41 -0
  210. package/lib/specs/personas.js +168 -0
  211. package/lib/specs/skills.d.ts +2 -1
  212. package/lib/specs/skills.js +41 -23
  213. package/lib/specs/teams/index.js +3 -1
  214. package/lib/specs/teams/teams.js +468 -348
  215. package/lib/specs/tools.js +4 -4
  216. package/lib/specs/triggers.js +61 -11
  217. package/lib/stores/agentRuntimeStore.d.ts +204 -0
  218. package/lib/stores/agentRuntimeStore.js +636 -0
  219. package/lib/stores/index.d.ts +1 -1
  220. package/lib/stores/index.js +1 -1
  221. package/lib/tools/adapters/copilotkit/lexicalHooks.d.ts +1 -2
  222. package/lib/tools/adapters/copilotkit/lexicalHooks.js +1 -3
  223. package/lib/tools/adapters/copilotkit/notebookHooks.d.ts +1 -2
  224. package/lib/tools/adapters/copilotkit/notebookHooks.js +1 -3
  225. package/lib/tools/index.d.ts +0 -2
  226. package/lib/tools/index.js +0 -1
  227. package/lib/types/agentspecs.d.ts +50 -1
  228. package/lib/types/chat.d.ts +309 -8
  229. package/lib/types/context.d.ts +27 -0
  230. package/lib/types/cost.d.ts +2 -2
  231. package/lib/types/index.d.ts +2 -0
  232. package/lib/types/index.js +2 -0
  233. package/lib/types/mcp.d.ts +8 -0
  234. package/lib/types/models.d.ts +2 -2
  235. package/lib/types/personas.d.ts +25 -0
  236. package/lib/types/personas.js +5 -0
  237. package/lib/types/skills.d.ts +43 -1
  238. package/lib/types/stream.d.ts +110 -0
  239. package/lib/types/stream.js +36 -0
  240. package/lib/utils/utils.d.ts +9 -5
  241. package/lib/utils/utils.js +9 -5
  242. package/package.json +13 -9
  243. package/scripts/codegen/__pycache__/generate_agents.cpython-313.pyc +0 -0
  244. package/scripts/codegen/__pycache__/generate_events.cpython-313.pyc +0 -0
  245. package/scripts/codegen/__pycache__/versioning.cpython-313.pyc +0 -0
  246. package/scripts/codegen/generate_agents.py +102 -6
  247. package/scripts/codegen/generate_events.py +35 -13
  248. package/scripts/codegen/generate_personas.py +319 -0
  249. package/scripts/codegen/generate_skills.py +9 -9
  250. package/scripts/sync-jupyter.sh +26 -7
  251. package/lib/api/tool-approvals.d.ts +0 -62
  252. package/lib/api/tool-approvals.js +0 -145
  253. package/lib/examples/LexicalSidebarExample.js +0 -163
  254. package/lib/examples/NotebookSidebarExample.js +0 -119
  255. package/lib/examples/NotebookSimpleExample.d.ts +0 -6
  256. package/lib/examples/NotebookSimpleExample.js +0 -22
  257. package/lib/examples/ag-ui/index.d.ts +0 -10
  258. package/lib/examples/ag-ui/index.js +0 -16
  259. package/lib/hooks/useAgentsRegistry.d.ts +0 -10
  260. package/lib/hooks/useAgentsRegistry.js +0 -20
  261. package/lib/stores/agentsStore.d.ts +0 -123
  262. package/lib/stores/agentsStore.js +0 -270
  263. /package/lib/examples/{AgentspecExample.d.ts → AgentSpecsExample.d.ts} +0 -0
  264. /package/lib/examples/{ag-ui → components}/haiku/HaikuDisplay.d.ts +0 -0
  265. /package/lib/examples/{ag-ui → components}/haiku/InlineHaikuCard.d.ts +0 -0
  266. /package/lib/examples/{ag-ui → components}/weather/InlineWeatherCard.d.ts +0 -0
  267. /package/lib/examples/{ag-ui → components}/weather/InlineWeatherCard.js +0 -0
@@ -3,566 +3,359 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  * Copyright (c) 2025-2026 Datalayer, Inc.
4
4
  * Distributed under the terms of the Modified BSD License.
5
5
  */
6
- /**
7
- * A2UiComponentGalleryExample
8
- *
9
- * Showcases the full catalog of A2UI components rendered via @a2ui/react.
10
- * Uses static A2UI JSON messages (no backend required) to demonstrate:
11
- * - Text, Button, CheckBox, Slider, TextField, DateTimeInput
12
- * - MultipleChoice (default, chips, filterable)
13
- * - Row, Column, Card, List, Tabs, Divider, Modal
14
- * - Icon, Image, Video, AudioPlayer
15
- *
16
- * All messages follow the A2UI three-step pattern:
17
- * beginRendering → surfaceUpdate → dataModelUpdate
18
- */
19
- import { useState, useCallback } from 'react';
6
+ import { useCallback, useEffect, useMemo, useState } from 'react';
20
7
  import { Box } from '@datalayer/primer-addons';
8
+ import { Button, SegmentedControl, Text } from '@primer/react';
9
+ import { A2uiSurface } from '@a2ui/react/v0_9';
21
10
  import { ThemedProvider } from './utils/themedProvider';
22
- import { Text, Button as PrimerButton } from '@primer/react';
23
- import { A2UIProvider, A2UIRenderer, useA2UIActions, initializeDefaultCatalog, } from '@a2ui/react';
24
- initializeDefaultCatalog();
25
- // ---------------------------------------------------------------------------
26
- // Static A2UI messages for each gallery section
27
- // ---------------------------------------------------------------------------
28
- /** Helper: single-component surface (begin + update + data) */
29
- function singleComponentSurface(surfaceId, rootId, componentDef, data) {
30
- const msgs = [
31
- {
32
- beginRendering: { surfaceId, root: rootId },
33
- },
34
- {
35
- surfaceUpdate: {
36
- surfaceId,
37
- components: [{ id: rootId, component: componentDef }],
38
- },
39
- },
40
- ];
41
- if (data)
42
- msgs.push(data);
43
- return msgs;
44
- }
45
- /** Helper: multi-component surface */
46
- function multiComponentSurface(surfaceId, rootId, components, data) {
47
- const msgs = [
48
- {
49
- beginRendering: { surfaceId, root: rootId },
50
- },
51
- {
52
- surfaceUpdate: { surfaceId, components },
53
- },
54
- ];
55
- if (data)
56
- msgs.push(data);
57
- return msgs;
58
- }
59
- function dataModelMsg(surfaceId, contents) {
60
- return {
61
- dataModelUpdate: { surfaceId, path: '/', contents },
62
- };
63
- }
64
- // --- Gallery sections ---
65
- function textFieldMessages() {
66
- return singleComponentSurface('gallery-text', 'gallery-text-root', {
67
- TextField: {
68
- label: { literalString: 'Enter some text' },
69
- text: { path: 'galleryData/textField' },
70
- },
71
- }, dataModelMsg('gallery-text', [
72
- {
73
- key: 'galleryData',
74
- valueMap: [{ key: 'textField', valueString: 'Hello World' }],
75
- },
76
- ]));
77
- }
78
- function textMessages() {
79
- return singleComponentSurface('gallery-text-block', 'gallery-text-block-root', {
80
- Text: {
81
- usageHint: 'h3',
82
- text: { literalString: 'Hello from A2UI Text component' },
83
- },
84
- });
85
- }
86
- function imageMessages() {
87
- return singleComponentSurface('gallery-image', 'gallery-image-root', {
88
- Image: {
89
- url: { path: 'galleryData/imageUrl' },
90
- altText: { literalString: 'A2UI demo landscape' },
91
- fit: 'cover',
92
- },
93
- }, dataModelMsg('gallery-image', [
94
- {
95
- key: 'galleryData',
96
- valueMap: [
11
+ import { A2uiMarkdownProvider } from './utils/a2uiMarkdownProvider';
12
+ import { createSceneMessages, useA2uiProcessor } from './utils/a2ui';
13
+ const SCENES = [
14
+ {
15
+ id: 'typography',
16
+ label: 'Typography',
17
+ description: 'Text, Icon, Row, and Button components bound to data-model values.',
18
+ messages: createSceneMessages({
19
+ surfaceId: 'gallery-typography',
20
+ components: [
21
+ { id: 'root', component: 'Card', child: 'main' },
97
22
  {
98
- key: 'imageUrl',
99
- valueString: 'https://images.unsplash.com/photo-1511884642898-4c92249e20b6?w=900&h=450&fit=crop',
23
+ id: 'main',
24
+ component: 'Column',
25
+ children: ['title', 'subtitle', 'meta-row', 'cta-label', 'cta'],
100
26
  },
101
- ],
102
- },
103
- ]));
104
- }
105
- function videoMessages() {
106
- return singleComponentSurface('gallery-video', 'gallery-video-root', {
107
- Video: {
108
- sourceUrl: {
109
- literalString: 'https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4',
110
- },
111
- },
112
- });
113
- }
114
- function audioMessages() {
115
- return singleComponentSurface('gallery-audio', 'gallery-audio-root', {
116
- AudioPlayer: {
117
- sourceUrl: {
118
- literalString: 'https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3',
119
- },
120
- },
121
- });
122
- }
123
- function layoutMessages() {
124
- return multiComponentSurface('gallery-layout', 'gallery-layout-root', [
125
- {
126
- id: 'gallery-layout-root',
127
- component: {
128
- Column: {
129
- children: { explicitList: ['layout-title', 'layout-row'] },
130
- gap: 'small',
27
+ {
28
+ id: 'title',
29
+ component: 'Text',
30
+ variant: 'h2',
31
+ text: { path: '/title' },
131
32
  },
132
- },
133
- },
134
- {
135
- id: 'layout-title',
136
- component: {
137
- Text: {
138
- usageHint: 'caption',
139
- text: {
140
- literalString: 'Row and Column layout composition',
141
- },
33
+ { id: 'subtitle', component: 'Text', text: { path: '/subtitle' } },
34
+ {
35
+ id: 'meta-row',
36
+ component: 'Row',
37
+ align: 'center',
38
+ children: ['meta-icon', 'meta-text'],
142
39
  },
143
- },
144
- },
145
- {
146
- id: 'layout-row',
147
- component: {
148
- Row: {
149
- children: { explicitList: ['layout-card-1', 'layout-card-2'] },
150
- gap: 'small',
40
+ { id: 'meta-icon', component: 'Icon', name: 'star' },
41
+ {
42
+ id: 'meta-text',
43
+ component: 'Text',
44
+ variant: 'caption',
45
+ text: { path: '/meta' },
151
46
  },
152
- },
153
- },
154
- {
155
- id: 'layout-card-1',
156
- component: {
157
- Card: { child: 'layout-card-1-text' },
158
- },
159
- },
160
- {
161
- id: 'layout-card-1-text',
162
- component: {
163
- Text: { text: { literalString: 'Column -> Row -> Card #1' } },
164
- },
165
- },
166
- {
167
- id: 'layout-card-2',
168
- component: {
169
- Card: { child: 'layout-card-2-text' },
170
- },
171
- },
172
- {
173
- id: 'layout-card-2-text',
174
- component: {
175
- Text: { text: { literalString: 'Column -> Row -> Card #2' } },
176
- },
177
- },
178
- ]);
179
- }
180
- function checkboxMessages() {
181
- return singleComponentSurface('gallery-checkbox', 'gallery-checkbox-root', {
182
- CheckBox: {
183
- label: { literalString: 'Toggle me' },
184
- value: { path: 'galleryData/checkbox' },
185
- },
186
- }, dataModelMsg('gallery-checkbox', [
187
- {
188
- key: 'galleryData',
189
- valueMap: [{ key: 'checkbox', valueBoolean: false }],
190
- },
191
- ]));
192
- }
193
- function sliderMessages() {
194
- return singleComponentSurface('gallery-slider', 'gallery-slider-root', {
195
- Slider: {
196
- value: { path: 'galleryData/slider' },
197
- minValue: 0,
198
- maxValue: 100,
199
- },
200
- }, dataModelMsg('gallery-slider', [
201
- { key: 'galleryData', valueMap: [{ key: 'slider', valueNumber: 30 }] },
202
- ]));
203
- }
204
- function dateTimeMessages() {
205
- return singleComponentSurface('gallery-date', 'gallery-date-root', {
206
- DateTimeInput: {
207
- value: { path: 'galleryData/date' },
208
- enableDate: true,
209
- },
210
- }, dataModelMsg('gallery-date', [
211
- {
212
- key: 'galleryData',
213
- valueMap: [{ key: 'date', valueString: '2025-10-26' }],
214
- },
215
- ]));
216
- }
217
- function multipleChoiceMessages() {
218
- return singleComponentSurface('gallery-mc', 'gallery-mc-root', {
219
- MultipleChoice: {
220
- selections: { path: 'galleryData/favorites' },
221
- options: [
222
- { label: { literalString: 'Apple' }, value: 'A' },
223
- { label: { literalString: 'Banana' }, value: 'B' },
224
- { label: { literalString: 'Cherry' }, value: 'C' },
225
- ],
226
- },
227
- }, dataModelMsg('gallery-mc', [
228
- {
229
- key: 'galleryData',
230
- valueMap: [
231
- { key: 'favorites', valueMap: [{ key: '0', valueString: 'A' }] },
232
- ],
233
- },
234
- ]));
235
- }
236
- function buttonMessages() {
237
- return multiComponentSurface('gallery-button', 'gallery-button-root', [
238
- {
239
- id: 'gallery-button-text',
240
- component: { Text: { text: { literalString: 'Trigger Action' } } },
241
- },
242
- {
243
- id: 'gallery-button-root',
244
- component: {
245
- Button: {
246
- child: 'gallery-button-text',
247
- primary: true,
47
+ { id: 'cta-label', component: 'Text', text: 'Trigger Action' },
48
+ {
49
+ id: 'cta',
50
+ component: 'Button',
51
+ child: 'cta-label',
52
+ variant: 'primary',
248
53
  action: {
249
- name: 'custom_action',
250
- context: [
251
- { key: 'info', value: { literalString: 'Button Clicked!' } },
252
- ],
54
+ event: {
55
+ name: 'gallery_typography_cta',
56
+ context: { section: 'typography', title: { path: '/title' } },
57
+ },
253
58
  },
254
59
  },
60
+ ],
61
+ value: {
62
+ title: 'A2UI Gallery',
63
+ subtitle: 'Protocol-native renderer with typed schemas and dynamic bindings.',
64
+ meta: 'createSurface · updateComponents · updateDataModel',
255
65
  },
256
- },
257
- ]);
258
- }
259
- function tabsMessages() {
260
- return multiComponentSurface('gallery-tabs', 'gallery-tabs-root', [
261
- {
262
- id: 'tab-1-content',
263
- component: {
264
- Text: {
265
- text: {
266
- literalString: 'First Tab Content — TextField, CheckBox, and Slider are in other sections.',
267
- },
66
+ }),
67
+ },
68
+ {
69
+ id: 'contact-card',
70
+ label: 'Contact',
71
+ description: 'Card layout with icons and data-bound profile information.',
72
+ messages: createSceneMessages({
73
+ surfaceId: 'gallery-contact-card',
74
+ components: [
75
+ { id: 'root', component: 'Card', child: 'main-column' },
76
+ {
77
+ id: 'main-column',
78
+ component: 'Column',
79
+ align: 'center',
80
+ children: [
81
+ 'avatar-image',
82
+ 'name',
83
+ 'title',
84
+ 'divider',
85
+ 'contact-info',
86
+ ],
268
87
  },
269
- },
270
- },
271
- {
272
- id: 'tab-2-content',
273
- component: {
274
- Text: {
275
- text: {
276
- literalString: 'Second Tab Content — Cards, Lists, and Modals too!',
277
- },
88
+ {
89
+ id: 'avatar-image',
90
+ component: 'Image',
91
+ url: { path: '/avatar' },
92
+ fit: 'cover',
93
+ variant: 'avatar',
94
+ },
95
+ {
96
+ id: 'name',
97
+ component: 'Text',
98
+ variant: 'h2',
99
+ text: { path: '/name' },
100
+ },
101
+ { id: 'title', component: 'Text', text: { path: '/title' } },
102
+ { id: 'divider', component: 'Divider' },
103
+ {
104
+ id: 'contact-info',
105
+ component: 'Column',
106
+ children: ['phone-row', 'email-row', 'location-row'],
278
107
  },
108
+ {
109
+ id: 'phone-row',
110
+ component: 'Row',
111
+ align: 'center',
112
+ children: ['phone-icon', 'phone-text'],
113
+ },
114
+ { id: 'phone-icon', component: 'Icon', name: 'phone' },
115
+ { id: 'phone-text', component: 'Text', text: { path: '/phone' } },
116
+ {
117
+ id: 'email-row',
118
+ component: 'Row',
119
+ align: 'center',
120
+ children: ['email-icon', 'email-text'],
121
+ },
122
+ { id: 'email-icon', component: 'Icon', name: 'mail' },
123
+ { id: 'email-text', component: 'Text', text: { path: '/email' } },
124
+ {
125
+ id: 'location-row',
126
+ component: 'Row',
127
+ align: 'center',
128
+ children: ['location-icon', 'location-text'],
129
+ },
130
+ { id: 'location-icon', component: 'Icon', name: 'locationOn' },
131
+ { id: 'location-text', component: 'Text', text: { path: '/location' } },
132
+ ],
133
+ value: {
134
+ avatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=100&h=100&fit=crop',
135
+ name: 'David Park',
136
+ title: 'Engineering Manager',
137
+ phone: '+1 (555) 234-5678',
138
+ email: 'david.park@company.com',
139
+ location: 'San Francisco, CA',
279
140
  },
280
- },
281
- {
282
- id: 'gallery-tabs-root',
283
- component: {
284
- Tabs: {
285
- tabItems: [
286
- { title: { literalString: 'View One' }, child: 'tab-1-content' },
287
- { title: { literalString: 'View Two' }, child: 'tab-2-content' },
141
+ }),
142
+ },
143
+ {
144
+ id: 'controls',
145
+ label: 'Controls',
146
+ description: 'Interactive inputs: TextField, ChoicePicker, CheckBox, Slider, DateTimeInput.',
147
+ messages: createSceneMessages({
148
+ surfaceId: 'gallery-controls',
149
+ components: [
150
+ { id: 'root', component: 'Card', child: 'controls-column' },
151
+ {
152
+ id: 'controls-column',
153
+ component: 'Column',
154
+ children: [
155
+ 'title',
156
+ 'name-field',
157
+ 'plan-picker',
158
+ 'alerts-checkbox',
159
+ 'volume-slider',
160
+ 'when-field',
161
+ 'submit-label',
162
+ 'submit',
288
163
  ],
289
164
  },
290
- },
291
- },
292
- ]);
293
- }
294
- function iconRowMessages() {
295
- return multiComponentSurface('gallery-icons', 'gallery-icons-root', [
296
- {
297
- id: 'gallery-icons-root',
298
- component: {
299
- Row: {
300
- children: { explicitList: ['icon-1', 'icon-2', 'icon-3', 'icon-4'] },
301
- distribution: 'spaceEvenly',
302
- alignment: 'center',
165
+ {
166
+ id: 'title',
167
+ component: 'Text',
168
+ variant: 'h3',
169
+ text: 'Interactive Inputs',
303
170
  },
304
- },
305
- },
306
- { id: 'icon-1', component: { Icon: { name: { literalString: 'star' } } } },
307
- { id: 'icon-2', component: { Icon: { name: { literalString: 'home' } } } },
308
- {
309
- id: 'icon-3',
310
- component: { Icon: { name: { literalString: 'settings' } } },
311
- },
312
- {
313
- id: 'icon-4',
314
- component: { Icon: { name: { literalString: 'search' } } },
315
- },
316
- ]);
317
- }
318
- function cardMessages() {
319
- return multiComponentSurface('gallery-card', 'gallery-card-root', [
320
- { id: 'gallery-card-root', component: { Card: { child: 'card-inner' } } },
321
- {
322
- id: 'card-inner',
323
- component: {
324
- Column: {
325
- children: {
326
- explicitList: ['card-title', 'card-divider', 'card-body'],
327
- },
328
- alignment: 'stretch',
171
+ {
172
+ id: 'name-field',
173
+ component: 'TextField',
174
+ label: 'Name',
175
+ value: { path: '/name' },
329
176
  },
330
- },
331
- },
332
- {
333
- id: 'card-title',
334
- component: {
335
- Text: { text: { literalString: 'Card Title' }, usageHint: 'h3' },
336
- },
337
- },
338
- { id: 'card-divider', component: { Divider: { axis: 'horizontal' } } },
339
- {
340
- id: 'card-body',
341
- component: {
342
- Text: {
343
- text: {
344
- literalString: 'This is the card body content. Cards wrap any child component.',
345
- },
177
+ {
178
+ id: 'plan-picker',
179
+ component: 'ChoicePicker',
180
+ label: 'Plan',
181
+ value: { path: '/plan' },
182
+ options: [
183
+ { label: 'Starter', value: 'starter' },
184
+ { label: 'Pro', value: 'pro' },
185
+ { label: 'Enterprise', value: 'enterprise' },
186
+ ],
346
187
  },
347
- },
348
- },
349
- ]);
350
- }
351
- function listMessages() {
352
- return multiComponentSurface('gallery-list', 'gallery-list-root', [
353
- {
354
- id: 'gallery-list-root',
355
- component: {
356
- List: {
357
- children: {
358
- explicitList: ['list-item-1', 'list-item-2', 'list-item-3'],
359
- },
360
- direction: 'vertical',
361
- alignment: 'stretch',
188
+ {
189
+ id: 'alerts-checkbox',
190
+ component: 'CheckBox',
191
+ label: 'Enable alerts',
192
+ value: { path: '/alerts' },
362
193
  },
363
- },
364
- },
365
- {
366
- id: 'list-item-1',
367
- component: { Text: { text: { literalString: '📄 Item 1 — Documents' } } },
368
- },
369
- {
370
- id: 'list-item-2',
371
- component: { Text: { text: { literalString: '📊 Item 2 — Analytics' } } },
372
- },
373
- {
374
- id: 'list-item-3',
375
- component: { Text: { text: { literalString: '⚙️ Item 3 — Settings' } } },
376
- },
377
- ]);
378
- }
379
- function modalMessages() {
380
- return multiComponentSurface('gallery-modal', 'gallery-modal-root', [
381
- {
382
- id: 'gallery-modal-root',
383
- component: {
384
- Modal: {
385
- entryPointChild: 'modal-trigger-btn',
386
- contentChild: 'modal-body',
194
+ {
195
+ id: 'volume-slider',
196
+ component: 'Slider',
197
+ label: 'Volume',
198
+ value: { path: '/volume' },
199
+ min: 0,
200
+ max: 100,
387
201
  },
388
- },
389
- },
390
- {
391
- id: 'modal-trigger-btn',
392
- component: {
393
- Button: {
394
- child: 'modal-btn-text',
395
- primary: false,
396
- action: { name: 'noop' },
202
+ {
203
+ id: 'when-field',
204
+ component: 'DateTimeInput',
205
+ label: 'Reminder time',
206
+ value: { path: '/when' },
397
207
  },
398
- },
399
- },
400
- {
401
- id: 'modal-btn-text',
402
- component: { Text: { text: { literalString: 'Open Modal' } } },
403
- },
404
- {
405
- id: 'modal-body',
406
- component: {
407
- Text: {
408
- text: {
409
- literalString: 'This is modal content! Click outside to close.',
208
+ { id: 'submit-label', component: 'Text', text: 'Submit' },
209
+ {
210
+ id: 'submit',
211
+ component: 'Button',
212
+ variant: 'primary',
213
+ child: 'submit-label',
214
+ action: {
215
+ event: {
216
+ name: 'submit_controls',
217
+ context: {
218
+ name: { path: '/name' },
219
+ plan: { path: '/plan' },
220
+ alerts: { path: '/alerts' },
221
+ volume: { path: '/volume' },
222
+ when: { path: '/when' },
223
+ },
224
+ },
410
225
  },
411
226
  },
227
+ ],
228
+ value: {
229
+ name: 'Morgan',
230
+ plan: 'pro',
231
+ alerts: true,
232
+ volume: 64,
233
+ when: '2026-05-01T18:30:00Z',
412
234
  },
413
- },
414
- ]);
415
- }
416
- /** Collect all gallery messages */
417
- function getAllGalleryMessages() {
418
- return [
419
- ...textMessages(),
420
- ...imageMessages(),
421
- ...videoMessages(),
422
- ...audioMessages(),
423
- ...layoutMessages(),
424
- ...textFieldMessages(),
425
- ...checkboxMessages(),
426
- ...sliderMessages(),
427
- ...dateTimeMessages(),
428
- ...multipleChoiceMessages(),
429
- ...buttonMessages(),
430
- ...tabsMessages(),
431
- ...iconRowMessages(),
432
- ...cardMessages(),
433
- ...listMessages(),
434
- ...modalMessages(),
435
- ];
436
- }
437
- const SECTIONS = [
438
- {
439
- label: 'Text',
440
- surfaceId: 'gallery-text-block',
441
- messages: textMessages,
442
- },
443
- { label: 'Image', surfaceId: 'gallery-image', messages: imageMessages },
444
- { label: 'Video', surfaceId: 'gallery-video', messages: videoMessages },
445
- {
446
- label: 'AudioPlayer',
447
- surfaceId: 'gallery-audio',
448
- messages: audioMessages,
449
- },
450
- {
451
- label: 'Row + Column',
452
- surfaceId: 'gallery-layout',
453
- messages: layoutMessages,
454
- },
455
- {
456
- label: 'TextField',
457
- surfaceId: 'gallery-text',
458
- messages: textFieldMessages,
459
- },
460
- {
461
- label: 'CheckBox',
462
- surfaceId: 'gallery-checkbox',
463
- messages: checkboxMessages,
235
+ }),
464
236
  },
465
- { label: 'Slider', surfaceId: 'gallery-slider', messages: sliderMessages },
466
237
  {
467
- label: 'DateTimeInput',
468
- surfaceId: 'gallery-date',
469
- messages: dateTimeMessages,
470
- },
471
- {
472
- label: 'MultipleChoice',
473
- surfaceId: 'gallery-mc',
474
- messages: multipleChoiceMessages,
475
- },
476
- { label: 'Button', surfaceId: 'gallery-button', messages: buttonMessages },
477
- { label: 'Tabs', surfaceId: 'gallery-tabs', messages: tabsMessages },
478
- { label: 'Icons', surfaceId: 'gallery-icons', messages: iconRowMessages },
479
- {
480
- label: 'Card + Divider',
481
- surfaceId: 'gallery-card',
482
- messages: cardMessages,
238
+ id: 'tabs-modal',
239
+ label: 'Tabs + Modal',
240
+ description: 'Tabs with nested content and a modal trigger using event actions.',
241
+ messages: createSceneMessages({
242
+ surfaceId: 'gallery-tabs-modal',
243
+ components: [
244
+ { id: 'root', component: 'Column', children: ['tabs', 'modal'] },
245
+ {
246
+ id: 'tabs',
247
+ component: 'Tabs',
248
+ tabs: [
249
+ { title: 'Overview', child: 'tab-overview' },
250
+ { title: 'Details', child: 'tab-details' },
251
+ ],
252
+ },
253
+ {
254
+ id: 'tab-overview',
255
+ component: 'Card',
256
+ child: 'tab-overview-text',
257
+ },
258
+ {
259
+ id: 'tab-overview-text',
260
+ component: 'Text',
261
+ text: 'Overview tab uses static component composition.',
262
+ },
263
+ {
264
+ id: 'tab-details',
265
+ component: 'Card',
266
+ child: 'tab-details-text',
267
+ },
268
+ {
269
+ id: 'tab-details-text',
270
+ component: 'Text',
271
+ text: 'Details tab includes modal interaction below.',
272
+ },
273
+ { id: 'modal-trigger-label', component: 'Text', text: 'Open Modal' },
274
+ {
275
+ id: 'modal-content-text',
276
+ component: 'Text',
277
+ text: 'This content is rendered inside a modal.',
278
+ },
279
+ {
280
+ id: 'modal-content',
281
+ component: 'Card',
282
+ child: 'modal-content-text',
283
+ },
284
+ {
285
+ id: 'modal-trigger',
286
+ component: 'Button',
287
+ child: 'modal-trigger-label',
288
+ action: { event: { name: 'open_modal' } },
289
+ },
290
+ {
291
+ id: 'modal',
292
+ component: 'Modal',
293
+ trigger: 'modal-trigger',
294
+ content: 'modal-content',
295
+ },
296
+ ],
297
+ }),
483
298
  },
484
- { label: 'List', surfaceId: 'gallery-list', messages: listMessages },
485
- { label: 'Modal', surfaceId: 'gallery-modal', messages: modalMessages },
486
299
  ];
487
- // ---------------------------------------------------------------------------
488
- // Components
489
- // ---------------------------------------------------------------------------
490
- function GalleryContent() {
491
- const { processMessages, clearSurfaces, getSurfaces } = useA2UIActions();
492
- const [loaded, setLoaded] = useState(false);
493
- const [selectedSection, setSelectedSection] = useState(null);
494
- const loadAll = useCallback(() => {
495
- clearSurfaces();
496
- processMessages(getAllGalleryMessages());
497
- setLoaded(true);
498
- setSelectedSection(null);
499
- }, [processMessages, clearSurfaces]);
500
- const loadSection = useCallback((section) => {
501
- clearSurfaces();
502
- processMessages(section.messages());
503
- setLoaded(true);
504
- setSelectedSection(section.surfaceId);
505
- }, [processMessages, clearSurfaces]);
506
- const surfaces = getSurfaces();
507
- const surfaceEntries = Array.from(surfaces.entries());
508
- return (_jsxs(Box, { sx: { display: 'flex', minHeight: '100vh' }, children: [_jsxs(Box, { sx: {
509
- width: '240px',
510
- borderRight: '1px solid',
300
+ function GalleryContent({ onAction, }) {
301
+ const { surfaces, processMessages, resetSurfaces } = useA2uiProcessor(onAction);
302
+ const [selectedScene, setSelectedScene] = useState(SCENES[0].id);
303
+ const currentScene = useMemo(() => SCENES.find(scene => scene.id === selectedScene) ?? SCENES[0], [selectedScene]);
304
+ const showScene = useCallback((scene) => {
305
+ resetSurfaces();
306
+ processMessages(scene.messages);
307
+ }, [processMessages, resetSurfaces]);
308
+ const showAllScenes = useCallback(() => {
309
+ resetSurfaces();
310
+ SCENES.forEach(scene => {
311
+ processMessages(scene.messages);
312
+ });
313
+ }, [processMessages, resetSurfaces]);
314
+ useEffect(() => {
315
+ showScene(currentScene);
316
+ }, [currentScene, showScene]);
317
+ return (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 3, p: 3 }, children: [_jsxs(Box, { sx: {
318
+ width: '100%',
319
+ border: '1px solid',
511
320
  borderColor: 'border.default',
321
+ borderRadius: 2,
322
+ p: 3,
512
323
  backgroundColor: 'canvas.subtle',
513
- padding: 3,
514
324
  display: 'flex',
515
325
  flexDirection: 'column',
516
- gap: 1,
517
- overflowY: 'auto',
518
- }, children: [_jsx(Text, { as: "h3", sx: { fontSize: '1rem', fontWeight: 'bold', marginBottom: 2 }, children: "Components" }), _jsx(PrimerButton, { variant: selectedSection === null && loaded ? 'primary' : 'default', onClick: loadAll, sx: { width: '100%', justifyContent: 'flex-start', marginBottom: 2 }, children: "Show All" }), SECTIONS.map(section => (_jsx(PrimerButton, { variant: selectedSection === section.surfaceId ? 'primary' : 'invisible', onClick: () => loadSection(section), sx: { width: '100%', justifyContent: 'flex-start' }, children: section.label }, section.surfaceId)))] }), _jsx(Box, { sx: { flex: 1, padding: 4, overflowY: 'auto' }, children: !loaded ? (_jsxs(Box, { sx: {
519
- display: 'flex',
520
- flexDirection: 'column',
521
- alignItems: 'center',
522
- justifyContent: 'center',
523
- height: '100%',
524
- gap: 3,
525
- }, children: [_jsx(Text, { sx: { fontSize: '3rem' }, children: "\uD83C\uDFA8" }), _jsx(Text, { as: "h2", sx: { fontSize: '1.5rem', fontWeight: 'bold' }, children: "A2UI Component Gallery" }), _jsx(Text, { sx: { color: 'fg.muted', textAlign: 'center', maxWidth: '400px' }, children: "Browse the full catalog of A2UI components rendered via @a2ui/react. Click \"Show All\" or pick a component from the sidebar." }), _jsx(PrimerButton, { variant: "primary", onClick: loadAll, children: "Show All Components" })] })) : (_jsx(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 4 }, children: surfaceEntries.map(([surfaceId]) => (_jsxs(Box, { children: [_jsx(Text, { as: "h4", sx: {
526
- fontSize: '0.75rem',
527
- fontWeight: 'bold',
528
- color: 'fg.muted',
529
- textTransform: 'uppercase',
530
- letterSpacing: '0.05em',
531
- marginBottom: 2,
532
- }, children: surfaceId }), _jsx(Box, { sx: {
533
- border: '1px solid',
534
- borderColor: 'border.default',
535
- borderRadius: 2,
536
- padding: 3,
537
- backgroundColor: 'canvas.default',
538
- }, children: _jsx(A2UIRenderer, { surfaceId: surfaceId }) })] }, surfaceId))) })) })] }));
326
+ gap: 3,
327
+ }, children: [_jsx(Text, { sx: { fontSize: 2, fontWeight: 'bold' }, children: "Scenes" }), _jsx(SegmentedControl, { "aria-label": "A2UI gallery scene picker", fullWidth: true, children: SCENES.map(scene => (_jsx(SegmentedControl.Button, { selected: scene.id === selectedScene, onClick: () => setSelectedScene(scene.id), children: scene.label }, scene.id))) }), _jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: currentScene.description }), _jsxs(Box, { sx: { display: 'flex', gap: 2, flexWrap: 'wrap' }, children: [_jsx(Button, { size: "small", variant: "primary", onClick: () => showScene(currentScene), children: "Reload" }), _jsx(Button, { size: "small", variant: "default", onClick: showAllScenes, children: "Show All" }), _jsx(Button, { size: "small", variant: "invisible", onClick: resetSurfaces, children: "Clear" })] })] }), _jsx(Box, { sx: {
328
+ width: '100%',
329
+ minWidth: 0,
330
+ display: 'flex',
331
+ flexDirection: 'column',
332
+ gap: 4,
333
+ }, children: surfaces.map(surface => (_jsx(Box, { sx: { width: '100%' }, children: _jsx(A2uiSurface, { surface: surface }) }, surface.id))) })] }));
539
334
  }
540
- /**
541
- * A2UiComponentGalleryExample — Kitchen sink of all A2UI components.
542
- * No backend required — uses static A2UI JSON messages rendered client-side.
543
- */
544
335
  const A2UiComponentGalleryExample = () => {
545
- const handleAction = useCallback((actionMessage) => {
546
- console.log('Gallery action:', actionMessage);
547
- // In a real app this would be sent back to the agent
548
- alert(`Action: ${JSON.stringify(actionMessage, null, 2)}`);
336
+ const [lastAction, setLastAction] = useState(null);
337
+ const handleAction = useCallback((action) => {
338
+ console.log('A2UI Gallery Action:', action);
339
+ setLastAction(action);
549
340
  }, []);
550
- return (_jsx(ThemedProvider, { children: _jsx(A2UIProvider, { onAction: handleAction, children: _jsxs(Box, { sx: {
551
- display: 'flex',
552
- flexDirection: 'column',
553
- minHeight: '100vh',
554
- backgroundColor: 'canvas.default',
555
- }, children: [_jsxs(Box, { sx: {
556
- padding: 3,
341
+ return (_jsx(ThemedProvider, { children: _jsx(A2uiMarkdownProvider, { children: _jsxs(Box, { sx: { minHeight: '100vh', display: 'flex', flexDirection: 'column' }, children: [_jsxs(Box, { sx: {
342
+ px: 3,
343
+ py: 3,
557
344
  borderBottom: '1px solid',
558
345
  borderColor: 'border.default',
559
346
  backgroundColor: 'canvas.subtle',
560
- }, children: [_jsx(Text, { as: "h1", sx: {
561
- fontSize: '1.25rem',
562
- fontWeight: 'bold',
563
- display: 'flex',
564
- alignItems: 'center',
565
- gap: 2,
566
- }, children: "\uD83C\uDFA8 A2UI Component Gallery" }), _jsx(Text, { sx: { fontSize: '0.875rem', color: 'fg.muted' }, children: "Static A2UI messages rendered via @a2ui/react \u2014 no backend needed" })] }), _jsx(GalleryContent, {})] }) }) }));
347
+ }, children: [_jsx(Text, { as: "h1", sx: { fontSize: 3, fontWeight: 'bold' }, children: "\uD83C\uDFA8 A2UI Component Gallery" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: "Showcases the A2UI basic catalog rendered live via MessageProcessor and A2uiSurface." })] }), _jsx(GalleryContent, { onAction: handleAction }), _jsx(Box, { sx: {
348
+ borderTop: '1px solid',
349
+ borderColor: 'border.default',
350
+ p: 3,
351
+ fontFamily: 'mono',
352
+ fontSize: 0,
353
+ backgroundColor: 'canvas.subtle',
354
+ whiteSpace: 'pre-wrap',
355
+ maxHeight: 220,
356
+ overflow: 'auto',
357
+ }, children: lastAction
358
+ ? JSON.stringify(lastAction, null, 2)
359
+ : 'No action triggered yet.' })] }) }) }));
567
360
  };
568
361
  export default A2UiComponentGalleryExample;