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.
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 +6 -5
  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 -279
  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,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
+ };