agent-enderun 0.9.4 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/.enderun/ENDERUN.md +1 -1
  2. package/.enderun/STATUS.md +2 -2
  3. package/.enderun/config.json +1 -1
  4. package/.enderun/memory-graph/shared-facts.json +1 -1
  5. package/framework-mcp/dist/index.js +42 -240
  6. package/framework-mcp/dist/tools/definitions.js +109 -0
  7. package/framework-mcp/dist/tools/file_system/patch_file.js +18 -0
  8. package/framework-mcp/dist/tools/file_system/read_file.js +7 -0
  9. package/framework-mcp/dist/tools/file_system/replace_text.js +14 -0
  10. package/framework-mcp/dist/tools/file_system/write_file.js +9 -0
  11. package/framework-mcp/dist/tools/framework/get_status.js +5 -0
  12. package/framework-mcp/dist/tools/framework/orchestrate.js +5 -0
  13. package/framework-mcp/dist/tools/framework/update_contract_hash.js +5 -0
  14. package/framework-mcp/dist/tools/framework/update_memory.js +8 -0
  15. package/framework-mcp/dist/tools/index.js +25 -0
  16. package/framework-mcp/dist/tools/messaging/log_action.js +22 -0
  17. package/framework-mcp/dist/tools/messaging/send_message.js +21 -0
  18. package/framework-mcp/dist/tools/types.js +1 -0
  19. package/framework-mcp/dist/utils/cli.js +20 -0
  20. package/framework-mcp/dist/utils/security.js +35 -0
  21. package/framework-mcp/src/declarations.d.ts +17 -3
  22. package/framework-mcp/src/index.ts +49 -277
  23. package/framework-mcp/src/tools/definitions.ts +111 -0
  24. package/framework-mcp/src/tools/file_system/patch_file.ts +23 -0
  25. package/framework-mcp/src/tools/file_system/read_file.ts +9 -0
  26. package/framework-mcp/src/tools/file_system/replace_text.ts +18 -0
  27. package/framework-mcp/src/tools/file_system/write_file.ts +11 -0
  28. package/framework-mcp/src/tools/framework/get_status.ts +7 -0
  29. package/framework-mcp/src/tools/framework/orchestrate.ts +7 -0
  30. package/framework-mcp/src/tools/framework/update_contract_hash.ts +7 -0
  31. package/framework-mcp/src/tools/framework/update_memory.ts +10 -0
  32. package/framework-mcp/src/tools/index.ts +31 -0
  33. package/framework-mcp/src/tools/messaging/log_action.ts +28 -0
  34. package/framework-mcp/src/tools/messaging/send_message.ts +26 -0
  35. package/framework-mcp/src/tools/types.ts +40 -0
  36. package/framework-mcp/src/utils/cli.ts +20 -0
  37. package/framework-mcp/src/utils/security.ts +41 -0
  38. package/package.json +2 -2
