@maxhealth.tech/prefab 0.3.18 → 0.3.19
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/CHANGELOG.md +20 -0
- package/dist/a2ui/browser.js +1 -2
- package/dist/a2ui/browser.js.map +1 -1
- package/dist/a2ui/expr.d.ts +7 -54
- package/dist/a2ui/expr.d.ts.map +1 -1
- package/dist/a2ui/expr.js +13 -90
- package/dist/a2ui/expr.js.map +1 -1
- package/dist/a2ui/icons.d.ts +3 -25
- package/dist/a2ui/icons.d.ts.map +1 -1
- package/dist/a2ui/icons.js +4 -33
- package/dist/a2ui/icons.js.map +1 -1
- package/dist/a2ui/types.d.ts +7 -54
- package/dist/a2ui/types.d.ts.map +1 -1
- package/dist/a2ui/types.js +2 -21
- package/dist/a2ui/types.js.map +1 -1
- package/dist/a2ui.min.js +1 -1
- package/dist/actions/subscribe.d.ts +3 -18
- package/dist/actions/subscribe.d.ts.map +1 -1
- package/dist/actions/subscribe.js +2 -17
- package/dist/actions/subscribe.js.map +1 -1
- package/dist/components/pdf/index.d.ts +3 -9
- package/dist/components/pdf/index.d.ts.map +1 -1
- package/dist/components/pdf/index.js +2 -8
- package/dist/components/pdf/index.js.map +1 -1
- package/dist/core/escape.d.ts +1 -19
- package/dist/core/escape.d.ts.map +1 -1
- package/dist/core/escape.js +1 -19
- package/dist/core/escape.js.map +1 -1
- package/dist/core/humanize.d.ts +2 -17
- package/dist/core/humanize.d.ts.map +1 -1
- package/dist/core/humanize.js +8 -20
- package/dist/core/humanize.js.map +1 -1
- package/dist/core/logger.d.ts +1 -9
- package/dist/core/logger.d.ts.map +1 -1
- package/dist/core/logger.js +1 -9
- package/dist/core/logger.js.map +1 -1
- package/dist/core/stringify.d.ts +2 -19
- package/dist/core/stringify.d.ts.map +1 -1
- package/dist/core/stringify.js +3 -21
- package/dist/core/stringify.js.map +1 -1
- package/dist/core/validate.d.ts.map +1 -1
- package/dist/core/validate.js +23 -26
- package/dist/core/validate.js.map +1 -1
- package/dist/core/version.d.ts +3 -22
- package/dist/core/version.d.ts.map +1 -1
- package/dist/core/version.js +3 -22
- package/dist/core/version.js.map +1 -1
- package/dist/mcp/a2ui.d.ts +6 -36
- package/dist/mcp/a2ui.d.ts.map +1 -1
- package/dist/mcp/a2ui.js +6 -36
- package/dist/mcp/a2ui.js.map +1 -1
- package/dist/mcp/input-required.d.ts.map +1 -1
- package/dist/mcp/input-required.js +2 -8
- package/dist/mcp/input-required.js.map +1 -1
- package/dist/mcp/resource.d.ts +12 -88
- package/dist/mcp/resource.d.ts.map +1 -1
- package/dist/mcp/resource.js +18 -85
- package/dist/mcp/resource.js.map +1 -1
- package/dist/mcp/result.d.ts +2 -27
- package/dist/mcp/result.d.ts.map +1 -1
- package/dist/mcp/result.js +2 -27
- package/dist/mcp/result.js.map +1 -1
- package/dist/mcp/theme-bridge.d.ts +5 -36
- package/dist/mcp/theme-bridge.d.ts.map +1 -1
- package/dist/mcp/theme-bridge.js +6 -43
- package/dist/mcp/theme-bridge.js.map +1 -1
- package/dist/mcp/types.d.ts +11 -106
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/mcp/types.js +2 -22
- package/dist/mcp/types.js.map +1 -1
- package/dist/renderer/actions.d.ts +2 -2
- package/dist/renderer/actions.d.ts.map +1 -1
- package/dist/renderer/actions.js +6 -2
- package/dist/renderer/actions.js.map +1 -1
- package/dist/renderer/app.d.ts.map +1 -1
- package/dist/renderer/app.js +3 -2
- package/dist/renderer/app.js.map +1 -1
- package/dist/renderer/auto.js +9 -4
- package/dist/renderer/auto.js.map +1 -1
- package/dist/renderer/bridge.d.ts +3 -7
- package/dist/renderer/bridge.d.ts.map +1 -1
- package/dist/renderer/bridge.js +38 -64
- package/dist/renderer/bridge.js.map +1 -1
- package/dist/renderer/components/alert.d.ts.map +1 -1
- package/dist/renderer/components/alert.js +4 -2
- package/dist/renderer/components/alert.js.map +1 -1
- package/dist/renderer/components/choice.d.ts.map +1 -1
- package/dist/renderer/components/choice.js +5 -4
- package/dist/renderer/components/choice.js.map +1 -1
- package/dist/renderer/components/control.d.ts.map +1 -1
- package/dist/renderer/components/control.js +16 -9
- package/dist/renderer/components/control.js.map +1 -1
- package/dist/renderer/components/data.d.ts.map +1 -1
- package/dist/renderer/components/data.js +17 -15
- package/dist/renderer/components/data.js.map +1 -1
- package/dist/renderer/components/form.d.ts.map +1 -1
- package/dist/renderer/components/form.js +18 -17
- package/dist/renderer/components/form.js.map +1 -1
- package/dist/renderer/components/interactive.d.ts.map +1 -1
- package/dist/renderer/components/interactive.js +3 -2
- package/dist/renderer/components/interactive.js.map +1 -1
- package/dist/renderer/components/media.d.ts.map +1 -1
- package/dist/renderer/components/media.js +13 -10
- package/dist/renderer/components/media.js.map +1 -1
- package/dist/renderer/components/pdf.d.ts +1 -10
- package/dist/renderer/components/pdf.d.ts.map +1 -1
- package/dist/renderer/components/pdf.js +19 -14
- package/dist/renderer/components/pdf.js.map +1 -1
- package/dist/renderer/components/table.js +2 -2
- package/dist/renderer/components/table.js.map +1 -1
- package/dist/renderer/components/typography.d.ts.map +1 -1
- package/dist/renderer/components/typography.js +4 -2
- package/dist/renderer/components/typography.js.map +1 -1
- package/dist/renderer/engine.d.ts.map +1 -1
- package/dist/renderer/engine.js +5 -6
- package/dist/renderer/engine.js.map +1 -1
- package/dist/renderer/host-context.d.ts +8 -0
- package/dist/renderer/host-context.d.ts.map +1 -0
- package/dist/renderer/host-context.js +62 -0
- package/dist/renderer/host-context.js.map +1 -0
- package/dist/renderer/index.d.ts.map +1 -1
- package/dist/renderer/index.js +20 -20
- package/dist/renderer/index.js.map +1 -1
- package/dist/renderer/rx.d.ts.map +1 -1
- package/dist/renderer/rx.js +17 -24
- package/dist/renderer/rx.js.map +1 -1
- package/dist/renderer/state.d.ts.map +1 -1
- package/dist/renderer/state.js +10 -4
- package/dist/renderer/state.js.map +1 -1
- package/dist/renderer.auto.min.js +10 -10
- package/dist/renderer.min.js +10 -10
- package/dist/rx/pipes.d.ts +3 -19
- package/dist/rx/pipes.d.ts.map +1 -1
- package/dist/rx/pipes.js +3 -19
- package/dist/rx/pipes.js.map +1 -1
- package/dist/rx/signal.d.ts +3 -13
- package/dist/rx/signal.d.ts.map +1 -1
- package/dist/rx/signal.js +2 -9
- package/dist/rx/signal.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,26 @@ All notable changes to this project will be documented in this file.
|
|
|
6
6
|
|
|
7
7
|
<!-- Add new entries directly below. Keep this line: it makes a release merge conflict rather than file them under a published version. -->
|
|
8
8
|
|
|
9
|
+
## [0.3.19] — 2026-11-01
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **`registerViewerResource` allows every origin the viewer loads from.** Script origins went into the CSP `resourceDomains`, but `stylesheets` and a custom `cdnBase` did not, so a host enforcing the CSP blocked the extra stylesheets and, with `cdnBase`, the renderer itself.
|
|
14
|
+
- **`Subscribe`'s `onError` runs when the host refuses the push subscription.** A rejected or timed-out `resources/subscribe` was dropped as an unhandled rejection and the view waited forever. `onError` now runs and the same `Subscribe` can be dispatched again. `McpTransport.subscribe` and `Bridge.subscribe` take an optional `onError` for this.
|
|
15
|
+
- **`popState` resolves a template `index`** the way `setState` resolves its `value`, so `pop(items, '{{ $index }}')` inside a `ForEach` removes that row instead of nothing.
|
|
16
|
+
- **`humanizeKey` gives camelCase keys the same sentence-case label as snake_case**: `firstName` is now `First name` (was `First Name`), and acronyms stay whole (`userID` is `User ID`, was `User I D`). Elicitation schema titles from `formSchema` used a separate Title Case copy and now share it, so they match the `autoForm` labels.
|
|
17
|
+
- **The `date`, `time` and `datetime` pipes leave a value that is not a date unchanged** instead of rendering `Invalid Date`.
|
|
18
|
+
- **A `DataTable` with `rowKey` and `selected` renders `null` rows** instead of throwing.
|
|
19
|
+
- **The bridge ignores foreign `postMessage` traffic without a `type`** (strings, browser-extension messages) instead of throwing in its message listener.
|
|
20
|
+
- **Host themes keep only values the renderer can apply**: an unknown `theme` color scheme and non-string CSS variables are dropped, and `availableDisplayModes` is filtered to known modes.
|
|
21
|
+
- **`PdfViewer` reads `page`, `height` and numeric `zoom` given as numeric strings**, and falls back to its defaults for anything else instead of writing an invalid height.
|
|
22
|
+
- **Docs that promised more than the code does**: `PdfViewer` has no text layer and no zoom control in its toolbar, and `signal(..., { urlSync })` is stored for app code but not synced to the address bar by the renderer.
|
|
23
|
+
|
|
24
|
+
### Internal
|
|
25
|
+
|
|
26
|
+
- Renderer components, the bridge handshake, `validateWireFormat` and the pipe implementations narrow wire values with `src/core/guards.ts` instead of `as` casts.
|
|
27
|
+
- Long explanatory comments across `src/mcp`, `src/a2ui`, `src/core` and `src/rx` are cut to one or two lines.
|
|
28
|
+
|
|
9
29
|
## [0.3.18] — 2026-10-29
|
|
10
30
|
|
|
11
31
|
### Fixed
|
package/dist/a2ui/browser.js
CHANGED
package/dist/a2ui/browser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/a2ui/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,QAAQ,EAA6C,MAAM,WAAW,CAAA;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAE5C,OAAO,EACL,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,YAAY,GAGb,MAAM,YAAY,CAAA;AAEnB;;;;;;GAMG;AACH,SAAS,IAAI,CAAC,IAAa,EAAE,OAAyB;IACpD,IAAI,IAAI,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC,EAAE,CAAC;QAClE,MAAM,IAAI,SAAS,CAAC,2DAA2D,CAAC,CAAA;IAClF,CAAC;IACD,OAAO,QAAQ,CAAC,IAAwB,EA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X,OAAO;IACP,YAAY;IACZ,kBAAkB;IAClB,SAAS;IACT,WAAW;CACZ,CAAA;AAED,eAAe,UAAU,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAA;AAEzB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IAClC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,UAAU,EAAE,CAAC,CAAA;AACvC,CAAC"}
|
package/dist/a2ui/expr.d.ts
CHANGED
|
@@ -1,44 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `{{ }}`
|
|
3
|
-
*
|
|
4
|
-
* `$prefab` interpolates arbitrary expressions client-side. A2UI binds values
|
|
5
|
-
* through JSON Pointers and, for text that mixes literals with values, through
|
|
6
|
-
* the `formatString` catalog function. Between them those cover more than a
|
|
7
|
-
* plain-path conversion would suggest:
|
|
8
|
-
*
|
|
9
|
-
* - `{{ user.name }}` → `{ path: '/user/name' }`
|
|
10
|
-
* - `Hi {{ name }}!` → `{ call: 'formatString', args: { value: 'Hi ${/name}!' } }`
|
|
11
|
-
* - `{{ p | currency:'EUR' }}` → `{ call: 'formatCurrency', args: { … } }`
|
|
12
|
-
* - `{{ count + 1 }}` → nothing; A2UI has no expression language
|
|
13
|
-
*
|
|
14
|
-
* What does not survive is arithmetic, conditionals, and the pipes that
|
|
15
|
-
* transform data rather than format it (see `./pipes.ts`). Those are reported as
|
|
16
|
-
* `expression` diagnostics rather than emitted as a binding that would render an
|
|
17
|
-
* empty string in someone's renderer.
|
|
18
|
-
*
|
|
19
|
-
* ## Scopes
|
|
20
|
-
*
|
|
21
|
-
* A binding is resolved against a {@link BindScope}, which is how names local to
|
|
22
|
-
* a region become pointers. Inside a list template A2UI resolves relative paths
|
|
23
|
-
* against the current item, so prefab's `$item` maps to the empty prefix; inside
|
|
24
|
-
* an inlined definition, a `Use`'s overrides map to wherever the emitter seeded
|
|
25
|
-
* them. Without this, a name that means something local would silently bind to
|
|
26
|
-
* the root of the data model and read whatever happened to be there.
|
|
2
|
+
* `{{ }}` templates as A2UI values: `{{ user.name }}` → `{ path: '/user/name' }`, `Hi {{ name }}!` → `formatString`,
|
|
3
|
+
* `{{ p | currency }}` → `formatCurrency`. Arithmetic, conditionals and data pipes (also inside mixed text) are unbindable.
|
|
27
4
|
*/
|
|
28
5
|
import type { A2uiDataBinding, A2uiDynamicString, A2uiFunctionCall } from './types.js';
|
|
29
|
-
/**
|
|
30
|
-
* Names local to a region, mapped to the pointer they resolve to.
|
|
31
|
-
*
|
|
32
|
-
* An empty-string value means "relative to the current template item", which is
|
|
33
|
-
* how A2UI addresses fields inside a list template.
|
|
34
|
-
*/
|
|
6
|
+
/** Names local to a region (`$item`, a `Use`'s overrides) mapped to their pointer; `''` means relative to the current list item. */
|
|
35
7
|
export type BindScope = Record<string, string>;
|
|
36
|
-
/**
|
|
37
|
-
* Escape one JSON Pointer reference token (RFC 6901 §3).
|
|
38
|
-
*
|
|
39
|
-
* `~` must be escaped before `/`, otherwise the `~1` produced for a slash gets
|
|
40
|
-
* re-escaped into `~01` on the second pass.
|
|
41
|
-
*/
|
|
8
|
+
/** Escape one JSON Pointer token (RFC 6901): `~` before `/`, or the `~1` for a slash becomes `~01`. */
|
|
42
9
|
export declare function escapePointerToken(token: string): string;
|
|
43
10
|
/** Build a JSON Pointer from already-split path segments. */
|
|
44
11
|
export declare function toJsonPointer(segments: string[]): string;
|
|
@@ -54,11 +21,7 @@ export type BindingResult =
|
|
|
54
21
|
kind: 'binding';
|
|
55
22
|
value: A2uiDataBinding;
|
|
56
23
|
}
|
|
57
|
-
/**
|
|
58
|
-
* A value produced by a catalog function: interpolated text, or a pipe that
|
|
59
|
-
* maps onto one of A2UI's formatters. `note` carries anything the mapping
|
|
60
|
-
* cost, for the caller to report.
|
|
61
|
-
*/
|
|
24
|
+
/** Interpolated text or a formatting pipe as a catalog function; `note` is what the mapping cost. */
|
|
62
25
|
| {
|
|
63
26
|
kind: 'format';
|
|
64
27
|
value: A2uiFunctionCall;
|
|
@@ -74,18 +37,8 @@ export type BindingResult =
|
|
|
74
37
|
kind: 'unbindable';
|
|
75
38
|
expression: string;
|
|
76
39
|
};
|
|
77
|
-
/**
|
|
78
|
-
* Convert a prefab string value into an A2UI dynamic value.
|
|
79
|
-
*
|
|
80
|
-
* A whole-string template over a plain path becomes a binding, one over a
|
|
81
|
-
* formatting pipe becomes a catalog-function call, mixed text becomes a
|
|
82
|
-
* `formatString` call, a string with no template passes through, and anything
|
|
83
|
-
* else is unbindable.
|
|
84
|
-
*/
|
|
40
|
+
/** A prefab string as an A2UI dynamic value: binding, catalog-function call, `formatString`, literal, or unbindable. */
|
|
85
41
|
export declare function toBinding(value: string, scope?: BindScope): BindingResult;
|
|
86
|
-
/**
|
|
87
|
-
* Resolve a value to an `A2uiDynamicString`, or `undefined` when it cannot be
|
|
88
|
-
* expressed. Callers pair this with a diagnostic when it returns `undefined`.
|
|
89
|
-
*/
|
|
42
|
+
/** A value as an `A2uiDynamicString`, or `undefined` (which callers report as a diagnostic). */
|
|
90
43
|
export declare function dynamicString(value: string | undefined, scope?: BindScope): A2uiDynamicString | undefined;
|
|
91
44
|
//# sourceMappingURL=expr.d.ts.map
|
package/dist/a2ui/expr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expr.d.ts","sourceRoot":"","sources":["../../src/a2ui/expr.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"expr.d.ts","sourceRoot":"","sources":["../../src/a2ui/expr.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAoB,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAWxG,oIAAoI;AACpI,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAK9C,uGAAuG;AACvG,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,6DAA6D;AAC7D,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAExD;AA4BD,6EAA6E;AAC7E,MAAM,MAAM,aAAa;AACvB,wCAAwC;AACtC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AACpC,8DAA8D;GAC5D;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,eAAe,CAAA;CAAE;AAC7C,qGAAqG;GACnG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,gBAAgB,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE;AAC5D,+DAA+D;GAC7D;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,gBAAgB,CAAA;CAAE;AAC5C,iFAAiF;GAC/E;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAA;AA+C9C,wHAAwH;AACxH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,SAAc,GAAG,aAAa,CA2B7E;AAED,gGAAgG;AAChG,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,GAAE,SAAc,GAAG,iBAAiB,GAAG,SAAS,CAU7G"}
|
package/dist/a2ui/expr.js
CHANGED
|
@@ -1,50 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `{{ }}`
|
|
3
|
-
*
|
|
4
|
-
* `$prefab` interpolates arbitrary expressions client-side. A2UI binds values
|
|
5
|
-
* through JSON Pointers and, for text that mixes literals with values, through
|
|
6
|
-
* the `formatString` catalog function. Between them those cover more than a
|
|
7
|
-
* plain-path conversion would suggest:
|
|
8
|
-
*
|
|
9
|
-
* - `{{ user.name }}` → `{ path: '/user/name' }`
|
|
10
|
-
* - `Hi {{ name }}!` → `{ call: 'formatString', args: { value: 'Hi ${/name}!' } }`
|
|
11
|
-
* - `{{ p | currency:'EUR' }}` → `{ call: 'formatCurrency', args: { … } }`
|
|
12
|
-
* - `{{ count + 1 }}` → nothing; A2UI has no expression language
|
|
13
|
-
*
|
|
14
|
-
* What does not survive is arithmetic, conditionals, and the pipes that
|
|
15
|
-
* transform data rather than format it (see `./pipes.ts`). Those are reported as
|
|
16
|
-
* `expression` diagnostics rather than emitted as a binding that would render an
|
|
17
|
-
* empty string in someone's renderer.
|
|
18
|
-
*
|
|
19
|
-
* ## Scopes
|
|
20
|
-
*
|
|
21
|
-
* A binding is resolved against a {@link BindScope}, which is how names local to
|
|
22
|
-
* a region become pointers. Inside a list template A2UI resolves relative paths
|
|
23
|
-
* against the current item, so prefab's `$item` maps to the empty prefix; inside
|
|
24
|
-
* an inlined definition, a `Use`'s overrides map to wherever the emitter seeded
|
|
25
|
-
* them. Without this, a name that means something local would silently bind to
|
|
26
|
-
* the root of the data model and read whatever happened to be there.
|
|
2
|
+
* `{{ }}` templates as A2UI values: `{{ user.name }}` → `{ path: '/user/name' }`, `Hi {{ name }}!` → `formatString`,
|
|
3
|
+
* `{{ p | currency }}` → `formatCurrency`. Arithmetic, conditionals and data pipes (also inside mixed text) are unbindable.
|
|
27
4
|
*/
|
|
28
5
|
import { parsePipe, pipeCall } from './pipes.js';
|
|
29
6
|
/** Matches a string that is exactly one `{{ … }}` template and nothing else. */
|
|
30
7
|
const SOLE_TEMPLATE = /^\s*\{\{\s*(.+?)\s*\}\}\s*$/s;
|
|
31
8
|
/** Matches every `{{ … }}` occurrence, for interpolating mixed text. */
|
|
32
9
|
const EVERY_TEMPLATE = /\{\{\s*(.+?)\s*\}\}/g;
|
|
33
|
-
/**
|
|
34
|
-
* A plain member path: `user.name`, `items.0.label`, `count`, `$item.title`.
|
|
35
|
-
*
|
|
36
|
-
* Deliberately narrow. Anything outside this shape (operators, pipes, calls,
|
|
37
|
-
* ternaries, string literals) has no A2UI equivalent.
|
|
38
|
-
*/
|
|
10
|
+
/** A plain member path (`user.name`, `items.0.label`, `$item.title`); anything richer has no A2UI equivalent. */
|
|
39
11
|
const PLAIN_PATH = /^\$?[A-Za-z_][\w$]*(?:\.(?:[A-Za-z_$][\w$]*|\d+))*$/;
|
|
40
12
|
/** prefab's loop index. A2UI exposes the same thing as a system function. */
|
|
41
13
|
const LOOP_INDEX = '$index';
|
|
42
|
-
/**
|
|
43
|
-
* Escape one JSON Pointer reference token (RFC 6901 §3).
|
|
44
|
-
*
|
|
45
|
-
* `~` must be escaped before `/`, otherwise the `~1` produced for a slash gets
|
|
46
|
-
* re-escaped into `~01` on the second pass.
|
|
47
|
-
*/
|
|
14
|
+
/** Escape one JSON Pointer token (RFC 6901): `~` before `/`, or the `~1` for a slash becomes `~01`. */
|
|
48
15
|
export function escapePointerToken(token) {
|
|
49
16
|
return token.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
50
17
|
}
|
|
@@ -52,58 +19,34 @@ export function escapePointerToken(token) {
|
|
|
52
19
|
export function toJsonPointer(segments) {
|
|
53
20
|
return '/' + segments.map(escapePointerToken).join('/');
|
|
54
21
|
}
|
|
55
|
-
/**
|
|
56
|
-
* prefab state expressions address state keys directly (`count`), but actions
|
|
57
|
-
* and docs also spell the same key as `state.count`. Both mean the root of the
|
|
58
|
-
* data model, so the prefix is stripped before the pointer is built.
|
|
59
|
-
*/
|
|
22
|
+
/** `state.count` and `count` both address the data-model root. */
|
|
60
23
|
function stripStatePrefix(path) {
|
|
61
24
|
return path.startsWith('state.') ? path.slice('state.'.length) : path;
|
|
62
25
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Resolve a member path to a JSON Pointer under `scope`.
|
|
65
|
-
*
|
|
66
|
-
* A leading segment named in the scope is replaced by its prefix; everything
|
|
67
|
-
* else resolves from the data-model root.
|
|
68
|
-
*/
|
|
26
|
+
/** A member path as a JSON Pointer: a leading scoped name takes its prefix, anything else resolves from the root. */
|
|
69
27
|
function pathToPointer(expr, scope) {
|
|
70
28
|
if (!PLAIN_PATH.test(expr))
|
|
71
29
|
return undefined;
|
|
72
30
|
const segments = stripStatePrefix(expr).split('.');
|
|
73
31
|
const head = segments[0];
|
|
74
|
-
// `hasOwn` rather than a truthiness check: '' is a meaningful prefix, meaning
|
|
75
|
-
// "relative to the current template item".
|
|
76
32
|
const prefix = Object.hasOwn(scope, head) ? scope[head] : undefined;
|
|
77
33
|
if (prefix === undefined) {
|
|
78
|
-
//
|
|
79
|
-
// $result). Outside a scope that defines it, there is nothing to point at.
|
|
34
|
+
// $event, $error, $result: runtime-only names with nothing to point at.
|
|
80
35
|
if (head.startsWith('$'))
|
|
81
36
|
return undefined;
|
|
82
37
|
return toJsonPointer(segments);
|
|
83
38
|
}
|
|
84
39
|
const rest = segments.slice(1);
|
|
85
40
|
if (prefix === '') {
|
|
86
|
-
// Relative to the current template item. `{{ $item }}` alone has no field to
|
|
87
|
-
// address, so it cannot become a pointer.
|
|
88
41
|
return rest.length === 0 ? undefined : rest.map(escapePointerToken).join('/');
|
|
89
42
|
}
|
|
90
43
|
return rest.length === 0 ? prefix : `${prefix}/${rest.map(escapePointerToken).join('/')}`;
|
|
91
44
|
}
|
|
92
|
-
/**
|
|
93
|
-
* Escape a literal segment for a `formatString` template.
|
|
94
|
-
*
|
|
95
|
-
* `${` is the interpolation opener, so a literal one has to be escaped or the
|
|
96
|
-
* renderer reads the surrounding text as an expression.
|
|
97
|
-
*/
|
|
45
|
+
/** Escape a literal `${` so `formatString` does not read it as an interpolation. */
|
|
98
46
|
function escapeFormatLiteral(text) {
|
|
99
47
|
return text.replace(/\$\{/g, '\\${');
|
|
100
48
|
}
|
|
101
|
-
/**
|
|
102
|
-
* Convert mixed literal and template text into a `formatString` call.
|
|
103
|
-
*
|
|
104
|
-
* @returns `undefined` when any embedded expression is richer than a path, in
|
|
105
|
-
* which case the whole string is unbindable rather than partly interpolated.
|
|
106
|
-
*/
|
|
49
|
+
/** Mixed text as a `formatString` call, or `undefined` when any embedded expression is richer than a path. */
|
|
107
50
|
function toFormatString(value, scope) {
|
|
108
51
|
let failed;
|
|
109
52
|
let interpolated = '';
|
|
@@ -124,12 +67,7 @@ function toFormatString(value, scope) {
|
|
|
124
67
|
interpolated += escapeFormatLiteral(value.slice(cursor));
|
|
125
68
|
return { call: 'formatString', args: { value: interpolated } };
|
|
126
69
|
}
|
|
127
|
-
/**
|
|
128
|
-
* Resolve a piped expression to a catalog-function call.
|
|
129
|
-
*
|
|
130
|
-
* The base must itself be a plain path or a literal, since A2UI function
|
|
131
|
-
* arguments take a value rather than an expression to evaluate.
|
|
132
|
-
*/
|
|
70
|
+
/** A piped expression as a catalog-function call; its base must be a plain path or a number literal. */
|
|
133
71
|
function toPipeCall(expr, scope) {
|
|
134
72
|
const pipe = parsePipe(expr);
|
|
135
73
|
if (pipe == null)
|
|
@@ -145,20 +83,10 @@ function toPipeCall(expr, scope) {
|
|
|
145
83
|
return undefined;
|
|
146
84
|
return { kind: 'format', value: mapped.call, ...(mapped.note != null && { note: mapped.note }) };
|
|
147
85
|
}
|
|
148
|
-
/**
|
|
149
|
-
* Convert a prefab string value into an A2UI dynamic value.
|
|
150
|
-
*
|
|
151
|
-
* A whole-string template over a plain path becomes a binding, one over a
|
|
152
|
-
* formatting pipe becomes a catalog-function call, mixed text becomes a
|
|
153
|
-
* `formatString` call, a string with no template passes through, and anything
|
|
154
|
-
* else is unbindable.
|
|
155
|
-
*/
|
|
86
|
+
/** A prefab string as an A2UI dynamic value: binding, catalog-function call, `formatString`, literal, or unbindable. */
|
|
156
87
|
export function toBinding(value, scope = {}) {
|
|
157
88
|
const sole = SOLE_TEMPLATE.exec(value);
|
|
158
|
-
// The
|
|
159
|
-
// matches as one template whose body is `a }} of {{ b`. Rejecting a capture
|
|
160
|
-
// that contains delimiters sends those strings down the interpolation path,
|
|
161
|
-
// which is where they belong.
|
|
89
|
+
// The lazy capture still spans `{{ a }} of {{ b }}`; such strings belong to the interpolation path.
|
|
162
90
|
const isSole = sole != null && !sole[1].includes('{{') && !sole[1].includes('}}');
|
|
163
91
|
if (isSole) {
|
|
164
92
|
const expr = sole[1].trim();
|
|
@@ -168,8 +96,6 @@ export function toBinding(value, scope = {}) {
|
|
|
168
96
|
const pointer = pathToPointer(expr, scope);
|
|
169
97
|
if (pointer != null)
|
|
170
98
|
return { kind: 'binding', value: { path: pointer } };
|
|
171
|
-
// A pipe is not part of A2UI's expression language, but the common
|
|
172
|
-
// formatting ones exist in its catalog as functions.
|
|
173
99
|
const piped = toPipeCall(expr, scope);
|
|
174
100
|
if (piped != null)
|
|
175
101
|
return piped;
|
|
@@ -182,10 +108,7 @@ export function toBinding(value, scope = {}) {
|
|
|
182
108
|
return { kind: 'format', value: format };
|
|
183
109
|
return { kind: 'unbindable', expression: value };
|
|
184
110
|
}
|
|
185
|
-
/**
|
|
186
|
-
* Resolve a value to an `A2uiDynamicString`, or `undefined` when it cannot be
|
|
187
|
-
* expressed. Callers pair this with a diagnostic when it returns `undefined`.
|
|
188
|
-
*/
|
|
111
|
+
/** A value as an `A2uiDynamicString`, or `undefined` (which callers report as a diagnostic). */
|
|
189
112
|
export function dynamicString(value, scope = {}) {
|
|
190
113
|
if (value == null)
|
|
191
114
|
return undefined;
|
package/dist/a2ui/expr.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expr.js","sourceRoot":"","sources":["../../src/a2ui/expr.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"expr.js","sourceRoot":"","sources":["../../src/a2ui/expr.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAGhD,gFAAgF;AAChF,MAAM,aAAa,GAAG,8BAA8B,CAAA;AAEpD,wEAAwE;AACxE,MAAM,cAAc,GAAG,sBAAsB,CAAA;AAE7C,iHAAiH;AACjH,MAAM,UAAU,GAAG,qDAAqD,CAAA;AAKxE,6EAA6E;AAC7E,MAAM,UAAU,GAAG,QAAQ,C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AAU,EAAE,KAAK,EAAE,CAAA;AAClD,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,aAAa,CAAC,KAAyB,EAAE,QAAmB,EAAE;IAC5E,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO,SAAS,CAAA;IACnC,MAAM,CAAC,GAAG,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IACjC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QACf,KAAK,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAA;QAC9B,KAAK,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAA;QAC9B,KAAK,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAA;QAC7B,KAAK,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAA;QAC5B,OAAO,CAAC,CAAC,OAAO,SAAS,CAAA;IAC3B,CAAC;AACH,CAAC"}
|
package/dist/a2ui/icons.d.ts
CHANGED
|
@@ -1,30 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* The one place where the two catalogs disagree on *values* rather than on
|
|
5
|
-
* component shape. prefab's `Icon(name)` takes any string, because its renderer
|
|
6
|
-
* resolves Lucide names at runtime and new icons cost nothing. A2UI's
|
|
7
|
-
* `Icon.name` is a closed enum of 59 names, so an unrecognised value does not
|
|
8
|
-
* render as a fallback glyph — it makes the whole component fail validation.
|
|
9
|
-
*
|
|
10
|
-
* Passing the name through unchecked therefore emits an invalid surface for
|
|
11
|
-
* every icon outside those 59, which is most of them. Instead the name is
|
|
12
|
-
* normalised, matched against the enum, and dropped with a diagnostic when
|
|
13
|
-
* nothing fits, so an unmappable icon costs a glyph rather than the payload.
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
* The A2UI Basic catalog's `Icon.name` enum, v1.0.
|
|
17
|
-
*
|
|
18
|
-
* Duplicated as a literal because prefab ships zero runtime dependencies and
|
|
19
|
-
* cannot read the catalog JSON at emit time. `test/a2ui-icons.test.ts` asserts
|
|
20
|
-
* this matches the vendored catalog exactly, so it cannot drift silently.
|
|
2
|
+
* The A2UI Basic catalog's closed `Icon.name` enum (v1.0); an unknown name fails the whole component's validation.
|
|
3
|
+
* `test/a2ui-icons.test.ts` keeps this literal equal to the vendored catalog.
|
|
21
4
|
*/
|
|
22
5
|
export declare const A2UI_ICONS: readonly string[];
|
|
23
|
-
/**
|
|
24
|
-
* Resolve a prefab icon name to an A2UI one.
|
|
25
|
-
*
|
|
26
|
-
* @returns the catalog name, or `undefined` when nothing in the enum means the
|
|
27
|
-
* same thing. Callers drop the icon and record a diagnostic.
|
|
28
|
-
*/
|
|
6
|
+
/** A prefab icon name as an A2UI one, or `undefined` (callers drop the icon with a diagnostic). */
|
|
29
7
|
export declare function a2uiIconName(name: string): string | undefined;
|
|
30
8
|
//# sourceMappingURL=icons.d.ts.map
|
package/dist/a2ui/icons.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/a2ui/icons.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/a2ui/icons.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,MAAM,EAUvC,CAAA;AA0CD,mGAAmG;AACnG,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG7D"}
|
package/dist/a2ui/icons.js
CHANGED
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* The one place where the two catalogs disagree on *values* rather than on
|
|
5
|
-
* component shape. prefab's `Icon(name)` takes any string, because its renderer
|
|
6
|
-
* resolves Lucide names at runtime and new icons cost nothing. A2UI's
|
|
7
|
-
* `Icon.name` is a closed enum of 59 names, so an unrecognised value does not
|
|
8
|
-
* render as a fallback glyph — it makes the whole component fail validation.
|
|
9
|
-
*
|
|
10
|
-
* Passing the name through unchecked therefore emits an invalid surface for
|
|
11
|
-
* every icon outside those 59, which is most of them. Instead the name is
|
|
12
|
-
* normalised, matched against the enum, and dropped with a diagnostic when
|
|
13
|
-
* nothing fits, so an unmappable icon costs a glyph rather than the payload.
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
* The A2UI Basic catalog's `Icon.name` enum, v1.0.
|
|
17
|
-
*
|
|
18
|
-
* Duplicated as a literal because prefab ships zero runtime dependencies and
|
|
19
|
-
* cannot read the catalog JSON at emit time. `test/a2ui-icons.test.ts` asserts
|
|
20
|
-
* this matches the vendored catalog exactly, so it cannot drift silently.
|
|
2
|
+
* The A2UI Basic catalog's closed `Icon.name` enum (v1.0); an unknown name fails the whole component's validation.
|
|
3
|
+
* `test/a2ui-icons.test.ts` keeps this literal equal to the vendored catalog.
|
|
21
4
|
*/
|
|
22
5
|
export const A2UI_ICONS = [
|
|
23
6
|
'accountCircle', 'add', 'arrowBack', 'arrowForward', 'attachFile', 'calendarToday',
|
|
@@ -32,14 +15,7 @@ export const A2UI_ICONS = [
|
|
|
32
15
|
];
|
|
33
16
|
/** Lookup by normalised form, so `Arrow-Back`, `arrow_back` and `ArrowBack` all hit. */
|
|
34
17
|
const BY_NORMALISED = new Map(A2UI_ICONS.map(name => [normalise(name), name]));
|
|
35
|
-
/**
|
|
36
|
-
* Names that differ between the two vocabularies rather than merely in case.
|
|
37
|
-
*
|
|
38
|
-
* prefab follows Lucide, A2UI follows Material. Where the concept exists in both
|
|
39
|
-
* under different words, the alias keeps the icon; where it does not, the entry
|
|
40
|
-
* is absent and the icon is dropped rather than mapped to something that means
|
|
41
|
-
* something else. Keys are normalised, so one entry covers every spelling.
|
|
42
|
-
*/
|
|
18
|
+
/** Lucide names whose Material counterpart is spelled differently, keyed by normalised name. */
|
|
43
19
|
const ALIASES = {
|
|
44
20
|
// Status and feedback
|
|
45
21
|
alertcircle: 'error', alerttriangle: 'warning', alertoctagon: 'error',
|
|
@@ -74,12 +50,7 @@ const ALIASES = {
|
|
|
74
50
|
function normalise(name) {
|
|
75
51
|
return name.replace(/[\s._-]/g, '').toLowerCase();
|
|
76
52
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Resolve a prefab icon name to an A2UI one.
|
|
79
|
-
*
|
|
80
|
-
* @returns the catalog name, or `undefined` when nothing in the enum means the
|
|
81
|
-
* same thing. Callers drop the icon and record a diagnostic.
|
|
82
|
-
*/
|
|
53
|
+
/** A prefab icon name as an A2UI one, or `undefined` (callers drop the icon with a diagnostic). */
|
|
83
54
|
export function a2uiIconName(name) {
|
|
84
55
|
const key = normalise(name);
|
|
85
56
|
return BY_NORMALISED.get(key) ?? ALIASES[key];
|
package/dist/a2ui/icons.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/a2ui/icons.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/a2ui/icons.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAsB;IAC3C,eAAe,EAAE,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe;IAClF,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAClF,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAC1E,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW;IACzE,kBAAkB,EAAE,eAAe,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO;IACnF,MAAM,EAAE,OAAO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;IAC3B,OAAO,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC"}
|
package/dist/a2ui/types.d.ts
CHANGED
|
@@ -1,25 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A2UI v1.0 wire types.
|
|
3
|
-
*
|
|
4
|
-
* A2UI (`a2ui.org`) is the declarative agent-to-UI protocol: the agent streams
|
|
5
|
-
* JSON describing a component tree plus a data model, and the renderer maps the
|
|
6
|
-
* abstract component names onto its own widgets. prefab emits it as a second
|
|
7
|
-
* output target alongside the `$prefab` wire format.
|
|
8
|
-
*
|
|
9
|
-
* Two structural differences drive the whole emitter:
|
|
10
|
-
*
|
|
11
|
-
* 1. **Flat, not nested.** A2UI components live in an adjacency list — every
|
|
12
|
-
* component carries an `id`, and parents reference children by id rather
|
|
13
|
-
* than embedding them. `$prefab` nests `children` directly.
|
|
14
|
-
* 2. **Bound, not interpolated.** A2UI reads dynamic values through JSON
|
|
15
|
-
* Pointer `{ path }` bindings into the data model. `$prefab` interpolates
|
|
16
|
-
* `{{ expr }}` templates, which is strictly more expressive, so only the
|
|
17
|
-
* plain-path subset survives the crossing (see `./expr.ts`).
|
|
18
|
-
*
|
|
19
|
-
* Mirrors `specification/v1_0/json/agent_to_renderer.json` and
|
|
20
|
-
* `catalogs/basic/catalog.json` from a2ui-project/a2ui (Apache-2.0). Only the
|
|
21
|
-
* agent-to-renderer direction is modelled: prefab produces UI, it does not
|
|
22
|
-
* consume renderer events.
|
|
2
|
+
* A2UI v1.0 agent-to-renderer wire types (a2ui-project/a2ui, Apache-2.0): a flat, id-linked component list whose
|
|
3
|
+
* values bind through JSON Pointers, where `$prefab` nests children and interpolates `{{ }}`.
|
|
23
4
|
*/
|
|
24
5
|
/** Protocol version stamped on every emitted message. */
|
|
25
6
|
export declare const A2UI_VERSION = "v1.0";
|
|
@@ -35,13 +16,7 @@ export declare const A2UI_ROOT_ID = "root";
|
|
|
35
16
|
export interface A2uiDataBinding {
|
|
36
17
|
path: string;
|
|
37
18
|
}
|
|
38
|
-
/**
|
|
39
|
-
* A call to a catalog function, used for formatting and validation.
|
|
40
|
-
*
|
|
41
|
-
* The function name lives under `call`, and the object IS the call — it is not
|
|
42
|
-
* wrapped in a `functionCall` key. That wrapper appears only where a function
|
|
43
|
-
* stands in for an {@link A2uiAction}.
|
|
44
|
-
*/
|
|
19
|
+
/** A catalog function call, unwrapped; the `functionCall` wrapper exists only inside an {@link A2uiAction}. */
|
|
45
20
|
export interface A2uiFunctionCall {
|
|
46
21
|
call: string;
|
|
47
22
|
catalogId?: string;
|
|
@@ -70,13 +45,7 @@ export interface A2uiAccessibility {
|
|
|
70
45
|
description?: A2uiDynamicString;
|
|
71
46
|
live?: 'off' | 'polite' | 'assertive';
|
|
72
47
|
}
|
|
73
|
-
/**
|
|
74
|
-
* One entry in a surface's adjacency list.
|
|
75
|
-
*
|
|
76
|
-
* The index signature carries catalog-specific props (`text`, `url`, `options`,
|
|
77
|
-
* …) that vary per component, which is how the catalog stays open to component
|
|
78
|
-
* sets beyond Basic without a type per component.
|
|
79
|
-
*/
|
|
48
|
+
/** One entry in a surface's component list; catalog-specific props ride the index signature. */
|
|
80
49
|
export interface A2uiComponentProps {
|
|
81
50
|
component: string;
|
|
82
51
|
catalogId?: string;
|
|
@@ -86,12 +55,7 @@ export interface A2uiComponentProps {
|
|
|
86
55
|
};
|
|
87
56
|
[prop: string]: unknown;
|
|
88
57
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Split from {@link A2uiComponentProps} by extension rather than by
|
|
91
|
-
* `Omit<A2uiComponent, 'id'>`. `Omit` resolves `keyof` to `string | number`
|
|
92
|
-
* on a type carrying an index signature, which erases every named property, so
|
|
93
|
-
* the omitted form would no longer be known to supply `component`.
|
|
94
|
-
*/
|
|
58
|
+
/** Extends {@link A2uiComponentProps} because `Omit` over an index signature erases the named properties. */
|
|
95
59
|
export interface A2uiComponent extends A2uiComponentProps {
|
|
96
60
|
id: string;
|
|
97
61
|
}
|
|
@@ -125,14 +89,7 @@ export interface A2uiUpdateDataModel {
|
|
|
125
89
|
export interface A2uiDeleteSurface {
|
|
126
90
|
surfaceId: string;
|
|
127
91
|
}
|
|
128
|
-
/**
|
|
129
|
-
* One agent-to-renderer message.
|
|
130
|
-
*
|
|
131
|
-
* A type alias rather than an interface so it keeps an implicit index
|
|
132
|
-
* signature: these land in `structuredContent`, which the MCP SDK types as
|
|
133
|
-
* `{ [x: string]: unknown }`, and TypeScript grants that signature to object
|
|
134
|
-
* aliases but never to interfaces. Same reasoning as `src/mcp/types.ts`.
|
|
135
|
-
*/
|
|
92
|
+
/** One agent-to-renderer message; a type alias so it fits `structuredContent` (see `src/mcp/types.ts`). */
|
|
136
93
|
export type A2uiMessage = {
|
|
137
94
|
version: string;
|
|
138
95
|
createSurface: A2uiCreateSurface;
|
|
@@ -146,11 +103,7 @@ export type A2uiMessage = {
|
|
|
146
103
|
version: string;
|
|
147
104
|
deleteSurface: A2uiDeleteSurface;
|
|
148
105
|
};
|
|
149
|
-
/**
|
|
150
|
-
* The list-wrapper envelope, for transports that need a top-level JSON object
|
|
151
|
-
* rather than a bare array. This is what prefab writes into an MCP resource or
|
|
152
|
-
* an embedded resource, per `agent_to_renderer_list_wrapper.json`.
|
|
153
|
-
*/
|
|
106
|
+
/** The `{ messages }` envelope prefab writes into MCP resources, per `agent_to_renderer_list_wrapper.json`. */
|
|
154
107
|
export type A2uiMessageList = {
|
|
155
108
|
messages: A2uiMessage[];
|
|
156
109
|
};
|
package/dist/a2ui/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/a2ui/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/a2ui/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,yDAAyD;AACzD,eAAO,MAAM,YAAY,SAA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7E,KAAK,EAAE,OAAO,CAAA;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,2GAA2G;AAC3G,MAAM,MAAM,WAAW,GACnB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,iBAAiB,CAAA;CAAE,GACrD;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,oBAAoB,CAAA;CAAE,GAC3D;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,mBAAmB,CAAA;CAAE,GACzD;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,iBAAiB,CAAA;CAAE,CAAA;AAEzD,+GAA+G;AAE/G,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,WAAW,EAAE,CAAA;CACxB,CAAA;AAID,6DAA6D;AAC7D,MAAM,MAAM,kBAAkB;AAC5B,yFAAyF;AACvF,UAAU;AACZ,4DAA4D;GAC1D,aAAa;AACf,oFAAoF;GAClF,YAAY;AACd,0DAA0D;GACxD,QAAQ,CAAA;AAEZ,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,kBAAkB,CAAA;IACxB,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAA;IACf,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAA;CACf"}
|
package/dist/a2ui/types.js
CHANGED
|
@@ -1,25 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A2UI v1.0 wire types.
|
|
3
|
-
*
|
|
4
|
-
* A2UI (`a2ui.org`) is the declarative agent-to-UI protocol: the agent streams
|
|
5
|
-
* JSON describing a component tree plus a data model, and the renderer maps the
|
|
6
|
-
* abstract component names onto its own widgets. prefab emits it as a second
|
|
7
|
-
* output target alongside the `$prefab` wire format.
|
|
8
|
-
*
|
|
9
|
-
* Two structural differences drive the whole emitter:
|
|
10
|
-
*
|
|
11
|
-
* 1. **Flat, not nested.** A2UI components live in an adjacency list — every
|
|
12
|
-
* component carries an `id`, and parents reference children by id rather
|
|
13
|
-
* than embedding them. `$prefab` nests `children` directly.
|
|
14
|
-
* 2. **Bound, not interpolated.** A2UI reads dynamic values through JSON
|
|
15
|
-
* Pointer `{ path }` bindings into the data model. `$prefab` interpolates
|
|
16
|
-
* `{{ expr }}` templates, which is strictly more expressive, so only the
|
|
17
|
-
* plain-path subset survives the crossing (see `./expr.ts`).
|
|
18
|
-
*
|
|
19
|
-
* Mirrors `specification/v1_0/json/agent_to_renderer.json` and
|
|
20
|
-
* `catalogs/basic/catalog.json` from a2ui-project/a2ui (Apache-2.0). Only the
|
|
21
|
-
* agent-to-renderer direction is modelled: prefab produces UI, it does not
|
|
22
|
-
* consume renderer events.
|
|
2
|
+
* A2UI v1.0 agent-to-renderer wire types (a2ui-project/a2ui, Apache-2.0): a flat, id-linked component list whose
|
|
3
|
+
* values bind through JSON Pointers, where `$prefab` nests children and interpolates `{{ }}`.
|
|
23
4
|
*/
|
|
24
5
|
// ── Constants ────────────────────────────────────────────────────────────────
|
|
25
6
|
/** Protocol version stamped on every emitted message. */
|
package/dist/a2ui/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/a2ui/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/a2ui/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,gFAAgF;AAEhF,yDAAyD;AACzD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAA;AAElC,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG,iEAAiE,CAAA;AAEnG,sDAAsD;AACtD,MAAM,CAAC,MAAM,SAAS,GAAG,uBAAuB,CAAA;AAEhD,qDAAqD;AACrD,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAA;AAEpC,gEAAgE;AAChE,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAA"}
|