agent-enderun 1.10.4 → 1.11.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 (183) hide show
  1. package/README.md +34 -45
  2. package/dist/framework-mcp/tests/tools/quality/check_lint.test.js +1 -1
  3. package/dist/framework-mcp/tests/tools/quality/check_lint.test.js.map +1 -1
  4. package/dist/src/cli/adapters/core.d.ts +1 -1
  5. package/dist/src/cli/adapters/core.js +0 -1
  6. package/dist/src/cli/adapters/core.js.map +1 -1
  7. package/dist/src/cli/adapters/index.d.ts +1 -0
  8. package/dist/src/cli/adapters/index.js +1 -0
  9. package/dist/src/cli/adapters/index.js.map +1 -1
  10. package/dist/src/cli/adapters/scaffold.d.ts +1 -1
  11. package/dist/src/cli/adapters/scaffold.js +8 -6
  12. package/dist/src/cli/adapters/scaffold.js.map +1 -1
  13. package/dist/src/cli/commands/init/scaffold-core.d.ts +5 -2
  14. package/dist/src/cli/commands/init/scaffold-core.js +28 -6
  15. package/dist/src/cli/commands/init/scaffold-core.js.map +1 -1
  16. package/dist/src/cli/commands/init.js +31 -4
  17. package/dist/src/cli/commands/init.js.map +1 -1
  18. package/dist/src/cli/commands/orchestrate.d.ts +6 -6
  19. package/dist/src/cli/commands/plan.d.ts +3 -1
  20. package/dist/src/cli/commands/plan.js +79 -22
  21. package/dist/src/cli/commands/plan.js.map +1 -1
  22. package/dist/src/cli/index.js +11 -15
  23. package/dist/src/cli/index.js.map +1 -1
  24. package/dist/src/cli/utils/compliance.js +0 -1
  25. package/dist/src/cli/utils/compliance.js.map +1 -1
  26. package/dist/src/cli/utils/config-schema.d.ts +7 -7
  27. package/dist/src/cli/utils/pkg.d.ts +19 -0
  28. package/dist/src/cli/utils/pkg.js +29 -5
  29. package/dist/src/cli/utils/pkg.js.map +1 -1
  30. package/dist/src/modules/agents/registry/analyst.js +1 -1
  31. package/dist/src/modules/agents/registry/analyst.js.map +1 -1
  32. package/dist/src/modules/agents/registry/backend.js +5 -4
  33. package/dist/src/modules/agents/registry/backend.js.map +1 -1
  34. package/dist/src/modules/agents/registry/database.js +2 -1
  35. package/dist/src/modules/agents/registry/database.js.map +1 -1
  36. package/dist/src/modules/agents/registry/git.js +1 -1
  37. package/dist/src/modules/agents/registry/git.js.map +1 -1
  38. package/dist/src/modules/agents/registry/manager.js +3 -2
  39. package/dist/src/modules/agents/registry/manager.js.map +1 -1
  40. package/dist/src/modules/agents/registry/native.js +1 -1
  41. package/dist/src/modules/agents/registry/native.js.map +1 -1
  42. package/dist/src/modules/agents/registry/security.js +1 -0
  43. package/dist/src/modules/agents/registry/security.js.map +1 -1
  44. package/dist/tests/approve.test.js +4 -9
  45. package/dist/tests/approve.test.js.map +1 -1
  46. package/framework-mcp/dist/constants.js +64 -0
  47. package/framework-mcp/dist/index.js +109 -0
  48. package/framework-mcp/dist/tools/control_plane/locking.js +64 -0
  49. package/framework-mcp/dist/tools/control_plane/registry.js +34 -0
  50. package/framework-mcp/dist/tools/dashboard/start_dashboard.js +29 -0
  51. package/framework-mcp/dist/tools/definitions.js +300 -0
  52. package/framework-mcp/dist/tools/file_system/batch_surgical_edit.js +59 -0
  53. package/framework-mcp/dist/tools/file_system/patch_file.js +25 -0
  54. package/framework-mcp/dist/tools/file_system/read_file.js +51 -0
  55. package/framework-mcp/dist/tools/file_system/replace_text.js +43 -0
  56. package/framework-mcp/dist/tools/file_system/write_file.js +38 -0
  57. package/framework-mcp/dist/tools/framework/audit_deps.js +41 -0
  58. package/framework-mcp/dist/tools/framework/get_status.js +5 -0
  59. package/framework-mcp/dist/tools/framework/orchestrate.js +5 -0
  60. package/framework-mcp/dist/tools/framework/run_tests.js +25 -0
  61. package/framework-mcp/dist/tools/framework/update_contract_hash.js +5 -0
  62. package/framework-mcp/dist/tools/framework/update_memory.js +8 -0
  63. package/framework-mcp/dist/tools/index.js +62 -0
  64. package/framework-mcp/dist/tools/memory/get_insights.js +34 -0
  65. package/framework-mcp/dist/tools/memory/read_memory.js +28 -0
  66. package/framework-mcp/dist/tools/messaging/log_action.js +22 -0
  67. package/framework-mcp/dist/tools/messaging/send_message.js +87 -0
  68. package/framework-mcp/dist/tools/observability/check_ports.js +26 -0
  69. package/framework-mcp/dist/tools/observability/get_health.js +19 -0
  70. package/framework-mcp/dist/tools/quality/check_lint.js +28 -0
  71. package/framework-mcp/dist/tools/search/get_gaps.js +48 -0
  72. package/framework-mcp/dist/tools/search/get_map.js +43 -0
  73. package/framework-mcp/dist/tools/search/grep_search.js +76 -0
  74. package/framework-mcp/dist/tools/search/list_dir.js +28 -0
  75. package/framework-mcp/dist/tools/shell/run_command.js +46 -0
  76. package/framework-mcp/dist/tools/types.js +1 -0
  77. package/framework-mcp/dist/utils/cli.js +20 -0
  78. package/framework-mcp/dist/utils/compliance.js +29 -0
  79. package/framework-mcp/dist/utils/fs.js +44 -0
  80. package/framework-mcp/dist/utils/metrics.js +56 -0
  81. package/framework-mcp/dist/utils/security.js +60 -0
  82. package/framework-mcp/package.json +19 -0
  83. package/framework-mcp/src/constants.ts +78 -0
  84. package/framework-mcp/src/declarations.d.ts +17 -0
  85. package/framework-mcp/src/index.ts +132 -0
  86. package/framework-mcp/src/tools/control_plane/locking.ts +71 -0
  87. package/framework-mcp/src/tools/control_plane/registry.ts +38 -0
  88. package/framework-mcp/src/tools/dashboard/start_dashboard.ts +33 -0
  89. package/framework-mcp/src/tools/definitions.ts +302 -0
  90. package/framework-mcp/src/tools/file_system/batch_surgical_edit.ts +79 -0
  91. package/framework-mcp/src/tools/file_system/patch_file.ts +33 -0
  92. package/framework-mcp/src/tools/file_system/read_file.ts +58 -0
  93. package/framework-mcp/src/tools/file_system/replace_text.ts +52 -0
  94. package/framework-mcp/src/tools/file_system/write_file.ts +45 -0
  95. package/framework-mcp/src/tools/framework/audit_deps.ts +49 -0
  96. package/framework-mcp/src/tools/framework/get_status.ts +7 -0
  97. package/framework-mcp/src/tools/framework/orchestrate.ts +7 -0
  98. package/framework-mcp/src/tools/framework/run_tests.ts +28 -0
  99. package/framework-mcp/src/tools/framework/update_contract_hash.ts +7 -0
  100. package/framework-mcp/src/tools/framework/update_memory.ts +10 -0
  101. package/framework-mcp/src/tools/index.ts +66 -0
  102. package/framework-mcp/src/tools/memory/get_insights.ts +41 -0
  103. package/framework-mcp/src/tools/memory/read_memory.ts +31 -0
  104. package/framework-mcp/src/tools/messaging/log_action.ts +28 -0
  105. package/framework-mcp/src/tools/messaging/send_message.ts +89 -0
  106. package/framework-mcp/src/tools/observability/check_ports.ts +30 -0
  107. package/framework-mcp/src/tools/observability/get_health.ts +24 -0
  108. package/framework-mcp/src/tools/quality/check_lint.ts +33 -0
  109. package/framework-mcp/src/tools/search/get_gaps.ts +54 -0
  110. package/framework-mcp/src/tools/search/get_map.ts +48 -0
  111. package/framework-mcp/src/tools/search/grep_search.ts +76 -0
  112. package/framework-mcp/src/tools/search/list_dir.ts +34 -0
  113. package/framework-mcp/src/tools/shell/run_command.ts +56 -0
  114. package/framework-mcp/src/tools/types.ts +89 -0
  115. package/framework-mcp/src/utils/cli.ts +20 -0
  116. package/framework-mcp/src/utils/compliance.ts +37 -0
  117. package/framework-mcp/src/utils/fs.ts +45 -0
  118. package/framework-mcp/src/utils/metrics.ts +73 -0
  119. package/framework-mcp/src/utils/security.ts +66 -0
  120. package/framework-mcp/tests/tools/file_system/file_system_tools.test.ts +212 -0
  121. package/framework-mcp/tests/tools/messaging/send_message.test.ts +136 -0
  122. package/framework-mcp/tests/tools/quality/check_lint.test.ts +46 -0
  123. package/framework-mcp/tests/tools/shell/run_command.test.ts +55 -0
  124. package/framework-mcp/tsconfig.json +14 -0
  125. package/package.json +5 -3
  126. package/src/cli/adapters/core.ts +2 -3
  127. package/src/cli/adapters/index.ts +1 -0
  128. package/src/cli/adapters/scaffold.ts +15 -6
  129. package/src/cli/commands/init/scaffold-core.ts +45 -6
  130. package/src/cli/commands/init.ts +31 -2
  131. package/src/cli/commands/plan.ts +89 -23
  132. package/src/cli/index.ts +14 -19
  133. package/src/cli/utils/compliance.ts +8 -9
  134. package/src/cli/utils/pkg.ts +42 -13
  135. package/src/modules/agents/registry/analyst.ts +1 -1
  136. package/src/modules/agents/registry/backend.ts +5 -4
  137. package/src/modules/agents/registry/database.ts +2 -1
  138. package/src/modules/agents/registry/git.ts +1 -1
  139. package/src/modules/agents/registry/manager.ts +3 -2
  140. package/src/modules/agents/registry/native.ts +1 -1
  141. package/src/modules/agents/registry/security.ts +1 -0
  142. package/templates/prompts/bug-fix-recipe.md +20 -0
  143. package/templates/prompts/contract-design-recipe.md +21 -0
  144. package/templates/prompts/db-management-recipe.md +25 -0
  145. package/templates/prompts/deployment-recipe.md +23 -0
  146. package/templates/prompts/new-feature-recipe.md +19 -0
  147. package/templates/prompts/performance-optimization-recipe.md +23 -0
  148. package/templates/prompts/pull-request-template.md +21 -0
  149. package/templates/prompts/refactoring-recipe.md +21 -0
  150. package/templates/prompts/security-audit-recipe.md +20 -0
  151. package/templates/standards/architecture-standards.md +23 -0
  152. package/templates/standards/auth-standards.md +125 -0
  153. package/templates/standards/crud-governance.md +21 -0
  154. package/templates/standards/deployment-standards.md +21 -0
  155. package/templates/standards/frontend-standards.md +37 -0
  156. package/templates/standards/github-actions-standards.md +43 -0
  157. package/templates/standards/i18n-standards.md +17 -0
  158. package/templates/standards/kysely-standards.md +47 -0
  159. package/templates/standards/llm-governance.md +15 -0
  160. package/templates/standards/logging-and-secrets.md +34 -0
  161. package/templates/standards/mobile-standards.md +23 -0
  162. package/templates/standards/observability-standards.md +15 -0
  163. package/templates/standards/performance-standards.md +15 -0
  164. package/templates/standards/pino-standards.md +46 -0
  165. package/templates/standards/playwright-standards.md +54 -0
  166. package/templates/standards/quality-standards.md +31 -0
  167. package/templates/standards/react-query-standards.md +72 -0
  168. package/templates/standards/react-router-standards.md +62 -0
  169. package/templates/standards/security-audit-standards.md +16 -0
  170. package/templates/standards/security-standards.md +21 -0
  171. package/templates/standards/swagger-standards.md +50 -0
  172. package/templates/standards/tailwind-standards.md +20 -0
  173. package/templates/standards/testing-standards.md +31 -0
  174. package/templates/standards/typeorm-standards.md +49 -0
  175. package/templates/standards/vitest-standards.md +110 -0
  176. package/src/cli/commands/app.ts +0 -56
  177. package/src/cli/utils/app-backend.ts +0 -257
  178. package/src/cli/utils/app-docs.ts +0 -83
  179. package/src/cli/utils/app-frontend.ts +0 -263
  180. package/src/cli/utils/app-inferrer.ts +0 -63
  181. package/src/cli/utils/app-mobile.ts +0 -113
  182. package/src/cli/utils/app-types.ts +0 -248
  183. package/src/cli/utils/app.ts +0 -6
