@adia-ai/a2ui-runtime 0.6.2 → 0.6.6

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog — @adia-ai/a2ui-runtime
2
2
 
3
+ ## [0.6.6] — 2026-05-18
4
+
5
+ ### Changed
6
+ - Lockstep version bump for §304 `<field-ui align>` prop.
7
+ ## [0.6.5] — 2026-05-18
8
+
9
+ ### Changed
10
+ - Lockstep version bump for TS Phase 6 sealing (ADR-0029).
3
11
  Follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
4
12
  [Semantic Versioning](https://semver.org/).
5
13
 
@@ -12,6 +20,28 @@ Follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
12
20
 
13
21
  _No pending changes._
14
22
 
23
+ ## [0.6.4] - 2026-05-18
24
+
25
+ ### v0.6.4 §359 — TypeScript-first Phase 5: `a2ui.schema.json` + schema-driven codegen
26
+
27
+ `packages/a2ui/runtime/a2ui.schema.json` — JSON Schema 2020-12 for the full A2UI protocol.
28
+ `scripts/build/a2ui-schema-types.mjs` codegen emits `a2ui.schema.d.ts` from schema.
29
+ `npm run verify:a2ui-schema` drift-detection gate added to `npm run check`.
30
+ `./schema` + `./types` subpath exports added. `types.d.ts` now re-exports from schema.
31
+ **No BREAKING changes.**
32
+
33
+
34
+
35
+ ## [0.6.3] - 2026-05-18
36
+
37
+ ### v0.6.3 §358 — TypeScript-first Phase 5: real `.d.ts` + `A2UIMessage` discriminated union
38
+
39
+ 18 real declaration files replace Phase 1 `export {}` stubs across runtime, dockables,
40
+ surface-manifest, and wiring-registry. `A2UIMessage` discriminated union added.
41
+ `index.ts` typed barrel. **No BREAKING changes.**
42
+
43
+
44
+
15
45
  ## [0.6.2] - 2026-05-18
16
46
 
17
47
  ### v0.6.2 — Lockstep ride-along
@@ -0,0 +1,169 @@
1
+ // AUTO-GENERATED FROM packages/a2ui/runtime/a2ui.schema.json. DO NOT EDIT.
2
+ // Regenerate with: node scripts/build/a2ui-schema-types.mjs
3
+ // Verify drift with: node scripts/build/a2ui-schema-types.mjs --verify
4
+
5
+ /**
6
+ * Any valid A2UI protocol message. Discriminated on `type`.
7
+ */
8
+ export type A2UIMessage =
9
+ | CreateSurfaceMessage
10
+ | UpdateComponentsMessage
11
+ | UpdateDataModelMessage
12
+ | WireComponentsMessage
13
+ | DeleteSurfaceMessage
14
+ | MetaMessage;
15
+
16
+ /**
17
+ * Initialises a new rendering surface.
18
+ */
19
+ export interface CreateSurfaceMessage {
20
+ type: 'createSurface';
21
+ /**
22
+ * Unique surface identifier.
23
+ */
24
+ surfaceId: string;
25
+ /**
26
+ * Optional catalog URL override for this surface.
27
+ */
28
+ catalogId?: string;
29
+ /**
30
+ * Component ID to use as the surface root (defaults to 'root').
31
+ */
32
+ root?: string;
33
+ }
34
+ /**
35
+ * Upserts component nodes on a surface. The renderer reconciles against existing nodes.
36
+ */
37
+ export interface UpdateComponentsMessage {
38
+ type: 'updateComponents';
39
+ /**
40
+ * Legacy alias for type; renderer accepts both.
41
+ */
42
+ messageType?: string;
43
+ surfaceId: string;
44
+ /**
45
+ * @minItems 1
46
+ */
47
+ components: [A2UIComponent, ...A2UIComponent[]];
48
+ }
49
+ /**
50
+ * A single component node in the A2UI component tree.
51
+ */
52
+ export interface A2UIComponent {
53
+ /**
54
+ * Unique identifier within the surface.
55
+ */
56
+ id: string;
57
+ /**
58
+ * A2UI type name — resolved via the registry to a custom-element tag name.
59
+ */
60
+ component: string;
61
+ /**
62
+ * Ordered list of child component IDs.
63
+ */
64
+ children?: string[];
65
+ /**
66
+ * Single child component ID (shorthand when there is exactly one child).
67
+ */
68
+ child?: string;
69
+ [k: string]: unknown;
70
+ }
71
+ /**
72
+ * Updates the surface data model at a JSON Pointer path.
73
+ */
74
+ export interface UpdateDataModelMessage {
75
+ type: 'updateDataModel';
76
+ surfaceId: string;
77
+ /**
78
+ * JSON Pointer path within the data model (e.g. '/user/name'). '/' or '' = replace root.
79
+ */
80
+ path: string;
81
+ value: unknown;
82
+ }
83
+ /**
84
+ * Attaches interactive behaviour (actions, data sources, controllers) to a surface.
85
+ */
86
+ export interface WireComponentsMessage {
87
+ type: 'wireComponents';
88
+ surfaceId: string;
89
+ /**
90
+ * Event → handler bindings.
91
+ */
92
+ actions?: WireAction[];
93
+ /**
94
+ * Data-source dockables.
95
+ */
96
+ data?: WireDataSource[];
97
+ /**
98
+ * Controller dockables.
99
+ */
100
+ state?: WireState[];
101
+ /**
102
+ * Lifecycle hook dockables.
103
+ */
104
+ lifecycle?: {
105
+ [k: string]: unknown;
106
+ }[];
107
+ }
108
+ /**
109
+ * An event → handler binding for interactive wiring.
110
+ */
111
+ export interface WireAction {
112
+ /**
113
+ * The UIEvent that triggers this action.
114
+ */
115
+ event:
116
+ | string
117
+ | {
118
+ event: string;
119
+ /**
120
+ * Component ID that emits the event.
121
+ */
122
+ target?: string;
123
+ debounce?: number;
124
+ };
125
+ /**
126
+ * Handler name registered in the wiring registry.
127
+ */
128
+ handler: string;
129
+ /**
130
+ * Handler-specific configuration.
131
+ */
132
+ config?: {
133
+ [k: string]: unknown;
134
+ };
135
+ }
136
+ /**
137
+ * A data-source dockable: connects a model path to a component property.
138
+ */
139
+ export interface WireDataSource {
140
+ source: string;
141
+ target: string;
142
+ transform?: string;
143
+ [k: string]: unknown;
144
+ }
145
+ /**
146
+ * A controller dockable: attaches a stateful controller to a component.
147
+ */
148
+ export interface WireState {
149
+ controller: string;
150
+ target: string;
151
+ config?: {
152
+ [k: string]: unknown;
153
+ };
154
+ [k: string]: unknown;
155
+ }
156
+ /**
157
+ * Removes a surface and all its elements from the DOM.
158
+ */
159
+ export interface DeleteSurfaceMessage {
160
+ type: 'deleteSurface';
161
+ surfaceId: string;
162
+ }
163
+ /**
164
+ * LLM self-critique or metadata. Not rendered; passed through for logging.
165
+ */
166
+ export interface MetaMessage {
167
+ type: 'meta';
168
+ [k: string]: unknown;
169
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * ActionDock — Binds a UIEvent on a component to a handler function.
3
+ */
4
+
5
+ import type { Dockable } from './base.js';
6
+ import type { SurfaceContext } from '../surface.js';
7
+
8
+ /** Mapping of A2UI semantic event names to DOM event names. */
9
+ export declare const A2UI_EVENT_TO_DOM: Record<string, string>;
10
+
11
+ export interface UIEventDecl {
12
+ /** A2UI semantic event name (press, submit, input, change, …). */
13
+ event: string;
14
+ /** Component ID to listen on. Defaults to the surface root. */
15
+ target?: string;
16
+ /** Debounce delay in ms. */
17
+ debounce?: number;
18
+ /** Throttle interval in ms. */
19
+ throttle?: number;
20
+ /** Optional condition guard. */
21
+ condition?: {
22
+ path: string;
23
+ equals?: unknown;
24
+ notEquals?: unknown;
25
+ exists?: boolean;
26
+ };
27
+ }
28
+
29
+ export interface ActionDecl {
30
+ /** DOM event descriptor. */
31
+ event: UIEventDecl;
32
+ /** Handler name from the wiring registry. */
33
+ handler: string;
34
+ config?: Record<string, unknown>;
35
+ onSuccess?: Array<{ handler: string; config?: Record<string, unknown> }> | null;
36
+ onError?: Array<{ handler: string; config?: Record<string, unknown> }> | null;
37
+ }
38
+
39
+ export declare class ActionDock extends Dockable {
40
+ readonly kind: 'action';
41
+ readonly id: string;
42
+ readonly event: UIEventDecl;
43
+ readonly handler: string;
44
+ readonly config: Record<string, unknown>;
45
+ readonly onSuccess: Array<{ handler: string; config?: Record<string, unknown> }> | null;
46
+ readonly onError: Array<{ handler: string; config?: Record<string, unknown> }> | null;
47
+
48
+ constructor(
49
+ decl: ActionDecl,
50
+ resolveHandler: (name: string) => ((config: unknown, ctx: SurfaceContext, event: unknown) => Promise<unknown>) | null,
51
+ );
52
+
53
+ dock(ctx: SurfaceContext): (() => void) | void;
54
+ undock(): void;
55
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Dockable — Base class for objects that attach to a Surface.
3
+ */
4
+
5
+ import type { SurfaceContext } from '../surface.js';
6
+
7
+ /** The kinds of dockable objects. */
8
+ export type DockableKind = 'controller' | 'source' | 'action' | 'provider' | 'lifecycle';
9
+
10
+ export declare abstract class Dockable {
11
+ /** Port type — determines dock ordering. */
12
+ abstract readonly kind: DockableKind;
13
+
14
+ /** Unique identifier within the surface. */
15
+ abstract readonly id: string;
16
+
17
+ /**
18
+ * Attach to a surface. Return a cleanup function, or void.
19
+ */
20
+ dock(ctx: SurfaceContext): (() => void) | void;
21
+
22
+ /**
23
+ * Detach from the surface. The cleanup fn from dock() is called first.
24
+ */
25
+ undock(): void;
26
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * ControllerDock — Wraps an AdiaUI controller as a dockable.
3
+ */
4
+
5
+ import type { Dockable } from './base.js';
6
+ import type { SurfaceContext } from '../surface.js';
7
+
8
+ export interface ControllerDecl {
9
+ id: string;
10
+ /** Controller type name, e.g. 'FormController'. */
11
+ type: string;
12
+ /** Component ID of the host element to attach to. */
13
+ host: string;
14
+ config?: Record<string, unknown>;
15
+ /** Model path bindings: { stateKey: '/model/path' } */
16
+ bind?: Record<string, string> | null;
17
+ }
18
+
19
+ export declare class ControllerDock extends Dockable {
20
+ readonly kind: 'controller';
21
+ readonly id: string;
22
+ readonly type: string;
23
+ readonly hostId: string;
24
+ readonly config: Record<string, unknown>;
25
+ readonly bind: Record<string, string> | null;
26
+ controller: unknown | null;
27
+
28
+ constructor(
29
+ decl: ControllerDecl,
30
+ resolveClass: (type: string) => Promise<(new (...args: unknown[]) => unknown) | null>,
31
+ );
32
+
33
+ dock(ctx: SurfaceContext): Promise<(() => void) | void>;
34
+ undock(): void;
35
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * DataSourceDock — Fetches data and pushes it into the surface model.
3
+ */
4
+
5
+ import type { Dockable } from './base.js';
6
+ import type { SurfaceContext } from '../surface.js';
7
+
8
+ export interface DataSourceDecl {
9
+ id: string;
10
+ /** URI template, e.g., "resource://users/{userId}" */
11
+ uri: string;
12
+ /** Model path to write fetched data to. */
13
+ path: string;
14
+ /** Refresh strategy: 'once' | 'on-focus' | 'interval:<ms>' | 'stream'. Default: 'once'. */
15
+ refresh?: string;
16
+ }
17
+
18
+ export declare class DataSourceDock extends Dockable {
19
+ readonly kind: 'source';
20
+ readonly id: string;
21
+ readonly uri: string;
22
+ readonly path: string;
23
+ readonly refresh: string;
24
+
25
+ constructor(
26
+ decl: DataSourceDecl,
27
+ resolveData: (uri: string, ctx: unknown) => Promise<unknown>,
28
+ );
29
+
30
+ dock(ctx: SurfaceContext): (() => void) | void;
31
+ undock(): void;
32
+
33
+ /** Manually re-fetch the data source. */
34
+ refetch(): void;
35
+ }
@@ -1,4 +1,21 @@
1
- // v0.5.21 hotfix stub — TS-migration Phase 1 (568bb998d) declared this
2
- // types: export but Phase 2 hasn't generated real declarations yet.
3
- // Replace with real type declarations when Phase 2 lands.
4
- export {};
1
+ /**
2
+ * Dockables barrel re-exports all dockable classes and the event mapping.
3
+ */
4
+
5
+ export { Dockable } from './base.js';
6
+ export type { DockableKind } from './base.js';
7
+
8
+ export { ControllerDock } from './controller.js';
9
+ export type { ControllerDecl } from './controller.js';
10
+
11
+ export { DataSourceDock } from './data-source.js';
12
+ export type { DataSourceDecl } from './data-source.js';
13
+
14
+ export { ActionDock, A2UI_EVENT_TO_DOM } from './action.js';
15
+ export type { ActionDecl, UIEventDecl } from './action.js';
16
+
17
+ export { ProviderDock } from './provider.js';
18
+ export type { ProviderDecl } from './provider.js';
19
+
20
+ export { LifecycleDock } from './lifecycle.js';
21
+ export type { LifecycleDecl, LifecycleAction, ModelChangeWatcher } from './lifecycle.js';
@@ -0,0 +1,38 @@
1
+ /**
2
+ * LifecycleDock — Runs actions on mount, unmount, and model changes.
3
+ */
4
+
5
+ import type { Dockable } from './base.js';
6
+ import type { SurfaceContext } from '../surface.js';
7
+
8
+ export interface LifecycleAction {
9
+ handler: string;
10
+ config?: Record<string, unknown>;
11
+ }
12
+
13
+ export interface ModelChangeWatcher extends LifecycleAction {
14
+ path: string;
15
+ debounce?: number;
16
+ }
17
+
18
+ export interface LifecycleDecl {
19
+ onMount?: LifecycleAction[];
20
+ onUnmount?: LifecycleAction[];
21
+ onModelChange?: ModelChangeWatcher[];
22
+ }
23
+
24
+ export declare class LifecycleDock extends Dockable {
25
+ readonly kind: 'lifecycle';
26
+ readonly id: 'lifecycle';
27
+ readonly onMount: LifecycleAction[];
28
+ readonly onUnmount: LifecycleAction[];
29
+ readonly onModelChange: ModelChangeWatcher[];
30
+
31
+ constructor(
32
+ decl: LifecycleDecl,
33
+ resolveHandler: (name: string) => ((config: unknown, ctx: SurfaceContext) => Promise<unknown>) | null,
34
+ );
35
+
36
+ dock(ctx: SurfaceContext): (() => void) | void;
37
+ undock(): void;
38
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * ProviderDock — Injects shared context into a component subtree.
3
+ */
4
+
5
+ import type { Dockable } from './base.js';
6
+ import type { SurfaceContext } from '../surface.js';
7
+
8
+ export interface ProviderDecl {
9
+ /** Context name, e.g. "auth". The dock id is set to "provider:<name>". */
10
+ name: string;
11
+ /** Component ID to wrap. Defaults to the surface root. */
12
+ host?: string;
13
+ /** Initial context value. */
14
+ value?: unknown;
15
+ }
16
+
17
+ export declare class ProviderDock extends Dockable {
18
+ readonly kind: 'provider';
19
+ /** "provider:<name>" */
20
+ readonly id: string;
21
+ readonly hostId: string | null;
22
+ readonly value: unknown;
23
+
24
+ constructor(decl: ProviderDecl);
25
+
26
+ dock(ctx: SurfaceContext): (() => void) | void;
27
+ undock(): void;
28
+ }
package/index.js CHANGED
@@ -1,45 +1,51 @@
1
- /**
2
- * @adia-ai/a2ui-runtime A2UI runtime surface.
3
- *
4
- * Framework-agnostic leaf: no runtime dep on @adia-ai/web-components.
5
- * Pairs with any A2UI-conformant custom-element catalog.
6
- *
7
- * Tier 1 Render: resolve A2UI protocol → custom-element tags, run the
8
- * renderer, consume transports.
9
- *
10
- * Tier 2 — Wire: surface-manifest + wiring-engine + dockable primitives
11
- * for cross-surface data flow and lifecycle.
12
- */
13
-
14
- // ── Tier 1: Render ─────────────────────────────────────────────────
15
- export { registry, resolveTag, registerType } from './registry.js';
16
- export { A2UIRenderer } from './renderer.js';
17
- export { sseStream, wsStream, mockStream, mcpStream, jsonlStream } from './stream.js';
18
-
19
- // ── Tier 2: Wire ───────────────────────────────────────────────────
20
- export { SurfaceManifest } from './surface-manifest.js';
21
- export { Surface } from './surface.js';
22
-
23
- // Wiring primitives
24
- export { createDockables } from './wire-factory.js';
25
- export { WiringEngine } from './wiring-engine.js';
26
- export {
1
+ import { registry, resolveTag, registerType } from "./registry.js";
2
+ import { A2UIRenderer } from "./renderer.js";
3
+ import { sseStream, wsStream, mockStream, mcpStream, jsonlStream } from "./stream.js";
4
+ import { SurfaceManifest } from "./surface-manifest.js";
5
+ import { Surface } from "./surface.js";
6
+ import { createDockables } from "./wire-factory.js";
7
+ import { WiringEngine } from "./wiring-engine.js";
8
+ import {
27
9
  wiringRegistry,
28
10
  registerController,
29
11
  registerHandler,
30
12
  registerResolver,
31
13
  resolveController,
32
14
  resolveHandler,
33
- resolveData,
34
- } from './wiring-registry.js';
35
-
36
- // Dockable base + implementations
15
+ resolveData
16
+ } from "./wiring-registry.js";
17
+ import { Dockable } from "./dockables/base.js";
18
+ import { ControllerDock } from "./dockables/controller.js";
19
+ import { DataSourceDock } from "./dockables/data-source.js";
20
+ import { ActionDock, A2UI_EVENT_TO_DOM } from "./dockables/action.js";
21
+ import { ProviderDock } from "./dockables/provider.js";
22
+ import { LifecycleDock } from "./dockables/lifecycle.js";
37
23
  export {
38
- Dockable,
24
+ A2UIRenderer,
25
+ A2UI_EVENT_TO_DOM,
26
+ ActionDock,
39
27
  ControllerDock,
40
28
  DataSourceDock,
41
- ActionDock,
42
- A2UI_EVENT_TO_DOM,
43
- ProviderDock,
29
+ Dockable,
44
30
  LifecycleDock,
45
- } from './dockables/index.js';
31
+ ProviderDock,
32
+ Surface,
33
+ SurfaceManifest,
34
+ WiringEngine,
35
+ createDockables,
36
+ jsonlStream,
37
+ mcpStream,
38
+ mockStream,
39
+ registerController,
40
+ registerHandler,
41
+ registerResolver,
42
+ registerType,
43
+ registry,
44
+ resolveController,
45
+ resolveData,
46
+ resolveHandler,
47
+ resolveTag,
48
+ sseStream,
49
+ wiringRegistry,
50
+ wsStream
51
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adia-ai/a2ui-runtime",
3
- "version": "0.6.2",
3
+ "version": "0.6.6",
4
4
  "description": "A2UI runtime \u2014 renderer, registry, streams, surface manifest, and wiring primitives for the A2UI (Agent-to-UI) protocol. Framework-agnostic; pairs with any A2UI-conformant component set.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -38,6 +38,14 @@
38
38
  "types": "./dockables/index.d.ts",
39
39
  "import": "./dockables/index.js",
40
40
  "default": "./dockables/index.js"
41
+ },
42
+ "./schema": {
43
+ "types": "./a2ui.schema.d.ts",
44
+ "default": "./a2ui.schema.d.ts"
45
+ },
46
+ "./types": {
47
+ "types": "./types.d.ts",
48
+ "default": "./types.d.ts"
41
49
  }
42
50
  },
43
51
  "files": [
@@ -45,7 +53,9 @@
45
53
  "dockables/",
46
54
  "controllers/",
47
55
  "README.md",
48
- "CHANGELOG.md"
56
+ "CHANGELOG.md",
57
+ "a2ui.schema.d.ts",
58
+ "types.d.ts"
49
59
  ],
50
60
  "publishConfig": {
51
61
  "access": "public",
package/types.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ // AUTO-GENERATED re-export: runtime/types.d.ts now delegates to the schema codegen.
2
+ // The schema (a2ui.schema.json) is the authoritative source for A2UIMessage shapes.
3
+ // Regenerate with: node scripts/build/a2ui-schema-types.mjs
4
+
5
+ export type {
6
+ A2UIMessage,
7
+ A2UIComponent,
8
+ CreateSurfaceMessage,
9
+ UpdateComponentsMessage,
10
+ UpdateDataModelMessage,
11
+ WireComponentsMessage,
12
+ WireAction,
13
+ WireDataSource,
14
+ WireState,
15
+ DeleteSurfaceMessage,
16
+ MetaMessage,
17
+ } from './a2ui.schema.js';
18
+
19
+ /** String literal union of all valid A2UI message type discriminators. */
20
+ export type A2UIMessageType =
21
+ | 'createSurface'
22
+ | 'updateComponents'
23
+ | 'updateDataModel'
24
+ | 'wireComponents'
25
+ | 'deleteSurface'
26
+ | 'meta';