openbot 0.2.12 → 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 -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
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import * as fs from "node:fs/promises";
|
|
2
|
-
import * as path from "node:path";
|
|
3
|
-
// --- Factory ---
|
|
4
|
-
export function createMemoryModule(baseDir) {
|
|
5
|
-
const memoryDir = path.join(baseDir, "memory");
|
|
6
|
-
const indexPath = path.join(memoryDir, "index.json");
|
|
7
|
-
const journalDir = path.join(memoryDir, "journal");
|
|
8
|
-
// --- Helpers ---
|
|
9
|
-
async function loadIndex() {
|
|
10
|
-
try {
|
|
11
|
-
const data = await fs.readFile(indexPath, "utf-8");
|
|
12
|
-
return JSON.parse(data);
|
|
13
|
-
}
|
|
14
|
-
catch {
|
|
15
|
-
return { entries: [] };
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
async function saveIndex(index) {
|
|
19
|
-
await fs.mkdir(memoryDir, { recursive: true });
|
|
20
|
-
await fs.writeFile(indexPath, JSON.stringify(index, null, 2), "utf-8");
|
|
21
|
-
}
|
|
22
|
-
function generateId() {
|
|
23
|
-
const timestamp = Date.now().toString(36);
|
|
24
|
-
const random = Math.random().toString(36).substring(2, 6);
|
|
25
|
-
return `mem_${timestamp}_${random}`;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Simple keyword-based relevance scoring.
|
|
29
|
-
* Splits query into terms (ignoring short words) and counts how many
|
|
30
|
-
* appear in the entry's content + tags. Returns a 0-1 score.
|
|
31
|
-
*/
|
|
32
|
-
function scoreMatch(entry, query) {
|
|
33
|
-
const queryTerms = query
|
|
34
|
-
.toLowerCase()
|
|
35
|
-
.split(/\s+/)
|
|
36
|
-
.filter((t) => t.length > 2);
|
|
37
|
-
if (queryTerms.length === 0)
|
|
38
|
-
return 0;
|
|
39
|
-
const searchable = `${entry.content} ${entry.tags.join(" ")}`.toLowerCase();
|
|
40
|
-
let matched = 0;
|
|
41
|
-
for (const term of queryTerms) {
|
|
42
|
-
if (searchable.includes(term)) {
|
|
43
|
-
matched++;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return matched / queryTerms.length;
|
|
47
|
-
}
|
|
48
|
-
// --- Module ---
|
|
49
|
-
return {
|
|
50
|
-
async initialize() {
|
|
51
|
-
await fs.mkdir(memoryDir, { recursive: true });
|
|
52
|
-
await fs.mkdir(journalDir, { recursive: true });
|
|
53
|
-
try {
|
|
54
|
-
await fs.access(indexPath);
|
|
55
|
-
}
|
|
56
|
-
catch {
|
|
57
|
-
await saveIndex({ entries: [] });
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
async store(content, tags = []) {
|
|
61
|
-
const index = await loadIndex();
|
|
62
|
-
const entry = {
|
|
63
|
-
id: generateId(),
|
|
64
|
-
content,
|
|
65
|
-
tags,
|
|
66
|
-
createdAt: new Date().toISOString(),
|
|
67
|
-
};
|
|
68
|
-
index.entries.push(entry);
|
|
69
|
-
await saveIndex(index);
|
|
70
|
-
return entry;
|
|
71
|
-
},
|
|
72
|
-
async recall(query, options) {
|
|
73
|
-
const { tags, limit = 5 } = options || {};
|
|
74
|
-
const index = await loadIndex();
|
|
75
|
-
let candidates = index.entries;
|
|
76
|
-
// Filter by tags if provided
|
|
77
|
-
if (tags && tags.length > 0) {
|
|
78
|
-
candidates = candidates.filter((entry) => tags.some((tag) => entry.tags.includes(tag)));
|
|
79
|
-
}
|
|
80
|
-
// Score and sort by relevance
|
|
81
|
-
const scored = candidates
|
|
82
|
-
.map((entry) => ({ entry, score: scoreMatch(entry, query) }))
|
|
83
|
-
.filter(({ score }) => score > 0)
|
|
84
|
-
.sort((a, b) => b.score - a.score)
|
|
85
|
-
.slice(0, limit);
|
|
86
|
-
// If no keyword matches found, fall back to most recent entries
|
|
87
|
-
if (scored.length === 0) {
|
|
88
|
-
return candidates.slice(-limit).reverse();
|
|
89
|
-
}
|
|
90
|
-
return scored.map(({ entry }) => entry);
|
|
91
|
-
},
|
|
92
|
-
async forget(memoryId) {
|
|
93
|
-
const index = await loadIndex();
|
|
94
|
-
const before = index.entries.length;
|
|
95
|
-
index.entries = index.entries.filter((e) => e.id !== memoryId);
|
|
96
|
-
if (index.entries.length < before) {
|
|
97
|
-
await saveIndex(index);
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
return false;
|
|
101
|
-
},
|
|
102
|
-
async addJournalEntry(content) {
|
|
103
|
-
const today = new Date().toISOString().split("T")[0]; // e.g., "2026-02-12"
|
|
104
|
-
const journalPath = path.join(journalDir, `${today}.md`);
|
|
105
|
-
const timestamp = new Date().toLocaleTimeString();
|
|
106
|
-
const entry = `\n## ${timestamp}\n${content}\n`;
|
|
107
|
-
await fs.mkdir(journalDir, { recursive: true });
|
|
108
|
-
try {
|
|
109
|
-
await fs.access(journalPath);
|
|
110
|
-
await fs.appendFile(journalPath, entry, "utf-8");
|
|
111
|
-
}
|
|
112
|
-
catch {
|
|
113
|
-
const header = `# Journal - ${today}\n`;
|
|
114
|
-
await fs.writeFile(journalPath, header + entry, "utf-8");
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
async getRecentFacts(limit = 3) {
|
|
118
|
-
const index = await loadIndex();
|
|
119
|
-
return (index?.entries ?? []).slice(-limit);
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
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
|
-
};
|