glchat-a2ui-react-renderer 0.3.3 → 0.3.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 (31) hide show
  1. package/dist/src/components/a2ui/v0_8/UnknownComponent/UnknownComponent.d.ts +7 -0
  2. package/dist/src/components/a2ui/v0_8/UnknownComponent/UnknownComponent.d.ts.map +1 -0
  3. package/dist/src/components/a2ui/v0_8/UnknownComponent/UnknownComponent.js +13 -0
  4. package/dist/src/components/a2ui/v0_9/Button/Button.d.ts +2 -2
  5. package/dist/src/components/a2ui/v0_9/Timeout/Timeout.d.ts +2 -2
  6. package/dist/src/components/a2ui/v0_9/UnknownComponent/UnknownComponent.d.ts +231 -0
  7. package/dist/src/components/a2ui/v0_9/UnknownComponent/UnknownComponent.d.ts.map +1 -0
  8. package/dist/src/components/a2ui/v0_9/UnknownComponent/UnknownComponent.js +24 -0
  9. package/dist/src/components/ui/InlineAlert/InlineAlert.d.ts +14 -0
  10. package/dist/src/components/ui/InlineAlert/InlineAlert.d.ts.map +1 -0
  11. package/dist/src/components/ui/InlineAlert/InlineAlert.js +9 -0
  12. package/dist/src/v0_8/Provider.d.ts.map +1 -1
  13. package/dist/src/v0_8/Provider.js +10 -2
  14. package/dist/src/v0_8/registry.d.ts +5 -0
  15. package/dist/src/v0_8/registry.d.ts.map +1 -1
  16. package/dist/src/v0_8/registry.js +26 -12
  17. package/dist/src/v0_9/Provider.d.ts +6 -1
  18. package/dist/src/v0_9/Provider.d.ts.map +1 -1
  19. package/dist/src/v0_9/Provider.js +17 -8
  20. package/dist/src/v0_9/SurfaceErrorBoundary.d.ts +18 -0
  21. package/dist/src/v0_9/SurfaceErrorBoundary.d.ts.map +1 -0
  22. package/dist/src/v0_9/SurfaceErrorBoundary.js +24 -0
  23. package/dist/src/v0_9/SurfaceRenderer.d.ts.map +1 -1
  24. package/dist/src/v0_9/SurfaceRenderer.js +29 -3
  25. package/dist/src/v0_9/catalog.d.ts +6 -0
  26. package/dist/src/v0_9/catalog.d.ts.map +1 -1
  27. package/dist/src/v0_9/catalog.js +15 -0
  28. package/package.json +1 -1
  29. package/styles/globals.css +75 -0
  30. package/styles/theme-v4.css +5 -0
  31. package/tailwind.config.cjs +9 -0
@@ -0,0 +1,7 @@
1
+ import type { A2UIComponentProps } from '@a2ui/react/v0_8';
2
+ /**
3
+ * Renders a warning alert for unknown v0.8 component types.
4
+ * Wired into registries via `installUnknownComponentFallback`.
5
+ */
6
+ export declare function CustomUnknownComponent({ node }: Readonly<A2UIComponentProps>): import("react").JSX.Element;
7
+ //# sourceMappingURL=UnknownComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnknownComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/components/a2ui/v0_8/UnknownComponent/UnknownComponent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAI3D;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,IAAI,EAAE,EAAE,QAAQ,CAAC,kBAAkB,CAAC,+BAS5E"}
@@ -0,0 +1,13 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { InlineAlert } from '../../../../components/ui/InlineAlert/InlineAlert.js';
4
+ /**
5
+ * Renders a warning alert for unknown v0.8 component types.
6
+ * Wired into registries via `installUnknownComponentFallback`.
7
+ */
8
+ export function CustomUnknownComponent({ node }) {
9
+ const type = node && typeof node === 'object' && 'type' in node && node.type != null
10
+ ? String(node.type)
11
+ : 'unknown';
12
+ return (_jsx(InlineAlert, { role: "status", variant: "warning", message: `Unknown A2UI component: ${type}` }));
13
+ }
@@ -229,8 +229,8 @@ export declare const GlchatButtonApi: {
229
229
  returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
230
230
  };
231
231
  };
232
- weight?: number | undefined;
233
232
  variant?: "primary" | "destructive" | "borderless" | "default" | undefined;
