0xray 4.0.34 → 4.0.36
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.
- package/.grok-plugin/plugin.json +1 -1
- package/.xray/codex.json +12 -4
- package/.xray/features.json +1 -1
- package/AGENTS-consumer.md +6 -6
- package/AGENTS.md +5 -5
- package/README.md +2 -2
- package/dist/AGENTS.md +5 -5
- package/dist/CHANGELOG.md +26 -0
- package/dist/README.md +2 -2
- package/dist/cli/index.js +2 -5
- package/dist/governance/governance-service.js +1 -1
- package/dist/integrations/base/README.md +1 -9
- package/dist/integrations/base/index.d.ts +0 -1
- package/dist/integrations/base/index.js +0 -2
- package/dist/integrations/governance/index.js +31 -8
- package/dist/integrations/grok/hooks/grok-hook-utils.js +1 -1
- package/dist/integrations/grok/hooks/session-start.js +12 -0
- package/dist/integrations/grok/plugin/0xray/hooks/hooks.json +6 -6
- package/dist/integrations/hooks/goggles-mcp.mjs +10 -3
- package/dist/integrations/hooks/goggles-pipeline.mjs +110 -23
- package/dist/integrations/hooks/host-truth.mjs +74 -0
- package/dist/integrations/hooks/station-hook-runtime.cjs +3 -0
- package/dist/integrations/openclaw/plugin/xray-pre-tool/package.json +1 -1
- package/dist/mcps/knowledge-skills/storyteller.server.js +0 -1
- package/dist/nucleus/delegation-gate.d.ts +2 -2
- package/dist/nucleus/delegation-gate.js +13 -2
- package/dist/nucleus/work-freshness.mjs +189 -0
- package/dist/processors/implementations/agents-md-validation-processor.js +1 -1
- package/docs-site/docs/plates/boot.md +17 -2
- package/docs-site/docs/plates/governance.md +3 -2
- package/docs-site/docs/plates/index.md +3 -1
- package/docs-site/docs/plates/memory-recall.md +26 -35
- package/docs-site/docs/plates/orchestration.md +39 -35
- package/docs-site/docs/plates/processor.md +34 -36
- package/docs-site/docs/plates/reporting.md +3 -8
- package/docs-site/docs/plates/routing.md +22 -11
- package/package.json +3 -2
- package/scripts/foundry/release.mjs +48 -5
- package/scripts/mjs/run-grok-hook.mjs +50 -0
- package/scripts/mjs/test-consumer-readiness.mjs +1 -0
- package/scripts/mjs/test-mcp-functionality.mjs +14 -9
- package/scripts/node/basic-security-audit.cjs +0 -1
- package/scripts/node/bridge-mcp-wiring.cjs +66 -3
- package/scripts/node/install-bridges.cjs +3 -3
- package/scripts/node/postinstall.cjs +1 -1
- package/scripts/node/prepare-consumer.cjs +11 -7
- package/scripts/node/setup-dev.cjs +18 -26
- package/scripts/node/validate-mcp-connectivity.js +2 -1
- package/src/integrations/grok/plugin/0xray/hooks/hooks.json +6 -6
- package/src/integrations/openclaw/plugin/xray-pre-tool/package.json +1 -1
- package/src/mcps/knowledge-skills/storyteller.server.ts +0 -1
- package/xray/agents_template.md +5 -5
- package/xray/codex.json +12 -4
- package/xray/features.json +1 -1
- package/dist/agents/known-names.d.ts +0 -26
- package/dist/agents/known-names.js +0 -72
- package/dist/analytics/consent-manager.d.ts +0 -92
- package/dist/analytics/consent-manager.js +0 -257
- package/dist/benchmark/performance-benchmark.d.ts +0 -103
- package/dist/benchmark/performance-benchmark.js +0 -373
- package/dist/cli/commands/analytics-disable.d.ts +0 -9
- package/dist/cli/commands/analytics-disable.js +0 -72
- package/dist/cli/commands/analytics-enable-action.d.ts +0 -8
- package/dist/cli/commands/analytics-enable-action.js +0 -82
- package/dist/cli/commands/analytics-preview.d.ts +0 -9
- package/dist/cli/commands/analytics-preview.js +0 -106
- package/dist/cli/commands/analytics-status.d.ts +0 -9
- package/dist/cli/commands/analytics-status.js +0 -68
- package/dist/cli/commands/enforce.d.ts +0 -12
- package/dist/cli/commands/enforce.js +0 -78
- package/dist/cli/commands/govern.d.ts +0 -29
- package/dist/cli/commands/govern.js +0 -149
- package/dist/cli/commands/security-audit.d.ts +0 -23
- package/dist/cli/commands/security-audit.js +0 -219
- package/dist/cli/server.d.ts +0 -1
- package/dist/cli/server.js +0 -147
- package/dist/config/routing-mappings.d.ts +0 -26
- package/dist/config/routing-mappings.js +0 -151
- package/dist/core/bridge.mjs +0 -922
- package/dist/core/trace-context.d.ts +0 -12
- package/dist/core/trace-context.js +0 -33
- package/dist/enforcement/index.d.ts +0 -22
- package/dist/enforcement/index.js +0 -40
- package/dist/enforcement/loaders/index.d.ts +0 -36
- package/dist/enforcement/loaders/index.js +0 -39
- package/dist/enforcement/test-auto-healing.d.ts +0 -83
- package/dist/enforcement/test-auto-healing.js +0 -325
- package/dist/inference/index.d.ts +0 -10
- package/dist/inference/index.js +0 -5
- package/dist/infrastructure/iac-validator.d.ts +0 -150
- package/dist/infrastructure/iac-validator.js +0 -465
- package/dist/infrastructure/schemas/cloud-schemas.d.ts +0 -482
- package/dist/infrastructure/schemas/cloud-schemas.js +0 -488
- package/dist/integrations/base/ExampleIntegration.d.ts +0 -46
- package/dist/integrations/base/ExampleIntegration.js +0 -180
- package/dist/integrations/enforcement-gate.d.ts +0 -44
- package/dist/integrations/enforcement-gate.js +0 -348
- package/dist/mcps/connection/connection-manager.d.ts +0 -39
- package/dist/mcps/connection/connection-manager.js +0 -79
- package/dist/mcps/index.d.ts +0 -17
- package/dist/mcps/index.js +0 -65
- package/dist/mcps/orchestrator/index.d.ts +0 -6
- package/dist/mcps/orchestrator/index.js +0 -5
- package/dist/metrics/index.d.ts +0 -6
- package/dist/metrics/index.js +0 -6
- package/dist/orchestrator/self-direction-activation.d.ts +0 -108
- package/dist/orchestrator/self-direction-activation.js +0 -244
- package/dist/orchestrator/universal-registry-bridge.d.ts +0 -84
- package/dist/orchestrator/universal-registry-bridge.js +0 -246
- package/dist/performance/performance-budget-enforcer.d.ts +0 -157
- package/dist/performance/performance-budget-enforcer.js +0 -433
- package/dist/performance/performance-regression-tester.d.ts +0 -107
- package/dist/performance/performance-regression-tester.js +0 -341
- package/dist/postprocessor/analysis/CodeChangeAnalyzer.d.ts +0 -11
- package/dist/postprocessor/analysis/CodeChangeAnalyzer.js +0 -50
- package/dist/postprocessor/config/ProcessorConfigLoader.d.ts +0 -44
- package/dist/postprocessor/config/ProcessorConfigLoader.js +0 -16
- package/dist/postprocessor/integration.d.ts +0 -156
- package/dist/postprocessor/integration.js +0 -194
- package/dist/postprocessor/metamorphosis/index.d.ts +0 -2
- package/dist/postprocessor/metamorphosis/index.js +0 -1
- package/dist/postprocessor/redeploy/RetryHandler.d.ts +0 -49
- package/dist/postprocessor/redeploy/RetryHandler.js +0 -118
- package/dist/processors/implementations/session-capture-processor.d.ts +0 -14
- package/dist/processors/implementations/session-capture-processor.js +0 -37
- package/dist/public/XrayService.d.ts +0 -17
- package/dist/public/XrayService.js +0 -40
- package/dist/public/index.d.ts +0 -4
- package/dist/public/index.js +0 -2
- package/dist/security/comprehensive-security-audit.d.ts +0 -157
- package/dist/security/comprehensive-security-audit.js +0 -1004
- package/dist/security/index.d.ts +0 -13
- package/dist/security/index.js +0 -13
- package/dist/security/security-agent-coordinator.d.ts +0 -71
- package/dist/security/security-agent-coordinator.js +0 -203
- package/dist/security/security-hardening-system.d.ts +0 -238
- package/dist/security/security-hardening-system.js +0 -726
- package/dist/security/security-orchestration-layer.d.ts +0 -118
- package/dist/security/security-orchestration-layer.js +0 -495
- package/dist/testing/memory-regression-suite.d.ts +0 -105
- package/dist/testing/memory-regression-suite.js +0 -258
- package/dist/tools/assess-complexity-tool.d.ts +0 -28
- package/dist/tools/assess-complexity-tool.js +0 -44
- package/dist/tools/query-routing-tool.d.ts +0 -17
- package/dist/tools/query-routing-tool.js +0 -59
- package/dist/utils/batch-operations.d.ts +0 -25
- package/dist/utils/batch-operations.js +0 -292
- package/dist/utils/task-graph.d.ts +0 -29
- package/dist/utils/task-graph.js +0 -106
- package/dist/utils/test-template-generator.d.ts +0 -25
- package/dist/utils/test-template-generator.js +0 -178
- package/dist/utils/token-manager.d.ts +0 -48
- package/dist/utils/token-manager.js +0 -163
- package/dist/validation/agent-config-validator.d.ts +0 -110
- package/dist/validation/agent-config-validator.js +0 -280
- package/dist/validation/orchestration-flow-validator.d.ts +0 -87
- package/dist/validation/orchestration-flow-validator.js +0 -606
- package/src/mcps/connection/connection-manager.ts +0 -91
- package/src/mcps/index.ts +0 -80
- package/src/mcps/orchestrator/index.ts +0 -29
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface TraceContext {
|
|
2
|
-
traceId: string;
|
|
3
|
-
parentId?: string;
|
|
4
|
-
operation: string;
|
|
5
|
-
governanceApproved: boolean;
|
|
6
|
-
startTime: number;
|
|
7
|
-
metadata?: Record<string, any>;
|
|
8
|
-
}
|
|
9
|
-
export declare function startTrace(operation: string, metadata?: Record<string, any>): TraceContext;
|
|
10
|
-
export declare function getCurrentTrace(): TraceContext | null;
|
|
11
|
-
export declare function endTrace(approved?: boolean): void;
|
|
12
|
-
export declare function propagateTrace(childOperation: string): TraceContext | null;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// src/core/trace-context.ts
|
|
2
|
-
// Centralized trace propagation
|
|
3
|
-
let currentTrace = null;
|
|
4
|
-
function generateId() {
|
|
5
|
-
if (typeof crypto !== 'undefined' && crypto.randomUUID) {
|
|
6
|
-
return crypto.randomUUID();
|
|
7
|
-
}
|
|
8
|
-
return Date.now().toString(36) + Math.random().toString(36).substring(2);
|
|
9
|
-
}
|
|
10
|
-
export function startTrace(operation, metadata) {
|
|
11
|
-
const trace = {
|
|
12
|
-
traceId: generateId(),
|
|
13
|
-
operation,
|
|
14
|
-
governanceApproved: false,
|
|
15
|
-
startTime: Date.now(),
|
|
16
|
-
metadata: metadata || {}
|
|
17
|
-
};
|
|
18
|
-
currentTrace = trace;
|
|
19
|
-
return trace;
|
|
20
|
-
}
|
|
21
|
-
export function getCurrentTrace() {
|
|
22
|
-
return currentTrace;
|
|
23
|
-
}
|
|
24
|
-
export function endTrace(approved = true) {
|
|
25
|
-
if (currentTrace)
|
|
26
|
-
currentTrace.governanceApproved = approved;
|
|
27
|
-
currentTrace = null;
|
|
28
|
-
}
|
|
29
|
-
export function propagateTrace(childOperation) {
|
|
30
|
-
if (!currentTrace)
|
|
31
|
-
return null;
|
|
32
|
-
return { ...currentTrace, parentId: currentTrace.traceId, operation: childOperation, startTime: Date.now() };
|
|
33
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rule Enforcement Module
|
|
3
|
-
*
|
|
4
|
-
* This module provides rule enforcement capabilities for the 0xRay framework.
|
|
5
|
-
* It validates code against development rules and codex compliance requirements.
|
|
6
|
-
*
|
|
7
|
-
* @module enforcement
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* import { RuleEnforcer, RuleDefinition, ValidationReport } from './enforcement/index.js';
|
|
12
|
-
*
|
|
13
|
-
* const enforcer = new RuleEnforcer();
|
|
14
|
-
* const report = await enforcer.validateOperation('write', context);
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export { RuleEnforcer } from "./rule-enforcer.js";
|
|
18
|
-
export { RuleRegistry, RuleHierarchy, RuleExecutor, ViolationFixer, } from "./core/index.js";
|
|
19
|
-
export { RuleDefinition, RuleValidationContext, RuleValidationResult, ValidationReport, Violation, ViolationFix, RuleFix, RuleCategory, RuleSeverity, RuleFixType, IRuleRegistry, IValidator, IValidatorRegistry, IRuleHierarchy, IRuleExecutor, IViolationFixer, ExecutionOptions, BatchExecutionOptions, FixStrategy, isRuleValidationResult, } from "./types.js";
|
|
20
|
-
export { BaseValidator, ValidatorRegistry, globalValidatorRegistry, NoDuplicateCodeValidator, ContextAnalysisIntegrationValidator, MemoryOptimizationValidator, DocumentationRequiredValidator, NoOverEngineeringValidator, CleanDebugLogsValidator, ConsoleLogUsageValidator, } from "./validators/index.js";
|
|
21
|
-
export { BaseLoader, CodexLoader, AgentTriageLoader, ProcessorLoader, AgentsMdValidationLoader, LoaderOrchestrator, type LoaderOrchestratorOptions, type LoaderOrchestratorResult, } from "./loaders/index.js";
|
|
22
|
-
export * as enforcerTools from "./enforcer-tools.js";
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rule Enforcement Module
|
|
3
|
-
*
|
|
4
|
-
* This module provides rule enforcement capabilities for the 0xRay framework.
|
|
5
|
-
* It validates code against development rules and codex compliance requirements.
|
|
6
|
-
*
|
|
7
|
-
* @module enforcement
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* import { RuleEnforcer, RuleDefinition, ValidationReport } from './enforcement/index.js';
|
|
12
|
-
*
|
|
13
|
-
* const enforcer = new RuleEnforcer();
|
|
14
|
-
* const report = await enforcer.validateOperation('write', context);
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
// Core enforcer
|
|
18
|
-
export { RuleEnforcer } from "./rule-enforcer.js";
|
|
19
|
-
// Core components (Phase 5 refactoring)
|
|
20
|
-
export { RuleRegistry, RuleHierarchy, RuleExecutor, ViolationFixer, } from "./core/index.js";
|
|
21
|
-
// All types
|
|
22
|
-
export { isRuleValidationResult, } from "./types.js";
|
|
23
|
-
// Validators (Phase 3 refactoring)
|
|
24
|
-
export {
|
|
25
|
-
// Base class
|
|
26
|
-
BaseValidator,
|
|
27
|
-
// Registry
|
|
28
|
-
ValidatorRegistry, globalValidatorRegistry,
|
|
29
|
-
// Code quality validators
|
|
30
|
-
NoDuplicateCodeValidator, ContextAnalysisIntegrationValidator, MemoryOptimizationValidator, DocumentationRequiredValidator, NoOverEngineeringValidator, CleanDebugLogsValidator, ConsoleLogUsageValidator, } from "./validators/index.js";
|
|
31
|
-
// Loaders (Phase 4 refactoring)
|
|
32
|
-
export {
|
|
33
|
-
// Base loader
|
|
34
|
-
BaseLoader,
|
|
35
|
-
// Concrete loaders
|
|
36
|
-
CodexLoader, AgentTriageLoader, ProcessorLoader, AgentsMdValidationLoader,
|
|
37
|
-
// Orchestrator
|
|
38
|
-
LoaderOrchestrator, } from "./loaders/index.js";
|
|
39
|
-
// Enforcer tools (if any exports exist)
|
|
40
|
-
export * as enforcerTools from "./enforcer-tools.js";
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rule Loaders Module
|
|
3
|
-
*
|
|
4
|
-
* This module provides rule loading capabilities for the 0xRay framework.
|
|
5
|
-
* Loaders encapsulate the logic for loading rules from various sources.
|
|
6
|
-
*
|
|
7
|
-
* Phase 4 refactoring: Extracted async rule loading from RuleEnforcer
|
|
8
|
-
*
|
|
9
|
-
* @module loaders
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* import {
|
|
14
|
-
* LoaderOrchestrator,
|
|
15
|
-
* CodexLoader,
|
|
16
|
-
* AgentTriageLoader,
|
|
17
|
-
* IRuleLoader
|
|
18
|
-
* } from './enforcement/loaders/index.js';
|
|
19
|
-
*
|
|
20
|
-
* // Use the orchestrator to load all rules
|
|
21
|
-
* const orchestrator = new LoaderOrchestrator();
|
|
22
|
-
* const result = await orchestrator.loadAllRules();
|
|
23
|
-
*
|
|
24
|
-
* // Or use individual loaders
|
|
25
|
-
* const codexLoader = new CodexLoader();
|
|
26
|
-
* if (await codexLoader.isAvailable()) {
|
|
27
|
-
* const codexRules = await codexLoader.load();
|
|
28
|
-
* }
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export { BaseLoader } from "./base-loader.js";
|
|
32
|
-
export { CodexLoader } from "./codex-loader.js";
|
|
33
|
-
export { AgentTriageLoader } from "./agent-triage-loader.js";
|
|
34
|
-
export { ProcessorLoader } from "./processor-loader.js";
|
|
35
|
-
export { AgentsMdValidationLoader } from "./agents-md-validation-loader.js";
|
|
36
|
-
export { LoaderOrchestrator, type LoaderOrchestratorOptions, type LoaderOrchestratorResult, } from "./loader-orchestrator.js";
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Rule Loaders Module
|
|
3
|
-
*
|
|
4
|
-
* This module provides rule loading capabilities for the 0xRay framework.
|
|
5
|
-
* Loaders encapsulate the logic for loading rules from various sources.
|
|
6
|
-
*
|
|
7
|
-
* Phase 4 refactoring: Extracted async rule loading from RuleEnforcer
|
|
8
|
-
*
|
|
9
|
-
* @module loaders
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* import {
|
|
14
|
-
* LoaderOrchestrator,
|
|
15
|
-
* CodexLoader,
|
|
16
|
-
* AgentTriageLoader,
|
|
17
|
-
* IRuleLoader
|
|
18
|
-
* } from './enforcement/loaders/index.js';
|
|
19
|
-
*
|
|
20
|
-
* // Use the orchestrator to load all rules
|
|
21
|
-
* const orchestrator = new LoaderOrchestrator();
|
|
22
|
-
* const result = await orchestrator.loadAllRules();
|
|
23
|
-
*
|
|
24
|
-
* // Or use individual loaders
|
|
25
|
-
* const codexLoader = new CodexLoader();
|
|
26
|
-
* if (await codexLoader.isAvailable()) {
|
|
27
|
-
* const codexRules = await codexLoader.load();
|
|
28
|
-
* }
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
// Base loader
|
|
32
|
-
export { BaseLoader } from "./base-loader.js";
|
|
33
|
-
// Concrete loaders
|
|
34
|
-
export { CodexLoader } from "./codex-loader.js";
|
|
35
|
-
export { AgentTriageLoader } from "./agent-triage-loader.js";
|
|
36
|
-
export { ProcessorLoader } from "./processor-loader.js";
|
|
37
|
-
export { AgentsMdValidationLoader } from "./agents-md-validation-loader.js";
|
|
38
|
-
// Orchestrator
|
|
39
|
-
export { LoaderOrchestrator, } from "./loader-orchestrator.js";
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test Auto-Healing System for 0xRay Framework
|
|
3
|
-
*
|
|
4
|
-
* Automatically detects slow/failing tests and orchestrates fixes using specialized agents
|
|
5
|
-
* Implements intelligent test optimization and refactoring for enterprise reliability
|
|
6
|
-
*/
|
|
7
|
-
import { RuleValidationContext } from "./rule-enforcer.js";
|
|
8
|
-
export interface TestFailureAnalysis {
|
|
9
|
-
testFile: string;
|
|
10
|
-
failureType: "timeout" | "performance" | "logic-error" | "flaky" | "infrastructure";
|
|
11
|
-
rootCause: string;
|
|
12
|
-
severity: "low" | "medium" | "high" | "critical";
|
|
13
|
-
estimatedFixTime: number;
|
|
14
|
-
autoFixable: boolean;
|
|
15
|
-
recommendedAgent: string;
|
|
16
|
-
fixStrategy: TestFixStrategy;
|
|
17
|
-
}
|
|
18
|
-
export interface TestFixStrategy {
|
|
19
|
-
type: "refactor" | "optimize" | "parallelize" | "mock" | "isolate" | "infrastructure";
|
|
20
|
-
description: string;
|
|
21
|
-
estimatedImprovement: number;
|
|
22
|
-
riskLevel: "low" | "medium" | "high";
|
|
23
|
-
requiresAgentCoordination: boolean;
|
|
24
|
-
}
|
|
25
|
-
export interface AutoHealingResult {
|
|
26
|
-
success: boolean;
|
|
27
|
-
fixesApplied: number;
|
|
28
|
-
testsOptimized: number;
|
|
29
|
-
performanceImprovement: number;
|
|
30
|
-
agentCoordinationUsed: boolean;
|
|
31
|
-
recommendations: string[];
|
|
32
|
-
nextSteps: string[];
|
|
33
|
-
}
|
|
34
|
-
export interface TestResults {
|
|
35
|
-
timedOut?: boolean;
|
|
36
|
-
executionTime?: number;
|
|
37
|
-
file?: string;
|
|
38
|
-
failed?: number;
|
|
39
|
-
}
|
|
40
|
-
export declare class TestAutoHealingSystem {
|
|
41
|
-
private healingHistory;
|
|
42
|
-
/**
|
|
43
|
-
* Main auto-healing entry point for test failures
|
|
44
|
-
*/
|
|
45
|
-
healTestFailures(testResults: TestResults, context: RuleValidationContext): Promise<AutoHealingResult>;
|
|
46
|
-
/**
|
|
47
|
-
* Analyze test failures and determine root causes
|
|
48
|
-
*/
|
|
49
|
-
private analyzeTestFailures;
|
|
50
|
-
/**
|
|
51
|
-
* Apply automatic fixes for simple issues
|
|
52
|
-
*/
|
|
53
|
-
private applyAutomaticFixes;
|
|
54
|
-
/**
|
|
55
|
-
* Coordinate with specialized agents for complex fixes
|
|
56
|
-
*/
|
|
57
|
-
private coordinateAgentFixes;
|
|
58
|
-
/**
|
|
59
|
-
* Optimize test timeouts automatically
|
|
60
|
-
*/
|
|
61
|
-
private optimizeTestTimeouts;
|
|
62
|
-
/**
|
|
63
|
-
* Implement parallel test execution
|
|
64
|
-
*/
|
|
65
|
-
private implementParallelExecution;
|
|
66
|
-
/**
|
|
67
|
-
* Add mocks to speed up tests
|
|
68
|
-
*/
|
|
69
|
-
private addTestMocks;
|
|
70
|
-
/**
|
|
71
|
-
* Invoke specialized agents for complex fixes
|
|
72
|
-
*/
|
|
73
|
-
private invokeSpecializedAgent;
|
|
74
|
-
/**
|
|
75
|
-
* Detect flaky tests based on inconsistent results
|
|
76
|
-
*/
|
|
77
|
-
private detectFlakyTests;
|
|
78
|
-
/**
|
|
79
|
-
* Prioritize issues for fixing
|
|
80
|
-
*/
|
|
81
|
-
private prioritizeIssues;
|
|
82
|
-
}
|
|
83
|
-
export declare const testAutoHealingSystem: TestAutoHealingSystem;
|
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test Auto-Healing System for 0xRay Framework
|
|
3
|
-
*
|
|
4
|
-
* Automatically detects slow/failing tests and orchestrates fixes using specialized agents
|
|
5
|
-
* Implements intelligent test optimization and refactoring for enterprise reliability
|
|
6
|
-
*/
|
|
7
|
-
import { frameworkLogger } from "../core/framework-logger.js";
|
|
8
|
-
export class TestAutoHealingSystem {
|
|
9
|
-
healingHistory = new Map();
|
|
10
|
-
/**
|
|
11
|
-
* Main auto-healing entry point for test failures
|
|
12
|
-
*/
|
|
13
|
-
async healTestFailures(testResults, context) {
|
|
14
|
-
const jobId = `test-healing-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
|
|
15
|
-
const startTime = Date.now();
|
|
16
|
-
frameworkLogger.log("test-auto-healing", "healing-start", "info", {
|
|
17
|
-
jobId,
|
|
18
|
-
testFiles: context.tests?.length || 0,
|
|
19
|
-
operation: context.operation,
|
|
20
|
-
});
|
|
21
|
-
try {
|
|
22
|
-
// Step 1: Analyze test failures
|
|
23
|
-
const failureAnalysis = await this.analyzeTestFailures(testResults, context);
|
|
24
|
-
// Step 2: Prioritize and filter auto-fixable issues
|
|
25
|
-
const autoFixableIssues = failureAnalysis.filter((analysis) => analysis.autoFixable);
|
|
26
|
-
const prioritizedIssues = this.prioritizeIssues(autoFixableIssues);
|
|
27
|
-
// Step 3: Apply automatic fixes
|
|
28
|
-
const healingResult = await this.applyAutomaticFixes(prioritizedIssues, context, jobId);
|
|
29
|
-
// Step 4: Coordinate with agents for complex fixes
|
|
30
|
-
const agentCoordination = await this.coordinateAgentFixes(failureAnalysis.filter((analysis) => !analysis.autoFixable), context, jobId);
|
|
31
|
-
// Step 5: Generate final report
|
|
32
|
-
const result = {
|
|
33
|
-
success: healingResult.success && agentCoordination.success,
|
|
34
|
-
fixesApplied: healingResult.fixesApplied + agentCoordination.fixesApplied,
|
|
35
|
-
testsOptimized: healingResult.testsOptimized + agentCoordination.testsOptimized,
|
|
36
|
-
performanceImprovement: healingResult.performanceImprovement +
|
|
37
|
-
agentCoordination.performanceImprovement,
|
|
38
|
-
agentCoordinationUsed: agentCoordination.agentsUsed.length > 0,
|
|
39
|
-
recommendations: [
|
|
40
|
-
...healingResult.recommendations,
|
|
41
|
-
...agentCoordination.recommendations,
|
|
42
|
-
],
|
|
43
|
-
nextSteps: [...healingResult.nextSteps, ...agentCoordination.nextSteps],
|
|
44
|
-
};
|
|
45
|
-
const duration = Date.now() - startTime;
|
|
46
|
-
frameworkLogger.log("test-auto-healing", "healing-complete", "success", {
|
|
47
|
-
jobId,
|
|
48
|
-
duration,
|
|
49
|
-
fixesApplied: result.fixesApplied,
|
|
50
|
-
performanceImprovement: result.performanceImprovement,
|
|
51
|
-
success: result.success,
|
|
52
|
-
});
|
|
53
|
-
return result;
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
frameworkLogger.log("test-auto-healing", "healing-error", "error", {
|
|
57
|
-
jobId,
|
|
58
|
-
error: error instanceof Error
|
|
59
|
-
? error.message
|
|
60
|
-
: `Unknown error: ${String(error)}`,
|
|
61
|
-
operation: context.operation,
|
|
62
|
-
});
|
|
63
|
-
return {
|
|
64
|
-
success: false,
|
|
65
|
-
fixesApplied: 0,
|
|
66
|
-
testsOptimized: 0,
|
|
67
|
-
performanceImprovement: 0,
|
|
68
|
-
agentCoordinationUsed: false,
|
|
69
|
-
recommendations: ["Manual review required - auto-healing failed"],
|
|
70
|
-
nextSteps: ["Review error logs and fix underlying issues"],
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Analyze test failures and determine root causes
|
|
76
|
-
*/
|
|
77
|
-
async analyzeTestFailures(testResults, context) {
|
|
78
|
-
const analyses = [];
|
|
79
|
-
// Analyze timeout failures (Codex Term #45)
|
|
80
|
-
if (testResults.timedOut) {
|
|
81
|
-
analyses.push({
|
|
82
|
-
testFile: testResults.file || "unknown",
|
|
83
|
-
failureType: "timeout",
|
|
84
|
-
rootCause: "Test execution exceeded timeout limits",
|
|
85
|
-
severity: "high",
|
|
86
|
-
estimatedFixTime: 15,
|
|
87
|
-
autoFixable: true,
|
|
88
|
-
recommendedAgent: "testing-lead",
|
|
89
|
-
fixStrategy: {
|
|
90
|
-
type: "optimize",
|
|
91
|
-
description: "Optimize test execution time through parallelization and mocking",
|
|
92
|
-
estimatedImprovement: 60,
|
|
93
|
-
riskLevel: "low",
|
|
94
|
-
requiresAgentCoordination: false,
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
// Analyze performance issues
|
|
99
|
-
if ((testResults.executionTime ?? 0) > 300000) {
|
|
100
|
-
// 5 minutes
|
|
101
|
-
analyses.push({
|
|
102
|
-
testFile: testResults.file || "unknown",
|
|
103
|
-
failureType: "performance",
|
|
104
|
-
rootCause: "Test suite execution too slow",
|
|
105
|
-
severity: "medium",
|
|
106
|
-
estimatedFixTime: 30,
|
|
107
|
-
autoFixable: true,
|
|
108
|
-
recommendedAgent: "refactorer",
|
|
109
|
-
fixStrategy: {
|
|
110
|
-
type: "parallelize",
|
|
111
|
-
description: "Implement parallel test execution and optimize slow tests",
|
|
112
|
-
estimatedImprovement: 70,
|
|
113
|
-
riskLevel: "medium",
|
|
114
|
-
requiresAgentCoordination: true,
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
// Analyze flaky tests
|
|
119
|
-
const flakyTests = this.detectFlakyTests(testResults);
|
|
120
|
-
for (const flakyTest of flakyTests) {
|
|
121
|
-
analyses.push({
|
|
122
|
-
testFile: flakyTest.file,
|
|
123
|
-
failureType: "flaky",
|
|
124
|
-
rootCause: `Test ${flakyTest.name} is flaky - inconsistent results`,
|
|
125
|
-
severity: "medium",
|
|
126
|
-
estimatedFixTime: 20,
|
|
127
|
-
autoFixable: false,
|
|
128
|
-
recommendedAgent: "bug-triage-specialist",
|
|
129
|
-
fixStrategy: {
|
|
130
|
-
type: "isolate",
|
|
131
|
-
description: "Isolate and fix race conditions or timing dependencies",
|
|
132
|
-
estimatedImprovement: 90,
|
|
133
|
-
riskLevel: "medium",
|
|
134
|
-
requiresAgentCoordination: true,
|
|
135
|
-
},
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
return analyses;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Apply automatic fixes for simple issues
|
|
142
|
-
*/
|
|
143
|
-
async applyAutomaticFixes(issues, context, jobId) {
|
|
144
|
-
let fixesApplied = 0;
|
|
145
|
-
let testsOptimized = 0;
|
|
146
|
-
let performanceImprovement = 0;
|
|
147
|
-
const recommendations = [];
|
|
148
|
-
const nextSteps = [];
|
|
149
|
-
for (const issue of issues) {
|
|
150
|
-
try {
|
|
151
|
-
switch (issue.fixStrategy.type) {
|
|
152
|
-
case "optimize":
|
|
153
|
-
const optimizationResult = await this.optimizeTestTimeouts(issue, context, jobId);
|
|
154
|
-
if (optimizationResult.success) {
|
|
155
|
-
fixesApplied++;
|
|
156
|
-
performanceImprovement += issue.fixStrategy.estimatedImprovement;
|
|
157
|
-
recommendations.push(`Optimized ${issue.testFile} for better performance`);
|
|
158
|
-
}
|
|
159
|
-
break;
|
|
160
|
-
case "parallelize":
|
|
161
|
-
const parallelResult = await this.implementParallelExecution(issue, context, jobId);
|
|
162
|
-
if (parallelResult.success) {
|
|
163
|
-
fixesApplied++;
|
|
164
|
-
testsOptimized++;
|
|
165
|
-
performanceImprovement += issue.fixStrategy.estimatedImprovement;
|
|
166
|
-
recommendations.push(`Implemented parallel execution for ${issue.testFile}`);
|
|
167
|
-
}
|
|
168
|
-
break;
|
|
169
|
-
case "mock":
|
|
170
|
-
const mockResult = await this.addTestMocks(issue, context, jobId);
|
|
171
|
-
if (mockResult.success) {
|
|
172
|
-
fixesApplied++;
|
|
173
|
-
performanceImprovement += issue.fixStrategy.estimatedImprovement;
|
|
174
|
-
recommendations.push(`Added mocks to speed up ${issue.testFile}`);
|
|
175
|
-
}
|
|
176
|
-
break;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
catch (error) {
|
|
180
|
-
nextSteps.push(`Manual intervention needed for ${issue.testFile}: ${error instanceof Error ? error.message : String(error)}`);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return {
|
|
184
|
-
success: fixesApplied > 0,
|
|
185
|
-
fixesApplied,
|
|
186
|
-
testsOptimized,
|
|
187
|
-
performanceImprovement,
|
|
188
|
-
recommendations,
|
|
189
|
-
nextSteps,
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Coordinate with specialized agents for complex fixes
|
|
194
|
-
*/
|
|
195
|
-
async coordinateAgentFixes(complexIssues, context, jobId) {
|
|
196
|
-
let fixesApplied = 0;
|
|
197
|
-
let testsOptimized = 0;
|
|
198
|
-
let performanceImprovement = 0;
|
|
199
|
-
const agentsUsed = [];
|
|
200
|
-
const recommendations = [];
|
|
201
|
-
const nextSteps = [];
|
|
202
|
-
// Group issues by recommended agent
|
|
203
|
-
const agentGroups = new Map();
|
|
204
|
-
for (const issue of complexIssues) {
|
|
205
|
-
if (!agentGroups.has(issue.recommendedAgent)) {
|
|
206
|
-
agentGroups.set(issue.recommendedAgent, []);
|
|
207
|
-
}
|
|
208
|
-
agentGroups.get(issue.recommendedAgent).push(issue);
|
|
209
|
-
}
|
|
210
|
-
// Coordinate with each agent
|
|
211
|
-
for (const [agentName, issues] of agentGroups) {
|
|
212
|
-
try {
|
|
213
|
-
const agentResult = await this.invokeSpecializedAgent(agentName, issues, context, jobId);
|
|
214
|
-
if (agentResult.success) {
|
|
215
|
-
fixesApplied += agentResult.fixesApplied;
|
|
216
|
-
testsOptimized += agentResult.testsOptimized;
|
|
217
|
-
performanceImprovement += agentResult.performanceImprovement;
|
|
218
|
-
agentsUsed.push(agentName);
|
|
219
|
-
recommendations.push(...agentResult.recommendations);
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
nextSteps.push(`Agent ${agentName} coordination needed for ${issues.length} issues`);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
catch (error) {
|
|
226
|
-
nextSteps.push(`Failed to coordinate with ${agentName}: ${error instanceof Error ? error.message : String(error)}`);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
return {
|
|
230
|
-
success: fixesApplied > 0,
|
|
231
|
-
fixesApplied,
|
|
232
|
-
testsOptimized,
|
|
233
|
-
performanceImprovement,
|
|
234
|
-
agentsUsed,
|
|
235
|
-
recommendations,
|
|
236
|
-
nextSteps,
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Optimize test timeouts automatically
|
|
241
|
-
*/
|
|
242
|
-
async optimizeTestTimeouts(issue, context, jobId) {
|
|
243
|
-
// Implementation would modify test files to add timeouts and optimize slow operations
|
|
244
|
-
// For now, return success to indicate capability
|
|
245
|
-
frameworkLogger.log("test-auto-healing", "timeout-optimization", "success", {
|
|
246
|
-
jobId,
|
|
247
|
-
testFile: issue.testFile,
|
|
248
|
-
improvement: issue.fixStrategy.estimatedImprovement,
|
|
249
|
-
});
|
|
250
|
-
return { success: true };
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Implement parallel test execution
|
|
254
|
-
*/
|
|
255
|
-
async implementParallelExecution(issue, context, jobId) {
|
|
256
|
-
// Implementation would modify test configuration for parallel execution
|
|
257
|
-
frameworkLogger.log("test-auto-healing", "parallel-execution", "success", {
|
|
258
|
-
jobId,
|
|
259
|
-
testFile: issue.testFile,
|
|
260
|
-
improvement: issue.fixStrategy.estimatedImprovement,
|
|
261
|
-
});
|
|
262
|
-
return { success: true };
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Add mocks to speed up tests
|
|
266
|
-
*/
|
|
267
|
-
async addTestMocks(issue, context, jobId) {
|
|
268
|
-
// Implementation would analyze test dependencies and add appropriate mocks
|
|
269
|
-
frameworkLogger.log("test-auto-healing", "mock-addition", "success", {
|
|
270
|
-
jobId,
|
|
271
|
-
testFile: issue.testFile,
|
|
272
|
-
improvement: issue.fixStrategy.estimatedImprovement,
|
|
273
|
-
});
|
|
274
|
-
return { success: true };
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Invoke specialized agents for complex fixes
|
|
278
|
-
*/
|
|
279
|
-
async invokeSpecializedAgent(agentName, issues, context, jobId) {
|
|
280
|
-
// This would integrate with the actual agent system
|
|
281
|
-
// For now, simulate agent coordination
|
|
282
|
-
frameworkLogger.log("test-auto-healing", "agent-coordination", "info", {
|
|
283
|
-
jobId,
|
|
284
|
-
agent: agentName,
|
|
285
|
-
issuesCount: issues.length,
|
|
286
|
-
});
|
|
287
|
-
// Simulate agent response
|
|
288
|
-
return {
|
|
289
|
-
success: true,
|
|
290
|
-
fixesApplied: issues.length,
|
|
291
|
-
testsOptimized: Math.floor(issues.length * 0.8),
|
|
292
|
-
performanceImprovement: issues.reduce((sum, issue) => sum + issue.fixStrategy.estimatedImprovement, 0),
|
|
293
|
-
recommendations: [
|
|
294
|
-
`${agentName} successfully addressed ${issues.length} complex issues`,
|
|
295
|
-
],
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Detect flaky tests based on inconsistent results
|
|
300
|
-
*/
|
|
301
|
-
detectFlakyTests(testResults) {
|
|
302
|
-
// Implementation would analyze test history for flaky patterns
|
|
303
|
-
return []; // Placeholder
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Prioritize issues for fixing
|
|
307
|
-
*/
|
|
308
|
-
prioritizeIssues(issues) {
|
|
309
|
-
return issues.sort((a, b) => {
|
|
310
|
-
const severityOrder = { critical: 4, high: 3, medium: 2, low: 1 };
|
|
311
|
-
const typeOrder = {
|
|
312
|
-
timeout: 3,
|
|
313
|
-
performance: 2,
|
|
314
|
-
"logic-error": 3,
|
|
315
|
-
flaky: 2,
|
|
316
|
-
infrastructure: 1,
|
|
317
|
-
};
|
|
318
|
-
const aScore = severityOrder[a.severity] * 10 + typeOrder[a.failureType];
|
|
319
|
-
const bScore = severityOrder[b.severity] * 10 + typeOrder[b.failureType];
|
|
320
|
-
return bScore - aScore;
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
// Export singleton instance
|
|
325
|
-
export const testAutoHealingSystem = new TestAutoHealingSystem();
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { analyzeStructuralPatterns } from "./semantic-patterns.js";
|
|
2
|
-
export type { StructuralPattern } from "./semantic-patterns.js";
|
|
3
|
-
export { captureSessionInference, saveSessionInference, } from "./session-capture.js";
|
|
4
|
-
export type { SessionInference, ReasoningLink, SessionMetrics, } from "./session-capture.js";
|
|
5
|
-
export { shouldTriggerCycle, accumulateCorpus } from "./inference-accumulator.js";
|
|
6
|
-
export type { InferenceCorpus, RecurringPattern, RecurringProblem } from "./inference-accumulator.js";
|
|
7
|
-
export { InferenceCycle } from "./inference-cycle.js";
|
|
8
|
-
export type { InferenceProposal, InferenceCycleResult, CyclePhase } from "./inference-cycle.js";
|
|
9
|
-
export { DeployVerifier } from "./deploy-verifier.js";
|
|
10
|
-
export type { DeployVerificationResult, DeployCheck } from "./deploy-verifier.js";
|
package/dist/inference/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { analyzeStructuralPatterns } from "./semantic-patterns.js";
|
|
2
|
-
export { captureSessionInference, saveSessionInference, } from "./session-capture.js";
|
|
3
|
-
export { shouldTriggerCycle, accumulateCorpus } from "./inference-accumulator.js";
|
|
4
|
-
export { InferenceCycle } from "./inference-cycle.js";
|
|
5
|
-
export { DeployVerifier } from "./deploy-verifier.js";
|