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.
Files changed (141) hide show
  1. package/.prettierrc +8 -0
  2. package/AGENTS.md +68 -0
  3. package/CONTRIBUTING.md +74 -0
  4. package/LICENSE +21 -0
  5. package/README.md +117 -14
  6. package/dist/agents/system.js +106 -0
  7. package/dist/app/cli.js +27 -0
  8. package/dist/app/config.js +64 -0
  9. package/dist/app/server.js +237 -0
  10. package/dist/app/utils.js +35 -0
  11. package/dist/harness/agent-harness.js +45 -0
  12. package/dist/harness/mcp.js +61 -0
  13. package/dist/harness/orchestrator.js +273 -0
  14. package/dist/harness/process.js +7 -0
  15. package/dist/plugins/ai-sdk.js +141 -0
  16. package/dist/plugins/delegation.js +52 -0
  17. package/dist/plugins/mcp.js +140 -0
  18. package/dist/plugins/storage.js +502 -0
  19. package/dist/plugins/ui.js +47 -0
  20. package/dist/registry/plugins.js +73 -0
  21. package/dist/services/storage.js +724 -0
  22. package/docs/README.md +7 -0
  23. package/docs/agents.md +83 -0
  24. package/docs/architecture.md +34 -0
  25. package/docs/plugins.md +77 -0
  26. package/logo-black.png +0 -0
  27. package/{dist/assets/logo.js → logo-black.svg} +24 -24
  28. package/{dist/ui/sidebar.js → logo-white.svg} +23 -88
  29. package/package.json +10 -9
  30. package/src/agents/system.ts +112 -0
  31. package/src/app/cli.ts +38 -0
  32. package/src/app/config.ts +104 -0
  33. package/src/app/server.ts +284 -0
  34. package/src/app/types.ts +476 -0
  35. package/src/app/utils.ts +43 -0
  36. package/src/assets/icon.svg +1 -0
  37. package/src/harness/agent-harness.ts +58 -0
  38. package/src/harness/mcp.ts +78 -0
  39. package/src/harness/orchestrator.ts +342 -0
  40. package/src/harness/process.ts +9 -0
  41. package/src/harness/types.ts +34 -0
  42. package/src/plugins/ai-sdk.ts +197 -0
  43. package/src/plugins/delegation.ts +60 -0
  44. package/src/plugins/mcp.ts +154 -0
  45. package/src/plugins/storage.ts +725 -0
  46. package/src/plugins/ui.ts +57 -0
  47. package/src/registry/plugins.ts +85 -0
  48. package/src/services/storage.ts +957 -0
  49. package/tsconfig.json +18 -0
  50. package/dist/agents/agent-creator.js +0 -74
  51. package/dist/agents/browser-agent.js +0 -31
  52. package/dist/agents/os-agent.js +0 -32
  53. package/dist/agents/planner-agent.js +0 -32
  54. package/dist/agents/topic-agent.js +0 -46
  55. package/dist/architecture/execution-engine.js +0 -151
  56. package/dist/architecture/intent-classifier.js +0 -26
  57. package/dist/architecture/planner.js +0 -106
  58. package/dist/automation-worker.js +0 -121
  59. package/dist/automations.js +0 -52
  60. package/dist/cli.js +0 -275
  61. package/dist/config.js +0 -53
  62. package/dist/core/agents.js +0 -41
  63. package/dist/core/delegation.js +0 -230
  64. package/dist/core/manager.js +0 -96
  65. package/dist/core/plugins.js +0 -74
  66. package/dist/core/router.js +0 -191
  67. package/dist/handlers/init.js +0 -29
  68. package/dist/handlers/session-change.js +0 -21
  69. package/dist/handlers/settings.js +0 -47
  70. package/dist/handlers/tab-change.js +0 -14
  71. package/dist/installers.js +0 -156
  72. package/dist/marketplace.js +0 -80
  73. package/dist/model-catalog.js +0 -132
  74. package/dist/model-defaults.js +0 -25
  75. package/dist/models.js +0 -47
  76. package/dist/open-bot.js +0 -51
  77. package/dist/orchestrator/direct-invocation.js +0 -13
  78. package/dist/orchestrator/events.js +0 -36
  79. package/dist/orchestrator/state.js +0 -54
  80. package/dist/orchestrator.js +0 -422
  81. package/dist/plugins/agent/index.js +0 -81
  82. package/dist/plugins/approval/index.js +0 -100
  83. package/dist/plugins/brain/identity.js +0 -77
  84. package/dist/plugins/brain/index.js +0 -204
  85. package/dist/plugins/brain/memory.js +0 -120
  86. package/dist/plugins/brain/prompt.js +0 -46
  87. package/dist/plugins/brain/types.js +0 -45
  88. package/dist/plugins/brain/ui.js +0 -7
  89. package/dist/plugins/browser/index.js +0 -629
  90. package/dist/plugins/browser/ui.js +0 -13
  91. package/dist/plugins/file-system/index.js +0 -171
  92. package/dist/plugins/file-system/ui.js +0 -6
  93. package/dist/plugins/llm/context-budget.js +0 -139
  94. package/dist/plugins/llm/context-shaping.js +0 -177
  95. package/dist/plugins/llm/index.js +0 -380
  96. package/dist/plugins/memory/index.js +0 -220
  97. package/dist/plugins/memory/memory.js +0 -122
  98. package/dist/plugins/memory/prompt.js +0 -55
  99. package/dist/plugins/memory/types.js +0 -45
  100. package/dist/plugins/meta-agent/index.js +0 -570
  101. package/dist/plugins/meta-agent/ui.js +0 -11
  102. package/dist/plugins/shell/index.js +0 -100
  103. package/dist/plugins/shell/ui.js +0 -6
  104. package/dist/plugins/skills/index.js +0 -286
  105. package/dist/plugins/skills/types.js +0 -50
  106. package/dist/plugins/skills/ui.js +0 -12
  107. package/dist/registry/agent-registry.js +0 -35
  108. package/dist/registry/index.js +0 -2
  109. package/dist/registry/plugin-loader.js +0 -499
  110. package/dist/registry/plugin-registry.js +0 -44
  111. package/dist/registry/ts-agent-loader.js +0 -82
  112. package/dist/registry/yaml-agent-loader.js +0 -246
  113. package/dist/runtime/execution-trace.js +0 -41
  114. package/dist/runtime/intent-routing.js +0 -26
  115. package/dist/runtime/openbot-runtime.js +0 -354
  116. package/dist/server.js +0 -890
  117. package/dist/session.js +0 -179
  118. package/dist/ui/block.js +0 -12
  119. package/dist/ui/header.js +0 -52
  120. package/dist/ui/layout.js +0 -26
  121. package/dist/ui/navigation.js +0 -15
  122. package/dist/ui/settings.js +0 -106
  123. package/dist/ui/skills.js +0 -7
  124. package/dist/ui/thread.js +0 -16
  125. package/dist/ui/widgets/action-list.js +0 -2
  126. package/dist/ui/widgets/approval-card.js +0 -9
  127. package/dist/ui/widgets/code-snippet.js +0 -2
  128. package/dist/ui/widgets/data-block.js +0 -2
  129. package/dist/ui/widgets/data-table.js +0 -2
  130. package/dist/ui/widgets/delegation.js +0 -29
  131. package/dist/ui/widgets/empty-state.js +0 -2
  132. package/dist/ui/widgets/index.js +0 -23
  133. package/dist/ui/widgets/inquiry.js +0 -7
  134. package/dist/ui/widgets/key-value.js +0 -2
  135. package/dist/ui/widgets/progress-step.js +0 -2
  136. package/dist/ui/widgets/resource-card.js +0 -2
  137. package/dist/ui/widgets/status.js +0 -2
  138. package/dist/ui/widgets/todo-list.js +0 -2
  139. package/dist/version.js +0 -62
  140. /package/dist/{types.js → app/types.js} +0 -0
  141. /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
+ }