openbot 0.3.5 → 0.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.
Files changed (98) hide show
  1. package/README.md +15 -16
  2. package/dist/app/agent-ids.js +4 -0
  3. package/dist/app/cli.js +1 -1
  4. package/dist/app/config.js +0 -19
  5. package/dist/app/server.js +8 -14
  6. package/dist/assets/icon.svg +9 -3
  7. package/dist/bus/services.js +78 -132
  8. package/dist/harness/agent-invoke-run.js +44 -0
  9. package/dist/harness/agent-turn.js +99 -0
  10. package/dist/harness/channel-participants.js +40 -0
  11. package/dist/harness/constants.js +2 -0
  12. package/dist/harness/context-meter.js +97 -0
  13. package/dist/harness/context.js +98 -45
  14. package/dist/harness/dispatch.js +144 -0
  15. package/dist/harness/dispatcher.js +45 -156
  16. package/dist/harness/history.js +177 -0
  17. package/dist/harness/index.js +91 -0
  18. package/dist/harness/orchestration.js +88 -0
  19. package/dist/harness/participants.js +22 -0
  20. package/dist/harness/run-harness.js +154 -0
  21. package/dist/harness/run.js +98 -0
  22. package/dist/harness/runtime-factory.js +0 -34
  23. package/dist/harness/runtime.js +57 -0
  24. package/dist/harness/todo-dispatch.js +51 -0
  25. package/dist/harness/todos.js +5 -0
  26. package/dist/harness/turn.js +79 -0
  27. package/dist/plugins/approval/index.js +105 -149
  28. package/dist/plugins/delegation/index.js +119 -32
  29. package/dist/plugins/memory/index.js +103 -14
  30. package/dist/plugins/memory/service.js +152 -0
  31. package/dist/plugins/openbot/context.js +80 -0
  32. package/dist/plugins/openbot/history.js +98 -0
  33. package/dist/plugins/openbot/index.js +31 -0
  34. package/dist/plugins/openbot/runtime.js +317 -0
  35. package/dist/plugins/openbot/system-prompt.js +5 -0
  36. package/dist/plugins/plugin-manager/index.js +105 -0
  37. package/dist/plugins/storage/index.js +573 -0
  38. package/dist/plugins/storage/service.js +1159 -0
  39. package/dist/plugins/storage-tools/index.js +2 -2
  40. package/dist/plugins/thread-namer/index.js +72 -0
  41. package/dist/plugins/thread-naming/generate-title.js +44 -0
  42. package/dist/plugins/thread-naming/index.js +103 -0
  43. package/dist/plugins/threads/index.js +114 -0
  44. package/dist/plugins/todo/index.js +24 -25
  45. package/dist/plugins/ui/index.js +2 -32
  46. package/dist/registry/plugins.js +3 -9
  47. package/dist/services/plugins/domain.js +1 -0
  48. package/dist/services/plugins/plugin-cache.js +9 -0
  49. package/dist/services/plugins/registry.js +110 -0
  50. package/dist/services/plugins/service.js +177 -0
  51. package/dist/services/plugins/types.js +1 -0
  52. package/dist/services/process.js +29 -0
  53. package/dist/services/storage.js +41 -15
  54. package/dist/services/thread-naming.js +81 -0
  55. package/docs/agents.md +16 -10
  56. package/docs/architecture.md +2 -2
  57. package/docs/plugins.md +6 -15
  58. package/docs/templates/AGENT.example.md +7 -13
  59. package/package.json +1 -2
  60. package/src/app/agent-ids.ts +5 -0
  61. package/src/app/cli.ts +1 -1
  62. package/src/app/config.ts +1 -31
  63. package/src/app/server.ts +8 -16
  64. package/src/app/types.ts +70 -190
  65. package/src/assets/icon.svg +9 -3
  66. package/src/harness/index.ts +145 -0
  67. package/src/plugins/approval/index.ts +91 -189
  68. package/src/plugins/delegation/index.ts +136 -39
  69. package/src/plugins/memory/index.ts +112 -15
  70. package/src/{services/memory.ts → plugins/memory/service.ts} +1 -1
  71. package/src/plugins/openbot/context.ts +91 -0
  72. package/src/plugins/openbot/history.ts +107 -0
  73. package/src/plugins/openbot/index.ts +37 -0
  74. package/src/plugins/openbot/runtime.ts +384 -0
  75. package/src/plugins/openbot/system-prompt.ts +7 -0
  76. package/src/plugins/plugin-manager/index.ts +122 -0
  77. package/src/plugins/shell/index.ts +1 -1
  78. package/src/plugins/storage/index.ts +633 -0
  79. package/src/{services/storage.ts → plugins/storage/service.ts} +257 -72
  80. package/src/{bus/types.ts → services/plugins/domain.ts} +20 -7
  81. package/src/services/plugins/plugin-cache.ts +13 -0
  82. package/src/{registry/plugins.ts → services/plugins/registry.ts} +25 -27
  83. package/src/services/{plugins.ts → plugins/service.ts} +96 -2
  84. package/src/{bus/plugin.ts → services/plugins/types.ts} +3 -3
  85. package/src/bus/services.ts +0 -908
  86. package/src/harness/context.ts +0 -356
  87. package/src/harness/dispatcher.ts +0 -379
  88. package/src/harness/mcp.ts +0 -78
  89. package/src/harness/runtime-factory.ts +0 -129
  90. package/src/harness/todo-advance.ts +0 -128
  91. package/src/plugins/ai-sdk/index.ts +0 -41
  92. package/src/plugins/ai-sdk/runtime.ts +0 -468
  93. package/src/plugins/ai-sdk/system-prompt.ts +0 -18
  94. package/src/plugins/mcp/index.ts +0 -128
  95. package/src/plugins/storage-tools/index.ts +0 -90
  96. package/src/plugins/todo/index.ts +0 -64
  97. package/src/plugins/ui/index.ts +0 -227
  98. /package/src/{harness → services}/process.ts +0 -0
