0xray 4.0.33 → 4.0.35

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 (156) hide show
  1. package/.grok-plugin/plugin.json +1 -1
  2. package/.xray/codex.json +12 -4
  3. package/.xray/features.json +1 -1
  4. package/AGENTS-consumer.md +6 -6
  5. package/AGENTS.md +5 -5
  6. package/README.md +2 -2
  7. package/dist/AGENTS.md +5 -5
  8. package/dist/CHANGELOG.md +25 -0
  9. package/dist/README.md +2 -2
  10. package/dist/cli/index.js +2 -5
  11. package/dist/governance/governance-service.js +1 -1
  12. package/dist/integrations/base/README.md +1 -9
  13. package/dist/integrations/base/index.d.ts +0 -1
  14. package/dist/integrations/base/index.js +0 -2
  15. package/dist/integrations/governance/index.js +31 -8
  16. package/dist/integrations/grok/hooks/grok-hook-utils.js +1 -1
  17. package/dist/integrations/grok/hooks/session-start.js +12 -0
  18. package/dist/integrations/hooks/goggles-pipeline.mjs +108 -22
  19. package/dist/integrations/hooks/goggles-planes.json +23 -0
  20. package/dist/integrations/hooks/host-truth.mjs +74 -0
  21. package/dist/integrations/hooks/station-hook-runtime.cjs +3 -0
  22. package/dist/integrations/openclaw/plugin/xray-pre-tool/package.json +1 -1
  23. package/dist/mcps/knowledge-skills/storyteller.server.js +0 -1
  24. package/dist/nucleus/delegation-gate.d.ts +2 -2
  25. package/dist/nucleus/delegation-gate.js +13 -2
  26. package/dist/nucleus/work-freshness.mjs +189 -0
  27. package/dist/processors/implementations/agents-md-validation-processor.js +1 -1
  28. package/docs-site/docs/plates/boot.md +17 -2
  29. package/docs-site/docs/plates/governance.md +3 -2
  30. package/docs-site/docs/plates/index.md +3 -1
  31. package/docs-site/docs/plates/memory-recall.md +26 -35
  32. package/docs-site/docs/plates/orchestration.md +39 -35
  33. package/docs-site/docs/plates/processor.md +34 -36
  34. package/docs-site/docs/plates/reporting.md +3 -8
  35. package/docs-site/docs/plates/routing.md +22 -11
  36. package/package.json +2 -2
  37. package/scripts/foundry/release.mjs +48 -5
  38. package/scripts/mjs/test-consumer-readiness.mjs +1 -0
  39. package/scripts/mjs/test-mcp-functionality.mjs +14 -9
  40. package/scripts/node/basic-security-audit.cjs +0 -1
  41. package/scripts/node/bridge-mcp-wiring.cjs +66 -3
  42. package/scripts/node/postinstall.cjs +1 -1
  43. package/scripts/node/prepare-consumer.cjs +11 -7
  44. package/scripts/node/setup-dev.cjs +18 -26
  45. package/scripts/node/validate-mcp-connectivity.js +2 -1
  46. package/src/integrations/openclaw/plugin/xray-pre-tool/package.json +1 -1
  47. package/src/mcps/knowledge-skills/storyteller.server.ts +0 -1
  48. package/xray/agents_template.md +5 -5
  49. package/xray/codex.json +12 -4
  50. package/xray/features.json +1 -1
  51. package/dist/agents/known-names.d.ts +0 -26
  52. package/dist/agents/known-names.js +0 -72
  53. package/dist/analytics/consent-manager.d.ts +0 -92
  54. package/dist/analytics/consent-manager.js +0 -257
  55. package/dist/benchmark/performance-benchmark.d.ts +0 -103
  56. package/dist/benchmark/performance-benchmark.js +0 -373
  57. package/dist/cli/commands/analytics-disable.d.ts +0 -9
  58. package/dist/cli/commands/analytics-disable.js +0 -72
  59. package/dist/cli/commands/analytics-enable-action.d.ts +0 -8
  60. package/dist/cli/commands/analytics-enable-action.js +0 -82
  61. package/dist/cli/commands/analytics-preview.d.ts +0 -9
  62. package/dist/cli/commands/analytics-preview.js +0 -106
  63. package/dist/cli/commands/analytics-status.d.ts +0 -9
  64. package/dist/cli/commands/analytics-status.js +0 -68
  65. package/dist/cli/commands/enforce.d.ts +0 -12
  66. package/dist/cli/commands/enforce.js +0 -78
  67. package/dist/cli/commands/govern.d.ts +0 -29
  68. package/dist/cli/commands/govern.js +0 -149
  69. package/dist/cli/commands/security-audit.d.ts +0 -23
  70. package/dist/cli/commands/security-audit.js +0 -219
  71. package/dist/cli/server.d.ts +0 -1
  72. package/dist/cli/server.js +0 -147
  73. package/dist/config/routing-mappings.d.ts +0 -26
  74. package/dist/config/routing-mappings.js +0 -151
  75. package/dist/core/bridge.mjs +0 -922
  76. package/dist/core/trace-context.d.ts +0 -12
  77. package/dist/core/trace-context.js +0 -33
  78. package/dist/enforcement/index.d.ts +0 -22
  79. package/dist/enforcement/index.js +0 -40
  80. package/dist/enforcement/loaders/index.d.ts +0 -36
  81. package/dist/enforcement/loaders/index.js +0 -39
  82. package/dist/enforcement/test-auto-healing.d.ts +0 -83
  83. package/dist/enforcement/test-auto-healing.js +0 -325
  84. package/dist/inference/index.d.ts +0 -10
  85. package/dist/inference/index.js +0 -5
  86. package/dist/infrastructure/iac-validator.d.ts +0 -150
  87. package/dist/infrastructure/iac-validator.js +0 -465
  88. package/dist/infrastructure/schemas/cloud-schemas.d.ts +0 -482
  89. package/dist/infrastructure/schemas/cloud-schemas.js +0 -488
  90. package/dist/integrations/base/ExampleIntegration.d.ts +0 -46
  91. package/dist/integrations/base/ExampleIntegration.js +0 -180
  92. package/dist/integrations/enforcement-gate.d.ts +0 -44
  93. package/dist/integrations/enforcement-gate.js +0 -348
  94. package/dist/mcps/connection/connection-manager.d.ts +0 -39
  95. package/dist/mcps/connection/connection-manager.js +0 -79
  96. package/dist/mcps/index.d.ts +0 -17
  97. package/dist/mcps/index.js +0 -65
  98. package/dist/mcps/orchestrator/index.d.ts +0 -6
  99. package/dist/mcps/orchestrator/index.js +0 -5
  100. package/dist/metrics/index.d.ts +0 -6
  101. package/dist/metrics/index.js +0 -6
  102. package/dist/orchestrator/self-direction-activation.d.ts +0 -108
  103. package/dist/orchestrator/self-direction-activation.js +0 -244
  104. package/dist/orchestrator/universal-registry-bridge.d.ts +0 -84
  105. package/dist/orchestrator/universal-registry-bridge.js +0 -246
  106. package/dist/performance/performance-budget-enforcer.d.ts +0 -157
  107. package/dist/performance/performance-budget-enforcer.js +0 -433
  108. package/dist/performance/performance-regression-tester.d.ts +0 -107
  109. package/dist/performance/performance-regression-tester.js +0 -341
  110. package/dist/postprocessor/analysis/CodeChangeAnalyzer.d.ts +0 -11
  111. package/dist/postprocessor/analysis/CodeChangeAnalyzer.js +0 -50
  112. package/dist/postprocessor/config/ProcessorConfigLoader.d.ts +0 -44
  113. package/dist/postprocessor/config/ProcessorConfigLoader.js +0 -16
  114. package/dist/postprocessor/integration.d.ts +0 -156
  115. package/dist/postprocessor/integration.js +0 -194
  116. package/dist/postprocessor/metamorphosis/index.d.ts +0 -2
  117. package/dist/postprocessor/metamorphosis/index.js +0 -1
  118. package/dist/postprocessor/redeploy/RetryHandler.d.ts +0 -49
  119. package/dist/postprocessor/redeploy/RetryHandler.js +0 -118
  120. package/dist/processors/implementations/session-capture-processor.d.ts +0 -14
  121. package/dist/processors/implementations/session-capture-processor.js +0 -37
  122. package/dist/public/XrayService.d.ts +0 -17
  123. package/dist/public/XrayService.js +0 -40
  124. package/dist/public/index.d.ts +0 -4
  125. package/dist/public/index.js +0 -2
  126. package/dist/security/comprehensive-security-audit.d.ts +0 -157
  127. package/dist/security/comprehensive-security-audit.js +0 -1004
  128. package/dist/security/index.d.ts +0 -13
  129. package/dist/security/index.js +0 -13
  130. package/dist/security/security-agent-coordinator.d.ts +0 -71
  131. package/dist/security/security-agent-coordinator.js +0 -203
  132. package/dist/security/security-hardening-system.d.ts +0 -238
  133. package/dist/security/security-hardening-system.js +0 -726
  134. package/dist/security/security-orchestration-layer.d.ts +0 -118
  135. package/dist/security/security-orchestration-layer.js +0 -495
  136. package/dist/testing/memory-regression-suite.d.ts +0 -105
  137. package/dist/testing/memory-regression-suite.js +0 -258
  138. package/dist/tools/assess-complexity-tool.d.ts +0 -28
  139. package/dist/tools/assess-complexity-tool.js +0 -44
  140. package/dist/tools/query-routing-tool.d.ts +0 -17
  141. package/dist/tools/query-routing-tool.js +0 -59
  142. package/dist/utils/batch-operations.d.ts +0 -25
  143. package/dist/utils/batch-operations.js +0 -292
  144. package/dist/utils/task-graph.d.ts +0 -29
  145. package/dist/utils/task-graph.js +0 -106
  146. package/dist/utils/test-template-generator.d.ts +0 -25
  147. package/dist/utils/test-template-generator.js +0 -178
  148. package/dist/utils/token-manager.d.ts +0 -48
  149. package/dist/utils/token-manager.js +0 -163
  150. package/dist/validation/agent-config-validator.d.ts +0 -110
  151. package/dist/validation/agent-config-validator.js +0 -280
  152. package/dist/validation/orchestration-flow-validator.d.ts +0 -87
  153. package/dist/validation/orchestration-flow-validator.js +0 -606
  154. package/src/mcps/connection/connection-manager.ts +0 -91
  155. package/src/mcps/index.ts +0 -80
  156. package/src/mcps/orchestrator/index.ts +0 -29
