openbot 0.5.4 → 0.5.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.
Files changed (50) hide show
  1. package/CLAUDE.md +5 -4
  2. package/deploy/README.md +2 -4
  3. package/dist/app/cli.js +3 -1
  4. package/dist/app/cloud-mode.js +5 -16
  5. package/dist/app/ensure-default-stack.js +54 -0
  6. package/dist/app/openbot-plugin.js +4 -0
  7. package/dist/app/server.js +2 -3
  8. package/dist/harness/index.js +3 -0
  9. package/dist/plugins/openbot/index.js +6 -5
  10. package/dist/plugins/openbot/model.js +2 -41
  11. package/dist/plugins/openbot/runtime.js +9 -4
  12. package/dist/plugins/storage/index.js +3 -325
  13. package/dist/plugins/storage/service.js +18 -21
  14. package/dist/services/plugins/host.js +21 -0
  15. package/dist/services/plugins/model-registry.js +34 -9
  16. package/dist/services/plugins/registry.js +26 -42
  17. package/dist/services/plugins/service.js +5 -1
  18. package/dist/services/todo/types.js +1 -0
  19. package/docs/plugins.md +14 -12
  20. package/docs/templates/AGENT.example.md +8 -14
  21. package/package.json +2 -2
  22. package/src/app/cli.ts +3 -1
  23. package/src/app/cloud-mode.ts +7 -22
  24. package/src/app/ensure-default-stack.ts +63 -0
  25. package/src/app/openbot-plugin.ts +5 -0
  26. package/src/app/server.ts +2 -5
  27. package/src/app/types.ts +4 -8
  28. package/src/harness/index.ts +4 -0
  29. package/src/plugins/storage/index.ts +3 -368
  30. package/src/plugins/storage/service.ts +17 -22
  31. package/src/services/plugins/host.ts +36 -0
  32. package/src/services/plugins/model-registry.ts +41 -9
  33. package/src/services/plugins/registry.ts +28 -43
  34. package/src/services/plugins/service.ts +13 -12
  35. package/src/services/plugins/types.ts +36 -2
  36. package/src/services/todo/types.ts +12 -0
  37. package/src/plugins/approval/index.ts +0 -147
  38. package/src/plugins/bash/index.ts +0 -545
  39. package/src/plugins/delegation/index.ts +0 -153
  40. package/src/plugins/memory/index.ts +0 -182
  41. package/src/plugins/openbot/context.ts +0 -137
  42. package/src/plugins/openbot/history.ts +0 -158
  43. package/src/plugins/openbot/index.ts +0 -95
  44. package/src/plugins/openbot/model.ts +0 -76
  45. package/src/plugins/openbot/runtime.ts +0 -504
  46. package/src/plugins/openbot/system-prompt.ts +0 -57
  47. package/src/plugins/preview/index.ts +0 -323
  48. package/src/plugins/todo/index.ts +0 -166
  49. package/src/plugins/todo/service.ts +0 -123
  50. package/src/plugins/ui/index.ts +0 -130
