0xray 2.1.4 → 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/dist/CHANGELOG.md +31 -0
- 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/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 +9 -0
- package/dist/mcps/config/server-config-registry.js +1 -1
- package/dist/mcps/governance.server.js +3 -4
- 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 +10 -0
- 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/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/state/index.d.ts +0 -2
- package/package.json +4 -3
- package/scripts/node/universal-version-manager.js +2 -2
- 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 +3 -5
- 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 +9 -0
- 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/skills/orchestrator/SKILL.md +1 -1
- 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,216 +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 { frameworkLogger } from "../core/framework-logger.js";
|
|
6
|
-
import { resolveConfigPath } from "../core/config-paths.js";
|
|
7
|
-
export class UniversalLibrarianConsultation {
|
|
8
|
-
ruleEnforcer;
|
|
9
|
-
constructor(ruleEnforcer) {
|
|
10
|
-
this.ruleEnforcer = ruleEnforcer;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Pre-action consultation - must be called before any major system action
|
|
14
|
-
*/
|
|
15
|
-
async consultBeforeAction(action) {
|
|
16
|
-
await frameworkLogger.log("universal-librarian-consultation", "pre-action-consultation-started", "info", {
|
|
17
|
-
actionType: action.type,
|
|
18
|
-
scope: action.scope,
|
|
19
|
-
complexity: action.complexity,
|
|
20
|
-
});
|
|
21
|
-
// Prevent recursive consultation loops (researcher operations triggering more researcher consultations)
|
|
22
|
-
if (this.isLibrarianOperation(action)) {
|
|
23
|
-
await frameworkLogger.log("universal-librarian-consultation", "pre-action-consultation-skipped", "info", {
|
|
24
|
-
reason: "researcher operation detected - skipping to prevent recursion",
|
|
25
|
-
actionType: action.type,
|
|
26
|
-
scope: action.scope,
|
|
27
|
-
});
|
|
28
|
-
return {
|
|
29
|
-
approved: true,
|
|
30
|
-
documentationImpact: "none",
|
|
31
|
-
versionUpdates: [],
|
|
32
|
-
recommendations: [],
|
|
33
|
-
pairProgrammingRequired: false,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
const documentationImpact = this.assessDocumentationImpact(action);
|
|
37
|
-
const versionUpdates = await this.determineVersionUpdates(action);
|
|
38
|
-
const pairProgrammingRequired = this.requiresPairProgramming(action);
|
|
39
|
-
const recommendations = this.generateRecommendations(action, documentationImpact);
|
|
40
|
-
const approved = action.complexity !== "critical" || documentationImpact !== "critical";
|
|
41
|
-
const result = {
|
|
42
|
-
approved,
|
|
43
|
-
documentationImpact,
|
|
44
|
-
versionUpdates,
|
|
45
|
-
recommendations,
|
|
46
|
-
pairProgrammingRequired,
|
|
47
|
-
};
|
|
48
|
-
await frameworkLogger.log("universal-librarian-consultation", "pre-action-consultation-completed", approved ? "success" : "error", {
|
|
49
|
-
approved,
|
|
50
|
-
documentationImpact,
|
|
51
|
-
versionUpdatesCount: versionUpdates.length,
|
|
52
|
-
pairProgrammingRequired,
|
|
53
|
-
});
|
|
54
|
-
return result;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Post-action consultation - must be called after any major system action
|
|
58
|
-
*/
|
|
59
|
-
async consultAfterAction(action, result) {
|
|
60
|
-
await frameworkLogger.log("universal-librarian-consultation", "post-action-consultation-started", "info", {
|
|
61
|
-
actionType: action.type,
|
|
62
|
-
scope: action.scope,
|
|
63
|
-
result: result ? "success" : "failure",
|
|
64
|
-
});
|
|
65
|
-
await this.updateDocumentation(action, result);
|
|
66
|
-
await this.updateVersions(action, result);
|
|
67
|
-
await this.validateDocumentationIntegrity(action);
|
|
68
|
-
await frameworkLogger.log("universal-librarian-consultation", "post-action-consultation-completed", "success", {
|
|
69
|
-
actionType: action.type,
|
|
70
|
-
scope: action.scope,
|
|
71
|
-
documentationUpdated: true,
|
|
72
|
-
versionsUpdated: true,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Check if this action is related to researcher operations (to prevent recursion)
|
|
77
|
-
*/
|
|
78
|
-
isLibrarianOperation(action) {
|
|
79
|
-
return (action.scope === "documentation" ||
|
|
80
|
-
(action.type === "rule-modification" &&
|
|
81
|
-
action.description.includes("researcher")) ||
|
|
82
|
-
action.metadata?.triggeredBy === "researcher" ||
|
|
83
|
-
action.description.includes("researcher consultation"));
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Assess documentation impact of the action
|
|
87
|
-
*/
|
|
88
|
-
assessDocumentationImpact(action) {
|
|
89
|
-
if (action.scope === "documentation") {
|
|
90
|
-
return action.complexity === "critical" ? "critical" : "major";
|
|
91
|
-
}
|
|
92
|
-
if (action.scope === "framework" && action.complexity === "high") {
|
|
93
|
-
return "major";
|
|
94
|
-
}
|
|
95
|
-
if (action.scope === "agent" || action.scope === "tool") {
|
|
96
|
-
return action.complexity === "low" ? "minor" : "major";
|
|
97
|
-
}
|
|
98
|
-
if (action.scope === "configuration" && action.complexity === "high") {
|
|
99
|
-
return "major";
|
|
100
|
-
}
|
|
101
|
-
return "none";
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Determine what version updates are needed
|
|
105
|
-
*/
|
|
106
|
-
async determineVersionUpdates(action) {
|
|
107
|
-
const updates = [];
|
|
108
|
-
if (action.type === "rule-modification" || action.scope === "framework") {
|
|
109
|
-
const codexPath = resolveConfigPath("codex.json") || "codex.json";
|
|
110
|
-
updates.push({
|
|
111
|
-
file: codexPath,
|
|
112
|
-
field: "version",
|
|
113
|
-
oldVersion: "1.1.1",
|
|
114
|
-
newVersion: "1.1.2",
|
|
115
|
-
reason: `Updated for ${action.type}: ${action.description}`,
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
if (action.complexity === "critical") {
|
|
119
|
-
updates.push({
|
|
120
|
-
file: "package.json",
|
|
121
|
-
field: "version",
|
|
122
|
-
oldVersion: "1.1.1",
|
|
123
|
-
newVersion: "1.1.2",
|
|
124
|
-
reason: `Major ${action.scope} changes: ${action.description}`,
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
return updates;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Check if pair programming with researcher is required
|
|
131
|
-
*/
|
|
132
|
-
requiresPairProgramming(action) {
|
|
133
|
-
return (action.complexity === "critical" ||
|
|
134
|
-
action.scope === "framework" ||
|
|
135
|
-
action.type === "architectural-change" ||
|
|
136
|
-
action.type === "rule-modification");
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Generate recommendations for the action
|
|
140
|
-
*/
|
|
141
|
-
generateRecommendations(action, documentationImpact) {
|
|
142
|
-
const recommendations = [];
|
|
143
|
-
if (documentationImpact === "major" || documentationImpact === "critical") {
|
|
144
|
-
recommendations.push("Update architecture documentation");
|
|
145
|
-
recommendations.push("Update API documentation if interfaces changed");
|
|
146
|
-
recommendations.push("Update README.md with new capabilities");
|
|
147
|
-
}
|
|
148
|
-
if (action.type === "rule-modification") {
|
|
149
|
-
recommendations.push("Ensure rule mappings are updated in agent-delegator");
|
|
150
|
-
recommendations.push("Update AGENTS.md with any new enforceable rules");
|
|
151
|
-
}
|
|
152
|
-
if (action.scope === "agent") {
|
|
153
|
-
recommendations.push("Update agent capability documentation");
|
|
154
|
-
recommendations.push("Verify agent tool mappings are complete");
|
|
155
|
-
}
|
|
156
|
-
if (action.complexity === "critical") {
|
|
157
|
-
recommendations.push("Consider updating version to indicate breaking changes");
|
|
158
|
-
recommendations.push("Update changelog with major changes");
|
|
159
|
-
}
|
|
160
|
-
return recommendations;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Update documentation after action completion
|
|
164
|
-
*/
|
|
165
|
-
async updateDocumentation(action, _result) {
|
|
166
|
-
await frameworkLogger.log("universal-librarian-consultation", "documentation-update-triggered", "info", {
|
|
167
|
-
actionType: action.type,
|
|
168
|
-
scope: action.scope,
|
|
169
|
-
filesToUpdate: this.determineDocumentationFiles(action),
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Update versions after action completion
|
|
174
|
-
*/
|
|
175
|
-
async updateVersions(action, _result) {
|
|
176
|
-
await frameworkLogger.log("universal-librarian-consultation", "version-update-triggered", "info", {
|
|
177
|
-
actionType: action.type,
|
|
178
|
-
scope: action.scope,
|
|
179
|
-
versionUpdates: await this.determineVersionUpdates(action),
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Validate documentation integrity
|
|
184
|
-
*/
|
|
185
|
-
async validateDocumentationIntegrity(action) {
|
|
186
|
-
await frameworkLogger.log("universal-librarian-consultation", "documentation-integrity-validation", "info", {
|
|
187
|
-
actionType: action.type,
|
|
188
|
-
scope: action.scope,
|
|
189
|
-
validationPerformed: true,
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Determine which documentation files need updating
|
|
194
|
-
*/
|
|
195
|
-
determineDocumentationFiles(action) {
|
|
196
|
-
const files = [];
|
|
197
|
-
if (action.scope === "framework") {
|
|
198
|
-
files.push("README.md", "docs/ARCHITECTURE.md", "AGENTS.md");
|
|
199
|
-
}
|
|
200
|
-
if (action.scope === "agent") {
|
|
201
|
-
files.push("AGENTS.md", "docs/agent-capabilities.md");
|
|
202
|
-
}
|
|
203
|
-
if (action.scope === "tool") {
|
|
204
|
-
files.push("docs/tool-integration.md");
|
|
205
|
-
}
|
|
206
|
-
if (action.type === "rule-modification") {
|
|
207
|
-
files.push("AGENTS.md", "docs/rule-enforcement.md");
|
|
208
|
-
}
|
|
209
|
-
if (action.type === "architectural-change") {
|
|
210
|
-
files.push("docs/ARCHITECTURE.md", "docs/architectural-decisions.md");
|
|
211
|
-
}
|
|
212
|
-
return files;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
// Export singleton instance
|
|
216
|
-
export const universalLibrarianConsultation = new UniversalLibrarianConsultation(null);
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Universal Registry Bridge
|
|
3
|
-
*
|
|
4
|
-
* Connects 0xRay to external agent registries.
|
|
5
|
-
* Enables dynamic agent configuration loading from external sources.
|
|
6
|
-
*
|
|
7
|
-
* @version 1.0.0
|
|
8
|
-
* @since 2026-02-14
|
|
9
|
-
*/
|
|
10
|
-
import type { AgentConfig } from "../agents/types.js";
|
|
11
|
-
export interface ExternalRegistryConfig {
|
|
12
|
-
type: "file" | "http" | "npm";
|
|
13
|
-
location: string;
|
|
14
|
-
refreshInterval?: number;
|
|
15
|
-
}
|
|
16
|
-
export interface RegistryAgentDefinition {
|
|
17
|
-
name: string;
|
|
18
|
-
description: string;
|
|
19
|
-
version: string;
|
|
20
|
-
capabilities?: string[];
|
|
21
|
-
config?: Record<string, unknown>;
|
|
22
|
-
}
|
|
23
|
-
export interface BridgeOptions {
|
|
24
|
-
registries: ExternalRegistryConfig[];
|
|
25
|
-
cacheDir?: string;
|
|
26
|
-
autoRefresh?: boolean;
|
|
27
|
-
}
|
|
28
|
-
export declare class UniversalRegistryBridge {
|
|
29
|
-
private registries;
|
|
30
|
-
private cacheDir;
|
|
31
|
-
private autoRefresh;
|
|
32
|
-
private cache;
|
|
33
|
-
private logger;
|
|
34
|
-
constructor(options: BridgeOptions);
|
|
35
|
-
/**
|
|
36
|
-
* Load agents from all configured registries
|
|
37
|
-
*/
|
|
38
|
-
loadAgents(): Promise<RegistryAgentDefinition[]>;
|
|
39
|
-
/**
|
|
40
|
-
* Fetch agents from a specific registry
|
|
41
|
-
*/
|
|
42
|
-
private fetchFromRegistry;
|
|
43
|
-
/**
|
|
44
|
-
* Load agents from a local file
|
|
45
|
-
*/
|
|
46
|
-
private loadFromFile;
|
|
47
|
-
/**
|
|
48
|
-
* Simple YAML parser for agent definitions
|
|
49
|
-
* Handles basic agent registry format
|
|
50
|
-
*/
|
|
51
|
-
private parseYamlAgents;
|
|
52
|
-
/**
|
|
53
|
-
* Load agents from HTTP endpoint
|
|
54
|
-
*/
|
|
55
|
-
private loadFromHttp;
|
|
56
|
-
/**
|
|
57
|
-
* Load agents from npm package
|
|
58
|
-
*/
|
|
59
|
-
private loadFromNpm;
|
|
60
|
-
/**
|
|
61
|
-
* Convert registry definition to AgentConfig
|
|
62
|
-
*/
|
|
63
|
-
toAgentConfig(registryDef: RegistryAgentDefinition): Partial<AgentConfig>;
|
|
64
|
-
/**
|
|
65
|
-
* Get cached agents from a specific registry
|
|
66
|
-
*/
|
|
67
|
-
getCached(registryType: string, location: string): RegistryAgentDefinition[] | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* Clear the cache
|
|
70
|
-
*/
|
|
71
|
-
clearCache(): void;
|
|
72
|
-
/**
|
|
73
|
-
* Add a new registry dynamically
|
|
74
|
-
*/
|
|
75
|
-
addRegistry(registry: ExternalRegistryConfig): void;
|
|
76
|
-
/**
|
|
77
|
-
* Get all configured registries
|
|
78
|
-
*/
|
|
79
|
-
getRegistries(): ExternalRegistryConfig[];
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Create a bridge from integration config
|
|
83
|
-
*/
|
|
84
|
-
export declare function createRegistryBridge(configPath?: string): Promise<UniversalRegistryBridge>;
|
|
85
|
-
export declare function getDefaultBridge(): UniversalRegistryBridge;
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Universal Registry Bridge
|
|
3
|
-
*
|
|
4
|
-
* Connects 0xRay to external agent registries.
|
|
5
|
-
* Enables dynamic agent configuration loading from external sources.
|
|
6
|
-
*
|
|
7
|
-
* @version 1.0.0
|
|
8
|
-
* @since 2026-02-14
|
|
9
|
-
*/
|
|
10
|
-
import { readFile } from "fs/promises";
|
|
11
|
-
import { existsSync } from "fs";
|
|
12
|
-
import { resolve, dirname, join } from "path";
|
|
13
|
-
import { fileURLToPath } from "url";
|
|
14
|
-
import { frameworkLogger } from "../core/framework-logger.js";
|
|
15
|
-
import { getConfigDir } from "../core/config-paths.js";
|
|
16
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
17
|
-
const __dirname = dirname(__filename);
|
|
18
|
-
export class UniversalRegistryBridge {
|
|
19
|
-
registries;
|
|
20
|
-
cacheDir;
|
|
21
|
-
autoRefresh;
|
|
22
|
-
cache = new Map();
|
|
23
|
-
logger = frameworkLogger;
|
|
24
|
-
constructor(options) {
|
|
25
|
-
this.registries = options.registries || [];
|
|
26
|
-
this.cacheDir =
|
|
27
|
-
options.cacheDir || join(getConfigDir(), "registry-cache");
|
|
28
|
-
this.autoRefresh = options.autoRefresh ?? true;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Load agents from all configured registries
|
|
32
|
-
*/
|
|
33
|
-
async loadAgents() {
|
|
34
|
-
const allAgents = [];
|
|
35
|
-
for (const registry of this.registries) {
|
|
36
|
-
try {
|
|
37
|
-
const agents = await this.fetchFromRegistry(registry);
|
|
38
|
-
allAgents.push(...agents);
|
|
39
|
-
this.logger.log("universal-registry-bridge", `Loaded ${agents.length} agents from ${registry.type} registry: ${registry.location}`, "info");
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
this.logger.log("universal-registry-bridge", `Failed to load from registry ${registry.location}: ${error}`, "info");
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return allAgents;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Fetch agents from a specific registry
|
|
49
|
-
*/
|
|
50
|
-
async fetchFromRegistry(registry) {
|
|
51
|
-
// Check cache first
|
|
52
|
-
const cacheKey = `${registry.type}:${registry.location}`;
|
|
53
|
-
const cached = this.cache.get(cacheKey);
|
|
54
|
-
if (cached && !this.autoRefresh) {
|
|
55
|
-
return cached;
|
|
56
|
-
}
|
|
57
|
-
let agents;
|
|
58
|
-
switch (registry.type) {
|
|
59
|
-
case "file":
|
|
60
|
-
agents = await this.loadFromFile(registry.location);
|
|
61
|
-
break;
|
|
62
|
-
case "http":
|
|
63
|
-
agents = await this.loadFromHttp(registry.location);
|
|
64
|
-
break;
|
|
65
|
-
case "npm":
|
|
66
|
-
agents = await this.loadFromNpm(registry.location);
|
|
67
|
-
break;
|
|
68
|
-
default:
|
|
69
|
-
this.logger.log("universal-registry-bridge", `Unknown registry type: ${registry.type}`, "info");
|
|
70
|
-
return [];
|
|
71
|
-
}
|
|
72
|
-
this.cache.set(cacheKey, agents);
|
|
73
|
-
return agents;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Load agents from a local file
|
|
77
|
-
*/
|
|
78
|
-
async loadFromFile(location) {
|
|
79
|
-
const filePath = resolve(location);
|
|
80
|
-
if (!existsSync(filePath)) {
|
|
81
|
-
throw new Error(`Registry file not found: ${filePath}`);
|
|
82
|
-
}
|
|
83
|
-
const content = await readFile(filePath, "utf-8");
|
|
84
|
-
const ext = location.toLowerCase();
|
|
85
|
-
if (ext.endsWith(".json")) {
|
|
86
|
-
return JSON.parse(content);
|
|
87
|
-
}
|
|
88
|
-
else if (ext.endsWith(".yaml") || ext.endsWith(".yml")) {
|
|
89
|
-
// Simple YAML parser for agent definitions
|
|
90
|
-
return this.parseYamlAgents(content);
|
|
91
|
-
}
|
|
92
|
-
throw new Error(`Unsupported file format: ${location}`);
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Simple YAML parser for agent definitions
|
|
96
|
-
* Handles basic agent registry format
|
|
97
|
-
*/
|
|
98
|
-
parseYamlAgents(content) {
|
|
99
|
-
const agents = [];
|
|
100
|
-
const lines = content.split("\n");
|
|
101
|
-
let currentAgent = null;
|
|
102
|
-
let inAgent = false;
|
|
103
|
-
for (const line of lines) {
|
|
104
|
-
const trimmed = line.trim();
|
|
105
|
-
if (trimmed.startsWith("agents:")) {
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
// Check for new agent entry (name: xxx)
|
|
109
|
-
const nameMatch = trimmed.match(/^-\s*name:\s*(.+)$/);
|
|
110
|
-
if (nameMatch && nameMatch[1]) {
|
|
111
|
-
if (inAgent && currentAgent) {
|
|
112
|
-
agents.push(currentAgent);
|
|
113
|
-
}
|
|
114
|
-
currentAgent = {
|
|
115
|
-
name: nameMatch[1].trim(),
|
|
116
|
-
description: "",
|
|
117
|
-
version: "2.1.3",
|
|
118
|
-
};
|
|
119
|
-
inAgent = true;
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
if (inAgent && currentAgent) {
|
|
123
|
-
const descMatch = trimmed.match(/^description:\s*(.+)$/);
|
|
124
|
-
if (descMatch && descMatch[1]) {
|
|
125
|
-
currentAgent.description = descMatch[1].trim();
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
const versionMatch = trimmed.match(/^version:\s*(.+)$/);
|
|
129
|
-
if (versionMatch && versionMatch[1]) {
|
|
130
|
-
currentAgent.version = versionMatch[1].trim();
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
// Push last agent
|
|
136
|
-
if (inAgent && currentAgent) {
|
|
137
|
-
agents.push(currentAgent);
|
|
138
|
-
}
|
|
139
|
-
return agents;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Load agents from HTTP endpoint
|
|
143
|
-
*/
|
|
144
|
-
async loadFromHttp(location) {
|
|
145
|
-
try {
|
|
146
|
-
const response = await fetch(location);
|
|
147
|
-
if (!response.ok) {
|
|
148
|
-
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
149
|
-
}
|
|
150
|
-
return await response.json();
|
|
151
|
-
}
|
|
152
|
-
catch (error) {
|
|
153
|
-
throw new Error(`Failed to fetch from ${location}: ${error}`);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Load agents from npm package
|
|
158
|
-
*/
|
|
159
|
-
async loadFromNpm(packageName) {
|
|
160
|
-
try {
|
|
161
|
-
const response = await fetch(`https://registry.npmjs.org/${packageName}/latest`);
|
|
162
|
-
if (!response.ok) {
|
|
163
|
-
throw new Error(`npm API error: ${response.status}`);
|
|
164
|
-
}
|
|
165
|
-
const pkg = await response.json();
|
|
166
|
-
// Look for agent definitions in package exports
|
|
167
|
-
if (pkg.stringray?.agents) {
|
|
168
|
-
return pkg.stringray.agents;
|
|
169
|
-
}
|
|
170
|
-
return [];
|
|
171
|
-
}
|
|
172
|
-
catch (error) {
|
|
173
|
-
throw new Error(`Failed to load npm package ${packageName}: ${error}`);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Convert registry definition to AgentConfig
|
|
178
|
-
*/
|
|
179
|
-
toAgentConfig(registryDef) {
|
|
180
|
-
return {
|
|
181
|
-
name: registryDef.name,
|
|
182
|
-
description: registryDef.description,
|
|
183
|
-
capabilities: registryDef.capabilities || [],
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Get cached agents from a specific registry
|
|
188
|
-
*/
|
|
189
|
-
getCached(registryType, location) {
|
|
190
|
-
return this.cache.get(`${registryType}:${location}`);
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Clear the cache
|
|
194
|
-
*/
|
|
195
|
-
clearCache() {
|
|
196
|
-
this.cache.clear();
|
|
197
|
-
this.logger.log("universal-registry-bridge", "Registry cache cleared", "info");
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Add a new registry dynamically
|
|
201
|
-
*/
|
|
202
|
-
addRegistry(registry) {
|
|
203
|
-
this.registries.push(registry);
|
|
204
|
-
this.logger.log("universal-registry-bridge", `Added registry: ${registry.type}:${registry.location}`, "info");
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Get all configured registries
|
|
208
|
-
*/
|
|
209
|
-
getRegistries() {
|
|
210
|
-
return [...this.registries];
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Create a bridge from integration config
|
|
215
|
-
*/
|
|
216
|
-
export async function createRegistryBridge(configPath) {
|
|
217
|
-
const defaultPath = resolve(process.cwd(), ".stringray/integration/registries.json");
|
|
218
|
-
const path = configPath || defaultPath;
|
|
219
|
-
let registries = [];
|
|
220
|
-
if (existsSync(path)) {
|
|
221
|
-
try {
|
|
222
|
-
const content = await readFile(path, "utf-8");
|
|
223
|
-
const config = JSON.parse(content);
|
|
224
|
-
registries = config.registries || [];
|
|
225
|
-
}
|
|
226
|
-
catch (error) {
|
|
227
|
-
frameworkLogger.log("universal-registry-bridge", `Failed to load registry config from ${path}: ${error}`, "info");
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
return new UniversalRegistryBridge({
|
|
231
|
-
registries,
|
|
232
|
-
autoRefresh: true,
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Default bridge instance for quick access
|
|
237
|
-
*/
|
|
238
|
-
let defaultBridge = null;
|
|
239
|
-
export function getDefaultBridge() {
|
|
240
|
-
if (!defaultBridge) {
|
|
241
|
-
defaultBridge = new UniversalRegistryBridge({
|
|
242
|
-
registries: [],
|
|
243
|
-
autoRefresh: false,
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
return defaultBridge;
|
|
247
|
-
}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Performance Budget Enforcement System
|
|
3
|
-
*
|
|
4
|
-
* Comprehensive performance testing and monitoring system that enforces
|
|
5
|
-
* Universal Development Codex performance budget requirements.
|
|
6
|
-
*
|
|
7
|
-
* Performance Budget Requirements:
|
|
8
|
-
* - Bundle size <2MB (gzipped <700KB)
|
|
9
|
-
* - First Contentful Paint <2s
|
|
10
|
-
* - Time to Interactive <5s
|
|
11
|
-
*
|
|
12
|
-
* @version 1.0.0
|
|
13
|
-
* @since 2026-01-08
|
|
14
|
-
*/
|
|
15
|
-
import { EventEmitter } from "events";
|
|
16
|
-
export declare const PERFORMANCE_BUDGET: {
|
|
17
|
-
readonly bundleSize: {
|
|
18
|
-
readonly uncompressed: number;
|
|
19
|
-
readonly gzipped: number;
|
|
20
|
-
};
|
|
21
|
-
readonly webVitals: {
|
|
22
|
-
readonly firstContentfulPaint: 2000;
|
|
23
|
-
readonly timeToInteractive: 5000;
|
|
24
|
-
readonly largestContentfulPaint: 2500;
|
|
25
|
-
readonly cumulativeLayoutShift: 0.1;
|
|
26
|
-
readonly firstInputDelay: 100;
|
|
27
|
-
};
|
|
28
|
-
readonly runtime: {
|
|
29
|
-
readonly memoryUsage: number;
|
|
30
|
-
readonly startupTime: 100;
|
|
31
|
-
readonly testExecutionTime: 5000;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
export interface BundleSizeMetrics {
|
|
35
|
-
totalSize: number;
|
|
36
|
-
gzippedSize: number;
|
|
37
|
-
fileCount: number;
|
|
38
|
-
largestFile: {
|
|
39
|
-
name: string;
|
|
40
|
-
size: number;
|
|
41
|
-
gzippedSize: number;
|
|
42
|
-
};
|
|
43
|
-
breakdown: Array<{
|
|
44
|
-
name: string;
|
|
45
|
-
size: number;
|
|
46
|
-
gzippedSize: number;
|
|
47
|
-
percentage: number;
|
|
48
|
-
}>;
|
|
49
|
-
}
|
|
50
|
-
export interface WebVitalsMetrics {
|
|
51
|
-
firstContentfulPaint: number;
|
|
52
|
-
timeToInteractive: number;
|
|
53
|
-
largestContentfulPaint: number;
|
|
54
|
-
cumulativeLayoutShift: number;
|
|
55
|
-
firstInputDelay: number;
|
|
56
|
-
timestamp: number;
|
|
57
|
-
}
|
|
58
|
-
export interface RuntimePerformanceMetrics {
|
|
59
|
-
memoryUsage: {
|
|
60
|
-
rss: number;
|
|
61
|
-
heapUsed: number;
|
|
62
|
-
heapTotal: number;
|
|
63
|
-
external: number;
|
|
64
|
-
};
|
|
65
|
-
startupTime: number;
|
|
66
|
-
cpuUsage: number;
|
|
67
|
-
timestamp: number;
|
|
68
|
-
}
|
|
69
|
-
export interface PerformanceBudgetViolation {
|
|
70
|
-
metric: string;
|
|
71
|
-
actual: number;
|
|
72
|
-
budget: number;
|
|
73
|
-
percentage: number;
|
|
74
|
-
severity: "warning" | "error" | "critical";
|
|
75
|
-
recommendation: string;
|
|
76
|
-
}
|
|
77
|
-
export interface PerformanceReport {
|
|
78
|
-
timestamp: number;
|
|
79
|
-
bundleSize: BundleSizeMetrics;
|
|
80
|
-
webVitals: WebVitalsMetrics | null;
|
|
81
|
-
runtime: RuntimePerformanceMetrics;
|
|
82
|
-
violations: PerformanceBudgetViolation[];
|
|
83
|
-
recommendations: string[];
|
|
84
|
-
overallStatus: "pass" | "warning" | "fail";
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Comprehensive performance budget enforcement system
|
|
88
|
-
*/
|
|
89
|
-
export declare class PerformanceBudgetEnforcer extends EventEmitter {
|
|
90
|
-
private reports;
|
|
91
|
-
private monitoringActive;
|
|
92
|
-
private alertThresholds;
|
|
93
|
-
private started;
|
|
94
|
-
private boundViolation;
|
|
95
|
-
private boundBudgetExceeded;
|
|
96
|
-
constructor();
|
|
97
|
-
start(): void;
|
|
98
|
-
private setupEventHandlers;
|
|
99
|
-
destroy(): void;
|
|
100
|
-
/**
|
|
101
|
-
* Analyze bundle size against performance budget
|
|
102
|
-
*/
|
|
103
|
-
analyzeBundleSize(distPath?: string): Promise<BundleSizeMetrics>;
|
|
104
|
-
/**
|
|
105
|
-
* Measure web vitals (simulated for server-side framework)
|
|
106
|
-
* In a real web application, this would use the Web Vitals library
|
|
107
|
-
*/
|
|
108
|
-
measureWebVitals(): Promise<WebVitalsMetrics>;
|
|
109
|
-
/**
|
|
110
|
-
* Measure runtime performance metrics
|
|
111
|
-
*/
|
|
112
|
-
measureRuntimePerformance(): RuntimePerformanceMetrics;
|
|
113
|
-
/**
|
|
114
|
-
* Check performance budget compliance
|
|
115
|
-
*/
|
|
116
|
-
checkBudgetCompliance(bundleSize: BundleSizeMetrics, webVitals: WebVitalsMetrics | null, runtime: RuntimePerformanceMetrics): PerformanceBudgetViolation[];
|
|
117
|
-
/**
|
|
118
|
-
* Generate comprehensive performance report
|
|
119
|
-
*/
|
|
120
|
-
generatePerformanceReport(): Promise<PerformanceReport>;
|
|
121
|
-
/**
|
|
122
|
-
* Generate performance optimization recommendations
|
|
123
|
-
*/
|
|
124
|
-
private generateRecommendations;
|
|
125
|
-
/**
|
|
126
|
-
* Handle performance violations
|
|
127
|
-
*/
|
|
128
|
-
private handleViolation;
|
|
129
|
-
/**
|
|
130
|
-
* Handle budget exceeded events
|
|
131
|
-
*/
|
|
132
|
-
private handleBudgetExceeded;
|
|
133
|
-
/**
|
|
134
|
-
* Start continuous performance monitoring
|
|
135
|
-
*/
|
|
136
|
-
startMonitoring(intervalMs?: number): void;
|
|
137
|
-
/**
|
|
138
|
-
* Stop performance monitoring
|
|
139
|
-
*/
|
|
140
|
-
stopMonitoring(): void;
|
|
141
|
-
/**
|
|
142
|
-
* Get historical performance reports
|
|
143
|
-
*/
|
|
144
|
-
getReports(limit?: number): PerformanceReport[];
|
|
145
|
-
/**
|
|
146
|
-
* Export performance data for analysis
|
|
147
|
-
*/
|
|
148
|
-
exportPerformanceData(): {
|
|
149
|
-
reports: PerformanceReport[];
|
|
150
|
-
summary: {
|
|
151
|
-
totalReports: number;
|
|
152
|
-
averageViolations: number;
|
|
153
|
-
mostCommonViolation: string;
|
|
154
|
-
trend: "improving" | "stable" | "degrading";
|
|
155
|
-
};
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
export declare const performanceBudgetEnforcer: PerformanceBudgetEnforcer;
|