maestro-agent 0.0.1 → 0.0.3

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 (111) hide show
  1. package/README.md +316 -2
  2. package/bin/maestro.ts +5 -0
  3. package/dist/maestro +0 -0
  4. package/dist/web/apple-touch-icon.png +0 -0
  5. package/dist/web/assets/Connections-BMA04Ycg.js +11 -0
  6. package/dist/web/assets/GanttView-DXjh0gxg.js +49 -0
  7. package/dist/web/assets/Home-Ct3Ho0Qt.js +1 -0
  8. package/dist/web/assets/HooksCrons--0kyVJcR.js +11 -0
  9. package/dist/web/assets/ProjectDetail-B_IqEpFu.js +1 -0
  10. package/dist/web/assets/Roles-D1tIQzto.js +24 -0
  11. package/dist/web/assets/Settings-yts4LUmH.js +11 -0
  12. package/dist/web/assets/Skills-DbuNLjIV.js +12 -0
  13. package/dist/web/assets/Wizard-vJol8-Y4.js +11 -0
  14. package/dist/web/assets/WorkspaceChat-DrsLs4m2.js +56 -0
  15. package/dist/web/assets/WorkspaceDashboard-B9vgrd2Z.js +6 -0
  16. package/dist/web/assets/WorkspaceNew-DoNGYHCG.js +1 -0
  17. package/dist/web/assets/WorkspaceProjects-DDp3mUse.js +6 -0
  18. package/dist/web/assets/WorkspaceSchedules-BTjmCbYG.js +1 -0
  19. package/dist/web/assets/WorkspaceTasks-mPU-bhKR.js +41 -0
  20. package/dist/web/assets/activity-CIA8bIA4.js +6 -0
  21. package/dist/web/assets/addon-fit-BlxrFPDK.js +1 -0
  22. package/dist/web/assets/arrow-right-S7ID7nDp.js +6 -0
  23. package/dist/web/assets/badge-DDTUzWIi.js +1 -0
  24. package/dist/web/assets/circle-check-B3P1qK0Z.js +6 -0
  25. package/dist/web/assets/clock-f9aYZox0.js +6 -0
  26. package/dist/web/assets/index-BRo4Du_s.js +11 -0
  27. package/dist/web/assets/index-C7kx39S9.js +196 -0
  28. package/dist/web/assets/index-D6LSdZea.css +1 -0
  29. package/dist/web/assets/plus-BHnOxbns.js +6 -0
  30. package/dist/web/assets/refresh-cw-BWX04Hg3.js +6 -0
  31. package/dist/web/assets/save-BLbb_9xz.js +6 -0
  32. package/dist/web/assets/sparkles-CDr6Dw1e.js +6 -0
  33. package/dist/web/assets/trash-2-9-ThEdey.js +6 -0
  34. package/dist/web/assets/useEventStream-DXt2Hmei.js +1 -0
  35. package/dist/web/assets/x-DVdKPXXy.js +6 -0
  36. package/dist/web/assets/xterm-DYP7pi_n.css +32 -0
  37. package/dist/web/assets/xterm-DlVFs1Kw.js +9 -0
  38. package/dist/web/favicon-512.png +0 -0
  39. package/dist/web/favicon.png +0 -0
  40. package/dist/web/index.html +15 -0
  41. package/package.json +49 -6
  42. package/src/api/agents.ts +76 -0
  43. package/src/api/audit.ts +19 -0
  44. package/src/api/autopilot.ts +73 -0
  45. package/src/api/chat.ts +801 -0
  46. package/src/api/chief.ts +84 -0
  47. package/src/api/config.ts +39 -0
  48. package/src/api/gantt.ts +72 -0
  49. package/src/api/hooks.ts +54 -0
  50. package/src/api/inbox.ts +125 -0
  51. package/src/api/lark.ts +32 -0
  52. package/src/api/memory.ts +37 -0
  53. package/src/api/ops.ts +89 -0
  54. package/src/api/projects.ts +105 -0
  55. package/src/api/roles.ts +123 -0
  56. package/src/api/runtimes.ts +62 -0
  57. package/src/api/scheduled-tasks.ts +203 -0
  58. package/src/api/sessions.ts +479 -0
  59. package/src/api/skills.ts +386 -0
  60. package/src/api/tasks.ts +457 -0
  61. package/src/api/telegram.ts +94 -0
  62. package/src/api/templates.ts +36 -0
  63. package/src/api/webhooks.ts +20 -0
  64. package/src/api/workspaces.ts +150 -0
  65. package/src/bridges/lark/index.ts +213 -0
  66. package/src/bridges/telegram/index.ts +273 -0
  67. package/src/bridges/telegram/polling.ts +185 -0
  68. package/src/chat/index.ts +86 -0
  69. package/src/chief/index.ts +461 -0
  70. package/src/core/cli.ts +333 -0
  71. package/src/core/db.ts +53 -0
  72. package/src/core/event-bus.ts +33 -0
  73. package/src/core/index.ts +6 -0
  74. package/src/core/migrations.ts +303 -0
  75. package/src/core/router.ts +69 -0
  76. package/src/core/schema.sql +232 -0
  77. package/src/core/server.ts +308 -0
  78. package/src/core/validate.ts +22 -0
  79. package/src/discovery/index.ts +194 -0
  80. package/src/gateway/adapters/telegram.ts +148 -0
  81. package/src/gateway/index.ts +31 -0
  82. package/src/gateway/manager.ts +176 -0
  83. package/src/gateway/types.ts +77 -0
  84. package/src/inbox/index.ts +500 -0
  85. package/src/ops/artifact-sync.ts +65 -0
  86. package/src/ops/autopilot.ts +338 -0
  87. package/src/ops/gc.ts +252 -0
  88. package/src/ops/index.ts +226 -0
  89. package/src/ops/project-serial.ts +52 -0
  90. package/src/ops/role-dispatch.ts +111 -0
  91. package/src/ops/runtime-scheduler.ts +447 -0
  92. package/src/ops/task-blocking.ts +65 -0
  93. package/src/ops/task-deps.ts +37 -0
  94. package/src/ops/task-workspace.ts +60 -0
  95. package/src/roles/index.ts +258 -0
  96. package/src/roles/prompt-assembler.ts +85 -0
  97. package/src/roles/workspace-role.ts +155 -0
  98. package/src/scheduler/index.ts +461 -0
  99. package/src/session/output-parser.ts +75 -0
  100. package/src/session/realtime-parser.ts +40 -0
  101. package/src/skills/builtin.ts +155 -0
  102. package/src/skills/skill-extractor.ts +452 -0
  103. package/src/skills/skill-md.ts +282 -0
  104. package/src/transport/http-api.ts +75 -0
  105. package/src/transport/index.ts +4 -0
  106. package/src/transport/local-pty.ts +119 -0
  107. package/src/transport/ssh.ts +176 -0
  108. package/src/transport/types.ts +20 -0
  109. package/src/workflows/index.ts +231 -0
  110. package/index.js +0 -1
  111. package/maestro-agent-0.0.1.tgz +0 -0
