0xray 3.0.14 → 3.1.1

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 (296) hide show
  1. package/.gitignore.default +59 -0
  2. package/.mcp.json +35 -0
  3. package/.opencode/codex.codex +1 -1
  4. package/.opencode/commands/dependency-audit.md +3 -3
  5. package/.opencode/commands/summary-logger.md +4 -4
  6. package/.opencode/enforcer-config.json +2 -2
  7. package/.opencode/hooks/post-commit +1 -1
  8. package/.opencode/init.sh +10 -4
  9. package/.plugin/plugin.json +11 -0
  10. package/AGENTS-consumer.md +46 -0
  11. package/AGENTS.md +10 -10
  12. package/LICENSE +1 -1
  13. package/README.md +8 -8
  14. package/SKILLS.md +140 -0
  15. package/dist/.gitignore.default +59 -0
  16. package/dist/AGENTS.md +10 -10
  17. package/dist/CHANGELOG.md +34 -0
  18. package/dist/LICENSE +1 -1
  19. package/dist/README.md +8 -8
  20. package/dist/SKILLS.md +140 -0
  21. package/dist/agents/index.js +3 -1
  22. package/dist/agents/registry.js +13 -0
  23. package/dist/analytics/routing-refiner.js +1 -1
  24. package/dist/architect/architectural-integrity.js +3 -3
  25. package/dist/benchmark/performance-benchmark.js +4 -3
  26. package/dist/cli/commands/antigravity-status.js +23 -23
  27. package/dist/cli/commands/credible-init.js +1 -1
  28. package/dist/cli/commands/hermes-install.js +12 -4
  29. package/dist/cli/commands/mcp-install.js +1 -1
  30. package/dist/cli/commands/openclaw-install.js +10 -1
  31. package/dist/cli/commands/opencode-install.js +22 -0
  32. package/dist/cli/commands/plugin-commands.js +2 -2
  33. package/dist/cli/commands/publish-agent.js +5 -5
  34. package/dist/cli/commands/skill-install.js +39 -2
  35. package/dist/cli/commands/status.js +8 -3
  36. package/dist/cli/commands/storyteller.js +2 -2
  37. package/dist/cli/index.js +17 -11
  38. package/dist/cli/server.js +4 -4
  39. package/dist/core/activity-logger.js +4 -4
  40. package/dist/core/agent-spawn-gate.js +1 -1
  41. package/dist/core/boot-orchestrator.js +30 -31
  42. package/dist/core/bridge.mjs +26 -26
  43. package/dist/core/codex-formatter.js +2 -3
  44. package/dist/core/codex-injector.js +7 -7
  45. package/dist/core/config-loader.js +3 -2
  46. package/dist/core/config-paths.js +38 -31
  47. package/dist/core/context-loader.js +5 -5
  48. package/dist/core/features-config.js +1 -1
  49. package/dist/core/index.js +2 -2
  50. package/dist/core/logging-config.js +7 -7
  51. package/dist/core/orchestrator.js +2 -2
  52. package/dist/core/system-prompt-generator.js +2 -2
  53. package/dist/core/xray-activation.js +42 -41
  54. package/dist/delegation/agent-delegator.js +3 -3
  55. package/dist/enforcement/enforcer-tools.js +4 -4
  56. package/dist/enforcement/loaders/codex-loader.js +2 -2
  57. package/dist/execution/opencode-cli-invoker.js +1 -1
  58. package/dist/governance/governance-service.js +1 -1
  59. package/dist/governance/llm-governance-provider.js +223 -0
  60. package/dist/index.js +6 -6
  61. package/dist/inference/deploy-verifier.js +1 -1
  62. package/dist/inference/inference-cycle.js +16 -16
  63. package/dist/integrations/base/README.md +1 -1
  64. package/dist/integrations/enforcement-gate.js +2 -2
  65. package/dist/integrations/governance/index.js +1 -1
  66. package/dist/integrations/grok/grok-cli.js +20 -6
  67. package/dist/integrations/grok/hooks/pre-tool-use.js +3 -3
  68. package/dist/integrations/grok/plugin/0xray/.mcp.json +16 -4
  69. package/dist/integrations/grok/plugin/0xray/hooks/hooks.json +2 -2
  70. package/dist/integrations/hermes-agent/__init__.py +90 -79
  71. package/dist/integrations/hermes-agent/after-install.md +14 -14
  72. package/dist/integrations/hermes-agent/bridge.mjs +60 -25
  73. package/dist/integrations/hermes-agent/plugin.yaml +5 -5
  74. package/dist/integrations/hermes-agent/schemas.py +61 -12
  75. package/dist/integrations/hermes-agent/test_plugin.py +124 -124
  76. package/dist/integrations/hermes-agent/tools.py +129 -25
  77. package/dist/integrations/openclaw/README.md +6 -6
  78. package/dist/integrations/openclaw/config.js +1 -1
  79. package/dist/integrations/openclaw/index.js +2 -2
  80. package/dist/integrations/openclaw/types.js +3 -3
  81. package/dist/integrations/plugins/plugin-integration.js +1 -1
  82. package/dist/integrations/plugins/plugin-registry.js +3 -3
  83. package/dist/mcps/architect-tools.server.js +3 -2
  84. package/dist/mcps/auto-format.server.js +2 -2
  85. package/dist/mcps/boot-orchestrator.server.js +2 -2
  86. package/dist/mcps/config/config-loader.js +40 -9
  87. package/dist/mcps/config/server-config-registry.js +10 -10
  88. package/dist/mcps/connection/mcp-connection.js +1 -1
  89. package/dist/mcps/enforcer-tools.server.js +2 -2
  90. package/dist/mcps/estimation.server.js +3 -2
  91. package/dist/mcps/framework-compliance-audit.server.js +2 -2
  92. package/dist/mcps/framework-help.server.js +9 -8
  93. package/dist/mcps/governance.server.js +8 -4
  94. package/dist/mcps/knowledge-skills/api-design.server.js +3 -2
  95. package/dist/mcps/knowledge-skills/architecture-patterns.server.js +3 -2
  96. package/dist/mcps/knowledge-skills/bug-triage-specialist.server.js +3 -3
  97. package/dist/mcps/knowledge-skills/code-analyzer.server.js +2 -2
  98. package/dist/mcps/knowledge-skills/code-review.server.js +14 -39
  99. package/dist/mcps/knowledge-skills/content-creator.server.js +3 -3
  100. package/dist/mcps/knowledge-skills/database-design.server.js +2 -2
  101. package/dist/mcps/knowledge-skills/devops-deployment.server.js +3 -2
  102. package/dist/mcps/knowledge-skills/git-workflow.server.js +3 -2
  103. package/dist/mcps/knowledge-skills/growth-strategist.server.js +3 -3
  104. package/dist/mcps/knowledge-skills/log-monitor.server.js +3 -3
  105. package/dist/mcps/knowledge-skills/mobile-development.server.js +3 -3
  106. package/dist/mcps/knowledge-skills/multimodal-looker.server.js +3 -3
  107. package/dist/mcps/knowledge-skills/performance-optimization.server.js +2 -2
  108. package/dist/mcps/knowledge-skills/project-analysis.server.js +2 -2
  109. package/dist/mcps/knowledge-skills/refactoring-strategies.server.js +3 -2
  110. package/dist/mcps/knowledge-skills/security-audit.server.js +14 -44
  111. package/dist/mcps/knowledge-skills/seo-consultant.server.js +3 -2
  112. package/dist/mcps/knowledge-skills/session-management.server.js +3 -2
  113. package/dist/mcps/knowledge-skills/skill-invocation.server.js +105 -3
  114. package/dist/mcps/knowledge-skills/strategist.server.js +3 -3
  115. package/dist/mcps/knowledge-skills/tech-writer.server.js +3 -3
  116. package/dist/mcps/knowledge-skills/testing-best-practices.server.js +3 -2
  117. package/dist/mcps/knowledge-skills/testing-strategy.server.js +2 -2
  118. package/dist/mcps/knowledge-skills/ui-ux-design.server.js +5 -4
  119. package/dist/mcps/lint.server.js +4 -4
  120. package/dist/mcps/mcp-client.js +5 -5
  121. package/dist/mcps/model-health-check.server.js +3 -2
  122. package/dist/mcps/orchestrator/server.js +4 -3
  123. package/dist/mcps/orchestrator.server.js +2 -1
  124. package/dist/mcps/performance-analysis.server.js +2 -2
  125. package/dist/mcps/processor-pipeline.server.js +3 -2
  126. package/dist/mcps/registry.json +1 -1
  127. package/dist/mcps/researcher.server.js +14 -39
  128. package/dist/mcps/security-scan.server.js +2 -2
  129. package/dist/mcps/simulation/server-simulations.js +3 -3
  130. package/dist/mcps/state-manager.server.js +5 -5
  131. package/dist/metrics/agent-metrics.js +1 -1
  132. package/dist/orchestrator/enhanced-multi-agent-orchestrator.js +4 -4
  133. package/dist/orchestrator/intelligent-commit-batcher.js +2 -3
  134. package/dist/orchestrator/multi-agent-orchestration-coordinator.js +9 -9
  135. package/dist/orchestrator/orchestrator.js +9 -8
  136. package/dist/orchestrator/universal-registry-bridge.js +4 -4
  137. package/dist/postprocessor/PostProcessor.js +9 -9
  138. package/dist/postprocessor/services/RegressionAnalysisService.js +4 -4
  139. package/dist/postprocessor/triggers/GitHookTrigger.js +18 -18
  140. package/dist/processors/implementations/agents-md-validation-processor.js +2 -2
  141. package/dist/processors/implementations/inference-improvement-processor.js +1 -2
  142. package/dist/processors/implementations/log-protection-processor.js +2 -2
  143. package/dist/processors/implementations/publish-preflight-processor.js +2 -3
  144. package/dist/processors/implementations/regression-testing-processor.js +2 -2
  145. package/dist/processors/implementations/session-summary-processor.js +2 -2
  146. package/dist/processors/implementations/storytelling-trigger-processor.js +1 -2
  147. package/dist/public/about.html +6 -6
  148. package/dist/public/enterprise.html +1 -1
  149. package/dist/public/features.html +2 -2
  150. package/dist/public/index.html +4 -4
  151. package/dist/reporting/report-formatter.js +1 -1
  152. package/dist/scripts/activate-kernel-pipeline.js +4 -4
  153. package/dist/scripts/pre-command +1 -1
  154. package/dist/services/inference-tuner.js +2 -2
  155. package/dist/skills/api-design/SKILL.md +1 -1
  156. package/dist/skills/architect-tools/SKILL.md +1 -1
  157. package/dist/skills/architecture-patterns/SKILL.md +1 -1
  158. package/dist/skills/auto-format/SKILL.md +1 -1
  159. package/dist/skills/boot-orchestrator/SKILL.md +1 -1
  160. package/dist/skills/bug-triage/SKILL.md +1 -1
  161. package/dist/skills/code-analyzer/SKILL.md +1 -1
  162. package/dist/skills/code-review/SKILL.md +1 -1
  163. package/dist/skills/enforcer/SKILL.md +1 -1
  164. package/dist/skills/framework-compliance-audit/SKILL.md +1 -1
  165. package/dist/skills/git-workflow/SKILL.md +1 -1
  166. package/dist/skills/hermes-agent/SKILL.md +42 -42
  167. package/dist/skills/inference-improve/SKILL.md +1 -1
  168. package/dist/skills/lint/SKILL.md +1 -1
  169. package/dist/skills/log-monitor/SKILL.md +1 -1
  170. package/dist/skills/model-health-check/SKILL.md +1 -1
  171. package/dist/skills/multimodal-looker/SKILL.md +1 -1
  172. package/dist/skills/orchestrator/SKILL.md +1 -1
  173. package/dist/skills/performance-analysis/SKILL.md +1 -1
  174. package/dist/skills/performance-optimization/SKILL.md +1 -1
  175. package/dist/skills/processor-pipeline/SKILL.md +1 -1
  176. package/dist/skills/project-analysis/SKILL.md +1 -1
  177. package/dist/skills/refactoring-strategies/SKILL.md +1 -1
  178. package/dist/skills/registry.json +1 -1
  179. package/dist/skills/researcher/SKILL.md +1 -1
  180. package/dist/skills/security-audit/SKILL.md +1 -1
  181. package/dist/skills/security-scan/SKILL.md +1 -1
  182. package/dist/skills/session-management/SKILL.md +1 -1
  183. package/dist/skills/state-manager/SKILL.md +1 -1
  184. package/dist/skills/storyteller/SKILL.md +1 -1
  185. package/dist/skills/testing-best-practices/SKILL.md +1 -1
  186. package/dist/skills/testing-strategy/SKILL.md +1 -1
  187. package/dist/skills/ui-ux-design/SKILL.md +1 -1
  188. package/dist/state/index.js +1 -1
  189. package/dist/state/state-manager.js +3 -4
  190. package/dist/utils/import-resolver.js +1 -1
  191. package/dist/utils/path-resolver.js +2 -2
  192. package/dist/utils/token-manager.js +1 -1
  193. package/dist/validation/estimation-validator.js +1 -1
  194. package/package.json +10 -3
  195. package/scripts/hooks/pre-command +1 -1
  196. package/scripts/hooks/run-hook.js +2 -2
  197. package/scripts/node/auto-reflection-generator.mjs +30 -36
  198. package/scripts/node/govern-reflection.mjs +1 -1
  199. package/scripts/node/postinstall.cjs +37 -2
  200. package/scripts/node/pre-publish-guard.js +13 -9
  201. package/scripts/node/setup-xai-oauth.mjs +244 -0
  202. package/scripts/node/universal-version-manager.js +8 -8
  203. package/scripts/node/version-manager.mjs +1 -1
  204. package/src/integrations/grok/plugin/0xray/.mcp.json +16 -4
  205. package/src/integrations/grok/plugin/0xray/hooks/hooks.json +2 -2
  206. package/src/mcps/architect-tools.server.ts +2 -2
  207. package/src/mcps/auto-format.server.ts +2 -2
  208. package/src/mcps/boot-orchestrator.server.ts +2 -2
  209. package/src/mcps/config/__tests__/config-loader.test.ts +29 -33
  210. package/src/mcps/config/__tests__/server-config-registry.test.ts +12 -12
  211. package/src/mcps/config/config-loader.ts +50 -11
  212. package/src/mcps/config/server-config-registry.ts +10 -10
  213. package/src/mcps/connection/mcp-connection.ts +1 -1
  214. package/src/mcps/enforcer-tools.server.ts +2 -2
  215. package/src/mcps/estimation.server.ts +3 -2
  216. package/src/mcps/framework-compliance-audit.server.ts +2 -2
  217. package/src/mcps/framework-help.server.ts +9 -8
  218. package/src/mcps/governance.server.ts +8 -3
  219. package/src/mcps/knowledge-skills/api-design.server.ts +3 -2
  220. package/src/mcps/knowledge-skills/architecture-patterns.server.ts +2 -2
  221. package/src/mcps/knowledge-skills/bug-triage-specialist.server.ts +2 -2
  222. package/src/mcps/knowledge-skills/code-analyzer.server.ts +2 -2
  223. package/src/mcps/knowledge-skills/code-review.server.ts +21 -36
  224. package/src/mcps/knowledge-skills/content-creator.server.ts +3 -3
  225. package/src/mcps/knowledge-skills/database-design.server.ts +2 -2
  226. package/src/mcps/knowledge-skills/devops-deployment.server.ts +3 -2
  227. package/src/mcps/knowledge-skills/git-workflow.server.ts +3 -2
  228. package/src/mcps/knowledge-skills/growth-strategist.server.ts +3 -3
  229. package/src/mcps/knowledge-skills/log-monitor.server.ts +3 -3
  230. package/src/mcps/knowledge-skills/mobile-development.server.ts +3 -3
  231. package/src/mcps/knowledge-skills/multimodal-looker.server.ts +3 -3
  232. package/src/mcps/knowledge-skills/performance-optimization.server.ts +2 -2
  233. package/src/mcps/knowledge-skills/project-analysis.server.ts +2 -2
  234. package/src/mcps/knowledge-skills/refactoring-strategies.server.ts +3 -2
  235. package/src/mcps/knowledge-skills/security-audit.server.ts +21 -40
  236. package/src/mcps/knowledge-skills/seo-consultant.server.ts +3 -2
  237. package/src/mcps/knowledge-skills/session-management.server.ts +3 -2
  238. package/src/mcps/knowledge-skills/skill-invocation.server.ts +113 -3
  239. package/src/mcps/knowledge-skills/strategist.server.ts +3 -3
  240. package/src/mcps/knowledge-skills/tech-writer.server.ts +3 -3
  241. package/src/mcps/knowledge-skills/testing-best-practices.server.ts +3 -2
  242. package/src/mcps/knowledge-skills/testing-strategy.server.ts +2 -2
  243. package/src/mcps/knowledge-skills/ui-ux-design.server.ts +5 -4
  244. package/src/mcps/lint.server.ts +4 -4
  245. package/src/mcps/mcp-client.ts +5 -5
  246. package/src/mcps/model-health-check.server.ts +2 -2
  247. package/src/mcps/orchestrator/server.ts +4 -3
  248. package/src/mcps/orchestrator.server.ts +2 -1
  249. package/src/mcps/performance-analysis.server.ts +2 -2
  250. package/src/mcps/processor-pipeline.server.ts +3 -2
  251. package/src/mcps/registry.json +1 -1
  252. package/src/mcps/researcher.server.ts +21 -36
  253. package/src/mcps/security-scan.server.ts +2 -2
  254. package/src/mcps/simulation/server-simulations.ts +3 -3
  255. package/src/mcps/state-manager.server.ts +5 -5
  256. package/src/opencode/codex.codex +1 -1
  257. package/src/opencode/commands/dependency-audit.md +3 -3
  258. package/src/opencode/commands/summary-logger.md +4 -4
  259. package/src/opencode/enforcer-config.json +2 -2
  260. package/src/skills/api-design/SKILL.md +1 -1
  261. package/src/skills/architect-tools/SKILL.md +1 -1
  262. package/src/skills/architecture-patterns/SKILL.md +1 -1
  263. package/src/skills/auto-format/SKILL.md +1 -1
  264. package/src/skills/boot-orchestrator/SKILL.md +1 -1
  265. package/src/skills/bug-triage/SKILL.md +1 -1
  266. package/src/skills/code-analyzer/SKILL.md +1 -1
  267. package/src/skills/code-review/SKILL.md +1 -1
  268. package/src/skills/enforcer/SKILL.md +1 -1
  269. package/src/skills/framework-compliance-audit/SKILL.md +1 -1
  270. package/src/skills/git-workflow/SKILL.md +1 -1
  271. package/src/skills/hermes-agent/SKILL.md +42 -42
  272. package/src/skills/inference-improve/SKILL.md +1 -1
  273. package/src/skills/lint/SKILL.md +1 -1
  274. package/src/skills/log-monitor/SKILL.md +1 -1
  275. package/src/skills/model-health-check/SKILL.md +1 -1
  276. package/src/skills/multimodal-looker/SKILL.md +1 -1
  277. package/src/skills/orchestrator/SKILL.md +1 -1
  278. package/src/skills/performance-analysis/SKILL.md +1 -1
  279. package/src/skills/performance-optimization/SKILL.md +1 -1
  280. package/src/skills/processor-pipeline/SKILL.md +1 -1
  281. package/src/skills/project-analysis/SKILL.md +1 -1
  282. package/src/skills/refactoring-strategies/SKILL.md +1 -1
  283. package/src/skills/registry.json +1 -1
  284. package/src/skills/researcher/SKILL.md +1 -1
  285. package/src/skills/security-audit/SKILL.md +1 -1
  286. package/src/skills/security-scan/SKILL.md +1 -1
  287. package/src/skills/session-management/SKILL.md +1 -1
  288. package/src/skills/state-manager/SKILL.md +1 -1
  289. package/src/skills/storyteller/SKILL.md +1 -1
  290. package/src/skills/testing-best-practices/SKILL.md +1 -1
  291. package/src/skills/testing-strategy/SKILL.md +1 -1
  292. package/src/skills/ui-ux-design/SKILL.md +1 -1
  293. package/xray/agents_template.md +46 -0
  294. package/xray/codex.json +598 -0
  295. package/dist/plugin/xray-codex-injection.js +0 -857
  296. /package/dist/integrations/openclaw/hooks/{strray-hooks.js → xray-hooks.js} +0 -0
