agent-enderun 0.5.0 → 0.5.2

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 (84) hide show
  1. package/.enderun/BRAIN_DASHBOARD.md +0 -0
  2. package/.enderun/PROJECT_MEMORY.md +40 -1
  3. package/.enderun/STATUS.md +2 -0
  4. package/.enderun/agents/analyst.md +8 -8
  5. package/.enderun/agents/backend.md +11 -11
  6. package/.enderun/agents/explorer.md +4 -4
  7. package/.enderun/agents/frontend.md +7 -7
  8. package/.enderun/agents/git.md +5 -5
  9. package/.enderun/agents/manager.md +12 -12
  10. package/.enderun/agents/mobile.md +5 -5
  11. package/.enderun/agents/native.md +5 -5
  12. package/.enderun/benchmarks/.gitkeep +0 -0
  13. package/.enderun/cli-commands.json +0 -0
  14. package/.enderun/config.json +0 -0
  15. package/.enderun/docs/api/README.md +0 -0
  16. package/.enderun/docs/api/auth.md +0 -0
  17. package/.enderun/docs/api/errors.md +0 -0
  18. package/.enderun/docs/error-handling.md +0 -0
  19. package/.enderun/docs/privacy.md +0 -0
  20. package/.enderun/docs/project-docs.md +0 -0
  21. package/.enderun/docs/security.md +0 -0
  22. package/.enderun/docs/tech-stack.md +38 -10
  23. package/.enderun/docs/troubleshooting.md +0 -0
  24. package/.enderun/knowledge/api_design_rules.md +0 -0
  25. package/.enderun/knowledge/async_error_handling.md +0 -0
  26. package/.enderun/knowledge/branded_types_pattern.md +7 -0
  27. package/.enderun/knowledge/code_review_checklist.md +0 -0
  28. package/.enderun/knowledge/contract_versioning.md +0 -0
  29. package/.enderun/knowledge/database_migration.md +0 -0
  30. package/.enderun/knowledge/deployment_checklist.md +0 -0
  31. package/.enderun/knowledge/git_commit_strategy.md +0 -0
  32. package/.enderun/knowledge/hermes_protocol.md +59 -0
  33. package/.enderun/knowledge/legacy_onboarding.md +0 -0
  34. package/.enderun/knowledge/monitoring_setup.md +0 -0
  35. package/.enderun/knowledge/performance_guidelines.md +0 -0
  36. package/.enderun/knowledge/repository_patterns.md +0 -0
  37. package/.enderun/knowledge/responsive_design_standards.md +0 -0
  38. package/.enderun/knowledge/security_scanning.md +0 -0
  39. package/.enderun/knowledge/testing_standards.md +1 -1
  40. package/.enderun/knowledge/troubleshooting_guide.md +0 -0
  41. package/.enderun/knowledge/zero_ui_library_policy.md +8 -4
  42. package/.enderun/logs/.gitkeep +0 -0
  43. package/.enderun/messages/.gitkeep +0 -0
  44. package/.enderun/monitoring/.gitkeep +0 -0
  45. package/.env.example +0 -0
  46. package/ENDERUN.md +10 -5
  47. package/LICENSE +0 -0
  48. package/README.md +93 -45
  49. package/bin/cli.js +633 -3
  50. package/bin/update-contract.js +63 -0
  51. package/claude.md +2 -2
  52. package/codex.md +2 -2
  53. package/cursor.md +2 -2
  54. package/docs/README.md +23 -0
  55. package/gemini-extension.json +8 -2
  56. package/gemini.md +2 -2
  57. package/mcp.json +0 -0
  58. package/package.json +4 -3
  59. package/packages/framework-mcp/dist/index.js +0 -0
  60. package/packages/framework-mcp/dist/schemas.js +16 -0
  61. package/packages/framework-mcp/dist/tools/contract.js +13 -7
  62. package/packages/framework-mcp/dist/tools/framework.js +25 -0
  63. package/packages/framework-mcp/dist/tools/knowledge.js +75 -11
  64. package/packages/framework-mcp/dist/tools/messages.js +73 -11
  65. package/packages/framework-mcp/dist/tools/repository.js +24 -3
  66. package/packages/framework-mcp/dist/utils.js +2 -2
  67. package/packages/framework-mcp/package.json +2 -2
  68. package/packages/framework-mcp/src/schemas.ts +20 -0
  69. package/packages/framework-mcp/src/tools/contract.ts +14 -7
  70. package/packages/framework-mcp/src/tools/framework.ts +24 -0
  71. package/packages/framework-mcp/src/tools/knowledge.ts +86 -12
  72. package/packages/framework-mcp/src/tools/messages.ts +80 -11
  73. package/packages/framework-mcp/src/tools/repository.ts +24 -3
  74. package/packages/framework-mcp/src/utils.ts +2 -2
  75. package/packages/shared-types/README.md +0 -0
  76. package/packages/shared-types/contract.version.json +6 -3
  77. package/packages/shared-types/package.json +4 -4
  78. package/packages/shared-types/src/index.ts +0 -0
  79. package/packages/shared-types/tsconfig.json +0 -0
  80. package/panda.config.ts +5 -1
  81. package/tsconfig.json +0 -0
  82. package/.enderun/ENDERUN.md +0 -205
  83. package/packages/framework-mcp/dist/index.d.ts +0 -1
  84. package/packages/shared-types/dist/index.d.ts.map +0 -1
