0xray 4.0.34 → 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.
- 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 +16 -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/hooks/goggles-pipeline.mjs +62 -11
- 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 +2 -2
- package/scripts/foundry/release.mjs +48 -5
- 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/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/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,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Known Names — Single combined vocabulary for agent names, skill names,
|
|
3
|
-
* system service names, and opencode built-in types. All consumers import
|
|
4
|
-
* from here instead of defining their own hardcoded lists.
|
|
5
|
-
*
|
|
6
|
-
* Imports:
|
|
7
|
-
* - registry.ts (AGENT_REGISTRY, AGENT_KEYS) — canonical agent definitions
|
|
8
|
-
* - mcps/index.ts (MCP_SERVERS) — canonical MCP server manifest
|
|
9
|
-
*/
|
|
10
|
-
import { AGENT_KEYS } from "./registry.js";
|
|
11
|
-
import { MCP_SERVERS } from "../mcps/index.js";
|
|
12
|
-
// ── Agent names (from SSOT) ──
|
|
13
|
-
export { AGENT_KEYS };
|
|
14
|
-
/** All agent names as a mutable array */
|
|
15
|
-
export function getAgentNames() {
|
|
16
|
-
return [...AGENT_KEYS];
|
|
17
|
-
}
|
|
18
|
-
// ── System service names (not in AGENT_REGISTRY) ──
|
|
19
|
-
export const SYSTEM_SERVICE_NAMES = [
|
|
20
|
-
"enforcer",
|
|
21
|
-
"orchestrator",
|
|
22
|
-
"analyzer",
|
|
23
|
-
];
|
|
24
|
-
// ── Opencode CLI built-in types ──
|
|
25
|
-
export const OPENCODE_BUILTIN_TYPES = [
|
|
26
|
-
"explore",
|
|
27
|
-
"general",
|
|
28
|
-
];
|
|
29
|
-
// ── Combined vocabulary ──
|
|
30
|
-
export const ALL_KNOWN_NAMES = [
|
|
31
|
-
...AGENT_KEYS,
|
|
32
|
-
...SYSTEM_SERVICE_NAMES,
|
|
33
|
-
...OPENCODE_BUILTIN_TYPES,
|
|
34
|
-
];
|
|
35
|
-
// ── Boot-priority agents (loaded first by boot-orchestrator) ──
|
|
36
|
-
export const BOOT_AGENTS = [
|
|
37
|
-
"enforcer",
|
|
38
|
-
"architect",
|
|
39
|
-
"bug-triage-specialist",
|
|
40
|
-
"code-reviewer",
|
|
41
|
-
"security-auditor",
|
|
42
|
-
"refactorer",
|
|
43
|
-
"testing-lead",
|
|
44
|
-
];
|
|
45
|
-
// ── Validation ──
|
|
46
|
-
export function isValidType(name) {
|
|
47
|
-
return ALL_KNOWN_NAMES.includes(name);
|
|
48
|
-
}
|
|
49
|
-
// ── Agent → Skill alias map (single source) ──
|
|
50
|
-
export const AGENT_TO_SKILL_MAP = {
|
|
51
|
-
"architect": "architecture-patterns",
|
|
52
|
-
"backend-engineer": "api-design",
|
|
53
|
-
"code-reviewer": "code-review",
|
|
54
|
-
"database-engineer": "database-design",
|
|
55
|
-
"devops-engineer": "devops-deployment",
|
|
56
|
-
"mobile-developer": "mobile-development",
|
|
57
|
-
"performance-engineer": "performance-optimization",
|
|
58
|
-
"security-auditor": "security-audit",
|
|
59
|
-
"testing-lead": "testing-strategy",
|
|
60
|
-
"tech-writer": "documentation-generation",
|
|
61
|
-
"frontend-ui-ux-engineer": "ui-ux-design",
|
|
62
|
-
"frontend-engineer": "project-analysis",
|
|
63
|
-
};
|
|
64
|
-
/** Resolve agent name to skill name via alias map, fallback to identity */
|
|
65
|
-
export function resolveSkill(agentOrSkill) {
|
|
66
|
-
return AGENT_TO_SKILL_MAP[agentOrSkill] || agentOrSkill;
|
|
67
|
-
}
|
|
68
|
-
// ── MCP server names (for consumers that need them) ──
|
|
69
|
-
export { MCP_SERVERS };
|
|
70
|
-
export function getSkillNames() {
|
|
71
|
-
return MCP_SERVERS.map(s => s.serverName);
|
|
72
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Consent Manager for 0xRay Central Analytics
|
|
3
|
-
*
|
|
4
|
-
* Manages user consent for analytics data submission with granular
|
|
5
|
-
* control over what categories can be shared.
|
|
6
|
-
*
|
|
7
|
-
* @since 2026-03-06
|
|
8
|
-
*/
|
|
9
|
-
export interface ConsentConfiguration {
|
|
10
|
-
analyticsEnabled: boolean;
|
|
11
|
-
consentDate: Date;
|
|
12
|
-
consentVersion: string;
|
|
13
|
-
lastOptOut: Date | undefined;
|
|
14
|
-
categories: {
|
|
15
|
-
reflections: boolean;
|
|
16
|
-
logs: boolean;
|
|
17
|
-
metrics: boolean;
|
|
18
|
-
patterns: boolean;
|
|
19
|
-
};
|
|
20
|
-
projectId: string;
|
|
21
|
-
}
|
|
22
|
-
export interface ConsentCategory {
|
|
23
|
-
name: string;
|
|
24
|
-
description: string;
|
|
25
|
-
enabled: boolean;
|
|
26
|
-
}
|
|
27
|
-
export declare class ConsentManager {
|
|
28
|
-
private configPath;
|
|
29
|
-
private config;
|
|
30
|
-
private submissionQueue;
|
|
31
|
-
constructor(configPath?: string | undefined);
|
|
32
|
-
/**
|
|
33
|
-
* Initialize consent manager - load existing config or create default
|
|
34
|
-
*/
|
|
35
|
-
initialize(): Promise<ConsentConfiguration>;
|
|
36
|
-
/**
|
|
37
|
-
* Enable analytics (opt-in)
|
|
38
|
-
*/
|
|
39
|
-
enableConsent(categories?: string[]): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* Disable analytics (opt-out)
|
|
42
|
-
*/
|
|
43
|
-
disableConsent(): Promise<void>;
|
|
44
|
-
/**
|
|
45
|
-
* Check if submission is allowed for a category
|
|
46
|
-
*/
|
|
47
|
-
canSubmit(category: string): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Get current consent status
|
|
50
|
-
*/
|
|
51
|
-
getStatus(): Promise<ConsentConfiguration>;
|
|
52
|
-
/**
|
|
53
|
-
* Enable specific category
|
|
54
|
-
*/
|
|
55
|
-
enableCategory(category: string): Promise<void>;
|
|
56
|
-
/**
|
|
57
|
-
* Disable specific category
|
|
58
|
-
*/
|
|
59
|
-
disableCategory(category: string): Promise<void>;
|
|
60
|
-
/**
|
|
61
|
-
* Get all categories with their status
|
|
62
|
-
*/
|
|
63
|
-
getCategories(): ConsentCategory[];
|
|
64
|
-
/**
|
|
65
|
-
* Generate anonymous project ID
|
|
66
|
-
*/
|
|
67
|
-
private generateProjectId;
|
|
68
|
-
/**
|
|
69
|
-
* Create default disabled configuration
|
|
70
|
-
*/
|
|
71
|
-
private createDefaultConfig;
|
|
72
|
-
/**
|
|
73
|
-
* Load configuration from file
|
|
74
|
-
*/
|
|
75
|
-
private loadConfig;
|
|
76
|
-
/**
|
|
77
|
-
* Save configuration to file
|
|
78
|
-
*/
|
|
79
|
-
private saveConfig;
|
|
80
|
-
/**
|
|
81
|
-
* Clear submission queue
|
|
82
|
-
*/
|
|
83
|
-
private clearSubmissionQueue;
|
|
84
|
-
/**
|
|
85
|
-
* Add item to submission queue
|
|
86
|
-
*/
|
|
87
|
-
queueSubmission(data: unknown): Promise<void>;
|
|
88
|
-
/**
|
|
89
|
-
* Save submission queue to file
|
|
90
|
-
*/
|
|
91
|
-
private saveSubmissionQueue;
|
|
92
|
-
}
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Consent Manager for 0xRay Central Analytics
|
|
3
|
-
*
|
|
4
|
-
* Manages user consent for analytics data submission with granular
|
|
5
|
-
* control over what categories can be shared.
|
|
6
|
-
*
|
|
7
|
-
* @since 2026-03-06
|
|
8
|
-
*/
|
|
9
|
-
import * as fs from "fs/promises";
|
|
10
|
-
import * as path from "path";
|
|
11
|
-
import { frameworkLogger } from "../core/framework-logger.js";
|
|
12
|
-
import { getConfigDir, resolveConfigPath } from "../core/config-paths.js";
|
|
13
|
-
export class ConsentManager {
|
|
14
|
-
configPath;
|
|
15
|
-
config = null;
|
|
16
|
-
submissionQueue = [];
|
|
17
|
-
constructor(configPath = undefined) {
|
|
18
|
-
this.configPath = configPath || resolveConfigPath("consent.json") || path.join(getConfigDir(), "consent.json");
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Initialize consent manager - load existing config or create default
|
|
22
|
-
*/
|
|
23
|
-
async initialize() {
|
|
24
|
-
try {
|
|
25
|
-
await this.loadConfig();
|
|
26
|
-
if (!this.config) {
|
|
27
|
-
// Create default disabled configuration
|
|
28
|
-
this.config = this.createDefaultConfig();
|
|
29
|
-
await this.saveConfig();
|
|
30
|
-
}
|
|
31
|
-
return this.config;
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
// If config doesn't exist, create default
|
|
35
|
-
this.config = this.createDefaultConfig();
|
|
36
|
-
await this.saveConfig();
|
|
37
|
-
return this.config;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Enable analytics (opt-in)
|
|
42
|
-
*/
|
|
43
|
-
async enableConsent(categories) {
|
|
44
|
-
if (!this.config) {
|
|
45
|
-
await this.initialize();
|
|
46
|
-
}
|
|
47
|
-
if (!this.config) {
|
|
48
|
-
throw new Error("Failed to initialize consent configuration");
|
|
49
|
-
}
|
|
50
|
-
// Enable all categories if none specified
|
|
51
|
-
const categoriesToEnable = categories || Object.keys(this.config.categories);
|
|
52
|
-
// Enable main analytics flag
|
|
53
|
-
this.config.analyticsEnabled = true;
|
|
54
|
-
this.config.consentDate = new Date();
|
|
55
|
-
this.config.consentVersion = "1.0";
|
|
56
|
-
// Enable specified categories
|
|
57
|
-
categoriesToEnable.forEach(cat => {
|
|
58
|
-
if (this.config && cat in this.config.categories) {
|
|
59
|
-
this.config.categories[cat] = true;
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
// Generate project ID if not exists
|
|
63
|
-
if (!this.config.projectId || this.config.projectId === "") {
|
|
64
|
-
this.config.projectId = this.generateProjectId();
|
|
65
|
-
}
|
|
66
|
-
await this.saveConfig();
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Disable analytics (opt-out)
|
|
70
|
-
*/
|
|
71
|
-
async disableConsent() {
|
|
72
|
-
if (!this.config) {
|
|
73
|
-
await this.initialize();
|
|
74
|
-
}
|
|
75
|
-
if (!this.config) {
|
|
76
|
-
throw new Error("Failed to initialize consent configuration");
|
|
77
|
-
}
|
|
78
|
-
// Disable all analytics
|
|
79
|
-
this.config.analyticsEnabled = false;
|
|
80
|
-
this.config.lastOptOut = new Date();
|
|
81
|
-
// Disable all categories
|
|
82
|
-
Object.keys(this.config.categories).forEach(cat => {
|
|
83
|
-
this.config.categories[cat] = false;
|
|
84
|
-
});
|
|
85
|
-
await this.saveConfig();
|
|
86
|
-
// Clear submission queue
|
|
87
|
-
await this.clearSubmissionQueue();
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Check if submission is allowed for a category
|
|
91
|
-
*/
|
|
92
|
-
canSubmit(category) {
|
|
93
|
-
if (!this.config) {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
return this.config.analyticsEnabled &&
|
|
97
|
-
this.config.categories[category] === true;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Get current consent status
|
|
101
|
-
*/
|
|
102
|
-
async getStatus() {
|
|
103
|
-
if (!this.config) {
|
|
104
|
-
await this.initialize();
|
|
105
|
-
}
|
|
106
|
-
if (!this.config) {
|
|
107
|
-
throw new Error("Failed to load consent configuration");
|
|
108
|
-
}
|
|
109
|
-
return { ...this.config };
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Enable specific category
|
|
113
|
-
*/
|
|
114
|
-
async enableCategory(category) {
|
|
115
|
-
if (!this.config) {
|
|
116
|
-
await this.initialize();
|
|
117
|
-
}
|
|
118
|
-
if (!this.config || !(category in this.config.categories)) {
|
|
119
|
-
throw new Error(`Invalid category: ${category}`);
|
|
120
|
-
}
|
|
121
|
-
this.config.categories[category] = true;
|
|
122
|
-
await this.saveConfig();
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Disable specific category
|
|
126
|
-
*/
|
|
127
|
-
async disableCategory(category) {
|
|
128
|
-
if (!this.config) {
|
|
129
|
-
await this.initialize();
|
|
130
|
-
}
|
|
131
|
-
if (!this.config || !(category in this.config.categories)) {
|
|
132
|
-
throw new Error(`Invalid category: ${category}`);
|
|
133
|
-
}
|
|
134
|
-
this.config.categories[category] = false;
|
|
135
|
-
await this.saveConfig();
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Get all categories with their status
|
|
139
|
-
*/
|
|
140
|
-
getCategories() {
|
|
141
|
-
if (!this.config) {
|
|
142
|
-
return [];
|
|
143
|
-
}
|
|
144
|
-
const categoryInfo = {
|
|
145
|
-
reflections: "Anonymized reflection data for pattern learning",
|
|
146
|
-
logs: "Framework activity logs for performance analysis",
|
|
147
|
-
metrics: "Agent performance and routing metrics",
|
|
148
|
-
patterns: "P9 pattern learning data and insights"
|
|
149
|
-
};
|
|
150
|
-
return Object.entries(this.config.categories).map(([name, enabled]) => ({
|
|
151
|
-
name,
|
|
152
|
-
description: categoryInfo[name] || "",
|
|
153
|
-
enabled: enabled
|
|
154
|
-
}));
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Generate anonymous project ID
|
|
158
|
-
*/
|
|
159
|
-
generateProjectId() {
|
|
160
|
-
// Generate UUID-like identifier
|
|
161
|
-
const timestamp = Date.now().toString(36);
|
|
162
|
-
const random = Math.random().toString(36).substring(2, 8);
|
|
163
|
-
return `project-${timestamp}-${random}`;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Create default disabled configuration
|
|
167
|
-
*/
|
|
168
|
-
createDefaultConfig() {
|
|
169
|
-
return {
|
|
170
|
-
analyticsEnabled: false,
|
|
171
|
-
consentDate: new Date(),
|
|
172
|
-
consentVersion: "1.0",
|
|
173
|
-
lastOptOut: undefined,
|
|
174
|
-
categories: {
|
|
175
|
-
reflections: false,
|
|
176
|
-
logs: false,
|
|
177
|
-
metrics: false,
|
|
178
|
-
patterns: false
|
|
179
|
-
},
|
|
180
|
-
projectId: this.generateProjectId()
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Load configuration from file
|
|
185
|
-
*/
|
|
186
|
-
async loadConfig() {
|
|
187
|
-
try {
|
|
188
|
-
const configData = await fs.readFile(this.configPath, "utf-8");
|
|
189
|
-
this.config = JSON.parse(configData);
|
|
190
|
-
// Convert date strings back to Date objects
|
|
191
|
-
if (this.config.consentDate) {
|
|
192
|
-
this.config.consentDate = new Date(this.config.consentDate);
|
|
193
|
-
}
|
|
194
|
-
if (this.config.lastOptOut) {
|
|
195
|
-
this.config.lastOptOut = new Date(this.config.lastOptOut);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
catch (error) {
|
|
199
|
-
// Config doesn't exist or is invalid
|
|
200
|
-
this.config = null;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Save configuration to file
|
|
205
|
-
*/
|
|
206
|
-
async saveConfig() {
|
|
207
|
-
if (!this.config) {
|
|
208
|
-
throw new Error("No configuration to save");
|
|
209
|
-
}
|
|
210
|
-
// Ensure directory exists
|
|
211
|
-
const configDir = path.dirname(this.configPath);
|
|
212
|
-
try {
|
|
213
|
-
await fs.mkdir(configDir, { recursive: true });
|
|
214
|
-
}
|
|
215
|
-
catch {
|
|
216
|
-
// Directory already exists
|
|
217
|
-
}
|
|
218
|
-
await fs.writeFile(this.configPath, JSON.stringify(this.config, null, 2), "utf-8");
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Clear submission queue
|
|
222
|
-
*/
|
|
223
|
-
async clearSubmissionQueue() {
|
|
224
|
-
const queuePath = path.join(path.dirname(this.configPath), "analytics", "submission-queue.json");
|
|
225
|
-
try {
|
|
226
|
-
await fs.writeFile(queuePath, "[]", "utf-8");
|
|
227
|
-
this.submissionQueue = [];
|
|
228
|
-
}
|
|
229
|
-
catch (error) {
|
|
230
|
-
// Queue directory doesn't exist yet, which is fine
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Add item to submission queue
|
|
235
|
-
*/
|
|
236
|
-
async queueSubmission(data) {
|
|
237
|
-
if (!this.canSubmit("all")) {
|
|
238
|
-
throw new Error("Analytics is disabled or category not enabled");
|
|
239
|
-
}
|
|
240
|
-
this.submissionQueue.push(data);
|
|
241
|
-
await this.saveSubmissionQueue();
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Save submission queue to file
|
|
245
|
-
*/
|
|
246
|
-
async saveSubmissionQueue() {
|
|
247
|
-
const queueDir = path.join(path.dirname(this.configPath), "analytics");
|
|
248
|
-
const queuePath = path.join(queueDir, "submission-queue.json");
|
|
249
|
-
try {
|
|
250
|
-
await fs.mkdir(queueDir, { recursive: true });
|
|
251
|
-
await fs.writeFile(queuePath, JSON.stringify(this.submissionQueue, null, 2), "utf-8");
|
|
252
|
-
}
|
|
253
|
-
catch (error) {
|
|
254
|
-
frameworkLogger.log("consent-manager", "save-queue-failed", "error", { error, message: "Failed to save submission queue" });
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
export interface BenchmarkResult {
|
|
2
|
-
operation: string;
|
|
3
|
-
startTime: number;
|
|
4
|
-
endTime: number;
|
|
5
|
-
duration: number;
|
|
6
|
-
success: boolean;
|
|
7
|
-
metadata: Record<string, any>;
|
|
8
|
-
error?: string | undefined;
|
|
9
|
-
}
|
|
10
|
-
export interface PerformanceMetrics {
|
|
11
|
-
totalOperations: number;
|
|
12
|
-
successfulOperations: number;
|
|
13
|
-
failedOperations: number;
|
|
14
|
-
averageDuration: number;
|
|
15
|
-
medianDuration: number;
|
|
16
|
-
p95Duration: number;
|
|
17
|
-
p99Duration: number;
|
|
18
|
-
minDuration: number;
|
|
19
|
-
maxDuration: number;
|
|
20
|
-
throughput: number;
|
|
21
|
-
}
|
|
22
|
-
export interface BootBenchmarkResult {
|
|
23
|
-
totalBootTime: number;
|
|
24
|
-
phaseTimings: Record<string, number>;
|
|
25
|
-
componentLoadTimes: Record<string, number>;
|
|
26
|
-
memoryUsage: {
|
|
27
|
-
beforeBoot: number;
|
|
28
|
-
afterBoot: number;
|
|
29
|
-
peakDuringBoot: number;
|
|
30
|
-
};
|
|
31
|
-
success: boolean;
|
|
32
|
-
errors: string[];
|
|
33
|
-
orchestratorLoadTime?: number;
|
|
34
|
-
delegationInitTime?: number;
|
|
35
|
-
sessionManagementInitTime?: number;
|
|
36
|
-
processorActivationTime?: number;
|
|
37
|
-
agentLoadingTime?: number;
|
|
38
|
-
enforcementActivationTime?: number;
|
|
39
|
-
codexComplianceActivationTime?: number;
|
|
40
|
-
}
|
|
41
|
-
export interface OrchestratorBenchmarkResult {
|
|
42
|
-
taskExecutionTimes: number[];
|
|
43
|
-
delegationLatencies: number[];
|
|
44
|
-
conflictResolutionTimes: number[];
|
|
45
|
-
concurrentTaskThroughput: number;
|
|
46
|
-
dependencyResolutionTime: number;
|
|
47
|
-
overallSuccess: boolean;
|
|
48
|
-
}
|
|
49
|
-
export interface SessionBenchmarkResult {
|
|
50
|
-
stateShareLatencies: number[];
|
|
51
|
-
dependencyUpdateTimes: number[];
|
|
52
|
-
groupOperationTimes: number[];
|
|
53
|
-
migrationTimes: number[];
|
|
54
|
-
failoverTimes: number[];
|
|
55
|
-
concurrentSessionOperations: number;
|
|
56
|
-
}
|
|
57
|
-
export declare class XrayPerformanceBenchmark {
|
|
58
|
-
private results;
|
|
59
|
-
private activeBenchmarks;
|
|
60
|
-
/**
|
|
61
|
-
* Start a benchmark measurement
|
|
62
|
-
*/
|
|
63
|
-
startBenchmark(operation: string, metadata?: Record<string, any>): string;
|
|
64
|
-
/**
|
|
65
|
-
* End a benchmark measurement
|
|
66
|
-
*/
|
|
67
|
-
endBenchmark(benchmarkId: string, success?: boolean, error?: string): BenchmarkResult | null;
|
|
68
|
-
/**
|
|
69
|
-
* Benchmark boot sequence performance
|
|
70
|
-
*/
|
|
71
|
-
benchmarkBootSequence(_bootOrchestrator: unknown): Promise<BootBenchmarkResult>;
|
|
72
|
-
/**
|
|
73
|
-
* Benchmark orchestrator task execution
|
|
74
|
-
*/
|
|
75
|
-
benchmarkOrchestratorTasks(_orchestrator: unknown, taskCount?: number, concurrentTasks?: number): Promise<OrchestratorBenchmarkResult>;
|
|
76
|
-
/**
|
|
77
|
-
* Benchmark session management operations
|
|
78
|
-
*/
|
|
79
|
-
benchmarkSessionOperations(_sessionStateManager: unknown, operationCount?: number): Promise<SessionBenchmarkResult>;
|
|
80
|
-
/**
|
|
81
|
-
* Calculate performance metrics from benchmark results
|
|
82
|
-
*/
|
|
83
|
-
calculateMetrics(operationFilter?: string): PerformanceMetrics;
|
|
84
|
-
/**
|
|
85
|
-
* Generate comprehensive benchmark report
|
|
86
|
-
*/
|
|
87
|
-
generateReport(): {
|
|
88
|
-
summary: PerformanceMetrics;
|
|
89
|
-
bootBenchmark?: BootBenchmarkResult;
|
|
90
|
-
orchestratorBenchmark?: OrchestratorBenchmarkResult;
|
|
91
|
-
sessionBenchmark?: SessionBenchmarkResult;
|
|
92
|
-
recommendations: string[];
|
|
93
|
-
};
|
|
94
|
-
/**
|
|
95
|
-
* Clear all benchmark results
|
|
96
|
-
*/
|
|
97
|
-
clearResults(): void;
|
|
98
|
-
/**
|
|
99
|
-
* Export results for external analysis
|
|
100
|
-
*/
|
|
101
|
-
exportResults(): BenchmarkResult[];
|
|
102
|
-
}
|
|
103
|
-
export declare const performanceBenchmark: XrayPerformanceBenchmark;
|