openbot 0.4.7 → 0.5.4
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/.claude/agents/runtime-security-reviewer.md +32 -0
- package/.claude/hooks/format.sh +18 -0
- package/.claude/hooks/protect-secrets.sh +23 -0
- package/.claude/settings.json +26 -0
- package/.claude/skills/deploy/SKILL.md +26 -0
- package/.claude/skills/new-plugin/SKILL.md +46 -0
- package/.dockerignore +9 -0
- package/.mcp.json +8 -0
- package/AGENTS.md +2 -2
- package/CLAUDE.md +50 -0
- package/Dockerfile +41 -0
- package/deploy/README.md +61 -0
- package/deploy/entrypoint.sh +6 -0
- package/deploy/fly.toml +36 -0
- package/dist/app/bootstrap.js +29 -0
- package/dist/app/cli.js +3 -1
- package/dist/app/cloud-mode.js +26 -0
- package/dist/app/config.js +61 -16
- package/dist/app/server.js +38 -6
- package/dist/plugins/approval/index.js +1 -1
- package/dist/plugins/bash/index.js +386 -164
- package/dist/plugins/memory/service.js +2 -5
- package/dist/plugins/openbot/context.js +17 -1
- package/dist/plugins/openbot/index.js +23 -8
- package/dist/plugins/openbot/model.js +59 -0
- package/dist/plugins/openbot/runtime.js +39 -56
- package/dist/plugins/openbot/system-prompt.js +43 -8
- package/dist/plugins/preview/index.js +267 -0
- package/dist/plugins/storage/index.js +3 -3
- package/dist/plugins/storage/service.js +58 -12
- package/dist/plugins/todo/index.js +131 -38
- package/dist/plugins/todo/service.js +93 -0
- package/dist/plugins/ui/index.js +8 -1
- package/dist/services/plugins/model-registry.js +101 -0
- package/dist/services/plugins/registry.js +6 -4
- package/dist/services/plugins/service.js +2 -6
- package/docs/agents.md +20 -2
- package/docs/architecture.md +1 -1
- package/docs/plugins.md +13 -3
- package/docs/templates/AGENT.example.md +1 -1
- package/package.json +5 -2
- package/pnpm-workspace.yaml +2 -0
- package/src/app/bootstrap.ts +43 -0
- package/src/app/cli.ts +3 -1
- package/src/app/cloud-mode.ts +41 -0
- package/src/app/config.ts +71 -19
- package/src/app/server.ts +45 -6
- package/src/app/types.ts +162 -31
- package/src/plugins/approval/index.ts +1 -1
- package/src/plugins/bash/index.ts +498 -185
- package/src/plugins/memory/service.ts +2 -5
- package/src/plugins/openbot/context.ts +17 -1
- package/src/plugins/openbot/index.ts +25 -10
- package/src/plugins/openbot/model.ts +76 -0
- package/src/plugins/openbot/runtime.ts +47 -69
- package/src/plugins/openbot/system-prompt.ts +43 -8
- package/src/plugins/preview/index.ts +323 -0
- package/src/plugins/storage/index.ts +5 -8
- package/src/plugins/storage/service.ts +79 -15
- package/src/plugins/todo/index.ts +166 -0
- package/src/plugins/todo/service.ts +123 -0
- package/src/plugins/ui/index.ts +8 -1
- package/src/services/plugins/domain.ts +2 -0
- package/src/services/plugins/model-registry.ts +146 -0
- package/src/services/plugins/registry.ts +6 -4
- package/src/services/plugins/service.ts +2 -6
- package/dist/agents/openbot/index.js +0 -76
- package/dist/agents/openbot/middleware/approval.js +0 -132
- package/dist/agents/openbot/runtime.js +0 -289
- package/dist/agents/openbot/system-prompt.js +0 -32
- package/dist/agents/openbot/tools/delegation.js +0 -78
- package/dist/agents/openbot/tools/mcp.js +0 -99
- package/dist/agents/openbot/tools/shell.js +0 -91
- package/dist/agents/openbot/tools/storage.js +0 -75
- package/dist/agents/openbot/tools/ui.js +0 -176
- package/dist/agents/system.js +0 -33
- package/dist/bus/agent-package.js +0 -1
- package/dist/bus/plugin.js +0 -1
- package/dist/bus/services.js +0 -754
- package/dist/bus/types.js +0 -1
- package/dist/harness/agent-harness.js +0 -45
- package/dist/harness/agent-invoke-run.js +0 -44
- package/dist/harness/agent-turn.js +0 -99
- package/dist/harness/channel-participants.js +0 -40
- package/dist/harness/constants.js +0 -2
- package/dist/harness/context-meter.js +0 -97
- package/dist/harness/context.js +0 -363
- package/dist/harness/dispatch.js +0 -144
- package/dist/harness/dispatcher.js +0 -156
- package/dist/harness/event-normalizer.js +0 -59
- package/dist/harness/history.js +0 -177
- package/dist/harness/mcp.js +0 -61
- package/dist/harness/orchestration.js +0 -88
- package/dist/harness/orchestrator.js +0 -149
- package/dist/harness/participants.js +0 -22
- package/dist/harness/process.js +0 -29
- package/dist/harness/queue-processor.js +0 -187
- package/dist/harness/run-harness.js +0 -154
- package/dist/harness/run.js +0 -98
- package/dist/harness/runtime-factory.js +0 -73
- package/dist/harness/runtime.js +0 -57
- package/dist/harness/todo-advance.js +0 -93
- package/dist/harness/todo-dispatch.js +0 -51
- package/dist/harness/todos.js +0 -5
- package/dist/harness/turn.js +0 -79
- package/dist/harness/types.js +0 -1
- package/dist/plugins/ai-sdk/index.js +0 -34
- package/dist/plugins/ai-sdk/runtime.js +0 -395
- package/dist/plugins/ai-sdk/system-prompt.js +0 -18
- package/dist/plugins/ai-sdk.js +0 -331
- package/dist/plugins/approval.js +0 -163
- package/dist/plugins/delegation.js +0 -108
- package/dist/plugins/mcp/index.js +0 -108
- package/dist/plugins/mcp.js +0 -140
- package/dist/plugins/shell/index.js +0 -100
- package/dist/plugins/shell.js +0 -123
- package/dist/plugins/storage-tools/index.js +0 -76
- package/dist/plugins/storage.js +0 -737
- package/dist/plugins/thread-namer/index.js +0 -72
- package/dist/plugins/threads/index.js +0 -114
- package/dist/plugins/ui.js +0 -211
- package/dist/plugins/workflow/index.js +0 -65
- package/dist/registry/agents.js +0 -138
- package/dist/registry/plugins.js +0 -110
- package/dist/services/agent-packages.js +0 -103
- package/dist/services/memory.js +0 -152
- package/dist/services/plugins.js +0 -98
- package/dist/services/storage.js +0 -1028
- package/dist/workflow/service.js +0 -106
- package/dist/workflow/types.js +0 -3
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import z from 'zod';
|
|
2
|
-
const actionSchema = z.object({
|
|
3
|
-
id: z.string().describe('Stable action ID returned by client:ui:widget:response.'),
|
|
4
|
-
label: z.string().describe('Human-readable button label.'),
|
|
5
|
-
value: z.unknown().optional().describe('Optional machine-readable value for this action.'),
|
|
6
|
-
variant: z.enum(['primary', 'secondary', 'danger']).optional(),
|
|
7
|
-
disabled: z.boolean().optional(),
|
|
8
|
-
});
|
|
9
|
-
const optionSchema = z.object({
|
|
10
|
-
label: z.string(),
|
|
11
|
-
value: z.string(),
|
|
12
|
-
});
|
|
13
|
-
const fieldSchema = z.object({
|
|
14
|
-
id: z.string().describe('Stable field ID used as the submitted value key.'),
|
|
15
|
-
label: z.string(),
|
|
16
|
-
type: z.enum(['text', 'textarea', 'number', 'boolean', 'select', 'multiselect', 'date']),
|
|
17
|
-
description: z.string().optional(),
|
|
18
|
-
placeholder: z.string().optional(),
|
|
19
|
-
required: z.boolean().optional(),
|
|
20
|
-
options: z.array(optionSchema).optional(),
|
|
21
|
-
defaultValue: z.unknown().optional(),
|
|
22
|
-
});
|
|
23
|
-
const listItemSchema = z.object({
|
|
24
|
-
id: z.string(),
|
|
25
|
-
label: z.string(),
|
|
26
|
-
description: z.string().optional(),
|
|
27
|
-
status: z.enum(['pending', 'in_progress', 'done', 'error', 'cancelled']).optional(),
|
|
28
|
-
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
29
|
-
});
|
|
30
|
-
const widgetBaseSchema = {
|
|
31
|
-
widgetId: z.string().optional().describe('Stable widget ID. Defaults from toolCallId.'),
|
|
32
|
-
title: z.string().optional(),
|
|
33
|
-
description: z.string().optional(),
|
|
34
|
-
body: z.string().optional(),
|
|
35
|
-
state: z.enum(['open', 'submitted', 'cancelled', 'error']).optional(),
|
|
36
|
-
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
37
|
-
};
|
|
38
|
-
const renderWidgetSchema = z.union([
|
|
39
|
-
z.object({
|
|
40
|
-
...widgetBaseSchema,
|
|
41
|
-
kind: z.literal('message'),
|
|
42
|
-
actions: z.array(actionSchema).optional(),
|
|
43
|
-
}),
|
|
44
|
-
z.object({
|
|
45
|
-
...widgetBaseSchema,
|
|
46
|
-
kind: z.literal('choice'),
|
|
47
|
-
actions: z.array(actionSchema).min(1),
|
|
48
|
-
}),
|
|
49
|
-
z.object({
|
|
50
|
-
...widgetBaseSchema,
|
|
51
|
-
kind: z.literal('form'),
|
|
52
|
-
fields: z.array(fieldSchema).optional(),
|
|
53
|
-
submitLabel: z.string().optional(),
|
|
54
|
-
actions: z.array(actionSchema).optional(),
|
|
55
|
-
props: z.record(z.string(), z.unknown()).optional(),
|
|
56
|
-
}),
|
|
57
|
-
z.object({
|
|
58
|
-
...widgetBaseSchema,
|
|
59
|
-
kind: z.literal('list'),
|
|
60
|
-
items: z.array(listItemSchema).optional(),
|
|
61
|
-
actions: z.array(actionSchema).optional(),
|
|
62
|
-
}),
|
|
63
|
-
z.object({
|
|
64
|
-
kind: z.enum(['approval', 'todo_list']).describe('Legacy preset. Prefer choice or list.'),
|
|
65
|
-
widgetId: z.string().optional(),
|
|
66
|
-
title: z.string().optional(),
|
|
67
|
-
props: z.record(z.string(), z.unknown()).optional(),
|
|
68
|
-
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
69
|
-
}),
|
|
70
|
-
]);
|
|
71
|
-
const isRecord = (value) => !!value && typeof value === 'object' && !Array.isArray(value);
|
|
72
|
-
const readString = (value) => typeof value === 'string' && value.trim() ? value : undefined;
|
|
73
|
-
const asFields = (value) => Array.isArray(value) ? value : undefined;
|
|
74
|
-
const asListItems = (value) => Array.isArray(value) ? value : undefined;
|
|
75
|
-
const todoToListItem = (todo, index) => {
|
|
76
|
-
if (!isRecord(todo)) {
|
|
77
|
-
return { id: `todo_${index + 1}`, label: String(todo) };
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
id: readString(todo.id) || `todo_${index + 1}`,
|
|
81
|
-
label: readString(todo.label) ||
|
|
82
|
-
readString(todo.task) ||
|
|
83
|
-
readString(todo.title) ||
|
|
84
|
-
`Todo ${index + 1}`,
|
|
85
|
-
description: readString(todo.description),
|
|
86
|
-
status: readString(todo.status),
|
|
87
|
-
metadata: todo,
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
const createWidgetId = (data, toolCallId) => {
|
|
91
|
-
if ('widgetId' in data && data.widgetId)
|
|
92
|
-
return data.widgetId;
|
|
93
|
-
if (toolCallId)
|
|
94
|
-
return `widget_${toolCallId}`;
|
|
95
|
-
return `widget_${Date.now()}`;
|
|
96
|
-
};
|
|
97
|
-
const normalizeWidget = (data, state, toolCallId) => {
|
|
98
|
-
const widgetId = createWidgetId(data, toolCallId);
|
|
99
|
-
if (data.kind === 'approval') {
|
|
100
|
-
const props = data.props || {};
|
|
101
|
-
return {
|
|
102
|
-
widgetId,
|
|
103
|
-
kind: 'choice',
|
|
104
|
-
title: data.title || 'Approval Required',
|
|
105
|
-
body: readString(props.message) ||
|
|
106
|
-
readString(props.summary) ||
|
|
107
|
-
'Please approve or deny this action.',
|
|
108
|
-
metadata: {
|
|
109
|
-
...(data.metadata || {}),
|
|
110
|
-
legacyKind: 'approval',
|
|
111
|
-
actionId: props.actionId,
|
|
112
|
-
},
|
|
113
|
-
actions: [
|
|
114
|
-
{ id: 'approve', label: 'Approve', value: props.actionId || 'approve', variant: 'primary' },
|
|
115
|
-
{ id: 'deny', label: 'Deny', value: props.actionId || 'deny', variant: 'danger' },
|
|
116
|
-
],
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
if (data.kind === 'todo_list') {
|
|
120
|
-
const props = data.props || {};
|
|
121
|
-
const stateTodos = isRecord(state.threadDetails?.state)
|
|
122
|
-
? state.threadDetails.state.todos
|
|
123
|
-
: undefined;
|
|
124
|
-
const todos = asListItems(props.todos) || asListItems(stateTodos) || [];
|
|
125
|
-
return {
|
|
126
|
-
widgetId,
|
|
127
|
-
kind: 'list',
|
|
128
|
-
title: data.title || readString(props.title) || 'Task List',
|
|
129
|
-
description: readString(props.description),
|
|
130
|
-
metadata: { ...(data.metadata || {}), legacyKind: 'todo_list' },
|
|
131
|
-
items: todos.map(todoToListItem),
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
if (data.kind === 'form') {
|
|
135
|
-
const propsSource = data.props;
|
|
136
|
-
const props = isRecord(propsSource) ? propsSource : {};
|
|
137
|
-
return {
|
|
138
|
-
widgetId,
|
|
139
|
-
kind: 'form',
|
|
140
|
-
title: data.title || 'Details Required',
|
|
141
|
-
description: data.description,
|
|
142
|
-
body: data.body,
|
|
143
|
-
state: data.state,
|
|
144
|
-
metadata: data.metadata,
|
|
145
|
-
fields: data.fields || asFields(props.schema) || [],
|
|
146
|
-
submitLabel: data.submitLabel || readString(props.submitLabel),
|
|
147
|
-
actions: data.actions,
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
if (data.kind === 'list') {
|
|
151
|
-
return { ...data, widgetId, title: data.title || 'Task List', items: data.items || [] };
|
|
152
|
-
}
|
|
153
|
-
if (data.kind === 'choice') {
|
|
154
|
-
return { ...data, widgetId, title: data.title || 'Choose an Option' };
|
|
155
|
-
}
|
|
156
|
-
if (data.kind === 'message') {
|
|
157
|
-
return { ...data, widgetId, title: data.title || 'Message' };
|
|
158
|
-
}
|
|
159
|
-
throw new Error(`Unsupported UI widget kind: ${data.kind || 'unknown'}`);
|
|
160
|
-
};
|
|
161
|
-
export const uiToolDefinitions = {
|
|
162
|
-
render_ui_widget: {
|
|
163
|
-
description: '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.',
|
|
164
|
-
inputSchema: renderWidgetSchema,
|
|
165
|
-
},
|
|
166
|
-
};
|
|
167
|
-
export const uiPlugin = () => (builder) => {
|
|
168
|
-
builder.on('action:render_ui_widget', async function* (event, context) {
|
|
169
|
-
const widget = normalizeWidget(event.data, context.state, event.meta?.toolCallId);
|
|
170
|
-
yield {
|
|
171
|
-
type: 'client:ui:widget',
|
|
172
|
-
data: widget,
|
|
173
|
-
meta: event.meta,
|
|
174
|
-
};
|
|
175
|
-
});
|
|
176
|
-
};
|
package/dist/agents/system.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { openBotAgentPackage } from './openbot/index.js';
|
|
2
|
-
import { OPENBOT_SYSTEM_PROMPT } from './openbot/system-prompt.js';
|
|
3
|
-
/**
|
|
4
|
-
* Default Agent record for the first-party OpenBot orchestrator.
|
|
5
|
-
*
|
|
6
|
-
* The OpenBot agent is a regular peer on the bus — it just happens to ship
|
|
7
|
-
* by default and to use the first-party `openbot` AgentPackage. Users (and the
|
|
8
|
-
* bus's storage layer) can override its instructions/config like any other agent.
|
|
9
|
-
*/
|
|
10
|
-
export const SYSTEM_AGENT_ID = 'system';
|
|
11
|
-
export const getSystemAgentDetails = (overrides) => {
|
|
12
|
-
const defaults = {
|
|
13
|
-
id: SYSTEM_AGENT_ID,
|
|
14
|
-
name: openBotAgentPackage.name,
|
|
15
|
-
image: openBotAgentPackage.image,
|
|
16
|
-
description: openBotAgentPackage.description,
|
|
17
|
-
instructions: OPENBOT_SYSTEM_PROMPT,
|
|
18
|
-
packageId: openBotAgentPackage.id,
|
|
19
|
-
config: { model: 'openai/gpt-5.4-nano' },
|
|
20
|
-
createdAt: new Date(),
|
|
21
|
-
updatedAt: new Date(),
|
|
22
|
-
};
|
|
23
|
-
if (!overrides)
|
|
24
|
-
return defaults;
|
|
25
|
-
return {
|
|
26
|
-
...defaults,
|
|
27
|
-
...overrides,
|
|
28
|
-
id: SYSTEM_AGENT_ID,
|
|
29
|
-
image: overrides.image || defaults.image,
|
|
30
|
-
config: { ...(defaults.config || {}), ...(overrides.config || {}) },
|
|
31
|
-
updatedAt: new Date(),
|
|
32
|
-
};
|
|
33
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/bus/plugin.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|