@datalayer/agent-runtimes 1.3.25 → 1.3.27

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.
Files changed (38) hide show
  1. package/lib/chat/messages/ChatMessages.d.ts +4 -4
  2. package/lib/chat/messages/ChatMessages.js +17 -17
  3. package/lib/config/AgentConfiguration.js +1 -1
  4. package/lib/examples/example-selector.js +1 -1
  5. package/lib/loop/apps/AppRenderer.js +8 -1
  6. package/lib/loop/apps/checks.d.ts +6 -1
  7. package/lib/loop/apps/checks.js +17 -0
  8. package/lib/loop/embed/LoopEmbed.js +14 -1
  9. package/lib/loop/plugins/chat/ChatView.js +9 -6
  10. package/lib/loop/plugins/chat/index.d.ts +19 -0
  11. package/lib/loop/presets.d.ts +5 -1
  12. package/lib/loop/presets.js +4 -2
  13. package/lib/protocols/A2AAdapter.d.ts +1 -1
  14. package/lib/specs/uiPlugins.d.ts +6 -1
  15. package/lib/specs/uiPlugins.js +471 -0
  16. package/lib/stores/chatStore.d.ts +11 -11
  17. package/lib/stores/chatStore.js +34 -34
  18. package/lib/stores/index.d.ts +1 -1
  19. package/lib/stores/index.js +1 -1
  20. package/lib/types/agentspecs.d.ts +33 -0
  21. package/lib/types/index.d.ts +1 -1
  22. package/lib/types/index.js +1 -1
  23. package/lib/types/{extensions.d.ts → uiPlugins.d.ts} +49 -49
  24. package/lib/types/{extensions.js → uiPlugins.js} +8 -8
  25. package/lib/{extensions/A2UIExtension.d.ts → ui-plugins/A2UIPlugin.d.ts} +7 -7
  26. package/lib/{extensions/A2UIExtension.js → ui-plugins/A2UIPlugin.js} +4 -4
  27. package/lib/{extensions/MCPUIExtension.d.ts → ui-plugins/MCPUIPlugin.d.ts} +9 -9
  28. package/lib/{extensions/MCPUIExtension.js → ui-plugins/MCPUIPlugin.js} +6 -6
  29. package/lib/ui-plugins/UIPluginRegistry.d.ts +65 -0
  30. package/lib/{extensions/ExtensionRegistry.js → ui-plugins/UIPluginRegistry.js} +32 -32
  31. package/lib/ui-plugins/index.d.ts +9 -0
  32. package/lib/ui-plugins/index.js +12 -0
  33. package/package.json +1 -1
  34. package/scripts/codegen/generate_agents.py +6 -6
  35. package/scripts/codegen/generate_ui_plugins.py +64 -4
  36. package/lib/extensions/ExtensionRegistry.d.ts +0 -65
  37. package/lib/extensions/index.d.ts +0 -9
  38. package/lib/extensions/index.js +0 -12
@@ -8,5 +8,5 @@
8
8
  * @module store
9
9
  */
10
10
  export { agentRuntimeStore, useAgentRuntimeStore, useAgentRuntimeConnection, useAgentRuntimeStatus, useAgentRuntimeError, useAgentRuntimeIsLaunching, useAgentRuntimeApprovals, useAgentRuntimePendingCount, useAgentRuntimeMcpStatus, useAgentRuntimeFullContext, useAgentRuntimeContextSnapshot, useAgentRuntimeCostUsage, useAgentRuntimeCodemodeStatus, useAgentRuntimeWsState, useAgentRuntimeLoadedSkills, useAgentRuntimeActiveSubagentToolCallId, useAgentRuntimeRunningSubagentNames, runningSubagentNames, isSubagentRunOver, useAgentRuntimeSubagentActivity, useAgentRuntimeSubagentActivityByToolCall, useAgentRuntimeCompaction, useAgentRuntimeHistoryVersion, getAgentRuntimeState, subscribeToAgentRuntime, } from './agentRuntimeStore';
