openbot 0.2.3 → 0.2.5

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 (49) hide show
  1. package/README.md +1 -1
  2. package/dist/agents/agent-creator.js +58 -19
  3. package/dist/agents/os-agent.js +1 -4
  4. package/dist/agents/planner-agent.js +32 -0
  5. package/dist/agents/topic-agent.js +1 -1
  6. package/dist/architecture/contracts.js +1 -0
  7. package/dist/architecture/execution-engine.js +151 -0
  8. package/dist/architecture/intent-classifier.js +26 -0
  9. package/dist/architecture/planner.js +106 -0
  10. package/dist/automation-worker.js +121 -0
  11. package/dist/automations.js +52 -0
  12. package/dist/cli.js +54 -141
  13. package/dist/config.js +20 -0
  14. package/dist/core/agents.js +41 -0
  15. package/dist/core/delegation.js +124 -0
  16. package/dist/core/manager.js +73 -0
  17. package/dist/core/plugins.js +77 -0
  18. package/dist/core/router.js +40 -0
  19. package/dist/installers.js +170 -0
  20. package/dist/marketplace.js +80 -0
  21. package/dist/open-bot.js +34 -157
  22. package/dist/orchestrator.js +247 -51
  23. package/dist/plugins/approval/index.js +107 -3
  24. package/dist/plugins/brain/index.js +17 -86
  25. package/dist/plugins/brain/memory.js +1 -1
  26. package/dist/plugins/brain/prompt.js +8 -13
  27. package/dist/plugins/brain/types.js +0 -15
  28. package/dist/plugins/file-system/index.js +8 -8
  29. package/dist/plugins/llm/context-shaping.js +177 -0
  30. package/dist/plugins/llm/index.js +223 -49
  31. package/dist/plugins/memory/index.js +220 -0
  32. package/dist/plugins/memory/memory.js +122 -0
  33. package/dist/plugins/memory/prompt.js +55 -0
  34. package/dist/plugins/memory/types.js +45 -0
  35. package/dist/plugins/shell/index.js +3 -3
  36. package/dist/plugins/skills/index.js +9 -9
  37. package/dist/registry/index.js +1 -4
  38. package/dist/registry/plugin-loader.js +339 -56
  39. package/dist/registry/plugin-registry.js +21 -4
  40. package/dist/registry/ts-agent-loader.js +4 -4
  41. package/dist/registry/yaml-agent-loader.js +78 -20
  42. package/dist/runtime/execution-trace.js +41 -0
  43. package/dist/runtime/intent-routing.js +26 -0
  44. package/dist/runtime/openbot-runtime.js +354 -0
  45. package/dist/server.js +489 -40
  46. package/dist/ui/widgets/approval-card.js +22 -2
  47. package/dist/ui/widgets/delegation.js +29 -0
  48. package/dist/version.js +62 -0
  49. package/package.json +7 -7
@@ -1,8 +1,28 @@
1
1
  import { ui } from '@melony/ui-kit/server';