@@ -1 +1 @@
1
- {"version":3,"file":"native.js","sourceRoot":"","sources":["../../../../../src/modules/agents/registry/native.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG,uCAAgD,CAAC;AAEvE,MAAM,CAAC,MAAM,MAAM,GAAoB;IACnC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,iBAAiB;IAC9B,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EACb,kDAAkD;QAClD,iDAAiD;IAC/C,UAAU,EAAE,CAAC;IACb,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IACxB,YAAY,EAAE,aAAa;IAC3B,KAAK,EAAE;QACH,WAAW;QACX,YAAY;QACZ,cAAc;QACd,UAAU;QACV,aAAa;QACb,qBAAqB;QACrB,mBAAmB;KACtB;IACD,YAAY,EAAE;QACV,QAAQ,EAAE,4DAA4D;QACtE,OAAO,EACX,kEAAkE;YAClE,4CAA4C;QACxC,cAAc,EAAE,0EAA0E;YAC1E,2FAA2F;YAC3F,0EAA0E;YAC1E,kGAAkG;QAClH,KAAK,EAAE;YACH,oFAAoF;YACpF,0FAA0F;YAC1F,gGAAgG;SACnG;KACJ;CACJ,CAAC"}
1
+ {"version":3,"file":"native.js","sourceRoot":"","sources":["../../../../../src/modules/agents/registry/native.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG,uCAAgD,CAAC;AAEvE,MAAM,CAAC,MAAM,MAAM,GAAoB;IACnC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,iBAAiB;IAC9B,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EACb,kDAAkD;QAClD,iDAAiD;IAC/C,UAAU,EAAE,CAAC;IACb,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IACxB,YAAY,EAAE,aAAa;IAC3B,KAAK,EAAE;QACH,WAAW;QACX,YAAY;QACZ,cAAc;QACd,UAAU;QACV,aAAa;QACb,qBAAqB;QACrB,mBAAmB;KACtB;IACD,YAAY,EAAE;QACV,QAAQ,EAAE,4DAA4D;QACtE,OAAO,EACX,kEAAkE;YAClE,4CAA4C;QACxC,cAAc,EAAE,0EAA0E;YAC1E,2FAA2F;YAC3F,0EAA0E;YAC1E,kGAAkG;QAClH,KAAK,EAAE;YACH,oFAAoF;YACpF,0FAA0F;YAC1F,gGAAgG;SACnG;KACJ;CACJ,CAAC"}
@@ -13,6 +13,7 @@ export const security = {
13
13
  "read_file",
14
14
  "replace_text",
15
15
  "grep_search",
16
+ "send_agent_message",
16
17
  "read_project_memory",
17
18
  "get_memory_insights",
18
19
  "log_agent_action",
@@ -1 +1 @@
1
- {"version":3,"file":"security.js","sourceRoot":"","sources":["../../../../../src/modules/agents/registry/security.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG,uCAAgD,CAAC;AAEvE,MAAM,CAAC,MAAM,QAAQ,GAAoB;IACrC,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,qBAAqB;IAClC,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EACb,uDAAuD;QACvD,uEAAuE;IACrE,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC;IAC1B,YAAY,EAAE,aAAa;IAC3B,KAAK,EAAE;QACH,WAAW;QACX,cAAc;QACd,aAAa;QACb,qBAAqB;QACrB,qBAAqB;QACrB,kBAAkB;KACrB;IACD,YAAY,EAAE;QACV,QAAQ,EAAE,2CAA2C;QACrD,OAAO,EACX,kEAAkE;YAClE,gCAAgC;QAC5B,cAAc,EAAE,0EAA0E;YAC1E,2FAA2F;YAC3F,0EAA0E;YAC1E,kGAAkG;QAClH,KAAK,EAAE;YACH,sGAAsG;YACtG,sGAAsG;YACtG,6EAA6E;YAC7E,0FAA0F;SAC7F;QACD,cAAc,EAAE,CAAC,uBAAuB,CAAC;KAC5C;CACJ,CAAC"}
1
+ {"version":3,"file":"security.js","sourceRoot":"","sources":["../../../../../src/modules/agents/registry/security.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG,uCAAgD,CAAC;AAEvE,MAAM,CAAC,MAAM,QAAQ,GAAoB;IACrC,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,qBAAqB;IAClC,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EACb,uDAAuD;QACvD,uEAAuE;IACrE,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC;IAC1B,YAAY,EAAE,aAAa;IAC3B,KAAK,EAAE;QACH,WAAW;QACX,cAAc;QACd,aAAa;QACb,oBAAoB;QACpB,qBAAqB;QACrB,qBAAqB;QACrB,kBAAkB;KACrB;IACD,YAAY,EAAE;QACV,QAAQ,EAAE,2CAA2C;QACrD,OAAO,EACX,kEAAkE;YAClE,gCAAgC;QAC5B,cAAc,EAAE,0EAA0E;YAC1E,2FAA2F;YAC3F,0EAA0E;YAC1E,kGAAkG;QAClH,KAAK,EAAE;YACH,sGAAsG;YACtG,sGAAsG;YACtG,6EAA6E;YAC7E,0FAA0F;SAC7F;QACD,cAAc,EAAE,CAAC,uBAAuB,CAAC;KAC5C;CACJ,CAAC"}
@@ -22,16 +22,11 @@ describe("Approve Command", () => {
22
22
  fs.rmSync(tempDir, { recursive: true, force: true });
23
23
  vi.restoreAllMocks();
24
24
  });
25
- it("should exit with error if messages directory does not exist", () => {
25
+ it("should exit with error if messages directory does not exist", async () => {
26
26
  const uiErrorSpy = vi.spyOn(UI, "error");
27
- const exitSpy = vi.spyOn(process, "exit").mockImplementation((code) => {
28
- throw new Error(`process.exit: ${code}`);
29
- });
30
- expect(() => approveCommand("trace-123")).toThrow(ValidationError);
31
- expect(uiErrorSpy).toHaveBeenCalledWith("No messages directory found.");
32
- exitSpy.mockRestore();
27
+ await expect(approveCommand("trace-123")).rejects.toThrow(ValidationError);
33
28
  });
34
- it("should successfully approve pending ACTION/ALERT message", () => {
29
+ it("should successfully approve pending ACTION/ALERT message", async () => {
35
30
  fs.mkdirSync(messagesDir, { recursive: true });
36
31
  const message = {
37
32
  timestamp: new Date().toISOString(),
@@ -45,7 +40,7 @@ describe("Approve Command", () => {
45
40
  const msgFilePath = path.join(messagesDir, "msg.json");
46
41
  fs.writeFileSync(msgFilePath, JSON.stringify(message) + "\n");
47
42
  const uiSuccessSpy = vi.spyOn(UI, "success");
48
- approveCommand("trace-123");
43
+ await approveCommand("trace-123");
49
44
  const fileContent = fs.readFileSync(msgFilePath, "utf8");
50
45
  const parsed = JSON.parse(fileContent.trim());
51
46
  expect(parsed.status).toBe("APPROVED");
@@ -1 +1 @@
1
- {"version":3,"file":"approve.test.js","sourceRoot":"","sources":["../../tests/approve.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,KAAK,WAAW,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAE,eAAe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AAC,EAAE,EAAE,SAAS,CAAC,CAAC;QAE7C,MAAM,cAAc,CAAC,WAAW,CAAC,CAAC;QAElC,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9C,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAEvC,MAAM,CAAC,YAAY,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC3F,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,64 @@
1
+ import path from "path";
2
+ /**
3
+ * Agent Enderun — Single Source of Truth for framework constants.
4
+ * Import from here instead of hardcoding paths, phases, or directory names.
5
+ */
6
+ // ─── Framework identity ───────────────────────────────────────────────────
7
+ export const FRAMEWORK = {
8
+ NAME: "Agent Enderun",
9
+ CORE_DIR: ".enderun",
10
+ // This is the hub for unified adapter layouts (e.g. .agents/gemini, .agents/claude)
11
+ UNIFIED_HUB_DIR: ".agents",
12
+ // This is the default directory to scaffold new apps into
13
+ APPS_DIR: "apps",
14
+ // This is where all skills are stored
15
+ SKILLS_DIR: "skills",
16
+ };
17
+ export const FRAMEWORK_SUBDIRS = {
18
+ AGENTS: "agents",
19
+ SKILLS: "skills",
20
+ KNOWLEDGE: "knowledge",
21
+ MESSAGES: "messages",
22
+ MEMORY: "memory",
23
+ MEMORY_GRAPH: "memory-graph",
24
+ LOGS: "logs",
25
+ CONFIG: "config",
26
+ };
27
+ export const ROOT_CONFIG_FILES = {
28
+ MCP: "mcp.json",
29
+ NATIVE_MODULES: "native-modules.json",
30
+ TSCONFIG: "tsconfig.json",
31
+ ESLINT: "eslint.config.js",
32
+ };
33
+ export const MCP = {
34
+ // Environment variable used by MCP to identify project root
35
+ PROJECT_ROOT_ENV: "ENDERUN_PROJECT_ROOT",
36
+ // Environment variable for test mode
37
+ TEST_DIR_ENV: "ENDERUN_TEST_DIR",
38
+ };
39
+ export const MEMORY_FILES = {
40
+ STATE: "state.json",
41
+ SHARED_FACTS: "shared_facts.json",
42
+ };
43
+ export const NATIVE_AGENT_PATHS = {
44
+ gemini: ".gemini/agents",
45
+ claude: ".claude/agents",
46
+ cursor: ".cursor/rules",
47
+ codex: ".agents/instructions",
48
+ grok: ".grok",
49
+ "antigravity-cli": ".antigravity/agents",
50
+ };
51
+ // ─── Backward-compatible aliases ──────────────────────────────────────────
52
+ export const CORE_FRAMEWORK_DIR = FRAMEWORK.CORE_DIR;
53
+ export const UNIFIED_HUB_DIR = FRAMEWORK.UNIFIED_HUB_DIR;
54
+ export const SKILLS_HUB_PATH = pathJoin(UNIFIED_HUB_DIR, FRAMEWORK_SUBDIRS.SKILLS);
55
+ // ─── Path Helpers ─────────────────────────────────────────────────────────
56
+ function pathJoin(...args) {
57
+ return path.join(...args);
58
+ }
59
+ function corePath(subdir, filename) {
60
+ return pathJoin(FRAMEWORK.CORE_DIR, subdir, filename);
61
+ }
62
+ export function knowledgePath(filename) {
63
+ return corePath(FRAMEWORK_SUBDIRS.KNOWLEDGE, filename);
64
+ }
@@ -0,0 +1,109 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { fileURLToPath } from "url";
4
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
5
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
7
+ import { TOOLS, toolHandlers } from "./tools/index.js";
8
+ // ─── Server Setup ─────────────────────────────────────────────────
9
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
10
+ // Robustly find package.json by walking up from __dirname
11
+ function findPackageJson(startDir) {
12
+ let currentDir = startDir;
13
+ while (currentDir !== path.parse(currentDir).root) {
14
+ const pkgPath = path.join(currentDir, "package.json");
15
+ if (fs.existsSync(pkgPath))
16
+ return pkgPath;
17
+ currentDir = path.dirname(currentDir);
18
+ }
19
+ throw new Error("Could not find package.json for @agent-enderun/mcp");
20
+ }
21
+ const pkgPath = findPackageJson(__dirname);
22
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
23
+ const serverVersion = pkg.version;
24
+ const server = new Server({
25
+ name: "@agent-enderun/mcp",
26
+ version: serverVersion,
27
+ }, {
28
+ capabilities: {
29
+ tools: {},
30
+ },
31
+ });
32
+ // Basic Schema Validator for Required Fields
33
+ function validateArgs(toolName, args) {
34
+ const definition = TOOLS.find(t => t.name === toolName);
35
+ if (!definition)
36
+ return `Unknown tool: ${toolName}`;
37
+ const required = definition.inputSchema.required || [];
38
+ for (const field of required) {
39
+ if (args[field] === undefined || args[field] === null || args[field] === "") {
40
+ return `Missing required argument: '${field}' for tool '${toolName}'`;
41
+ }
42
+ }
43
+ return null;
44
+ }
45
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
46
+ return { tools: TOOLS };
47
+ });
48
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
49
+ const req = request;
50
+ const { name, arguments: args } = req.params;
51
+ const projectRoot = process.env.ENDERUN_PROJECT_ROOT || process.cwd();
52
+ try {
53
+ const handler = toolHandlers[name];
54
+ if (!handler) {
55
+ return {
56
+ isError: true,
57
+ content: [{ type: "text", text: `❌ Unknown tool: ${name}` }],
58
+ };
59
+ }
60
+ // 🛡️ Runtime Validation
61
+ const validationError = validateArgs(name, args || {});
62
+ if (validationError) {
63
+ return {
64
+ isError: true,
65
+ content: [{ type: "text", text: `❌ Validation Error: ${validationError}` }],
66
+ };
67
+ }
68
+ return await handler(projectRoot, args || {});
69
+ }
70
+ catch (error) {
71
+ const message = error instanceof Error ? error.message : "Unknown error occurred";
72
+ return {
73
+ isError: true,
74
+ content: [{ type: "text", text: `❌ Execution failed: ${message}` }],
75
+ };
76
+ }
77
+ });
78
+ // ─── Graceful Startup & Shutdown ──────────────────────────────────
79
+ async function run() {
80
+ const transport = new StdioServerTransport();
81
+ // Prevent unhandled errors from crashing the MCP stream
82
+ process.on("uncaughtException", (error) => {
83
+ process.stderr.write(`[agent-enderun-mcp] Uncaught exception: ${error.message}
84
+ `);
85
+ });
86
+ process.on("unhandledRejection", (reason) => {
87
+ const message = reason instanceof Error ? reason.message : String(reason);
88
+ process.stderr.write(`[agent-enderun-mcp] Unhandled rejection: ${message}
89
+ `);
90
+ });
91
+ // Graceful shutdown on SIGINT/SIGTERM
92
+ const shutdown = async () => {
93
+ try {
94
+ await server.close();
95
+ }
96
+ catch {
97
+ // Already closed or failed — safe to ignore
98
+ }
99
+ process.exit(0);
100
+ };
101
+ process.on("SIGINT", shutdown);
102
+ process.on("SIGTERM", shutdown);
103
+ await server.connect(transport);
104
+ }
105
+ run().catch((error) => {
106
+ process.stderr.write(`[agent-enderun-mcp] Fatal startup error: ${error.message}
107
+ `);
108
+ process.exit(1);
109
+ });
@@ -0,0 +1,64 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { resolveFrameworkDir } from "../../utils/security.js";
4
+ /**
5
+ * Handles acquiring a stateful lock on a resource.
6
+ */
7
+ export async function handleAcquireLock(projectRoot, args) {
8
+ const { resource, agent, ttl = 60 } = args;
9
+ const frameworkDir = resolveFrameworkDir(projectRoot);
10
+ const lockDir = path.join(projectRoot, frameworkDir, "locks");
11
+ const lockPath = path.join(lockDir, `${resource}.lock`);
12
+ try {
13
+ if (!fs.existsSync(lockDir))
14
+ fs.mkdirSync(lockDir, { recursive: true });
15
+ if (fs.existsSync(lockPath)) {
16
+ const stat = fs.statSync(lockPath);
17
+ const now = new Date().getTime();
18
+ const age = (now - stat.mtimeMs) / 1000;
19
+ if (age < ttl) {
20
+ return {
21
+ isError: true,
22
+ content: [{ type: "text", text: `Resource '${resource}' is currently locked by another agent.` }]
23
+ };
24
+ }
25
+ // Lock expired, safe to override
26
+ fs.unlinkSync(lockPath);
27
+ }
28
+ fs.writeFileSync(lockPath, JSON.stringify({ agent, timestamp: new Date().toISOString() }));
29
+ return {
30
+ content: [{ type: "text", text: `✅ Lock acquired for resource '${resource}' by ${agent}.` }]
31
+ };
32
+ }
33
+ catch (e) {
34
+ return {
35
+ isError: true,
36
+ content: [{ type: "text", text: `Failed to acquire lock: ${String(e)}` }]
37
+ };
38
+ }
39
+ }
40
+ /**
41
+ * Handles releasing a lock.
42
+ */
43
+ export async function handleReleaseLock(projectRoot, args) {
44
+ const { resource, agent } = args;
45
+ const frameworkDir = resolveFrameworkDir(projectRoot);
46
+ const lockPath = path.join(projectRoot, frameworkDir, "locks", `${resource}.lock`);
47
+ try {
48
+ if (!fs.existsSync(lockPath)) {
49
+ return { content: [{ type: "text", text: `ℹ️ No lock found for resource '${resource}'.` }] };
50
+ }
51
+ const lockData = JSON.parse(fs.readFileSync(lockPath, "utf8"));
52
+ if (lockData.agent !== agent) {
53
+ return {
54
+ isError: true,
55
+ content: [{ type: "text", text: `❌ Denied: You do not own the lock for '${resource}'. Owned by ${lockData.agent}.` }]
56
+ };
57
+ }
58
+ fs.unlinkSync(lockPath);
59
+ return { content: [{ type: "text", text: `✅ Lock released for resource '${resource}' by ${agent}.` }] };
60
+ }
61
+ catch (e) {
62
+ return { isError: true, content: [{ type: "text", text: `Failed to release lock: ${String(e)}` }] };
63
+ }
64
+ }
@@ -0,0 +1,34 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { resolveFrameworkDir } from "../../utils/security.js";
4
+ /**
5
+ * Handles agent registration with the Control Plane.
6
+ * This can be used to validate permissions and active status.
7
+ */
8
+ export async function handleRegisterAgent(projectRoot, args) {
9
+ const { agent, role, capability = 5 } = args;
10
+ const frameworkDir = resolveFrameworkDir(projectRoot);
11
+ const registryDir = path.join(projectRoot, frameworkDir, "registry");
12
+ const agentFile = path.join(registryDir, `${agent.replace("@", "")}_active.json`);
13
+ try {
14
+ if (!fs.existsSync(registryDir))
15
+ fs.mkdirSync(registryDir, { recursive: true });
16
+ const agentData = {
17
+ agent,
18
+ role,
19
+ capability,
20
+ last_seen: new Date().toISOString(),
21
+ status: "ACTIVE"
22
+ };
23
+ fs.writeFileSync(agentFile, JSON.stringify(agentData, null, 2));
24
+ return {
25
+ content: [{ type: "text", text: `🎖️ Agent ${agent} (${role}) registered successfully in the Enderun Control Plane.` }]
26
+ };
27
+ }
28
+ catch (e) {
29
+ return {
30
+ isError: true,
31
+ content: [{ type: "text", text: `Failed to register agent: ${String(e)}` }]
32
+ };
33
+ }
34
+ }
@@ -0,0 +1,29 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { exec } from "child_process";
4
+ /**
5
+ * Starts the Enderun Web Dashboard server.
6
+ */
7
+ export function handleStartDashboard(projectRoot, args) {
8
+ const port = args.port || 5858;
9
+ const dashboardScript = path.join(projectRoot, "bin/enderun-dashboard.js");
10
+ if (!fs.existsSync(dashboardScript)) {
11
+ throw new Error("Dashboard server script not found in bin/enderun-dashboard.js");
12
+ }
13
+ try {
14
+ // Start the dashboard as a background process
15
+ exec(`node "${dashboardScript}"`, {
16
+ cwd: projectRoot,
17
+ env: { ...process.env, PORT: String(port) }
18
+ });
19
+ return {
20
+ content: [{
21
+ type: "text",
22
+ text: `🖥️ **Enderun Web Dashboard started!**\n\nAccess it at: http://localhost:${port}\n\nThis interface will show real-time agent status, system health, and orchestration logs.`
23
+ }]
24
+ };
25
+ }
26
+ catch (e) {
27
+ return { isError: true, content: [{ type: "text", text: `Failed to start dashboard: ${String(e)}` }] };
28
+ }
29
+ }