@@ -1,194 +0,0 @@
1
- /**
2
- * 0xRay Integration Layer
3
- *
4
- * Provides generic connectors for integrating 0xRay's PostProcessor
5
- * with external applications and frameworks.
6
- *
7
- * This is framework-agnostic - works with Express, Fastify, Koa, etc.
8
- *
9
- * @since 2026-03-08
10
- */
11
- export { WebhookTrigger } from './triggers/WebhookTrigger.js';
12
- export { APITrigger } from './triggers/APITrigger.js';
13
- /**
14
- * Generic 0xRay integration for any external application
15
- *
16
- * Provides:
17
- * - Webhook receivers (GitHub, GitLab, Bitbucket, Stripe)
18
- * - REST API triggers (manual trigger, retry, status)
19
- * - Framework-agnostic (works with Express, Fastify, Koa, etc.)
20
- *
21
- * @example
22
- * ```typescript
23
- * import { createXrayIntegration } from '0xray/integration';
24
- *
25
- * const postProcessor = new PostProcessor(stateManager);
26
- * const integration = createXrayIntegration(postProcessor);
27
- *
28
- * // Get Express app for mounting
29
- * app.use('/webhooks', integration.getWebhookApp());
30
- * app.use('/api/post-process', integration.getAPIApp());
31
- *
32
- * // Or get raw routers for Fastify/Koa
33
- * const webhookRouter = integration.getWebhookRouter();
34
- * const apiRouter = integration.getAPIRouter();
35
- * ```
36
- */
37
- export class XrayIntegration {
38
- postProcessor;
39
- webhookTrigger = null;
40
- apiTrigger = null;
41
- constructor(postProcessor) {
42
- this.postProcessor = postProcessor;
43
- }
44
- /**
45
- * Initialize all triggers with default configuration
46
- *
47
- * @param config - Optional configuration for triggers
48
- */
49
- async initialize(config) {
50
- const { WebhookTrigger } = await import('./triggers/WebhookTrigger.js');
51
- const { APITrigger } = await import('./triggers/APITrigger.js');
52
- // Initialize webhook trigger with default GitHub config
53
- this.webhookTrigger = new WebhookTrigger(this.postProcessor, {
54
- provider: 'github',
55
- events: ['push', 'pull_request'],
56
- path: '/webhooks/github',
57
- verifySignature: true,
58
- ...config?.webhook
59
- });
60
- await this.webhookTrigger.initialize();
61
- // Initialize API trigger with default config
62
- this.apiTrigger = new APITrigger(this.postProcessor, {
63
- enabled: true,
64
- path: '/api/post-process',
65
- ...config?.api
66
- });
67
- await this.apiTrigger.initialize();
68
- }
69
- /**
70
- * Get webhook app for framework-specific mounting
71
- *
72
- * Returns an Express Application. For other frameworks,
73
- * use getWebhookRouter() to get the router instance.
74
- *
75
- * @example
76
- * ```typescript
77
- * // Express
78
- * app.use('/webhooks', integration.getWebhookApp());
79
- *
80
- * // Fastify
81
- * await fastify.register(integration.getWebhookRouter(), { prefix: '/webhooks' });
82
- *
83
- * // Koa
84
- * app.use(integration.getWebhookRouter().routes());
85
- * ```
86
- */
87
- getWebhookApp() {
88
- return this.webhookTrigger?.getApp() ?? null;
89
- }
90
- /**
91
- * Get webhook router (raw Express router)
92
- *
93
- * Useful for frameworks that need the router instance directly
94
- * rather than the full Express app.
95
- */
96
- getWebhookRouter() {
97
- return this.webhookTrigger?.getApp() ?? null;
98
- }
99
- /**
100
- * Get API trigger app for framework-specific mounting
101
- *
102
- * @example
103
- * ```typescript
104
- * // Express
105
- * app.use('/api/post-process', integration.getAPIApp());
106
- *
107
- * // Fastify
108
- * await fastify.register(integration.getAPIRouter(), { prefix: '/api/post-process' });
109
- * ```
110
- */
111
- getAPIApp() {
112
- return this.apiTrigger?.getApp() ?? null;
113
- }
114
- /**
115
- * Get API trigger router (raw Express router)
116
- *
117
- * Useful for frameworks that need the router instance directly.
118
- */
119
- getAPIRouter() {
120
- return this.apiTrigger?.getApp() ?? null;
121
- }
122
- /**
123
- * Manually trigger PostProcessor via API
124
- *
125
- * Convenience method for programmatic triggering without
126
- * going through the HTTP endpoint.
127
- *
128
- * @example
129
- * ```typescript
130
- * await integration.trigger({
131
- * tool: 'test',
132
- * operation: 'run',
133
- * reason: 'Manual test trigger'
134
- * });
135
- * ```
136
- */
137
- async trigger(options) {
138
- const context = {
139
- commitSha: `manual-${Date.now()}`,
140
- repository: '',
141
- branch: '',
142
- author: 'manual',
143
- files: [],
144
- trigger: 'manual',
145
- tool: options.tool,
146
- operation: options.operation,
147
- ...(options.filePath !== undefined ? { filePath: options.filePath } : {}),
148
- ...(options.directory !== undefined ? { directory: options.directory } : {}),
149
- };
150
- await this.postProcessor.executePostProcessorLoop(context);
151
- }
152
- /**
153
- * Shutdown all triggers
154
- */
155
- async shutdown() {
156
- if (this.webhookTrigger) {
157
- this.webhookTrigger.shutdown();
158
- }
159
- if (this.apiTrigger) {
160
- this.apiTrigger.shutdown();
161
- }
162
- }
163
- }
164
- /**
165
- * Factory function for easy integration setup
166
- *
167
- * @example
168
- * ```typescript
169
- * import { createXrayIntegration } from '0xray/integration';
170
- *
171
- * // With default configuration
172
- * const integration = createXrayIntegration(postProcessor);
173
- * await integration.initialize();
174
- *
175
- * // With custom configuration
176
- * const integration = createXrayIntegration(postProcessor);
177
- * await integration.initialize({
178
- * webhook: {
179
- * provider: 'gitlab',
180
- * secret: process.env.GITLAB_WEBHOOK_SECRET,
181
- * events: ['push', 'merge_request'],
182
- * path: '/webhooks/gitlab'
183
- * },
184
- * api: {
185
- * path: '/api/stray-trigger',
186
- * apiKey: process.env.API_KEY
187
- * }
188
- * });
189
- * ```
190
- */
191
- export function createXrayIntegration(postProcessor) {
192
- return new XrayIntegration(postProcessor);
193
- }
194
- // Backward compat aliases
@@ -1,2 +0,0 @@
1
- export { type MetamorphosisEngine, type MetamorphosisProposal } from '../../types/metamorphosis.js';
2
- export { SelfProposalEngine, type SelfProposalConfig } from './SelfProposalEngine.js';
@@ -1 +0,0 @@
1
- export { SelfProposalEngine } from './SelfProposalEngine.js';
@@ -1,49 +0,0 @@
1
- /**
2
- * Retry Handler for Redeploy Operations
3
- */
4
- export interface RetryConfig {
5
- maxRetries: number;
6
- baseDelay: number;
7
- backoffStrategy: "linear" | "exponential";
8
- }
9
- export interface RetryableError {
10
- type?: string;
11
- code?: string;
12
- statusCode?: number;
13
- }
14
- export declare class RetryHandler {
15
- private config;
16
- constructor(config?: RetryConfig);
17
- /**
18
- * Execute an operation with retry logic
19
- */
20
- executeWithRetry<T>(operation: () => Promise<T>, shouldRetry?: (error: RetryableError, attempt: number) => boolean): Promise<T>;
21
- /**
22
- * Calculate delay based on backoff strategy
23
- */
24
- private calculateDelay;
25
- /**
26
- * Wait for the specified duration
27
- */
28
- private wait;
29
- /**
30
- * Default retry conditions for deployment operations
31
- */
32
- static shouldRetryDeployment(error: RetryableError, attempt: number): boolean;
33
- /**
34
- * Specialized retry handler for deployment operations
35
- */
36
- executeDeploymentWithRetry<T>(deploymentOperation: () => Promise<T>): Promise<T>;
37
- /**
38
- * Specialized retry handler for API calls
39
- */
40
- executeApiCallWithRetry<T>(apiCall: () => Promise<T>): Promise<T>;
41
- /**
42
- * Get retry statistics
43
- */
44
- getStats(): {
45
- maxRetries: number;
46
- baseDelay: number;
47
- backoffStrategy: string;
48
- };
49
- }
@@ -1,118 +0,0 @@
1
- /**
2
- * Retry Handler for Redeploy Operations
3
- */
4
- import { frameworkLogger } from "../../core/framework-logger.js";
5
- export class RetryHandler {
6
- config;
7
- constructor(config = {
8
- maxRetries: 3,
9
- baseDelay: 30000,
10
- backoffStrategy: "exponential",
11
- }) {
12
- this.config = config;
13
- }
14
- /**
15
- * Execute an operation with retry logic
16
- */
17
- async executeWithRetry(operation, shouldRetry) {
18
- let lastError = {};
19
- for (let attempt = 0; attempt <= this.config.maxRetries; attempt++) {
20
- try {
21
- return await operation();
22
- }
23
- catch (error) {
24
- const retryable = error;
25
- lastError = retryable;
26
- // Don't retry on the last attempt
27
- if (attempt === this.config.maxRetries) {
28
- break;
29
- }
30
- // Check if we should retry this error
31
- if (shouldRetry && !shouldRetry(retryable, attempt)) {
32
- break;
33
- }
34
- // Calculate delay and wait
35
- const delay = this.calculateDelay(attempt);
36
- await frameworkLogger.log("-retry-handler", "-operation-failed-attempt-attempt-1-retrying-in-de", "error", {
37
- message: `⏳ Operation failed (attempt ${attempt + 1}), retrying in ${delay}ms...`,
38
- });
39
- await this.wait(delay);
40
- }
41
- }
42
- throw lastError;
43
- }
44
- /**
45
- * Calculate delay based on backoff strategy
46
- */
47
- calculateDelay(attempt) {
48
- const { baseDelay, backoffStrategy } = this.config;
49
- switch (backoffStrategy) {
50
- case "exponential":
51
- return baseDelay * Math.pow(2, attempt);
52
- case "linear":
53
- return baseDelay * (attempt + 1);
54
- default:
55
- return baseDelay;
56
- }
57
- }
58
- /**
59
- * Wait for the specified duration
60
- */
61
- async wait(duration) {
62
- return new Promise((resolve) => setTimeout(resolve, duration));
63
- }
64
- /**
65
- * Default retry conditions for deployment operations
66
- */
67
- static shouldRetryDeployment(error, attempt) {
68
- // Don't retry certain types of errors
69
- const nonRetryableErrors = [
70
- "authentication_failed",
71
- "authorization_failed",
72
- "invalid_configuration",
73
- "quota_exceeded",
74
- ];
75
- if (nonRetryableErrors.some((type) => error.type?.includes(type))) {
76
- return false;
77
- }
78
- // Don't retry after too many attempts for transient errors
79
- if (attempt >= 2 && error.type === "transient") {
80
- return false;
81
- }
82
- // Retry network and timeout errors
83
- if (error.code === "ECONNRESET" ||
84
- error.code === "ETIMEDOUT" ||
85
- error.code === "ENOTFOUND") {
86
- return true;
87
- }
88
- // Retry 5xx HTTP errors
89
- if (error.statusCode >= 500 && error.statusCode < 600) {
90
- return true;
91
- }
92
- // Default: retry for most errors
93
- return true;
94
- }
95
- /**
96
- * Specialized retry handler for deployment operations
97
- */
98
- async executeDeploymentWithRetry(deploymentOperation) {
99
- return this.executeWithRetry(deploymentOperation, RetryHandler.shouldRetryDeployment);
100
- }
101
- /**
102
- * Specialized retry handler for API calls
103
- */
104
- async executeApiCallWithRetry(apiCall) {
105
- return this.executeWithRetry(apiCall, (error, attempt) => {
106
- // Retry on network errors and 5xx status codes
107
- return (error.code === "ECONNRESET" ||
108
- error.code === "ETIMEDOUT" ||
109
- (error.statusCode >= 500 && error.statusCode < 600));
110
- });
111
- }
112
- /**
113
- * Get retry statistics
114
- */
115
- getStats() {
116
- return { ...this.config };
117
- }
118
- }
@@ -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,17 +0,0 @@
1
- import type { BeforeHookResult, AfterHookResult } from "../integrations/enforcement-gate.js";
2
- export interface XrayServiceConfig {
3
- enabled?: boolean;
4
- strictMode?: boolean;
5
- logLevel?: string;
6
- }
7
- export declare class XrayService {
8
- private config;
9
- private initialized;
10
- constructor(config?: XrayServiceConfig);
11
- init(): Promise<void>;
12
- beforeTool(tool: string, args: Record<string, unknown> | null, context?: {
13
- directory?: string;
14
- }): Promise<BeforeHookResult>;
15
- afterTool(tool: string, args: Record<string, unknown> | null, result: unknown, error?: string | null): Promise<AfterHookResult>;
16
- shutdown(): void;
17
- }
@@ -1,40 +0,0 @@
1
- import { frameworkLogger } from "../core/framework-logger.js";
2
- import { beforeToolHook, afterToolHook } from "../integrations/enforcement-gate.js";
3
- const defaultConfig = {
4
- enabled: true,
5
- strictMode: false,
6
- logLevel: "info",
7
- };
8
- export class XrayService {
9
- config;
10
- initialized = false;
11
- constructor(config) {
12
- this.config = { ...defaultConfig, ...config };
13
- }
14
- async init() {
15
- if (this.initialized)
16
- return;
17
- await frameworkLogger.log("XrayService", "init", "info", {
18
- message: "XrayService initialized",
19
- config: this.config,
20
- });
21
- this.initialized = true;
22
- }
23
- async beforeTool(tool, args, context) {
24
- if (!this.config.enabled) {
25
- return { allowed: true, blocked: false, violations: [], resonance: 1, duration: 0 };
26
- }
27
- const gateCtx = context ? { ...(context.directory ? { directory: context.directory } : {}) } : undefined;
28
- return beforeToolHook(tool, args, gateCtx);
29
- }
30
- async afterTool(tool, args, result, error = null) {
31
- if (!this.config.enabled) {
32
- return { processed: false, violations: [], processorResults: [], governanceTriggered: false, duration: 0 };
33
- }
34
- return afterToolHook(tool, args, result, error);
35
- }
36
- shutdown() {
37
- this.initialized = false;
38
- frameworkLogger.log("XrayService", "shutdown", "info", { message: "XrayService shut down" });
39
- }
40
- }
@@ -1,4 +0,0 @@
1
- export { XrayService } from "./XrayService.js";
2
- export type { XrayServiceConfig } from "./XrayService.js";
3
- export { beforeToolHook, afterToolHook } from "../integrations/enforcement-gate.js";
4
- export type { BeforeHookResult, AfterHookResult, GateViolation } from "../integrations/enforcement-gate.js";
@@ -1,2 +0,0 @@
1
- export { XrayService } from "./XrayService.js";
2
- export { beforeToolHook, afterToolHook } from "../integrations/enforcement-gate.js";
@@ -1,157 +0,0 @@
1
- /**
2
- * 0xRay Comprehensive Security Audit System
3
- *
4
- * Multi-agent security audit system with vulnerability scanning,
5
- * automated remediation, compliance checking, and weighted voting
6
- * for architectural decisions.
7
- *
8
- */
9
- export type SeverityLevel = "critical" | "high" | "medium" | "low" | "info";
10
- export type ComplianceStandard = "owasp-top-10" | "cwe" | "nist" | "iso-27001" | "pci-dss";
11
- export interface Vulnerability {
12
- id: string;
13
- title: string;
14
- severity: SeverityLevel;
15
- category: VulnerabilityCategory;
16
- cwe: string;
17
- owasp?: string | undefined;
18
- file: string;
19
- line: number;
20
- column?: number | undefined;
21
- description: string;
22
- impact: string;
23
- recommendation: string;
24
- codeSnippet: string;
25
- confidence: number;
26
- autoRemediation?: RemediationStep[] | undefined;
27
- }
28
- export type VulnerabilityCategory = "injection" | "authentication" | "authorization" | "cryptography" | "configuration" | "data-protection" | "input-validation" | "sensitive-data-exposure" | "security-misconfiguration" | "dependency-vulnerability";
29
- export interface RemediationStep {
30
- step: number;
31
- action: string;
32
- code?: string | undefined;
33
- file?: string | undefined;
34
- line?: number | undefined;
35
- estimatedEffort: "low" | "medium" | "high";
36
- automated: boolean;
37
- }
38
- export interface SecurityAuditConfig {
39
- projectPath: string;
40
- scanDepth?: "shallow" | "medium" | "deep";
41
- includeDependencies?: boolean;
42
- complianceStandards?: ComplianceStandard[];
43
- enableAutoRemediation?: boolean;
44
- enableWeightedVoting?: boolean;
45
- agentWeights?: Record<string, number>;
46
- outputPath?: string | undefined;
47
- }
48
- export interface WeightedVote {
49
- agentId: string;
50
- agentName: string;
51
- vote: "approve" | "reject" | "abstain";
52
- weight: number;
53
- reasoning: string;
54
- concerns?: string[] | undefined;
55
- }
56
- export interface ArchitecturalDecision {
57
- id: string;
58
- title: string;
59
- description: string;
60
- proposedBy: string;
61
- votes: WeightedVote[];
62
- finalDecision: "approved" | "rejected" | "needs-revision";
63
- approvedBy: WeightedVote[];
64
- rejectedBy: WeightedVote[];
65
- timestamp: Date;
66
- }
67
- export interface ComplianceResult {
68
- standard: ComplianceStandard;
69
- passed: boolean;
70
- score: number;
71
- findings: Vulnerability[];
72
- recommendations: string[];
73
- }
74
- export interface SecurityAuditReport {
75
- metadata: {
76
- auditId: string;
77
- timestamp: Date;
78
- projectPath: string;
79
- totalFilesScanned: number;
80
- duration: number;
81
- };
82
- summary: {
83
- totalVulnerabilities: number;
84
- bySeverity: Record<SeverityLevel, number>;
85
- byCategory: Record<VulnerabilityCategory, number>;
86
- securityScore: number;
87
- complianceScore: number;
88
- };
89
- vulnerabilities: Vulnerability[];
90
- compliance: ComplianceResult[];
91
- remediation: {
92
- totalIssues: number;
93
- automatable: number;
94
- manualRequired: number;
95
- estimatedFixTime: string;
96
- prioritizedFixes: RemediationPlan[];
97
- };
98
- architecturalDecisions: ArchitecturalDecision[];
99
- agentConsensus: {
100
- participatingAgents: string[];
101
- averageAgreement: number;
102
- contentiousIssues: Vulnerability[];
103
- } | undefined;
104
- }
105
- export interface RemediationPlan {
106
- vulnerabilityId: string;
107
- title: string;
108
- severity: SeverityLevel;
109
- priority: number;
110
- steps: RemediationStep[];
111
- dependencies: string[];
112
- estimatedTime: string;
113
- }
114
- export declare class ComprehensiveSecurityAuditSystem {
115
- private config;
116
- private vulnerabilities;
117
- private architecturalDecisions;
118
- private agentVotes;
119
- private readonly severityWeights;
120
- private readonly defaultAgentWeights;
121
- private readonly dangerousPatterns;
122
- constructor(config: SecurityAuditConfig);
123
- runAudit(): Promise<SecurityAuditReport>;
124
- private getProjectFiles;
125
- private auditFile;
126
- private createVulnerability;
127
- private isFalsePositive;
128
- private auditImports;
129
- private auditDependencies;
130
- private checkCompliance;
131
- private evaluateStandard;
132
- private evaluateOWASP;
133
- private evaluateCWE;
134
- private evaluateNIST;
135
- private evaluateISO27001;
136
- private evaluatePCIDSS;
137
- private groupByCategory;
138
- private generateRemediationPlan;
139
- private prioritizeFixes;
140
- private estimateFixTime;
141
- private estimateFixTimeForVuln;
142
- private calculateSummary;
143
- private collectAgentVotes;
144
- private simulateAgentVote;
145
- private resolveArchitecturalDecisions;
146
- private calculateAgentConsensus;
147
- private saveReport;
148
- generateMarkdownReport(report: SecurityAuditReport): string;
149
- private getScoreEmoji;
150
- private getSeverityEmoji;
151
- addVote(vote: WeightedVote): void;
152
- getVulnerabilities(): Vulnerability[];
153
- getArchitecturalDecisions(): ArchitecturalDecision[];
154
- }
155
- export declare function createSecurityAuditSystem(config: SecurityAuditConfig): ComprehensiveSecurityAuditSystem;
156
- export declare function runQuickSecurityAudit(projectPath: string): Promise<SecurityAuditReport>;
157
- export declare function runDeepSecurityAudit(projectPath: string, outputPath?: string): Promise<SecurityAuditReport>;