@aceshooting/lyra-ui 30.1.0 → 30.3.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 +92 -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/agent-tools/span-waterfall/span-waterfall.class.js +1 -1
- package/dist/components/agent-tools/task-list/task-list.class.js +2 -2
- package/dist/components/agent-tools/trace-tree/trace-tree.class.js +2 -2
- package/dist/components/charts/chart/chart-prepared-data.d.ts +3 -1
- package/dist/components/charts/chart/chart-prepared-data.js +1 -1
- package/dist/components/charts/chart/chart.class.js +2 -2
- package/dist/components/charts/chart/lite-chart.class.js +1 -1
- 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-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/forms/checkbox/checkbox.class.d.ts +1 -1
- package/dist/components/forms/checkbox/checkbox.class.js +2 -2
- package/dist/components/forms/combobox/option.class.d.ts +1 -1
- package/dist/components/forms/combobox/option.class.js +2 -2
- package/dist/components/forms/radio/radio.class.d.ts +1 -1
- package/dist/components/forms/radio/radio.class.js +1 -1
- package/dist/components/forms/select/select.class.js +1 -1
- package/dist/components/forms/switch/switch.class.d.ts +1 -1
- package/dist/components/forms/switch/switch.class.js +1 -1
- package/dist/components/media/file-input/file-input.styles.js +1 -1
- package/dist/components/media/map/map-anchor-controller.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/viewers/model-viewer/model-viewer-loader.js +1 -1
- package/dist/components/viewers/model-viewer/model-viewer.class.js +1 -1
- package/dist/components/viewers/pptx-viewer/pptx-viewer.class.d.ts +11 -11
- package/dist/components/viewers/pptx-viewer/pptx-viewer.class.js +1 -1
- package/dist/events.d.ts +10 -1
- package/dist/framework-types.d.ts +1 -1
- package/dist/internal/accessible-text-controller.js +1 -1
- package/dist/internal/anchored-overlay-runtime.js +1 -1
- package/dist/internal/default-label-forwarding.js +1 -0
- package/dist/internal/hierarchy-summary-source.js +1 -0
- package/dist/internal/localization-types.d.ts +1 -1
- package/dist/internal/localization.js +1 -1
- package/dist/internal/package-metadata.js +1 -1
- package/dist/internal/positioner.d.ts +8 -0
- package/dist/internal/positioner.js +1 -1
- package/dist/internal/scoped-definitions.generated.js +1 -1
- package/dist/lyra.d.ts +1 -1
- package/llms/components/lr-file-input.md +5 -0
- package/llms/components/lr-map.md +87 -14
- package/llms/components/lr-mcp-app.md +94 -4
- package/llms/components/lr-message-parts.md +18 -0
- package/llms/components/lr-pptx-viewer.md +9 -5
- package/llms/components/lr-select.md +3 -2
- package/llms/index.md +1 -1
- package/llms/peers.md +1 -1
- package/llms/shared/ai-and-peers.md +77 -3
- package/llms/shared/events-and-types.md +25 -1
- package/llms/shared/localization-and-rtl.md +29 -0
- package/llms/shared.md +131 -4
- package/locales.json +1 -1
- package/package.json +12 -8
- 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 +16 -8
- package/skills/lyra-ui/lyra-gen.md +86 -0
package/llms/shared.md
CHANGED
|
@@ -2679,6 +2679,35 @@ Pluralized messages use one object-valued entry keyed by CLDR categories. A cata
|
|
|
2679
2679
|
singular and `<key>Plural` entries should fold them into `{ one: …, other: … }` under the singular
|
|
2680
2680
|
key's name; the plural key is not read.
|
|
2681
2681
|
|
|
2682
|
+
### Generated views and embedded apps
|
|
2683
|
+
|
|
2684
|
+
`@aceshooting/lyra-gen` uses the same locale registry and inherited `lang`/`locale` as Lyra UI.
|
|
2685
|
+
The seven `genView*` renderer messages ship in each locale's `conversation` slice, including
|
|
2686
|
+
empty, invalid, loading, load-failure, field-value, unavailable-action and confirmation messages.
|
|
2687
|
+
Import the full matching `@aceshooting/lyra-translations/<locale>.js` catalog, or the
|
|
2688
|
+
`<locale>/conversation.js` slice plus the families and `shared.js` used by generated child controls.
|
|
2689
|
+
The translations package matches the **Lyra UI** version; Gen is versioned independently.
|
|
2690
|
+
|
|
2691
|
+
```ts
|
|
2692
|
+
import '@aceshooting/lyra-translations/fr/conversation.js';
|
|
2693
|
+
import '@aceshooting/lyra-translations/fr/forms.js';
|
|
2694
|
+
import '@aceshooting/lyra-translations/fr/shared.js';
|
|
2695
|
+
import '@aceshooting/lyra-gen/gen-view.js';
|
|
2696
|
+
```
|
|
2697
|
+
|
|
2698
|
+
The renderer keeps its own small English defaults and does not load the complete English catalog.
|
|
2699
|
+
Its `.strings` overrides affect its own messages; registered locale messages also reach nested
|
|
2700
|
+
controls. Changing the inherited locale or registering a catalog after mounting refreshes the
|
|
2701
|
+
renderer. Caller labels and model-generated prose remain caller content: the host chooses their
|
|
2702
|
+
language separately. Numeric/date formatting follows the host locale without changing stored
|
|
2703
|
+
JSON numbers or ISO dates. Host-created chat stream messages still require the host's localized
|
|
2704
|
+
`strings` configuration.
|
|
2705
|
+
|
|
2706
|
+
A loaded `lr-mcp-app` publishes changed locale/direction context without reloading its frame.
|
|
2707
|
+
Official MCP Apps sessions retain context updates during initialization and deliver the latest
|
|
2708
|
+
context when the app becomes ready. Resource content remains responsible for rendering its own
|
|
2709
|
+
translations and direction; the iframe does not inherit the parent document's CSS or `dir`.
|
|
2710
|
+
|
|
2682
2711
|
## RTL and direction
|
|
2683
2712
|
|
|
2684
2713
|
Direction is inherited from the platform `dir` cascade; locale/`lang` selection does not change it,
|
|
@@ -2742,9 +2771,12 @@ import {
|
|
|
2742
2771
|
and strictly increasing `sequence`. A newer generation atomically retires the previous run, while
|
|
2743
2772
|
an older or replayed cursor is ignored. JSON Patch input is structurally validated and rejects
|
|
2744
2773
|
prototype-mutating paths.
|
|
2745
|
-
- **
|
|
2746
|
-
|
|
2747
|
-
|
|
2774
|
+
- **Structural adapters** — `adaptAiSdkMessage()` maps structural provider messages and
|
|
2775
|
+
`AgUiStreamAdapter` maps events onto the neutral runtime without pulling vendor SDKs into the
|
|
2776
|
+
package. Feed AG-UI events through `new AgUiStreamAdapter().push(event)`; the constructor accepts
|
|
2777
|
+
`(limits?: Partial<AgUiAdapterLimits>, options?: AgUiAdapterOptions)`.
|
|
2778
|
+
`adaptA2UiSurface()` is a limited A2UI-like graph helper, described below; it does not implement
|
|
2779
|
+
the native A2UI protocol or its surface lifecycle.
|
|
2748
2780
|
Adapter inputs are treated as untrusted data, recursively snapshotted, and rejected without
|
|
2749
2781
|
throwing when malformed, non-serializable, or over their configured budgets.
|
|
2750
2782
|
`adaptAiSdkMessage()` maps AI SDK tool states structurally: `output-error` → `error`,
|
|
@@ -2784,6 +2816,77 @@ import {
|
|
|
2784
2816
|
These structural, provider-agnostic types correspond to the component inputs above; map a vendor
|
|
2785
2817
|
payload onto them at the edge.
|
|
2786
2818
|
|
|
2819
|
+
### AG-UI reasoning, activity, and custom events
|
|
2820
|
+
|
|
2821
|
+
`AgUiLikeEvent` is the structural input shape; `push()` also accepts unknown input for guarded
|
|
2822
|
+
admission. Visible `REASONING_MESSAGE_*` events become reasoning parts. `ACTIVITY_SNAPSHOT`
|
|
2823
|
+
uses `messageId`, `activityType`, object `content`, and optional `replace`; `replace: false`
|
|
2824
|
+
keeps an existing message. `ACTIVITY_DELTA` uses `patch` against a prior snapshot with the same
|
|
2825
|
+
`messageId` and `activityType`. Activity content becomes a named data part and remains subject to
|
|
2826
|
+
the adapter's snapshot and buffered-content budgets.
|
|
2827
|
+
|
|
2828
|
+
`CUSTOM` requires `name` and `value` plus explicit host routing. Set
|
|
2829
|
+
`AgUiAdapterOptions.customEventTarget` to receive an `AgUiCustomEvent { name, value }` and return
|
|
2830
|
+
an `AgUiCustomEventTarget { messageId, partId }`, or `null` to ignore it. Repeated targets replace
|
|
2831
|
+
their data part. The callback owns those identities; the application registers named data renderers
|
|
2832
|
+
and controls which event names it accepts. An omitted callback ignores custom events. Named data values remain data,
|
|
2833
|
+
including values that resemble widgets or actions.
|
|
2834
|
+
|
|
2835
|
+
`AgUiAdapterLimits.maxBufferedMessages` bounds retained message identities, including activity
|
|
2836
|
+
patch baselines; its default is 512. `maxBufferedTools`, `maxToolArgumentBytes`,
|
|
2837
|
+
`maxTextDeltaCharacters`, and the inherited provider snapshot limits remain independently bounded.
|
|
2838
|
+
Run boundaries and `reset()` clear retained buffers. Compact chunks require upstream expansion;
|
|
2839
|
+
phase, encrypted, raw, step, subagent, deprecated thinking, and unknown events are ignored.
|
|
2840
|
+
See the [AG-UI adapter guide](https://github.com/aceshooting/lyra-ui/blob/main/docs/ag-ui-adapter.md)
|
|
2841
|
+
for event mappings, routing examples, error behavior, and the supported subset.
|
|
2842
|
+
|
|
2843
|
+
### Limited A2UI-like graph helper
|
|
2844
|
+
|
|
2845
|
+
`adaptA2UiSurface(surface, typeMap, limits?)` accepts one structural graph:
|
|
2846
|
+
`{ rootId, components: [{ id, type, props?, text?, children?: string[], action?: { id, payload? } }], data? }`.
|
|
2847
|
+
The host-owned `typeMap` maps those type names to allowlisted widget types. Unsupported native
|
|
2848
|
+
A2UI lifecycle messages are not accepted as graphs; the helper does not maintain surfaces,
|
|
2849
|
+
process native data-model updates, or provide native A2UI catalog compatibility.
|
|
2850
|
+
|
|
2851
|
+
The result is `A2UiAdapterResult | null`: a widget-compatible `{ version: '2', root }` plus
|
|
2852
|
+
`bindingState` when `surface.data` is present. Assign `bindingState` separately; the widget-v2
|
|
2853
|
+
document itself never supplies controlled state. Explicit `data: null` remains `bindingState: null`.
|
|
2854
|
+
The original `state` field remains an equal compatibility alias in the helper result; renderers
|
|
2855
|
+
do not read it. Input, props, action payloads and state are detached under the adapter budgets.
|
|
2856
|
+
|
|
2857
|
+
```ts
|
|
2858
|
+
import { adaptA2UiSurface } from "@aceshooting/lyra-ui/ai";
|
|
2859
|
+
import "@aceshooting/lyra-ui/components/lr-message-parts.js";
|
|
2860
|
+
import "@aceshooting/lyra-ui/components/lr-input.js";
|
|
2861
|
+
import { createWidgetTypeRegistry } from "@aceshooting/lyra-ui/components/lr-widget-renderer.js";
|
|
2862
|
+
|
|
2863
|
+
const registry = createWidgetTypeRegistry([["field", {
|
|
2864
|
+
tag: "lr-input", interaction: "control", props: { label: "string", value: "string" },
|
|
2865
|
+
bindings: { value: { event: "lr-input" } },
|
|
2866
|
+
}]]);
|
|
2867
|
+
const adapted = adaptA2UiSurface({
|
|
2868
|
+
rootId: "name-field",
|
|
2869
|
+
components: [{ id: "name-field", type: "Field", props: {
|
|
2870
|
+
label: "Name", value: { $bind: "/name" },
|
|
2871
|
+
} }],
|
|
2872
|
+
data: { name: "Ada" },
|
|
2873
|
+
}, { Field: "field" });
|
|
2874
|
+
const message = document.querySelector("lr-message-parts")!;
|
|
2875
|
+
if (adapted) {
|
|
2876
|
+
message.widgetRegistry = registry;
|
|
2877
|
+
message.widgetBindingState = adapted.bindingState;
|
|
2878
|
+
message.parts = [{ id: "name-form", type: "data", widget: adapted.root }];
|
|
2879
|
+
}
|
|
2880
|
+
message.addEventListener("lr-widget-state-change", (event) => {
|
|
2881
|
+
if (event.detail.path === "/name") message.widgetBindingState = { name: event.detail.value };
|
|
2882
|
+
});
|
|
2883
|
+
```
|
|
2884
|
+
|
|
2885
|
+
For host-specific content, keep using `renderPart(part, index)`: return `undefined` to delegate
|
|
2886
|
+
one part, or return a template to replace it and own its interaction. No extra part registry is
|
|
2887
|
+
required. Widget type registries control the existing widget renderer's allowed component types,
|
|
2888
|
+
separately from the message-part rendering hook.
|
|
2889
|
+
|
|
2787
2890
|
### Interrupting and resuming a streamed run
|
|
2788
2891
|
|
|
2789
2892
|
`stream-interrupt` and `stream-resume` are reducer events for the host-owned transport lifecycle;
|
|
@@ -4319,11 +4422,18 @@ These named interfaces and helper signatures are available to typed integrations
|
|
|
4319
4422
|
components: A2UiLikeComponent[];
|
|
4320
4423
|
data?: unknown;
|
|
4321
4424
|
}`
|
|
4322
|
-
`
|
|
4425
|
+
`A2UiAdapterResult {
|
|
4426
|
+
readonly version: '2';
|
|
4427
|
+
readonly root: LyraWidgetNode;
|
|
4428
|
+
readonly bindingState?: unknown;
|
|
4429
|
+
readonly state?: unknown;
|
|
4430
|
+
}`
|
|
4431
|
+
`adaptA2UiSurface(surface: unknown, typeMap: unknown, limits: Partial<A2UiAdapterLimits> = {}): A2UiAdapterResult | null`
|
|
4323
4432
|
|
|
4324
4433
|
- **`ai-adapters-ag-ui-contracts`** — AI adapter and runtime contracts.
|
|
4325
4434
|
`AgUiAdapterLimits {
|
|
4326
4435
|
maxBufferedTools: number;
|
|
4436
|
+
maxBufferedMessages: number;
|
|
4327
4437
|
maxToolArgumentBytes: number;
|
|
4328
4438
|
maxTextDeltaCharacters: number;
|
|
4329
4439
|
maxDepth: number;
|
|
@@ -4345,6 +4455,23 @@ These named interfaces and helper signatures are available to typed integrations
|
|
|
4345
4455
|
code?: string;
|
|
4346
4456
|
snapshot?: unknown;
|
|
4347
4457
|
messages?: unknown[];
|
|
4458
|
+
name?: string;
|
|
4459
|
+
value?: unknown;
|
|
4460
|
+
activityType?: string;
|
|
4461
|
+
content?: unknown;
|
|
4462
|
+
replace?: boolean;
|
|
4463
|
+
patch?: unknown[];
|
|
4464
|
+
}`
|
|
4465
|
+
`AgUiCustomEvent {
|
|
4466
|
+
name: string;
|
|
4467
|
+
value: unknown;
|
|
4468
|
+
}`
|
|
4469
|
+
`AgUiCustomEventTarget {
|
|
4470
|
+
messageId: string;
|
|
4471
|
+
partId: string;
|
|
4472
|
+
}`
|
|
4473
|
+
`AgUiAdapterOptions {
|
|
4474
|
+
customEventTarget?: (event: AgUiCustomEvent) => AgUiCustomEventTarget | null;
|
|
4348
4475
|
}`
|
|
4349
4476
|
|
|
4350
4477
|
- **`ai-adapters-ai-sdk-contracts`** — AI adapter and runtime contracts.
|