@@ -1,130 +0,0 @@
1
- import { randomUUID } from 'node:crypto';
2
- import { z } from 'zod';
3
- import type { Plugin } from '../../services/plugins/types.js';
4
- import { OpenBotEvent, RenderWidgetEvent, UIWidgetResponseEvent } from '../../app/types.js';
5
-
6
- /**
7
- * `ui` — provides a tool for the agent to render interactive UI widgets.
8
- *
9
- * The model can choose which widget to render (form, choice, list, message)
10
- * depending on the situation.
11
- */
12
-
13
- export const uiPlugin: Plugin = {
14
- id: 'ui',
15
- name: 'UI',
16
- description: 'Render interactive UI widgets to interact with the user.',
17
- toolDefinitions: {
18
- render_widget: {
19
- description: 'Render a UI widget to the user. Use "form" for data collection, "choice" for simple selection, "list" for displaying items, and "message" for simple notifications with actions. When using form widge to unquire user, do not provide complex forms with many fields, always try to make it simple to keep the experience smooth and straightforward.',
20
- inputSchema: z.object({
21
- kind: z.enum(['message', 'choice', 'form', 'list']).describe('The type of widget to render.'),
22
- title: z.string().describe('The title of the widget.'),
23
- description: z.string().optional().describe('A description or body text.'),
24
- fields: z.array(z.object({
25
- id: z.string().describe('Unique ID for the field.'),
26
- label: z.string().describe('Label shown to the user.'),
27
- type: z.enum(['text', 'textarea', 'number', 'boolean', 'select', 'multiselect', 'date']),
28
- description: z.string().optional(),
29
- placeholder: z.string().optional(),
30
- required: z.boolean().optional(),
31
- options: z.array(z.object({ label: z.string(), value: z.string() })).optional(),
32
- defaultValue: z.any().optional()
33
- })).optional().describe('Required for kind="form". List of form fields.'),
34
- actions: z.array(z.object({
35
- id: z.string(),
36
- label: z.string(),
37
- variant: z.enum(['primary', 'secondary', 'danger']).optional(),
38
- })).optional().describe('Buttons or actions available on the widget.'),
39
- items: z.array(z.object({
40
- id: z.string(),
41
- label: z.string(),
42
- description: z.string().optional(),
43
- status: z
44
- .string()
45
- .optional()
46
- .describe('Status label shown on the item (e.g. "Pending", "Shipped").'),
47
- statusVariant: z
48
- .enum(['default', 'success', 'warning', 'danger', 'info'])
49
- .optional()
50
- .describe('Semantic hint for status badge coloring in the client.'),
51
- metadata: z.record(z.string(), z.any()).optional()
52
- })).optional().describe('Required for kind="list". List of items to display.'),
53
- submitLabel: z.string().optional().describe('Label for the primary action button (e.g. "Submit", "Save").')
54
- })
55
- }
56
- },
57
- factory: () => (builder) => {
58
- // Handle the tool call from the agent
59
- builder.on('action:render_widget', async function* (event, context) {
60
- const widgetEvent = event as RenderWidgetEvent;
61
- const toolCallId = widgetEvent.meta?.toolCallId;
62
- const threadId = widgetEvent.meta?.threadId || context.state.threadId;
63
-
64
- if (!toolCallId) return;
65
-
66
- const widgetId = randomUUID();
67
-
68
- // Emit the UI widget event to the client
69
- yield {
70
- type: 'client:ui:widget',
71
- data: {
72
- ...widgetEvent.data,
73
- widgetId,
74
- metadata: {
75
- type: 'ui:request',
76
- originalEvent: widgetEvent
77
- }
78
- },
79
- meta: { agentId: context.state.agentId, threadId }
80
- } as OpenBotEvent;
81
- });
82
-
83
- // Handle the user's response from the UI widget
84
- builder.on('client:ui:widget:response', async function* (event, context) {
85
- const responseEvent = event as UIWidgetResponseEvent;
86
- const { widgetId, actionId, values, metadata } = responseEvent.data;
87
- if (metadata?.type !== 'ui:request') return;
88
-
89
- const originalEvent = metadata.originalEvent as RenderWidgetEvent;
90
- const toolCallId = originalEvent?.meta?.toolCallId;
91
- const threadId = originalEvent?.meta?.threadId || context.state.threadId;
92
-
93
- if (!toolCallId) return;
94
-
95
- // Yield a "submitted" widget update to the UI to collapse/disable it
96
- yield {
97
- type: 'client:ui:widget',
98
- data: {
99
- widgetId,
100
- title: originalEvent.data.title,
101
- kind: originalEvent.data.kind as any,
102
- state: 'submitted',
103
- body: "Thank you for your response. We will process it and get back to you soon.",
104
- display: 'collapsed',
105
- disabled: true,
106
- actions: [], // Clear actions to disable buttons in UI
107
- },
108
- meta: { agentId: context.state.agentId, threadId },
109
- } as OpenBotEvent;
110
-
111
- // Emit the tool result event so the agent runtime can resume
112
- yield {
113
- type: 'action:render_widget:result',
114
- data: {
115
- success: true,
116
- actionId,
117
- values,
118
- output: JSON.stringify(values)
119
- },
120
- meta: {
121
- agentId: context.state.agentId,
122
- threadId,
123
- toolCallId
124
- }
125
- } as any as OpenBotEvent;
126
- });
127
- },
128
- };
129
-
130
- export default uiPlugin;