openbot 0.2.11 → 0.2.13
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 +10 -9
- 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 -275
- 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,57 @@
|
|
|
1
|
+
import { MelonyPlugin } from 'melony';
|
|
2
|
+
import { OpenBotEvent, OpenBotState } from '../app/types.js';
|
|
3
|
+
import z from 'zod';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* UI Plugin for Melony.
|
|
7
|
+
* Provides tools for agents to trigger interactive UI widgets.
|
|
8
|
+
*/
|
|
9
|
+
export const uiPlugin = (): MelonyPlugin<OpenBotState, OpenBotEvent> => (builder) => {
|
|
10
|
+
builder.on('action:render_ui_widget', async function* (event, context) {
|
|
11
|
+
const { kind, title, props } = event.data;
|
|
12
|
+
|
|
13
|
+
const finalProps = { ...(props as Record<string, unknown>) };
|
|
14
|
+
|
|
15
|
+
// Auto-inject todos if it's a todo_list and they aren't provided
|
|
16
|
+
if (kind === 'todo_list' && !finalProps.todos) {
|
|
17
|
+
finalProps.todos = (context.state.threadDetails?.state as any)?.todos || [];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
yield {
|
|
21
|
+
type: 'client:ui:widget',
|
|
22
|
+
data: {
|
|
23
|
+
widgetId: `${kind}_${Date.now()}`,
|
|
24
|
+
kind,
|
|
25
|
+
title: title || (kind === 'approval' ? 'Approval Required' : kind === 'todo_list' ? 'Task List' : 'Details Required'),
|
|
26
|
+
props: finalProps,
|
|
27
|
+
},
|
|
28
|
+
meta: event.meta,
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const uiToolDefinitions = {
|
|
34
|
+
render_ui_widget: {
|
|
35
|
+
description: 'Render an interactive UI widget (approval, todo_list, or form) in the conversation.',
|
|
36
|
+
inputSchema: z.object({
|
|
37
|
+
kind: z.enum(['approval', 'todo_list', 'form']).describe('The type of widget to render.'),
|
|
38
|
+
title: z.string().optional().describe('Optional title for the widget.'),
|
|
39
|
+
props: z.record(z.string(), z.unknown()).describe(
|
|
40
|
+
'Properties for the widget. \n' +
|
|
41
|
+
'- For "approval": { message: string, actionId: string }\n' +
|
|
42
|
+
'- For "todo_list": { title?: string } (Note: current thread todos are auto-injected if not provided)\n' +
|
|
43
|
+
'- For "form": { schema: Array<{ id, label, type, options?, required? }>, submitLabel?: string }'
|
|
44
|
+
),
|
|
45
|
+
}),
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const plugin = {
|
|
50
|
+
name: 'ui',
|
|
51
|
+
description: 'UI Widgets plugin',
|
|
52
|
+
version: '1.0.0',
|
|
53
|
+
author: 'OpenBot',
|
|
54
|
+
license: 'MIT',
|
|
55
|
+
factory: uiPlugin,
|
|
56
|
+
toolDefinitions: uiToolDefinitions,
|
|
57
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { pathToFileURL } from 'node:url';
|
|
4
|
+
import { MelonyPlugin } from 'melony';
|
|
5
|
+
import { OpenBotEvent, OpenBotState } from '../app/types.js';
|
|
6
|
+
import { aiSdkPlugin } from '../plugins/ai-sdk.js';
|
|
7
|
+
import { storagePlugin } from '../plugins/storage.js';
|
|
8
|
+
import { storageService } from '../services/storage.js';
|
|
9
|
+
import { DEFAULT_BASE_DIR, loadConfig, resolvePath } from '../app/config.js';
|
|
10
|
+
import { delegationPlugin } from '../plugins/delegation.js';
|
|
11
|
+
import { mcpPlugin } from '../plugins/mcp.js';
|
|
12
|
+
import { uiPlugin } from '../plugins/ui.js';
|
|
13
|
+
import { orchestratorService } from '../harness/orchestrator.js';
|
|
14
|
+
|
|
15
|
+
let pluginsDir: string | null = null;
|
|
16
|
+
const loadedPlugins = new Set<string>();
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Initializes the plugins directory.
|
|
20
|
+
*/
|
|
21
|
+
export function initPlugins(dir?: string) {
|
|
22
|
+
if (dir) {
|
|
23
|
+
pluginsDir = dir;
|
|
24
|
+
} else {
|
|
25
|
+
const config = loadConfig();
|
|
26
|
+
const baseDir = config.baseDir || DEFAULT_BASE_DIR;
|
|
27
|
+
pluginsDir = path.join(resolvePath(baseDir), 'plugins');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Resolves a plugin from its name and config.
|
|
33
|
+
*/
|
|
34
|
+
export async function resolvePlugin(
|
|
35
|
+
pluginName: string,
|
|
36
|
+
config: any = {},
|
|
37
|
+
): Promise<MelonyPlugin<OpenBotState, OpenBotEvent> | null> {
|
|
38
|
+
// 1. Built-in plugins
|
|
39
|
+
switch (pluginName) {
|
|
40
|
+
case 'storage':
|
|
41
|
+
return storagePlugin({ storage: storageService, ...config });
|
|
42
|
+
case 'ai-sdk':
|
|
43
|
+
return aiSdkPlugin({
|
|
44
|
+
storage: storageService,
|
|
45
|
+
...config,
|
|
46
|
+
});
|
|
47
|
+
case 'delegation':
|
|
48
|
+
return delegationPlugin();
|
|
49
|
+
case 'mcp':
|
|
50
|
+
return mcpPlugin();
|
|
51
|
+
case 'ui':
|
|
52
|
+
return uiPlugin();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 2. Search for external plugins in the initialized plugins directory
|
|
56
|
+
if (!pluginsDir) {
|
|
57
|
+
initPlugins();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (pluginsDir) {
|
|
61
|
+
const pluginDir = path.resolve(pluginsDir, pluginName);
|
|
62
|
+
const distPath = path.join(pluginDir, 'dist', 'index.js');
|
|
63
|
+
|
|
64
|
+
if (fs.existsSync(distPath)) {
|
|
65
|
+
try {
|
|
66
|
+
// Dynamic import needs file:// URL for absolute paths
|
|
67
|
+
const module = await import(pathToFileURL(distPath).href);
|
|
68
|
+
const factory = module.plugin.factory;
|
|
69
|
+
|
|
70
|
+
if (typeof factory === 'function') {
|
|
71
|
+
if (!loadedPlugins.has(pluginName)) {
|
|
72
|
+
console.log(`[plugins] Loaded community plugin "${pluginName}" from ${distPath}`);
|
|
73
|
+
loadedPlugins.add(pluginName);
|
|
74
|
+
}
|
|
75
|
+
return factory(config);
|
|
76
|
+
}
|
|
77
|
+
} catch (e) {
|
|
78
|
+
console.warn(`[plugins] Failed to load plugin "${pluginName}" from ${distPath}:`, e);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
console.warn(`[plugins] Plugin "${pluginName}" not found in registry or external directory.`);
|
|
84
|
+
return null;
|
|
85
|
+
}
|