@@ -0,0 +1,28 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { resolveFrameworkDir } from "../../utils/security.js";
4
+ import { ToolArgs, ToolResult } from "../types.js";
5
+
6
+ export function handleLogAgentAction(projectRoot: string, args: ToolArgs): ToolResult {
7
+ const { agent, action, traceId, status, summary } = args as Required<Pick<ToolArgs, "agent" | "action" | "traceId" | "status" | "summary">>;
8
+ const findings = args.findings ? args.findings.split(",").map(f => f.trim()) : [];
9
+
10
+ const frameworkDir = resolveFrameworkDir(projectRoot);
11
+ const agentName = (agent as string).replace("@", "");
12
+ const logPath = path.join(projectRoot, frameworkDir, "logs", `${agentName}.json`);
13
+
14
+ const logEntry = {
15
+ timestamp: new Date().toISOString(),
16
+ agent,
17
+ action,
18
+ requestId: traceId,
19
+ status,
20
+ summary,
21
+ findings
22
+ };
23
+
24
+ fs.mkdirSync(path.dirname(logPath), { recursive: true });
25
+ fs.appendFileSync(logPath, JSON.stringify(logEntry) + "\n");
26
+
27
+ return { content: [{ type: "text", text: `✅ Action logged for ${agent} to ${path.join(frameworkDir, "logs", `${agentName}.json`)}` }] };
28
+ }
@@ -0,0 +1,26 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { resolveFrameworkDir } from "../../utils/security.js";
4
+ import { ToolArgs, ToolResult } from "../types.js";
5
+
6
+ export function handleSendAgentMessage(projectRoot: string, args: ToolArgs): ToolResult {
7
+ const { to, category, content, traceId } = args as Required<Pick<ToolArgs, "to" | "category" | "content" | "traceId">>;
8
+ const frameworkDir = resolveFrameworkDir(projectRoot);
9
+ const agentName = to.replace("@", "");
10
+ const messagePath = path.join(projectRoot, frameworkDir, "messages", `${agentName}.json`);
11
+
12
+ const message = {
13
+ timestamp: new Date().toISOString(),
14
+ from: "@mcp",
15
+ to,
16
+ category,
17
+ traceId,
18
+ content,
19
+ status: "PENDING"
20
+ };
21
+
22
+ fs.mkdirSync(path.dirname(messagePath), { recursive: true });
23
+ fs.appendFileSync(messagePath, JSON.stringify(message) + "\n");
24
+
25
+ return { content: [{ type: "text", text: `✅ Message sent to ${to}` }] };
26
+ }
@@ -0,0 +1,40 @@
1
+ export interface ToolDefinition {
2
+ name: string;
3
+ description: string;
4
+ inputSchema: {
5
+ type: "object";
6
+ properties: Record<string, { type: string; description?: string; enum?: string[] }>;
7
+ required?: string[];
8
+ };
9
+ }
10
+
11
+ export interface CallToolRequest {
12
+ params: {
13
+ name: string;
14
+ arguments?: ToolArgs;
15
+ };
16
+ }
17
+
18
+ export interface ToolArgs {
19
+ path?: string;
20
+ content?: string;
21
+ oldText?: string;
22
+ newText?: string;
23
+ startLine?: number;
24
+ endLine?: number;
25
+ newContent?: string;
26
+ section?: string;
27
+ to?: string;
28
+ category?: "ACTION" | "DELEGATION" | "INFO" | "ALERT";
29
+ traceId?: string;
30
+ agent?: string;
31
+ action?: string;
32
+ status?: "SUCCESS" | "FAILURE";
33
+ summary?: string;
34
+ findings?: string;
35
+ }
36
+
37
+ export interface ToolResult {
38
+ isError?: boolean;
39
+ content: Array<{ type: "text"; text: string }>;
40
+ }
@@ -0,0 +1,20 @@
1
+ import { execFileSync } from "child_process";
2
+
3
+ /**
4
+ * Executes a CLI command safely using execFileSync (no shell injection risk).
5
+ * Captures stderr gracefully to prevent stream crashes.
6
+ */
7
+ export function safeExec(command: string, args: string[], cwd: string): string {
8
+ try {
9
+ return execFileSync(command, args, {
10
+ cwd,
11
+ encoding: "utf8",
12
+ timeout: 30000,
13
+ maxBuffer: 1024 * 1024,
14
+ stdio: ["pipe", "pipe", "pipe"],
15
+ });
16
+ } catch (error: unknown) {
17
+ const err = error as { stderr?: string; message?: string };
18
+ throw new Error(err.stderr || err.message || "Command execution failed");
19
+ }
20
+ }
@@ -0,0 +1,41 @@
1
+ import path from "path";
2
+ import fs from "fs";
3
+
4
+ /**
5
+ * Validates and resolves a user-provided path to prevent path traversal attacks.
6
+ * Ensures the resolved path stays within the project root boundary.
7
+ */
8
+ export function safePath(projectRoot: string, userPath: string): string {
9
+ const resolved = path.resolve(projectRoot, userPath);
10
+ const normalizedRoot = path.resolve(projectRoot);
11
+
12
+ if (!resolved.startsWith(normalizedRoot + path.sep) && resolved !== normalizedRoot) {
13
+ throw new Error(`Access denied: path "${userPath}" escapes project root.`);
14
+ }
15
+
16
+ return resolved;
17
+ }
18
+
19
+ /**
20
+ * Resolves the active framework directory by scanning known candidates.
21
+ */
22
+ export function resolveFrameworkDir(projectRoot: string): string {
23
+ const candidates = [
24
+ ".gemini/antigravity",
25
+ ".gemini/antigravity-cli",
26
+ ".gemini",
27
+ ".claude",
28
+ ".grok",
29
+ ".agent",
30
+ ".enderun",
31
+ ];
32
+
33
+ for (const candidate of candidates) {
34
+ const candidatePath = path.join(projectRoot, candidate);
35
+ if (fs.existsSync(candidatePath)) {
36
+ return candidate;
37
+ }
38
+ }
39
+
40
+ return ".enderun";
41
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-enderun",
3
- "version": "0.9.4",
3
+ "version": "0.9.5",
4
4
  "description": "The Supreme AI Governance & Orchestration Framework for Enterprise Development",
5
5
  "author": "Yusuf BEKAR",
6
6
  "license": "MIT",
@@ -85,4 +85,4 @@
85
85
  "version": "0.9.0",
86
86
  "initializedAt": "2026-05-29T13:21:18.516Z"
87
87
  }
88
- }
88
+ }