0xray 2.1.2 → 2.1.3

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 (250) hide show
  1. package/.opencode/codex.codex +1 -1
  2. package/.opencode/commands/dependency-audit.md +3 -3
  3. package/.opencode/enforcer-config.json +2 -2
  4. package/AGENTS.md +2 -1
  5. package/README.md +12 -11
  6. package/dist/AGENTS.md +2 -1
  7. package/dist/CHANGELOG.md +26 -0
  8. package/dist/README.md +12 -11
  9. package/dist/agents/code-reviewer.js +1 -1
  10. package/dist/analytics/routing-refiner.js +1 -1
  11. package/dist/cli/index.js +11 -1
  12. package/dist/cli/server.js +3 -3
  13. package/dist/core/activity-logger.d.ts +2 -2
  14. package/dist/core/activity-logger.js +4 -4
  15. package/dist/core/boot-orchestrator.d.ts +1 -1
  16. package/dist/core/boot-orchestrator.js +13 -28
  17. package/dist/core/bridge.mjs +3 -3
  18. package/dist/core/codex-formatter.js +2 -2
  19. package/dist/core/codex-injector.d.ts +0 -1
  20. package/dist/core/codex-injector.js +2 -3
  21. package/dist/core/config-loader.d.ts +1 -1
  22. package/dist/core/config-loader.js +1 -1
  23. package/dist/core/config-paths.d.ts +0 -2
  24. package/dist/core/config-paths.js +7 -8
  25. package/dist/core/context-loader.d.ts +1 -1
  26. package/dist/core/context-loader.js +1 -1
  27. package/dist/core/errors.d.ts +3 -0
  28. package/dist/core/errors.js +10 -0
  29. package/dist/core/features-config.js +1 -1
  30. package/dist/core/framework-logger.d.ts +3 -3
  31. package/dist/core/framework-logger.js +17 -9
  32. package/dist/core/index.d.ts +2 -2
  33. package/dist/core/index.js +4 -2
  34. package/dist/core/logging-config.d.ts +2 -1
  35. package/dist/core/logging-config.js +7 -7
  36. package/dist/enforcement/loaders/codex-loader.js +1 -1
  37. package/dist/execution/opencode-cli-invoker.js +5 -5
  38. package/dist/governance/governance-service.js +1 -1
  39. package/dist/index.d.ts +3 -3
  40. package/dist/index.js +3 -3
  41. package/dist/inference/inference-cycle.d.ts +1 -1
  42. package/dist/inference/inference-cycle.js +10 -10
  43. package/dist/integrations/base/Integration.js +1 -1
  44. package/dist/integrations/base/registry.js +19 -19
  45. package/dist/integrations/grok/grok-cli.js +17 -17
  46. package/dist/integrations/grok/hooks/pre-tool-use.js +1 -1
  47. package/dist/integrations/hermes-agent/bridge.mjs +1 -1
  48. package/dist/integrations/openclaw/api-server.d.ts +0 -1
  49. package/dist/integrations/openclaw/api-server.js +7 -10
  50. package/dist/integrations/openclaw/client.d.ts +0 -1
  51. package/dist/integrations/openclaw/client.js +22 -24
  52. package/dist/integrations/openclaw/hooks/xray-hooks.d.ts +0 -1
  53. package/dist/integrations/openclaw/hooks/xray-hooks.js +17 -18
  54. package/dist/integrations/plugins/plugin-registry.js +5 -5
  55. package/dist/mcps/architect-tools.server.d.ts +2 -4
  56. package/dist/mcps/architect-tools.server.js +112 -195
  57. package/dist/mcps/auto-format.server.d.ts +2 -4
  58. package/dist/mcps/auto-format.server.js +49 -95
  59. package/dist/mcps/boot-orchestrator.server.d.ts +2 -4
  60. package/dist/mcps/boot-orchestrator.server.js +73 -105
  61. package/dist/mcps/config/server-config-registry.js +3 -3
  62. package/dist/mcps/enforcer-tools.server.d.ts +2 -4
  63. package/dist/mcps/enforcer-tools.server.js +202 -285
  64. package/dist/mcps/estimation.server.d.ts +2 -4
  65. package/dist/mcps/estimation.server.js +63 -107
  66. package/dist/mcps/framework-compliance-audit.server.d.ts +2 -4
  67. package/dist/mcps/framework-compliance-audit.server.js +53 -82
  68. package/dist/mcps/framework-help.server.d.ts +2 -4
  69. package/dist/mcps/framework-help.server.js +63 -101
  70. package/dist/mcps/governance.server.js +2 -2
  71. package/dist/mcps/knowledge-skills/api-design.server.d.ts +2 -4
  72. package/dist/mcps/knowledge-skills/api-design.server.js +35 -67
  73. package/dist/mcps/knowledge-skills/architecture-patterns.server.d.ts +2 -10
  74. package/dist/mcps/knowledge-skills/architecture-patterns.server.js +35 -74
  75. package/dist/mcps/knowledge-skills/bug-triage-specialist.server.d.ts +2 -4
  76. package/dist/mcps/knowledge-skills/bug-triage-specialist.server.js +143 -162
  77. package/dist/mcps/knowledge-skills/code-analyzer.server.d.ts +3 -4
  78. package/dist/mcps/knowledge-skills/code-analyzer.server.js +20 -45
  79. package/dist/mcps/knowledge-skills/code-review.server.d.ts +2 -4
  80. package/dist/mcps/knowledge-skills/code-review.server.js +109 -143
  81. package/dist/mcps/knowledge-skills/content-creator.server.d.ts +2 -4
  82. package/dist/mcps/knowledge-skills/content-creator.server.js +205 -226
  83. package/dist/mcps/knowledge-skills/database-design.server.d.ts +2 -4
  84. package/dist/mcps/knowledge-skills/database-design.server.js +117 -151
  85. package/dist/mcps/knowledge-skills/devops-deployment.server.d.ts +2 -4
  86. package/dist/mcps/knowledge-skills/devops-deployment.server.js +71 -160
  87. package/dist/mcps/knowledge-skills/git-workflow.server.d.ts +2 -4
  88. package/dist/mcps/knowledge-skills/git-workflow.server.js +36 -68
  89. package/dist/mcps/knowledge-skills/growth-strategist.server.d.ts +2 -4
  90. package/dist/mcps/knowledge-skills/growth-strategist.server.js +303 -324
  91. package/dist/mcps/knowledge-skills/log-monitor.server.d.ts +2 -4
  92. package/dist/mcps/knowledge-skills/log-monitor.server.js +141 -160
  93. package/dist/mcps/knowledge-skills/mobile-development.server.d.ts +2 -4
  94. package/dist/mcps/knowledge-skills/mobile-development.server.js +92 -209
  95. package/dist/mcps/knowledge-skills/multimodal-looker.server.d.ts +2 -4
  96. package/dist/mcps/knowledge-skills/multimodal-looker.server.js +123 -159
  97. package/dist/mcps/knowledge-skills/performance-optimization.server.d.ts +2 -5
  98. package/dist/mcps/knowledge-skills/performance-optimization.server.js +155 -296
  99. package/dist/mcps/knowledge-skills/project-analysis.server.d.ts +2 -4
  100. package/dist/mcps/knowledge-skills/project-analysis.server.js +75 -226
  101. package/dist/mcps/knowledge-skills/refactoring-strategies.server.d.ts +2 -4
  102. package/dist/mcps/knowledge-skills/refactoring-strategies.server.js +63 -156
  103. package/dist/mcps/knowledge-skills/security-audit.server.d.ts +2 -4
  104. package/dist/mcps/knowledge-skills/security-audit.server.js +102 -136
  105. package/dist/mcps/knowledge-skills/seo-consultant.server.d.ts +2 -4
  106. package/dist/mcps/knowledge-skills/seo-consultant.server.js +80 -203
  107. package/dist/mcps/knowledge-skills/session-management.server.d.ts +2 -4
  108. package/dist/mcps/knowledge-skills/session-management.server.js +50 -203
  109. package/dist/mcps/knowledge-skills/skill-invocation.server.d.ts +2 -4
  110. package/dist/mcps/knowledge-skills/skill-invocation.server.js +168 -347
  111. package/dist/mcps/knowledge-skills/strategist.server.d.ts +2 -11
  112. package/dist/mcps/knowledge-skills/strategist.server.js +72 -122
  113. package/dist/mcps/knowledge-skills/tech-writer.server.d.ts +2 -4
  114. package/dist/mcps/knowledge-skills/tech-writer.server.js +87 -300
  115. package/dist/mcps/knowledge-skills/testing-best-practices.server.d.ts +2 -4
  116. package/dist/mcps/knowledge-skills/testing-best-practices.server.js +147 -182
  117. package/dist/mcps/knowledge-skills/testing-strategy.server.d.ts +2 -4
  118. package/dist/mcps/knowledge-skills/testing-strategy.server.js +78 -153
  119. package/dist/mcps/knowledge-skills/ui-ux-design.server.d.ts +2 -5
  120. package/dist/mcps/knowledge-skills/ui-ux-design.server.js +90 -399
  121. package/dist/mcps/lint.server.d.ts +2 -4
  122. package/dist/mcps/lint.server.js +51 -92
  123. package/dist/mcps/mcp-client.js +2 -2
  124. package/dist/mcps/model-health-check.server.d.ts +2 -4
  125. package/dist/mcps/model-health-check.server.js +32 -60
  126. package/dist/mcps/performance-analysis.server.d.ts +2 -4
  127. package/dist/mcps/performance-analysis.server.js +57 -88
  128. package/dist/mcps/processor-pipeline.server.d.ts +2 -4
  129. package/dist/mcps/processor-pipeline.server.js +69 -100
  130. package/dist/mcps/registry.json +1 -1
  131. package/dist/mcps/researcher.server.d.ts +3 -5
  132. package/dist/mcps/researcher.server.js +81 -154
  133. package/dist/mcps/security-scan.server.d.ts +2 -4
  134. package/dist/mcps/security-scan.server.js +54 -96
  135. package/dist/mcps/shared/knowledge-skill-base.d.ts +14 -0
  136. package/dist/mcps/shared/knowledge-skill-base.js +45 -0
  137. package/dist/{security → mcps/shared}/security-scanner.js +1 -1
  138. package/dist/mcps/state-manager.server.d.ts +2 -4
  139. package/dist/mcps/state-manager.server.js +115 -160
  140. package/dist/orchestrator/orchestrator.d.ts +1 -1
  141. package/dist/orchestrator/orchestrator.js +1 -1
  142. package/dist/orchestrator/universal-registry-bridge.js +1 -1
  143. package/dist/plugin/xray-codex-injection.d.ts +1 -1
  144. package/dist/plugin/xray-codex-injection.js +1 -1
  145. package/dist/postprocessor/PostProcessor.d.ts +4 -44
  146. package/dist/postprocessor/PostProcessor.js +39 -553
  147. package/dist/postprocessor/analysis/CodeChangeAnalyzer.d.ts +11 -0
  148. package/dist/postprocessor/analysis/CodeChangeAnalyzer.js +50 -0
  149. package/dist/postprocessor/compliance/ArchitecturalComplianceChecker.d.ts +11 -0
  150. package/dist/postprocessor/compliance/ArchitecturalComplianceChecker.js +356 -0
  151. package/dist/postprocessor/config/ProcessorConfigLoader.d.ts +44 -0
  152. package/dist/postprocessor/config/ProcessorConfigLoader.js +21 -0
  153. package/dist/postprocessor/reporting/PostProcessorReporter.d.ts +19 -0
  154. package/dist/postprocessor/reporting/PostProcessorReporter.js +96 -0
  155. package/dist/postprocessor/triggers/GitHookTrigger.js +11 -11
  156. package/dist/processors/implementations/refactoring-logging-processor-wrapper.d.ts +32 -0
  157. package/dist/processors/implementations/refactoring-logging-processor-wrapper.js +95 -1
  158. package/dist/processors/processor-manager.js +346 -314
  159. package/dist/reporting/report-formatter.js +1 -1
  160. package/dist/security/security-hardener.d.ts +69 -2
  161. package/dist/security/security-hardener.js +129 -1
  162. package/dist/skills/registry.json +1 -1
  163. package/dist/state/index.d.ts +3 -5
  164. package/dist/state/index.js +1 -7
  165. package/dist/state/state-manager.d.ts +1 -1
  166. package/dist/state/state-manager.js +2 -3
  167. package/package.json +13 -10
  168. package/scripts/node/universal-version-manager.js +11 -11
  169. package/src/mcps/architect-tools.server.ts +112 -215
  170. package/src/mcps/auto-format.server.ts +50 -110
  171. package/src/mcps/boot-orchestrator.server.ts +75 -121
  172. package/src/mcps/config/__tests__/server-config-registry.test.ts +21 -12
  173. package/src/mcps/config/server-config-registry.ts +3 -3
  174. package/src/mcps/enforcer-tools.server.ts +212 -310
  175. package/src/mcps/estimation.server.ts +62 -122
  176. package/src/mcps/framework-compliance-audit.server.ts +52 -97
  177. package/src/mcps/framework-help.server.ts +64 -114
  178. package/src/mcps/governance.server.ts +2 -2
  179. package/src/mcps/knowledge-skills/api-design.server.ts +32 -77
  180. package/src/mcps/knowledge-skills/architecture-patterns.server.ts +31 -87
  181. package/src/mcps/knowledge-skills/bug-triage-specialist.server.ts +165 -193
  182. package/src/mcps/knowledge-skills/code-analyzer.server.ts +20 -55
  183. package/src/mcps/knowledge-skills/code-review.server.ts +114 -161
  184. package/src/mcps/knowledge-skills/content-creator.server.ts +218 -255
  185. package/src/mcps/knowledge-skills/database-design.server.ts +118 -165
  186. package/src/mcps/knowledge-skills/devops-deployment.server.ts +67 -172
  187. package/src/mcps/knowledge-skills/git-workflow.server.ts +32 -77
  188. package/src/mcps/knowledge-skills/growth-strategist.server.ts +324 -361
  189. package/src/mcps/knowledge-skills/log-monitor.server.ts +160 -187
  190. package/src/mcps/knowledge-skills/mobile-development.server.ts +89 -223
  191. package/src/mcps/knowledge-skills/multimodal-looker.server.ts +128 -175
  192. package/src/mcps/knowledge-skills/performance-optimization.server.ts +156 -329
  193. package/src/mcps/knowledge-skills/project-analysis.server.ts +72 -248
  194. package/src/mcps/knowledge-skills/refactoring-strategies.server.ts +59 -171
  195. package/src/mcps/knowledge-skills/security-audit.server.ts +104 -151
  196. package/src/mcps/knowledge-skills/seo-consultant.server.ts +80 -220
  197. package/src/mcps/knowledge-skills/session-management.server.ts +51 -232
  198. package/src/mcps/knowledge-skills/skill-invocation.server.ts +165 -372
  199. package/src/mcps/knowledge-skills/strategist.server.ts +72 -143
  200. package/src/mcps/knowledge-skills/tech-writer.server.ts +85 -350
  201. package/src/mcps/knowledge-skills/testing-best-practices.server.ts +146 -195
  202. package/src/mcps/knowledge-skills/testing-strategy.server.ts +75 -161
  203. package/src/mcps/knowledge-skills/ui-ux-design.server.ts +93 -487
  204. package/src/mcps/lint.server.ts +53 -107
  205. package/src/mcps/mcp-client.ts +2 -2
  206. package/src/mcps/model-health-check.server.ts +34 -71
  207. package/src/mcps/performance-analysis.server.ts +60 -104
  208. package/src/mcps/processor-pipeline.server.ts +72 -110
  209. package/src/mcps/registry.json +1 -1
  210. package/src/mcps/researcher.server.ts +88 -177
  211. package/src/mcps/security-scan.server.ts +55 -104
  212. package/src/mcps/shared/knowledge-skill-base.ts +62 -0
  213. package/src/mcps/shared/prompt-security-validator.ts +199 -0
  214. package/src/mcps/shared/security-scanner.ts +599 -0
  215. package/src/mcps/state-manager.server.ts +117 -175
  216. package/src/opencode/codex.codex +1 -1
  217. package/src/opencode/commands/dependency-audit.md +3 -3
  218. package/src/opencode/enforcer-config.json +2 -2
  219. package/src/skills/registry.json +1 -1
  220. package/xray/codex.json +1 -1
  221. package/xray/config.json +1 -1
  222. package/xray/features.json +1 -1
  223. package/xray/integrations.json +3 -3
  224. package/dist/integrations/hermes-agent/__pycache__/__init__.cpython-313.pyc +0 -0
  225. package/dist/integrations/hermes-agent/__pycache__/conftest.cpython-313-pytest-9.0.2.pyc +0 -0
  226. package/dist/integrations/hermes-agent/__pycache__/schemas.cpython-313.pyc +0 -0
  227. package/dist/integrations/hermes-agent/__pycache__/test_plugin.cpython-313-pytest-9.0.2.pyc +0 -0
  228. package/dist/integrations/hermes-agent/__pycache__/test_plugin.cpython-313.pyc +0 -0
  229. package/dist/integrations/hermes-agent/__pycache__/tools.cpython-313.pyc +0 -0
  230. package/dist/integrations/hermes-agent/conftest.py +0 -14
  231. package/dist/integrations/hermes-agent/test_plugin.py +0 -1103
  232. package/dist/processors/implementations/refactoring-logging-processor.d.ts +0 -31
  233. package/dist/processors/implementations/refactoring-logging-processor.js +0 -96
  234. package/dist/processors/implementations/session-capture-processor.d.ts +0 -14
  235. package/dist/processors/implementations/session-capture-processor.js +0 -37
  236. package/dist/scripts/activate-kernel-pipeline.d.ts +0 -7
  237. package/dist/scripts/activate-kernel-pipeline.js +0 -101
  238. package/dist/security/index.d.ts +0 -13
  239. package/dist/security/index.js +0 -13
  240. package/dist/security/security-agent-coordinator.d.ts +0 -72
  241. package/dist/security/security-agent-coordinator.js +0 -204
  242. package/dist/security/security-auditor.d.ts +0 -56
  243. package/dist/security/security-auditor.js +0 -584
  244. package/dist/security/security-hardening-system.d.ts +0 -239
  245. package/dist/security/security-hardening-system.js +0 -727
  246. package/dist/security/security-orchestration-layer.d.ts +0 -119
  247. package/dist/security/security-orchestration-layer.js +0 -496
  248. /package/dist/{security → mcps/shared}/prompt-security-validator.d.ts +0 -0
  249. /package/dist/{security → mcps/shared}/prompt-security-validator.js +0 -0
  250. /package/dist/{security → mcps/shared}/security-scanner.d.ts +0 -0