233
+ weight?: number | undefined;
234
234
  accessibility?: {
235
235
  description?: string | {
236
236
  path: string;
@@ -277,8 +277,8 @@ export declare const GlchatButtonApi: {
277
277
  returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
278
278
  };
279
279
  };
280
- weight?: number | undefined;
281
280
  variant?: "primary" | "destructive" | "borderless" | "default" | undefined;
281
+ weight?: number | undefined;
282
282
  accessibility?: {
283
283
  description?: string | {
284
284
  path: string;
@@ -105,8 +105,8 @@ export declare const TimeoutApi: {
105
105
  args: Record<string, any>;
106
106
  returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
107
107
  };
108
- weight?: number | undefined;
109
108
  variant?: "caption" | "h3" | "body" | "h4" | "h5" | undefined;
109
+ weight?: number | undefined;
110
110
  accessibility?: {
111
111
  description?: string | {
112
112
  path: string;
@@ -131,8 +131,8 @@ export declare const TimeoutApi: {
131
131
  args: Record<string, any>;
132
132
  returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
133
133
  };
134
- weight?: number | undefined;
135
134
  variant?: "caption" | "h3" | "body" | "h4" | "h5" | undefined;
135
+ weight?: number | undefined;
136
136
  accessibility?: {
137
137
  description?: string | {
138
138
  path: string;
@@ -0,0 +1,231 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Fallback API used when a message references a component type that is not
4
+ * registered in the active catalog. Properties are accepted but ignored.
5
+ */
6
+ export declare const UnknownComponentApi: {
7
+ name: string;
8
+ schema: z.ZodObject<{
9
+ accessibility: z.ZodOptional<z.ZodObject<{
10
+ label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
11
+ path: z.ZodString;
12
+ }, "strip", z.ZodTypeAny, {
13
+ path: string;
14
+ }, {
15
+ path: string;
16
+ }>, z.ZodObject<{
17
+ call: z.ZodString;
18
+ args: z.ZodRecord<z.ZodString, z.ZodAny>;
19
+ returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ call: string;
22
+ args: Record<string, any>;
23
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
24
+ }, {
25
+ call: string;
26
+ args: Record<string, any>;
27
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
28
+ }>]>>;
29
+ description: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
30
+ path: z.ZodString;
31
+ }, "strip", z.ZodTypeAny, {
32
+ path: string;
33
+ }, {
34
+ path: string;
35
+ }>, z.ZodObject<{
36
+ call: z.ZodString;
37
+ args: z.ZodRecord<z.ZodString, z.ZodAny>;
38
+ returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ call: string;
41
+ args: Record<string, any>;
42
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
43
+ }, {
44
+ call: string;
45
+ args: Record<string, any>;
46
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
47
+ }>]>>;
48
+ }, "strip", z.ZodTypeAny, {
49
+ description?: string | {
50
+ path: string;
51
+ } | {
52
+ call: string;
53
+ args: Record<string, any>;
54
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
55
+ } | undefined;
56
+ label?: string | {
57
+ path: string;
58
+ } | {
59
+ call: string;
60
+ args: Record<string, any>;
61
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
62
+ } | undefined;
63
+ }, {
64
+ description?: string | {
65
+ path: string;
66
+ } | {
67
+ call: string;
68
+ args: Record<string, any>;
69
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
70
+ } | undefined;
71
+ label?: string | {
72
+ path: string;
73
+ } | {
74
+ call: string;
75
+ args: Record<string, any>;
76
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
77
+ } | undefined;
78
+ }>>;
79
+ weight: z.ZodOptional<z.ZodNumber>;
80
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
81
+ accessibility: z.ZodOptional<z.ZodObject<{
82
+ label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
83
+ path: z.ZodString;
84
+ }, "strip", z.ZodTypeAny, {
85
+ path: string;
86
+ }, {
87
+ path: string;
88
+ }>, z.ZodObject<{
89
+ call: z.ZodString;
90
+ args: z.ZodRecord<z.ZodString, z.ZodAny>;
91
+ returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
92
+ }, "strip", z.ZodTypeAny, {
93
+ call: string;
94
+ args: Record<string, any>;
95
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
96
+ }, {
97
+ call: string;
98
+ args: Record<string, any>;
99
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
100
+ }>]>>;
101
+ description: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
102
+ path: z.ZodString;
103
+ }, "strip", z.ZodTypeAny, {
104
+ path: string;
105
+ }, {
106
+ path: string;
107
+ }>, z.ZodObject<{
108
+ call: z.ZodString;
109
+ args: z.ZodRecord<z.ZodString, z.ZodAny>;
110
+ returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
111
+ }, "strip", z.ZodTypeAny, {
112
+ call: string;
113
+ args: Record<string, any>;
114
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
115
+ }, {
116
+ call: string;
117
+ args: Record<string, any>;
118
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
119
+ }>]>>;
120
+ }, "strip", z.ZodTypeAny, {
121
+ description?: string | {
122
+ path: string;
123
+ } | {
124
+ call: string;
125
+ args: Record<string, any>;
126
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
127
+ } | undefined;
128
+ label?: string | {
129
+ path: string;
130
+ } | {
131
+ call: string;
132
+ args: Record<string, any>;
133
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
134
+ } | undefined;
135
+ }, {
136
+ description?: string | {
137
+ path: string;
138
+ } | {
139
+ call: string;
140
+ args: Record<string, any>;
141
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
142
+ } | undefined;
143
+ label?: string | {
144
+ path: string;
145
+ } | {
146
+ call: string;
147
+ args: Record<string, any>;
148
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
149
+ } | undefined;
150
+ }>>;
151
+ weight: z.ZodOptional<z.ZodNumber>;
152
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
153
+ accessibility: z.ZodOptional<z.ZodObject<{
154
+ label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
155
+ path: z.ZodString;
156
+ }, "strip", z.ZodTypeAny, {
157
+ path: string;
158
+ }, {
159
+ path: string;
160
+ }>, z.ZodObject<{
161
+ call: z.ZodString;
162
+ args: z.ZodRecord<z.ZodString, z.ZodAny>;
163
+ returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
164
+ }, "strip", z.ZodTypeAny, {
165
+ call: string;
166
+ args: Record<string, any>;
167
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
168
+ }, {
169
+ call: string;
170
+ args: Record<string, any>;
171
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
172
+ }>]>>;
173
+ description: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
174
+ path: z.ZodString;
175
+ }, "strip", z.ZodTypeAny, {
176
+ path: string;
177
+ }, {
178
+ path: string;
179
+ }>, z.ZodObject<{
180
+ call: z.ZodString;
181
+ args: z.ZodRecord<z.ZodString, z.ZodAny>;
182
+ returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
183
+ }, "strip", z.ZodTypeAny, {
184
+ call: string;
185
+ args: Record<string, any>;
186
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
187
+ }, {
188
+ call: string;
189
+ args: Record<string, any>;
190
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
191
+ }>]>>;
192
+ }, "strip", z.ZodTypeAny, {
193
+ description?: string | {
194
+ path: string;
195
+ } | {
196
+ call: string;
197
+ args: Record<string, any>;
198
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
199
+ } | undefined;
200
+ label?: string | {
201
+ path: string;
202
+ } | {
203
+ call: string;
204
+ args: Record<string, any>;
205
+ returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
206
+ } | undefined;
207
+ }, {
208
+ description?: string | {
209
+ path: string;
210
+ } | {
211
+ call: string;
212
+ args: Record<string, any>;
213
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
214
+ } | undefined;
215
+ label?: string | {
216
+ path: string;
217
+ } | {
218
+ call: string;
219
+ args: Record<string, any>;
220
+ returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
221
+ } | undefined;
222
+ }>>;
223
+ weight: z.ZodOptional<z.ZodNumber>;
224
+ }, z.ZodTypeAny, "passthrough">>;
225
+ };
226
+ /**
227
+ * Renders a warning alert for unknown component types.
228
+ * Wired into catalogs via `installUnknownComponentFallback`.
229
+ */
230
+ export declare const UnknownComponentFallback: import("@a2ui/react/v0_9").ReactComponentImplementation;
231
+ //# sourceMappingURL=UnknownComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnknownComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/components/a2ui/v0_9/UnknownComponent/UnknownComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;0BAwB8pZ,CAAC;;;;;;;;;;;;;;;;;;;0BAAivB,CAAC;;;;;;;;;;;;;;;;;;;;;;;0BAA2sB,CAAC;;;;;;;0BAA0O,CAAC;;;;;;;;;;;;;;;;;;;;;;;0BAA1qD,CAAC;;;;;;;;;;;;;;;;;;;0BAAivB,CAAC;;;;;;;;;;;;;;;;;;;;;;;0BAA2sB,CAAC;;;;;;;0BAA0O,CAAC;;;;;;;;;;;;;;;;;;;;;;;0BAA1qD,CAAC;;;;;;;;;;;;;;;;;;;0BAAivB,CAAC;;;;;;;;;;;;;;;;;;;;;;;0BAA2sB,CAAC;;;;;;;0BAA0O,CAAC;;;;;CAhBv2c,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,yDASpC,CAAC"}
@@ -0,0 +1,24 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { createBinderlessComponentImplementation } from '@a2ui/react/v0_9';
4
+ import { z } from 'zod';
5
+ import { InlineAlert } from '../../../../components/ui/InlineAlert/InlineAlert.js';
6
+ import { CommonProps } from '../common.js';
7
+ /**
8
+ * Fallback API used when a message references a component type that is not
9
+ * registered in the active catalog. Properties are accepted but ignored.
10
+ */
11
+ export const UnknownComponentApi = {
12
+ name: '__UnknownComponent__',
13
+ schema: z
14
+ .object({
15
+ ...CommonProps,
16
+ })
17
+ .passthrough()
18
+ .describe('Placeholder for an unsupported or unregistered A2UI component.'),
19
+ };
20
+ /**
21
+ * Renders a warning alert for unknown component types.
22
+ * Wired into catalogs via `installUnknownComponentFallback`.
23
+ */
24
+ export const UnknownComponentFallback = createBinderlessComponentImplementation(UnknownComponentApi, ({ context }) => (_jsx(InlineAlert, { role: "status", variant: "warning", message: `Unknown A2UI component: ${context.componentModel.type}` })));
@@ -0,0 +1,14 @@
1
+ import { type HTMLAttributes } from 'react';
2
+ export type InlineAlertProps = HTMLAttributes<HTMLDivElement> & {
3
+ /** Visual tone. Defaults to `warning`. */
4
+ variant?: 'warning' | 'error';
5
+ /** Alert message text. */
6
+ message?: string;
7
+ };
8
+ export declare const InlineAlert: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
9
+ /** Visual tone. Defaults to `warning`. */
10
+ variant?: "warning" | "error";
11
+ /** Alert message text. */
12
+ message?: string;
13
+ } & import("react").RefAttributes<HTMLDivElement>>;
14
+ //# sourceMappingURL=InlineAlert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InlineAlert.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/InlineAlert/InlineAlert.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAIxD,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC9D,0CAA0C;IAC1C,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC9B,0BAA0B;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,WAAW;IANtB,0CAA0C;cAChC,SAAS,GAAG,OAAO;IAC7B,0BAA0B;cAChB,MAAM;kDAqBhB,CAAC"}
@@ -0,0 +1,9 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { CircleAlert } from 'lucide-react';
4
+ import { forwardRef } from 'react';
5
+ import { cn } from '../../../utils/css.js';
6
+ export const InlineAlert = forwardRef(function InlineAlert({ className, message = 'Alert Message', variant = 'warning', ...props }, ref) {
7
+ return (_jsxs("div", { className: cn('glchat-a2ui-inline-alert', `glchat-a2ui-inline-alert--${variant}`, className), ref: ref, ...props, children: [_jsx("div", { className: "glchat-a2ui-inline-alert__icon", children: _jsx(CircleAlert, { className: "glchat-a2ui-inline-alert__svg", strokeWidth: 1.5 }) }), _jsx("div", { className: "glchat-a2ui-inline-alert__body", children: _jsx("p", { className: "glchat-a2ui-inline-alert__message", children: message }) })] }));
8
+ });
9
+ InlineAlert.displayName = 'InlineAlert';
@@ -1 +1 @@
1
- {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../src/v0_8/Provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,EAEL,iBAAiB,EAEjB,KAAK,sBAAsB,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAyB,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAI5D,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,sBAAsB,CAAC,YAAY,CAAC,CAAC,CAAC;AACjF,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAClF,MAAM,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC9B,CAAC;AAyCF,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,OAAO,EACP,QAAQ,EAAE,YAAY,EACtB,QAAQ,GACT,EAAE,QAAQ,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,+BAgC/C;AAED,wBAAgB,eAAe,IAAI,iBAAiB,CAInD"}
1
+ {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../src/v0_8/Provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAW/C,OAAO,EAEL,iBAAiB,EAEjB,KAAK,sBAAsB,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAyB,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAGxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAI5D,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,sBAAsB,CAAC,YAAY,CAAC,CAAC,CAAC;AACjF,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAClF,MAAM,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC9B,CAAC;AAqDF,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,OAAO,EACP,QAAQ,EAAE,YAAY,EACtB,QAAQ,GACT,EAAE,QAAQ,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,+BAgC/C;AAED,wBAAgB,eAAe,IAAI,iBAAiB,CAInD"}
@@ -1,13 +1,16 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { createContext, useCallback, useContext, useEffect, useMemo, useRef } from 'react';
3
+ import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
4
4
  import { A2UIProvider, ComponentRegistry, useA2UI, } from '@a2ui/react/v0_8';
5
+ import { InlineAlert } from '../components/ui/InlineAlert/InlineAlert.js';
5
6
  import { ensureGlchatComponentsRegistered } from './registry.js';
6
7
  import { mergeGlchatTheme } from './theme.js';
7
8
  const A2UIRegistryContext = createContext(null);
9
+ const PROCESS_ERROR_MESSAGE = 'Failed to process A2UI messages (v0.8)';
8
10
  function MessagesProcessor({ messages, onError, }) {
9
11
  const { processMessages } = useA2UI();
10
12
  const processedCountRef = useRef(0);
13
+ const [processError, setProcessError] = useState(null);
11
14
  useEffect(() => {
12
15
  if (!messages?.length)
13
16
  return;
@@ -20,8 +23,11 @@ function MessagesProcessor({ messages, onError, }) {
20
23
  processedCountRef.current = messages.length;
21
24
  try {
22
25
  processMessages(pending);
26
+ // eslint-disable-next-line react-hooks/set-state-in-effect -- sync process result into alert UI
27
+ setProcessError(null);
23
28
  }
24
29
  catch (error) {
30
+ setProcessError(PROCESS_ERROR_MESSAGE);
25
31
  if (onError) {
26
32
  onError(error);
27
33
  }
@@ -31,7 +37,9 @@ function MessagesProcessor({ messages, onError, }) {
31
37
  }
32
38
  }
33
39
  }, [messages, onError, processMessages]);
34
- return null;
40
+ if (!processError)
41
+ return null;
42
+ return (_jsx("div", { className: "a2ui-surface", children: _jsx(InlineAlert, { role: "alert", variant: "warning", message: processError }) }));
35
43
  }
36
44
  export function V08Provider({ messages, theme, onAction, onError, registry: registryProp, children, }) {
37
45
  const registry = useMemo(() => registryProp ?? ComponentRegistry.getInstance(), [registryProp]);
@@ -3,6 +3,11 @@ import { ComponentRegistry } from '@a2ui/react/v0_8';
3
3
  * Catalog identifier for the GLChat extended A2UI v0.8 catalog.
4
4
  */
5
5
  export declare const GLCHAT_CATALOG_ID_V08 = "https://github.com/GDP-ADMIN/glchat-sdk/blob/main/js/glchat-a2ui-react-renderer/json/v0_8/glchat_standard_catalog_definition.json";
6
+ /**
7
+ * Makes `registry.get(type)` return the warning fallback when the type is not
8
+ * registered, so unknown components render an alert instead of nothing.
9
+ */
10
+ export declare function installUnknownComponentFallback(registry: ComponentRegistry): void;
6
11
  /**
7
12
  * Ensures the registry has the official default A2UI components
8
13
  * extended with GLChat-specific components.
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/v0_8/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA0B,MAAM,kBAAkB,CAAC;AAS7E;;GAEG;AACH,eAAO,MAAM,qBAAqB,sIACmG,CAAC;AAItI;;;GAGG;AACH,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,iBAAiB,QAgB3E;AAED,wBAAgB,oBAAoB,IAAI,iBAAiB,CAIxD"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/v0_8/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA0B,MAAM,kBAAkB,CAAC;AAU7E;;GAEG;AACH,eAAO,MAAM,qBAAqB,sIACmG,CAAC;AAKtI;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAOjF;AAED;;;GAGG;AACH,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,iBAAiB,QAkB3E;AAED,wBAAgB,oBAAoB,IAAI,iBAAiB,CAIxD"}
@@ -5,28 +5,42 @@ import { CustomDestructiveButtonComponent } from '../components/a2ui/v0_8/Destru
5
5
  import { CustomMultipleChoiceComponent } from '../components/a2ui/v0_8/MultipleChoice/MultipleChoice.js';
6
6
  import { CustomTagInputComponent } from '../components/a2ui/v0_8/TagInput/TagInput.js';
7
7
  import { CustomTimeoutComponent } from '../components/a2ui/v0_8/Timeout/Timeout.js';
8
+ import { CustomUnknownComponent } from '../components/a2ui/v0_8/UnknownComponent/UnknownComponent.js';
8
9
  /**
9
10
  * Catalog identifier for the GLChat extended A2UI v0.8 catalog.
10
11
  */
11
12
  export const GLCHAT_CATALOG_ID_V08 = 'https://github.com/GDP-ADMIN/glchat-sdk/blob/main/js/glchat-a2ui-react-renderer/json/v0_8/glchat_standard_catalog_definition.json';
12
13
  const registeredRegistries = new WeakSet();
14
+ const fallbackRegistries = new WeakSet();
15
+ /**
16
+ * Makes `registry.get(type)` return the warning fallback when the type is not
17
+ * registered, so unknown components render an alert instead of nothing.
18
+ */
19
+ export function installUnknownComponentFallback(registry) {
20
+ if (fallbackRegistries.has(registry))
21
+ return;
22
+ const originalGet = registry.get.bind(registry);
23
+ registry.get = ((type) => originalGet(type) ?? CustomUnknownComponent);
24
+ fallbackRegistries.add(registry);
25
+ }
13
26
  /**
14
27
  * Ensures the registry has the official default A2UI components
15
28
  * extended with GLChat-specific components.
16
29
  */
17
30
  export function ensureGlchatComponentsRegistered(registry) {
18
- if (registeredRegistries.has(registry))
19
- return;
20
- registerDefaultCatalog(registry);
21
- registry.unregister('Button');
22
- registry.unregister('MultipleChoice');
23
- registry.register('Button', { component: CustomButtonComponent });
24
- registry.register('ButtonAsLink', { component: CustomButtonAsLinkComponent });
25
- registry.register('DestructiveButton', { component: CustomDestructiveButtonComponent });
26
- registry.register('MultipleChoice', { component: CustomMultipleChoiceComponent });
27
- registry.register('TagInput', { component: CustomTagInputComponent });
28
- registry.register('Timeout', { component: CustomTimeoutComponent });
29
- registeredRegistries.add(registry);
31
+ if (!registeredRegistries.has(registry)) {
32
+ registerDefaultCatalog(registry);
33
+ registry.unregister('Button');
34
+ registry.unregister('MultipleChoice');
35
+ registry.register('Button', { component: CustomButtonComponent });
36
+ registry.register('ButtonAsLink', { component: CustomButtonAsLinkComponent });
37
+ registry.register('DestructiveButton', { component: CustomDestructiveButtonComponent });
38
+ registry.register('MultipleChoice', { component: CustomMultipleChoiceComponent });
39
+ registry.register('TagInput', { component: CustomTagInputComponent });
40
+ registry.register('Timeout', { component: CustomTimeoutComponent });
41
+ registeredRegistries.add(registry);
42
+ }
43
+ installUnknownComponentFallback(registry);
30
44
  }
31
45
  export function createGlchatRegistry() {
32
46
  const registry = new ComponentRegistry();
@@ -11,6 +11,11 @@ export type V09ProviderProps = {
11
11
  onError?: V09MessageErrorHandler;
12
12
  catalog?: Catalog<ReactComponentImplementation>;
13
13
  };
14
+ type SurfaceGroupContextValue = {
15
+ model: SurfaceGroupModel<ReactComponentImplementation>;
16
+ hasMessages: boolean;
17
+ };
14
18
  export declare function V09Provider({ messages, onAction, onError, catalog, children, }: Readonly<PropsWithChildren<V09ProviderProps>>): import("react").JSX.Element;
15
- export declare function useSurfaceGroup(): SurfaceGroupModel<ReactComponentImplementation>;
19
+ export declare function useSurfaceGroup(): SurfaceGroupContextValue;
20
+ export {};
16
21
  //# sourceMappingURL=Provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../src/v0_9/Provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,EAAmB,KAAK,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAG5D,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAChD,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAClF,MAAM,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC,4BAA4B,CAAC,CAAC;CACjD,CAAC;AAMF,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,OAAO,EACP,QAAQ,GACT,EAAE,QAAQ,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,+BAgE/C;AAED,wBAAgB,eAAe,IAAI,iBAAiB,CAAC,4BAA4B,CAAC,CAIjF"}
1
+ {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../src/v0_9/Provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,EAAmB,KAAK,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAQ5D,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAChD,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAClF,MAAM,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC,4BAA4B,CAAC,CAAC;CACjD,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE,iBAAiB,CAAC,4BAA4B,CAAC,CAAC;IACvD,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAMF,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,OAAO,EACP,QAAQ,GACT,EAAE,QAAQ,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,+BAkF/C;AAED,wBAAgB,eAAe,IAAI,wBAAwB,CAI1D"}
@@ -1,15 +1,19 @@
1
1
  'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { createContext, useContext, useEffect, useRef, useState } from 'react';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { createContext, useContext, useEffect, useMemo, useRef, useState } from 'react';
4
4
  import { MarkdownContext } from '@a2ui/react/v0_9';
5
5
  import { MessageProcessor, } from '@a2ui/web_core/v0_9';
6
6
  import { injectBasicCatalogStyles } from '@a2ui/web_core/v0_9/basic_catalog';
7
7
  import { renderMarkdown } from '@a2ui/markdown-it';
8
- import { createGlchatCatalog, GLCHAT_CATALOG_ID, withFallbackCatalogId } from './catalog.js';
8
+ import { InlineAlert } from '../components/ui/InlineAlert/InlineAlert.js';
9
+ import { createGlchatCatalog, GLCHAT_CATALOG_ID, installUnknownComponentFallback, withFallbackCatalogId, } from './catalog.js';
9
10
  const SurfaceGroupContext = createContext(null);
11
+ const PROCESS_ERROR_MESSAGE = 'Failed to process A2UI messages (v0.9)';
10
12
  export function V09Provider({ messages, onAction, onError, catalog, children, }) {
11
13
  const onActionRef = useRef(onAction);
12
14
  const onErrorRef = useRef(onError);
15
+ const [processError, setProcessError] = useState(null);
16
+ const hasMessages = !!messages?.length;
13
17
  useEffect(() => {
14
18
  onActionRef.current = onAction;
15
19
  }, [onAction]);
@@ -18,6 +22,7 @@ export function V09Provider({ messages, onAction, onError, catalog, children, })
18
22
  }, [onError]);
19
23
  const [processor] = useState(() => {
20
24
  const resolvedCatalog = catalog ?? createGlchatCatalog();
25
+ installUnknownComponentFallback(resolvedCatalog);
21
26
  return new MessageProcessor([resolvedCatalog]);
22
27
  });
23
28
  const processedCountRef = useRef(0);
@@ -44,8 +49,11 @@ export function V09Provider({ messages, onAction, onError, catalog, children, })
44
49
  processedCountRef.current = messages.length;
45
50
  try {
46
51
  processor.processMessages(pending);
52
+ // eslint-disable-next-line react-hooks/set-state-in-effect -- sync process result into alert UI
53
+ setProcessError(null);
47
54
  }
48
55
  catch (error) {
56
+ setProcessError(PROCESS_ERROR_MESSAGE);
49
57
  if (onErrorRef.current) {
50
58
  onErrorRef.current(error);
51
59
  }
@@ -54,12 +62,13 @@ export function V09Provider({ messages, onAction, onError, catalog, children, })
54
62
  console.error('[glchat-a2ui] Failed to process v0.9 messages:', error);
55
63
  }
56
64
  }
57
- }, [messages, processor]);
58
- return (_jsx(SurfaceGroupContext.Provider, { value: processor.model, children: _jsx(MarkdownContext.Provider, { value: renderMarkdown, children: children }) }));
65
+ }, [messages, processor, catalog?.id]);
66
+ const contextValue = useMemo(() => ({ model: processor.model, hasMessages }), [processor.model, hasMessages]);
67
+ return (_jsx(SurfaceGroupContext.Provider, { value: contextValue, children: _jsxs(MarkdownContext.Provider, { value: renderMarkdown, children: [processError ? (_jsx("div", { className: "a2ui-surface", children: _jsx(InlineAlert, { role: "alert", variant: "warning", message: processError }) })) : null, children] }) }));
59
68
  }
