0xray 2.1.3 → 2.2.0
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/README.md +3 -3
- package/dist/CHANGELOG.md +43 -0
- package/dist/README.md +3 -3
- 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 +1 -1
- package/dist/core/features-config.js +1 -1
- package/dist/core/framework-logger.js +30 -1
- 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 +10 -1
- 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/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 +3 -3
- 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/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
package/dist/cli/server.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import express from "express";
|
|
2
|
-
import { exec } from "child_process";
|
|
3
|
-
import { join, dirname } from "path";
|
|
4
|
-
import { fileURLToPath } from "url";
|
|
5
|
-
import * as fs from "fs";
|
|
6
|
-
import * as crypto from "crypto";
|
|
7
|
-
import { frameworkLogger } from "../core/framework-logger.js";
|
|
8
|
-
import { resolveConfigPath } from "../core/config-paths.js";
|
|
9
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
-
const __dirname = dirname(__filename);
|
|
11
|
-
const ROOT_DIR = join(__dirname, "..", "..");
|
|
12
|
-
const PUBLIC_DIR = join(ROOT_DIR, "public");
|
|
13
|
-
// Read version dynamically from package.json
|
|
14
|
-
const packageJsonPath = join(ROOT_DIR, "package.json");
|
|
15
|
-
const { version } = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
16
|
-
const app = express();
|
|
17
|
-
const PORT = 3000;
|
|
18
|
-
const API_KEY = process.env.XRAY_API_KEY || undefined;
|
|
19
|
-
function timingSafeCompare(a, b) {
|
|
20
|
-
const aBuf = Buffer.from(a, "utf-8");
|
|
21
|
-
const bBuf = Buffer.from(b, "utf-8");
|
|
22
|
-
if (aBuf.length !== bBuf.length)
|
|
23
|
-
return false;
|
|
24
|
-
return crypto.timingSafeEqual(aBuf, bBuf);
|
|
25
|
-
}
|
|
26
|
-
function requireAuth(req, res, next) {
|
|
27
|
-
if (!API_KEY) {
|
|
28
|
-
frameworkLogger.log("cli-server", "auth-skipped", "warning", {
|
|
29
|
-
message: "No XRAY_API_KEY set — API is unauthenticated. Set XRAY_API_KEY in production.",
|
|
30
|
-
});
|
|
31
|
-
return next();
|
|
32
|
-
}
|
|
33
|
-
const providedKey = req.headers["x-api-key"];
|
|
34
|
-
if (typeof providedKey !== "string") {
|
|
35
|
-
return res.status(401).json({ error: "API key required. Set XRAY_API_KEY environment variable." });
|
|
36
|
-
}
|
|
37
|
-
if (!timingSafeCompare(providedKey, API_KEY)) {
|
|
38
|
-
return res.status(403).json({ error: "Invalid API key" });
|
|
39
|
-
}
|
|
40
|
-
next();
|
|
41
|
-
}
|
|
42
|
-
// Lazy load security headers middleware
|
|
43
|
-
let securityMiddleware = null;
|
|
44
|
-
const getSecurityMiddleware = async () => {
|
|
45
|
-
if (!securityMiddleware) {
|
|
46
|
-
try {
|
|
47
|
-
const { securityHeadersMiddleware } = await import("../security/security-headers");
|
|
48
|
-
securityMiddleware = securityHeadersMiddleware.getExpressMiddleware();
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
frameworkLogger.log("cli-server", "security-middleware-unavailable", "warning", {
|
|
52
|
-
message: "Security middleware not available, continuing without security headers",
|
|
53
|
-
});
|
|
54
|
-
securityMiddleware = (req, res, next) => next(); // No-op middleware
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return securityMiddleware;
|
|
58
|
-
};
|
|
59
|
-
// Apply security headers middleware lazily
|
|
60
|
-
app.use(async (req, res, next) => {
|
|
61
|
-
try {
|
|
62
|
-
const middleware = await getSecurityMiddleware();
|
|
63
|
-
middleware(req, res, next);
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
frameworkLogger.log("cli-server", "security-middleware-load-failed", "warning", {
|
|
67
|
-
error,
|
|
68
|
-
message: "Security middleware failed to load, continuing without it",
|
|
69
|
-
});
|
|
70
|
-
next();
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
// Serve static files
|
|
74
|
-
app.use(express.static(PUBLIC_DIR));
|
|
75
|
-
// API endpoints
|
|
76
|
-
app.get("/api/status", requireAuth, (req, res) => {
|
|
77
|
-
// Return framework status
|
|
78
|
-
res.json({
|
|
79
|
-
framework: "0xRay",
|
|
80
|
-
version,
|
|
81
|
-
status: "active",
|
|
82
|
-
agents: 8,
|
|
83
|
-
timestamp: new Date().toISOString(),
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
app.get("/api/agents", requireAuth, (req, res) => {
|
|
87
|
-
// Return agent configurations
|
|
88
|
-
res.json({
|
|
89
|
-
agents: [
|
|
90
|
-
"architect",
|
|
91
|
-
"bug-triage-specialist",
|
|
92
|
-
"code-reviewer",
|
|
93
|
-
"security-auditor",
|
|
94
|
-
"refactorer",
|
|
95
|
-
"testing-lead",
|
|
96
|
-
],
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
// Performance monitoring middleware
|
|
100
|
-
app.use((req, res, next) => {
|
|
101
|
-
const start = process.hrtime.bigint();
|
|
102
|
-
res.on("finish", () => {
|
|
103
|
-
const end = process.hrtime.bigint();
|
|
104
|
-
const duration = Number(end - start) / 1e6; // Convert to milliseconds
|
|
105
|
-
// HTTP request logging - operational, keep for monitoring
|
|
106
|
-
});
|
|
107
|
-
next();
|
|
108
|
-
});
|
|
109
|
-
// Add route for root path
|
|
110
|
-
app.get("/", (req, res) => {
|
|
111
|
-
res.sendFile(join(PUBLIC_DIR, "index.html"));
|
|
112
|
-
});
|
|
113
|
-
// Add route for refactoring logs
|
|
114
|
-
app.get("/logs", requireAuth, async (req, res) => {
|
|
115
|
-
const logPath = resolveConfigPath("REFACTORING_LOG.md") || join(__dirname, "..", ".xray", "REFACTORING_LOG.md");
|
|
116
|
-
// Server debug logging - remove for production
|
|
117
|
-
try {
|
|
118
|
-
if (fs.existsSync(logPath)) {
|
|
119
|
-
const content = fs.readFileSync(logPath, "utf-8");
|
|
120
|
-
res.setHeader("Content-Type", "text/markdown");
|
|
121
|
-
res.send(content);
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
res
|
|
125
|
-
.status(404)
|
|
126
|
-
.send("Refactoring log not found. The framework may not have generated any logs yet.");
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
catch (error) {
|
|
130
|
-
// File read error - remove debug logging
|
|
131
|
-
res.status(500).send("Server error reading log file.");
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
// Global error handler (4-param middleware must be registered before listen)
|
|
135
|
-
app.use((err, req, res, _next) => {
|
|
136
|
-
frameworkLogger.log("cli-server", "unhandled-error", "error", { error: err, path: req.path });
|
|
137
|
-
res.status(500).send("Internal Server Error");
|
|
138
|
-
});
|
|
139
|
-
app.listen(PORT, () => {
|
|
140
|
-
// Auto-open browser
|
|
141
|
-
const start = process.platform === "darwin"
|
|
142
|
-
? "open"
|
|
143
|
-
: process.platform === "win32"
|
|
144
|
-
? "start"
|
|
145
|
-
: "xdg-open";
|
|
146
|
-
exec(`${start} http://localhost:${PORT}`);
|
|
147
|
-
});
|
package/dist/core/errors.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare function logAndReturn<T = never>(logger: any, component: string, message: string, error: unknown, returnValue: T): T;
|
|
2
|
-
export declare function logWarning(logger: any, component: string, message: string, details?: Record<string, unknown>): void;
|
|
3
|
-
export declare function logInfo(logger: any, component: string, message: string, details?: Record<string, unknown>): void;
|
package/dist/core/errors.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export function logAndReturn(logger, component, message, error, returnValue) {
|
|
2
|
-
logger.log(component, message, "error", { error: error instanceof Error ? error.message : String(error) }).catch(() => { });
|
|
3
|
-
return returnValue;
|
|
4
|
-
}
|
|
5
|
-
export function logWarning(logger, component, message, details) {
|
|
6
|
-
logger.log(component, message, "warning", details).catch(() => { });
|
|
7
|
-
}
|
|
8
|
-
export function logInfo(logger, component, message, details) {
|
|
9
|
-
logger.log(component, message, "info", details).catch(() => { });
|
|
10
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { LogStatus } from "./framework-logger.js";
|
|
2
|
-
export interface LoggingConfig {
|
|
3
|
-
enabled: boolean;
|
|
4
|
-
level: "debug" | "info" | "warn" | "error";
|
|
5
|
-
destinations: ("console" | "file" | "monitoring")[];
|
|
6
|
-
performanceMode: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare function getLoggingConfig(): LoggingConfig;
|
|
9
|
-
export declare function setLoggingConfig(config: Partial<LoggingConfig>): void;
|
|
10
|
-
export declare function isLoggingEnabled(): boolean;
|
|
11
|
-
export declare function shouldLog(level: LogStatus): boolean;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// Default logging configuration
|
|
2
|
-
const defaultLoggingConfig = {
|
|
3
|
-
enabled: (process.env.XRAY_LOGGING_ENABLED) !== "false", // Default true, can be disabled
|
|
4
|
-
level: (process.env.XRAY_LOG_LEVEL) || "info",
|
|
5
|
-
destinations: ["console", "file"],
|
|
6
|
-
performanceMode: (process.env.XRAY_PERFORMANCE_MODE) === "true",
|
|
7
|
-
};
|
|
8
|
-
// Available log levels in priority order (higher index = more verbose)
|
|
9
|
-
const LOG_LEVELS = ["debug", "info", "warn", "error"];
|
|
10
|
-
// Global logging configuration instance
|
|
11
|
-
let globalLoggingConfig = { ...defaultLoggingConfig };
|
|
12
|
-
export function getLoggingConfig() {
|
|
13
|
-
return { ...globalLoggingConfig };
|
|
14
|
-
}
|
|
15
|
-
export function setLoggingConfig(config) {
|
|
16
|
-
globalLoggingConfig = { ...globalLoggingConfig, ...config };
|
|
17
|
-
}
|
|
18
|
-
export function isLoggingEnabled() {
|
|
19
|
-
return globalLoggingConfig.enabled;
|
|
20
|
-
}
|
|
21
|
-
export function shouldLog(level) {
|
|
22
|
-
if (!globalLoggingConfig.enabled) {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
const currentLevelIndex = LOG_LEVELS.indexOf(globalLoggingConfig.level);
|
|
26
|
-
const messageLevelIndex = LOG_LEVELS.indexOf(level);
|
|
27
|
-
// If either level is not found, default to showing the message
|
|
28
|
-
if (currentLevelIndex === -1 || messageLevelIndex === -1) {
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
// Show message if its level is >= current configured level
|
|
32
|
-
return messageLevelIndex >= currentLevelIndex;
|
|
33
|
-
}
|
|
34
|
-
// Environment variable configuration
|
|
35
|
-
if ((process.env.XRAY_LOGGING_ENABLED) === "false") {
|
|
36
|
-
setLoggingConfig({ enabled: false });
|
|
37
|
-
}
|
|
38
|
-
if (process.env.XRAY_LOG_LEVEL) {
|
|
39
|
-
setLoggingConfig({ level: (process.env.XRAY_LOG_LEVEL) });
|
|
40
|
-
}
|
|
41
|
-
if ((process.env.XRAY_PERFORMANCE_MODE) === "true") {
|
|
42
|
-
setLoggingConfig({ performanceMode: true });
|
|
43
|
-
}
|
|
@@ -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,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Voting Coordinator
|
|
3
|
-
*
|
|
4
|
-
* Multi-agent voting system with:
|
|
5
|
-
* - Weighted confidence scoring based on agent expertise
|
|
6
|
-
* - Adaptive strategy selection
|
|
7
|
-
* - Historical learning and pattern detection
|
|
8
|
-
* - Integration with session coordinator
|
|
9
|
-
*
|
|
10
|
-
* @version 1.0.0
|
|
11
|
-
* @since 2026-04-16
|
|
12
|
-
*/
|
|
13
|
-
import type { VotingSession, VotingResult, StrategySelectionContext, VotingHistoryEntry, VotingMetrics, ConflictResolutionRequest, ConflictResolutionResponse } from "./voting-types.js";
|
|
14
|
-
import { SessionCoordinator } from "./session-coordinator.js";
|
|
15
|
-
import { WeightedVotingAggregator } from "./weighted-voting-aggregator.js";
|
|
16
|
-
import { XrayStateManager } from "../state/state-manager.js";
|
|
17
|
-
export interface VotingCoordinatorConfig {
|
|
18
|
-
enableHistoryTracking: boolean;
|
|
19
|
-
enableLearning: boolean;
|
|
20
|
-
minVotersForConsensus: number;
|
|
21
|
-
consensusThreshold: number;
|
|
22
|
-
}
|
|
23
|
-
export declare class VotingCoordinator {
|
|
24
|
-
private stateManager;
|
|
25
|
-
private sessionCoordinator;
|
|
26
|
-
private activeVotingSessions;
|
|
27
|
-
private votingHistory;
|
|
28
|
-
private metrics;
|
|
29
|
-
private config;
|
|
30
|
-
private aggregator;
|
|
31
|
-
constructor(stateManager: XrayStateManager, sessionCoordinator?: SessionCoordinator, config?: Partial<VotingCoordinatorConfig>);
|
|
32
|
-
initiateVoting(sessionId: string, topic: string, description: string, participants: string[], context?: StrategySelectionContext): Promise<string>;
|
|
33
|
-
submitVote(voteId: string, agentName: string, vote: string, confidence: number, reasoning?: string): boolean;
|
|
34
|
-
resolveVoting(voteId: string): VotingResult | null;
|
|
35
|
-
resolveConflict(request: ConflictResolutionRequest): ConflictResolutionResponse;
|
|
36
|
-
getAggregator(): WeightedVotingAggregator;
|
|
37
|
-
getVotingSession(voteId: string): VotingSession | undefined;
|
|
38
|
-
getActiveVotingSessions(): VotingSession[];
|
|
39
|
-
getVotingHistory(sessionId?: string, limit?: number): VotingHistoryEntry[];
|
|
40
|
-
getMetrics(): VotingMetrics;
|
|
41
|
-
private resolveMajorityVote;
|
|
42
|
-
private resolveConsensus;
|
|
43
|
-
private resolveExpertPriority;
|
|
44
|
-
private recordVotingHistory;
|
|
45
|
-
private loadHistory;
|
|
46
|
-
private initializeMetrics;
|
|
47
|
-
private updateMetricsAfterVote;
|
|
48
|
-
}
|
|
49
|
-
export declare const createVotingCoordinator: (stateManager: XrayStateManager, sessionCoordinator?: SessionCoordinator) => VotingCoordinator;
|