11
- export { useChatStore, useChatMessages, useChatLoading, useChatStreaming, useChatError, useChatTools, useChatOpen, useChatConfig, useChatReady, useChatInferenceProvider, useChatExtensionRegistry, defaultChatConfig, } from './chatStore';
11
+ export { useChatStore, useChatMessages, useChatLoading, useChatStreaming, useChatError, useChatTools, useChatOpen, useChatConfig, useChatReady, useChatInferenceProvider, useChatUIPluginRegistry, defaultChatConfig, } from './chatStore';
12
12
  export { useConversationStore, useConversationMessages, useNeedsFetch, useIsFetching, } from './conversationStore';
@@ -74,6 +74,35 @@ export interface AgentCapability {
74
74
  /** Free text, for humans reading a catalogue; never matched on. */
75
75
  tags?: string[];
76
76
  }
77
+ /**
78
+ * A visual component a UI plugin renders (LOOP C-13), named as a surface names
79
+ * it. A standard one's properties are its protocol's own; Datalayer's own
80
+ * carry theirs as a JSON Schema, from which its properties form is drawn (C-14).
81
+ */
82
+ export interface ComponentSpec {
83
+ /** The name a surface gives it (e.g. 'Table'). */
84
+ id: string;
85
+ name: string;
86
+ /** What it is for, in a sentence. */
87
+ description: string;
88
+ /** text, input, action, data, conversation, media, layout. */
89
+ category: string;
90
+ /** Its face on the palette. */
91
+ emoji: string;
92
+ /** Its properties are its protocol's own. */
93
+ standard: boolean;
94
+ /** Its properties as a JSON Schema, when it is Datalayer's own. */
95
+ properties?: Record<string, unknown>;
96
+ /** What it can be bound to: what it shows, what it sends. */
97
+ bindings?: {
98
+ shows: string[];
99
+ sends: string[];
100
+ };
101
+ /** What it reports. */
102
+ events: string[];
103
+ /** A valid configuration of it. */
104
+ example?: Record<string, unknown>;
105
+ }
77
106
  /**
78
107
  * How an agent's answer becomes an interface: a protocol the host renders
79
108
  * (`agentspecs/ui-plugins`). An agent spec's `uiPlugin` names one.
@@ -89,6 +118,10 @@ export interface UIPluginSpec {
89
118
  docsUrl: string;
90
119
  /** Whether an agent spec may name it today. */
91
120
  enabled: boolean;
121
+ /** The catalog its components are written in. */
122
+ catalog: string;
123
+ /** The visual components it renders (LOOP C-13). */
124
+ components: ComponentSpec[];
92
125
  }
93
126
  /** A check a Frame requires of the output of work done under it. */
