@aceshooting/lyra-ui 30.2.0 → 30.4.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/CHANGELOG.md +87 -0
- package/dist/ai/adapters/a2ui.d.ts +10 -4
- package/dist/ai/adapters/a2ui.js +1 -1
- package/dist/ai/adapters/ag-ui.d.ts +17 -4
- package/dist/ai/adapters/ag-ui.js +1 -1
- package/dist/ai/adapters/ai-sdk.js +1 -1
- package/dist/ai/runtime.js +1 -1
- package/dist/components/agent-tools/mcp-app/mcp-app-protocol.d.ts +15 -0
- package/dist/components/agent-tools/mcp-app/mcp-app-protocol.js +36 -0
- package/dist/components/agent-tools/mcp-app/mcp-app.class.d.ts +31 -4
- package/dist/components/agent-tools/mcp-app/mcp-app.class.js +4 -4
- package/dist/components/conversation/chat-viewport/chat-viewport.class.d.ts +2 -2
- package/dist/components/conversation/chat-viewport/chat-viewport.class.js +1 -1
- package/dist/components/conversation/message-actions/message-actions.class.d.ts +3 -3
- package/dist/components/conversation/message-parts/message-parts.class.d.ts +13 -4
- package/dist/components/conversation/message-parts/message-parts.class.js +12 -10
- package/dist/components/conversation/message-parts/message-parts.d.ts +1 -1
- package/dist/components/conversation/message-parts/message-parts.js +1 -1
- package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +1 -1
- package/dist/components/data/flow-minimap/flow-minimap.class.d.ts +1 -1
- package/dist/components/forms/select/select.class.js +1 -1
- package/dist/components/layout/app-rail/app-rail.class.d.ts +1 -1
- package/dist/components/layout/app-rail/app-rail.class.js +1 -1
- package/dist/components/layout/multi-split/multi-split.class.d.ts +4 -1
- package/dist/components/layout/multi-split/multi-split.class.js +6 -3
- package/dist/components/layout/multi-split/multi-split.styles.js +1 -1
- package/dist/components/layout/navigation-menu/navigation-menu.class.js +1 -1
- package/dist/components/layout/page/page.class.d.ts +3 -1
- package/dist/components/layout/page/page.class.js +1 -1
- package/dist/components/layout/responsive-panel/responsive-panel.class.d.ts +6 -4
- package/dist/components/layout/responsive-panel/responsive-panel.class.js +1 -1
- package/dist/components/layout/scroller/scroller.class.d.ts +1 -1
- package/dist/components/layout/scroller/scroller.class.js +1 -1
- package/dist/components/layout/split-panel/split-panel.class.d.ts +1 -1
- package/dist/components/layout/split-panel/split-panel.class.js +1 -1
- package/dist/components/layout/stepper/stepper.class.d.ts +1 -1
- package/dist/components/layout/stepper/stepper.class.js +1 -1
- package/dist/components/layout/widget/widget.class.d.ts +1 -1
- package/dist/components/layout/widget/widget.class.js +1 -1
- package/dist/components/media/file-input/file-input.styles.js +1 -1
- package/dist/components/media/map/map-control-chrome.js +1 -0
- package/dist/components/media/map/map-control-options.d.ts +6 -2
- package/dist/components/media/map/map-control-options.js +1 -1
- package/dist/components/media/map/map-controls-lifecycle.js +1 -1
- package/dist/components/media/map/map-controls-readiness.js +1 -0
- package/dist/components/media/map/map.class.d.ts +39 -2
- package/dist/components/media/map/map.class.js +13 -7
- package/dist/components/media/map/map.styles.js +1 -1
- package/dist/components/overlays/dialog/dialog.class.d.ts +2 -2
- package/dist/components/overlays/dialog/dialog.class.js +1 -1
- package/dist/components/utility/copy-button/copy-button.class.d.ts +13 -15
- package/dist/components/utility/copy-button/copy-button.class.js +3 -3
- package/dist/components/utility/copy-button/copy-button.styles.js +1 -1
- package/dist/components/utility/tour/tour.class.d.ts +2 -2
- package/dist/components/utility/tour/tour.class.js +1 -1
- package/dist/events.d.ts +10 -1
- package/dist/framework-types.d.ts +1 -1
- package/dist/internal/localization-types.d.ts +1 -1
- package/dist/internal/localization.js +1 -1
- package/dist/internal/modal-host.styles.js +1 -0
- package/dist/internal/modal-surface-controller.js +1 -1
- package/dist/internal/overlay-stack.d.ts +1 -1
- package/dist/internal/overlay-stack.js +1 -1
- package/dist/internal/package-metadata.js +1 -1
- package/dist/internal/scoped-definitions.generated.js +1 -1
- package/dist/internal/style-property-lease.js +1 -1
- package/dist/lyra.d.ts +1 -1
- package/llms/components/lr-app-rail.md +4 -0
- package/llms/components/lr-badge.md +3 -0
- package/llms/components/lr-copy-button.md +15 -7
- package/llms/components/lr-file-input.md +5 -0
- package/llms/components/lr-map.md +80 -8
- package/llms/components/lr-mcp-app.md +94 -4
- package/llms/components/lr-message-parts.md +18 -0
- package/llms/components/lr-multi-split.md +4 -0
- package/llms/components/lr-page.md +5 -1
- package/llms/components/lr-responsive-panel.md +5 -1
- package/llms/components/lr-select.md +3 -2
- package/llms/components/lr-token-input.md +4 -3
- package/llms/components/lr-tooltip.md +4 -4
- package/llms/peers.md +1 -1
- package/llms/shared/ai-and-peers.md +88 -3
- package/llms/shared/events-and-types.md +25 -1
- package/llms/shared/localization-and-rtl.md +29 -0
- package/llms/shared/styles-and-tokens.md +75 -14
- package/llms/shared.md +217 -18
- package/locales.json +1 -1
- package/package.json +8 -4
- package/registrations.json +1 -1
- package/skills/compose-lyra-interfaces/SKILL.md +5 -3
- package/skills/compose-lyra-interfaces/references/composition-patterns.md +8 -1
- package/skills/lyra-ui/SKILL.md +17 -8
- package/skills/lyra-ui/lyra-gen.md +95 -0
|
@@ -53,6 +53,10 @@ buttons.
|
|
|
53
53
|
icon-only trigger always remains named; remove the attribute or assign `null` for the same
|
|
54
54
|
fallback.
|
|
55
55
|
- `disabled: boolean = false` (reflected)
|
|
56
|
+
- `size?: LyraSize` (reflected) — optional built-in trigger density on the shared `2xs` through
|
|
57
|
+
`xl` ladder; `small`/`medium`/`large` alias `s`/`m`/`l`. Scales the minimum hit area, glyph font
|
|
58
|
+
and corner radius. Unset preserves the established icon-button footprint and inherited font;
|
|
59
|
+
custom default-slot triggers keep their own geometry.
|
|
56
60
|
- `feedbackDuration: number = 1500` (attribute `feedback-duration`) — milliseconds before the
|
|
57
61
|
confirmation **or** the failure state returns to the copy icon. A non-finite value falls back to
|
|
58
62
|
`1500` rather than leaving the state stuck; a negative one clamps to `0`.
|
|
@@ -188,12 +192,16 @@ import type {
|
|
|
188
192
|
`copyFailed` (`'Copy failed'`), overridable per instance through `.strings` or app-wide through
|
|
189
193
|
`registerLyraLocale()` (see `llms/shared.md`). Explicit `*-label` properties take precedence.
|
|
190
194
|
- Native `dir`/`lang` remain inherited global attributes. The component is not form-associated.
|
|
191
|
-
-
|
|
192
|
-
|
|
193
|
-
`--lr-theme-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
195
|
+
- Use `size="2xs"` or `size="xs"` for dense metadata or action rows. A selected tier follows the
|
|
196
|
+
shared form-control height, font and radius inputs (`--lr-theme-form-control-height-<tier>`,
|
|
197
|
+
`--lr-theme-font-size-*`, `--lr-theme-form-control-radius`); larger icon content still grows the
|
|
198
|
+
trigger beyond its minimum box. The composed icon button retains its coarse-pointer/no-hover
|
|
199
|
+
floor of 2.75rem/44px for every tier. Public `--lr-icon-button-*` paint tokens and
|
|
200
|
+
`::part(base-control)` still reach the native control.
|
|
201
|
+
- With `size` unset, the built-in trigger uses the shared `--lr-icon-button-size` floor
|
|
202
|
+
(2.25rem by default). Ancestor `--lr-icon-button-size-scope` or `--lr-theme-icon-button-size`
|
|
203
|
+
inputs keep working; setting `--lr-icon-button-size` on the copy-button host does not cross the
|
|
204
|
+
composed child's token declaration. Removing `size` or assigning an unsupported value restores
|
|
205
|
+
that established geometry and ancestor override behavior.
|
|
198
206
|
|
|
199
207
|
---
|
|
@@ -27,6 +27,11 @@ removing `label` never changes the dropzone text. Disabled file removal buttons,
|
|
|
27
27
|
including fieldset disablement, retain resting foreground and background under hover and press;
|
|
28
28
|
enabled buttons retain pointer feedback.
|
|
29
29
|
|
|
30
|
+
The auto-sized host includes the label, dropzone, selected files and visible feedback, including
|
|
31
|
+
inside intrinsic grid rows. A definite host height (such as an absolutely positioned full-area
|
|
32
|
+
drop target) gives the dropzone the remaining space after the other field content; leave enough
|
|
33
|
+
height for that content and the dropzone's minimum size.
|
|
34
|
+
|
|
30
35
|
**Properties:**
|
|
31
36
|
|
|
32
37
|
- `multiple: boolean = false` (reflected) — `multiple="false"` reads as false, like
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
- **Release history** [CHANGELOG.md](../../CHANGELOG.md); family-wide breaking-change summaries: [media](https://github.com/aceshooting/lyra-ui/blob/main/packages/lyra-ui/llms/media.md)
|
|
10
10
|
- **Deprecations** none
|
|
11
11
|
- **Optional peers** `@aceshooting/lyra-map`, `dompurify`, `maplibre-gl` — see `llms/peers.md`
|
|
12
|
-
- **Themeable via**
|
|
12
|
+
- **Themeable via** 78 parts, 10 custom properties — see this component's own `@csspart`/`@cssprop` list below
|
|
13
13
|
- **Library-wide behavior** (events, form association, `locale`/`strings`, tokens, TS types): `llms/shared.md`
|
|
14
14
|
|
|
15
15
|
---
|
|
@@ -63,6 +63,15 @@ style, await `whenIdle()` for the current resource and rendering work. Observe
|
|
|
63
63
|
rejection when replacing styles or disconnecting; a returned `true` from a synchronous command
|
|
64
64
|
means admission, not asynchronous completion.
|
|
65
65
|
|
|
66
|
+
`whenControlsReady(): Promise<void>` waits for native control installation and public chrome hooks,
|
|
67
|
+
including default attribution. Await it after `whenStyleReady()` when measuring or styling installed
|
|
68
|
+
controls. Explicitly disabling all controls resolves after map construction. On a connected deferred
|
|
69
|
+
map, it waits for initialization rather than activating the map. Replacing `controls` or disconnecting
|
|
70
|
+
rejects the pending barrier with `AbortError`; initialization, invalid configuration or control
|
|
71
|
+
loading failure rejects with `MapReadinessError`. A style-only change preserves the controls
|
|
72
|
+
barrier. A completed promise describes its captured configuration; call again after assigning
|
|
73
|
+
`controls`.
|
|
74
|
+
|
|
66
75
|
URL `mapStyle` replacements and new objects on the modular peer use `setStyle(style, { diff: false })`.
|
|
67
76
|
Readiness waits for the replacement's committed `style.load` before capturing its catalog and
|
|
68
77
|
restoring owned layers, images and style overrides. Superseding an unfinished replacement also
|
|
@@ -1038,12 +1047,16 @@ intensity?: LyraMapHeatmapZoomValue; opacity?: number }`, where `LyraMapHeatmapZ
|
|
|
1038
1047
|
LyraMapNavigationControlOptions; scale?: boolean | LyraMapScaleControlOptions;
|
|
1039
1048
|
geolocate?: boolean | LyraMapGeolocateControlOptions;
|
|
1040
1049
|
attribution?: boolean | LyraMapAttributionControlOptions }`, with
|
|
1041
|
-
`LyraMapNavigationControlOptions { position?: LyraMapControlPosition }`,
|
|
1042
|
-
`LyraMapScaleControlOptions { position?: LyraMapControlPosition; unit?: LyraMapScaleUnit }`,
|
|
1050
|
+
`LyraMapNavigationControlOptions { position?: LyraMapControlPosition; order?: number }`,
|
|
1051
|
+
`LyraMapScaleControlOptions { position?: LyraMapControlPosition; order?: number; unit?: LyraMapScaleUnit }`,
|
|
1043
1052
|
`LyraMapControlPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'` and
|
|
1044
1053
|
`LyraMapScaleUnit = 'metric' | 'imperial'`. The element adds the engine's standard controls once
|
|
1045
1054
|
the map exists, moves one whose corner changes, replaces one whose other options change and removes one that
|
|
1046
1055
|
is dropped, so an application no longer imports control classes and calls `map.addControl()`.
|
|
1056
|
+
All four control option objects accept finite `order` numbers, defaulting to `0`. Within each
|
|
1057
|
+
corner, ascending order controls both visual and keyboard order; ties retain the existing
|
|
1058
|
+
navigation, scale, geolocate, attribution sequence. Changing only order moves existing controls
|
|
1059
|
+
without reconstructing them. Invalid order values produce localized configuration feedback.
|
|
1047
1060
|
`true` takes the defaults (navigation `'top-right'`, scale `'bottom-left'` and `'metric'`); an
|
|
1048
1061
|
unknown navigation/scale position or unit falls back to its default. Malformed geolocate or
|
|
1049
1062
|
attribution options are rejected with localized feedback. The control code comes from the selected
|
|
@@ -1064,7 +1077,7 @@ intensity?: LyraMapHeatmapZoomValue; opacity?: number }`, where `LyraMapHeatmapZ
|
|
|
1064
1077
|
mapElement.controls = {
|
|
1065
1078
|
navigation: { position: 'bottom-left' },
|
|
1066
1079
|
scale: { position: 'bottom-left' },
|
|
1067
|
-
geolocate: { position: 'bottom-left' },
|
|
1080
|
+
geolocate: { position: 'bottom-left', order: -1 },
|
|
1068
1081
|
attribution: { position: 'bottom-left', customAttribution: [
|
|
1069
1082
|
'Survey team', { label: 'Data contributors', url: 'https://example.com/credits' }
|
|
1070
1083
|
] }
|
|
@@ -1418,11 +1431,20 @@ which only reaches rows projected from `legend`.
|
|
|
1418
1431
|
`legend-hi`, `legend-ticks`, `legend-tick`, `legend-derived`, `legend-limit`, `anchor`,
|
|
1419
1432
|
`anchor-close`, `marker`, `popup`, `popup-content`, `popup-close-button`, `attribution`,
|
|
1420
1433
|
`attribution-toggle`, `attribution-content`, `navigation`, `zoom-in`, `zoom-out`, `compass`, `scale`,
|
|
1421
|
-
`geolocate`, `geolocate-control`,
|
|
1434
|
+
`geolocate`, `geolocate-control`, `controls`, `controls-top`, `controls-bottom`, `controls-top-left`, `controls-top-right`,
|
|
1435
|
+
`controls-bottom-left`, `controls-bottom-right`, `zoom-in-icon`, `zoom-out-icon`, `compass-icon`,
|
|
1436
|
+
`geolocate-icon`, `geolocate-waiting`, `geolocate-active`, `geolocate-background`, `geolocate-error`,
|
|
1437
|
+
`attribution-link`, `attribution-expanded`, `controls-attribution-expanded`,
|
|
1422
1438
|
`configuration-error`, `error`.
|
|
1423
|
-
Before native construction, `initialization-placeholder` is the stable surface
|
|
1424
|
-
`initialization-
|
|
1425
|
-
`
|
|
1439
|
+
Before native construction, `initialization-placeholder` is the stable surface and
|
|
1440
|
+
`initialization-skeleton` is its decorative skeleton. `initialization-controls` also exposes `controls`;
|
|
1441
|
+
its rows expose `controls-top` and `controls-bottom`, and each `initialization-corner` also exposes its
|
|
1442
|
+
matching corner token. `initialization-control` outlines explicitly requested controls, with
|
|
1443
|
+
`initialization-navigation`, `initialization-scale`, `initialization-geolocate` or
|
|
1444
|
+
`initialization-attribution` identifying the kind. Placeholder corners and order follow those options;
|
|
1445
|
+
implicit default attribution has no placeholder. For `initialization="interaction"`,
|
|
1446
|
+
`initialization-activate` starts the map and `initialization-activate-label` styles its visible label.
|
|
1447
|
+
Hiding that label retains the button's localized accessible name. Pick mode renders `pick-controls` with
|
|
1426
1448
|
`pick-center` and `pick-cancel`; draw mode renders `drawing-controls` with `drawing-add`,
|
|
1427
1449
|
`drawing-undo`, `drawing-complete`, `drawing-cancel` and the `drawing-status` vertex count (plus
|
|
1428
1450
|
`drawing-summary` with `drawingMeasurements`), vertex editing renders `drawing-handles` containing
|
|
@@ -1459,6 +1481,55 @@ lr-map::part(attribution-content) {
|
|
|
1459
1481
|
|
|
1460
1482
|
Choose panel bounds that fit the map's allocation and keep required provider credits reachable.
|
|
1461
1483
|
|
|
1484
|
+
`controls` targets the native control container; `controls-top` and `controls-bottom` are independent
|
|
1485
|
+
row grids. `controls-top-left`, `controls-top-right`,
|
|
1486
|
+
`controls-bottom-left` and `controls-bottom-right` target its corners. Their names match the control
|
|
1487
|
+
position vocabulary; positioning follows the inherited text direction. Use these parts for corner
|
|
1488
|
+
insets, gaps and responsive layouts. Icon parts target the native spans: styling `compass-icon`
|
|
1489
|
+
preserves the engine's bearing rotation. Geolocation button state adds `geolocate-waiting`,
|
|
1490
|
+
`geolocate-active`, `geolocate-background` or `geolocate-error` tokens as applicable.
|
|
1491
|
+
`attribution-link` reaches each credit link. While credits are expanded, `attribution-expanded`
|
|
1492
|
+
is added to the attribution wrapper, toggle and content, allowing each surface to be styled directly.
|
|
1493
|
+
|
|
1494
|
+
`--lr-map-scale-bar-display` defaults to `block`; set it to `none` to hide the ruler while retaining
|
|
1495
|
+
the distance text. For example:
|
|
1496
|
+
|
|
1497
|
+
```css
|
|
1498
|
+
lr-map { --lr-map-scale-bar-display: none; }
|
|
1499
|
+
lr-map::part(controls-bottom-right) { gap: var(--lr-space-s); }
|
|
1500
|
+
lr-map::part(compass-icon) { color: var(--lr-color-brand); }
|
|
1501
|
+
lr-map::part(attribution-link) { padding-inline: var(--lr-space-xs); }
|
|
1502
|
+
lr-map::part(attribution-toggle) { background: transparent; }
|
|
1503
|
+
```
|
|
1504
|
+
|
|
1505
|
+
Corner spacing also includes each control's margin; reset those public wrapper margins when
|
|
1506
|
+
replacing them with a corner gap. Keep required credits visible and controls within the map.
|
|
1507
|
+
|
|
1508
|
+
When any attribution in the container is expanded, `controls-attribution-expanded` is added to
|
|
1509
|
+
that container, both rows and all four corners. Compound part selectors can therefore reflow the
|
|
1510
|
+
corners without observing shadow DOM. This bounded example stacks the two bottom corners on narrow
|
|
1511
|
+
viewports; choose the breakpoint and footer reservation for the application:
|
|
1512
|
+
|
|
1513
|
+
```css
|
|
1514
|
+
@media (max-width: 40rem) {
|
|
1515
|
+
lr-map::part(controls controls-attribution-expanded) {
|
|
1516
|
+
display: flex;
|
|
1517
|
+
flex-direction: column;
|
|
1518
|
+
justify-content: flex-end;
|
|
1519
|
+
gap: var(--lr-space-s);
|
|
1520
|
+
}
|
|
1521
|
+
lr-map::part(controls-top controls-attribution-expanded),
|
|
1522
|
+
lr-map::part(controls-bottom controls-attribution-expanded) { display: contents; }
|
|
1523
|
+
lr-map::part(controls-bottom-left controls-attribution-expanded),
|
|
1524
|
+
lr-map::part(controls-bottom-right controls-attribution-expanded) { position: static; }
|
|
1525
|
+
lr-map::part(controls-bottom-left controls-attribution-expanded) { align-self: flex-start; }
|
|
1526
|
+
lr-map::part(controls-bottom-right controls-attribution-expanded) { align-self: flex-end; }
|
|
1527
|
+
}
|
|
1528
|
+
```
|
|
1529
|
+
|
|
1530
|
+
Map content is clipped to its allocation. The host application owns stacking relative to page
|
|
1531
|
+
siblings and the stacking contexts established by its ancestors.
|
|
1532
|
+
|
|
1462
1533
|
`legend` is a localized `role="group"` containing a real list associated to the map canvas with
|
|
1463
1534
|
`aria-describedby`; each entry is a `listitem`, decorative swatches are inert/accessibility-hidden,
|
|
1464
1535
|
and the overlay is bounded to the map allocation with scrolling and long-label wrapping.
|
|
@@ -1621,6 +1692,7 @@ mapEl.overlays = {
|
|
|
1621
1692
|
};
|
|
1622
1693
|
document.body.append(mapEl);
|
|
1623
1694
|
await mapEl.whenStyleReady();
|
|
1695
|
+
await mapEl.whenControlsReady();
|
|
1624
1696
|
|
|
1625
1697
|
async function replaceBasemap(style: LyraMapStyleSpecification): Promise<void> {
|
|
1626
1698
|
mapEl.mapStyle = style;
|
|
@@ -21,7 +21,94 @@ with a trusted CSP meta placed before every caller-controlled HTML token; commen
|
|
|
21
21
|
head decoys therefore cannot bypass the policy. Remote documents accept only relative or HTTP(S)
|
|
22
22
|
URLs and use a fixed `no-referrer` policy; active-document `data:` and `blob:` URLs are rejected.
|
|
23
23
|
The frame can only request tool calls, messages, navigation, logs, and clamped resizing through
|
|
24
|
-
typed events.
|
|
24
|
+
typed events. Browser API permissions are denied unless explicitly enabled in `resource.permissions`.
|
|
25
|
+
|
|
26
|
+
The default `protocol="legacy"` uses Lyra's existing nonce/port envelope. Set
|
|
27
|
+
`protocol="mcp-apps"` for the supported JSON-RPC host subset of the
|
|
28
|
+
[MCP Apps 2026-01-26 protocol](https://github.com/modelcontextprotocol/ext-apps/blob/v2.0.3/specification/2026-01-26/apps.mdx).
|
|
29
|
+
The wire contract is pinned against the public `@modelcontextprotocol/ext-apps` 2.0.3 types.
|
|
30
|
+
An SDK-built interoperability fixture exercises initialization, tools, resources, context, text messages,
|
|
31
|
+
links, inline display fallback, cancellation, error responses and teardown with `App` from the pinned
|
|
32
|
+
SDK. This is a bounded host implementation, not a claim of full MCP Apps conformance: server
|
|
33
|
+
connections and discovery execution belong to the embedding application; sampling, downloads,
|
|
34
|
+
fullscreen/PiP presentation and host calls into app-exposed tools are unsupported. Unsupported
|
|
35
|
+
optional host capabilities are omitted from the initialization result, even if untyped input offers
|
|
36
|
+
them; their incoming requests fail with method-not-found and do not dispatch host work. App-exposed
|
|
37
|
+
tools use the separate app capability direction: advertising them does not grant server-tool access,
|
|
38
|
+
and this host does not discover or invoke them.
|
|
39
|
+
|
|
40
|
+
**Official protocol mode:**
|
|
41
|
+
|
|
42
|
+
- `hostCapabilities: McpAppHostCapabilities = {}` (attribute: false) is a clone-owned grant snapshot.
|
|
43
|
+
Supported grants are `serverTools: {}`, `serverResources: {}`, `openLinks: {}`, `logging: {}`,
|
|
44
|
+
`message: { text: {} }`, and
|
|
45
|
+
`updateModelContext: { text?: {}, structuredContent?: {} }`. Unadvertised methods return JSON-RPC
|
|
46
|
+
method-not-found. Changing capabilities or protocol remounts the app and cancels pending work.
|
|
47
|
+
- The app sends `ui/initialize`; the host returns the pinned revision, host identity, supported
|
|
48
|
+
capabilities, locale and inline display context. The app's `ui/notifications/initialized`
|
|
49
|
+
notification emits `lr-mcp-initialized` with `{ uri, frameGeneration }`. Host notifications are
|
|
50
|
+
rejected before that point; `lr-mcp-ready` alone only reports frame load.
|
|
51
|
+
- `lr-mcp-request` carries `{ requestId, requestToken, method, params, frameGeneration, signal }` for `tools/call`,
|
|
52
|
+
`tools/list`, `resources/list`, `resources/templates/list`, `resources/read`, `ui/message`,
|
|
53
|
+
`ui/open-link`, and `ui/update-model-context`. IDs retain their string
|
|
54
|
+
or numeric type, including `0`. The host authorizes and executes each request. Links must be
|
|
55
|
+
absolute HTTP(S) or mailto; message content supports text blocks only. Resource methods delegate
|
|
56
|
+
authorization and actual server reads to the host listener; they never fetch on their own.
|
|
57
|
+
- `ui/request-display-mode` accepts the standard mode vocabulary and returns `{ mode: "inline" }`,
|
|
58
|
+
the only display mode advertised by this host, including when the app requests fullscreen or PiP.
|
|
59
|
+
- `postMcpResponse(requestId, options): boolean` requires `{ frameGeneration, requestToken, result }` or
|
|
60
|
+
`{ frameGeneration, requestToken, error: { code, message, data? } }`. Results are objects. Unknown, duplicate,
|
|
61
|
+
cancelled, timed-out and stale replies return `false`. Each event has a fresh opaque `requestToken`;
|
|
62
|
+
return it unchanged so a late reply cannot answer a newer request that reuses the same wire ID.
|
|
63
|
+
No external action is automatic.
|
|
64
|
+
- `postMcpNotification(method, params, frameGeneration): boolean` supports
|
|
65
|
+
`ui/notifications/tool-input`, `tool-input-partial`, `tool-result`, `tool-cancelled` and
|
|
66
|
+
`host-context-changed` under that same prefix. Keep the initialized event's generation for
|
|
67
|
+
asynchronous deliveries. `postHostContext()` sends a context-changed notification in this mode.
|
|
68
|
+
- `teardownApp(): Promise<boolean>` sends `ui/resource-teardown` and waits at most one second for
|
|
69
|
+
acknowledgement. Await it before removing the resource when graceful cleanup is needed. The
|
|
70
|
+
session closes regardless of acknowledgement. Abrupt removal closes immediately.
|
|
71
|
+
- Each pending request has a 30-second deadline; cancellation, timeout and teardown abort its
|
|
72
|
+
`signal`. There are at most 64 pending requests; messages are bounded to 10,000 values, 32 nesting
|
|
73
|
+
levels and 1,048,576 UTF-16 code units across keys and strings. This bounds processing and retained requests, not the
|
|
74
|
+
browser's initial structured-clone allocation. Optional undefined object members are omitted
|
|
75
|
+
during bounded JSON normalization; sparse/undefined arrays, cyclic values and accessors are rejected.
|
|
76
|
+
|
|
77
|
+
In official mode, inline resources can load external JavaScript and stylesheets only from the
|
|
78
|
+
HTTP(S) origins explicitly granted in `resource.csp.resourceDomains`. The embedding host must vet
|
|
79
|
+
those origins before assigning the resource; server-provided metadata is not itself authorization.
|
|
80
|
+
Empty, malformed and unmatched origins do not enable external assets. This adds no evaluation,
|
|
81
|
+
blob-script or wildcard allowances. Legacy mode keeps script and stylesheet execution inline-only,
|
|
82
|
+
even when its resource domains permit images, fonts or media. Remote `src` resources still follow
|
|
83
|
+
the remote server's own CSP rather than receiving an injected policy.
|
|
84
|
+
|
|
85
|
+
The official app runs in an inner opaque-origin iframe within a trusted outer sandbox proxy.
|
|
86
|
+
The trusted proxy enforces an ancestor CSP: inline app navigation is limited to the explicitly
|
|
87
|
+
approved `frameDomains` (none by default), including redirects. For remote `src`, the ancestor
|
|
88
|
+
permits only its initial HTTP(S) origin. This blocks unapproved destinations before a network
|
|
89
|
+
request is sent; the inner document cannot remove or relax the ancestor policy. Inline srcdoc
|
|
90
|
+
frames inherit the approved policy, including any approved nested-frame origins.
|
|
91
|
+
The app uses standard parent-window JSON-RPC messages; the proxy checks the app window and opaque
|
|
92
|
+
origin and relays through the host's document-bound message port. Loaded inner-frame navigation
|
|
93
|
+
closes that relay and remounts the sandbox. Treat all app documents and navigations as untrusted;
|
|
94
|
+
window transport does not authenticate a document during the interval before a permitted navigation
|
|
95
|
+
loads. The origin allowlist constrains that interval but does not prove document identity. Do not deliver credentials or secrets as host context or tool data.
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
element.protocol = "mcp-apps";
|
|
99
|
+
element.hostCapabilities = { serverTools: {} };
|
|
100
|
+
element.addEventListener("lr-mcp-request", async event => {
|
|
101
|
+
const { requestId, requestToken, method, params, frameGeneration, signal } = event.detail;
|
|
102
|
+
if (method !== "tools/call") {
|
|
103
|
+
element.postMcpResponse(requestId, {
|
|
104
|
+
frameGeneration, requestToken, error: { code: -32601, message: "Unsupported method" }
|
|
105
|
+
});
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const result = await callAuthorizedTool(params, { signal });
|
|
109
|
+
element.postMcpResponse(requestId, { frameGeneration, requestToken, result });
|
|
110
|
+
});
|
|
111
|
+
```
|
|
25
112
|
|
|
26
113
|
**Properties:**
|
|
27
114
|
|
|
@@ -51,15 +138,18 @@ typed events. Capabilities are denied unless explicitly enabled in `resource.per
|
|
|
51
138
|
request with exactly one of `{ frameGeneration, result }` or `{ frameGeneration, error }`. Missing,
|
|
52
139
|
stale, or ambiguous correlation fails closed. Both methods are no-ops before a frame exists.
|
|
53
140
|
|
|
54
|
-
|
|
141
|
+
In legacy mode, the initial `host-context` message includes a document-bound nonce and transfers a `MessagePort` to
|
|
55
142
|
the executable document; that port is the only channel (window messages are ignored). A same-frame
|
|
56
143
|
navigation closes the port, invalidates the nonce and generation, and mounts a fresh sandbox before
|
|
57
144
|
host data can be delivered.
|
|
58
145
|
|
|
59
146
|
**Exported types:** `McpAppResource`, `McpAppCsp`, `McpAppPermissions`,
|
|
60
|
-
`McpAppToolCallDetail`, `McpAppToolResultOptions`,
|
|
147
|
+
`McpAppToolCallDetail`, `McpAppToolResultOptions`, `McpAppProtocol`, `McpAppHostCapabilities`,
|
|
148
|
+
`McpAppRequestId`, `McpAppRequestMethod`, `McpAppRequestDetail`, `McpAppResponseOptions`,
|
|
149
|
+
`McpAppNotificationMethod`, and `LyraMcpAppEventMap`.
|
|
61
150
|
|
|
62
|
-
**Events:** `lr-mcp-ready` (`{ uri }`), `lr-mcp-
|
|
151
|
+
**Events:** `lr-mcp-ready` (`{ uri }`), `lr-mcp-initialized` (`{ uri, frameGeneration }`),
|
|
152
|
+
`lr-mcp-request` (`{ requestId, requestToken, method, params, frameGeneration, signal }`), `lr-mcp-tool-call`
|
|
63
153
|
(`{ requestId?, name, args, frameGeneration }`), `lr-mcp-send-message` (`{ message }`),
|
|
64
154
|
`lr-mcp-open-link` (`{ href }`, an absolute http(s) or mailto URL), `lr-mcp-log`
|
|
65
155
|
(`{ level, value }`), and `lr-mcp-resize` (`{ height }`). These are host-authorized requests; the
|
|
@@ -22,6 +22,11 @@ Built-in text and reasoning Markdown receives each part's `state === 'streaming'
|
|
|
22
22
|
accumulated plain text without parsing or highlighting by default. The `streaming-render` property
|
|
23
23
|
can opt those parts into progressive Markdown. Replacing that same-id part with `state: 'complete'`
|
|
24
24
|
parses and renders the final content.
|
|
25
|
+
Built-in reasoning, tool, citation, attachment, JSON, widget and retry-button renderers register
|
|
26
|
+
on first use. A localized loading placeholder is visible while the import is pending; a failed
|
|
27
|
+
import shows a localized error and emits `lr-render-error`. Text-only messages do not load those
|
|
28
|
+
renderer implementations. Audio uses the browser's native audio element. A custom `renderPart`
|
|
29
|
+
that replaces a part does not load that part's built-in renderer.
|
|
25
30
|
Citation badge ranks are precomputed in one linear pass per render, rather than rescanning and
|
|
26
31
|
allocating every preceding part for each citation in a citation-heavy or growing message.
|
|
27
32
|
|
|
@@ -58,6 +63,19 @@ default — every instance carries `tool-display="chip"` until set, like `conten
|
|
|
58
63
|
`renderPart` is called exactly once per rendered part, in order, in both tool displays, and its
|
|
59
64
|
output is the host's own: it is never masked by `redactedFields`.
|
|
60
65
|
|
|
66
|
+
`widgetRegistry: LyraWidgetTypeRegistry = DEFAULT_WIDGET_TYPE_REGISTRY` (property only) forwards
|
|
67
|
+
an immutable registry created by `createWidgetTypeRegistry()` to every built-in widget part.
|
|
68
|
+
`widgetBindingState?: unknown` (property only) forwards explicit controlled state; `null` is a real
|
|
69
|
+
value. This state takes a bounded, clone-owned snapshot on assignment. Handle
|
|
70
|
+
`lr-widget-state-change` and reassign the next state yourself. Parts share this state, so their
|
|
71
|
+
JSON Pointer bindings must refer to the intended host-owned paths. Registry entries only describe
|
|
72
|
+
allowed types: applications must still register custom mapped components using granular imports.
|
|
73
|
+
Widget documents are cached by the unique part id and their bounded snapshot content. Unrelated
|
|
74
|
+
text writes preserve the existing widget document, while a changed widget root invalidates it.
|
|
75
|
+
Removing a part, windowing it out, or disconnecting releases its cached document. This cache does
|
|
76
|
+
not change widget-v2 validation, identity rejection, or controlled-state ownership.
|
|
77
|
+
|
|
78
|
+
|
|
61
79
|
Unsupported direct or `content-mode` attribute values normalize and reflect as `markdown`;
|
|
62
80
|
unsupported `tool-display` values normalize and reflect as `chip`.
|
|
63
81
|
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
|
|
17
17
|
## `lr-multi-split`
|
|
18
18
|
|
|
19
|
+
The floating drawer enters the browser top layer within the split's allocation. An intrinsically
|
|
20
|
+
sized split reserves its opening block-size footprint until the drawer closes; definite parent
|
|
21
|
+
sizes, scrolling, and resizing remain live.
|
|
22
|
+
|
|
19
23
|
The floating pane remains interactive when opened outside an existing native `dialog.showModal()`. An internal native modal surface preserves the authored host and content; Escape, close vetoes, and focus return keep their usual behavior. Ordinary inline rendering is unchanged.
|
|
20
24
|
|
|
21
25
|
Resizable panels for dashboard layouts. Direct **light-DOM children are the panels**; a divider is
|
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
## `lr-page`
|
|
18
18
|
|
|
19
|
-
The mobile navigation drawer
|
|
19
|
+
The mobile navigation drawer enters the browser top layer, escaping fixed headers and transformed
|
|
20
|
+
or clipped ancestors while keeping its host and navigation content in place. It also remains
|
|
21
|
+
interactive when opened outside an existing native `dialog.showModal()`, using an internal native
|
|
22
|
+
modal surface. Escape, close vetoes, and focus return keep their usual behavior; desktop navigation
|
|
23
|
+
remains in the page grid.
|
|
20
24
|
|
|
21
25
|
Semantic application/page shell with page-wide banner/header/subheader/footer regions, a compact
|
|
22
26
|
menu, primary navigation, main header/content/footer, and an aside. It derives mobile versus
|
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
## `lr-responsive-panel`
|
|
18
18
|
|
|
19
|
-
The overlay
|
|
19
|
+
The overlay surface enters the browser top layer, so sticky headers, clipped ancestors, and
|
|
20
|
+
stacking contexts cannot cover it. The host stays in its authored slot, and ordinary inline/overlay
|
|
21
|
+
transitions retain the same body and slotted content. When opened outside an existing native
|
|
22
|
+
`dialog.showModal()`, an internal native modal surface preserves interactivity. Escape, close
|
|
23
|
+
vetoes, and focus return keep their usual behavior.
|
|
20
24
|
|
|
21
25
|
The same slotted content either docked inline in its containing layout or presented as a
|
|
22
26
|
full-screen/bottom-sheet/side-anchored overlay, depending on the panel's allocated inline size.
|
|
@@ -545,8 +545,9 @@ purposes.
|
|
|
545
545
|
`defaultSelected`/attribute changes update that reset baseline without clobbering a dirty live
|
|
546
546
|
selection; user picks and direct `option.selected` writes remain live-only and never rewrite the
|
|
547
547
|
attribute/default.
|
|
548
|
-
- `aria-required` on the trigger reflects `required` immediately; `aria-invalid`
|
|
549
|
-
|
|
548
|
+
- `aria-required` on the trigger reflects `required` immediately; `aria-invalid` and `data-invalid`
|
|
549
|
+
reveal a constraint error after blur, `reportValidity()` or a native submission attempt.
|
|
550
|
+
A silent `checkValidity()` leaves a pristine control unchanged; `form.reset()` restores that state.
|
|
550
551
|
Blurring the trigger (Tab away) closes an open listbox, the same as a native `<select>`'s popup,
|
|
551
552
|
without restoring focus and undoing the browser's native Tab/Shift+Tab destination.
|
|
552
553
|
- The trigger's accessible name now checks a host-level `aria-label` attribute first, before falling
|
|
@@ -51,7 +51,8 @@ token editor. The former camel-case `autoCorrect` property is removed; use the n
|
|
|
51
51
|
lowercase IDL. `size: '2xs' | 'xs' | 's' | 'm' | 'l' | 'xl' = 'm'` (reflected —
|
|
52
52
|
same scale as `lr-input`'s `size`, scaling the input-wrapper's row height and text size across six
|
|
53
53
|
tiers, and both `2xs`/`xs`/`s`/`m`/`l`/`xl` and `small`/`medium`/`large` are accepted; the remove
|
|
54
|
-
button
|
|
54
|
+
button retains the shared `--lr-icon-button-size` minimum hit area across all sizes), `pill`
|
|
55
|
+
(reflected, default `false` —
|
|
55
56
|
rounds the token row's corners by changing the private radius default to `--lr-radius-pill`; the
|
|
56
57
|
chips share the public `--lr-token-input-radius` hook with the row, and an inherited or direct
|
|
57
58
|
value remains authoritative),
|
|
@@ -167,8 +168,8 @@ text the part is hidden and no glyph is painted.
|
|
|
167
168
|
`--lr-token-input-control-min-height` floor only; set it to a length to both floor and cap the row,
|
|
168
169
|
e.g. to pixel-match a sibling field in the same toolbar row). An uncapped row grows as tokens wrap.
|
|
169
170
|
A capped row explicitly clips inline overflow and becomes a block-axis scrollport, preserving every
|
|
170
|
-
wrapped token and
|
|
171
|
-
the destination token into view. `--lr-token-input-input-inline-size`
|
|
171
|
+
wrapped token and remove/edit action with its shared `--lr-icon-button-size` floor instead of
|
|
172
|
+
clipping them; keyboard focus scrolls the destination token into view. `--lr-token-input-input-inline-size`
|
|
172
173
|
(the editable input's `flex-basis` inside the wrapped token row; undeclared by default, falling back
|
|
173
174
|
inline to `--lr-size-8rem`), `--lr-token-input-min-input-inline-size` (default `--lr-size-4rem`, the
|
|
174
175
|
floor that input keeps once tokens have consumed the row), and `--lr-token-input-editor-inline-size`
|
|
@@ -44,8 +44,8 @@ later text renders normally.
|
|
|
44
44
|
leaves the tooltip entirely under programmatic control. Note the name collision: this string
|
|
45
45
|
property and the `trigger` _slot_ are different things — the slot holds the element, this property
|
|
46
46
|
says which of its interactions count.
|
|
47
|
-
- `manual: boolean = false` — equivalent to including `manual`
|
|
48
|
-
|
|
47
|
+
- `manual: boolean = false` (attribute `manual`, not reflected) — equivalent to including `manual`
|
|
48
|
+
in `trigger`; use `<lr-tooltip manual>` for a tooltip driven only from script
|
|
49
49
|
- `showDelay: number = 150` (attribute `show-delay`) and `hideDelay: number = 0` (attribute
|
|
50
50
|
`hide-delay`) — independent milliseconds values, so a tooltip can linger after the pointer leaves without also
|
|
51
51
|
being slow to appear; `hideDelay` `0` closes the tooltip at once. A non-finite value falls back to the default; a negative one clamps to
|
|
@@ -208,7 +208,7 @@ or cross-document adoption cancels the old realm, and reconnect creates fresh ob
|
|
|
208
208
|
`lr-popover` when click-to-open ownership is desired.
|
|
209
209
|
|
|
210
210
|
**`showAt()` composed with `lr-graph`** — anchoring a popover to a clicked graph node. Note:
|
|
211
|
-
`lr-graph.getNodePosition()` and the `lr-node-
|
|
211
|
+
`lr-graph.getNodePosition()` and the `lr-node-activate` event's `{ x, y }` are in the graph's own
|
|
212
212
|
_local drawing space_ (pre pan/zoom), not viewport pixels, so they can't be passed to `showAt()`
|
|
213
213
|
directly. For `renderer="svg"` (the default), read the clicked node's own rendered element instead,
|
|
214
214
|
whose `getBoundingClientRect()` is already viewport-relative; for `renderer="canvas"` (no per-node
|
|
@@ -225,7 +225,7 @@ graph.addEventListener("click", (event) => {
|
|
|
225
225
|
if (!nodeEl) return; // clicked empty canvas/background, not a node
|
|
226
226
|
const rect = nodeEl.getBoundingClientRect();
|
|
227
227
|
detail.showAt({
|
|
228
|
-
x: rect.left
|
|
228
|
+
x: rect.left,
|
|
229
229
|
y: rect.top,
|
|
230
230
|
width: rect.width,
|
|
231
231
|
height: rect.height,
|
package/llms/peers.md
CHANGED
|
@@ -40,7 +40,7 @@ for the page.
|
|
|
40
40
|
| `@aceshooting/lyra-3d` | `^1.0.0` | `lr-chart-3d`, `lr-embedding-explorer`, `lr-graph`, `lr-image-viewer`, `lr-knowledge-graph-explorer`, `lr-model-viewer`, `lr-video` |
|
|
41
41
|
| `@aceshooting/lyra-flags` | `^2.3.1` | _(loaded by a shared internal module)_ |
|
|
42
42
|
| `@aceshooting/lyra-map` | `^1.3.0` | `lr-geojson-viewer`, `lr-map` |
|
|
43
|
-
| `@aceshooting/lyra-translations` | `^30.
|
|
43
|
+
| `@aceshooting/lyra-translations` | `^30.4.0` | _(not referenced by any component)_ |
|
|
44
44
|
| `@aiden0z/pptx-renderer` | `^1.4.0` | `lr-pptx-viewer` |
|
|
45
45
|
| `@sgratzl/chartjs-chart-boxplot` | `^4.0.0` | `lr-box-plot` |
|
|
46
46
|
| `chart.js` | `^4.0.1` | `lr-bar-chart`, `lr-box-plot`, `lr-bubble-chart`, `lr-chart`, `lr-doughnut-chart`, `lr-histogram`, `lr-line-chart`, `lr-pie-chart`, `lr-polar-area-chart`, `lr-radar-chart`, `lr-scatter-chart` |
|
|
@@ -29,9 +29,12 @@ import {
|
|
|
29
29
|
and strictly increasing `sequence`. A newer generation atomically retires the previous run, while
|
|
30
30
|
an older or replayed cursor is ignored. JSON Patch input is structurally validated and rejects
|
|
31
31
|
prototype-mutating paths.
|
|
32
|
-
- **
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
- **Structural adapters** — `adaptAiSdkMessage()` maps structural provider messages and
|
|
33
|
+
`AgUiStreamAdapter` maps events onto the neutral runtime without pulling vendor SDKs into the
|
|
34
|
+
package. Feed AG-UI events through `new AgUiStreamAdapter().push(event)`; the constructor accepts
|
|
35
|
+
`(limits?: Partial<AgUiAdapterLimits>, options?: AgUiAdapterOptions)`.
|
|
36
|
+
`adaptA2UiSurface()` is a limited A2UI-like graph helper, described below; it does not implement
|
|
37
|
+
the native A2UI protocol or its surface lifecycle.
|
|
35
38
|
Adapter inputs are treated as untrusted data, recursively snapshotted, and rejected without
|
|
36
39
|
throwing when malformed, non-serializable, or over their configured budgets.
|
|
37
40
|
`adaptAiSdkMessage()` maps AI SDK tool states structurally: `output-error` → `error`,
|
|
@@ -71,6 +74,77 @@ import {
|
|
|
71
74
|
These structural, provider-agnostic types correspond to the component inputs above; map a vendor
|
|
72
75
|
payload onto them at the edge.
|
|
73
76
|
|
|
77
|
+
### AG-UI reasoning, activity, and custom events
|
|
78
|
+
|
|
79
|
+
`AgUiLikeEvent` is the structural input shape; `push()` also accepts unknown input for guarded
|
|
80
|
+
admission. Visible `REASONING_MESSAGE_*` events become reasoning parts. `ACTIVITY_SNAPSHOT`
|
|
81
|
+
uses `messageId`, `activityType`, object `content`, and optional `replace`; `replace: false`
|
|
82
|
+
keeps an existing message. `ACTIVITY_DELTA` uses `patch` against a prior snapshot with the same
|
|
83
|
+
`messageId` and `activityType`. Activity content becomes a named data part and remains subject to
|
|
84
|
+
the adapter's snapshot and buffered-content budgets.
|
|
85
|
+
|
|
86
|
+
`CUSTOM` requires `name` and `value` plus explicit host routing. Set
|
|
87
|
+
`AgUiAdapterOptions.customEventTarget` to receive an `AgUiCustomEvent { name, value }` and return
|
|
88
|
+
an `AgUiCustomEventTarget { messageId, partId }`, or `null` to ignore it. Repeated targets replace
|
|
89
|
+
their data part. The callback owns those identities; the application registers named data renderers
|
|
90
|
+
and controls which event names it accepts. An omitted callback ignores custom events. Named data values remain data,
|
|
91
|
+
including values that resemble widgets or actions.
|
|
92
|
+
|
|
93
|
+
`AgUiAdapterLimits.maxBufferedMessages` bounds retained message identities, including activity
|
|
94
|
+
patch baselines; its default is 512. `maxBufferedTools`, `maxToolArgumentBytes`,
|
|
95
|
+
`maxTextDeltaCharacters`, and the inherited provider snapshot limits remain independently bounded.
|
|
96
|
+
Run boundaries and `reset()` clear retained buffers. Compact chunks require upstream expansion;
|
|
97
|
+
phase, encrypted, raw, step, subagent, deprecated thinking, and unknown events are ignored.
|
|
98
|
+
See the [AG-UI adapter guide](https://github.com/aceshooting/lyra-ui/blob/main/docs/ag-ui-adapter.md)
|
|
99
|
+
for event mappings, routing examples, error behavior, and the supported subset.
|
|
100
|
+
|
|
101
|
+
### Limited A2UI-like graph helper
|
|
102
|
+
|
|
103
|
+
`adaptA2UiSurface(surface, typeMap, limits?)` accepts one structural graph:
|
|
104
|
+
`{ rootId, components: [{ id, type, props?, text?, children?: string[], action?: { id, payload? } }], data? }`.
|
|
105
|
+
The host-owned `typeMap` maps those type names to allowlisted widget types. Unsupported native
|
|
106
|
+
A2UI lifecycle messages are not accepted as graphs; the helper does not maintain surfaces,
|
|
107
|
+
process native data-model updates, or provide native A2UI catalog compatibility.
|
|
108
|
+
|
|
109
|
+
The result is `A2UiAdapterResult | null`: a widget-compatible `{ version: '2', root }` plus
|
|
110
|
+
`bindingState` when `surface.data` is present. Assign `bindingState` separately; the widget-v2
|
|
111
|
+
document itself never supplies controlled state. Explicit `data: null` remains `bindingState: null`.
|
|
112
|
+
The original `state` field remains an equal compatibility alias in the helper result; renderers
|
|
113
|
+
do not read it. Input, props, action payloads and state are detached under the adapter budgets.
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
import { adaptA2UiSurface } from "@aceshooting/lyra-ui/ai";
|
|
117
|
+
import "@aceshooting/lyra-ui/components/lr-message-parts.js";
|
|
118
|
+
import "@aceshooting/lyra-ui/components/lr-input.js";
|
|
119
|
+
import { createWidgetTypeRegistry } from "@aceshooting/lyra-ui/components/lr-widget-renderer.js";
|
|
120
|
+
|
|
121
|
+
const registry = createWidgetTypeRegistry([["field", {
|
|
122
|
+
tag: "lr-input", interaction: "control", props: { label: "string", value: "string" },
|
|
123
|
+
bindings: { value: { event: "lr-input" } },
|
|
124
|
+
}]]);
|
|
125
|
+
const adapted = adaptA2UiSurface({
|
|
126
|
+
rootId: "name-field",
|
|
127
|
+
components: [{ id: "name-field", type: "Field", props: {
|
|
128
|
+
label: "Name", value: { $bind: "/name" },
|
|
129
|
+
} }],
|
|
130
|
+
data: { name: "Ada" },
|
|
131
|
+
}, { Field: "field" });
|
|
132
|
+
const message = document.querySelector("lr-message-parts")!;
|
|
133
|
+
if (adapted) {
|
|
134
|
+
message.widgetRegistry = registry;
|
|
135
|
+
message.widgetBindingState = adapted.bindingState;
|
|
136
|
+
message.parts = [{ id: "name-form", type: "data", widget: adapted.root }];
|
|
137
|
+
}
|
|
138
|
+
message.addEventListener("lr-widget-state-change", (event) => {
|
|
139
|
+
if (event.detail.path === "/name") message.widgetBindingState = { name: event.detail.value };
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
For host-specific content, keep using `renderPart(part, index)`: return `undefined` to delegate
|
|
144
|
+
one part, or return a template to replace it and own its interaction. No extra part registry is
|
|
145
|
+
required. Widget type registries control the existing widget renderer's allowed component types,
|
|
146
|
+
separately from the message-part rendering hook.
|
|
147
|
+
|
|
74
148
|
### Interrupting and resuming a streamed run
|
|
75
149
|
|
|
76
150
|
`stream-interrupt` and `stream-resume` are reducer events for the host-owned transport lifecycle;
|
|
@@ -111,6 +185,17 @@ state = reduceAgentStream(state, {
|
|
|
111
185
|
- **Build voice sessions:** `lr-realtime-session`; it composes the existing audio visualizer,
|
|
112
186
|
push-to-talk control, and transcript feed while leaving transport ownership with the host.
|
|
113
187
|
|
|
188
|
+
For catalog-bound generated views, use the independently versioned `@aceshooting/lyra-gen`
|
|
189
|
+
companion; its format differs from widget-v2. Read its
|
|
190
|
+
[integration guide](https://github.com/aceshooting/lyra-ui/blob/main/packages/lyra-gen/README.md)
|
|
191
|
+
and installed explicit `exports` map before importing runtime modules. The
|
|
192
|
+
[compatibility guide](https://github.com/aceshooting/lyra-ui/blob/main/packages/lyra-gen/docs/compatibility.md)
|
|
193
|
+
defines its 1.x contract and qualification limits; only the A2UI candidate entry is separately
|
|
194
|
+
experimental. Its
|
|
195
|
+
[guided demo](https://github.com/aceshooting/lyra-ui/blob/main/packages/lyra-gen/docs/guided-demo.md)
|
|
196
|
+
is shipped application source with simulated data and scripted en/fr/ar replies, not an exported
|
|
197
|
+
runtime entry or a model service. Core locale catalogs do not translate that example-owned copy.
|
|
198
|
+
|
|
114
199
|
Family registration entry points are additive: importing
|
|
115
200
|
`@aceshooting/lyra-ui/components/conversation`, `/agent-tools`, or `/retrieval` registers and
|
|
116
201
|
exports that complete family. Granular component entry points remain the smallest bundles and are
|
|
@@ -614,11 +614,18 @@ These named interfaces and helper signatures are available to typed integrations
|
|
|
614
614
|
components: A2UiLikeComponent[];
|
|
615
615
|
data?: unknown;
|
|
616
616
|
}`
|
|
617
|
-
`
|
|
617
|
+
`A2UiAdapterResult {
|
|
618
|
+
readonly version: '2';
|
|
619
|
+
readonly root: LyraWidgetNode;
|
|
620
|
+
readonly bindingState?: unknown;
|
|
621
|
+
readonly state?: unknown;
|
|
622
|
+
}`
|
|
623
|
+
`adaptA2UiSurface(surface: unknown, typeMap: unknown, limits: Partial<A2UiAdapterLimits> = {}): A2UiAdapterResult | null`
|
|
618
624
|
|
|
619
625
|
- **`ai-adapters-ag-ui-contracts`** — AI adapter and runtime contracts.
|
|
620
626
|
`AgUiAdapterLimits {
|
|
621
627
|
maxBufferedTools: number;
|
|
628
|
+
maxBufferedMessages: number;
|
|
622
629
|
maxToolArgumentBytes: number;
|
|
623
630
|
maxTextDeltaCharacters: number;
|
|
624
631
|
maxDepth: number;
|
|
@@ -640,6 +647,23 @@ These named interfaces and helper signatures are available to typed integrations
|
|
|
640
647
|
code?: string;
|
|
641
648
|
snapshot?: unknown;
|
|
642
649
|
messages?: unknown[];
|
|
650
|
+
name?: string;
|
|
651
|
+
value?: unknown;
|
|
652
|
+
activityType?: string;
|
|
653
|
+
content?: unknown;
|
|
654
|
+
replace?: boolean;
|
|
655
|
+
patch?: unknown[];
|
|
656
|
+
}`
|
|
657
|
+
`AgUiCustomEvent {
|
|
658
|
+
name: string;
|
|
659
|
+
value: unknown;
|
|
660
|
+
}`
|
|
661
|
+
`AgUiCustomEventTarget {
|
|
662
|
+
messageId: string;
|
|
663
|
+
partId: string;
|
|
664
|
+
}`
|
|
665
|
+
`AgUiAdapterOptions {
|
|
666
|
+
customEventTarget?: (event: AgUiCustomEvent) => AgUiCustomEventTarget | null;
|
|
643
667
|
}`
|
|
644
668
|
|
|
645
669
|
- **`ai-adapters-ai-sdk-contracts`** — AI adapter and runtime contracts.
|