@@ -1,13 +1,14 @@
1
1
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
2
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3
3
  import { CallToolRequestSchema, ErrorCode, ListToolsRequestSchema, McpError, } from "@modelcontextprotocol/sdk/types.js";
4
+ import * as fs from "fs";
4
5
  import { frameworkLogger } from "../core/framework-logger.js";
5
6
  import { AGENT_REGISTRY } from "../agents/registry.js";
6
7
  class FrameworkHelpServer {
7
8
  server;
8
9
  constructor() {
9
10
  this.server = new Server({
10
- name: "xray/framework-help", version: "1.22.67",
11
+ name: "xray/framework-help", version: "3.1.0",
11
12
  }, {
12
13
  capabilities: {
13
14
  tools: {},
@@ -21,7 +22,7 @@ class FrameworkHelpServer {
21
22
  return {
22
23
  tools: [
23
24
  {
24
- name: "strray_get_capabilities",
25
+ name: "xray_get_capabilities",
25
26
  description: "Get comprehensive list of all 0xRay framework capabilities, commands, and available tools",
26
27
  inputSchema: {
27
28
  type: "object",
@@ -43,7 +44,7 @@ class FrameworkHelpServer {
43
44
  },
44
45
  },
45
46
  {
46
- name: "strray_get_commands",
47
+ name: "xray_get_commands",
47
48
  description: "Get list of available 0xRay commands and their usage",
48
49
  inputSchema: {
49
50
  type: "object",
@@ -63,7 +64,7 @@ class FrameworkHelpServer {
63
64
  },
64
65
  },
65
66
  {
66
- name: "strray_explain_capability",
67
+ name: "xray_explain_capability",
67
68
  description: "Get detailed explanation of a specific 0xRay capability",
68
69
  inputSchema: {
69
70
  type: "object",
@@ -84,11 +85,11 @@ class FrameworkHelpServer {
84
85
  const { name, arguments: args } = request.params;
85
86
  try {
86
87
  switch (name) {
87
- case "strray_get_capabilities":
88
+ case "xray_get_capabilities":
88
89
  return this.handleGetCapabilities(args);
89
- case "strray_get_commands":
90
+ case "xray_get_commands":
90
91
  return this.handleGetCommands(args);
91
- case "strray_explain_capability":
92
+ case "xray_explain_capability":
92
93
  return this.handleExplainCapability(args);
93
94
  default:
94
95
  throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
@@ -393,7 +394,7 @@ ${items.map(([name, desc]) => `- **${name}**: ${desc}`).join("\n")}
393
394
  }
394
395
  }
395
396
  // Auto-start if this file is run directly - conditional server initialization for development/testing
396
- if (import.meta.url === `file://${process.argv[1]}`) {
397
+ if (import.meta.url === `file://${fs.realpathSync(process.argv[1])}`) {
397
398
  const server = new FrameworkHelpServer();
398
399
  server.start().catch((error) => frameworkLogger.log("mcps/framework-help", "run", "error", { error: String(error) }));
399
400
  }
@@ -18,7 +18,6 @@ import { createMcpExpressApp } from "@modelcontextprotocol/sdk/server/express.js
18
18
  import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
19
19
  import { frameworkLogger } from "../core/framework-logger.js";
20
20
  import * as fs from "fs";
21
- import * as path from "path";
22
21
  import { fileURLToPath } from "url";
23
22
  import { randomUUID } from "crypto";
24
23
  import { getGovernanceService } from "../governance/governance-service.js";
@@ -29,7 +28,7 @@ class GovernanceServer {
29
28
  server;
30
29
  constructor() {
31
30
  this.server = new Server({
32
- name: "governance", version: "1.22.67",
31
+ name: "governance", version: "3.1.0",
33
32
  }, {
34
33
  capabilities: {
35
34
  tools: {},
@@ -395,7 +394,12 @@ class GovernanceServer {
395
394
  */
396
395
  async runHttp(port = parseInt(process.env.MCP_PORT ?? "3100", 10)) {
397
396
  await this.initializeGovernance();
398
- const app = createMcpExpressApp();
397
+ const mcpHost = process.env.MCP_HOST || "127.0.0.1";
398
+ const allowedHosts = process.env.MCP_ALLOWED_HOSTS?.split(",");
399
+ const app = createMcpExpressApp({
400
+ host: mcpHost,
401
+ ...(allowedHosts ? { allowedHosts } : {}),
402
+ });
399
403
  const transport = new StreamableHTTPServerTransport({
400
404
  sessionIdGenerator: () => randomUUID(),
401
405
  });
@@ -441,7 +445,7 @@ class GovernanceServer {
441
445
  }
442
446
  }
443
447
  // Start the server if this file is run directly
444
- const entryPoint = path.resolve(process.argv[1] ?? "");
448
+ const entryPoint = fs.realpathSync(process.argv[1] ?? "");
445
449
  if (entryPoint && fileURLToPath(import.meta.url) === entryPoint) {
446
450
  // If --port or MCP_PORT is set, use HTTP transport (for Grok CLI compatibility)
447
451
  const cliPort = process.argv.find((a) => a.startsWith("--port="))?.split("=")[1];
@@ -7,12 +7,13 @@
7
7
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
8
8
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
9
9
  import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
10
+ import * as fs from "fs";
10
11
  import { createGracefulShutdown } from "../../utils/shutdown-handler.js";
11
12
  class XrayApiDesignServer {
12
13
  server;
13
14
  constructor() {
14
15
  this.server = new Server({
15
- name: "api-design", version: "1.22.67",
16
+ name: "api-design", version: "3.1.0",
16
17
  }, {
17
18
  capabilities: {
18
19
  tools: {},
@@ -116,7 +117,7 @@ class XrayApiDesignServer {
116
117
  });
117
118
  }
118
119
  }
119
- if (import.meta.url === `file://${process.argv[1]}`) {
120
+ if (import.meta.url === `file://${fs.realpathSync(process.argv[1])}`) {
120
121
  const server = new XrayApiDesignServer();
121
122
  server.run().catch(() => { });
122
123
  }
@@ -7,12 +7,13 @@
7
7
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
8
8
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
9
9
  import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
10
+ import * as fs from "fs";
10
11
  import { createGracefulShutdown } from "../../utils/shutdown-handler.js";
11
12
  class XrayArchitecturePatternsServer {
12
13
  server;
13
14
  constructor() {
14
15
  this.server = new Server({
15
- name: "architecture-patterns", version: "1.22.67",
16
+ name: "architecture-patterns", version: "3.1.0",
16
17
  }, {
17
18
  capabilities: {
18
19
  tools: {},
@@ -106,7 +107,7 @@ class XrayArchitecturePatternsServer {
106
107
  });
107
108
  }
108
109
  }
109
- if (import.meta.url === `file://${process.argv[1]}`) {
110
+ if (import.meta.url === `file://${fs.realpathSync(process.argv[1])}`) {
110
111
  const server = new XrayArchitecturePatternsServer();
111
112
  server.run().catch(() => { });
112
113
  }
@@ -8,12 +8,12 @@
8
8
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
9
9
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
10
10
  import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
11
- import * as path from "path";
11
+ import * as fs from "fs";
12
12
  import { fileURLToPath } from "url";
13
13
  class BugTriageSpecialistServer {
14
14
  server;
15
15
  constructor() {
16
- this.server = new Server({ name: "bug-triage-specialist", version: "1.22.67" }, { capabilities: { tools: {} } });
16
+ this.server = new Server({ name: "bug-triage-specialist", version: "3.1.0" }, { capabilities: { tools: {} } });
17
17
  this.setupToolHandlers();
18
18
  }
19
19
  setupToolHandlers() {
@@ -466,7 +466,7 @@ class BugTriageSpecialistServer {
466
466
  await this.server.connect(transport);
467
467
  }
468
468
  }
469
- const entryPoint = path.resolve(process.argv[1] ?? "");
469
+ const entryPoint = fs.realpathSync(process.argv[1] ?? "");
470
470
  if (entryPoint && fileURLToPath(import.meta.url) === entryPoint) {
471
471
  const server = new BugTriageSpecialistServer();
472
472
  server.run();
@@ -242,7 +242,7 @@ class CodeAnalyzerServer {
242
242
  },
243
243
  ];
244
244
  constructor() {
245
- this.server = new Server({ name: "code-analyzer", version: "1.22.67" }, { capabilities: { tools: {} } });
245
+ this.server = new Server({ name: "code-analyzer", version: "3.1.0" }, { capabilities: { tools: {} } });
246
246
  this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
247
247
  tools: this.tools,
248
248
  }));
@@ -599,7 +599,7 @@ class CodeAnalyzerServer {
599
599
  });
600
600
  }
601
601
  }
602
- if (import.meta.url === `file://${process.argv[1]}`) {
602
+ if (import.meta.url === `file://${fs.realpathSync(process.argv[1])}`) {
603
603
  new CodeAnalyzerServer().run().catch(() => { });
604
604
  }
605
605
  export default CodeAnalyzerServer;
@@ -10,11 +10,12 @@ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextpro
10
10
  import * as fs from "fs";
11
11
  import * as path from "path";
12
12
  import { createGracefulShutdown } from "../../utils/shutdown-handler.js";
13
+ import { tryLLMGovernance } from "../../governance/llm-governance-provider.js";
13
14
  class XrayCodeReviewServer {
14
15
  server;
15
16
  constructor() {
16
17
  this.server = new Server({
17
- name: "code-review", version: "1.22.67",
18
+ name: "code-review", version: "3.1.0",
18
19
  }, {
19
20
  capabilities: {
20
21
  tools: {},
@@ -339,48 +340,22 @@ class XrayCodeReviewServer {
339
340
  */
340
341
  async analyzeProposal(args) {
341
342
  const { proposalTitle = "", proposalDescription = "", evidence = [], proposalType = "" } = args;
342
- const text = `${proposalTitle} ${proposalDescription} ${evidence.join(" ")}`.toLowerCase();
343
- let decision = "approve";
344
- let confidence = 0.82;
345
- let reasoning = "The proposal appears reasonable from a code quality and maintainability perspective.";
346
- if (text.includes("aml") || text.includes("kyc") || text.includes("anti-money")) {
347
- decision = "approve";
348
- confidence = 0.88;
349
- reasoning = "AML/KYC compliance code requires rigorous review: transaction monitoring must handle edge cases, avoid false positives from legitimate patterns, and maintain audit trails for regulatory inspection.";
350
- }
351
- else if (text.includes("psd2") || text.includes("strong customer authentication") || text.includes("payment initiation")) {
352
- decision = "approve";
353
- confidence = 0.90;
354
- reasoning = "PSD2 SCA implementation must balance security with user experience. Code should use well-audited MFA libraries, avoid rolling custom authentication, and include comprehensive test coverage for all authentication flows.";
355
- }
356
- else if (text.includes("gdpr") || text.includes("right to erasure") || text.includes("data protection")) {
357
- decision = "approve";
358
- confidence = 0.92;
359
- reasoning = "GDPR erasure pipelines require careful code review: cascading deletes must be transactional, audit logs must be preserved, and the 30-day SLA demands observability and monitoring integration.";
360
- }
361
- else if (text.includes("extract method")) {
362
- decision = "approve";
363
- confidence = 0.93;
364
- reasoning = "Extract Method is a well-established refactoring pattern that improves readability and reduces cognitive load when applied consistently.";
365
- }
366
- else if (text.includes("test coverage")) {
367
- decision = "approve";
368
- confidence = 0.90;
369
- reasoning = "Expanding automated test coverage generally improves long-term code health and reduces regression risk.";
370
- }
371
- else if (text.includes("increase timeout") && text.includes("flaky")) {
372
- decision = "reject";
373
- confidence = 0.72;
374
- reasoning = "Repeatedly increasing timeouts to mask flaky tests is an anti-pattern that hides underlying race conditions or timing issues.";
375
- }
376
- if (proposalType === "fix" && text.includes("timeout")) {
377
- confidence = Math.max(0.68, confidence - 0.08);
343
+ const vote = await tryLLMGovernance("code-review", proposalTitle, proposalDescription, evidence, proposalType);
344
+ if (!vote) {
345
+ return {
346
+ content: [
347
+ {
348
+ type: "text",
349
+ text: "DECISION: abstain\nCONFIDENCE: 0.50\nREASONING: No LLM governance provider configured. Set XRAY_GOVERNANCE_LLM_ENABLED=true + XRAY_LLM_ENDPOINT, or install Hermes and run: hermes auth add xai-oauth --no-browser",
350
+ },
351
+ ],
352
+ };
378
353
  }
379
354
  return {
380
355
  content: [
381
356
  {
382
357
  type: "text",
383
- text: `DECISION: ${decision}\nCONFIDENCE: ${confidence.toFixed(2)}\nREASONING: ${reasoning}`,
358
+ text: `DECISION: ${vote.decision}\nCONFIDENCE: ${vote.confidence.toFixed(2)}\nREASONING: ${vote.reasoning}`,
384
359
  },
385
360
  ],
386
361
  };
@@ -840,7 +815,7 @@ class XrayCodeReviewServer {
840
815
  }
841
816
  }
842
817
  // Run the server if this file is executed directly
843
- if (import.meta.url === `file://${process.argv[1]}`) {
818
+ if (import.meta.url === `file://${fs.realpathSync(process.argv[1])}`) {
844
819
  const server = new XrayCodeReviewServer();
845
820
  server.run().catch(() => { });
846
821
  }
@@ -7,7 +7,7 @@
7
7
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
8
8
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
9
9
  import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
10
- import * as path from "path";
10
+ import * as fs from "fs";
11
11
  import { fileURLToPath } from "url";
12
12
  class SEOCopywriterServer {
13
13
  server;
@@ -86,7 +86,7 @@ class SEOCopywriterServer {
86
86
  },
87
87
  ];
88
88
  constructor() {
89
- this.server = new Server({ name: "content-creator", version: "1.22.67" }, { capabilities: { tools: {} } });
89
+ this.server = new Server({ name: "content-creator", version: "3.1.0" }, { capabilities: { tools: {} } });
90
90
  this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
91
91
  tools: this.tools,
92
92
  }));
@@ -248,7 +248,7 @@ class SEOCopywriterServer {
248
248
  await this.server.connect(transport);
249
249
  }
250
250
  }
251
- const entryPoint = path.resolve(process.argv[1] ?? "");
251
+ const entryPoint = fs.realpathSync(process.argv[1] ?? "");
252
252
  if (entryPoint && fileURLToPath(import.meta.url) === entryPoint) {
253
253
  const server = new SEOCopywriterServer();
254
254
  server.run();
@@ -14,7 +14,7 @@ class XrayDatabaseDesignServer {
14
14
  server;
15
15
  constructor() {
16
16
  this.server = new Server({
17
- name: "database-design", version: "1.22.67",
17
+ name: "database-design", version: "3.1.0",
18
18
  }, {
19
19
  capabilities: {
20
20
  tools: {},
@@ -815,7 +815,7 @@ class XrayDatabaseDesignServer {
815
815
  }
816
816
  }
817
817
  // Run the server if this file is executed directly
818
- if (import.meta.url === `file://${process.argv[1]}`) {
818
+ if (import.meta.url === `file://${fs.realpathSync(process.argv[1])}`) {
819
819
  const server = new XrayDatabaseDesignServer();
820
820
  server.run().catch(() => { });
821
821
  }
@@ -6,13 +6,14 @@
6
6
  */
7
7
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
8
8
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
9
+ import * as fs from "fs";
9
10
  import { createGracefulShutdown } from "../../utils/shutdown-handler.js";
10
11
  import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
11
12
  class XrayDevOpsDeploymentServer {
12
13
  server;
13
14
  constructor() {
14
15
  this.server = new Server({
15
- name: "devops-deployment", version: "1.22.67",
16
+ name: "devops-deployment", version: "3.1.0",
16
17
  }, {
17
18
  capabilities: {
18
19
  tools: {},
@@ -1173,7 +1174,7 @@ spec:
1173
1174
  }
1174
1175
  }
1175
1176
  // Run the server if this file is executed directly
1176
- if (import.meta.url === `file://${process.argv[1]}`) {
1177
+ if (import.meta.url === `file://${fs.realpathSync(process.argv[1])}`) {
1177
1178
  const server = new XrayDevOpsDeploymentServer();
1178
1179
  server.run().catch(() => { });
1179
1180
  }
@@ -7,12 +7,13 @@
7
7
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
8
8
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
9
9
  import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
10
+ import * as fs from "fs";
10
11
  import { createGracefulShutdown } from "../../utils/shutdown-handler.js";
11
12
  class XrayGitWorkflowServer {
12
13
  server;
13
14
  constructor() {
14
15
  this.server = new Server({
15
- name: "git-workflow", version: "1.22.67",
16
+ name: "git-workflow", version: "3.1.0",
16
17
  }, {
17
18
  capabilities: {
18
19
  tools: {},
@@ -108,7 +109,7 @@ class XrayGitWorkflowServer {
108
109
  });
109
110
  }
110
111
  }
111
- if (import.meta.url === `file://${process.argv[1]}`) {
112
+ if (import.meta.url === `file://${fs.realpathSync(process.argv[1])}`) {
112
113
  const server = new XrayGitWorkflowServer();
113
114
  server.run().catch(() => { });
114
115
  }
@@ -7,7 +7,7 @@
7
7
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
8
8
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
9
9
  import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
10
- import * as path from "path";
10
+ import * as fs from "fs";
11
11
  import { fileURLToPath } from "url";
12
12
  class MarketingExpertServer {
13
13
  server;
@@ -93,7 +93,7 @@ class MarketingExpertServer {
93
93
  },
94
94
  ];
95
95
  constructor() {
96
- this.server = new Server({ name: "growth-strategist", version: "1.22.67" }, { capabilities: { tools: {} } });
96
+ this.server = new Server({ name: "growth-strategist", version: "3.1.0" }, { capabilities: { tools: {} } });
97
97
  this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
98
98
  tools: this.tools,
99
99
  }));
@@ -353,7 +353,7 @@ class MarketingExpertServer {
353
353
  await this.server.connect(transport);
354
354
  }
355
355
  }
356
- const entryPoint = path.resolve(process.argv[1] ?? "");
356
+ const entryPoint = fs.realpathSync(process.argv[1] ?? "");
357
357
  if (entryPoint && fileURLToPath(import.meta.url) === entryPoint) {
358
358
  const server = new MarketingExpertServer();
359
359
  server.run();
@@ -8,7 +8,7 @@
8
8
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
9
9
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
10
10
  import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
11
- import * as path from "path";
11
+ import * as fs from "fs";
12
12
  import { fileURLToPath } from "url";
13
13
  class LogMonitorServer {
14
14
  server;
@@ -60,7 +60,7 @@ class LogMonitorServer {
60
60
  },
61
61
  ];
62
62
  constructor() {
63
- this.server = new Server({ name: "log-monitor", version: "1.22.67" }, { capabilities: { tools: {} } });
63
+ this.server = new Server({ name: "log-monitor", version: "3.1.0" }, { capabilities: { tools: {} } });
64
64
  this.setupToolHandlers();
65
65
  }
66
66
  setupToolHandlers() {
@@ -443,7 +443,7 @@ ${analysis.recommendations.map((r) => `- ${r}`).join("\n")}
443
443
  await this.server.connect(transport);
444
444
  }
445
445
  }
446
- const entryPoint = path.resolve(process.argv[1] ?? "");
446
+ const entryPoint = fs.realpathSync(process.argv[1] ?? "");
447
447
  if (entryPoint && fileURLToPath(import.meta.url) === entryPoint) {
448
448
  const server = new LogMonitorServer();
449
449
  server.run();
@@ -7,13 +7,13 @@
7
7
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
8
8
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
9
9
  import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
10
- import * as path from "path";
10
+ import * as fs from "fs";
11
11
  import { fileURLToPath } from "url";
12
12
  class XrayMobileDevelopmentServer {
13
13
  server;
14
14
  constructor() {
15
15
  this.server = new Server({
16
- name: "mobile-development", version: "1.22.67",
16
+ name: "mobile-development", version: "3.1.0",
17
17
  }, {
18
18
  capabilities: {
19
19
  tools: {},
@@ -517,7 +517,7 @@ class HomePage extends StatelessWidget {
517
517
  await this.server.connect(transport);
518
518
  }
519
519
  }
520
- const entryPoint = path.resolve(process.argv[1] ?? "");
520
+ const entryPoint = fs.realpathSync(process.argv[1] ?? "");
521
521
  if (entryPoint && fileURLToPath(import.meta.url) === entryPoint) {
522
522
  const server = new XrayMobileDevelopmentServer();
523
523
  server.start().catch(() => { });
@@ -10,7 +10,7 @@
10
10
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
11
11
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
12
12
  import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
13
- import * as path from "path";
13
+ import * as fs from "fs";
14
14
  import { fileURLToPath } from "url";
15
15
  import { frameworkLogger } from "../../core/framework-logger.js";
16
16
  /* ============================================================================
@@ -19,7 +19,7 @@ import { frameworkLogger } from "../../core/framework-logger.js";
19
19
  class MultimodalLookerServer {
20
20
  server;
21
21
  constructor() {
22
- this.server = new Server({ name: "multimodal-looker", version: "1.22.67" }, { capabilities: { tools: {} } });
22
+ this.server = new Server({ name: "multimodal-looker", version: "3.1.0" }, { capabilities: { tools: {} } });
23
23
  this.setupToolHandlers();
24
24
  }
25
25
  /* --------------------------------------------------------------------------
@@ -1056,7 +1056,7 @@ class MultimodalLookerServer {
1056
1056
  await this.server.connect(transport);
1057
1057
  }
1058
1058
  }
1059
- const entryPoint = path.resolve(process.argv[1] ?? "");
1059
+ const entryPoint = fs.realpathSync(process.argv[1] ?? "");
1060
1060
  if (entryPoint && fileURLToPath(import.meta.url) === entryPoint) {
1061
1061
  const server = new MultimodalLookerServer();
1062
1062
  server.run().catch((err) => frameworkLogger.log('multimodal-looker', 'run-error', 'error', { error: String(err) }));
@@ -16,7 +16,7 @@ class XrayPerformanceOptimizationServer {
16
16
  startTime;
17
17
  constructor() {
18
18
  this.server = new Server({
19
- name: "performance-optimization", version: "1.22.67",
19
+ name: "performance-optimization", version: "3.1.0",
20
20
  }, {
21
21
  capabilities: {
22
22
  tools: {},
@@ -1578,7 +1578,7 @@ ${result.recommendations.slice(0, 5).map((r, i) => `${i + 1}. ${r}`).join("\n")
1578
1578
  });
1579
1579
  }
1580
1580
  }
1581
- if (import.meta.url === `file://${process.argv[1]}`) {
1581
+ if (import.meta.url === `file://${fs.realpathSync(process.argv[1])}`) {
1582
1582
  const server = new XrayPerformanceOptimizationServer();
1583
1583
  server.run().catch((error) => {
1584
1584
  frameworkLogger.log("mcp/performance-optimization", "run", "error", { error: String(error) });
@@ -14,7 +14,7 @@ class ProjectAnalysisServer {
14
14
  server;
15
15
  constructor() {
16
16
  this.server = new Server({
17
- name: "project-analysis", version: "1.22.67",
17
+ name: "project-analysis", version: "3.1.0",
18
18
  }, {
19
19
  capabilities: {
20
20
  tools: {},
@@ -804,7 +804,7 @@ class ProjectAnalysisServer {
804
804
  }
805
805
  }
806
806
  // Start the server if run directly
807
- if (import.meta.url === `file://${process.argv[1]}`) {
807
+ if (import.meta.url === `file://${fs.realpathSync(process.argv[1])}`) {
808
808
  const server = new ProjectAnalysisServer();
809
809
  server.run().catch((error) => frameworkLogger.log("mcps/project-analysis", "run", "error", { error: String(error) }));
810
810
  }
@@ -6,13 +6,14 @@
6
6
  */
7
7
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
8
8
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
9
+ import * as fs from "fs";
9
10
  import { createGracefulShutdown } from "../../utils/shutdown-handler.js";
10
11
  import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
11
12
  class XrayRefactoringStrategiesServer {
12
13
  server;
13
14
  constructor() {
14
15
  this.server = new Server({
15
- name: "refactoring-strategies", version: "1.22.67",
16
+ name: "refactoring-strategies", version: "3.1.0",
16
17
  }, {
17
18
  capabilities: {
18
19
  tools: {},
@@ -789,7 +790,7 @@ class XrayRefactoringStrategiesServer {
789
790
  }
790
791
  }
791
792
  // Run the server if this file is executed directly
792
- if (import.meta.url === `file://${process.argv[1]}`) {
793
+ if (import.meta.url === `file://${fs.realpathSync(process.argv[1])}`) {
793
794
  const server = new XrayRefactoringStrategiesServer();
794
795
  server.run().catch(() => { });
795
796
  }
@@ -10,11 +10,12 @@ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextpro
10
10
  import * as fs from "fs";
11
11
  import * as path from "path";
12
12
  import { createGracefulShutdown } from "../../utils/shutdown-handler.js";
13
+ import { tryLLMGovernance } from "../../governance/llm-governance-provider.js";
13
14
  class XraySecurityAuditServer {
14
15
  server;
15
16
  constructor() {
16
17
  this.server = new Server({
17
- name: "security-audit", version: "1.22.67",
18
+ name: "security-audit", version: "3.1.0",
18
19
  }, {
19
20
  capabilities: {
20
21
  tools: {},
@@ -777,53 +778,22 @@ class XraySecurityAuditServer {
777
778
  */
778
779
  async analyzeProposal(args) {
779
780
  const { proposalTitle = "", proposalDescription = "", evidence = [], proposalType = "" } = args;
780
- const text = `${proposalTitle} ${proposalDescription} ${evidence.join(" ")}`.toLowerCase();
781
- let decision = "approve";
782
- let confidence = 0.82;
783
- let reasoning = "The proposal does not appear to introduce significant new security surface area.";
784
- if (text.includes("aml") || text.includes("kyc") || text.includes("anti-money")) {
785
- decision = "approve";
786
- confidence = 0.91;
787
- reasoning = "AML/KYC compliance measures are critical for regulatory security posture. Automated transaction monitoring closes vulnerability gaps in financial crime detection and demonstrates due diligence for regulatory inspections.";
788
- }
789
- else if (text.includes("psd2") || text.includes("strong customer authentication") || text.includes("payment initiation")) {
790
- decision = "approve";
791
- confidence = 0.93;
792
- reasoning = "PSD2 SCA implementation is a mandatory security control for payment services. Multi-factor authentication with dynamic linking reduces unauthorized payment risk and satisfies EBA regulatory technical standards.";
793
- }
794
- else if (text.includes("gdpr") || text.includes("right to erasure") || text.includes("data protection")) {
795
- decision = "approve";
796
- confidence = 0.94;
797
- reasoning = "GDPR compliance controls are foundational to data security posture. Automated data erasure pipelines reduce data breach exposure windows and satisfy supervisory authority inspection requirements.";
798
- }
799
- else if (text.includes("beneficial ownership") || text.includes("ubo") || text.includes("pep screening")) {
800
- decision = "approve";
801
- confidence = 0.87;
802
- reasoning = "Beneficial ownership transparency and PEP screening are critical AML controls. Verifying ultimate beneficial owners reduces money laundering risk through corporate account structuring.";
803
- }
804
- else if (text.includes("extract method")) {
805
- decision = "approve";
806
- confidence = 0.88;
807
- reasoning = "Extract Method refactoring improves security posture by reducing attack surface in large monolithic files and enabling better isolation of sensitive logic.";
808
- }
809
- else if (text.includes("test coverage")) {
810
- decision = "approve";
811
- confidence = 0.91;
812
- reasoning = "Expanding test coverage is one of the highest-ROI security controls available — more tests surface regressions and boundary condition vulnerabilities earlier.";
813
- }
814
- else if (text.includes("increase timeout") && text.includes("flaky")) {
815
- decision = "reject";
816
- confidence = 0.75;
817
- reasoning = "Repeatedly increasing timeouts to hide flaky tests can mask timing attacks, race conditions, and resource exhaustion vulnerabilities. Root cause remediation is required.";
818
- }
819
- if (proposalType === "fix" && text.includes("timeout")) {
820
- confidence = Math.max(0.65, confidence - 0.10);
781
+ const vote = await tryLLMGovernance("security-audit", proposalTitle, proposalDescription, evidence, proposalType);
782
+ if (!vote) {
783
+ return {
784
+ content: [
785
+ {
786
+ type: "text",
787
+ text: "DECISION: abstain\nCONFIDENCE: 0.50\nREASONING: No LLM governance provider configured. Set XRAY_GOVERNANCE_LLM_ENABLED=true + XRAY_LLM_ENDPOINT, or install Hermes and run: hermes auth add xai-oauth --no-browser",
788
+ },
789
+ ],
790
+ };
821
791
  }
822
792
  return {
823
793
  content: [
824
794
  {
825
795
  type: "text",
826
- text: `DECISION: ${decision}\nCONFIDENCE: ${confidence.toFixed(2)}\nREASONING: ${reasoning}`,
796
+ text: `DECISION: ${vote.decision}\nCONFIDENCE: ${vote.confidence.toFixed(2)}\nREASONING: ${vote.reasoning}`,
827
797
  },
828
798
  ],
829
799
  };
@@ -839,7 +809,7 @@ class XraySecurityAuditServer {
839
809
  }
840
810
  }
841
811
  // Run the server if this file is executed directly
842
- if (import.meta.url === `file://${process.argv[1]}`) {
812
+ if (import.meta.url === `file://${fs.realpathSync(process.argv[1])}`) {
843
813
  const server = new XraySecurityAuditServer();
844
814
  server.run().catch(() => { });
845
815
  }