94
127
  export interface FrameGuardSpec {
@@ -17,7 +17,7 @@ export * from './eventspecs';
17
17
  export * from './evals';
18
18
  export * from './examples';
19
19
  export * from './execution';
20
- export * from './extensions';
20
+ export * from './uiPlugins';
21
21
  export * from './guardrails';
22
22
  export * from './inference';
23
23
  export * from './loops';
@@ -21,7 +21,7 @@ export * from './eventspecs';
21
21
  export * from './evals';
22
22
  export * from './examples';
23
23
  export * from './execution';
24
- export * from './extensions';
24
+ export * from './uiPlugins';
25
25
  export * from './guardrails';
26
26
  export * from './inference';
27
27
  export * from './loops';
@@ -1,37 +1,37 @@
1
1
  /**
2
- * Extension types for chat component.
3
- * Extensions add pluggable UI and protocol capabilities.
2
+ * UI plugin types for the chat.
3
+ * UI plugins add pluggable UI and protocol capabilities.
4
4
  *
5
- * @module types/extension
5
+ * @module types/plugin
6
6
  */
7
7
  import type { ReactNode } from 'react';
8
8
  import type { ChatMessage } from './messages';
9
9
  import type { ToolRenderProps } from './tools';
10
10
  import type { ProtocolEvent } from './protocol';
11
11
  /**
12
- * Extension type identifiers
12
+ * UI plugin type identifiers
13
13
  */
14
- export type ExtensionType = 'a2ui' | 'mcp-ui' | 'tool-approval' | 'dev-console' | 'activity' | 'custom';
14
+ export type UIPluginType = 'a2ui' | 'mcp-ui' | 'tool-approval' | 'dev-console' | 'activity' | 'custom';
15
15
  /**
16
- * Extension lifecycle hooks
16
+ * UI plugin lifecycle hooks
17
17
  */
18
- export interface ExtensionLifecycle {
19
- /** Called when extension is registered */
18
+ export interface UIPluginLifecycle {
19
+ /** Called when plugin is registered */
20
20
  onRegister?: () => void;
21
- /** Called when extension is unregistered */
21
+ /** Called when plugin is unregistered */
22
22
  onUnregister?: () => void;
23
23
  /** Called when chat context changes */
24
24
  onContextChange?: (context: unknown) => void;
25
25
  }
26
26
  /**
27
- * Message renderer extension
27
+ * Message renderer plugin
28
28
  * Used to render custom message types (A2UI, activity messages, etc.)
29
29
  */
30
- export interface MessageRendererExtension {
30
+ export interface MessageRendererUIPlugin {
31
31
  type: 'message-renderer';
32
- /** Unique extension name */
32
+ /** Unique plugin name */
33
33
  name: string;
34
- /** Check if this extension can render the message */
34
+ /** Check if this plugin can render the message */
35
35
  canRender: (message: ChatMessage) => boolean;
36
36
  /** Render the message */
37
37
  render: (props: {
@@ -42,14 +42,14 @@ export interface MessageRendererExtension {
42
42
  priority?: number;
43
43
  }
44
44
  /**
45
- * Activity renderer extension
45
+ * Activity renderer plugin
46
46
  * Used to render protocol-specific activity messages
47
47
  */
48
- export interface ActivityRendererExtension {
48
+ export interface ActivityRendererUIPlugin {
49
49
  type: 'activity-renderer';
50
- /** Unique extension name */
50
+ /** Unique plugin name */
51
51
  name: string;
52
- /** Activity types this extension handles */
52
+ /** Activity types this plugin handles */
53
53
  activityTypes: string[];
54
54
  /** Render the activity */
55
55
  render: (props: {
@@ -61,14 +61,14 @@ export interface ActivityRendererExtension {
61
61
  priority?: number;
62
62
  }
63
63
  /**
64
- * Tool UI extension
64
+ * Tool UI plugin
65
65
  * Used to provide custom UI for tool calls (beyond tool's own render)
66
66
  */
67
- export interface ToolUIExtension {
67
+ export interface ToolUIPlugin {
68
68
  type: 'tool-ui';
69
- /** Unique extension name */
69
+ /** Unique plugin name */
70
70
  name: string;
71
- /** Tool names this extension handles (or '*' for all) */
71
+ /** Tool names this plugin handles (or '*' for all) */
72
72
  toolNames: string[] | '*';
73
73
  /** Render custom UI for tool */
74
74
  render: (props: ToolRenderProps & {
@@ -79,14 +79,14 @@ export interface ToolUIExtension {
79
79
  priority?: number;
80
80
  }
81
81
  /**
82
- * Protocol event extension
82
+ * Protocol event plugin
83
83
  * Used to handle custom protocol events
84
84
  */
85
- export interface ProtocolEventExtension {
85
+ export interface ProtocolEventUIPlugin {
86
86
  type: 'protocol-event';
87
- /** Unique extension name */
87
+ /** Unique plugin name */
88
88
  name: string;
89
- /** Event types this extension handles */
89
+ /** Event types this plugin handles */
90
90
  eventTypes: string[];
91
91
  /** Handle the protocol event */
92
92
  handle: (event: ProtocolEvent) => void;
@@ -94,12 +94,12 @@ export interface ProtocolEventExtension {
94
94
  render?: (event: ProtocolEvent) => ReactNode;
95
95
  }
96
96
  /**
97
- * Panel extension
97
+ * Panel plugin
98
98
  * Used to add custom panels (dev console, settings, etc.)
99
99
  */
100
- export interface PanelExtension {
100
+ export interface PanelUIPlugin {
101
101
  type: 'panel';
102
- /** Unique extension name */
102
+ /** Unique plugin name */
103
103
  name: string;
104
104
  /** Panel title */
105
105
  title: string;
@@ -113,30 +113,30 @@ export interface PanelExtension {
113
113
  defaultVisible?: boolean;
114
114
  }
115
115
  /**
116
- * Union type for all extensions
116
+ * Union type for all uiPlugins
117
117
  */
118
- export type ChatExtension = MessageRendererExtension | ActivityRendererExtension | ToolUIExtension | ProtocolEventExtension | PanelExtension;
118
+ export type ChatUIPlugin = MessageRendererUIPlugin | ActivityRendererUIPlugin | ToolUIPlugin | ProtocolEventUIPlugin | PanelUIPlugin;
119
119
  /**
120
- * Extension registration options
120
+ * UI plugin registration options
121
121
  */
122
- export interface ExtensionRegistrationOptions {
123
- /** Replace existing extension with same name */
122
+ export interface UIPluginRegistrationOptions {
123
+ /** Replace existing plugin with same name */
124
124
  replace?: boolean;
125
- /** Enable/disable extension */
125
+ /** Enable/disable plugin */
126
126
  enabled?: boolean;
127
127
  }
128
128
  /**
129
- * Extension registry entry
129
+ * UI plugin registry entry
130
130
  */
131
- export interface ExtensionRegistryEntry {
132
- extension: ChatExtension;
131
+ export interface UIPluginRegistryEntry {
132
+ plugin: ChatUIPlugin;
133
133
  enabled: boolean;
134
134
  registeredAt: Date;
135
135
  }
136
136
  /**
137
- * A2UI specific extension types
137
+ * A2UI specific plugin types
138
138
  */
139
- export declare namespace A2UIExtension {
139
+ export declare namespace A2UIPlugin {
140
140
  /** A2UI surface state */
141
141
  interface Surface {
142
142
  id: string;
@@ -164,18 +164,18 @@ export declare namespace A2UIExtension {
164
164
  }
165
165
  }
166
166
  /**
167
- * Type guard to check extension type
167
+ * Type guard to check plugin type
168
168
  */
169
- export declare function isMessageRendererExtension(ext: ChatExtension): ext is MessageRendererExtension;
170
- export declare function isActivityRendererExtension(ext: ChatExtension): ext is ActivityRendererExtension;
171
- export declare function isToolUIExtension(ext: ChatExtension): ext is ToolUIExtension;
172
- export declare function isProtocolEventExtension(ext: ChatExtension): ext is ProtocolEventExtension;
173
- export declare function isPanelExtension(ext: ChatExtension): ext is PanelExtension;
169
+ export declare function isMessageRendererUIPlugin(ext: ChatUIPlugin): ext is MessageRendererUIPlugin;
170
+ export declare function isActivityRendererUIPlugin(ext: ChatUIPlugin): ext is ActivityRendererUIPlugin;
171
+ export declare function isToolUIPlugin(ext: ChatUIPlugin): ext is ToolUIPlugin;
172
+ export declare function isProtocolEventUIPlugin(ext: ChatUIPlugin): ext is ProtocolEventUIPlugin;
173
+ export declare function isPanelUIPlugin(ext: ChatUIPlugin): ext is PanelUIPlugin;
174
174
  /**
175
- * Helper to create a message renderer extension
175
+ * Helper to create a message renderer plugin
176
176
  */
177
- export declare function createMessageRenderer(name: string, canRender: MessageRendererExtension['canRender'], render: MessageRendererExtension['render'], priority?: number): MessageRendererExtension;
177
+ export declare function createMessageRenderer(name: string, canRender: MessageRendererUIPlugin['canRender'], render: MessageRendererUIPlugin['render'], priority?: number): MessageRendererUIPlugin;
178
178
  /**
179
- * Helper to create an activity renderer extension
179
+ * Helper to create an activity renderer plugin
180
180
  */
181
- export declare function createActivityRenderer(name: string, activityTypes: string[], render: ActivityRendererExtension['render'], priority?: number): ActivityRendererExtension;
181
+ export declare function createActivityRenderer(name: string, activityTypes: string[], render: ActivityRendererUIPlugin['render'], priority?: number): ActivityRendererUIPlugin;
@@ -3,25 +3,25 @@
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
5
  /**
6
- * Type guard to check extension type
6
+ * Type guard to check plugin type
7
7
  */
8
- export function isMessageRendererExtension(ext) {
8
+ export function isMessageRendererUIPlugin(ext) {
9
9
  return ext.type === 'message-renderer';
10
10
  }
11
- export function isActivityRendererExtension(ext) {
11
+ export function isActivityRendererUIPlugin(ext) {
12
12
  return ext.type === 'activity-renderer';
13
13
  }
14
- export function isToolUIExtension(ext) {
14
+ export function isToolUIPlugin(ext) {
15
15
  return ext.type === 'tool-ui';
16
16
  }
17
- export function isProtocolEventExtension(ext) {
17
+ export function isProtocolEventUIPlugin(ext) {
18
18
  return ext.type === 'protocol-event';
19
19
  }
20
- export function isPanelExtension(ext) {
20
+ export function isPanelUIPlugin(ext) {
21
21
  return ext.type === 'panel';
22
22
  }
23
23
  /**
24
- * Helper to create a message renderer extension
24
+ * Helper to create a message renderer plugin
25
25
  */
26
26
  export function createMessageRenderer(name, canRender, render, priority = 0) {
27
27
  return {
@@ -33,7 +33,7 @@ export function createMessageRenderer(name, canRender, render, priority = 0) {
33
33
  };
34
34
  }
35
35
  /**
36
- * Helper to create an activity renderer extension
36
+ * Helper to create an activity renderer plugin
37
37
  */
38
38
  export function createActivityRenderer(name, activityTypes, render, priority = 0) {
39
39
  return {
@@ -1,13 +1,13 @@
1
1
  /**
2
- * A2UI extension for chat component.
2
+ * A2UI plugin for chat component.
3
3
  * Renders A2UI protocol messages from A2A agents using @a2ui/react v0.8.
4
4
  *
5
- * @module components/extensions/A2UIExtension
5
+ * @module components/uiPlugins/A2UIPlugin
6
6
  */
7
7
  import React from 'react';
8
8
  import type { ComponentInstance } from '@a2ui/react';
9
9
  import type { ChatMessage } from '../types/messages';
10
- import type { ActivityRendererExtension, A2UIExtension as A2UIExtensionNamespace } from '../types/extensions';
10
+ import type { ActivityRendererUIPlugin, A2UIPlugin as A2UIPluginNamespace } from '../types/uiPlugins';
11
11
  interface ValueMap {
12
12
  key: string;
13
13
  valueString?: string;
@@ -42,11 +42,11 @@ export interface A2UIMessage {
42
42
  */
43
43
  export declare function createA2UIRenderer(_customRenderers?: Record<string, React.ComponentType<{
44
44
  content: unknown;
45
- }>>): ActivityRendererExtension;
45
+ }>>): ActivityRendererUIPlugin;
46
46
  /**
47
- * A2UI Extension implementation class.
47
+ * A2UI UI plugin implementation class.
48
48
  */
49
- export declare class A2UIExtensionImpl implements ActivityRendererExtension {
49
+ export declare class A2UIPluginImpl implements ActivityRendererUIPlugin {
50
50
  readonly name = "a2ui";
51
51
  readonly type: "activity-renderer";
52
52
  readonly activityTypes: string[];
@@ -62,4 +62,4 @@ export declare class A2UIExtensionImpl implements ActivityRendererExtension {
62
62
  message: ChatMessage;
63
63
  }) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
64
64
  }
65
- export type { A2UIExtensionNamespace };
65
+ export type { A2UIPluginNamespace };
@@ -3,10 +3,10 @@
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
5
  /**
6
- * A2UI extension for chat component.
6
+ * A2UI plugin for chat component.
7
7
  * Renders A2UI protocol messages from A2A agents using @a2ui/react v0.8.
8
8
  *
9
- * @module components/extensions/A2UIExtension
9
+ * @module components/uiPlugins/A2UIPlugin
10
10
  */
11
11
  import React from 'react';
12
12
  import { A2UIViewer, initializeDefaultCatalog } from '@a2ui/react';
@@ -157,9 +157,9 @@ export function createA2UIRenderer(_customRenderers) {
157
157
  };
158
158
  }
159
159
  /**
160
- * A2UI Extension implementation class.
160
+ * A2UI UI plugin implementation class.
161
161
  */
162
- export class A2UIExtensionImpl {
162
+ export class A2UIPluginImpl {
163
163
  name = 'a2ui';
164
164
  type = 'activity-renderer';
165
165
  activityTypes = ['a2ui'];
@@ -1,11 +1,11 @@
1
1
  /**
2
- * MCP-UI extension for chat component.
2
+ * MCP-UI plugin for chat component.
3
3
  * Renders MCP UI protocol messages and resources.
4
4
  *
5
- * @module components/extensions/MCPUIExtension
5
+ * @module components/uiPlugins/MCPUIPlugin
6
6
  */
7
7
  import React from 'react';
8
- import type { ActivityRendererExtension } from '../types/extensions';
8
+ import type { ActivityRendererUIPlugin } from '../types/uiPlugins';
9
9
  /**
10
10
  * MCP-UI resource types
11
11
  */
@@ -50,20 +50,20 @@ export interface MCPUIMessage {
50
50
  */
51
51
  export declare function createMCPUIRenderer(customRenderers?: Record<string, React.ComponentType<{
52
52
  resource: MCPUIResource;
53
- }>>): ActivityRendererExtension;
53
+ }>>): ActivityRendererUIPlugin;
54
54
  /**
55
- * MCP-UI Extension implementation class
55
+ * MCP-UI UI plugin implementation class
56
56
  */
57
- export declare class MCPUIExtensionImpl {
57
+ export declare class MCPUIPluginImpl {
58
58
  private renderer;
59
59
  private customRenderers;
60
60
  constructor(customRenderers?: Record<string, React.ComponentType<{
61
61
  resource: MCPUIResource;
62
62
  }>>);
63
63
  /**
64
- * Get the activity renderer extension
64
+ * Get the activity renderer plugin
65
65
  */
66
- getRenderer(): ActivityRendererExtension;
66
+ getRenderer(): ActivityRendererUIPlugin;
67
67
  /**
68
68
  * Register a custom renderer for a MIME type
69
69
  */
@@ -71,7 +71,7 @@ export declare class MCPUIExtensionImpl {
71
71
  resource: MCPUIResource;
72
72
  }>): void;
73
73
  /**
74
- * Cleanup extension state
74
+ * Cleanup plugin state
75
75
  */
76
76
  cleanup(): void;
77
77
  }
@@ -4,10 +4,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  * Distributed under the terms of the Modified BSD License.
5
5
  */
6
6
  /**
7
- * MCP-UI extension for chat component.
7
+ * MCP-UI plugin for chat component.
8
8
  * Renders MCP UI protocol messages and resources.
9
9
  *
10
- * @module components/extensions/MCPUIExtension
10
+ * @module components/uiPlugins/MCPUIPlugin
11
11
  */
12
12
  import React from 'react';
13
13
  /**
@@ -180,9 +180,9 @@ const UIElement = ({ element, }) => {
180
180
  }, children?.map((child, index) => (_jsx(UIElement, { element: child.uiElement }, index))));
181
181
  };
182
182
  /**
183
- * MCP-UI Extension implementation class
183
+ * MCP-UI UI plugin implementation class
184
184
  */
185
- export class MCPUIExtensionImpl {
185
+ export class MCPUIPluginImpl {
186
186
  renderer;
187
187
  customRenderers;
188
188
  constructor(customRenderers) {
@@ -190,7 +190,7 @@ export class MCPUIExtensionImpl {
190
190
  this.renderer = createMCPUIRenderer(this.customRenderers);
191
191
  }
192
192
  /**
193
- * Get the activity renderer extension
193
+ * Get the activity renderer plugin
194
194
  */
195
195
  getRenderer() {
196
196
  return this.renderer;
@@ -204,7 +204,7 @@ export class MCPUIExtensionImpl {
204
204
  this.renderer = createMCPUIRenderer(this.customRenderers);
205
205
  }
206
206
  /**
207
- * Cleanup extension state
207
+ * Cleanup plugin state
208
208
  */
209
209
  cleanup() {
210
210
  // Context cleanup handled by renderer garbage collection
@@ -0,0 +1,65 @@
1
+ /**
2
+ * UI plugin registry for the chat.
3
+ * Manages custom renderers and plugin points.
4
+ *
5
+ * @module components/uiPlugins/UIPluginRegistry
6
+ */
7
+ import type { ChatUIPlugin, MessageRendererUIPlugin, ActivityRendererUIPlugin, ToolUIPlugin, ProtocolEventUIPlugin, PanelUIPlugin } from '../types/uiPlugins';
8
+ /** Internal plugin type for registry organization */
9
+ export type InternalUIPluginType = 'message-renderer' | 'activity-renderer' | 'tool-ui' | 'protocol-event' | 'panel';
10
+ /**
11
+ * UI plugin registry class
12
+ */
13
+ export declare class UIPluginRegistry {
14
+ private uiPlugins;
15
+ private byType;
16
+ constructor();
17
+ /**
18
+ * Register an plugin
19
+ */
20
+ register(plugin: ChatUIPlugin): void;
21
+ /**
22
+ * Unregister an plugin
23
+ */
24
+ unregister(pluginName: string): void;
25
+ /**
26
+ * Get an plugin by name
27
+ */
28
+ get<T extends ChatUIPlugin>(pluginName: string): T | undefined;
29
+ /**
30
+ * Get all uiPlugins of a specific type
31
+ */
32
+ getByType<T extends ChatUIPlugin>(type: InternalUIPluginType): T[];
33
+ /**
34
+ * Get all registered uiPlugins
35
+ */
36
+ getAll(): ChatUIPlugin[];
37
+ /**
38
+ * Check if an plugin is registered
39
+ */
40
+ has(pluginName: string): boolean;
41
+ /**
42
+ * Get message renderers
43
+ */
44
+ getMessageRenderers(): MessageRendererUIPlugin[];
45
+ /**
46
+ * Get activity renderer for a specific activity type
47
+ */
48
+ getActivityRenderer(activityType: string): ActivityRendererUIPlugin | undefined;
49
+ /**
50
+ * Get tool UI for a specific tool
51
+ */
52
+ getToolUI(toolName: string): ToolUIPlugin | undefined;
53
+ /**
54
+ * Get all panels
55
+ */
56
+ getPanels(): PanelUIPlugin[];
57
+ /**
58
+ * Get protocol event handlers for an event type
59
+ */
60
+ getProtocolEventHandlers(eventType: string): ProtocolEventUIPlugin[];
61
+ /**
62
+ * Clear all uiPlugins
63
+ */
64
+ clear(): void;
65
+ }
@@ -3,22 +3,22 @@
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
5
  /**
6
- * Get the internal type string from an extension
6
+ * Get the internal type string from an plugin
7
7
  */
8
- function getExtensionType(ext) {
8
+ function getUIPluginType(ext) {
9
9
  return ext.type;
10
10
  }
11
11
  /**
12
- * Get the name from an extension
12
+ * Get the name from an plugin
13
13
  */
14
- function getExtensionName(ext) {
14
+ function getUIPluginName(ext) {
15
15
  return ext.name;
16
16
  }
17
17
  /**
18
- * Extension registry class
18
+ * UI plugin registry class
19
19
  */
20
- export class ExtensionRegistry {
21
- extensions = new Map();
20
+ export class UIPluginRegistry {
21
+ uiPlugins = new Map();
22
22
  byType = new Map();
23
23
  constructor() {
24
24
  // Initialize type maps
@@ -34,52 +34,52 @@ export class ExtensionRegistry {
34
34
  }
35
35
  }
36
36
  /**
37
- * Register an extension
37
+ * Register an plugin
38
38
  */
39
- register(extension) {
40
- const name = getExtensionName(extension);
41
- if (this.extensions.has(name)) {
42
- console.warn(`[ExtensionRegistry] Extension ${name} already registered, replacing`);
39
+ register(plugin) {
40
+ const name = getUIPluginName(plugin);
41
+ if (this.uiPlugins.has(name)) {
42
+ console.warn(`[UIPluginRegistry] UI plugin ${name} already registered, replacing`);
43
43
  }
44
- this.extensions.set(name, extension);
45
- this.byType.get(getExtensionType(extension))?.add(name);
44
+ this.uiPlugins.set(name, plugin);
45
+ this.byType.get(getUIPluginType(plugin))?.add(name);
46
46
  }
47
47
  /**
48
- * Unregister an extension
48
+ * Unregister an plugin
49
49
  */
50
- unregister(extensionName) {
51
- const extension = this.extensions.get(extensionName);
52
- if (extension) {
53
- this.byType.get(getExtensionType(extension))?.delete(extensionName);
54
- this.extensions.delete(extensionName);
50
+ unregister(pluginName) {
51
+ const plugin = this.uiPlugins.get(pluginName);
52
+ if (plugin) {
53
+ this.byType.get(getUIPluginType(plugin))?.delete(pluginName);
54
+ this.uiPlugins.delete(pluginName);
55
55
  }
56
56
  }
57
57
  /**
58
- * Get an extension by name
58
+ * Get an plugin by name
59
59
  */
60
- get(extensionName) {
61
- return this.extensions.get(extensionName);
60
+ get(pluginName) {
61
+ return this.uiPlugins.get(pluginName);
62
62
  }
63
63
  /**
64
- * Get all extensions of a specific type
64
+ * Get all uiPlugins of a specific type
65
65
  */
66
66
  getByType(type) {
67
67
  const names = this.byType.get(type) || new Set();
68
68
  return Array.from(names)
69
- .map(name => this.extensions.get(name))
69
+ .map(name => this.uiPlugins.get(name))
70
70
  .filter(ext => ext !== undefined);
71
71
  }
72
72
  /**
73
- * Get all registered extensions
73
+ * Get all registered uiPlugins
74
74
  */
75
75
  getAll() {
76
- return Array.from(this.extensions.values());
76
+ return Array.from(this.uiPlugins.values());
77
77
  }
78
78
  /**
79
- * Check if an extension is registered
79
+ * Check if an plugin is registered
80
80
  */
81
- has(extensionName) {
82
- return this.extensions.has(extensionName);
81
+ has(pluginName) {
82
+ return this.uiPlugins.has(pluginName);
83
83
  }
84
84
  /**
85
85
  * Get message renderers
@@ -115,10 +115,10 @@ export class ExtensionRegistry {
115
115
  return handlers.filter(h => h.eventTypes.includes(eventType) || h.eventTypes.includes('*'));
116
116
  }
117
117
  /**
118
- * Clear all extensions
118
+ * Clear all uiPlugins
119
119
  */
120
120
  clear() {
121
- this.extensions.clear();
121
+ this.uiPlugins.clear();
122
122
  for (const set of this.byType.values()) {
123
123
  set.clear();
124
124
  }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * UI plugin exports for the chat: how an agent's answer becomes an interface (A2UI, MCP UI).
3
+ *
4
+ * @module components/uiPlugins
5
+ */
6
+ export { UIPluginRegistry } from './UIPluginRegistry';
7
+ export type { InternalUIPluginType } from './UIPluginRegistry';
8
+ export { createA2UIRenderer, A2UIPluginImpl, type A2UIMessage, } from './A2UIPlugin';
9
+ export { createMCPUIRenderer, MCPUIPluginImpl, type MCPUIMessage, type MCPUIResource, } from './MCPUIPlugin';