2
- export const approvalCard = (title, description, approveAction, denyAction) => ui.box({ border: true, radius: 'md', padding: 'md' }, [
2
+ export const approvalCard = (title, data, approveAction, denyAction) => ui.box({ border: true, radius: 'md', padding: 'md' }, [
3
3
  ui.col({ gap: 'sm' }, [
4
4
  ui.heading(title, { level: 4 }),
5
- ui.text(description, { size: 'sm', color: 'muted' }),
5
+ ui.text(data.summary, { size: 'sm', color: 'muted' }),
6
+ ...(data.details?.length
7
+ ? [
8
+ ui.box({ border: true, radius: 'sm', padding: 'sm' }, [
9
+ ui.col({ gap: 'xs' }, data.details.map((detail) => ui.row({ gap: 'sm', align: 'start' }, [
10
+ ui.text(`${detail.label}:`, { size: 'xs', color: 'muted', weight: 'semibold' }),
11
+ ui.text(detail.value, { size: 'xs' }),
12
+ ]))),
13
+ ]),
14
+ ]
15
+ : []),
16
+ ...(data.rawPayload
17
+ ? [
18
+ ui.box({ border: true, radius: 'sm', padding: 'sm' }, [
19
+ ui.col({ gap: 'xs' }, [
20
+ ui.text('Full action payload', { size: 'xs', color: 'muted', weight: 'semibold' }),
21
+ ui.text(data.rawPayload, { size: 'xs' }),
22
+ ]),
23
+ ]),
24
+ ]
25
+ : []),
6
26
  ui.row({ gap: 'sm', justify: 'end' }, [
7
27
  ui.button({ variant: 'outline', onClickAction: denyAction }, [
8
28
  ui.text('Deny', { size: 'xs' })
@@ -0,0 +1,29 @@
1
+ import { ui } from "@melony/ui-kit/server";
2
+ function stateLabel(state) {
3
+ if (state === "running")
4
+ return "Running";
5
+ if (state === "completed")
6
+ return "Completed";
7
+ return "Failed";
8
+ }
9
+ export const delegationWidget = (agentName, state, task, details) => {
10
+ const taskPreview = (task || "").trim();
11
+ const clippedTask = taskPreview.length > 240
12
+ ? `${taskPreview.slice(0, 237)}...`
13
+ : taskPreview;
14
+ const detailsPreview = (details || "").trim();
15
+ const clippedDetails = detailsPreview.length > 400
16
+ ? `${detailsPreview.slice(0, 397)}...`
17
+ : detailsPreview;
18
+ return ui.box({ border: true, radius: "md", padding: "md" }, [
19
+ ui.col({ gap: "sm" }, [
20
+ ui.heading(`Sub-agent: ${agentName}`, { level: 4 }),
21
+ ui.text(`State: ${stateLabel(state)}`, {
22
+ size: "xs",
23
+ color: state === "failed" ? "danger" : state === "completed" ? "success" : "muted",
24
+ }),
25
+ ...(clippedTask ? [ui.text(`Task: ${clippedTask}`, { size: "sm", color: "muted" })] : []),
26
+ ...(clippedDetails ? [ui.text(clippedDetails, { size: "sm" })] : []),
27
+ ]),
28
+ ]);
29
+ };
@@ -0,0 +1,62 @@
1
+ import { fileURLToPath } from "node:url";
2
+ import { dirname, join } from "node:path";
3
+ import { readFileSync } from "node:fs";
4
+ /**
5
+ * Gets the version of the currently running OpenBot instance.
6
+ * Works regardless of where the command is executed from.
7
+ */
8
+ export function getCurrentVersion() {
9
+ try {
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = dirname(__filename);
12
+ // Look for package.json by walking up from the current directory
13
+ let currentDir = __dirname;
14
+ for (let i = 0; i < 4; i++) {
15
+ const pkgPath = join(currentDir, "package.json");
16
+ try {
17
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
18
+ if (pkg.name === "openbot") {
19
+ return pkg.version;
20
+ }
21
+ }
22
+ catch {
23
+ // Continue walking up
24
+ }
25
+ currentDir = dirname(currentDir);
26
+ }
27
+ }
28
+ catch (err) {
29
+ console.warn("Could not determine OpenBot version:", err);
30
+ }
31
+ // Fallback to a hardcoded version if detection fails
32
+ return "0.2.3";
33
+ }
34
+ /**
35
+ * Fetches the latest version from NPM registry and checks for updates.
36
+ */
37
+ export async function getVersionStatus() {
38
+ const current = getCurrentVersion();
39
+ try {
40
+ const response = await fetch("https://registry.npmjs.org/openbot/latest", {
41
+ signal: AbortSignal.timeout(5000), // 5s timeout
42
+ });
43
+ if (!response.ok) {
44
+ throw new Error(`NPM registry returned ${response.status}`);
45
+ }
46
+ const data = await response.json();
47
+ const latest = data.version;
48
+ return {
49
+ current,
50
+ latest,
51
+ updateAvailable: current !== latest,
52
+ };
53
+ }
54
+ catch (error) {
55
+ console.error("Failed to check for updates:", error);
56
+ return {
57
+ current,
58
+ latest: current,
59
+ updateAvailable: false,
60
+ };
61
+ }
62
+ }
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "openbot",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "private": false,
5
5
  "type": "module",
6
+ "scripts": {
7
+ "dev": "tsx watch src/cli.ts server",
8
+ "build": "tsc",
9
+ "start": "node dist/cli.js server"
10
+ },
6
11
  "bin": {
7
12
  "openbot": "./dist/cli.js"
8
13
  },
@@ -28,10 +33,5 @@
28
33
  "@types/node": "^20.10.1",
29
34
  "tsx": "^4.21.0",
30
35
  "typescript": "^5.9.3"
31
- },
32
- "scripts": {
33
- "dev": "tsx watch src/cli.ts server",
34
- "build": "tsc",
35
- "start": "node dist/cli.js server"
36
36
  }
37
- }
37
+ }