@@ -1,8 +1,8 @@
1
1
  import path from "path";
2
2
  import fs from "fs";
3
- export const FRAMEWORK_VERSION = "0.5.0";
3
+ export const FRAMEWORK_VERSION = "0.5.2";
4
4
  export function getFrameworkDir(projectRoot) {
5
- const adapters = [".gemini", ".claude", ".cursor", ".codex", ".enderun"];
5
+ const adapters = [".gemini", ".claude", ".cursor", ".enderun", ".codex"];
6
6
  for (const adp of adapters) {
7
7
  const fullPath = path.join(projectRoot, adp);
8
8
  if (fs.existsSync(fullPath) && fs.lstatSync(fullPath).isDirectory()) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-enderun-mcp",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Enterprise-grade MCP Server for AI Agent Framework",
5
5
  "author": "Yusuf BEKAR",
6
6
  "license": "MIT",
@@ -26,7 +26,7 @@
26
26
  "README.md"
27
27
  ],
28
28
  "scripts": {
29
- "build": "npx tsc -p tsconfig.json",
29
+ "build": "tsc -p tsconfig.json",
30
30
  "start": "node dist/index.js",
31
31
  "dev": "tsx src/index.ts"
32
32
  },
@@ -35,6 +35,8 @@ export const SEND_AGENT_MESSAGE_ARGS_SCHEMA = z.object({
35
35
  to: z.string().min(1),
36
36
  message: z.string().min(1),
37
37
  traceId: z.string().min(1),
38
+ category: z.enum(["ACTION", "DELEGATION", "INFO", "ALERT"]).default("INFO"),
39
+ priority: z.enum(["LOW", "MEDIUM", "HIGH", "URGENT"]).default("MEDIUM"),
38
40
  });
39
41
 
40
42
  export const SEARCH_KNOWLEDGE_BASE_ARGS_SCHEMA = z.object({
@@ -44,6 +46,7 @@ export const SEARCH_KNOWLEDGE_BASE_ARGS_SCHEMA = z.object({
44
46
  export const UPDATE_KNOWLEDGE_BASE_ARGS_SCHEMA = z.object({
45
47
  topic: z.string().min(1),
46
48
  content: z.string().min(1),
49
+ tags: z.array(z.string().min(1)).default([]),
47
50
  });
48
51
 
49
52
  export const ANALYZE_DATABASE_SCHEMA_ARGS_SCHEMA = z.object({
@@ -77,6 +80,7 @@ export const VALIDATE_REPOSITORY_HEALTH_ARGS_SCHEMA = z.object({
77
80
 
78
81
  export const READ_AGENT_MESSAGES_ARGS_SCHEMA = z.object({
79
82
  agent: z.string().min(1),
83
+ traceId: z.string().min(1).optional(),
80
84
  });
81
85
 
82
86
  export const VERIFY_CONTRACT_INTEGRITY_ARGS_SCHEMA = z.object({
@@ -104,3 +108,19 @@ export const GET_AGENT_AUDIT_REPORT_ARGS_SCHEMA = z.object({
104
108
  agent: z.string().min(1),
105
109
  days: z.number().default(7),
106
110
  });
111
+
112
+ export const GET_AGENT_INBOX_STATS_ARGS_SCHEMA = z.object({
113
+ agent: z.string().min(1),
114
+ });
115
+
116
+ export const GET_KNOWLEDGE_GRAPH_ARGS_SCHEMA = z.object({
117
+ tag: z.string().optional(),
118
+ });
119
+
120
+ export const SYNC_CONTRACT_HASH_ARGS_SCHEMA = z.object({
121
+ force: z.boolean().default(false),
122
+ });
123
+
124
+ export const VERIFY_FRAMEWORK_HEALTH_ARGS_SCHEMA = z.object({
125
+ detailed: z.boolean().default(false),
126
+ });
@@ -8,6 +8,18 @@ import {
8
8
  } from "../utils.js";
9
9
  import { VERIFY_CONTRACT_INTEGRITY_ARGS_SCHEMA } from "../schemas.js";
10
10
 
11
+ function calculateContractHash(sharedTypesDir: string, projectRoot: string): string {
12
+ const files = collectFilesRecursively(sharedTypesDir, new Set(["ts"])).sort();
13
+ const hash = crypto.createHash("sha256");
14
+ files.forEach((filePath) => {
15
+ hash.update(path.relative(projectRoot, filePath));
16
+ hash.update("\0");
17
+ hash.update(fs.readFileSync(filePath));
18
+ hash.update("\0");
19
+ });
20
+ return hash.digest("hex");
21
+ }
22
+
11
23
  export const contractTools = [
12
24
  {
13
25
  name: "verify_api_contract",
@@ -41,10 +53,7 @@ export const contractHandlers = {
41
53
  const sharedTypesDir = path.join(projectRoot, "packages/shared-types/src");
42
54
  const contractJsonPath = path.join(projectRoot, "packages/shared-types/contract.version.json");
43
55
  if (!fs.existsSync(sharedTypesDir) || !fs.existsSync(contractJsonPath)) return { content: [{ type: "text", text: "Missing shared-types directory or contract.version.json" }] };
44
- const files = collectFilesRecursively(sharedTypesDir, new Set(["ts"])).sort();
45
- const hash = crypto.createHash("sha256");
46
- files.forEach(f => hash.update(fs.readFileSync(f)));
47
- const currentHash = hash.digest("hex");
56
+ const currentHash = calculateContractHash(sharedTypesDir, projectRoot);
48
57
  const storedHash = JSON.parse(fs.readFileSync(contractJsonPath, "utf-8")).contract_hash;
49
58
  return { content: [{ type: "text", text: currentHash === storedHash ? "✅ MATCH: Contract is valid and synchronized." : `❌ MISMATCH: Current hash (${currentHash.slice(0, 8)}...) does not match stored hash (${storedHash.slice(0, 8)}...).` }] };
50
59
  } catch (error) {
@@ -58,9 +67,7 @@ export const contractHandlers = {
58
67
  if (!fs.existsSync(sharedTypesDir)) return { content: [{ type: "text", text: "Missing shared-types directory" }] };
59
68
  const files = collectFilesRecursively(sharedTypesDir, new Set(["ts"])).sort();
60
69
  if (files.length === 0) return { content: [{ type: "text", text: "⚠️ WARNING: No TypeScript files found in shared-types/src. Hash not updated." }] };
61
- const hash = crypto.createHash("sha256");
62
- files.forEach(f => hash.update(fs.readFileSync(f)));
63
- const currentHash = hash.digest("hex");
70
+ const currentHash = calculateContractHash(sharedTypesDir, projectRoot);
64
71
  const contractJson = fs.existsSync(contractJsonPath) ? JSON.parse(fs.readFileSync(contractJsonPath, "utf-8")) : {};
65
72
  contractJson.contract_hash = currentHash;
66
73
  contractJson.last_updated = new Date().toISOString();
@@ -1,10 +1,12 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
+ import { execSync } from "child_process";
3
4
  import {
4
5
  getFrameworkDir,
5
6
  collectMarkdownArtifacts,
6
7
  FRAMEWORK_VERSION
7
8
  } from "../utils.js";
9
+ import { VERIFY_FRAMEWORK_HEALTH_ARGS_SCHEMA } from "../schemas.js";
8
10
 
9
11
  export const frameworkTools = [
10
12
  {
@@ -42,6 +44,16 @@ export const frameworkTools = [
42
44
  description: "Analyzes a pre-existing codebase to automatically generate the initial project memory, learning its tech stack and architecture.",
43
45
  inputSchema: { type: "object", properties: {} },
44
46
  },
47
+ {
48
+ name: "verify_framework_health",
49
+ description: "Runs the framework's internal 'check' command and reports system health status via MCP.",
50
+ inputSchema: {
51
+ type: "object",
52
+ properties: {
53
+ detailed: { type: "boolean", default: false, description: "Include detailed issues if any." },
54
+ },
55
+ },
56
+ },
45
57
  ];
46
58
 
47
59
  export const frameworkHandlers = {
@@ -154,4 +166,16 @@ export const frameworkHandlers = {
154
166
  get_system_time: async () => {
155
167
  return { content: [{ type: "text", text: new Date().toISOString() }] };
156
168
  },
169
+ verify_framework_health: async (args: unknown, projectRoot: string) => {
170
+ const parsed = VERIFY_FRAMEWORK_HEALTH_ARGS_SCHEMA.safeParse(args ?? {});
171
+ try {
172
+ // Run the internal CLI check command via tsx to ensure we test current state
173
+ // If the CLI is not yet linked, we might need a relative path
174
+ const cliPath = path.join(projectRoot, "bin/cli.js");
175
+ const output = execSync(`node ${cliPath} check`, { cwd: projectRoot, encoding: "utf-8", stdio: "pipe" });
176
+ return { content: [{ type: "text", text: `### FRAMEWORK HEALTH CHECK\n\n${output}` }] };
177
+ } catch (error: any) {
178
+ return { content: [{ type: "text", text: `### FRAMEWORK HEALTH CHECK (FAILED)\n\n${error.stdout || error.message}` }] };
179
+ }
180
+ }
157
181
  };
@@ -3,35 +3,59 @@ import path from "path";
3
3
  import { getFrameworkDir } from "../utils.js";
4
4
  import {
5
5
  SEARCH_KNOWLEDGE_BASE_ARGS_SCHEMA,
6
- UPDATE_KNOWLEDGE_BASE_ARGS_SCHEMA
6
+ UPDATE_KNOWLEDGE_BASE_ARGS_SCHEMA,
7
+ GET_KNOWLEDGE_GRAPH_ARGS_SCHEMA
7
8
  } from "../schemas.js";
8
9
 
9
10
  export const knowledgeTools = [
10
11
  {
11
12
  name: "search_knowledge_base",
12
- description: "Searches the Academy's internal knowledge base for architectural patterns, troubleshooting guides, and FAQs.",
13
+ description: "Searches the Academy's Obsidian-style knowledge base using keywords or tags.",
13
14
  inputSchema: {
14
15
  type: "object",
15
16
  properties: {
16
- query: { type: "string", description: "Search query or topic" },
17
+ query: { type: "string", description: "Search query, topic, or tag (e.g. #security)" },
17
18
  },
18
19
  required: ["query"],
19
20
  },
20
21
  },
21
22
  {
22
23
  name: "update_knowledge_base",
23
- description: "Adds or updates an entry in the Academy's internal knowledge base.",
24
+ description: "Adds or updates an entry with mandatory YAML frontmatter for Obsidian compatibility.",
24
25
  inputSchema: {
25
26
  type: "object",
26
27
  properties: {
27
- topic: { type: "string", description: "The topic or title of the entry" },
28
- content: { type: "string", description: "The technical content or guide" },
28
+ topic: { type: "string", description: "The topic or title" },
29
+ content: { type: "string", description: "Content (YAML frontmatter will be auto-generated if missing)" },
30
+ tags: { type: "array", items: { type: "string" }, description: "Tags for the entry" },
29
31
  },
30
32
  required: ["topic", "content"],
31
33
  },
32
34
  },
35
+ {
36
+ name: "get_knowledge_graph",
37
+ description: "Generates a Mermaid diagram showing relationships between knowledge entries based on 'related' metadata.",
38
+ inputSchema: {
39
+ type: "object",
40
+ properties: {
41
+ tag: { type: "string", description: "Filter by tag" },
42
+ },
43
+ },
44
+ },
33
45
  ];
34
46
 
47
+ function parseFrontmatter(content: string) {
48
+ const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
49
+ if (!match) return { metadata: {}, body: content };
50
+ const yaml = match[1];
51
+ const metadata: Record<string, any> = {};
52
+ yaml.split("\n").forEach(line => {
53
+ const [key, ...val] = line.split(":");
54
+ if (key && val.length > 0) metadata[key.trim()] = val.join(":").trim();
55
+ });
56
+ return { metadata, body: content.replace(match[0], "").trim() };
57
+ }
58
+
35
59
  export const knowledgeHandlers = {
36
60
  search_knowledge_base: async (args: unknown, projectRoot: string) => {
37
61
  const parsed = SEARCH_KNOWLEDGE_BASE_ARGS_SCHEMA.safeParse(args ?? {});
@@ -40,29 +64,79 @@ export const knowledgeHandlers = {
40
64
  const frameworkDir = getFrameworkDir(projectRoot);
41
65
  const kbDir = path.join(projectRoot, frameworkDir, "knowledge");
42
66
  if (!fs.existsSync(kbDir)) return { content: [{ type: "text", text: "Knowledge base is empty." }] };
67
+
68
+ const query = parsed.data.query.toLowerCase();
43
69
  const results = fs.readdirSync(kbDir).filter(f => f.endsWith(".md")).map(file => {
44
70
  const content = fs.readFileSync(path.join(kbDir, file), "utf-8");
45
- if (content.toLowerCase().includes(parsed.data.query.toLowerCase()) || file.toLowerCase().includes(parsed.data.query.toLowerCase())) {
46
- return `### ${file.replace(".md", "")}\n\n${content.slice(0, 300)}...`;
71
+ const { metadata, body } = parseFrontmatter(content);
72
+
73
+ const matchesQuery = body.toLowerCase().includes(query) ||
74
+ file.toLowerCase().includes(query) ||
75
+ (metadata.tags && metadata.tags.toLowerCase().includes(query)) ||
76
+ (metadata.title && metadata.title.toLowerCase().includes(query));
77
+
78
+ if (matchesQuery) {
79
+ return `### ${metadata.title || file.replace(".md", "")}\n**Tags:** ${metadata.tags || "None"}\n\n${body.slice(0, 300)}...`;
47
80
  }
48
81
  return null;
49
82
  }).filter(Boolean);
50
- return { content: [{ type: "text", text: results.length > 0 ? `### KNOWLEDGE BASE SEARCH RESULTS\n\n${results.join("\n\n---\n\n")}` : "No matching knowledge base entries found." }] };
83
+
84
+ return { content: [{ type: "text", text: results.length > 0 ? `### KNOWLEDGE BASE SEARCH RESULTS\n\n${results.join("\n\n---\n\n")}` : "No matching knowledge entries found." }] };
51
85
  } catch (error) {
52
86
  return { content: [{ type: "text", text: "Knowledge base search failed." }] };
53
87
  }
54
88
  },
55
89
  update_knowledge_base: async (args: unknown, projectRoot: string) => {
56
90
  const parsed = UPDATE_KNOWLEDGE_BASE_ARGS_SCHEMA.safeParse(args ?? {});
57
- if (!parsed.success) return { content: [{ type: "text", text: "Invalid topic or content." }] };
91
+ if (!parsed.success) return { content: [{ type: "text", text: "Invalid arguments." }] };
58
92
  try {
59
93
  const frameworkDir = getFrameworkDir(projectRoot);
60
94
  const kbDir = path.join(projectRoot, frameworkDir, "knowledge");
61
95
  if (!fs.existsSync(kbDir)) fs.mkdirSync(kbDir, { recursive: true });
62
- fs.writeFileSync(path.join(kbDir, parsed.data.topic.replace(/[^a-z0-9]/gi, "_").toLowerCase() + ".md"), parsed.data.content);
63
- return { content: [{ type: "text", text: `Knowledge base updated: ${parsed.data.topic}` }] };
96
+
97
+ const fileName = parsed.data.topic.replace(/[^a-z0-9]/gi, "_").toLowerCase() + ".md";
98
+ const tags = parsed.data.tags;
99
+
100
+ let finalContent = parsed.data.content;
101
+ if (!finalContent.startsWith("---")) {
102
+ const frontmatter = `---\ntitle: ${parsed.data.topic}\ntags: [${tags.join(", ")}]\nlast_updated: ${new Date().toISOString()}\n---\n\n`;
103
+ finalContent = frontmatter + finalContent;
104
+ }
105
+
106
+ fs.writeFileSync(path.join(kbDir, fileName), finalContent);
107
+ return { content: [{ type: "text", text: `Obsidian Wiki updated: ${parsed.data.topic}` }] };
64
108
  } catch (error) {
65
109
  return { content: [{ type: "text", text: "Failed to update knowledge base." }] };
66
110
  }
67
111
  },
112
+ get_knowledge_graph: async (args: unknown, projectRoot: string) => {
113
+ try {
114
+ const frameworkDir = getFrameworkDir(projectRoot);
115
+ const kbDir = path.join(projectRoot, frameworkDir, "knowledge");
116
+ if (!fs.existsSync(kbDir)) return { content: [{ type: "text", text: "Knowledge base empty." }] };
117
+
118
+ const files = fs.readdirSync(kbDir).filter(f => f.endsWith(".md"));
119
+ let mermaid = "graph TD\n";
120
+
121
+ files.forEach(file => {
122
+ const content = fs.readFileSync(path.join(kbDir, file), "utf-8");
123
+ const { metadata } = parseFrontmatter(content);
124
+ const id = file.replace(".md", "");
125
+ const label = metadata.title || id;
126
+
127
+ mermaid += ` ${id}["${label}"]\n`;
128
+
129
+ if (metadata.related) {
130
+ const related = metadata.related.replace(/[\[\]]/g, "").split(",");
131
+ related.forEach((r: string) => {
132
+ mermaid += ` ${id} --> ${r.trim().replace(".md", "")}\n`;
133
+ });
134
+ }
135
+ });
136
+
137
+ return { content: [{ type: "text", text: `### KNOWLEDGE GRAPH (Mermaid)\n\n\`\`\`mermaid\n${mermaid}\n\`\`\`` }] };
138
+ } catch (error) {
139
+ return { content: [{ type: "text", text: "Failed to generate knowledge graph." }] };
140
+ }
141
+ }
68
142
  };
@@ -3,30 +3,45 @@ import path from "path";
3
3
  import { getFrameworkDir } from "../utils.js";
4
4
  import {
5
5
  SEND_AGENT_MESSAGE_ARGS_SCHEMA,
6
- READ_AGENT_MESSAGES_ARGS_SCHEMA
6
+ READ_AGENT_MESSAGES_ARGS_SCHEMA,
7
+ GET_AGENT_INBOX_STATS_ARGS_SCHEMA
7
8
  } from "../schemas.js";
8
9
 
9
10
  export const messageTools = [
10
11
  {
11
12
  name: "send_agent_message",
12
- description: "Sends a message to another specialized agent. Useful for collaboration and delegation.",
13
+ description: "Sends a message to another specialized agent following the Hermes Protocol.",
13
14
  inputSchema: {
14
15
  type: "object",
15
16
  properties: {
16
17
  to: { type: "string", description: "Recipient agent name" },
17
18
  message: { type: "string", description: "The message content" },
18
19
  traceId: { type: "string", description: "The active Trace ID" },
20
+ category: { type: "string", enum: ["ACTION", "DELEGATION", "INFO", "ALERT"], default: "INFO" },
21
+ priority: { type: "string", enum: ["LOW", "MEDIUM", "HIGH", "URGENT"], default: "MEDIUM" },
19
22
  },
20
23
  required: ["to", "message", "traceId"],
21
24
  },
22
25
  },
23
26
  {
24
27
  name: "read_agent_messages",
25
- description: "Reads messages sent to the current agent.",
28
+ description: "Reads messages sent to the current agent. Filters by Trace ID if provided.",
26
29
  inputSchema: {
27
30
  type: "object",
28
31
  properties: {
29
32
  agent: { type: "string", description: "Current agent name reading their messages" },
33
+ traceId: { type: "string", description: "Optional Trace ID to filter messages" },
34
+ },
35
+ required: ["agent"],
36
+ },
37
+ },
38
+ {
39
+ name: "get_agent_inbox_stats",
40
+ description: "Returns statistics about the agent's inbox (total, unread, priority distribution).",
41
+ inputSchema: {
42
+ type: "object",
43
+ properties: {
44
+ agent: { type: "string", description: "Agent name" },
30
45
  },
31
46
  required: ["agent"],
32
47
  },
@@ -37,26 +52,42 @@ interface Message {
37
52
  timestamp: string;
38
53
  from: string;
39
54
  traceId: string;
55
+ category: "ACTION" | "DELEGATION" | "INFO" | "ALERT";
56
+ priority: "LOW" | "MEDIUM" | "HIGH" | "URGENT";
40
57
  content: string;
41
58
  read: boolean;
42
59
  }
43
60
 
61
+ function normalizeAgentName(agent: string): string | null {
62
+ const normalized = agent.replace(/^@/, "").trim();
63
+ return /^[a-z0-9_-]+$/i.test(normalized) ? normalized : null;
64
+ }
65
+
44
66
  export const messageHandlers = {
45
67
  send_agent_message: async (args: unknown, projectRoot: string) => {
46
68
  const parsed = SEND_AGENT_MESSAGE_ARGS_SCHEMA.safeParse(args ?? {});
47
69
  if (!parsed.success) return { content: [{ type: "text", text: "Invalid message arguments." }] };
48
70
  try {
49
71
  const frameworkDir = getFrameworkDir(projectRoot);
50
- const recipient = parsed.data.to.replace(/^@/, "");
72
+ const recipient = normalizeAgentName(parsed.data.to);
73
+ if (!recipient) return { content: [{ type: "text", text: "Invalid recipient agent name." }] };
51
74
  const messagesDir = path.join(projectRoot, frameworkDir, "messages");
52
75
  if (!fs.existsSync(messagesDir)) fs.mkdirSync(messagesDir, { recursive: true });
53
76
  const messagePath = path.join(messagesDir, `${recipient}.json`);
54
77
  const messages = (fs.existsSync(messagePath) ? JSON.parse(fs.readFileSync(messagePath, "utf-8")) : []) as Message[];
55
- messages.push({ timestamp: new Date().toISOString(), from: "manager", traceId: parsed.data.traceId, content: parsed.data.message, read: false });
78
+ messages.push({
79
+ timestamp: new Date().toISOString(),
80
+ from: "manager",
81
+ traceId: parsed.data.traceId,
82
+ category: parsed.data.category,
83
+ priority: parsed.data.priority,
84
+ content: parsed.data.message,
85
+ read: false
86
+ });
56
87
  fs.writeFileSync(messagePath, JSON.stringify(messages, null, 2));
57
- return { content: [{ type: "text", text: `Message sent to @${recipient}.` }] };
88
+ return { content: [{ type: "text", text: `Hermes: Message sent to @${recipient} [${parsed.data.category} | ${parsed.data.priority}].` }] };
58
89
  } catch (error) {
59
- return { content: [{ type: "text", text: "Failed to send message." }] };
90
+ return { content: [{ type: "text", text: "Failed to send message via Hermes." }] };
60
91
  }
61
92
  },
62
93
  read_agent_messages: async (args: unknown, projectRoot: string) => {
@@ -64,15 +95,53 @@ export const messageHandlers = {
64
95
  if (!parsed.success) return { content: [{ type: "text", text: "Invalid agent name." }] };
65
96
  try {
66
97
  const frameworkDir = getFrameworkDir(projectRoot);
67
- const agentName = parsed.data.agent.replace(/^@/, "");
98
+ const agentName = normalizeAgentName(parsed.data.agent);
99
+ if (!agentName) return { content: [{ type: "text", text: "Invalid agent name." }] };
68
100
  const messagePath = path.join(projectRoot, frameworkDir, "messages", `${agentName}.json`);
69
101
  if (!fs.existsSync(messagePath)) return { content: [{ type: "text", text: "No messages found." }] };
70
102
  const messages = JSON.parse(fs.readFileSync(messagePath, "utf-8")) as Message[];
71
- const unread = messages.filter((m) => !m.read);
72
- fs.writeFileSync(messagePath, JSON.stringify(messages.map((m) => ({ ...m, read: true })), null, 2));
73
- return { content: [{ type: "text", text: unread.length === 0 ? "No new messages." : `### INBOX: @${agentName}\n\n` + unread.map((m) => `- **From:** ${m.from}\n **Message:** ${m.content}`).join("\n\n") }] };
103
+ const unread = messages.filter((m) => !m.read && (!parsed.data.traceId || m.traceId === parsed.data.traceId));
104
+
105
+ fs.writeFileSync(messagePath, JSON.stringify(messages.map((m) => (
106
+ !m.read && (!parsed.data.traceId || m.traceId === parsed.data.traceId) ? { ...m, read: true } : m
107
+ )), null, 2));
108
+
109
+ if (unread.length === 0) return { content: [{ type: "text", text: "No new messages." }] };
110
+
111
+ const formatted = unread.map((m) =>
112
+ `- [${m.priority}] **${m.from}** (${m.category}): ${m.content} *(Trace: ${m.traceId})*`
113
+ ).join("\n");
114
+
115
+ return { content: [{ type: "text", text: `### HERMES INBOX: @${agentName}\n\n${formatted}` }] };
74
116
  } catch (error) {
75
117
  return { content: [{ type: "text", text: "Failed to read messages." }] };
76
118
  }
77
119
  },
120
+ get_agent_inbox_stats: async (args: unknown, projectRoot: string) => {
121
+ const parsed = GET_AGENT_INBOX_STATS_ARGS_SCHEMA.safeParse(args ?? {});
122
+ if (!parsed.success) return { content: [{ type: "text", text: "Invalid agent name." }] };
123
+ try {
124
+ const frameworkDir = getFrameworkDir(projectRoot);
125
+ const agentName = normalizeAgentName(parsed.data.agent);
126
+ if (!agentName) return { content: [{ type: "text", text: "Invalid agent name." }] };
127
+ const messagePath = path.join(projectRoot, frameworkDir, "messages", `${agentName}.json`);
128
+ if (!fs.existsSync(messagePath)) return { content: [{ type: "text", text: "Inbox empty." }] };
129
+ const messages = JSON.parse(fs.readFileSync(messagePath, "utf-8")) as Message[];
130
+ const unread = messages.filter(m => !m.read);
131
+
132
+ const priorityDist = messages.reduce((acc, m) => {
133
+ acc[m.priority] = (acc[m.priority] || 0) + 1;
134
+ return acc;
135
+ }, {} as Record<string, number>);
136
+
137
+ return {
138
+ content: [{
139
+ type: "text",
140
+ text: `### INBOX STATS: @${agentName}\n- Total: ${messages.length}\n- Unread: ${unread.length}\n- Priority Distribution: ${JSON.stringify(priorityDist)}`
141
+ }]
142
+ };
143
+ } catch (error) {
144
+ return { content: [{ type: "text", text: "Failed to get inbox stats." }] };
145
+ }
146
+ }
78
147
  };
@@ -1,6 +1,6 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
- import { execSync } from "child_process";
3
+ import { spawnSync } from "child_process";
4
4
  import { Project } from "ts-morph";
5
5
  import {
6
6
  resolveSafePath,
@@ -42,12 +42,33 @@ export const repositoryHandlers = {
42
42
  const pkgPath = path.join(projectRoot, "package.json");
43
43
  if (!fs.existsSync(pkgPath)) return { content: [{ type: "text", text: "package.json not found." }] };
44
44
  const scripts = JSON.parse(fs.readFileSync(pkgPath, "utf-8")).scripts || {};
45
- const runScript = (name: string) => scripts[name] ? { name, status: (execSync(`npm run ${name}`, { stdio: "pipe", cwd: projectRoot }) ? "PASSED" : "FAILED") } : { name, status: "SKIPPED" };
45
+ const scriptCandidates: Record<string, string[]> = {
46
+ lint: ["lint", "enderun:lint"],
47
+ test: ["test", "enderun:test"],
48
+ build: ["build", "enderun:build"],
49
+ };
50
+ const runScript = (name: string) => {
51
+ const scriptName = scriptCandidates[name].find((candidate) => scripts[candidate]);
52
+ if (!scriptName) return { name, script: "-", status: "SKIPPED", details: "No matching script found." };
53
+
54
+ const result = spawnSync("npm", ["run", scriptName], {
55
+ cwd: projectRoot,
56
+ encoding: "utf-8",
57
+ stdio: "pipe",
58
+ });
59
+ const output = `${result.stdout || ""}${result.stderr || ""}`.trim();
60
+ return {
61
+ name,
62
+ script: scriptName,
63
+ status: result.status === 0 ? "PASSED" : "FAILED",
64
+ details: output.split("\n").slice(-5).join("\n"),
65
+ };
66
+ };
46
67
  const results = [];
47
68
  if (scope === "full" || scope === "lint") results.push(runScript("lint"));
48
69
  if (scope === "full" || scope === "test") results.push(runScript("test"));
49
70
  if (scope === "full" || scope === "build") results.push(runScript("build"));
50
- return { content: [{ type: "text", text: `### REPOSITORY HEALTH REPORT\n\n` + results.map(r => `- **${r.name.toUpperCase()}:** ${r.status}`).join("\n") }] };
71
+ return { content: [{ type: "text", text: `### REPOSITORY HEALTH REPORT\n\n` + results.map(r => `- **${r.name.toUpperCase()}** (${r.script}): ${r.status}${r.status === "FAILED" && r.details ? `\n ${r.details}` : ""}`).join("\n") }] };
51
72
  } catch (error) {
52
73
  return { content: [{ type: "text", text: "Health validation failed." }] };
53
74
  }
@@ -1,10 +1,10 @@
1
1
  import path from "path";
2
2
  import fs from "fs";
3
3
 
4
- export const FRAMEWORK_VERSION = "0.5.0";
4
+ export const FRAMEWORK_VERSION = "0.5.2";
5
5
 
6
6
  export function getFrameworkDir(projectRoot: string): string {
7
- const adapters = [".gemini", ".claude", ".cursor", ".codex", ".enderun"];
7
+ const adapters = [".gemini", ".claude", ".cursor", ".enderun", ".codex"];
8
8
  for (const adp of adapters) {
9
9
  const fullPath = path.join(projectRoot, adp);
10
10
  if (fs.existsSync(fullPath) && fs.lstatSync(fullPath).isDirectory()) {
File without changes
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "version": "0.1.11",
3
- "last_updated": "2026-05-11T13:45:00Z",
4
- "contract_hash": "a8ff433521ce2d7e249d67e84ae8ef0e54082260195b672789ef7a48a9a1e35a",
3
+ "last_updated": "2026-05-16T16:47:16.000Z",
4
+ "contract_hash": "8574144a23e68351f48365f5ccb3d69dc11629af54ec9c1ed0fffd57f967b777",
5
5
  "breaking_changes": [
6
- { "version": "0.1.11", "description": "Extended shared types for Enderun Brain Dashboard" }
6
+ {
7
+ "version": "0.1.11",
8
+ "description": "Extended shared types for Enderun Brain Dashboard"
9
+ }
7
10
  ],
8
11
  "deprecated_versions": []
9
12
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-enderun/shared-types",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Shared TypeScript types for AI-Enderun Framework. Ensures Contract-First synchronization between agents.",
5
5
  "author": "Yusuf BEKAR",
6
6
  "license": "MIT",
@@ -23,9 +23,9 @@
23
23
  "README.md"
24
24
  ],
25
25
  "scripts": {
26
- "build": "npx tsc -p tsconfig.json",
27
- "build:watch": "npx tsc -p tsconfig.json --watch",
28
- "typecheck": "npx tsc -p tsconfig.json --noEmit"
26
+ "build": "tsc -p tsconfig.json",
27
+ "build:watch": "tsc -p tsconfig.json --watch",
28
+ "typecheck": "tsc -p tsconfig.json --noEmit"
29
29
  },
30
30
  "license": "MIT",
31
31
  "devDependencies": {
File without changes
File without changes
package/panda.config.ts CHANGED
@@ -5,7 +5,11 @@ export default defineConfig({
5
5
  preflight: true,
6
6
 
7
7
  // Where to look for your css declarations
8
- include: ["./src/**/*.{js,jsx,ts,tsx}", "./pages/**/*.{js,jsx,ts,tsx}"],
8
+ include: [
9
+ "./src/**/*.{js,jsx,ts,tsx}",
10
+ "./pages/**/*.{js,jsx,ts,tsx}",
11
+ "./apps/**/*.{js,jsx,ts,tsx}",
12
+ ],
9
13
 
10
14
  // Files to exclude
11
15
  exclude: [],
package/tsconfig.json CHANGED
File without changes