@watt42/a2ui-core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # @watt42/a2ui-core
2
+
3
+ ## Purpose
4
+
5
+ Shared TypeScript A2UI types, message prepare/diagnostics, and lightweight UIService facade.
6
+
7
+ ## Owns
8
+
9
+ - A2UI message types and version constants
10
+ - `prepare` / normalize helpers used before processors
11
+ - Diagnostics helpers
12
+ - Thin `UIService` client stub for TS consumers
13
+
14
+ ## Does Not Own
15
+
16
+ - React rendering or components
17
+ - Python compiler / `UICapability`
18
+ - Transport adapters
19
+
20
+ ## Public API
21
+
22
+ ```ts
23
+ import {
24
+ A2UI_VERSION,
25
+ prepareA2UiMessages,
26
+ type A2UiMessage,
27
+ } from "@watt42/a2ui-core";
28
+ ```
29
+
30
+ ## Dependencies
31
+
32
+ - `@watt42/a2ui-component-catalog`
@@ -0,0 +1,18 @@
1
+ import type { MissingComponentReferenceIssue, ObjectTextBindingIssue, TabsConfigurationIssue, UnsupportedComponentIssue } from "./catalogDiagnostics.js";
2
+ import type { A2UiMessage } from "./types.js";
3
+ /** Catalog / binding diagnostics for an A2UI message batch (host-agnostic). */
4
+ export interface A2UiDiagnostics {
5
+ unsupportedComponents: UnsupportedComponentIssue[];
6
+ tabsIssues: TabsConfigurationIssue[];
7
+ missingComponentRefs: MissingComponentReferenceIssue[];
8
+ objectTextBindings: ObjectTextBindingIssue[];
9
+ missingDataModel: boolean;
10
+ hasWarnings: boolean;
11
+ }
12
+ export declare function buildA2UiDiagnostics(messages: A2UiMessage[], options?: {
13
+ alreadyPrepared?: boolean;
14
+ renderer?: "official" | "surface";
15
+ }): A2UiDiagnostics;
16
+ /** Surface/editor strip: ignore object-text binding noise. */
17
+ export declare function a2uiSurfaceHasWarnings(diagnostics: A2UiDiagnostics): boolean;
18
+ //# sourceMappingURL=a2uiDiagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"a2uiDiagnostics.d.ts","sourceRoot":"","sources":["../src/a2uiDiagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,8BAA8B,EAC9B,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EAC1B,MAAM,yBAAyB,CAAC;AAQjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,+EAA+E;AAC/E,MAAM,WAAW,eAAe;IAC9B,qBAAqB,EAAE,yBAAyB,EAAE,CAAC;IACnD,UAAU,EAAE,sBAAsB,EAAE,CAAC;IACrC,oBAAoB,EAAE,8BAA8B,EAAE,CAAC;IACvD,kBAAkB,EAAE,sBAAsB,EAAE,CAAC;IAC7C,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,WAAW,EAAE,EACvB,OAAO,CAAC,EAAE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;CAAE,GACzE,eAAe,CAwBjB;AAED,8DAA8D;AAC9D,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,eAAe,GAAG,OAAO,CAO5E"}
@@ -0,0 +1,32 @@
1
+ import { findMissingComponentReferences, findMissingDataModelMessages, findObjectTextBindingIssues, findTabsConfigurationIssues, findUnsupportedComponents, } from "./catalogDiagnostics.js";
2
+ export function buildA2UiDiagnostics(messages, options) {
3
+ const opts = {
4
+ alreadyPrepared: options?.alreadyPrepared ?? false,
5
+ renderer: options?.renderer,
6
+ };
7
+ const unsupportedComponents = findUnsupportedComponents(messages, opts);
8
+ const tabsIssues = findTabsConfigurationIssues(messages, opts);
9
+ const missingComponentRefs = findMissingComponentReferences(messages, opts);
10
+ const objectTextBindings = findObjectTextBindingIssues(messages, opts);
11
+ const missingDataModel = findMissingDataModelMessages(messages, opts);
12
+ return {
13
+ unsupportedComponents,
14
+ tabsIssues,
15
+ missingComponentRefs,
16
+ objectTextBindings,
17
+ missingDataModel,
18
+ hasWarnings: unsupportedComponents.length > 0 ||
19
+ tabsIssues.length > 0 ||
20
+ missingComponentRefs.length > 0 ||
21
+ objectTextBindings.length > 0 ||
22
+ missingDataModel,
23
+ };
24
+ }
25
+ /** Surface/editor strip: ignore object-text binding noise. */
26
+ export function a2uiSurfaceHasWarnings(diagnostics) {
27
+ return (diagnostics.unsupportedComponents.length > 0 ||
28
+ diagnostics.tabsIssues.length > 0 ||
29
+ diagnostics.missingComponentRefs.length > 0 ||
30
+ diagnostics.missingDataModel);
31
+ }
32
+ //# sourceMappingURL=a2uiDiagnostics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"a2uiDiagnostics.js","sourceRoot":"","sources":["../src/a2uiDiagnostics.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,EAC5B,2BAA2B,EAC3B,2BAA2B,EAC3B,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC;AAajC,MAAM,UAAU,oBAAoB,CAClC,QAAuB,EACvB,OAA0E;IAE1E,MAAM,IAAI,GAAG;QACX,eAAe,EAAE,OAAO,EAAE,eAAe,IAAI,KAAK;QAClD,QAAQ,EAAE,OAAO,EAAE,QAAQ;KAC5B,CAAC;IACF,MAAM,qBAAqB,GAAG,yBAAyB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACxE,MAAM,UAAU,GAAG,2BAA2B,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC/D,MAAM,oBAAoB,GAAG,8BAA8B,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC5E,MAAM,kBAAkB,GAAG,2BAA2B,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACvE,MAAM,gBAAgB,GAAG,4BAA4B,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAEtE,OAAO;QACL,qBAAqB;QACrB,UAAU;QACV,oBAAoB;QACpB,kBAAkB;QAClB,gBAAgB;QAChB,WAAW,EACT,qBAAqB,CAAC,MAAM,GAAG,CAAC;YAChC,UAAU,CAAC,MAAM,GAAG,CAAC;YACrB,oBAAoB,CAAC,MAAM,GAAG,CAAC;YAC/B,kBAAkB,CAAC,MAAM,GAAG,CAAC;YAC7B,gBAAgB;KACnB,CAAC;AACJ,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,sBAAsB,CAAC,WAA4B;IACjE,OAAO,CACL,WAAW,CAAC,qBAAqB,CAAC,MAAM,GAAG,CAAC;QAC5C,WAAW,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC;QACjC,WAAW,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC;QAC3C,WAAW,CAAC,gBAAgB,CAC7B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Catalog-aware diagnostics using shared component-catalog metadata.
3
+ */
4
+ import type { A2UiMessage } from "./types.js";
5
+ export declare function getSupportedCatalogComponentNames(renderer?: "official" | "surface"): string[];
6
+ export interface UnsupportedComponentIssue {
7
+ component: string;
8
+ catalogId: string;
9
+ }
10
+ export interface A2UiValidationOptions {
11
+ alreadyPrepared?: boolean;
12
+ renderer?: "official" | "surface";
13
+ }
14
+ export declare function findUnsupportedComponents(messages: A2UiMessage[], options?: A2UiValidationOptions): UnsupportedComponentIssue[];
15
+ export declare function formatUnsupportedComponentHint(issue: UnsupportedComponentIssue): string;
16
+ export declare function findMissingDataModelMessages(messages: A2UiMessage[], options?: A2UiValidationOptions): boolean;
17
+ export interface TabsConfigurationIssue {
18
+ componentId: string;
19
+ detail: string;
20
+ }
21
+ export interface ObjectTextBindingIssue {
22
+ componentId: string;
23
+ path: string;
24
+ }
25
+ export interface MissingComponentReferenceIssue {
26
+ referencedBy: string;
27
+ missingId: string;
28
+ }
29
+ export declare function formatMissingComponentReferenceDetail(issue: MissingComponentReferenceIssue): string;
30
+ export declare function findMissingComponentReferences(messages: A2UiMessage[], options?: A2UiValidationOptions): MissingComponentReferenceIssue[];
31
+ export declare function findObjectTextBindingIssues(messages: A2UiMessage[], options?: A2UiValidationOptions): ObjectTextBindingIssue[];
32
+ export declare function findTabsConfigurationIssues(messages: A2UiMessage[], options?: A2UiValidationOptions): TabsConfigurationIssue[];
33
+ //# sourceMappingURL=catalogDiagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalogDiagnostics.d.ts","sourceRoot":"","sources":["../src/catalogDiagnostics.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAU9C,wBAAgB,iCAAiC,CAC/C,QAAQ,CAAC,EAAE,UAAU,GAAG,SAAS,GAChC,MAAM,EAAE,CAOV;AAMD,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAoBD,MAAM,WAAW,qBAAqB;IACpC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CACnC;AASD,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,WAAW,EAAE,EACvB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,yBAAyB,EAAE,CAoB7B;AAED,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,yBAAyB,GAC/B,MAAM,CAER;AASD,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,WAAW,EAAE,EACvB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAgBT;AAED,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,8BAA8B;IAC7C,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,qCAAqC,CACnD,KAAK,EAAE,8BAA8B,GACpC,MAAM,CAMR;AA6CD,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,WAAW,EAAE,EACvB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,8BAA8B,EAAE,CAuBlC;AAuCD,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,WAAW,EAAE,EACvB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,sBAAsB,EAAE,CA0B1B;AAeD,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,WAAW,EAAE,EACvB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,sBAAsB,EAAE,CA4C1B"}
@@ -0,0 +1,268 @@
1
+ /**
2
+ * Catalog-aware diagnostics using shared component-catalog metadata.
3
+ */
4
+ import { getCatalog, listComponents } from "@watt42/a2ui-component-catalog";
5
+ import { coerceA2UiMessages, isDynamicBindingValue, normalizeTabsArray, } from "./normalize.js";
6
+ let cachedByRenderer = new Map();
7
+ export function getSupportedCatalogComponentNames(renderer) {
8
+ const key = renderer ?? "all";
9
+ const cached = cachedByRenderer.get(key);
10
+ if (cached)
11
+ return cached;
12
+ const names = listComponents(renderer).map((c) => c.name).sort();
13
+ cachedByRenderer.set(key, names);
14
+ return names;
15
+ }
16
+ function getSupportedComponentSet(renderer) {
17
+ return new Set(getSupportedCatalogComponentNames(renderer));
18
+ }
19
+ function isRecord(value) {
20
+ return typeof value === "object" && value !== null && !Array.isArray(value);
21
+ }
22
+ function componentTypeFromRaw(raw) {
23
+ if (!isRecord(raw))
24
+ return null;
25
+ if (typeof raw.component === "string")
26
+ return raw.component;
27
+ if (typeof raw.type === "string" &&
28
+ raw.type !== "updateComponents" &&
29
+ raw.type !== "createSurface" &&
30
+ raw.type !== "surfaceUpdate") {
31
+ return raw.type;
32
+ }
33
+ return null;
34
+ }
35
+ function resolveMessages(messages, options) {
36
+ return options?.alreadyPrepared ? messages : coerceA2UiMessages(messages);
37
+ }
38
+ export function findUnsupportedComponents(messages, options) {
39
+ const coerced = resolveMessages(messages, options);
40
+ const supported = getSupportedComponentSet(options?.renderer ?? "surface");
41
+ const catalogId = getCatalog().catalogId;
42
+ const seen = new Set();
43
+ const issues = [];
44
+ for (const message of coerced) {
45
+ const payload = message.updateComponents ?? message.surfaceUpdate;
46
+ if (!isRecord(payload) || !Array.isArray(payload.components))
47
+ continue;
48
+ for (const raw of payload.components) {
49
+ const name = componentTypeFromRaw(raw);
50
+ if (!name || supported.has(name) || seen.has(name))
51
+ continue;
52
+ seen.add(name);
53
+ issues.push({ component: name, catalogId });
54
+ }
55
+ }
56
+ return issues;
57
+ }
58
+ export function formatUnsupportedComponentHint(issue) {
59
+ return `"${issue.component}" is not in catalog ${issue.catalogId}. Available: ${getSupportedCatalogComponentNames().join(", ")}.`;
60
+ }
61
+ function usesDataModelPaths(value) {
62
+ if (Array.isArray(value))
63
+ return value.some(usesDataModelPaths);
64
+ if (isDynamicBindingValue(value))
65
+ return true;
66
+ if (!isRecord(value))
67
+ return false;
68
+ return Object.values(value).some(usesDataModelPaths);
69
+ }
70
+ export function findMissingDataModelMessages(messages, options) {
71
+ const coerced = resolveMessages(messages, options);
72
+ let needsModel = false;
73
+ let hasModel = false;
74
+ for (const message of coerced) {
75
+ if (message.updateDataModel || message.dataModelUpdate) {
76
+ hasModel = true;
77
+ }
78
+ const payload = message.updateComponents ?? message.surfaceUpdate;
79
+ if (isRecord(payload) && usesDataModelPaths(payload.components)) {
80
+ needsModel = true;
81
+ }
82
+ }
83
+ return needsModel && !hasModel;
84
+ }
85
+ export function formatMissingComponentReferenceDetail(issue) {
86
+ return (`Component "${issue.missingId}" is referenced by "${issue.referencedBy}" ` +
87
+ `(in children, child, or tabs) but is not defined in updateComponents. ` +
88
+ `Add a component with id "${issue.missingId}" to the components array.`);
89
+ }
90
+ function collectComponentIds(messages, options) {
91
+ const ids = new Set();
92
+ const coerced = resolveMessages(messages, options);
93
+ for (const message of coerced) {
94
+ const payload = message.updateComponents ?? message.surfaceUpdate;
95
+ if (!isRecord(payload) || !Array.isArray(payload.components))
96
+ continue;
97
+ for (const raw of payload.components) {
98
+ if (isRecord(raw) && typeof raw.id === "string") {
99
+ ids.add(raw.id);
100
+ }
101
+ }
102
+ }
103
+ return ids;
104
+ }
105
+ function referencedChildIdsFromRaw(raw) {
106
+ const ids = [];
107
+ if (Array.isArray(raw.children)) {
108
+ for (const child of raw.children) {
109
+ if (typeof child === "string")
110
+ ids.push(child);
111
+ }
112
+ }
113
+ if (typeof raw.child === "string")
114
+ ids.push(raw.child);
115
+ const tabs = raw.tabs ?? raw.tabItems;
116
+ if (Array.isArray(tabs)) {
117
+ for (const item of tabs) {
118
+ if (!isRecord(item))
119
+ continue;
120
+ if (typeof item.child === "string")
121
+ ids.push(item.child);
122
+ }
123
+ }
124
+ return ids;
125
+ }
126
+ export function findMissingComponentReferences(messages, options) {
127
+ const coerced = resolveMessages(messages, options);
128
+ const componentIds = collectComponentIds(messages, options);
129
+ const seen = new Set();
130
+ const issues = [];
131
+ for (const message of coerced) {
132
+ const payload = message.updateComponents ?? message.surfaceUpdate;
133
+ if (!isRecord(payload) || !Array.isArray(payload.components))
134
+ continue;
135
+ for (const raw of payload.components) {
136
+ if (!isRecord(raw) || typeof raw.id !== "string")
137
+ continue;
138
+ for (const missingId of referencedChildIdsFromRaw(raw)) {
139
+ if (componentIds.has(missingId))
140
+ continue;
141
+ const key = `${raw.id}\0${missingId}`;
142
+ if (seen.has(key))
143
+ continue;
144
+ seen.add(key);
145
+ issues.push({ referencedBy: raw.id, missingId });
146
+ }
147
+ }
148
+ }
149
+ return issues;
150
+ }
151
+ function getAtPath(root, path) {
152
+ if (!path || path === "/")
153
+ return root;
154
+ const segments = path.split("/").filter(Boolean);
155
+ let current = root;
156
+ for (const segment of segments) {
157
+ if (!isRecord(current) && !Array.isArray(current))
158
+ return undefined;
159
+ if (Array.isArray(current)) {
160
+ const index = Number(segment);
161
+ if (!Number.isInteger(index))
162
+ return undefined;
163
+ current = current[index];
164
+ continue;
165
+ }
166
+ current = current[segment];
167
+ }
168
+ return current;
169
+ }
170
+ function collectDataModelRoots(messages) {
171
+ const roots = new Map();
172
+ for (const message of messages) {
173
+ const payload = message.updateDataModel ?? message.dataModelUpdate;
174
+ if (!isRecord(payload) || typeof payload.surfaceId !== "string")
175
+ continue;
176
+ const path = typeof payload.path === "string" ? payload.path : "/";
177
+ if (path === "/") {
178
+ roots.set(payload.surfaceId, payload.value ?? payload.contents);
179
+ }
180
+ }
181
+ return roots;
182
+ }
183
+ function textPathFromProp(value) {
184
+ if (isRecord(value) && typeof value.path === "string" && value.path.trim()) {
185
+ return value.path.trim();
186
+ }
187
+ return null;
188
+ }
189
+ export function findObjectTextBindingIssues(messages, options) {
190
+ const coerced = resolveMessages(messages, options);
191
+ const roots = collectDataModelRoots(coerced);
192
+ const issues = [];
193
+ for (const message of coerced) {
194
+ const payload = message.updateComponents ?? message.surfaceUpdate;
195
+ if (!isRecord(payload) || !Array.isArray(payload.components))
196
+ continue;
197
+ const surfaceId = typeof payload.surfaceId === "string" ? payload.surfaceId : "default";
198
+ const root = roots.get(surfaceId);
199
+ for (const raw of payload.components) {
200
+ if (!isRecord(raw) || typeof raw.id !== "string")
201
+ continue;
202
+ const type = componentTypeFromRaw(raw);
203
+ if (type !== "Text")
204
+ continue;
205
+ const path = textPathFromProp(raw.text);
206
+ if (!path)
207
+ continue;
208
+ const value = getAtPath(root, path);
209
+ if (isRecord(value) && !Array.isArray(value)) {
210
+ issues.push({ componentId: raw.id, path });
211
+ }
212
+ }
213
+ }
214
+ return issues;
215
+ }
216
+ function formatTabTitleForMessage(title) {
217
+ if (typeof title === "string")
218
+ return title;
219
+ if (typeof title === "object" &&
220
+ title !== null &&
221
+ "path" in title &&
222
+ typeof title.path === "string") {
223
+ return title.path;
224
+ }
225
+ return "(dynamic title)";
226
+ }
227
+ export function findTabsConfigurationIssues(messages, options) {
228
+ const coerced = resolveMessages(messages, options);
229
+ const componentIds = collectComponentIds(messages, options);
230
+ const issues = [];
231
+ for (const message of coerced) {
232
+ const payload = message.updateComponents ?? message.surfaceUpdate;
233
+ if (!isRecord(payload) || !Array.isArray(payload.components))
234
+ continue;
235
+ for (const raw of payload.components) {
236
+ if (!isRecord(raw))
237
+ continue;
238
+ const type = componentTypeFromRaw(raw);
239
+ if (type !== "Tabs" || typeof raw.id !== "string")
240
+ continue;
241
+ const props = { ...raw };
242
+ delete props.id;
243
+ delete props.component;
244
+ delete props.type;
245
+ if (isRecord(raw.props)) {
246
+ Object.assign(props, raw.props);
247
+ }
248
+ const tabs = normalizeTabsArray(props);
249
+ if (tabs.length === 0) {
250
+ issues.push({
251
+ componentId: raw.id,
252
+ detail: 'Tabs needs a "tabs" array of {title, child} entries. Use string titles, {"path":"..."} for dynamic titles, and updateDataModel for values.',
253
+ });
254
+ continue;
255
+ }
256
+ for (const tab of tabs) {
257
+ if (!componentIds.has(tab.child)) {
258
+ issues.push({
259
+ componentId: raw.id,
260
+ detail: `Tabs references missing component "${tab.child}" (tab ${formatTabTitleForMessage(tab.title)}).`,
261
+ });
262
+ }
263
+ }
264
+ }
265
+ }
266
+ return issues;
267
+ }
268
+ //# sourceMappingURL=catalogDiagnostics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalogDiagnostics.js","sourceRoot":"","sources":["../src/catalogDiagnostics.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAE5E,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,GAEnB,MAAM,gBAAgB,CAAC;AAExB,IAAI,gBAAgB,GAAG,IAAI,GAAG,EAAoB,CAAC;AAEnD,MAAM,UAAU,iCAAiC,CAC/C,QAAiC;IAEjC,MAAM,GAAG,GAAG,QAAQ,IAAI,KAAK,CAAC;IAC9B,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG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GAAG,CAAC,EAAE;wBACnB,MAAM,EAAE,sCAAsC,GAAG,CAAC,KAAK,UAAU,wBAAwB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI;qBACzG,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** Canonical shared surface catalog id (generated catalog.json). */
2
+ export declare const WATT42_SHARED_UI_CATALOG: string;
3
+ /** Missing/invalid/retired catalogId → canonical shared catalog. */
4
+ export declare function resolveCatalogId(catalogId: unknown): string;
5
+ //# sourceMappingURL=catalogIds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalogIds.d.ts","sourceRoot":"","sources":["../src/catalogIds.ts"],"names":[],"mappings":"AAEA,oEAAoE;AACpE,eAAO,MAAM,wBAAwB,QAAyB,CAAC;AAI/D,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,CAQ3D"}
@@ -0,0 +1,15 @@
1
+ import { getCatalog } from "@watt42/a2ui-component-catalog";
2
+ /** Canonical shared surface catalog id (generated catalog.json). */
3
+ export const WATT42_SHARED_UI_CATALOG = getCatalog().catalogId;
4
+ const RETIRED_CATALOG_IDS = new Set(["watt42:a2ui:catalog:shadcn:v1"]);
5
+ /** Missing/invalid/retired catalogId → canonical shared catalog. */
6
+ export function resolveCatalogId(catalogId) {
7
+ if (typeof catalogId !== "string" || !catalogId.trim()) {
8
+ return WATT42_SHARED_UI_CATALOG;
9
+ }
10
+ if (RETIRED_CATALOG_IDS.has(catalogId.trim())) {
11
+ return WATT42_SHARED_UI_CATALOG;
12
+ }
13
+ return catalogId;
14
+ }
15
+ //# sourceMappingURL=catalogIds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalogIds.js","sourceRoot":"","sources":["../src/catalogIds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D,oEAAoE;AACpE,MAAM,CAAC,MAAM,wBAAwB,GAAG,UAAU,EAAE,CAAC,SAAS,CAAC;AAE/D,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC;AAEvE,oEAAoE;AACpE,MAAM,UAAU,gBAAgB,CAAC,SAAkB;IACjD,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC;QACvD,OAAO,wBAAwB,CAAC;IAClC,CAAC;IACD,IAAI,mBAAmB,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QAC9C,OAAO,wBAAwB,CAAC;IAClC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { A2UiMessage, UIServiceConfig, ValidationResult } from "./types.js";
2
+ import { A2UI_VERSION } from "./types.js";
3
+ export type { A2UiMessage, ValidationResult, UIServiceConfig };
4
+ export { A2UI_VERSION };
5
+ export { coerceA2UiMessages, normalizeProcessorComponents, countRenderableComponents, hasUpdateComponentsMessage, isDynamicBindingValue, resolveSurfaceId, normalizeTabsArray, type TabEntry, } from "./normalize.js";
6
+ export { prepareA2UiMessagesForProcessor } from "./prepare.js";
7
+ export { buildA2UiDiagnostics, a2uiSurfaceHasWarnings, type A2UiDiagnostics, } from "./a2uiDiagnostics.js";
8
+ export { formatMissingComponentReferenceDetail, formatUnsupportedComponentHint, getSupportedCatalogComponentNames, type MissingComponentReferenceIssue, type ObjectTextBindingIssue, type TabsConfigurationIssue, type UnsupportedComponentIssue, } from "./catalogDiagnostics.js";
9
+ export { WATT42_SHARED_UI_CATALOG, resolveCatalogId, } from "./catalogIds.js";
10
+ export declare class UIService {
11
+ private readonly config;
12
+ constructor(config?: UIServiceConfig);
13
+ validate(messages: A2UiMessage[]): ValidationResult;
14
+ prepare(messages: A2UiMessage[]): A2UiMessage[];
15
+ get catalogId(): string | undefined;
16
+ }
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC5B,yBAAyB,EACzB,0BAA0B,EAC1B,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,QAAQ,GACd,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,KAAK,eAAe,GACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,qCAAqC,EACrC,8BAA8B,EAC9B,iCAAiC,EACjC,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,GAC/B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAEzB,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;gBAE7B,MAAM,GAAE,eAAoB;IAIxC,QAAQ,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,gBAAgB;IAcnD,OAAO,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE;IAI/C,IAAI,SAAS,IAAI,MAAM,GAAG,SAAS,CAElC;CACF"}
package/dist/index.js ADDED
@@ -0,0 +1,35 @@
1
+ import { buildA2UiDiagnostics } from "./a2uiDiagnostics.js";
2
+ import { prepareA2UiMessagesForProcessor } from "./prepare.js";
3
+ import { A2UI_VERSION } from "./types.js";
4
+ export { A2UI_VERSION };
5
+ export { coerceA2UiMessages, normalizeProcessorComponents, countRenderableComponents, hasUpdateComponentsMessage, isDynamicBindingValue, resolveSurfaceId, normalizeTabsArray, } from "./normalize.js";
6
+ export { prepareA2UiMessagesForProcessor } from "./prepare.js";
7
+ export { buildA2UiDiagnostics, a2uiSurfaceHasWarnings, } from "./a2uiDiagnostics.js";
8
+ export { formatMissingComponentReferenceDetail, formatUnsupportedComponentHint, getSupportedCatalogComponentNames, } from "./catalogDiagnostics.js";
9
+ export { WATT42_SHARED_UI_CATALOG, resolveCatalogId, } from "./catalogIds.js";
10
+ export class UIService {
11
+ config;
12
+ constructor(config = {}) {
13
+ this.config = config;
14
+ }
15
+ validate(messages) {
16
+ const diagnostics = buildA2UiDiagnostics(messages, {
17
+ renderer: "surface",
18
+ });
19
+ const errors = [];
20
+ for (const issue of diagnostics.unsupportedComponents) {
21
+ errors.push(`Unsupported component: ${issue.component}`);
22
+ }
23
+ if (diagnostics.missingDataModel) {
24
+ errors.push("Missing updateDataModel for path-bound fields");
25
+ }
26
+ return { ok: errors.length === 0, errors };
27
+ }
28
+ prepare(messages) {
29
+ return prepareA2UiMessagesForProcessor(messages);
30
+ }
31
+ get catalogId() {
32
+ return this.config.catalogId;
33
+ }
34
+ }
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC5B,yBAAy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* ## Dynamic UI (what we preserve)
5
+ * - Data bindings: `{ "path": "/field" }` on Chart, Input, tab titles, etc.
6
+ * - Literals from the data model: `updateDataModel` + optional `literalString` in props.
7
+ * - Function-call bindings when present in incoming JSON.
8
+ *
9
+ * ## What we do NOT do (no hardcoded content)
10
+ * - No static component name lists (use the generated catalog / registry).
11
+ * - No invented tab titles ("Tab 1"), no Python `SystemState` defaults, no template substitution.
12
+ *
13
+ * ## Structural-only transforms (shape repair)
14
+ * - Message key coercion (`type` → `createSurface` / `updateComponents` / `updateDataModel`).
15
+ * - Flat component extraction, Card single-child wrapper, Tabs `tabItems` → `tabs`, Chart field aliases.
16
+ */
17
+ import type { A2UiMessage } from "./types.js";
18
+ /** True when value is already an A2UI dynamic binding (not a static string to rewrite). */
19
+ export declare function isDynamicBindingValue(value: unknown): boolean;
20
+ /** Resolve surface id from v0.9 payloads (models sometimes use `id` instead of `surfaceId`). */
21
+ export declare function resolveSurfaceId(payload: Record<string, unknown>, fallback?: string): string;
22
+ /** Ensure createSurface / deleteSurface / beginRendering payloads use `surfaceId`. */
23
+ export declare function normalizeSurfacePayload(payload: Record<string, unknown>): Record<string, unknown>;
24
+ /** Coerce `{ "type": "updateComponents", ... }` into proper A2UI v0.9 message keys. */
25
+ export declare function coerceA2UiMessages(messages: A2UiMessage[]): A2UiMessage[];
26
+ /** A2UI DynamicString: literal, path binding, or literalString wrapper. */
27
+ export type TabTitleValue = string | {
28
+ path: string;
29
+ } | {
30
+ literalString: string;
31
+ };
32
+ export interface TabEntry {
33
+ title: TabTitleValue;
34
+ child: string;
35
+ }
36
+ /**
37
+ * Canonical A2UI v0.9 Tabs `tabs` array: [{ title, child }].
38
+ * Preserves dynamic titles (`path` bindings). Does not invent placeholder titles.
39
+ */
40
+ export declare function normalizeTabsArray(props: Record<string, unknown>): TabEntry[];
41
+ export declare function normalizeProcessorComponents(rawComponents: unknown[]): Record<string, unknown>[];
42
+ export declare function countRenderableComponents(messages: A2UiMessage[]): number;
43
+ export declare function hasUpdateComponentsMessage(messages: A2UiMessage[]): boolean;
44
+ //# sourceMappingURL=normalize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../src/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA4B9C,2FAA2F;AAC3F,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQ7D;AAED,gGAAgG;AAChG,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,QAAQ,SAAqB,GAC5B,MAAM,CAQR;AAMD,sFAAsF;AACtF,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIzB;AAiBD,uFAAuF;AACvF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE,CAsGzE;AA2DD,2EAA2E;AAC3E,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAAA;AAEjF,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,aAAa,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;CACd;AA6BD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,QAAQ,EAAE,CA0B7E;AAyGD,wBAAgB,4BAA4B,CAAC,aAAa,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAyChG;AA2BD,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,MAAM,CAEz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