beercan 0.1.0

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 (151) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +187 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +546 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/client.d.ts +8 -0
  8. package/dist/client.d.ts.map +1 -0
  9. package/dist/client.js +29 -0
  10. package/dist/client.js.map +1 -0
  11. package/dist/config.d.ts +49 -0
  12. package/dist/config.d.ts.map +1 -0
  13. package/dist/config.js +61 -0
  14. package/dist/config.js.map +1 -0
  15. package/dist/core/gatekeeper.d.ts +163 -0
  16. package/dist/core/gatekeeper.d.ts.map +1 -0
  17. package/dist/core/gatekeeper.js +247 -0
  18. package/dist/core/gatekeeper.js.map +1 -0
  19. package/dist/core/job-queue.d.ts +61 -0
  20. package/dist/core/job-queue.d.ts.map +1 -0
  21. package/dist/core/job-queue.js +123 -0
  22. package/dist/core/job-queue.js.map +1 -0
  23. package/dist/core/logger.d.ts +22 -0
  24. package/dist/core/logger.d.ts.map +1 -0
  25. package/dist/core/logger.js +65 -0
  26. package/dist/core/logger.js.map +1 -0
  27. package/dist/core/role-templates.d.ts +3 -0
  28. package/dist/core/role-templates.d.ts.map +1 -0
  29. package/dist/core/role-templates.js +179 -0
  30. package/dist/core/role-templates.js.map +1 -0
  31. package/dist/core/roles.d.ts +94 -0
  32. package/dist/core/roles.d.ts.map +1 -0
  33. package/dist/core/roles.js +206 -0
  34. package/dist/core/roles.js.map +1 -0
  35. package/dist/core/runner.d.ts +76 -0
  36. package/dist/core/runner.d.ts.map +1 -0
  37. package/dist/core/runner.js +307 -0
  38. package/dist/core/runner.js.map +1 -0
  39. package/dist/events/daemon.d.ts +9 -0
  40. package/dist/events/daemon.d.ts.map +1 -0
  41. package/dist/events/daemon.js +29 -0
  42. package/dist/events/daemon.js.map +1 -0
  43. package/dist/events/event-bus.d.ts +35 -0
  44. package/dist/events/event-bus.d.ts.map +1 -0
  45. package/dist/events/event-bus.js +41 -0
  46. package/dist/events/event-bus.js.map +1 -0
  47. package/dist/events/index.d.ts +41 -0
  48. package/dist/events/index.d.ts.map +1 -0
  49. package/dist/events/index.js +57 -0
  50. package/dist/events/index.js.map +1 -0
  51. package/dist/events/sources/filesystem-source.d.ts +23 -0
  52. package/dist/events/sources/filesystem-source.d.ts.map +1 -0
  53. package/dist/events/sources/filesystem-source.js +95 -0
  54. package/dist/events/sources/filesystem-source.js.map +1 -0
  55. package/dist/events/sources/macos-source.d.ts +23 -0
  56. package/dist/events/sources/macos-source.d.ts.map +1 -0
  57. package/dist/events/sources/macos-source.js +123 -0
  58. package/dist/events/sources/macos-source.js.map +1 -0
  59. package/dist/events/sources/polling-source.d.ts +23 -0
  60. package/dist/events/sources/polling-source.d.ts.map +1 -0
  61. package/dist/events/sources/polling-source.js +47 -0
  62. package/dist/events/sources/polling-source.js.map +1 -0
  63. package/dist/events/sources/webhook-source.d.ts +23 -0
  64. package/dist/events/sources/webhook-source.d.ts.map +1 -0
  65. package/dist/events/sources/webhook-source.js +132 -0
  66. package/dist/events/sources/webhook-source.js.map +1 -0
  67. package/dist/events/trigger-manager.d.ts +78 -0
  68. package/dist/events/trigger-manager.d.ts.map +1 -0
  69. package/dist/events/trigger-manager.js +130 -0
  70. package/dist/events/trigger-manager.js.map +1 -0
  71. package/dist/index.d.ts +123 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +225 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/mcp/index.d.ts +4 -0
  76. package/dist/mcp/index.d.ts.map +1 -0
  77. package/dist/mcp/index.js +3 -0
  78. package/dist/mcp/index.js.map +1 -0
  79. package/dist/mcp/manager.d.ts +99 -0
  80. package/dist/mcp/manager.d.ts.map +1 -0
  81. package/dist/mcp/manager.js +143 -0
  82. package/dist/mcp/manager.js.map +1 -0
  83. package/dist/mcp/tool-adapter.d.ts +20 -0
  84. package/dist/mcp/tool-adapter.d.ts.map +1 -0
  85. package/dist/mcp/tool-adapter.js +29 -0
  86. package/dist/mcp/tool-adapter.js.map +1 -0
  87. package/dist/memory/embeddings.d.ts +28 -0
  88. package/dist/memory/embeddings.d.ts.map +1 -0
  89. package/dist/memory/embeddings.js +90 -0
  90. package/dist/memory/embeddings.js.map +1 -0
  91. package/dist/memory/hybrid-search.d.ts +31 -0
  92. package/dist/memory/hybrid-search.d.ts.map +1 -0
  93. package/dist/memory/hybrid-search.js +114 -0
  94. package/dist/memory/hybrid-search.js.map +1 -0
  95. package/dist/memory/index.d.ts +55 -0
  96. package/dist/memory/index.d.ts.map +1 -0
  97. package/dist/memory/index.js +175 -0
  98. package/dist/memory/index.js.map +1 -0
  99. package/dist/memory/knowledge-graph.d.ts +21 -0
  100. package/dist/memory/knowledge-graph.d.ts.map +1 -0
  101. package/dist/memory/knowledge-graph.js +118 -0
  102. package/dist/memory/knowledge-graph.js.map +1 -0
  103. package/dist/memory/schemas.d.ts +187 -0
  104. package/dist/memory/schemas.d.ts.map +1 -0
  105. package/dist/memory/schemas.js +75 -0
  106. package/dist/memory/schemas.js.map +1 -0
  107. package/dist/memory/sqlite-vec-store.d.ts +22 -0
  108. package/dist/memory/sqlite-vec-store.d.ts.map +1 -0
  109. package/dist/memory/sqlite-vec-store.js +37 -0
  110. package/dist/memory/sqlite-vec-store.js.map +1 -0
  111. package/dist/memory/working-memory.d.ts +22 -0
  112. package/dist/memory/working-memory.d.ts.map +1 -0
  113. package/dist/memory/working-memory.js +53 -0
  114. package/dist/memory/working-memory.js.map +1 -0
  115. package/dist/scheduler/index.d.ts +3 -0
  116. package/dist/scheduler/index.d.ts.map +1 -0
  117. package/dist/scheduler/index.js +2 -0
  118. package/dist/scheduler/index.js.map +1 -0
  119. package/dist/scheduler/scheduler.d.ts +82 -0
  120. package/dist/scheduler/scheduler.d.ts.map +1 -0
  121. package/dist/scheduler/scheduler.js +127 -0
  122. package/dist/scheduler/scheduler.js.map +1 -0
  123. package/dist/schemas.d.ts +328 -0
  124. package/dist/schemas.d.ts.map +1 -0
  125. package/dist/schemas.js +77 -0
  126. package/dist/schemas.js.map +1 -0
  127. package/dist/storage/database.d.ts +97 -0
  128. package/dist/storage/database.d.ts.map +1 -0
  129. package/dist/storage/database.js +685 -0
  130. package/dist/storage/database.js.map +1 -0
  131. package/dist/tools/builtin/filesystem.d.ts +11 -0
  132. package/dist/tools/builtin/filesystem.d.ts.map +1 -0
  133. package/dist/tools/builtin/filesystem.js +137 -0
  134. package/dist/tools/builtin/filesystem.js.map +1 -0
  135. package/dist/tools/builtin/memory.d.ts +13 -0
  136. package/dist/tools/builtin/memory.d.ts.map +1 -0
  137. package/dist/tools/builtin/memory.js +299 -0
  138. package/dist/tools/builtin/memory.js.map +1 -0
  139. package/dist/tools/builtin/notification.d.ts +5 -0
  140. package/dist/tools/builtin/notification.d.ts.map +1 -0
  141. package/dist/tools/builtin/notification.js +36 -0
  142. package/dist/tools/builtin/notification.js.map +1 -0
  143. package/dist/tools/builtin/web.d.ts +7 -0
  144. package/dist/tools/builtin/web.d.ts.map +1 -0
  145. package/dist/tools/builtin/web.js +191 -0
  146. package/dist/tools/builtin/web.js.map +1 -0
  147. package/dist/tools/registry.d.ts +36 -0
  148. package/dist/tools/registry.d.ts.map +1 -0
  149. package/dist/tools/registry.js +49 -0
  150. package/dist/tools/registry.js.map +1 -0
  151. package/package.json +73 -0