@@ -1,128 +0,0 @@
1
- import { MelonyPlugin } from 'melony';
2
- import z from 'zod';
3
- import type { Plugin } from '../../bus/plugin.js';
4
- import { OpenBotEvent, OpenBotState } from '../../app/types.js';
5
- import { mcpService } from '../../harness/mcp.js';
6
-
7
- function stringifyResult(value: unknown): string {
8
- if (typeof value === 'string') return value;
9
- try {
10
- return JSON.stringify(value, null, 2);
11
- } catch {
12
- return String(value);
13
- }
14
- }
15
-
16
- const mcpToolDefinitions = {
17
- mcp_list_tools: {
18
- description:
19
- 'List available tools from a configured MCP server. Use this first before calling tools on an unknown server.',
20
- inputSchema: z.object({
21
- serverId: z.string().describe('Configured MCP server id (e.g. github, notion, linear).'),
22
- }),
23
- },
24
- mcp_call: {
25
- description:
26
- 'Call a tool on a configured MCP server. Provide tool arguments as a JSON object. Use mcp_list_tools first when uncertain.',
27
- inputSchema: z.object({
28
- serverId: z.string().describe('Configured MCP server id.'),
29
- toolName: z.string().describe('Exact MCP tool name from mcp_list_tools.'),
30
- args: z
31
- .record(z.string(), z.unknown())
32
- .default({})
33
- .describe('Tool arguments as a JSON object.'),
34
- }),
35
- },
36
- };
37
-
38
- const mcpPluginRuntime = (): MelonyPlugin<OpenBotState, OpenBotEvent> => (builder) => {
39
- builder.on('action:mcp_list_tools', async function* (event, context) {
40
- const serverId = (event.data as { serverId?: string })?.serverId as string;
41
-
42
- try {
43
- const tools = await mcpService.listTools(serverId);
44
- const toolNames = tools.map(
45
- (tool) => `- ${tool.name}${tool.description ? `: ${tool.description}` : ''}`,
46
- );
47
-
48
- yield {
49
- type: 'action:mcp_list_tools:result',
50
- data: { success: true, serverId, tools },
51
- meta: event.meta,
52
- } as OpenBotEvent;
53
-
54
- yield {
55
- type: 'agent:output',
56
- data: {
57
- content:
58
- toolNames.length > 0
59
- ? `MCP tools available on \`${serverId}\`:\n${toolNames.join('\n')}`
60
- : `MCP server \`${serverId}\` has no tools.`,
61
- },
62
- meta: { ...(event.meta || {}), agentId: context.state.agentId },
63
- } as OpenBotEvent;
64
- } catch (error) {
65
- const message = error instanceof Error ? error.message : 'Unknown MCP error';
66
- yield {
67
- type: 'action:mcp_list_tools:result',
68
- data: { success: false, serverId, tools: [], error: message },
69
- meta: event.meta,
70
- } as OpenBotEvent;
71
- yield {
72
- type: 'agent:output',
73
- data: { content: `Failed to list MCP tools for \`${serverId}\`: ${message}` },
74
- meta: { ...(event.meta || {}), agentId: context.state.agentId },
75
- } as OpenBotEvent;
76
- }
77
- });
78
-
79
- builder.on('action:mcp_call', async function* (event, context) {
80
- const data = event.data as {
81
- serverId?: string;
82
- toolName?: string;
83
- args?: Record<string, unknown>;
84
- };
85
- const serverId = data?.serverId as string;
86
- const toolName = data?.toolName as string;
87
- const args = (data?.args || {}) as Record<string, unknown>;
88
-
89
- try {
90
- const result = await mcpService.callTool(serverId, toolName, args);
91
- const rendered = stringifyResult(result);
92
-
93
- yield {
94
- type: 'action:mcp_call:result',
95
- data: { success: true, serverId, toolName, result },
96
- meta: event.meta,
97
- } as OpenBotEvent;
98
-
99
- yield {
100
- type: 'agent:output',
101
- data: { content: `MCP \`${serverId}.${toolName}\` result:\n\n${rendered}` },
102
- meta: { ...(event.meta || {}), agentId: context.state.agentId },
103
- } as OpenBotEvent;
104
- } catch (error) {
105
- const message = error instanceof Error ? error.message : 'Unknown MCP error';
106
- yield {
107
- type: 'action:mcp_call:result',
108
- data: { success: false, serverId, toolName, error: message },
109
- meta: event.meta,
110
- } as OpenBotEvent;
111
- yield {
112
- type: 'agent:output',
113
- data: { content: `MCP call failed for \`${serverId}.${toolName}\`: ${message}` },
114
- meta: { ...(event.meta || {}), agentId: context.state.agentId },
115
- } as OpenBotEvent;
116
- }
117
- });
118
- };
119
-
120
- export const mcpPlugin: Plugin = {
121
- id: 'mcp',
122
- name: 'MCP',
123
- description: 'Connect to Model Context Protocol servers and call their tools.',
124
- toolDefinitions: mcpToolDefinitions,
125
- factory: () => mcpPluginRuntime(),
126
- };
127
-
128
- export default mcpPlugin;
@@ -1,90 +0,0 @@
1
- import z from 'zod';
2
- import type { Plugin } from '../../bus/plugin.js';
3
-
4
- /**
5
- * `storage-tools` — exposes channel/thread/variable mutation tools to runtime
6
- * plugins. The actual handlers live in `bus/services.ts` because storage is
7
- * platform infrastructure, not agent behaviour.
8
- */
9
- const storageToolDefinitions = {
10
- create_channel: {
11
- description:
12
- 'Create a new channel. Use when the user intent is clearly different from the current channel and should be split. Always confirm before creating. Skip for simple Q&A.',
13
- inputSchema: z.object({
14
- channelId: z
15
- .string()
16
- .describe('Unique channel ID (e.g. product-launch, backend-platform, channel_roadmap).'),
17
- spec: z
18
- .string()
19
- .optional()
20
- .describe('Optional initial markdown content for the channel spec.'),
21
- initialState: z
22
- .record(z.string(), z.unknown())
23
- .optional()
24
- .describe('Optional initial state object for the channel.'),
25
- cwd: z
26
- .string()
27
- .optional()
28
- .describe('Optional initial current working directory for the channel.'),
29
- }),
30
- },
31
- patch_channel_details: {
32
- description: 'Patch current channel details (state, spec, cwd).',
33
- inputSchema: z
34
- .object({
35
- state: z
36
- .record(z.string(), z.unknown())
37
- .optional()
38
- .describe(
39
- 'JSON state object for the channel. Use for structured data like `todos` or metadata.',
40
- ),
41
- spec: z
42
- .string()
43
- .optional()
44
- .describe(
45
- 'Markdown content for the channel specification (SPEC.md). Use for goals and rules.',
46
- ),
47
- cwd: z.string().optional().describe('Current working directory for the channel.'),
48
- })
49
- .refine(
50
- (value) => value.state !== undefined || value.spec !== undefined || value.cwd !== undefined,
51
- { message: 'Provide at least one of state, spec, or cwd.' },
52
- ),
53
- },
54
- patch_thread_details: {
55
- description: 'Patch current thread details (state).',
56
- inputSchema: z.object({
57
- state: z
58
- .record(z.string(), z.unknown())
59
- .describe(
60
- 'JSON state object for the thread. Use for structured data like `todos` or progress.',
61
- ),
62
- }),
63
- },
64
- create_variable: {
65
- description: 'Create or update a variable in the workspace storage.',
66
- inputSchema: z.object({
67
- key: z.string().describe('The key of the variable.'),
68
- value: z.string().describe('The value of the variable.'),
69
- secret: z.boolean().optional().describe('Whether the variable is a secret.'),
70
- }),
71
- },
72
- delete_variable: {
73
- description: 'Delete a variable from the workspace storage.',
74
- inputSchema: z.object({
75
- key: z.string().describe('The key of the variable to delete.'),
76
- }),
77
- },
78
- };
79
-
80
- export const storageToolsPlugin: Plugin = {
81
- id: 'storage-tools',
82
- name: 'Storage Tools',
83
- description: 'Tools for creating channels, patching state, and managing workspace variables.',
84
- toolDefinitions: storageToolDefinitions,
85
- factory: () => () => {
86
- // Handlers live in bus/services.ts; this plugin only contributes tool definitions.
87
- },
88
- };
89
-
90
- export default storageToolsPlugin;
@@ -1,64 +0,0 @@
1
- import z from 'zod';
2
- import type { Plugin } from '../../bus/plugin.js';
3
-
4
- /**
5
- * `todo` — shared, per-thread task list for autonomous multi-agent flows.
6
- *
7
- * Todos live in `threadDetails.state.todos` and are owned by the system
8
- * (handlers in `bus/services.ts`). Any agent in the thread can read the
9
- * list via context, and propose mutations through these tools. Each item
10
- * may carry an `assignee` agent id; combine with `handoff` to drive an
11
- * autonomous, multi-step plan across agents.
12
- *
13
- * Keep the surface minimal: two tools (replace-all, patch-one) cover plan
14
- * authoring, status transitions, and reassignment.
15
- */
16
- const todoStatus = z.enum(['pending', 'in_progress', 'done', 'cancelled']);
17
-
18
- const todoToolDefinitions = {
19
- todo_write: {
20
- description:
21
- 'Author or rewrite the shared todo plan for the current thread. Pass the full ordered list — missing items are removed. Use at the start of multi-step work, or whenever the plan changes shape. For status flips, prefer `todo_update`.',
22
- inputSchema: z.object({
23
- todos: z
24
- .array(
25
- z.object({
26
- id: z
27
- .string()
28
- .optional()
29
- .describe('Stable id. Reuse existing ids to preserve history; omit to create.'),
30
- content: z.string().min(1).describe('What needs to be done. One concrete step.'),
31
- status: todoStatus.optional().describe('Defaults to `pending`.'),
32
- assignee: z
33
- .string()
34
- .optional()
35
- .describe('Agent id responsible for this step. Pair with `handoff` to delegate.'),
36
- }),
37
- )
38
- .describe('The complete, ordered plan.'),
39
- }),
40
- },
41
- todo_update: {
42
- description:
43
- 'Patch a single todo by id. Use to mark progress (`in_progress`, `done`, `cancelled`), rephrase, or reassign without rewriting the whole list.',
44
- inputSchema: z.object({
45
- id: z.string().describe('Todo id from `todo_write` or the rendered list.'),
46
- status: todoStatus.optional(),
47
- content: z.string().min(1).optional(),
48
- assignee: z.string().optional().describe('Use empty string to clear.'),
49
- }),
50
- },
51
- };
52
-
53
- export const todoPlugin: Plugin = {
54
- id: 'todo',
55
- name: 'Todo',
56
- description:
57
- 'Shared per-thread task list for coordinating multi-step, multi-agent work.',
58
- toolDefinitions: todoToolDefinitions,
59
- factory: () => () => {
60
- // Handlers live in bus/services.ts; this plugin only contributes tool definitions.
61
- },
62
- };
63
-
64
- export default todoPlugin;
@@ -1,227 +0,0 @@
1
- import { MelonyPlugin } from 'melony';
2
- import z from 'zod';
3
- import type { Plugin } from '../../bus/plugin.js';
4
- import {
5
- OpenBotEvent,
6
- OpenBotState,
7
- RenderUIWidgetData,
8
- UIWidgetField,
9
- UIWidgetListItem,
10
- UIWidgetSpec,
11
- } from '../../app/types.js';
12
-
13
- const actionSchema = z.object({
14
- id: z.string().describe('Stable action ID returned by client:ui:widget:response.'),
15
- label: z.string().describe('Human-readable button label.'),
16
- value: z.unknown().optional().describe('Optional machine-readable value for this action.'),
17
- variant: z.enum(['primary', 'secondary', 'danger']).optional(),
18
- disabled: z.boolean().optional(),
19
- });
20
-
21
- const optionSchema = z.object({
22
- label: z.string(),
23
- value: z.string(),
24
- });
25
-
26
- const fieldSchema = z.object({
27
- id: z.string().describe('Stable field ID used as the submitted value key.'),
28
- label: z.string(),
29
- type: z.enum(['text', 'textarea', 'number', 'boolean', 'select', 'multiselect', 'date']),
30
- description: z.string().optional(),
31
- placeholder: z.string().optional(),
32
- required: z.boolean().optional(),
33
- options: z.array(optionSchema).optional(),
34
- defaultValue: z.unknown().optional(),
35
- });
36
-
37
- const listItemSchema = z.object({
38
- id: z.string(),
39
- label: z.string(),
40
- description: z.string().optional(),
41
- status: z.enum(['pending', 'in_progress', 'done', 'error', 'cancelled']).optional(),
42
- metadata: z.record(z.string(), z.unknown()).optional(),
43
- });
44
-
45
- const widgetBaseSchema = {
46
- widgetId: z.string().optional().describe('Stable widget ID. Defaults from toolCallId.'),
47
- title: z.string().optional(),
48
- description: z.string().optional(),
49
- body: z.string().optional(),
50
- state: z.enum(['open', 'submitted', 'cancelled', 'error']).optional(),
51
- metadata: z.record(z.string(), z.unknown()).optional(),
52
- };
53
-
54
- const renderWidgetSchema = z.union([
55
- z.object({
56
- ...widgetBaseSchema,
57
- kind: z.literal('message'),
58
- actions: z.array(actionSchema).optional(),
59
- }),
60
- z.object({
61
- ...widgetBaseSchema,
62
- kind: z.literal('choice'),
63
- actions: z.array(actionSchema).min(1),
64
- }),
65
- z.object({
66
- ...widgetBaseSchema,
67
- kind: z.literal('form'),
68
- fields: z.array(fieldSchema).optional(),
69
- submitLabel: z.string().optional(),
70
- actions: z.array(actionSchema).optional(),
71
- props: z.record(z.string(), z.unknown()).optional(),
72
- }),
73
- z.object({
74
- ...widgetBaseSchema,
75
- kind: z.literal('list'),
76
- items: z.array(listItemSchema).optional(),
77
- actions: z.array(actionSchema).optional(),
78
- }),
79
- z.object({
80
- kind: z.enum(['approval', 'todo_list']).describe('Legacy preset. Prefer choice or list.'),
81
- widgetId: z.string().optional(),
82
- title: z.string().optional(),
83
- props: z.record(z.string(), z.unknown()).optional(),
84
- metadata: z.record(z.string(), z.unknown()).optional(),
85
- }),
86
- ]);
87
-
88
- const isRecord = (value: unknown): value is Record<string, unknown> =>
89
- !!value && typeof value === 'object' && !Array.isArray(value);
90
-
91
- const readString = (value: unknown): string | undefined =>
92
- typeof value === 'string' && value.trim() ? value : undefined;
93
-
94
- const asFields = (value: unknown): UIWidgetField[] | undefined =>
95
- Array.isArray(value) ? (value as UIWidgetField[]) : undefined;
96
-
97
- const asListItems = (value: unknown): UIWidgetListItem[] | undefined =>
98
- Array.isArray(value) ? (value as UIWidgetListItem[]) : undefined;
99
-
100
- const todoToListItem = (todo: unknown, index: number): UIWidgetListItem => {
101
- if (!isRecord(todo)) {
102
- return { id: `todo_${index + 1}`, label: String(todo) };
103
- }
104
- return {
105
- id: readString(todo.id) || `todo_${index + 1}`,
106
- label:
107
- readString(todo.label) ||
108
- readString(todo.task) ||
109
- readString(todo.title) ||
110
- `Todo ${index + 1}`,
111
- description: readString(todo.description),
112
- status: readString(todo.status) as UIWidgetListItem['status'],
113
- metadata: todo,
114
- };
115
- };
116
-
117
- const createWidgetId = (data: RenderUIWidgetData, toolCallId?: string): string => {
118
- if ('widgetId' in data && data.widgetId) return data.widgetId;
119
- if (toolCallId) return `widget_${toolCallId}`;
120
- return `widget_${Date.now()}`;
121
- };
122
-
123
- const normalizeWidget = (
124
- data: RenderUIWidgetData,
125
- state: OpenBotState,
126
- toolCallId?: string,
127
- ): UIWidgetSpec => {
128
- const widgetId = createWidgetId(data, toolCallId);
129
-
130
- if (data.kind === 'approval') {
131
- const props = data.props || {};
132
- return {
133
- widgetId,
134
- kind: 'choice',
135
- title: data.title || 'Approval Required',
136
- body:
137
- readString(props.message) ||
138
- readString(props.summary) ||
139
- 'Please approve or deny this action.',
140
- metadata: {
141
- ...(data.metadata || {}),
142
- legacyKind: 'approval',
143
- actionId: props.actionId,
144
- },
145
- actions: [
146
- { id: 'approve', label: 'Approve', value: props.actionId || 'approve', variant: 'primary' },
147
- { id: 'deny', label: 'Deny', value: props.actionId || 'deny', variant: 'danger' },
148
- ],
149
- };
150
- }
151
-
152
- if (data.kind === 'todo_list') {
153
- const props = data.props || {};
154
- const stateTodos = isRecord(state.threadDetails?.state)
155
- ? (state.threadDetails.state as Record<string, unknown>).todos
156
- : undefined;
157
- const todos = asListItems(props.todos) || asListItems(stateTodos) || [];
158
- return {
159
- widgetId,
160
- kind: 'list',
161
- title: data.title || readString(props.title) || 'Task List',
162
- description: readString(props.description),
163
- metadata: { ...(data.metadata || {}), legacyKind: 'todo_list' },
164
- items: todos.map(todoToListItem),
165
- };
166
- }
167
-
168
- if (data.kind === 'form') {
169
- const propsSource = (data as unknown as { props?: unknown }).props;
170
- const props = isRecord(propsSource) ? propsSource : {};
171
- return {
172
- widgetId,
173
- kind: 'form',
174
- title: data.title || 'Details Required',
175
- description: data.description,
176
- body: data.body,
177
- state: data.state,
178
- metadata: data.metadata,
179
- fields: data.fields || asFields(props.schema) || [],
180
- submitLabel: data.submitLabel || readString(props.submitLabel),
181
- actions: data.actions,
182
- };
183
- }
184
-
185
- if (data.kind === 'list') {
186
- return { ...data, widgetId, title: data.title || 'Task List', items: data.items || [] };
187
- }
188
-
189
- if (data.kind === 'choice') {
190
- return { ...data, widgetId, title: data.title || 'Choose an Option' };
191
- }
192
-
193
- if (data.kind === 'message') {
194
- return { ...data, widgetId, title: data.title || 'Message' };
195
- }
196
-
197
- throw new Error(`Unsupported UI widget kind: ${(data as { kind?: string }).kind || 'unknown'}`);
198
- };
199
-
200
- const uiToolDefinitions = {
201
- render_ui_widget: {
202
- description:
203
- 'Render a small server-driven UI widget in the conversation. Prefer primitive kinds: message, choice, form, or list. Legacy presets approval and todo_list are accepted.',
204
- inputSchema: renderWidgetSchema,
205
- },
206
- };
207
-
208
- const uiPluginRuntime = (): MelonyPlugin<OpenBotState, OpenBotEvent> => (builder) => {
209
- builder.on('action:render_ui_widget', async function* (event, context) {
210
- const widget = normalizeWidget(event.data, context.state, event.meta?.toolCallId);
211
- yield {
212
- type: 'client:ui:widget',
213
- data: widget,
214
- meta: event.meta,
215
- };
216
- });
217
- };
218
-
219
- export const uiPlugin: Plugin = {
220
- id: 'ui',
221
- name: 'UI Widgets',
222
- description: 'Render server-driven UI widgets (messages, choices, forms, lists) in the conversation.',
223
- toolDefinitions: uiToolDefinitions,
224
- factory: () => uiPluginRuntime(),
225
- };
226
-
227
- export default uiPlugin;
File without changes