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
@@ -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
- };