@@ -0,0 +1,123 @@
1
+ import { v4 as uuid } from "uuid";
2
+ import { getLogger } from "./logger.js";
3
+ export class JobQueue {
4
+ running = new Map();
5
+ maxConcurrent;
6
+ db;
7
+ executor = null;
8
+ constructor(db, maxConcurrent) {
9
+ this.db = db;
10
+ this.maxConcurrent = maxConcurrent;
11
+ }
12
+ /** Set the bloop executor (called after engine is fully initialized) */
13
+ setExecutor(fn) {
14
+ this.executor = fn;
15
+ }
16
+ /** Enqueue a new job. Returns job ID. */
17
+ enqueue(opts) {
18
+ const log = getLogger();
19
+ const id = uuid();
20
+ const now = new Date().toISOString();
21
+ this.db.createJob({
22
+ id,
23
+ projectSlug: opts.projectSlug,
24
+ goal: opts.goal,
25
+ team: opts.team ?? "auto",
26
+ priority: opts.priority ?? 0,
27
+ status: "pending",
28
+ source: opts.source ?? "manual",
29
+ sourceId: opts.sourceId ?? null,
30
+ extraContext: opts.extraContext ?? null,
31
+ bloopId: null,
32
+ error: null,
33
+ createdAt: now,
34
+ startedAt: null,
35
+ completedAt: null,
36
+ });
37
+ log.info("queue", `Job enqueued: ${opts.goal.slice(0, 60)}`, {
38
+ jobId: id, projectSlug: opts.projectSlug, source: opts.source ?? "manual", priority: opts.priority ?? 0,
39
+ });
40
+ // Try to process immediately
41
+ this.processNext();
42
+ return id;
43
+ }
44
+ /** Process the next pending job if under concurrency limit. */
45
+ processNext() {
46
+ if (!this.executor)
47
+ return;
48
+ if (this.running.size >= this.maxConcurrent)
49
+ return;
50
+ const job = this.db.claimNextJob();
51
+ if (!job)
52
+ return;
53
+ const log = getLogger();
54
+ log.info("queue", `Job started: ${job.goal.slice(0, 60)}`, { jobId: job.id, running: this.running.size + 1 });
55
+ const promise = this.executeJob(job);
56
+ this.running.set(job.id, promise);
57
+ promise.finally(() => {
58
+ this.running.delete(job.id);
59
+ // Try to process next after completion
60
+ this.processNext();
61
+ });
62
+ // Try to fill more slots
63
+ if (this.running.size < this.maxConcurrent) {
64
+ this.processNext();
65
+ }
66
+ }
67
+ async executeJob(job) {
68
+ const log = getLogger();
69
+ try {
70
+ const result = await this.executor({
71
+ projectSlug: job.projectSlug,
72
+ goal: job.goal,
73
+ team: job.team,
74
+ extraContext: job.extraContext ?? undefined,
75
+ });
76
+ this.db.updateJob(job.id, {
77
+ status: "completed",
78
+ bloopId: result.id,
79
+ completedAt: new Date().toISOString(),
80
+ });
81
+ log.info("queue", `Job completed: ${job.goal.slice(0, 60)}`, {
82
+ jobId: job.id, bloopId: result.id, bloopStatus: result.status,
83
+ });
84
+ }
85
+ catch (err) {
86
+ this.db.updateJob(job.id, {
87
+ status: "failed",
88
+ error: err.message,
89
+ completedAt: new Date().toISOString(),
90
+ });
91
+ log.error("queue", `Job failed: ${err.message}`, { jobId: job.id });
92
+ }
93
+ }
94
+ /** Get queue statistics. */
95
+ getStats() {
96
+ return this.db.getJobStats();
97
+ }
98
+ /** List jobs, optionally filtered by status. */
99
+ listJobs(status, limit = 20) {
100
+ return this.db.listJobs(status, limit);
101
+ }
102
+ /** Wait for all running AND pending jobs to complete. */
103
+ async drain() {
104
+ const log = getLogger();
105
+ while (true) {
106
+ if (this.running.size > 0) {
107
+ log.info("queue", `Draining ${this.running.size} running jobs...`);
108
+ await Promise.allSettled(Array.from(this.running.values()));
109
+ continue; // Check again — processNext may have started new jobs
110
+ }
111
+ // Check if there are still pending jobs
112
+ const stats = this.getStats();
113
+ if (stats.pending > 0 && this.executor) {
114
+ // Kick processing and wait a tick
115
+ this.processNext();
116
+ await new Promise((r) => setTimeout(r, 10));
117
+ continue;
118
+ }
119
+ break;
120
+ }
121
+ }
122
+ }
123
+ //# sourceMappingURL=job-queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"job-queue.js","sourceRoot":"","sources":["../../src/core/job-queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAyCxC,MAAM,OAAO,QAAQ;IACX,OAAO,GAAG,IAAI,GAAG,EAAyB,CAAC;IAC3C,aAAa,CAAS;IACtB,EAAE,CAAY;IACd,QAAQ,GAA2I,IAAI,CAAC;IAEhK,YAAY,EAAa,EAAE,aAAqB;QAC9C,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED,wEAAwE;IACxE,WAAW,CAAC,EAAiI;QAC3I,IAAI,CAAC,QAAQ,GAAG,EAAE,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AAE,CAAC;YACZ,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;gBAC1B,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,IAAI,CAAC,OAAO,CAAC,IAAI,kBAAkB,CAAC,CAAC;gBACnE,MAAM,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;gBAC5D,SAAS,CAAC,sDAAsD;YAClE,CAAC;YACD,wCAAwC;YACxC,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC9B,IAAI,KAAK,CAAC,OAAO,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACvC,kCAAkC;gBAClC,IAAI,CAAC,WAAW,EAAE,CAAC;gBACnB,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;gBAC5C,SAAS;YACX,CAAC;YACD,MAAM;QACR,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,22 @@
1
+ export type LogLevel = "debug" | "info" | "warn" | "error";
2
+ export interface LogEntry {
3
+ timestamp: string;
4
+ level: LogLevel;
5
+ component: string;
6
+ message: string;
7
+ data?: Record<string, unknown>;
8
+ }
9
+ export declare class Logger {
10
+ private level;
11
+ private fileStream;
12
+ constructor(level?: LogLevel, logFilePath?: string);
13
+ private write;
14
+ debug(component: string, message: string, data?: Record<string, unknown>): void;
15
+ info(component: string, message: string, data?: Record<string, unknown>): void;
16
+ warn(component: string, message: string, data?: Record<string, unknown>): void;
17
+ error(component: string, message: string, data?: Record<string, unknown>): void;
18
+ close(): void;
19
+ }
20
+ export declare function setGlobalLogger(logger: Logger): void;
21
+ export declare function getLogger(): Logger;
22
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger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+ const LEVELS = { debug: 0, info: 1, warn: 2, error: 3 };
4
+ export class Logger {
5
+ level;
6
+ fileStream = null;
7
+ constructor(level = "info", logFilePath) {
8
+ this.level = LEVELS[level];
9
+ if (logFilePath) {
10
+ const dir = path.dirname(logFilePath);
11
+ if (!fs.existsSync(dir))
12
+ fs.mkdirSync(dir, { recursive: true });
13
+ this.fileStream = fs.createWriteStream(logFilePath, { flags: "a" });
14
+ }
15
+ }
16
+ write(level, component, message, data) {
17
+ if (LEVELS[level] < this.level)
18
+ return;
19
+ const entry = {
20
+ timestamp: new Date().toISOString(),
21
+ level,
22
+ component,
23
+ message,
24
+ ...(data && Object.keys(data).length > 0 ? { data } : {}),
25
+ };
26
+ const line = JSON.stringify(entry);
27
+ // Always write to file if available
28
+ this.fileStream?.write(line + "\n");
29
+ // Write to stderr for warn/error, stdout for others
30
+ if (level === "error" || level === "warn") {
31
+ process.stderr.write(line + "\n");
32
+ }
33
+ else if (LEVELS[level] >= this.level) {
34
+ process.stdout.write(line + "\n");
35
+ }
36
+ }
37
+ debug(component, message, data) {
38
+ this.write("debug", component, message, data);
39
+ }
40
+ info(component, message, data) {
41
+ this.write("info", component, message, data);
42
+ }
43
+ warn(component, message, data) {
44
+ this.write("warn", component, message, data);
45
+ }
46
+ error(component, message, data) {
47
+ this.write("error", component, message, data);
48
+ }
49
+ close() {
50
+ this.fileStream?.end();
51
+ this.fileStream = null;
52
+ }
53
+ }
54
+ /** Global logger instance — set once in BeerCanEngine */
55
+ let _logger = null;
56
+ export function setGlobalLogger(logger) {
57
+ _logger = logger;
58
+ }
59
+ export function getLogger() {
60
+ if (!_logger) {
61
+ _logger = new Logger("info");
62
+ }
63
+ return _logger;
64
+ }
65
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/core/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,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AO,EAAE,CAAC;QACb,OAAO,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { AgentRole } from "./roles.js";
2
+ export declare const ROLE_TEMPLATES: Record<string, Omit<AgentRole, "id">>;
3
+ //# sourceMappingURL=role-templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role-templates.d.ts","sourceRoot":"","sources":["../../src/core/role-templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAO5C,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAqLhE,CAAC"}
@@ -0,0 +1,179 @@
1
+ // ── Dynamic Role Templates ──────────────────────────────────
2
+ // Extend beyond the 5 built-in coding-focused roles.
3
+ // Used as defaults by the Gatekeeper when composing dynamic teams.
4
+ // The gatekeeper can override any field.
5
+ export const ROLE_TEMPLATES = {
6
+ writer: {
7
+ name: "Writer",
8
+ description: "Writes prose, documentation, blog posts, reports, and other textual content.",
9
+ systemPrompt: `You are the Writer agent in the BeerCan system. Your responsibilities:
10
+
11
+ 1. Write clear, engaging, well-structured content based on the plan and research provided.
12
+ 2. Follow any style guidelines or tone requirements specified.
13
+ 3. Use read_file to reference existing content for consistency.
14
+ 4. Save your output using write_file.
15
+
16
+ Rules:
17
+ - Write in clear, professional prose unless a different tone is specified.
18
+ - Structure content with headings, bullet points, and paragraphs as appropriate.
19
+ - Cite sources and reference specific details from research.
20
+ - If the task is documentation, follow the project's existing doc conventions.
21
+ - Save your work to a file so reviewers can read it.`,
22
+ allowedTools: ["read_file", "write_file", "list_directory", "memory_search", "memory_store", "memory_scratch"],
23
+ phase: "primary",
24
+ maxIterations: 15,
25
+ },
26
+ researcher: {
27
+ name: "Researcher",
28
+ description: "Gathers information from files, memory, and project context to inform other agents.",
29
+ systemPrompt: `You are the Researcher agent in the BeerCan system. Your responsibilities:
30
+
31
+ 1. Gather relevant information from the project files, memory, and knowledge graph.
32
+ 2. Synthesize findings into a clear, organized research brief.
33
+ 3. Identify key facts, patterns, and context that other agents will need.
34
+ 4. Store important findings in memory for future reference.
35
+
36
+ Process:
37
+ 1. Read the goal carefully and identify what information is needed.
38
+ 2. Search memory for relevant past knowledge.
39
+ 3. Browse project files for relevant content.
40
+ 4. Produce a structured summary of your findings.
41
+
42
+ Be thorough but concise. Focus on information that directly supports the goal.`,
43
+ allowedTools: ["read_file", "list_directory", "exec_command", "memory_search", "memory_query_graph", "memory_store", "memory_link", "memory_scratch"],
44
+ phase: "plan",
45
+ maxIterations: 15,
46
+ },
47
+ analyst: {
48
+ name: "Analyst",
49
+ description: "Analyzes data, code patterns, logs, or metrics and produces structured insights.",
50
+ systemPrompt: `You are the Analyst agent in the BeerCan system. Your responsibilities:
51
+
52
+ 1. Analyze the data, code, logs, or information provided or accessible in the project.
53
+ 2. Identify patterns, anomalies, trends, and actionable insights.
54
+ 3. Produce a structured analysis report with clear conclusions.
55
+ 4. Store key insights in memory for future loops.
56
+
57
+ Rules:
58
+ - Use exec_command to run analysis scripts if available.
59
+ - Be data-driven — cite specific numbers, files, and evidence.
60
+ - Distinguish between facts and interpretations.
61
+ - Prioritize actionable findings over exhaustive description.`,
62
+ allowedTools: ["read_file", "list_directory", "exec_command", "memory_search", "memory_store", "memory_link", "memory_scratch"],
63
+ phase: "primary",
64
+ maxIterations: 15,
65
+ },
66
+ data_processor: {
67
+ name: "Data Processor",
68
+ description: "Transforms, cleans, parses, or migrates data between formats.",
69
+ systemPrompt: `You are the Data Processor agent in the BeerCan system. Your responsibilities:
70
+
71
+ 1. Read input data from files or command output.
72
+ 2. Transform, clean, or convert data as specified by the goal.
73
+ 3. Write processed output to the appropriate location.
74
+ 4. Verify the output is correct and complete.
75
+
76
+ Rules:
77
+ - Handle edge cases (empty data, malformed input, encoding issues).
78
+ - Preserve data integrity — never silently drop records.
79
+ - Log processing statistics (records processed, errors, etc.).
80
+ - Use exec_command for batch operations when appropriate.`,
81
+ allowedTools: ["read_file", "write_file", "list_directory", "exec_command", "memory_search", "memory_scratch"],
82
+ phase: "primary",
83
+ maxIterations: 20,
84
+ },
85
+ summarizer: {
86
+ name: "Summarizer",
87
+ description: "Condenses large amounts of information into clear, concise summaries.",
88
+ systemPrompt: `You are the Summarizer agent in the BeerCan system. Your responsibilities:
89
+
90
+ 1. Read and comprehend the full body of content provided or accessible.
91
+ 2. Produce a concise, accurate summary that captures the essential points.
92
+ 3. Organize the summary with clear structure (executive summary, key points, details).
93
+
94
+ Rules:
95
+ - Preserve critical details — don't over-simplify.
96
+ - Maintain accuracy — never introduce information not in the source.
97
+ - Scale summary length to content complexity.
98
+ - Highlight any areas of uncertainty or incompleteness.`,
99
+ allowedTools: ["read_file", "list_directory", "memory_search", "memory_query_graph", "memory_scratch"],
100
+ phase: "summarize",
101
+ maxIterations: 5,
102
+ },
103
+ planner: {
104
+ name: "Planner",
105
+ description: "Creates detailed execution plans and task breakdowns without doing the work itself.",
106
+ systemPrompt: `You are the Planner agent in the BeerCan system. Your responsibilities:
107
+
108
+ 1. Analyze the goal and break it into concrete, actionable sub-tasks.
109
+ 2. Identify dependencies between tasks and determine the optimal order.
110
+ 3. Specify acceptance criteria for each task.
111
+ 4. Estimate complexity and flag potential risks.
112
+
113
+ Rules:
114
+ - Be specific — "Add validation to the /users endpoint" not "Add validation".
115
+ - Consider edge cases and error handling in your plan.
116
+ - Reference existing code patterns when suggesting implementation approaches.
117
+ - Use memory to check for similar past tasks and their outcomes.`,
118
+ allowedTools: ["read_file", "list_directory", "memory_search", "memory_query_graph", "memory_scratch"],
119
+ phase: "plan",
120
+ maxIterations: 10,
121
+ },
122
+ editor: {
123
+ name: "Editor",
124
+ description: "Reviews and improves written content for clarity, grammar, style, and consistency.",
125
+ systemPrompt: `You are the Editor agent in the BeerCan system. Your responsibilities:
126
+
127
+ 1. Review the written content produced by other agents.
128
+ 2. Check for: grammar, clarity, consistency, tone, structure, accuracy.
129
+ 3. Suggest specific improvements with concrete rewrites.
130
+
131
+ If the content is publication-ready: respond with <decision>APPROVE</decision>
132
+ If edits are needed: respond with <decision>REVISE</decision> and list specific changes
133
+ If fundamentally off-track: respond with <decision>REJECT</decision> and explain why
134
+
135
+ Be constructive. Focus on substantive improvements, not minor stylistic preferences.`,
136
+ allowedTools: ["read_file", "list_directory", "memory_search"],
137
+ phase: "review",
138
+ maxIterations: 5,
139
+ },
140
+ devops: {
141
+ name: "DevOps",
142
+ description: "Handles deployment, infrastructure, CI/CD, and operational tasks.",
143
+ systemPrompt: `You are the DevOps agent in the BeerCan system. Your responsibilities:
144
+
145
+ 1. Execute deployment, build, and infrastructure operations.
146
+ 2. Run and verify CI/CD pipelines and scripts.
147
+ 3. Check system health, logs, and configurations.
148
+ 4. Troubleshoot operational issues.
149
+
150
+ Rules:
151
+ - Always verify changes before and after applying them.
152
+ - Check for existing configuration before creating new ones.
153
+ - Use exec_command carefully — prefer read-only checks first.
154
+ - Store operational decisions in memory for future reference.`,
155
+ allowedTools: ["read_file", "write_file", "list_directory", "exec_command", "memory_search", "memory_store", "memory_scratch"],
156
+ phase: "primary",
157
+ maxIterations: 20,
158
+ },
159
+ architect: {
160
+ name: "Architect",
161
+ description: "Designs system architecture, evaluates trade-offs, and creates technical plans.",
162
+ systemPrompt: `You are the Architect agent in the BeerCan system. Your responsibilities:
163
+
164
+ 1. Analyze the existing system architecture by reading code and documentation.
165
+ 2. Design solutions that fit the existing patterns and conventions.
166
+ 3. Evaluate trade-offs (performance, maintainability, complexity).
167
+ 4. Produce clear technical plans that coders can follow.
168
+
169
+ Rules:
170
+ - Read existing code before proposing new patterns.
171
+ - Favor incremental improvement over wholesale redesign.
172
+ - Consider backward compatibility and migration paths.
173
+ - Document architectural decisions in memory.`,
174
+ allowedTools: ["read_file", "list_directory", "memory_search", "memory_query_graph", "memory_store", "memory_link", "memory_scratch"],
175
+ phase: "plan",
176
+ maxIterations: 10,
177
+ },
178
+ };
179
+ //# sourceMappingURL=role-templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role-templates.js","sourceRoot":"","sources":["../../src/core/role-templates.ts"],"names":[],"mappings":"AAEA,+DAA+D;AAC/D,qDAAqD;AACrD,mEAAmE;AACnE,yCAAyC;AAEzC,MAAM,CAAC,MAAM,cAAc,GAA0C;IACnE,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,8EAA8E;QAC3F,YAAY,EAAE;;;;;;;;;;;;qDAYmC;QACjD,YAAY,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,CAAC;QAC9G,KAAK,EAAE,SAAS;QAChB,aAAa,EAAE,EAAE;KAClB;IAED,UAAU,EAAE;QACV,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,qFAAqF;QAClG,YAAY,EAAE;;;;;;;;;;;;;+EAa6D;QAC3E,YAAY,EAAE,CAAC,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,oBAAoB,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,CAAC;QACrJ,KAAK,EAAE,MAAM;QACb,aAAa,EAAE,EAAE;KAClB;IAED,OAAO,EAAE;QACP,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,kFAAkF;QAC/F,YAAY,EAAE;;;;;;;;;;;8DAW4C;QAC1D,YAAY,EAAE,CAAC,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,CAAC;QAC/H,KAAK,EAAE,SAAS;QAChB,aAAa,EAAE,EAAE;KAClB;IAED,cAAc,EAAE;QACd,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE,+DAA+D;QAC5E,YAAY,EAAE;;;;;;;;;;;0DAWwC;QACtD,YAAY,EAAE,CAAC,WAAW,E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YAAY,EAAE,CAAC,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,oBAAoB,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,CAAC;QACrI,KAAK,EAAE,MAAM;QACb,aAAa,EAAE,EAAE;KAClB;CACF,CAAC"}
@@ -0,0 +1,94 @@
1
+ import { z } from "zod";
2
+ export declare const AgentRoleSchema: z.ZodObject<{
3
+ /** Unique role identifier, e.g. "coder", "reviewer", "manager" */
4
+ id: z.ZodString;
5
+ name: z.ZodString;
6
+ description: z.ZodString;
7
+ /** System prompt injected when this agent is active */
8
+ systemPrompt: z.ZodString;
9
+ /** Which tools this role is allowed to use. ["*"] = all project tools */
10
+ allowedTools: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
11
+ /** Model override — some roles need heavier reasoning */
12
+ model: z.ZodOptional<z.ZodString>;
13
+ /** Temperature override */
14
+ temperature: z.ZodOptional<z.ZodNumber>;
15
+ /**
16
+ * When does this agent get invoked in a bloop?
17
+ * - "primary" → runs the main bloop cycle
18
+ * - "review" → called after primary produces output
19
+ * - "validate" → called after review to verify / run tests
20
+ * - "plan" → called at the start to break down the goal
21
+ * - "summarize" → called at the end to produce final output
22
+ */
23
+ phase: z.ZodDefault<z.ZodEnum<["plan", "primary", "review", "validate", "summarize"]>>;
24
+ /** Max iterations this specific agent can run within its phase */
25
+ maxIterations: z.ZodDefault<z.ZodNumber>;
26
+ }, "strip", z.ZodTypeAny, {
27
+ id: string;
28
+ systemPrompt: string;
29
+ maxIterations: number;
30
+ name: string;
31
+ description: string;
32
+ allowedTools: string[];
33
+ phase: "plan" | "primary" | "review" | "validate" | "summarize";
34
+ model?: string | undefined;
35
+ temperature?: number | undefined;
36
+ }, {
37
+ id: string;
38
+ systemPrompt: string;
39
+ name: string;
40
+ description: string;
41
+ maxIterations?: number | undefined;
42
+ allowedTools?: string[] | undefined;
43
+ model?: string | undefined;
44
+ temperature?: number | undefined;
45
+ phase?: "plan" | "primary" | "review" | "validate" | "summarize" | undefined;
46
+ }>;
47
+ export type AgentRole = z.infer<typeof AgentRoleSchema>;
48
+ export declare const BloopTeamSchema: z.ZodObject<{
49
+ /**
50
+ * Pipeline defines execution order.
51
+ * Each stage runs its assigned agent(s) before moving to the next.
52
+ * A stage can have multiple agents (they see each other's output).
53
+ */
54
+ pipeline: z.ZodArray<z.ZodObject<{
55
+ phase: z.ZodEnum<["plan", "primary", "review", "validate", "summarize"]>;
56
+ roleId: z.ZodString;
57
+ /** If true, this phase can send work back to a previous phase */
58
+ canReject: z.ZodOptional<z.ZodBoolean>;
59
+ /** Phase to return to on rejection */
60
+ rejectTo: z.ZodOptional<z.ZodEnum<["plan", "primary", "review", "validate", "summarize"]>>;
61
+ }, "strip", z.ZodTypeAny, {
62
+ phase: "plan" | "primary" | "review" | "validate" | "summarize";
63
+ roleId: string;
64
+ canReject?: boolean | undefined;
65
+ rejectTo?: "plan" | "primary" | "review" | "validate" | "summarize" | undefined;
66
+ }, {
67
+ phase: "plan" | "primary" | "review" | "validate" | "summarize";
68
+ roleId: string;
69
+ canReject?: boolean | undefined;
70
+ rejectTo?: "plan" | "primary" | "review" | "validate" | "summarize" | undefined;
71
+ }>, "many">;
72
+ /** Max full pipeline cycles (plan→primary→review→validate) before forced completion */
73
+ maxCycles: z.ZodDefault<z.ZodNumber>;
74
+ }, "strip", z.ZodTypeAny, {
75
+ pipeline: {
76
+ phase: "plan" | "primary" | "review" | "validate" | "summarize";
77
+ roleId: string;
78
+ canReject?: boolean | undefined;
79
+ rejectTo?: "plan" | "primary" | "review" | "validate" | "summarize" | undefined;
80
+ }[];
81
+ maxCycles: number;
82
+ }, {
83
+ pipeline: {
84
+ phase: "plan" | "primary" | "review" | "validate" | "summarize";
85
+ roleId: string;
86
+ canReject?: boolean | undefined;
87
+ rejectTo?: "plan" | "primary" | "review" | "validate" | "summarize" | undefined;
88
+ }[];
89
+ maxCycles?: number | undefined;
90
+ }>;
91
+ export type BloopTeam = z.infer<typeof BloopTeamSchema>;
92
+ export declare const BUILTIN_ROLES: Record<string, AgentRole>;
93
+ export declare const PRESET_TEAMS: Record<string, BloopTeam>;
94
+ //# sourceMappingURL=roles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roles.d.ts","sourceRoot":"","sources":["../../src/core/roles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe;IAC1B,kEAAkE;;;;IAIlE,uDAAuD;;IAEvD,yEAAyE;;IAEzE,yDAAyD;;IAEzD,2BAA2B;;IAE3B;;;;;;;OAOG;;IAEH,kEAAkE;;;;;;;;;;;;;;;;;;;;;;EAElE,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAKxD,eAAO,MAAM,eAAe;IAC1B;;;;OAIG;;;;QAKC,iEAAiE;;QAEjE,sCAAsC;;;;;;;;;;;;;IAI1C,uFAAuF;;;;;;;;;;;;;;;;;;EAEvF,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAIxD,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CA4HnD,CAAC;AAIF,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAsClD,CAAC"}