openbot 0.2.12 → 0.2.14
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/.prettierrc +8 -0
- package/AGENTS.md +68 -0
- package/CONTRIBUTING.md +74 -0
- package/LICENSE +21 -0
- package/README.md +117 -14
- package/dist/agents/system.js +106 -0
- package/dist/app/cli.js +27 -0
- package/dist/app/config.js +64 -0
- package/dist/app/server.js +237 -0
- package/dist/app/utils.js +35 -0
- package/dist/harness/agent-harness.js +45 -0
- package/dist/harness/mcp.js +61 -0
- package/dist/harness/orchestrator.js +273 -0
- package/dist/harness/process.js +7 -0
- package/dist/plugins/ai-sdk.js +141 -0
- package/dist/plugins/delegation.js +52 -0
- package/dist/plugins/mcp.js +140 -0
- package/dist/plugins/storage.js +502 -0
- package/dist/plugins/ui.js +47 -0
- package/dist/registry/plugins.js +73 -0
- package/dist/services/storage.js +724 -0
- package/docs/README.md +7 -0
- package/docs/agents.md +83 -0
- package/docs/architecture.md +34 -0
- package/docs/plugins.md +77 -0
- package/logo-black.png +0 -0
- package/{dist/assets/logo.js → logo-black.svg} +24 -24
- package/{dist/ui/sidebar.js → logo-white.svg} +23 -88
- package/package.json +6 -5
- package/src/agents/system.ts +112 -0
- package/src/app/cli.ts +38 -0
- package/src/app/config.ts +104 -0
- package/src/app/server.ts +284 -0
- package/src/app/types.ts +476 -0
- package/src/app/utils.ts +43 -0
- package/src/assets/icon.svg +1 -0
- package/src/harness/agent-harness.ts +58 -0
- package/src/harness/mcp.ts +78 -0
- package/src/harness/orchestrator.ts +342 -0
- package/src/harness/process.ts +9 -0
- package/src/harness/types.ts +34 -0
- package/src/plugins/ai-sdk.ts +197 -0
- package/src/plugins/delegation.ts +60 -0
- package/src/plugins/mcp.ts +154 -0
- package/src/plugins/storage.ts +725 -0
- package/src/plugins/ui.ts +57 -0
- package/src/registry/plugins.ts +85 -0
- package/src/services/storage.ts +957 -0
- package/tsconfig.json +18 -0
- package/dist/agents/agent-creator.js +0 -74
- package/dist/agents/browser-agent.js +0 -31
- package/dist/agents/os-agent.js +0 -32
- package/dist/agents/planner-agent.js +0 -32
- package/dist/agents/topic-agent.js +0 -46
- package/dist/architecture/execution-engine.js +0 -151
- package/dist/architecture/intent-classifier.js +0 -26
- package/dist/architecture/planner.js +0 -106
- package/dist/automation-worker.js +0 -121
- package/dist/automations.js +0 -52
- package/dist/cli.js +0 -279
- package/dist/config.js +0 -53
- package/dist/core/agents.js +0 -41
- package/dist/core/delegation.js +0 -230
- package/dist/core/manager.js +0 -96
- package/dist/core/plugins.js +0 -74
- package/dist/core/router.js +0 -191
- package/dist/handlers/init.js +0 -29
- package/dist/handlers/session-change.js +0 -21
- package/dist/handlers/settings.js +0 -47
- package/dist/handlers/tab-change.js +0 -14
- package/dist/installers.js +0 -156
- package/dist/marketplace.js +0 -80
- package/dist/model-catalog.js +0 -132
- package/dist/model-defaults.js +0 -25
- package/dist/models.js +0 -47
- package/dist/open-bot.js +0 -51
- package/dist/orchestrator/direct-invocation.js +0 -13
- package/dist/orchestrator/events.js +0 -36
- package/dist/orchestrator/state.js +0 -54
- package/dist/orchestrator.js +0 -422
- package/dist/plugins/agent/index.js +0 -81
- package/dist/plugins/approval/index.js +0 -100
- package/dist/plugins/brain/identity.js +0 -77
- package/dist/plugins/brain/index.js +0 -204
- package/dist/plugins/brain/memory.js +0 -120
- package/dist/plugins/brain/prompt.js +0 -46
- package/dist/plugins/brain/types.js +0 -45
- package/dist/plugins/brain/ui.js +0 -7
- package/dist/plugins/browser/index.js +0 -629
- package/dist/plugins/browser/ui.js +0 -13
- package/dist/plugins/file-system/index.js +0 -171
- package/dist/plugins/file-system/ui.js +0 -6
- package/dist/plugins/llm/context-budget.js +0 -139
- package/dist/plugins/llm/context-shaping.js +0 -177
- package/dist/plugins/llm/index.js +0 -380
- package/dist/plugins/memory/index.js +0 -220
- package/dist/plugins/memory/memory.js +0 -122
- package/dist/plugins/memory/prompt.js +0 -55
- package/dist/plugins/memory/types.js +0 -45
- package/dist/plugins/meta-agent/index.js +0 -570
- package/dist/plugins/meta-agent/ui.js +0 -11
- package/dist/plugins/shell/index.js +0 -100
- package/dist/plugins/shell/ui.js +0 -6
- package/dist/plugins/skills/index.js +0 -286
- package/dist/plugins/skills/types.js +0 -50
- package/dist/plugins/skills/ui.js +0 -12
- package/dist/registry/agent-registry.js +0 -35
- package/dist/registry/index.js +0 -2
- package/dist/registry/plugin-loader.js +0 -499
- package/dist/registry/plugin-registry.js +0 -44
- package/dist/registry/ts-agent-loader.js +0 -82
- package/dist/registry/yaml-agent-loader.js +0 -246
- package/dist/runtime/execution-trace.js +0 -41
- package/dist/runtime/intent-routing.js +0 -26
- package/dist/runtime/openbot-runtime.js +0 -354
- package/dist/server.js +0 -890
- package/dist/session.js +0 -179
- package/dist/ui/block.js +0 -12
- package/dist/ui/header.js +0 -52
- package/dist/ui/layout.js +0 -26
- package/dist/ui/navigation.js +0 -15
- package/dist/ui/settings.js +0 -106
- package/dist/ui/skills.js +0 -7
- package/dist/ui/thread.js +0 -16
- package/dist/ui/widgets/action-list.js +0 -2
- package/dist/ui/widgets/approval-card.js +0 -9
- package/dist/ui/widgets/code-snippet.js +0 -2
- package/dist/ui/widgets/data-block.js +0 -2
- package/dist/ui/widgets/data-table.js +0 -2
- package/dist/ui/widgets/delegation.js +0 -29
- package/dist/ui/widgets/empty-state.js +0 -2
- package/dist/ui/widgets/index.js +0 -23
- package/dist/ui/widgets/inquiry.js +0 -7
- package/dist/ui/widgets/key-value.js +0 -2
- package/dist/ui/widgets/progress-step.js +0 -2
- package/dist/ui/widgets/resource-card.js +0 -2
- package/dist/ui/widgets/status.js +0 -2
- package/dist/ui/widgets/todo-list.js +0 -2
- package/dist/version.js +0 -62
- /package/dist/{types.js → app/types.js} +0 -0
- /package/dist/{architecture/contracts.js → harness/types.js} +0 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { MelonyPlugin } from 'melony';
|
|
2
|
+
import z from 'zod';
|
|
3
|
+
import { OpenBotEvent, OpenBotState } from '../app/types.js';
|
|
4
|
+
import { mcpService } from '../harness/mcp.js';
|
|
5
|
+
|
|
6
|
+
function stringifyResult(value: unknown): string {
|
|
7
|
+
if (typeof value === 'string') {
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
return JSON.stringify(value, null, 2);
|
|
13
|
+
} catch {
|
|
14
|
+
return String(value);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const mcpToolDefinitions = {
|
|
19
|
+
mcp_list_tools: {
|
|
20
|
+
description:
|
|
21
|
+
'List available tools from a configured MCP server. Use this first before calling tools on an unknown server.',
|
|
22
|
+
inputSchema: z.object({
|
|
23
|
+
serverId: z.string().describe('Configured MCP server id (for example: github, notion, linear).'),
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
mcp_call: {
|
|
27
|
+
description:
|
|
28
|
+
'Call a tool on a configured MCP server. Provide tool arguments as a JSON object. Use mcp_list_tools first when uncertain.',
|
|
29
|
+
inputSchema: z.object({
|
|
30
|
+
serverId: z.string().describe('Configured MCP server id.'),
|
|
31
|
+
toolName: z.string().describe('Exact MCP tool name from mcp_list_tools.'),
|
|
32
|
+
args: z.record(z.string(), z.unknown()).default({}).describe('Tool arguments as a JSON object.'),
|
|
33
|
+
}),
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const mcpPlugin = (): MelonyPlugin<OpenBotState, OpenBotEvent> => (builder) => {
|
|
38
|
+
builder.on('action:mcp_list_tools', async function* (event, context) {
|
|
39
|
+
const serverId = (event.data as any)?.serverId as string;
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
const tools = await mcpService.listTools(serverId);
|
|
43
|
+
const toolNames = tools.map((tool) => `- ${tool.name}${tool.description ? `: ${tool.description}` : ''}`);
|
|
44
|
+
|
|
45
|
+
yield {
|
|
46
|
+
type: 'action:mcp_list_tools:result',
|
|
47
|
+
data: {
|
|
48
|
+
success: true,
|
|
49
|
+
serverId,
|
|
50
|
+
tools,
|
|
51
|
+
},
|
|
52
|
+
meta: event.meta,
|
|
53
|
+
} as any;
|
|
54
|
+
|
|
55
|
+
yield {
|
|
56
|
+
type: 'agent:output',
|
|
57
|
+
data: {
|
|
58
|
+
content:
|
|
59
|
+
toolNames.length > 0
|
|
60
|
+
? `MCP tools available on \`${serverId}\`:\n${toolNames.join('\n')}`
|
|
61
|
+
: `MCP server \`${serverId}\` has no tools.`,
|
|
62
|
+
},
|
|
63
|
+
meta: {
|
|
64
|
+
...(event.meta || {}),
|
|
65
|
+
agentId: context.state.agentId,
|
|
66
|
+
},
|
|
67
|
+
} as any;
|
|
68
|
+
} catch (error) {
|
|
69
|
+
const message = error instanceof Error ? error.message : 'Unknown MCP error';
|
|
70
|
+
yield {
|
|
71
|
+
type: 'action:mcp_list_tools:result',
|
|
72
|
+
data: {
|
|
73
|
+
success: false,
|
|
74
|
+
serverId,
|
|
75
|
+
tools: [],
|
|
76
|
+
error: message,
|
|
77
|
+
},
|
|
78
|
+
meta: event.meta,
|
|
79
|
+
} as any;
|
|
80
|
+
yield {
|
|
81
|
+
type: 'agent:output',
|
|
82
|
+
data: {
|
|
83
|
+
content: `Failed to list MCP tools for \`${serverId}\`: ${message}`,
|
|
84
|
+
},
|
|
85
|
+
meta: {
|
|
86
|
+
...(event.meta || {}),
|
|
87
|
+
agentId: context.state.agentId,
|
|
88
|
+
},
|
|
89
|
+
} as any;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
builder.on('action:mcp_call', async function* (event, context) {
|
|
94
|
+
const serverId = (event.data as any)?.serverId as string;
|
|
95
|
+
const toolName = (event.data as any)?.toolName as string;
|
|
96
|
+
const args = ((event.data as any)?.args || {}) as Record<string, unknown>;
|
|
97
|
+
|
|
98
|
+
try {
|
|
99
|
+
const result = await mcpService.callTool(serverId, toolName, args);
|
|
100
|
+
const rendered = stringifyResult(result);
|
|
101
|
+
|
|
102
|
+
yield {
|
|
103
|
+
type: 'action:mcp_call:result',
|
|
104
|
+
data: {
|
|
105
|
+
success: true,
|
|
106
|
+
serverId,
|
|
107
|
+
toolName,
|
|
108
|
+
result,
|
|
109
|
+
},
|
|
110
|
+
meta: event.meta,
|
|
111
|
+
} as any;
|
|
112
|
+
|
|
113
|
+
yield {
|
|
114
|
+
type: 'agent:output',
|
|
115
|
+
data: {
|
|
116
|
+
content: `MCP \`${serverId}.${toolName}\` result:\n\n${rendered}`,
|
|
117
|
+
},
|
|
118
|
+
meta: {
|
|
119
|
+
...(event.meta || {}),
|
|
120
|
+
agentId: context.state.agentId,
|
|
121
|
+
},
|
|
122
|
+
} as any;
|
|
123
|
+
} catch (error) {
|
|
124
|
+
const message = error instanceof Error ? error.message : 'Unknown MCP error';
|
|
125
|
+
yield {
|
|
126
|
+
type: 'action:mcp_call:result',
|
|
127
|
+
data: {
|
|
128
|
+
success: false,
|
|
129
|
+
serverId,
|
|
130
|
+
toolName,
|
|
131
|
+
error: message,
|
|
132
|
+
},
|
|
133
|
+
meta: event.meta,
|
|
134
|
+
} as any;
|
|
135
|
+
yield {
|
|
136
|
+
type: 'agent:output',
|
|
137
|
+
data: {
|
|
138
|
+
content: `MCP call failed for \`${serverId}.${toolName}\`: ${message}`,
|
|
139
|
+
},
|
|
140
|
+
meta: {
|
|
141
|
+
...(event.meta || {}),
|
|
142
|
+
agentId: context.state.agentId,
|
|
143
|
+
},
|
|
144
|
+
} as any;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const plugin = {
|
|
150
|
+
name: 'mcp',
|
|
151
|
+
description: 'Basic MCP integration for configured servers',
|
|
152
|
+
factory: mcpPlugin,
|
|
153
|
+
toolDefinitions: mcpToolDefinitions,
|
|
154
|
+
};
|