0xray 2.1.4 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.opencode/codex.codex +1 -1
- package/.opencode/commands/dependency-audit.md +3 -3
- package/.opencode/enforcer-config.json +2 -2
- package/.opencode/init.sh +1 -1
- package/AGENTS.md +6 -6
- package/README.md +4 -4
- package/dist/AGENTS.md +6 -6
- package/dist/CHANGELOG.md +39 -0
- package/dist/README.md +4 -4
- package/dist/agents/code-reviewer.js +1 -1
- package/dist/analytics/routing-refiner.js +1 -1
- package/dist/cli/commands/govern.d.ts +29 -0
- package/dist/cli/commands/govern.js +152 -0
- package/dist/cli/index.js +29 -216
- package/dist/core/boot-orchestrator.js +2 -2
- package/dist/core/features-config.js +1 -1
- package/dist/core/framework-logger.d.ts +1 -0
- package/dist/core/framework-logger.js +57 -2
- package/dist/delegation/index.d.ts +1 -2
- package/dist/delegation/index.js +1 -2
- package/dist/enforcement/enforcer-tools.js +1 -1
- package/dist/execution/proposal-applier.d.ts +1 -9
- package/dist/execution/proposal-applier.js +18 -173
- package/dist/governance/codex-policy.service.d.ts +7 -25
- package/dist/governance/codex-policy.service.js +8 -26
- package/dist/governance/governance-core.d.ts +22 -28
- package/dist/governance/governance-core.js +31 -101
- package/dist/governance/governance-service.d.ts +1 -0
- package/dist/governance/governance-service.js +67 -4
- package/dist/governance/governance-types.d.ts +5 -2
- package/dist/inference/index.d.ts +3 -4
- package/dist/inference/inference-accumulator.js +1 -1
- package/dist/inference/inference-cycle.d.ts +12 -18
- package/dist/inference/inference-cycle.js +120 -335
- package/dist/integrations/base/index.d.ts +0 -1
- package/dist/integrations/base/index.js +0 -2
- package/dist/integrations/grok/hooks/pre-tool-use.js +4 -18
- package/dist/integrations/hermes-agent/bridge.mjs +9 -0
- package/dist/mcps/config/server-config-registry.js +1 -1
- package/dist/mcps/governance.server.js +4 -5
- package/dist/mcps/knowledge-skills/api-design.server.js +10 -0
- package/dist/mcps/knowledge-skills/architecture-patterns.server.js +10 -0
- package/dist/mcps/knowledge-skills/bug-triage-specialist.server.js +10 -0
- package/dist/mcps/knowledge-skills/code-analyzer.server.js +10 -0
- package/dist/mcps/knowledge-skills/code-review.server.js +10 -0
- package/dist/mcps/knowledge-skills/content-creator.server.js +10 -0
- package/dist/mcps/knowledge-skills/database-design.server.js +10 -0
- package/dist/mcps/knowledge-skills/devops-deployment.server.js +10 -0
- package/dist/mcps/knowledge-skills/git-workflow.server.js +10 -0
- package/dist/mcps/knowledge-skills/growth-strategist.server.js +10 -0
- package/dist/mcps/knowledge-skills/log-monitor.server.js +10 -0
- package/dist/mcps/knowledge-skills/mobile-development.server.js +10 -0
- package/dist/mcps/knowledge-skills/multimodal-looker.server.js +10 -0
- package/dist/mcps/knowledge-skills/performance-optimization.server.js +10 -0
- package/dist/mcps/knowledge-skills/project-analysis.server.js +10 -0
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.js +10 -0
- package/dist/mcps/knowledge-skills/security-audit.server.js +10 -0
- package/dist/mcps/knowledge-skills/seo-consultant.server.js +10 -0
- package/dist/mcps/knowledge-skills/skill-invocation.server.d.ts +4 -0
- package/dist/mcps/knowledge-skills/skill-invocation.server.js +33 -14
- package/dist/mcps/knowledge-skills/strategist.server.js +10 -0
- package/dist/mcps/knowledge-skills/tech-writer.server.js +11 -1
- package/dist/mcps/knowledge-skills/testing-strategy.server.js +10 -0
- package/dist/mcps/knowledge-skills/ui-ux-design.server.js +10 -0
- package/dist/mcps/registry.json +1 -1
- package/dist/mcps/simulation/server-simulations.js +1 -1
- package/dist/metrics/agent-metrics.d.ts +2 -1
- package/dist/nucleus/govern-http.d.ts +59 -0
- package/dist/nucleus/govern-http.js +172 -0
- package/dist/nucleus/index.d.ts +14 -0
- package/dist/nucleus/index.js +9 -0
- package/dist/nucleus/kernel.d.ts +51 -0
- package/dist/nucleus/kernel.js +62 -0
- package/dist/nucleus/plugin-registry.d.ts +104 -0
- package/dist/nucleus/plugin-registry.js +147 -0
- package/dist/orchestrator/orchestrator.d.ts +0 -1
- package/dist/orchestrator/orchestrator.js +0 -21
- package/dist/postprocessor/PostProcessor.d.ts +13 -1
- package/dist/postprocessor/PostProcessor.js +41 -1
- package/dist/postprocessor/autofix/AutoFixEngine.d.ts +0 -8
- package/dist/postprocessor/autofix/AutoFixEngine.js +0 -54
- package/dist/postprocessor/metamorphosis/MetamorphosisEngine.d.ts +25 -0
- package/dist/postprocessor/metamorphosis/MetamorphosisEngine.js +10 -0
- package/dist/postprocessor/metamorphosis/SelfProposalEngine.d.ts +68 -0
- package/dist/postprocessor/metamorphosis/SelfProposalEngine.js +371 -0
- package/dist/skills/orchestrator/SKILL.md +1 -1
- package/dist/skills/registry.json +1 -1
- package/dist/state/index.d.ts +0 -2
- package/package.json +4 -3
- package/scripts/node/universal-version-manager.js +9 -9
- package/scripts/node/validate-mcp-connectivity.js +1 -1
- package/src/mcps/config/__tests__/server-config-registry.test.ts +6 -15
- package/src/mcps/config/server-config-registry.ts +1 -1
- package/src/mcps/governance.server.ts +4 -6
- package/src/mcps/knowledge-skills/api-design.server.ts +9 -0
- package/src/mcps/knowledge-skills/architecture-patterns.server.ts +9 -0
- package/src/mcps/knowledge-skills/bug-triage-specialist.server.ts +9 -0
- package/src/mcps/knowledge-skills/code-analyzer.server.ts +9 -0
- package/src/mcps/knowledge-skills/code-review.server.ts +9 -0
- package/src/mcps/knowledge-skills/content-creator.server.ts +9 -0
- package/src/mcps/knowledge-skills/database-design.server.ts +9 -0
- package/src/mcps/knowledge-skills/devops-deployment.server.ts +9 -0
- package/src/mcps/knowledge-skills/git-workflow.server.ts +9 -0
- package/src/mcps/knowledge-skills/growth-strategist.server.ts +9 -0
- package/src/mcps/knowledge-skills/log-monitor.server.ts +9 -0
- package/src/mcps/knowledge-skills/mobile-development.server.ts +9 -0
- package/src/mcps/knowledge-skills/multimodal-looker.server.ts +9 -0
- package/src/mcps/knowledge-skills/performance-optimization.server.ts +9 -0
- package/src/mcps/knowledge-skills/project-analysis.server.ts +9 -0
- package/src/mcps/knowledge-skills/refactoring-strategies.server.ts +9 -0
- package/src/mcps/knowledge-skills/security-audit.server.ts +9 -0
- package/src/mcps/knowledge-skills/seo-consultant.server.ts +9 -0
- package/src/mcps/knowledge-skills/session-management.server.ts +1 -0
- package/src/mcps/knowledge-skills/skill-invocation.server.ts +44 -29
- package/src/mcps/knowledge-skills/strategist.server.ts +9 -0
- package/src/mcps/knowledge-skills/tech-writer.server.ts +10 -1
- package/src/mcps/knowledge-skills/testing-strategy.server.ts +9 -0
- package/src/mcps/knowledge-skills/ui-ux-design.server.ts +9 -0
- package/src/mcps/registry.json +1 -1
- package/src/mcps/simulation/server-simulations.ts +1 -1
- package/src/opencode/codex.codex +1 -1
- package/src/opencode/commands/dependency-audit.md +3 -3
- package/src/opencode/enforcer-config.json +2 -2
- package/src/skills/orchestrator/SKILL.md +1 -1
- package/src/skills/registry.json +1 -1
- package/xray/codex.json +1 -1
- package/xray/config.json +1 -1
- package/xray/features.json +1 -1
- package/xray/integrations.json +3 -3
- package/.opencode/agents/testing-best-practices.yml +0 -12
- package/dist/analytics/consent-manager.d.ts +0 -93
- package/dist/analytics/consent-manager.js +0 -258
- package/dist/analytics/simple-pattern-analyzer.d.ts +0 -80
- package/dist/analytics/simple-pattern-analyzer.js +0 -297
- 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/server.d.ts +0 -1
- package/dist/cli/server.js +0 -147
- package/dist/core/errors.d.ts +0 -3
- package/dist/core/errors.js +0 -10
- package/dist/core/logging-config.d.ts +0 -11
- package/dist/core/logging-config.js +0 -43
- package/dist/core/trace-context.d.ts +0 -12
- package/dist/core/trace-context.js +0 -33
- package/dist/delegation/voting-coordinator.d.ts +0 -49
- package/dist/delegation/voting-coordinator.js +0 -375
- package/dist/enforcement/test-auto-healing.d.ts +0 -83
- package/dist/enforcement/test-auto-healing.js +0 -325
- package/dist/integrations/base/ExampleIntegration.d.ts +0 -47
- package/dist/integrations/base/ExampleIntegration.js +0 -181
- package/dist/mcps/knowledge-skills/testing-best-practices.server.d.ts +0 -34
- package/dist/mcps/knowledge-skills/testing-best-practices.server.js +0 -831
- package/dist/mcps/orchestrator.server.d.ts +0 -10
- package/dist/mcps/orchestrator.server.js +0 -19
- package/dist/orchestrator/self-direction-activation.d.ts +0 -109
- package/dist/orchestrator/self-direction-activation.js +0 -245
- package/dist/orchestrator/universal-librarian-consultation.d.ts +0 -98
- package/dist/orchestrator/universal-librarian-consultation.js +0 -216
- package/dist/orchestrator/universal-registry-bridge.d.ts +0 -85
- package/dist/orchestrator/universal-registry-bridge.js +0 -247
- package/dist/performance/performance-budget-enforcer.d.ts +0 -158
- package/dist/performance/performance-budget-enforcer.js +0 -434
- package/dist/performance/performance-regression-tester.d.ts +0 -108
- package/dist/performance/performance-regression-tester.js +0 -342
- package/dist/skills/testing-best-practices/SKILL.md +0 -37
- package/dist/state/context-providers.d.ts +0 -4
- package/dist/state/context-providers.js +0 -1
- package/dist/state/state-types.d.ts +0 -5
- package/dist/state/state-types.js +0 -1
- package/dist/utils/batch-operations.d.ts +0 -25
- package/dist/utils/batch-operations.js +0 -292
- 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/src/mcps/knowledge-skills/testing-best-practices.server.test.ts +0 -136
- package/src/mcps/knowledge-skills/testing-best-practices.server.ts +0 -1183
- package/src/mcps/orchestrator.server.ts +0 -34
- package/src/opencode/agents/testing-best-practices.yml +0 -12
- package/src/skills/testing-best-practices/SKILL.md +0 -37
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 0xRay Orchestrator MCP Server
|
|
3
|
-
*
|
|
4
|
-
* This is a re-export from the new modular structure.
|
|
5
|
-
* For the full implementation, see: src/mcps/orchestrator/
|
|
6
|
-
*
|
|
7
|
-
* @deprecated Use src/mcps/orchestrator/server.ts instead
|
|
8
|
-
*/
|
|
9
|
-
export { OrchestratorServer, createOrchestratorServer } from './orchestrator/server.js';
|
|
10
|
-
export type { AgentCapability, OrchestrationTask, ExecutionPlan, OrchestrationResult, ComplexityAnalysis, TaskValidation, OrchestrationStatus, TaskExecutionContext, } from './orchestrator/types.js';
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 0xRay Orchestrator MCP Server
|
|
3
|
-
*
|
|
4
|
-
* This is a re-export from the new modular structure.
|
|
5
|
-
* For the full implementation, see: src/mcps/orchestrator/
|
|
6
|
-
*
|
|
7
|
-
* @deprecated Use src/mcps/orchestrator/server.ts instead
|
|
8
|
-
*/
|
|
9
|
-
import { frameworkLogger } from '../core/framework-logger.js';
|
|
10
|
-
export { OrchestratorServer, createOrchestratorServer } from './orchestrator/server.js';
|
|
11
|
-
// Run if called directly
|
|
12
|
-
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
13
|
-
const { createOrchestratorServer } = await import('./orchestrator/server.js');
|
|
14
|
-
const server = createOrchestratorServer();
|
|
15
|
-
server.start().catch((error) => {
|
|
16
|
-
frameworkLogger.log("mcps/orchestrator", "start", "error", { error: String(error) });
|
|
17
|
-
process.exit(1);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Self-Direction Activation System (Simplified)
|
|
3
|
-
*
|
|
4
|
-
* Commercial version with autonomous self-direction capabilities.
|
|
5
|
-
* Activates the framework's dormant self-evolution systems for continuous improvement.
|
|
6
|
-
* This version works without advanced-features dependencies for initial deployment.
|
|
7
|
-
*
|
|
8
|
-
* @version 2.0.0
|
|
9
|
-
* @since 2026-01-24
|
|
10
|
-
*/
|
|
11
|
-
export interface SelfDirectionConfig {
|
|
12
|
-
monitoringInterval: number;
|
|
13
|
-
analyticsInterval: number;
|
|
14
|
-
learningCycleInterval: number;
|
|
15
|
-
autonomousReporting: boolean;
|
|
16
|
-
predictiveOptimization: boolean;
|
|
17
|
-
scalingAutonomy: boolean;
|
|
18
|
-
evolutionSafety: boolean;
|
|
19
|
-
}
|
|
20
|
-
export interface SelfAssessmentReport {
|
|
21
|
-
timestamp: number;
|
|
22
|
-
healthScore: number;
|
|
23
|
-
criticalIssues: CriticalIssue[];
|
|
24
|
-
improvementOpportunities: ImprovementOpportunity[];
|
|
25
|
-
predictions: SystemPrediction[];
|
|
26
|
-
recommendations: string[];
|
|
27
|
-
}
|
|
28
|
-
export interface CriticalIssue {
|
|
29
|
-
id: string;
|
|
30
|
-
severity: "low" | "medium" | "high" | "critical";
|
|
31
|
-
component: string;
|
|
32
|
-
description: string;
|
|
33
|
-
impact: string;
|
|
34
|
-
recommendedAction: string;
|
|
35
|
-
}
|
|
36
|
-
export interface ImprovementOpportunity {
|
|
37
|
-
id: string;
|
|
38
|
-
type: "performance" | "reliability" | "efficiency" | "capability";
|
|
39
|
-
description: string;
|
|
40
|
-
potentialBenefit: string;
|
|
41
|
-
implementationComplexity: "low" | "medium" | "high";
|
|
42
|
-
confidence: number;
|
|
43
|
-
}
|
|
44
|
-
export interface SystemPrediction {
|
|
45
|
-
type: "scaling" | "performance" | "reliability" | "resource";
|
|
46
|
-
prediction: string;
|
|
47
|
-
confidence: number;
|
|
48
|
-
timeHorizon: number;
|
|
49
|
-
recommendedAction?: string;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Simplified Self-Direction Activation System
|
|
53
|
-
*
|
|
54
|
-
* Provides basic self-direction capabilities without advanced-features dependencies
|
|
55
|
-
* for initial deployment and testing.
|
|
56
|
-
*/
|
|
57
|
-
export declare class SelfDirectionSystem {
|
|
58
|
-
private config;
|
|
59
|
-
private activeMonitoring;
|
|
60
|
-
private activeLearning;
|
|
61
|
-
private monitoringIntervalId;
|
|
62
|
-
private learningIntervalId;
|
|
63
|
-
constructor(config?: Partial<SelfDirectionConfig>);
|
|
64
|
-
/**
|
|
65
|
-
* Phase 1: Activate Self-Monitoring Foundation
|
|
66
|
-
*/
|
|
67
|
-
activateSelfMonitoring(): Promise<void>;
|
|
68
|
-
/**
|
|
69
|
-
* Setup autonomous critical issue reporting
|
|
70
|
-
*/
|
|
71
|
-
private setupAutonomousReporting;
|
|
72
|
-
/**
|
|
73
|
-
* Start continuous self-assessment cycle
|
|
74
|
-
*/
|
|
75
|
-
private startContinuousSelfAssessment;
|
|
76
|
-
/**
|
|
77
|
-
* Phase 2: Activate Self-Evolution Learning
|
|
78
|
-
*/
|
|
79
|
-
activateSelfEvolution(): Promise<void>;
|
|
80
|
-
/**
|
|
81
|
-
* Start learning cycles
|
|
82
|
-
*/
|
|
83
|
-
private startLearningCycles;
|
|
84
|
-
/**
|
|
85
|
-
* Core self-assessment method
|
|
86
|
-
*/
|
|
87
|
-
performSelfAssessment(): Promise<SelfAssessmentReport>;
|
|
88
|
-
/**
|
|
89
|
-
* Process self-assessment results
|
|
90
|
-
*/
|
|
91
|
-
private processSelfAssessmentResults;
|
|
92
|
-
/**
|
|
93
|
-
* Get current self-direction status
|
|
94
|
-
*/
|
|
95
|
-
getStatus(): {
|
|
96
|
-
activeMonitoring: boolean;
|
|
97
|
-
activeLearning: boolean;
|
|
98
|
-
config: SelfDirectionConfig;
|
|
99
|
-
componentsHealth: Record<string, boolean>;
|
|
100
|
-
};
|
|
101
|
-
/**
|
|
102
|
-
* Shutdown self-direction system
|
|
103
|
-
*/
|
|
104
|
-
shutdown(): Promise<void>;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Export singleton instance
|
|
108
|
-
*/
|
|
109
|
-
export declare const selfDirectionSystem: SelfDirectionSystem;
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Self-Direction Activation System (Simplified)
|
|
3
|
-
*
|
|
4
|
-
* Commercial version with autonomous self-direction capabilities.
|
|
5
|
-
* Activates the framework's dormant self-evolution systems for continuous improvement.
|
|
6
|
-
* This version works without advanced-features dependencies for initial deployment.
|
|
7
|
-
*
|
|
8
|
-
* @version 2.0.0
|
|
9
|
-
* @since 2026-01-24
|
|
10
|
-
*/
|
|
11
|
-
// Framework core imports
|
|
12
|
-
import { frameworkLogger, generateJobId } from "../core/framework-logger.js";
|
|
13
|
-
/**
|
|
14
|
-
* Simplified Self-Direction Activation System
|
|
15
|
-
*
|
|
16
|
-
* Provides basic self-direction capabilities without advanced-features dependencies
|
|
17
|
-
* for initial deployment and testing.
|
|
18
|
-
*/
|
|
19
|
-
export class SelfDirectionSystem {
|
|
20
|
-
config;
|
|
21
|
-
activeMonitoring = false;
|
|
22
|
-
activeLearning = false;
|
|
23
|
-
monitoringIntervalId;
|
|
24
|
-
learningIntervalId;
|
|
25
|
-
constructor(config = {}) {
|
|
26
|
-
this.config = {
|
|
27
|
-
monitoringInterval: 30000, // 30 seconds
|
|
28
|
-
analyticsInterval: 300000, // 5 minutes
|
|
29
|
-
learningCycleInterval: 3600000, // 1 hour
|
|
30
|
-
autonomousReporting: true,
|
|
31
|
-
predictiveOptimization: true,
|
|
32
|
-
scalingAutonomy: true,
|
|
33
|
-
evolutionSafety: true,
|
|
34
|
-
...config,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Phase 1: Activate Self-Monitoring Foundation
|
|
39
|
-
*/
|
|
40
|
-
async activateSelfMonitoring() {
|
|
41
|
-
frameworkLogger.log("self-direction-system", "activating-monitoring", "info", { message: "🤖 ACTIVATING SELF-MONITORING FOUNDATION" });
|
|
42
|
-
try {
|
|
43
|
-
// Setup autonomous critical issue reporting
|
|
44
|
-
this.setupAutonomousReporting();
|
|
45
|
-
frameworkLogger.log("self-direction-system", "reporting-activated", "info", { message: "✅ Autonomous critical issue reporting activated" });
|
|
46
|
-
// Start continuous self-assessment
|
|
47
|
-
this.startContinuousSelfAssessment();
|
|
48
|
-
this.activeMonitoring = true;
|
|
49
|
-
frameworkLogger.log("self-direction-system", "monitoring-activated", "info", { message: "🎉 Self-monitoring foundation activated" });
|
|
50
|
-
await frameworkLogger.log("self-direction-system", "monitoring-activated", "success", { phase: 1, componentsActivated: ["reporting", "assessment"] }, undefined, generateJobId("self-monitoring"));
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
frameworkLogger.log("self-direction-system", "monitoring-activation-failed", "error", { error, message: "❌ Self-monitoring activation failed" });
|
|
54
|
-
await frameworkLogger.log("self-direction-system", "monitoring-activation-failed", "error", { error: error instanceof Error ? error.message : error }, undefined, generateJobId("self-monitoring-fail"));
|
|
55
|
-
throw error;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Setup autonomous critical issue reporting
|
|
60
|
-
*/
|
|
61
|
-
setupAutonomousReporting() {
|
|
62
|
-
// Setup basic event listeners for critical issues
|
|
63
|
-
frameworkLogger.log("self-direction-system", "reporting-configured", "info", { message: "📊 Autonomous reporting configured" });
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Start continuous self-assessment cycle
|
|
67
|
-
*/
|
|
68
|
-
startContinuousSelfAssessment() {
|
|
69
|
-
// Clear any existing interval first to prevent duplicates
|
|
70
|
-
if (this.monitoringIntervalId) {
|
|
71
|
-
clearInterval(this.monitoringIntervalId);
|
|
72
|
-
}
|
|
73
|
-
this.monitoringIntervalId = setInterval(async () => {
|
|
74
|
-
try {
|
|
75
|
-
if (!this.activeMonitoring)
|
|
76
|
-
return; // Don't run if stopped
|
|
77
|
-
const assessment = await this.performSelfAssessment();
|
|
78
|
-
await this.processSelfAssessmentResults(assessment);
|
|
79
|
-
}
|
|
80
|
-
catch (error) {
|
|
81
|
-
frameworkLogger.log("self-direction-system", "assessment-cycle-failed", "error", { error, message: "Self-assessment cycle failed" });
|
|
82
|
-
}
|
|
83
|
-
}, this.config.monitoringInterval);
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Phase 2: Activate Self-Evolution Learning
|
|
87
|
-
*/
|
|
88
|
-
async activateSelfEvolution() {
|
|
89
|
-
frameworkLogger.log("self-direction-system", "activating-evolution", "info", { message: "🧠 ACTIVATING SELF-EVOLUTION LEARNING" });
|
|
90
|
-
try {
|
|
91
|
-
// Start learning cycles
|
|
92
|
-
this.startLearningCycles();
|
|
93
|
-
frameworkLogger.log("self-direction-system", "learning-cycles-activated", "info", { message: "✅ Learning cycles activated" });
|
|
94
|
-
this.activeLearning = true;
|
|
95
|
-
frameworkLogger.log("self-direction-system", "evolution-activated", "info", { message: "🎉 Self-evolution learning activated" });
|
|
96
|
-
await frameworkLogger.log("self-direction-system", "evolution-activated", "success", { phase: 2, componentsActivated: ["learning-cycles"] }, undefined, generateJobId("self-evolution"));
|
|
97
|
-
}
|
|
98
|
-
catch (error) {
|
|
99
|
-
frameworkLogger.log("self-direction-system", "evolution-activation-failed", "error", { error, message: "❌ Self-evolution activation failed" });
|
|
100
|
-
await frameworkLogger.log("self-direction-system", "evolution-activation-failed", "error", { error: error instanceof Error ? error.message : error }, undefined, generateJobId("self-evolution-fail"));
|
|
101
|
-
throw error;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Start learning cycles
|
|
106
|
-
*/
|
|
107
|
-
startLearningCycles() {
|
|
108
|
-
// Clear any existing interval first to prevent duplicates
|
|
109
|
-
if (this.learningIntervalId) {
|
|
110
|
-
clearInterval(this.learningIntervalId);
|
|
111
|
-
}
|
|
112
|
-
this.learningIntervalId = setInterval(async () => {
|
|
113
|
-
if (!this.activeLearning)
|
|
114
|
-
return; // Don't run if stopped
|
|
115
|
-
frameworkLogger.log("self-direction-system", "learning-cycle-executed", "info", { message: "🔄 Learning cycle executed" });
|
|
116
|
-
// Basic learning cycle - would be enhanced with advanced features
|
|
117
|
-
}, this.config.learningCycleInterval);
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Core self-assessment method
|
|
121
|
-
*/
|
|
122
|
-
async performSelfAssessment() {
|
|
123
|
-
const timestamp = Date.now();
|
|
124
|
-
// Basic health assessment
|
|
125
|
-
const healthScore = 0.75; // Placeholder
|
|
126
|
-
// Known critical issues
|
|
127
|
-
const criticalIssues = [
|
|
128
|
-
{
|
|
129
|
-
id: "memory-leak",
|
|
130
|
-
severity: "critical",
|
|
131
|
-
component: "memory-management",
|
|
132
|
-
description: "Memory leaks persist at 1.3GB+ usage",
|
|
133
|
-
impact: "System instability",
|
|
134
|
-
recommendedAction: "Deep profiling required",
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
id: "performance-budget",
|
|
138
|
-
severity: "critical",
|
|
139
|
-
component: "performance",
|
|
140
|
-
description: "Bundle size and response times exceed limits",
|
|
141
|
-
impact: "CI/CD deployment blocked",
|
|
142
|
-
recommendedAction: "Optimization required",
|
|
143
|
-
},
|
|
144
|
-
];
|
|
145
|
-
// Basic improvement opportunities
|
|
146
|
-
const improvementOpportunities = [
|
|
147
|
-
{
|
|
148
|
-
id: "memory-optimization",
|
|
149
|
-
type: "performance",
|
|
150
|
-
description: "Implement comprehensive memory leak fixes",
|
|
151
|
-
potentialBenefit: "Reduce memory usage by 95%",
|
|
152
|
-
implementationComplexity: "high",
|
|
153
|
-
confidence: 0.8,
|
|
154
|
-
},
|
|
155
|
-
];
|
|
156
|
-
// Basic predictions
|
|
157
|
-
const predictions = [
|
|
158
|
-
{
|
|
159
|
-
type: "performance",
|
|
160
|
-
prediction: "Performance budget violations will persist",
|
|
161
|
-
confidence: 0.9,
|
|
162
|
-
timeHorizon: 24,
|
|
163
|
-
recommendedAction: "Address bundle size and response times",
|
|
164
|
-
},
|
|
165
|
-
];
|
|
166
|
-
// Recommendations
|
|
167
|
-
const recommendations = [
|
|
168
|
-
"Conduct comprehensive memory profiling",
|
|
169
|
-
"Fix concurrent spawn limit race condition",
|
|
170
|
-
"Resolve performance budget violations",
|
|
171
|
-
];
|
|
172
|
-
return {
|
|
173
|
-
timestamp,
|
|
174
|
-
healthScore,
|
|
175
|
-
criticalIssues,
|
|
176
|
-
improvementOpportunities,
|
|
177
|
-
predictions,
|
|
178
|
-
recommendations,
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Process self-assessment results
|
|
183
|
-
*/
|
|
184
|
-
async processSelfAssessmentResults(assessment) {
|
|
185
|
-
if (assessment.criticalIssues.length > 0) {
|
|
186
|
-
frameworkLogger.log("self-direction-system", "critical-issues-detected", "warning", {
|
|
187
|
-
message: `🚨 ${assessment.criticalIssues.length} critical issues detected`,
|
|
188
|
-
issues: assessment.criticalIssues.map(i => `${i.severity.toUpperCase()}: ${i.description}`),
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
if (assessment.recommendations.length > 0) {
|
|
192
|
-
frameworkLogger.log("self-direction-system", "recommendations-generated", "info", {
|
|
193
|
-
message: `💡 ${assessment.recommendations.length} recommendations generated`,
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Get current self-direction status
|
|
199
|
-
*/
|
|
200
|
-
getStatus() {
|
|
201
|
-
return {
|
|
202
|
-
activeMonitoring: this.activeMonitoring,
|
|
203
|
-
activeLearning: this.activeLearning,
|
|
204
|
-
config: this.config,
|
|
205
|
-
componentsHealth: {
|
|
206
|
-
metricsCollector: true,
|
|
207
|
-
analytics: true,
|
|
208
|
-
streaming: true,
|
|
209
|
-
scaling: true,
|
|
210
|
-
loadBalancer: true,
|
|
211
|
-
metaAnalysis: true,
|
|
212
|
-
inference: true,
|
|
213
|
-
selfReflection: true,
|
|
214
|
-
learningLoops: true,
|
|
215
|
-
evolutionValidation: true,
|
|
216
|
-
monitoring: true,
|
|
217
|
-
reporting: true,
|
|
218
|
-
assessment: true,
|
|
219
|
-
learning: true,
|
|
220
|
-
},
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Shutdown self-direction system
|
|
225
|
-
*/
|
|
226
|
-
async shutdown() {
|
|
227
|
-
frameworkLogger.log("self-direction-system", "shutting-down", "info", { message: "🛑 Shutting down self-direction system..." });
|
|
228
|
-
// Clear all intervals to prevent memory leaks
|
|
229
|
-
if (this.monitoringIntervalId) {
|
|
230
|
-
clearInterval(this.monitoringIntervalId);
|
|
231
|
-
this.monitoringIntervalId = undefined;
|
|
232
|
-
}
|
|
233
|
-
if (this.learningIntervalId) {
|
|
234
|
-
clearInterval(this.learningIntervalId);
|
|
235
|
-
this.learningIntervalId = undefined;
|
|
236
|
-
}
|
|
237
|
-
this.activeMonitoring = false;
|
|
238
|
-
this.activeLearning = false;
|
|
239
|
-
frameworkLogger.log("self-direction-system", "shutdown-complete", "info", { message: "✅ Self-direction system shutdown complete" });
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Export singleton instance
|
|
244
|
-
*/
|
|
245
|
-
export const selfDirectionSystem = new SelfDirectionSystem();
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Universal Librarian Consultation System
|
|
3
|
-
* Ensures researcher is involved in all major system actions for documentation and versioning
|
|
4
|
-
*/
|
|
5
|
-
import { RuleEnforcer } from "../enforcement/rule-enforcer.js";
|
|
6
|
-
export interface SystemAction {
|
|
7
|
-
type: "code-change" | "rule-modification" | "architectural-change" | "configuration_update" | "documentation_update";
|
|
8
|
-
description: string;
|
|
9
|
-
scope: "framework" | "agent" | "tool" | "configuration" | "documentation";
|
|
10
|
-
complexity: "low" | "medium" | "high" | "critical";
|
|
11
|
-
files?: string[];
|
|
12
|
-
components?: string[];
|
|
13
|
-
metadata?: {
|
|
14
|
-
triggeredBy?: string;
|
|
15
|
-
[key: string]: unknown;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export interface LibrarianConsultationResult {
|
|
19
|
-
approved: boolean;
|
|
20
|
-
documentationImpact: "none" | "minor" | "major" | "critical";
|
|
21
|
-
versionUpdates: VersionUpdate[];
|
|
22
|
-
recommendations: string[];
|
|
23
|
-
pairProgrammingRequired: boolean;
|
|
24
|
-
}
|
|
25
|
-
export interface VersionUpdate {
|
|
26
|
-
file: string;
|
|
27
|
-
field: string;
|
|
28
|
-
oldVersion: string;
|
|
29
|
-
newVersion: string;
|
|
30
|
-
reason: string;
|
|
31
|
-
}
|
|
32
|
-
export interface ActionResult {
|
|
33
|
-
success: boolean;
|
|
34
|
-
[key: string]: unknown;
|
|
35
|
-
}
|
|
36
|
-
export interface LibrarianConsultationResult {
|
|
37
|
-
approved: boolean;
|
|
38
|
-
documentationImpact: "none" | "minor" | "major" | "critical";
|
|
39
|
-
versionUpdates: VersionUpdate[];
|
|
40
|
-
recommendations: string[];
|
|
41
|
-
pairProgrammingRequired: boolean;
|
|
42
|
-
}
|
|
43
|
-
export interface VersionUpdate {
|
|
44
|
-
file: string;
|
|
45
|
-
field: string;
|
|
46
|
-
oldVersion: string;
|
|
47
|
-
newVersion: string;
|
|
48
|
-
reason: string;
|
|
49
|
-
}
|
|
50
|
-
export declare class UniversalLibrarianConsultation {
|
|
51
|
-
private ruleEnforcer;
|
|
52
|
-
constructor(ruleEnforcer: RuleEnforcer);
|
|
53
|
-
/**
|
|
54
|
-
* Pre-action consultation - must be called before any major system action
|
|
55
|
-
*/
|
|
56
|
-
consultBeforeAction(action: SystemAction): Promise<LibrarianConsultationResult>;
|
|
57
|
-
/**
|
|
58
|
-
* Post-action consultation - must be called after any major system action
|
|
59
|
-
*/
|
|
60
|
-
consultAfterAction(action: SystemAction, result: ActionResult): Promise<void>;
|
|
61
|
-
/**
|
|
62
|
-
* Check if this action is related to researcher operations (to prevent recursion)
|
|
63
|
-
*/
|
|
64
|
-
private isLibrarianOperation;
|
|
65
|
-
/**
|
|
66
|
-
* Assess documentation impact of the action
|
|
67
|
-
*/
|
|
68
|
-
private assessDocumentationImpact;
|
|
69
|
-
/**
|
|
70
|
-
* Determine what version updates are needed
|
|
71
|
-
*/
|
|
72
|
-
private determineVersionUpdates;
|
|
73
|
-
/**
|
|
74
|
-
* Check if pair programming with researcher is required
|
|
75
|
-
*/
|
|
76
|
-
private requiresPairProgramming;
|
|
77
|
-
/**
|
|
78
|
-
* Generate recommendations for the action
|
|
79
|
-
*/
|
|
80
|
-
private generateRecommendations;
|
|
81
|
-
/**
|
|
82
|
-
* Update documentation after action completion
|
|
83
|
-
*/
|
|
84
|
-
private updateDocumentation;
|
|
85
|
-
/**
|
|
86
|
-
* Update versions after action completion
|
|
87
|
-
*/
|
|
88
|
-
private updateVersions;
|
|
89
|
-
/**
|
|
90
|
-
* Validate documentation integrity
|
|
91
|
-
*/
|
|
92
|
-
private validateDocumentationIntegrity;
|
|
93
|
-
/**
|
|
94
|
-
* Determine which documentation files need updating
|
|
95
|
-
*/
|
|
96
|
-
private determineDocumentationFiles;
|
|
97
|
-
}
|
|
98
|
-
export declare const universalLibrarianConsultation: UniversalLibrarianConsultation;
|