openbot 0.2.3 → 0.2.6
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/README.md +1 -1
- package/dist/agents/agent-creator.js +58 -19
- package/dist/agents/os-agent.js +1 -4
- package/dist/agents/planner-agent.js +32 -0
- package/dist/agents/topic-agent.js +1 -1
- package/dist/architecture/contracts.js +1 -0
- package/dist/architecture/execution-engine.js +151 -0
- package/dist/architecture/intent-classifier.js +26 -0
- package/dist/architecture/planner.js +106 -0
- package/dist/automation-worker.js +121 -0
- package/dist/automations.js +52 -0
- package/dist/cli.js +116 -146
- package/dist/config.js +20 -0
- package/dist/core/agents.js +41 -0
- package/dist/core/delegation.js +124 -0
- package/dist/core/manager.js +73 -0
- package/dist/core/plugins.js +77 -0
- package/dist/core/router.js +40 -0
- package/dist/installers.js +156 -0
- package/dist/marketplace.js +80 -0
- package/dist/open-bot.js +34 -157
- package/dist/orchestrator.js +247 -51
- package/dist/plugins/approval/index.js +107 -3
- package/dist/plugins/brain/index.js +17 -86
- package/dist/plugins/brain/memory.js +1 -1
- package/dist/plugins/brain/prompt.js +8 -13
- package/dist/plugins/brain/types.js +0 -15
- package/dist/plugins/file-system/index.js +8 -8
- package/dist/plugins/llm/context-shaping.js +177 -0
- package/dist/plugins/llm/index.js +223 -49
- package/dist/plugins/memory/index.js +220 -0
- package/dist/plugins/memory/memory.js +122 -0
- package/dist/plugins/memory/prompt.js +55 -0
- package/dist/plugins/memory/types.js +45 -0
- package/dist/plugins/shell/index.js +3 -3
- package/dist/plugins/skills/index.js +9 -9
- package/dist/registry/index.js +1 -4
- package/dist/registry/plugin-loader.js +361 -56
- package/dist/registry/plugin-registry.js +21 -4
- package/dist/registry/ts-agent-loader.js +4 -4
- package/dist/registry/yaml-agent-loader.js +78 -20
- package/dist/runtime/execution-trace.js +41 -0
- package/dist/runtime/intent-routing.js +26 -0
- package/dist/runtime/openbot-runtime.js +354 -0
- package/dist/server.js +513 -41
- package/dist/ui/widgets/approval-card.js +22 -2
- package/dist/ui/widgets/delegation.js +29 -0
- package/dist/version.js +62 -0
- package/package.json +4 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as fs from "node:fs/promises";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
// --- Prompt Builder ---
|
|
4
|
+
/**
|
|
5
|
+
* Build the memory's section of the system prompt.
|
|
6
|
+
*
|
|
7
|
+
* Includes only what the memory owns:
|
|
8
|
+
* - Environment context
|
|
9
|
+
* - Agent definition (from AGENT.md)
|
|
10
|
+
* - A handful of the most recent memories
|
|
11
|
+
* - Memory capability instructions
|
|
12
|
+
*
|
|
13
|
+
* Skills are handled by the separate skills plugin and composed
|
|
14
|
+
* at the top level in open-bot.ts.
|
|
15
|
+
*/
|
|
16
|
+
export async function buildMemoryPrompt(baseDir, modules, context) {
|
|
17
|
+
const parts = [];
|
|
18
|
+
const state = context?.state;
|
|
19
|
+
const currentCwd = state?.cwd || process.cwd();
|
|
20
|
+
// 1. Environment context
|
|
21
|
+
const now = new Date();
|
|
22
|
+
parts.push(`<environment>
|
|
23
|
+
- Time: ${now.toLocaleString()} (${Intl.DateTimeFormat().resolvedOptions().timeZone})
|
|
24
|
+
- CWD: ${currentCwd}
|
|
25
|
+
- Bot Home: ${baseDir}
|
|
26
|
+
</environment>`);
|
|
27
|
+
// 2. Agent definition (manual edit only)
|
|
28
|
+
try {
|
|
29
|
+
const agentPath = path.join(baseDir, "AGENT.md");
|
|
30
|
+
const agentMd = await fs.readFile(agentPath, "utf-8");
|
|
31
|
+
if (agentMd.trim()) {
|
|
32
|
+
parts.push(`<agent_definition>\n${agentMd.trim()}\n</agent_definition>`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// Skip if AGENT.md doesn't exist yet
|
|
37
|
+
}
|
|
38
|
+
// 3. Recent memories (lean — just a few to keep context fresh)
|
|
39
|
+
const recentFacts = await modules.memory.getRecentFacts(5);
|
|
40
|
+
if (recentFacts.length > 0) {
|
|
41
|
+
const factsList = recentFacts
|
|
42
|
+
.map((f) => `- ${f.content}${f.tags.length > 0 ? ` [${f.tags.join(", ")}]` : ""}`)
|
|
43
|
+
.join("\n");
|
|
44
|
+
parts.push(`<recent_memories>\n${factsList}\n</recent_memories>`);
|
|
45
|
+
}
|
|
46
|
+
// 4. Memory capabilities
|
|
47
|
+
parts.push(`<memory_tools>
|
|
48
|
+
Use these to manage your persistent state:
|
|
49
|
+
- \`remember(content, tags)\`: Store facts/preferences
|
|
50
|
+
- \`recall(query, tags)\`: Search long-term memory
|
|
51
|
+
- \`forget(memoryId)\`: Remove outdated info
|
|
52
|
+
- \`journal(content)\`: Record session reflections
|
|
53
|
+
</memory_tools>`);
|
|
54
|
+
return `\n${parts.join("\n\n")}\n`;
|
|
55
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// --- Tool Definitions ---
|
|
3
|
+
export const memoryToolDefinitions = {
|
|
4
|
+
// Memory tools
|
|
5
|
+
remember: {
|
|
6
|
+
description: "Store something important in long-term memory. Use for user preferences, learned facts, project context, etc.",
|
|
7
|
+
inputSchema: z.object({
|
|
8
|
+
content: z
|
|
9
|
+
.string()
|
|
10
|
+
.describe("The information to remember"),
|
|
11
|
+
tags: z
|
|
12
|
+
.array(z.string())
|
|
13
|
+
.optional()
|
|
14
|
+
.describe("Tags for categorization (e.g., 'user-preference', 'project', 'learning')"),
|
|
15
|
+
}),
|
|
16
|
+
},
|
|
17
|
+
recall: {
|
|
18
|
+
description: "Search your memory for relevant information. Use before answering questions that might relate to past interactions.",
|
|
19
|
+
inputSchema: z.object({
|
|
20
|
+
query: z.string().describe("What to search for in memory"),
|
|
21
|
+
tags: z
|
|
22
|
+
.array(z.string())
|
|
23
|
+
.optional()
|
|
24
|
+
.describe("Filter by specific tags"),
|
|
25
|
+
limit: z
|
|
26
|
+
.number()
|
|
27
|
+
.optional()
|
|
28
|
+
.describe("Max results to return (default: 5)"),
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
forget: {
|
|
32
|
+
description: "Remove a specific memory entry by ID.",
|
|
33
|
+
inputSchema: z.object({
|
|
34
|
+
memoryId: z
|
|
35
|
+
.string()
|
|
36
|
+
.describe("The ID of the memory entry to remove"),
|
|
37
|
+
}),
|
|
38
|
+
},
|
|
39
|
+
journal: {
|
|
40
|
+
description: "Add a journal entry for today. Use for session notes, learnings, and reflections.",
|
|
41
|
+
inputSchema: z.object({
|
|
42
|
+
content: z.string().describe("Journal entry content"),
|
|
43
|
+
}),
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -42,7 +42,7 @@ export const shellPlugin = (options = {}) => (builder) => {
|
|
|
42
42
|
data: { message: `Directory changed to ${newCwd}`, severity: "success" }
|
|
43
43
|
};
|
|
44
44
|
yield {
|
|
45
|
-
type: "action:
|
|
45
|
+
type: "action:result",
|
|
46
46
|
data: {
|
|
47
47
|
action: "executeCommand",
|
|
48
48
|
toolCallId,
|
|
@@ -62,7 +62,7 @@ export const shellPlugin = (options = {}) => (builder) => {
|
|
|
62
62
|
data: { message: `Command executed successfully`, severity: "success" }
|
|
63
63
|
};
|
|
64
64
|
yield {
|
|
65
|
-
type: "action:
|
|
65
|
+
type: "action:result",
|
|
66
66
|
data: {
|
|
67
67
|
action: "executeCommand",
|
|
68
68
|
toolCallId,
|
|
@@ -76,7 +76,7 @@ export const shellPlugin = (options = {}) => (builder) => {
|
|
|
76
76
|
}
|
|
77
77
|
catch (error) {
|
|
78
78
|
yield {
|
|
79
|
-
type: "action:
|
|
79
|
+
type: "action:result",
|
|
80
80
|
data: {
|
|
81
81
|
action: "executeCommand",
|
|
82
82
|
toolCallId,
|
|
@@ -116,7 +116,7 @@ You have no skills yet. When you learn reusable patterns, create skills using \`
|
|
|
116
116
|
// --- Prompt Builder ---
|
|
117
117
|
/**
|
|
118
118
|
* Create a prompt builder that generates the skills section
|
|
119
|
-
* of the system prompt. Use alongside the
|
|
119
|
+
* of the system prompt. Use alongside the memory prompt builder.
|
|
120
120
|
*/
|
|
121
121
|
export function createSkillsPromptBuilder(baseDir) {
|
|
122
122
|
const expandedBase = expandPath(baseDir);
|
|
@@ -128,7 +128,7 @@ export function createSkillsPromptBuilder(baseDir) {
|
|
|
128
128
|
* Skills Plugin for Melony
|
|
129
129
|
*
|
|
130
130
|
* Manages reusable skill definitions: load, create, update, list.
|
|
131
|
-
* Fully independent from the
|
|
131
|
+
* Fully independent from the memory plugin.
|
|
132
132
|
*/
|
|
133
133
|
export const skillsPlugin = (options) => (builder) => {
|
|
134
134
|
const expandedBase = expandPath(options.baseDir);
|
|
@@ -155,7 +155,7 @@ export const skillsPlugin = (options) => (builder) => {
|
|
|
155
155
|
},
|
|
156
156
|
};
|
|
157
157
|
yield {
|
|
158
|
-
type: "action:
|
|
158
|
+
type: "action:result",
|
|
159
159
|
data: {
|
|
160
160
|
action: "loadSkill",
|
|
161
161
|
toolCallId,
|
|
@@ -165,7 +165,7 @@ export const skillsPlugin = (options) => (builder) => {
|
|
|
165
165
|
}
|
|
166
166
|
catch {
|
|
167
167
|
yield {
|
|
168
|
-
type: "action:
|
|
168
|
+
type: "action:result",
|
|
169
169
|
data: {
|
|
170
170
|
action: "loadSkill",
|
|
171
171
|
toolCallId,
|
|
@@ -179,7 +179,7 @@ export const skillsPlugin = (options) => (builder) => {
|
|
|
179
179
|
const { toolCallId } = event.data;
|
|
180
180
|
const skillsList = await skills.list();
|
|
181
181
|
yield {
|
|
182
|
-
type: "action:
|
|
182
|
+
type: "action:result",
|
|
183
183
|
data: {
|
|
184
184
|
action: "listSkills",
|
|
185
185
|
toolCallId,
|
|
@@ -197,7 +197,7 @@ export const skillsPlugin = (options) => (builder) => {
|
|
|
197
197
|
data: { message: `Skill "${title}" created`, severity: "success" },
|
|
198
198
|
};
|
|
199
199
|
yield {
|
|
200
|
-
type: "action:
|
|
200
|
+
type: "action:result",
|
|
201
201
|
data: {
|
|
202
202
|
action: "createSkill",
|
|
203
203
|
toolCallId,
|
|
@@ -218,7 +218,7 @@ export const skillsPlugin = (options) => (builder) => {
|
|
|
218
218
|
},
|
|
219
219
|
};
|
|
220
220
|
yield {
|
|
221
|
-
type: "action:
|
|
221
|
+
type: "action:result",
|
|
222
222
|
data: {
|
|
223
223
|
action: "createSkill",
|
|
224
224
|
toolCallId,
|
|
@@ -240,7 +240,7 @@ export const skillsPlugin = (options) => (builder) => {
|
|
|
240
240
|
},
|
|
241
241
|
};
|
|
242
242
|
yield {
|
|
243
|
-
type: "action:
|
|
243
|
+
type: "action:result",
|
|
244
244
|
data: {
|
|
245
245
|
action: "updateSkill",
|
|
246
246
|
toolCallId,
|
|
@@ -265,7 +265,7 @@ export const skillsPlugin = (options) => (builder) => {
|
|
|
265
265
|
},
|
|
266
266
|
};
|
|
267
267
|
yield {
|
|
268
|
-
type: "action:
|
|
268
|
+
type: "action:result",
|
|
269
269
|
data: {
|
|
270
270
|
action: "updateSkill",
|
|
271
271
|
toolCallId,
|
package/dist/registry/index.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
export { PluginRegistry } from "./plugin-registry.js";
|
|
2
|
-
export {
|
|
3
|
-
export { discoverYamlAgents, listYamlAgents } from "./yaml-agent-loader.js";
|
|
4
|
-
export { discoverTsAgents } from "./ts-agent-loader.js";
|
|
5
|
-
export { loadPluginsFromDir } from "./plugin-loader.js";
|
|
2
|
+
export { discoverPlugins, listPlugins, readAgentConfig, getPluginMetadata, ensurePluginReady, } from "./plugin-loader.js";
|