Binary file
Binary file
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <link rel="icon" type="image/png" sizes="64x64" href="/favicon.png" />
7
+ <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
8
+ <title>MAESTRO — The Conductor for AI Agents</title>
9
+ <script type="module" crossorigin src="/assets/index-C7kx39S9.js"></script>
10
+ <link rel="stylesheet" crossorigin href="/assets/index-D6LSdZea.css">
11
+ </head>
12
+ <body>
13
+ <div id="root"></div>
14
+ </body>
15
+ </html>
package/package.json CHANGED
@@ -1,10 +1,53 @@
1
1
  {
2
2
  "name": "maestro-agent",
3
- "version": "0.0.1",
4
- "description": "Placeholder package for maestro-agent",
5
- "main": "index.js",
6
- "license": "MIT",
7
- "publishConfig": {
8
- "access": "public"
3
+ "version": "0.0.3",
4
+ "description": "The Conductor for AI Agents — Multi-Agent Execution System with Task, Roles & Orchestration",
5
+ "type": "module",
6
+ "bin": {
7
+ "maestro": "./bin/maestro.ts"
8
+ },
9
+ "scripts": {
10
+ "dev": "bun run build:web && bun run bin/maestro.ts start",
11
+ "build:web": "cd web && bun run build",
12
+ "build": "bun build --compile bin/maestro.ts --outfile dist/maestro",
13
+ "build:binary": "bun run scripts/build.ts",
14
+ "lint": "bunx --bun @biomejs/biome check .",
15
+ "test": "bun test",
16
+ "release": "node scripts/release.js",
17
+ "release:dry": "node scripts/release.js --dry-run",
18
+ "release:patch": "node scripts/release.js --patch",
19
+ "release:minor": "node scripts/release.js --minor",
20
+ "release:major": "node scripts/release.js --major"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "bin",
25
+ "src",
26
+ "README.md"
27
+ ],
28
+ "keywords": [
29
+ "ai",
30
+ "agent",
31
+ "multi-agent",
32
+ "orchestration",
33
+ "cli",
34
+ "terminal"
35
+ ],
36
+ "author": "",
37
+ "license": "UNLICENSED",
38
+ "engines": {
39
+ "bun": ">=1.1.0"
40
+ },
41
+ "dependencies": {
42
+ "@anthropic-ai/sdk": "^0.98.0",
43
+ "ssh2": "^1.16.0"
44
+ },
45
+ "devDependencies": {
46
+ "@monaco-editor/react": "^4.6.0",
47
+ "@types/bun": "latest",
48
+ "@types/ssh2": "^1.15.0",
49
+ "@xterm/addon-fit": "^0.10.0",
50
+ "@xterm/xterm": "^5.5.0",
51
+ "chalk": "^5.6.2"
9
52
  }
10
53
  }
@@ -0,0 +1,76 @@
1
+ import type { Router } from "../core/router";
2
+ import { json, body } from "../core/router";
3
+ import type { HubContext } from "../core/server";
4
+ import { generateId, now } from "../core/db";
5
+ import { required } from "../core/validate";
6
+ import { createSession } from "./sessions";
7
+
8
+ export function registerAgentRoutes(router: Router, ctx: HubContext) {
9
+ router.get("/api/agents", () => {
10
+ const rows = ctx.db.query(`
11
+ SELECT
12
+ agent.*,
13
+ (
14
+ SELECT session.id
15
+ FROM session
16
+ WHERE session.agent_id = agent.id
17
+ ORDER BY session.started_at DESC
18
+ LIMIT 1
19
+ ) AS session_id
20
+ FROM agent
21
+ ORDER BY created_at DESC
22
+ `).all();
23
+ return json(rows);
24
+ });
25
+
26
+ router.post("/api/agents", async (req) => {
27
+ const { role_id, runtime_id, name, workdir } = await body(req);
28
+ required({ runtime_id, name }, ["runtime_id", "name"]);
29
+ const id = generateId("agent");
30
+ const ts = now();
31
+ ctx.db.run(
32
+ "INSERT INTO agent (id, role_id, runtime_id, name, workdir, status, created_at, last_active_at) VALUES (?, ?, ?, ?, ?, 'idle', ?, ?)",
33
+ [id, role_id || null, runtime_id, name, workdir || null, ts, ts]
34
+ );
35
+ ctx.bus.publish("agent.spawned", { id, name, runtime_id });
36
+ return json({ id, name, status: "idle", created_at: ts }, 201);
37
+ });
38
+
39
+ router.post("/api/agents/:id/retire", (_req, params) => {
40
+ ctx.db.run("UPDATE agent SET status = 'offline' WHERE id = ?", [params.id]);
41
+ ctx.bus.publish("agent.retired", { id: params.id });
42
+ return json({ id: params.id, status: "offline" });
43
+ });
44
+
45
+ // GET /api/agents/:id/sessions - history
46
+ router.get("/api/agents/:id/sessions", (_req, params) => {
47
+ const sessions = ctx.db.query("SELECT * FROM session WHERE agent_id = ? ORDER BY started_at DESC").all(params.id);
48
+ return json(sessions);
49
+ });
50
+
51
+ // POST /api/agents/:id/restart
52
+ router.post("/api/agents/:id/restart", async (_req, params) => {
53
+ const agent = ctx.db.query("SELECT * FROM agent WHERE id = ?").get(params.id) as any;
54
+ if (!agent) return json({ error: "Agent not found" }, 404);
55
+
56
+ // Kill current running session if any
57
+ const currentSession = ctx.db.query("SELECT * FROM session WHERE agent_id = ? AND status = 'running' ORDER BY started_at DESC LIMIT 1").get(params.id) as any;
58
+ if (currentSession) {
59
+ const proc = ctx.sessions.get(currentSession.id);
60
+ if (proc) {
61
+ proc.kill();
62
+ ctx.sessions.delete(currentSession.id);
63
+ }
64
+ const ts = now();
65
+ ctx.db.run("UPDATE session SET status = 'ended', ended_at = ? WHERE id = ?", [ts, currentSession.id]);
66
+ }
67
+
68
+ // Restart: create new session
69
+ const ts = now();
70
+ ctx.db.run("UPDATE agent SET status = 'idle', last_active_at = ? WHERE id = ?", [ts, params.id]);
71
+ const result = await createSession(ctx, { agent_id: params.id });
72
+ if ("error" in result) return json({ error: result.error }, result.status);
73
+ ctx.bus.publish("agent.restarted", { id: params.id, session_id: result.session.id });
74
+ return json({ agent_id: params.id, session: result.session });
75
+ });
76
+ }
@@ -0,0 +1,19 @@
1
+ import type { Router } from "../core/router";
2
+ import { json } from "../core/router";
3
+ import type { HubContext } from "../core/server";
4
+
5
+ export function registerAuditRoutes(router: Router, ctx: HubContext) {
6
+ router.get("/api/audit", (req) => {
7
+ const url = new URL(req.url);
8
+ const actor = url.searchParams.get("actor");
9
+ const action = url.searchParams.get("action");
10
+ const since = url.searchParams.get("since");
11
+ let sql = "SELECT * FROM audit_log WHERE 1=1";
12
+ const params: any[] = [];
13
+ if (actor) { sql += " AND actor = ?"; params.push(actor); }
14
+ if (action) { sql += " AND action = ?"; params.push(action); }
15
+ if (since) { sql += " AND created_at >= ?"; params.push(Number(since)); }
16
+ sql += " ORDER BY created_at DESC";
17
+ return json(ctx.db.query(sql).all(...params));
18
+ });
19
+ }
@@ -0,0 +1,73 @@
1
+ import type { Router } from "../core/router";
2
+ import { json, body } from "../core/router";
3
+ import type { HubContext } from "../core/server";
4
+ import { Autopilot } from "../ops/autopilot";
5
+ import type { AutopilotConfig } from "../ops/autopilot";
6
+
7
+ let autopilotInstance: Autopilot | null = null;
8
+
9
+ export function getAutopilot(): Autopilot | null {
10
+ return autopilotInstance;
11
+ }
12
+
13
+ export function initAutopilot(ctx: HubContext, config?: Partial<AutopilotConfig>): Autopilot {
14
+ if (autopilotInstance) {
15
+ autopilotInstance.stop();
16
+ }
17
+ autopilotInstance = new Autopilot(ctx, config);
18
+ autopilotInstance.start();
19
+ return autopilotInstance;
20
+ }
21
+
22
+ export function registerAutopilotRoutes(router: Router, ctx: HubContext) {
23
+ // GET /api/autopilot — get current status
24
+ router.get("/api/autopilot", () => {
25
+ if (!autopilotInstance) {
26
+ return json({ running: false, config: null, stats: null, last_tick_at: null });
27
+ }
28
+ return json(autopilotInstance.getStatus());
29
+ });
30
+
31
+ // POST /api/autopilot/start — start autopilot
32
+ router.post("/api/autopilot/start", async (req) => {
33
+ const input = await body<Partial<AutopilotConfig>>(req);
34
+ if (!autopilotInstance) {
35
+ autopilotInstance = new Autopilot(ctx, input);
36
+ } else {
37
+ if (input && Object.keys(input).length > 0) {
38
+ autopilotInstance.updateConfig(input);
39
+ }
40
+ }
41
+ autopilotInstance.start();
42
+ return json(autopilotInstance.getStatus());
43
+ });
44
+
45
+ // POST /api/autopilot/stop — stop autopilot
46
+ router.post("/api/autopilot/stop", () => {
47
+ if (autopilotInstance) {
48
+ autopilotInstance.stop();
49
+ }
50
+ return json({ stopped: true });
51
+ });
52
+
53
+ // POST /api/autopilot/config — update config
54
+ router.post("/api/autopilot/config", async (req) => {
55
+ const updates = await body<Partial<AutopilotConfig>>(req);
56
+ if (!autopilotInstance) {
57
+ autopilotInstance = new Autopilot(ctx, updates);
58
+ autopilotInstance.start();
59
+ } else {
60
+ autopilotInstance.updateConfig(updates);
61
+ }
62
+ return json(autopilotInstance.getStatus());
63
+ });
64
+
65
+ // POST /api/autopilot/tick — trigger a single tick manually
66
+ router.post("/api/autopilot/tick", async () => {
67
+ if (!autopilotInstance) {
68
+ autopilotInstance = new Autopilot(ctx);
69
+ }
70
+ const result = await autopilotInstance.tick();
71
+ return json(result);
72
+ });
73
+ }