60
69
  export function useSurfaceGroup() {
61
- const model = useContext(SurfaceGroupContext);
62
- if (!model)
70
+ const ctx = useContext(SurfaceGroupContext);
71
+ if (!ctx)
63
72
  throw new Error('useSurfaceGroup must be used inside Provider (v0.9)');
64
- return model;
73
+ return ctx;
65
74
  }
@@ -0,0 +1,18 @@
1
+ import { Component, type ErrorInfo, type ReactNode } from 'react';
2
+ type SurfaceErrorBoundaryProps = Readonly<{
3
+ children: ReactNode;
4
+ }>;
5
+ type SurfaceErrorBoundaryState = {
6
+ hasError: boolean;
7
+ };
8
+ /**
9
+ * Catches render errors from `@a2ui/react` catalog components.
10
+ */
11
+ export declare class SurfaceErrorBoundary extends Component<SurfaceErrorBoundaryProps, SurfaceErrorBoundaryState> {
12
+ state: SurfaceErrorBoundaryState;
13
+ static getDerivedStateFromError(): SurfaceErrorBoundaryState;
14
+ componentDidCatch(error: Error, info: ErrorInfo): void;
15
+ render(): ReactNode;
16
+ }
17
+ export {};
18
+ //# sourceMappingURL=SurfaceErrorBoundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SurfaceErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/v0_9/SurfaceErrorBoundary.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMlE,KAAK,yBAAyB,GAAG,QAAQ,CAAC;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,CAAC,CAAC;AACnE,KAAK,yBAAyB,GAAG;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvD;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,SAAS,CACjD,yBAAyB,EACzB,yBAAyB,CAC1B;IACC,KAAK,EAAE,yBAAyB,CAAuB;IAEvD,MAAM,CAAC,wBAAwB,IAAI,yBAAyB;IAI5D,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI;IAKtD,MAAM,IAAI,SAAS;CAMpB"}
@@ -0,0 +1,24 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Component } from 'react';
4
+ import { InlineAlert } from '../components/ui/InlineAlert/InlineAlert.js';
5
+ const RENDER_ERROR_MESSAGE = 'Failed to render A2UI surface';
6
+ /**
7
+ * Catches render errors from `@a2ui/react` catalog components.
8
+ */
9
+ export class SurfaceErrorBoundary extends Component {
10
+ state = { hasError: false };
11
+ static getDerivedStateFromError() {
12
+ return { hasError: true };
13
+ }
14
+ componentDidCatch(error, info) {
15
+ // eslint-disable-next-line no-console -- match Provider message-process logging
16
+ console.error('[glchat-a2ui] Failed to render v0.9 surface:', error, info.componentStack);
17
+ }
18
+ render() {
19
+ if (this.state.hasError) {
20
+ return _jsx(InlineAlert, { role: "alert", variant: "warning", message: RENDER_ERROR_MESSAGE });
21
+ }
22
+ return this.props.children;
23
+ }
24
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"SurfaceRenderer.d.ts","sourceRoot":"","sources":["../../../src/v0_9/SurfaceRenderer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAMlE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC,+BA4BvE"}
1
+ {"version":3,"file":"SurfaceRenderer.d.ts","sourceRoot":"","sources":["../../../src/v0_9/SurfaceRenderer.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AA2DlE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC,+BAkCvE"}
@@ -1,11 +1,37 @@
1
1
  'use client';
2
2
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
3
+ import { useCallback, useSyncExternalStore } from 'react';
3
4
  import { A2uiSurface } from '@a2ui/react/v0_9';
5
+ import { InlineAlert } from '../components/ui/InlineAlert/InlineAlert.js';
4
6
  import { useSurfaceGroup } from './Provider.js';
7
+ import { SurfaceErrorBoundary } from './SurfaceErrorBoundary.js';
5
8
  import { useSurfaces } from './useSurfaces.js';
6
9
  const DEFAULT_FALLBACK = _jsx(_Fragment, {});
10
+ const ROOT_MISSING_MESSAGE = 'This A2UI interface could not be loaded because no root component was found.';
11
+ /** True when the surface has a `root` component (replace `@a2ui` "[Loading root...]"). */
12
+ function useHasRootComponent(surface) {
13
+ const subscribe = useCallback((onStoreChange) => {
14
+ const created = surface.componentsModel.onCreated.subscribe(() => onStoreChange());
15
+ const deleted = surface.componentsModel.onDeleted.subscribe(() => onStoreChange());
16
+ return () => {
17
+ created.unsubscribe();
18
+ deleted.unsubscribe();
19
+ };
20
+ }, [surface]);
21
+ const getSnapshot = useCallback(() => surface.componentsModel.get('root') != null, [surface]);
22
+ return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
23
+ }
24
+ function SurfaceView({ surface, className, fallback, hasMessages, }) {
25
+ const hasRoot = useHasRootComponent(surface);
26
+ if (!hasRoot) {
27
+ if (!hasMessages)
28
+ return _jsx(_Fragment, { children: fallback });
29
+ return (_jsx("div", { className: className, children: _jsx(InlineAlert, { role: "alert", variant: "warning", message: ROOT_MISSING_MESSAGE }) }));
30
+ }
31
+ return (_jsx("div", { className: className, children: _jsx(SurfaceErrorBoundary, { children: _jsx(A2uiSurface, { surface: surface }) }) }));
32
+ }
7
33
  export function V09SurfaceRenderer(props) {
8
- const model = useSurfaceGroup();
34
+ const { model, hasMessages } = useSurfaceGroup();
9
35
  const surfaces = useSurfaces(model);
10
36
  const fallback = props.fallback ?? DEFAULT_FALLBACK;
11
37
  const surfaceClassName = props.className ? `a2ui-surface ${props.className}` : 'a2ui-surface';
@@ -13,9 +39,9 @@ export function V09SurfaceRenderer(props) {
13
39
  const surface = model.getSurface(props.surfaceId);
14
40
  if (!surface)
15
41
  return _jsx(_Fragment, { children: fallback });
16
- return (_jsx("div", { className: surfaceClassName, children: _jsx(A2uiSurface, { surface: surface }) }));
42
+ return (_jsx(SurfaceView, { surface: surface, className: surfaceClassName, fallback: fallback, hasMessages: hasMessages }));
17
43
  }
18
44
  if (surfaces.length === 0)
19
45
  return _jsx(_Fragment, { children: fallback });
20
- return (_jsx(_Fragment, { children: surfaces.map((surface) => (_jsx("div", { className: surfaceClassName, children: _jsx(A2uiSurface, { surface: surface }) }, surface.id))) }));
46
+ return (_jsx(_Fragment, { children: surfaces.map((surface) => (_jsx(SurfaceView, { surface: surface, className: surfaceClassName, fallback: fallback, hasMessages: hasMessages }, surface.id))) }));
21
47
  }
@@ -8,6 +8,12 @@ export declare const GLCHAT_CATALOG_ID = "https://github.com/GDP-ADMIN/glchat-sd
8
8
  export declare const GLCHAT_CATALOG_OVERRIDES: readonly ["Button"];
9
9
  /** GLChat-only components not present in the basic catalog. */
10
10
  export declare const GLCHAT_CATALOG_EXTENSIONS: readonly ["TagInput", "Timeout"];
11
+ /**
12
+ * Makes `catalog.components.get(type)` return the warning fallback when the
13
+ * type is not registered, so unknown components render an alert instead of
14
+ * `@a2ui/react`'s red placeholder.
15
+ */
16
+ export declare function installUnknownComponentFallback(catalog: Catalog<ReactComponentImplementation>): void;
11
17
  /**
12
18
  * Builds the GLChat A2UI v0.9 catalog:
13
19
  * - Includes basic catalog components except those GLChat overrides (`AudioPlayer`, `Button`, `ChoicePicker`).
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/v0_9/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAQhE;;GAEG;AACH,eAAO,MAAM,iBAAiB,iIACkG,CAAC;AAKjI,0EAA0E;AAC1E,eAAO,MAAM,wBAAwB,qBAAsB,CAAC;AAE5D,+DAA+D;AAC/D,eAAO,MAAM,yBAAyB,kCAAmC,CAAC;AAE1E;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,4BAA4B,CAAC,CAiB3E;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,WAAW,EAAE,EACvB,YAAY,EAAE,MAAM,GACnB,WAAW,EAAE,CAqBf"}
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/v0_9/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAShE;;GAEG;AACH,eAAO,MAAM,iBAAiB,iIACkG,CAAC;AAKjI,0EAA0E;AAC1E,eAAO,MAAM,wBAAwB,qBAAsB,CAAC;AAE5D,+DAA+D;AAC/D,eAAO,MAAM,yBAAyB,kCAAmC,CAAC;AAE1E;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,OAAO,CAAC,4BAA4B,CAAC,GAC7C,IAAI,CASN;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,4BAA4B,CAAC,CAiB3E;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,WAAW,EAAE,EACvB,YAAY,EAAE,MAAM,GACnB,WAAW,EAAE,CAqBf"}
@@ -5,6 +5,7 @@ import { GlchatButtonComponent } from '../components/a2ui/v0_9/Button/Button.js'
5
5
  import { GlchatChoicePickerComponent } from '../components/a2ui/v0_9/ChoicePicker/ChoicePicker.js';
6
6
  import { GlchatTagInputComponent } from '../components/a2ui/v0_9/TagInput/TagInput.js';
7
7
  import { GlchatTimeoutComponent } from '../components/a2ui/v0_9/Timeout/Timeout.js';
8
+ import { UnknownComponentFallback } from '../components/a2ui/v0_9/UnknownComponent/UnknownComponent.js';
8
9
  /**
9
10
  * Catalog identifier for the GLChat extended A2UI v0.9 catalog.
10
11
  */
@@ -15,6 +16,20 @@ const OVERRIDDEN_COMPONENTS = new Set(['AudioPlayer', 'Button', 'ChoicePicker'])
15
16
  export const GLCHAT_CATALOG_OVERRIDES = ['Button'];
16
17
  /** GLChat-only components not present in the basic catalog. */
17
18
  export const GLCHAT_CATALOG_EXTENSIONS = ['TagInput', 'Timeout'];
19
+ /**
20
+ * Makes `catalog.components.get(type)` return the warning fallback when the
21
+ * type is not registered, so unknown components render an alert instead of
22
+ * `@a2ui/react`'s red placeholder.
23
+ */
24
+ export function installUnknownComponentFallback(catalog) {
25
+ const map = catalog.components;
26
+ if (map.__glchatUnknownFallback) {
27
+ return;
28
+ }
29
+ const originalGet = map.get.bind(map);
30
+ map.get = ((name) => originalGet(name) ?? UnknownComponentFallback);
31
+ map.__glchatUnknownFallback = true;
32
+ }
18
33
  /**
19
34
  * Builds the GLChat A2UI v0.9 catalog:
20
35
  * - Includes basic catalog components except those GLChat overrides (`AudioPlayer`, `Button`, `ChoicePicker`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glchat-a2ui-react-renderer",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "A2UI (Agent-to-UI) React renderer for GLChat — render declarative UI from AI agent messages",
5
5
  "author": {
6
6
  "name": "GDP Labs",
@@ -43,6 +43,11 @@
43
43
  --positive-alternate: 152 81% 96%;
44
44
  --positive-alternate-foreground: 161 100% 22%;
45
45
 
46
+ --warning: 43 96% 45%;
47
+ --warning-foreground: 0 0% 100%;
48
+ --warning-alternate: 48 100% 96%;
49
+ --warning-alternate-foreground: 32 95% 30%;
50
+
46
51
  --ring: 198 100% 31%;
47
52
 
48
53
  --card: 0 0% 100%;
@@ -99,6 +104,11 @@
99
104
  --positive-alternate: 161 100% 22%;
100
105
  --positive-alternate-foreground: 152 81% 96%;
101
106
 
107
+ --warning: 43 96% 56%;
108
+ --warning-foreground: 0 0% 11%;
109
+ --warning-alternate: 36 60% 18%;
110
+ --warning-alternate-foreground: 48 100% 90%;
111
+
102
112
  --ring: 196 71% 39%;
103
113
 
104
114
  --card: 0 0% 11%;
@@ -590,3 +600,68 @@
590
600
  cursor: not-allowed !important;
591
601
  opacity: 0.5 !important;
592
602
  }
603
+
604
+ /* Inline alert — A2UI process / status warnings */
605
+ .a2ui-surface .glchat-a2ui-inline-alert {
606
+ position: relative;
607
+ display: flex;
608
+ align-items: flex-start;
609
+ width: 100%;
610
+ max-width: 100%;
611
+ box-sizing: border-box;
612
+ border-radius: var(--radius-md);
613
+ padding: 1rem;
614
+ }
615
+
616
+ .a2ui-surface .glchat-a2ui-inline-alert--warning {
617
+ border: 1px solid hsl(var(--warning));
618
+ background-color: hsl(var(--warning-alternate));
619
+ }
620
+
621
+ .a2ui-surface .glchat-a2ui-inline-alert--error {
622
+ border: 1px solid hsl(var(--destructive));
623
+ background-color: hsl(var(--destructive-alternate));
624
+ }
625
+
626
+ .a2ui-surface .glchat-a2ui-inline-alert__icon {
627
+ margin-top: 0.125rem;
628
+ }
629
+
630
+ .a2ui-surface .glchat-a2ui-inline-alert__svg {
631
+ width: 1.25rem;
632
+ height: 1.25rem;
633
+ flex-shrink: 0;
634
+ }
635
+
636
+ .a2ui-surface .glchat-a2ui-inline-alert--warning .glchat-a2ui-inline-alert__svg {
637
+ color: hsl(var(--warning));
638
+ }
639
+
640
+ .a2ui-surface .glchat-a2ui-inline-alert--error .glchat-a2ui-inline-alert__svg {
641
+ color: hsl(var(--destructive));
642
+ }
643
+
644
+ .a2ui-surface .glchat-a2ui-inline-alert__body {
645
+ margin-left: 0.75rem;
646
+ display: flex;
647
+ flex: 1;
648
+ flex-direction: column;
649
+ gap: 0.5rem;
650
+ overflow: hidden;
651
+ }
652
+
653
+ .a2ui-surface .glchat-a2ui-inline-alert__message {
654
+ margin: 0;
655
+ flex: 1;
656
+ overflow: auto;
657
+ font-size: 0.875rem;
658
+ line-height: 1.5rem;
659
+ }
660
+
661
+ .a2ui-surface .glchat-a2ui-inline-alert--warning .glchat-a2ui-inline-alert__message {
662
+ color: hsl(var(--warning-alternate-foreground));
663
+ }
664
+
665
+ .a2ui-surface .glchat-a2ui-inline-alert--error .glchat-a2ui-inline-alert__message {
666
+ color: hsl(var(--destructive-alternate-foreground));
667
+ }
@@ -63,6 +63,11 @@
63
63
  --color-positive-alternate: hsl(var(--positive-alternate));
64
64
  --color-positive-alternate-foreground: hsl(var(--positive-alternate-foreground));
65
65
 
66
+ --color-warning: hsl(var(--warning));
67
+ --color-warning-foreground: hsl(var(--warning-foreground));
68
+ --color-warning-alternate: hsl(var(--warning-alternate));
69
+ --color-warning-alternate-foreground: hsl(var(--warning-alternate-foreground));
70
+
66
71
  --color-ring: hsl(var(--ring));
67
72
 
68
73
  --color-card: hsl(var(--card));
@@ -84,6 +84,15 @@ module.exports = {
84
84
  },
85
85
  },
86
86
 
87
+ warning: {
88
+ DEFAULT: 'hsl(var(--warning))',
89
+ foreground: 'hsl(var(--warning-foreground))',
90
+ alternate: {
91
+ DEFAULT: 'hsl(var(--warning-alternate))',
92
+ foreground: 'hsl(var(--warning-alternate-foreground))',
93
+ },
94
+ },
95
+
87
96
  ring: 'hsl(var(--ring))',
88
97
 
89
98
  card: {