@@ -1,31 +0,0 @@
1
- export interface RefactoringContext {
2
- agentName: string;
3
- task: {
4
- id?: string;
5
- description?: string;
6
- operationType?: string;
7
- };
8
- startTime: number;
9
- complexityScore?: number;
10
- changes?: Array<{
11
- description?: string;
12
- type?: string;
13
- }>;
14
- files?: string[];
15
- metrics?: Record<string, unknown>;
16
- operationType?: string;
17
- }
18
- export interface RefactoringLogResult {
19
- logged: boolean;
20
- success: boolean;
21
- message: string;
22
- error?: string;
23
- }
24
- export declare class RefactoringLoggingProcessor {
25
- private logPath;
26
- constructor();
27
- private ensureLogDirectory;
28
- execute(context: RefactoringContext): Promise<RefactoringLogResult>;
29
- private createLogEntry;
30
- private appendToLog;
31
- }
@@ -1,96 +0,0 @@
1
- import { frameworkLogger } from "../../core/framework-logger.js";
2
- import * as fs from "fs";
3
- import * as path from "path";
4
- export class RefactoringLoggingProcessor {
5
- logPath;
6
- constructor() {
7
- this.logPath = path.join(process.cwd(), "logs", "agents", "refactoring-log.md");
8
- this.ensureLogDirectory();
9
- }
10
- ensureLogDirectory() {
11
- const logDir = path.dirname(this.logPath);
12
- if (!fs.existsSync(logDir)) {
13
- fs.mkdirSync(logDir, { recursive: true });
14
- }
15
- }
16
- async execute(context) {
17
- try {
18
- if (context.agentName &&
19
- context.task &&
20
- typeof context.startTime === "number") {
21
- const logEntry = this.createLogEntry(context);
22
- await this.appendToLog(logEntry);
23
- return {
24
- logged: true,
25
- success: true,
26
- message: "Agent refactoring completion logged successfully",
27
- };
28
- }
29
- return {
30
- logged: false,
31
- success: true,
32
- message: "Not an agent task completion context",
33
- };
34
- }
35
- catch (error) {
36
- const errorMessage = error instanceof Error ? error.message : String(error);
37
- await frameworkLogger.log("refactoring-logging-processor", "-refactoring-logging-failed-error-instanceof-error-", "error", { message: `Refactoring logging failed: ${errorMessage}` });
38
- return {
39
- logged: false,
40
- success: false,
41
- message: `Refactoring logging failed: ${errorMessage}`,
42
- error: errorMessage,
43
- };
44
- }
45
- }
46
- createLogEntry(context) {
47
- const timestamp = new Date().toISOString();
48
- const duration = Date.now() - context.startTime;
49
- let logEntry = `## Refactoring Operation - ${timestamp}\n\n`;
50
- logEntry += `**Agent:** ${context.agentName}\n`;
51
- logEntry += `**Task:** ${context.task.description || context.task.id || "Unknown"}\n`;
52
- logEntry += `**Duration:** ${duration}ms\n`;
53
- logEntry += `**Operation Type:** ${context.task.operationType || context.operationType || "refactor"}\n`;
54
- if (context.complexityScore) {
55
- logEntry += `**Complexity Score:** ${context.complexityScore}\n`;
56
- }
57
- if (context.changes && Array.isArray(context.changes)) {
58
- logEntry += `\n**Changes Made:**\n`;
59
- context.changes.forEach((change, index) => {
60
- logEntry += `${index + 1}. ${change.description || change.type || "Unknown change"}\n`;
61
- });
62
- }
63
- if (context.files && Array.isArray(context.files)) {
64
- logEntry += `\n**Files Modified:**\n`;
65
- context.files.forEach((file) => {
66
- logEntry += `- ${file}\n`;
67
- });
68
- }
69
- if (context.metrics) {
70
- logEntry += `\n**Metrics:**\n`;
71
- Object.entries(context.metrics).forEach(([key, value]) => {
72
- logEntry += `- ${key}: ${value}\n`;
73
- });
74
- }
75
- logEntry += `\n---\n\n`;
76
- return logEntry;
77
- }
78
- async appendToLog(entry) {
79
- try {
80
- if (!fs.existsSync(this.logPath)) {
81
- let header = `# 0xRay Framework Refactoring Log\n\n`;
82
- header += `This log tracks all refactoring operations performed by 0xRay agents.\n\n`;
83
- header += `Generated on: ${new Date().toISOString()}\n\n`;
84
- header += `---\n\n`;
85
- fs.writeFileSync(this.logPath, header, "utf8");
86
- }
87
- fs.appendFileSync(this.logPath, entry, "utf8");
88
- await frameworkLogger.log("refactoring-logging-processor", "-refactoring-operation-logged-successfully-", "info", { message: "Refactoring operation logged successfully" });
89
- }
90
- catch (error) {
91
- const errorMessage = error instanceof Error ? error.message : String(error);
92
- await frameworkLogger.log("refactoring-logging-processor", "-failed-to-append-to-refactoring-log-error-instanceof-", "error", { message: `Failed to append to refactoring log: ${errorMessage}` });
93
- throw error;
94
- }
95
- }
96
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * Session Capture Processor
3
- *
4
- * Extracted from InferenceImprovementProcessor - handles discovery of
5
- * session data sources (reflections, logs, reports) for inference workflows.
6
- *
7
- * @module processors/implementations
8
- */
9
- export declare class SessionCapture {
10
- static findReflections(directory: string, reflectionsDir: string): string[];
11
- static findLogs(directory: string, logsDir: string): string[];
12
- static findReports(directory: string, reportsDir: string): string[];
13
- }
14
- export default SessionCapture;
@@ -1,37 +0,0 @@
1
- /**
2
- * Session Capture Processor
3
- *
4
- * Extracted from InferenceImprovementProcessor - handles discovery of
5
- * session data sources (reflections, logs, reports) for inference workflows.
6
- *
7
- * @module processors/implementations
8
- */
9
- import * as fs from "fs";
10
- import * as path from "path";
11
- export class SessionCapture {
12
- static findReflections(directory, reflectionsDir) {
13
- const reflectionsPath = path.join(directory, reflectionsDir);
14
- if (!fs.existsSync(reflectionsPath))
15
- return [];
16
- return fs.readdirSync(reflectionsPath)
17
- .filter(f => f.endsWith(".md"))
18
- .map(f => path.join(reflectionsPath, f));
19
- }
20
- static findLogs(directory, logsDir) {
21
- const logsPath = path.join(directory, logsDir);
22
- if (!fs.existsSync(logsPath))
23
- return [];
24
- return fs.readdirSync(logsPath)
25
- .filter(f => f.includes("routing") || f.includes("activity") || f.includes("session"))
26
- .map(f => path.join(logsPath, f));
27
- }
28
- static findReports(directory, reportsDir) {
29
- const reportsPath = path.join(directory, reportsDir);
30
- if (!fs.existsSync(reportsPath))
31
- return [];
32
- return fs.readdirSync(reportsPath)
33
- .filter(f => f.endsWith(".json") || f.endsWith(".md"))
34
- .map(f => path.join(reportsPath, f));
35
- }
36
- }
37
- export default SessionCapture;
@@ -1,7 +0,0 @@
1
- /**
2
- * Kernel Pipeline Activation Script
3
- *
4
- * Triggers real delegations that should activate kernel patterns.
5
- * Observes the full pipeline in action.
6
- */
7
- export {};
@@ -1,101 +0,0 @@
1
- /**
2
- * Kernel Pipeline Activation Script
3
- *
4
- * Triggers real delegations that should activate kernel patterns.
5
- * Observes the full pipeline in action.
6
- */
7
- import { AgentDelegator } from '../delegation/agent-delegator.js';
8
- import { XrayStateManager } from '../state/state-manager.js';
9
- import { strRayConfigLoader } from '../core/config-loader.js';
10
- import { routingOutcomeTracker } from '../delegation/analytics/outcome-tracker.js';
11
- import { patternPerformanceTracker } from '../analytics/pattern-performance-tracker.js';
12
- const stateManager = new XrayStateManager();
13
- const delegator = new AgentDelegator(stateManager, strRayConfigLoader);
14
- console.log('=== KERNEL PIPELINE ACTIVATION TEST ===\n');
15
- // Test cases designed to trigger kernel patterns
16
- const testCases = [
17
- {
18
- operation: 'security',
19
- description: 'Add new API endpoint with user authentication but skip input validation for SQL injection prevention',
20
- expected: ['P6', 'A8']
21
- },
22
- {
23
- operation: 'fix',
24
- description: 'Fix infinite recursion in the calculateTotals function - it keeps calling itself',
25
- expected: ['P1']
26
- },
27
- {
28
- operation: 'test',
29
- description: 'All tests pass on my machine but fail in CI - I think its an environment issue',
30
- expected: ['A1', 'A9']
31
- },
32
- {
33
- operation: 'deploy',
34
- description: 'Run the deployment script but getting permission denied on execution',
35
- expected: ['P8']
36
- },
37
- {
38
- operation: 'update',
39
- description: 'Upgrade all dependencies to latest version at once - we need everything current',
40
- expected: ['P5']
41
- },
42
- {
43
- operation: 'refactor',
44
- description: 'The tests all pass but we still have bugs in production - I do not understand why',
45
- expected: ['A2', 'A3']
46
- },
47
- {
48
- operation: 'create',
49
- description: 'Skip security for internal API - its only used internally so authentication is optional',
50
- expected: ['A8']
51
- },
52
- {
53
- operation: 'optimize',
54
- description: 'Make the code 80% faster - use aggressive caching everywhere',
55
- expected: ['A7']
56
- },
57
- ];
58
- let kernelEvents = 0;
59
- let learningEvents = 0;
60
- async function runTest(testCase) {
61
- console.log(`\n--- Testing: ${testCase.operation} ---`);
62
- console.log(`Description: ${testCase.description}`);
63
- console.log(`Expected patterns: ${testCase.expected.join(', ')}`);
64
- try {
65
- const result = await delegator.analyzeDelegation({
66
- operation: testCase.operation,
67
- description: testCase.description,
68
- sessionId: 'kernel-activation-test',
69
- });
70
- console.log(`Selected agents:`);
71
- result.agentDetails.forEach(agent => {
72
- console.log(` - ${agent.name}: ${agent.role} (confidence: ${agent.confidence})`);
73
- });
74
- kernelEvents++;
75
- // Check outcomes tracked
76
- const outcomes = routingOutcomeTracker.getOutcomes();
77
- console.log(`Total outcomes tracked: ${outcomes.length}`);
78
- learningEvents++;
79
- }
80
- catch (error) {
81
- console.log(`Error: ${error instanceof Error ? error.message : String(error)}`);
82
- }
83
- }
84
- async function main() {
85
- console.log('Initial state:');
86
- console.log(` Outcomes: ${routingOutcomeTracker.getOutcomes().length}`);
87
- for (const testCase of testCases) {
88
- await runTest(testCase);
89
- await new Promise(r => setTimeout(r, 100));
90
- }
91
- console.log('\n=== FINAL STATE ===');
92
- console.log(`Delegations performed: ${kernelEvents}`);
93
- console.log(`Learning events: ${learningEvents}`);
94
- console.log(`Total outcomes: ${routingOutcomeTracker.getOutcomes().length}`);
95
- // Check pattern metrics
96
- const patternMetrics = patternPerformanceTracker.getMetrics?.() || {};
97
- console.log(`Pattern types tracked: ${Object.keys(patternMetrics).length}`);
98
- console.log('\n=== CHECKING ACTIVITY LOG ===');
99
- // Log should show kernel-pattern-applied events
100
- }
101
- main().catch(console.error);
@@ -1,13 +0,0 @@
1
- /**
2
- * 0xRay AI v1.22.60 - Security Module Index
3
- * Unified exports for the comprehensive security system
4
- */
5
- export { SecurityScanner, securityScanner } from "./security-scanner.js";
6
- export { PromptSecurityValidator, promptSecurityValidator, } from "./prompt-security-validator.js";
7
- export * from "./security-headers.js";
8
- export * from "./security-hardening-system.js";
9
- export * from "./security-hardener.js";
10
- export * from "./security-auditor.js";
11
- export { ComprehensiveSecurityAuditSystem, createSecurityAuditSystem, runQuickSecurityAudit, runDeepSecurityAudit, type Vulnerability, type VulnerabilityCategory, type SeverityLevel, type RemediationStep, type RemediationPlan, type SecurityAuditConfig, type SecurityAuditReport, type WeightedVote, type ArchitecturalDecision, type ComplianceResult, type ComplianceStandard, } from "./comprehensive-security-audit.js";
12
- export { SecurityOrchestrationLayer, createSecurityOrchestrationLayer, runSecurityOrchestration, type SecurityAgent, type SecurityAgentType, type AgentStatus, type SecurityTask, type SecurityTaskType, type AgentVote, type SecurityDecision, type OrchestrationConfig, type SecurityOrchestrationReport, } from "./security-orchestration-layer.js";
13
- export { SecurityAgentCoordinator, createSecurityAgentCoordinator, runMultiAgentSecurityScan, type SecurityAgentConfig, type SecurityAgentContext, type AgentVotingResult, type MultiAgentSecurityResult, } from "./security-agent-coordinator.js";
@@ -1,13 +0,0 @@
1
- /**
2
- * 0xRay AI v1.22.60 - Security Module Index
3
- * Unified exports for the comprehensive security system
4
- */
5
- export { SecurityScanner, securityScanner } from "./security-scanner.js";
6
- export { PromptSecurityValidator, promptSecurityValidator, } from "./prompt-security-validator.js";
7
- export * from "./security-headers.js";
8
- export * from "./security-hardening-system.js";
9
- export * from "./security-hardener.js";
10
- export * from "./security-auditor.js";
11
- export { ComprehensiveSecurityAuditSystem, createSecurityAuditSystem, runQuickSecurityAudit, runDeepSecurityAudit, } from "./comprehensive-security-audit.js";
12
- export { SecurityOrchestrationLayer, createSecurityOrchestrationLayer, runSecurityOrchestration, } from "./security-orchestration-layer.js";
13
- export { SecurityAgentCoordinator, createSecurityAgentCoordinator, runMultiAgentSecurityScan, } from "./security-agent-coordinator.js";
@@ -1,72 +0,0 @@
1
- /**
2
- * Security Agent Integration
3
- *
4
- * Integrates the security orchestration layer with the framework's agent system.
5
- * Provides coordination between security agents using weighted voting.
6
- *
7
- * @version 1.22.13
8
- */
9
- import { EventEmitter } from "events";
10
- import { SecurityOrchestrationLayer, SecurityAgent, SecurityDecision, OrchestrationConfig } from "./security-orchestration-layer.js";
11
- import { Vulnerability } from "./comprehensive-security-audit.js";
12
- export interface SecurityAgentConfig {
13
- agentId: string;
14
- agentType: string;
15
- capabilities: string[];
16
- weight: number;
17
- }
18
- export interface SecurityAgentContext {
19
- projectPath: string;
20
- scanDepth: "shallow" | "medium" | "deep";
21
- complianceStandards: string[];
22
- enableAutoRemediation: boolean;
23
- }
24
- export interface AgentVotingResult {
25
- agentId: string;
26
- agentName: string;
27
- vote: "approve" | "reject" | "abstain";
28
- weight: number;
29
- reasoning: string;
30
- concerns: string[];
31
- confidence: number;
32
- }
33
- export interface MultiAgentSecurityResult {
34
- auditId: string;
35
- timestamp: Date;
36
- duration: number;
37
- participatingAgents: string[];
38
- vulnerabilities: Vulnerability[];
39
- decisions: SecurityDecision[];
40
- agentVotes: AgentVotingResult[];
41
- summary: {
42
- totalVulnerabilities: number;
43
- critical: number;
44
- high: number;
45
- medium: number;
46
- low: number;
47
- securityScore: number;
48
- complianceScore: number;
49
- };
50
- weightedApproval: number;
51
- approved: boolean;
52
- recommendations: string[];
53
- }
54
- export declare class SecurityAgentCoordinator extends EventEmitter {
55
- private orchestration;
56
- private agentRegistry;
57
- private isActive;
58
- constructor(config?: Partial<OrchestrationConfig>);
59
- private setupEventHandlers;
60
- registerAgent(config: SecurityAgentConfig): void;
61
- unregisterAgent(agentId: string): boolean;
62
- getRegisteredAgents(): SecurityAgentConfig[];
63
- runCoordinatedSecurityScan(context: SecurityAgentContext): Promise<MultiAgentSecurityResult>;
64
- private collectAgentVotes;
65
- private calculateWeightedApproval;
66
- getOrchestrationLayer(): SecurityOrchestrationLayer;
67
- getActiveAgents(): SecurityAgent[];
68
- getPendingTasks(): import("./security-orchestration-layer.js").SecurityTask[];
69
- isCoordinatorActive(): boolean;
70
- }
71
- export declare function createSecurityAgentCoordinator(config?: Partial<OrchestrationConfig>): SecurityAgentCoordinator;
72
- export declare function runMultiAgentSecurityScan(projectPath: string, context?: Partial<SecurityAgentContext>): Promise<MultiAgentSecurityResult>;
@@ -1,204 +0,0 @@
1
- /**
2
- * Security Agent Integration
3
- *
4
- * Integrates the security orchestration layer with the framework's agent system.
5
- * Provides coordination between security agents using weighted voting.
6
- *
7
- * @version 1.22.13
8
- */
9
- import { EventEmitter } from "events";
10
- import { frameworkLogger } from "../core/framework-logger.js";
11
- import { createSecurityOrchestrationLayer, } from "./security-orchestration-layer.js";
12
- export class SecurityAgentCoordinator extends EventEmitter {
13
- orchestration;
14
- agentRegistry = new Map();
15
- isActive = false;
16
- constructor(config) {
17
- super();
18
- this.orchestration = createSecurityOrchestrationLayer(config);
19
- this.setupEventHandlers();
20
- }
21
- setupEventHandlers() {
22
- this.orchestration.on("orchestration:start", (data) => {
23
- this.emit("coordinator:start", data);
24
- frameworkLogger.log("security-agent-coordinator", "coordinator-start", "info", data);
25
- });
26
- this.orchestration.on("orchestration:complete", (report) => {
27
- this.emit("coordinator:complete", report);
28
- frameworkLogger.log("security-agent-coordinator", "coordinator-complete", "info", {
29
- auditId: report.auditId,
30
- duration: report.duration,
31
- vulnerabilities: report.summary.totalVulnerabilities,
32
- });
33
- });
34
- this.orchestration.on("orchestration:error", (error) => {
35
- this.emit("coordinator:error", error);
36
- frameworkLogger.log("security-agent-coordinator", "coordinator-error", "error", error);
37
- });
38
- this.orchestration.on("agent:vote", ({ agentId, vote }) => {
39
- this.emit("agent:vote", { agentId, vote });
40
- });
41
- this.orchestration.on("agent:status-change", (agent) => {
42
- this.emit("agent:status-change", agent);
43
- });
44
- this.orchestration.on("task:complete", (task) => {
45
- this.emit("task:complete", task);
46
- });
47
- this.orchestration.on("task:failed", (task) => {
48
- this.emit("task:failed", task);
49
- });
50
- }
51
- registerAgent(config) {
52
- this.agentRegistry.set(config.agentId, config);
53
- frameworkLogger.log("security-agent-coordinator", "agent-registered", "info", {
54
- agentId: config.agentId,
55
- agentType: config.agentType,
56
- weight: config.weight,
57
- });
58
- }
59
- unregisterAgent(agentId) {
60
- const removed = this.agentRegistry.delete(agentId);
61
- if (removed) {
62
- frameworkLogger.log("security-agent-coordinator", "agent-unregistered", "info", {
63
- agentId,
64
- });
65
- }
66
- return removed;
67
- }
68
- getRegisteredAgents() {
69
- return Array.from(this.agentRegistry.values());
70
- }
71
- async runCoordinatedSecurityScan(context) {
72
- this.isActive = true;
73
- const startTime = Date.now();
74
- frameworkLogger.log("security-agent-coordinator", "coordinated-scan-start", "info", {
75
- projectPath: context.projectPath,
76
- scanDepth: context.scanDepth,
77
- registeredAgents: this.agentRegistry.size,
78
- });
79
- try {
80
- const report = await this.orchestration.runSecurityOrchestration(context.projectPath);
81
- const agentVotes = this.collectAgentVotes(report);
82
- const weightedApproval = this.calculateWeightedApproval(agentVotes);
83
- const result = {
84
- auditId: report.auditId,
85
- timestamp: report.timestamp,
86
- duration: report.duration,
87
- participatingAgents: report.agents.map((a) => a.name),
88
- vulnerabilities: report.vulnerabilities,
89
- decisions: report.decisions,
90
- agentVotes,
91
- summary: report.summary,
92
- weightedApproval,
93
- approved: weightedApproval >= 0.5,
94
- recommendations: report.recommendations,
95
- };
96
- this.emit("coordinated-scan:complete", result);
97
- return result;
98
- }
99
- catch (error) {
100
- const errorMessage = error instanceof Error ? error.message : String(error);
101
- frameworkLogger.log("security-agent-coordinator", "coordinated-scan-error", "error", {
102
- error: errorMessage,
103
- });
104
- throw error;
105
- }
106
- finally {
107
- this.isActive = false;
108
- }
109
- }
110
- collectAgentVotes(report) {
111
- const vulnerabilities = report.vulnerabilities;
112
- const agents = report.agents;
113
- return agents.map((agent) => {
114
- const agentVulns = vulnerabilities.filter((v) => v.severity === "critical" || v.severity === "high");
115
- const concerns = [];
116
- let vote = "approve";
117
- let reasoning = `Security review by ${agent.name}. Found ${vulnerabilities.length} vulnerabilities.`;
118
- const criticalCount = vulnerabilities.filter((v) => v.severity === "critical").length;
119
- const highCount = vulnerabilities.filter((v) => v.severity === "high").length;
120
- if (criticalCount > 0) {
121
- concerns.push(`${criticalCount} critical vulnerabilities detected`);
122
- }
123
- if (highCount > 5) {
124
- concerns.push(`${highCount} high-severity vulnerabilities`);
125
- }
126
- if (criticalCount > 5) {
127
- vote = "reject";
128
- reasoning = "Too many critical vulnerabilities. Security posture unacceptable.";
129
- }
130
- else if (criticalCount > 0 || highCount > 10) {
131
- vote = "approve";
132
- reasoning = "Acceptable with noted concerns. Priority fixes required.";
133
- }
134
- return {
135
- agentId: agent.id,
136
- agentName: agent.name,
137
- vote,
138
- weight: agent.weight,
139
- reasoning,
140
- concerns,
141
- confidence: Math.max(0.5, 1 - (criticalCount * 0.1 + highCount * 0.02)),
142
- };
143
- });
144
- }
145
- calculateWeightedApproval(votes) {
146
- if (votes.length === 0)
147
- return 0;
148
- const totalWeight = votes.reduce((sum, v) => sum + v.weight, 0);
149
- const approvalWeight = votes
150
- .filter((v) => v.vote === "approve")
151
- .reduce((sum, v) => sum + v.weight, 0);
152
- return totalWeight > 0 ? approvalWeight / totalWeight : 0;
153
- }
154
- getOrchestrationLayer() {
155
- return this.orchestration;
156
- }
157
- getActiveAgents() {
158
- return this.orchestration.getActiveAgents();
159
- }
160
- getPendingTasks() {
161
- return this.orchestration.getTasks().filter((t) => t.status === "pending");
162
- }
163
- isCoordinatorActive() {
164
- return this.isActive;
165
- }
166
- }
167
- export function createSecurityAgentCoordinator(config) {
168
- return new SecurityAgentCoordinator(config);
169
- }
170
- export async function runMultiAgentSecurityScan(projectPath, context) {
171
- const coordinator = createSecurityAgentCoordinator();
172
- const fullContext = {
173
- projectPath,
174
- scanDepth: context?.scanDepth || "medium",
175
- complianceStandards: context?.complianceStandards || ["owasp-top-10", "cwe"],
176
- enableAutoRemediation: context?.enableAutoRemediation ?? true,
177
- ...context,
178
- };
179
- coordinator.registerAgent({
180
- agentId: "agent-security-auditor",
181
- agentType: "security-auditor",
182
- capabilities: ["vulnerability-scanning", "threat-detection", "security-auditing"],
183
- weight: 0.35,
184
- });
185
- coordinator.registerAgent({
186
- agentId: "agent-code-analyzer",
187
- agentType: "code-analyzer",
188
- capabilities: ["code-pattern-analysis", "static-analysis", "security-hotspot-detection"],
189
- weight: 0.30,
190
- });
191
- coordinator.registerAgent({
192
- agentId: "agent-testing-lead",
193
- agentType: "testing-lead",
194
- capabilities: ["security-testing", "penetration-testing", "vulnerability-validation"],
195
- weight: 0.20,
196
- });
197
- coordinator.registerAgent({
198
- agentId: "agent-architect",
199
- agentType: "architect",
200
- capabilities: ["security-architecture", "threat-modeling", "risk-assessment"],
201
- weight: 0.15,
202
- });
203
- return coordinator.runCoordinatedSecurityScan(fullContext);
204
- }
@@ -1,56 +0,0 @@
1
- /**
2
- * Security Audit Tool
3
- *
4
- * Comprehensive security auditing for the framework and its components.
5
- * Identifies vulnerabilities, misconfigurations, and security weaknesses.
6
- *
7
- * @version 1.0.0
8
- * @since 2026-01-07
9
- */
10
- export interface SecurityIssue {
11
- severity: "critical" | "high" | "medium" | "low" | "info";
12
- category: string;
13
- file: string;
14
- line?: number;
15
- description: string;
16
- recommendation: string;
17
- cwe?: string;
18
- }
19
- export interface SecurityAuditResult {
20
- totalFiles: number;
21
- issues: SecurityIssue[];
22
- summary: {
23
- critical: number;
24
- high: number;
25
- medium: number;
26
- low: number;
27
- info: number;
28
- };
29
- score: number;
30
- }
31
- export declare class SecurityAuditor {
32
- private readonly dangerousPatterns;
33
- private readonly dangerousImports;
34
- /**
35
- * Run comprehensive security audit
36
- */
37
- auditProject(projectPath?: string): Promise<SecurityAuditResult>;
38
- private getAllFiles;
39
- private shouldSkipDirectory;
40
- private shouldAuditFile;
41
- private auditFile;
42
- private isFalsePositive;
43
- private auditImports;
44
- private auditFilePermissions;
45
- private auditPackageJson;
46
- private auditConfiguration;
47
- private auditDependencies;
48
- private getRecommendationForCategory;
49
- private generateSummary;
50
- private calculateSecurityScore;
51
- /**
52
- * Generate security audit report
53
- */
54
- generateReport(result: SecurityAuditResult): string;
55
- }
56
- export declare const securityAuditor: SecurityAuditor;