0xray 2.0.1 → 2.1.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/AGENTS.md +1 -1
- package/dist/AGENTS.md +1 -1
- package/dist/benchmark/performance-benchmark.d.ts +2 -2
- package/dist/benchmark/performance-benchmark.js +3 -3
- package/dist/cli/commands/hermes-install.js +4 -4
- package/dist/cli/commands/mcp-install.js +1 -1
- package/dist/cli/commands/openclaw-install.js +1 -1
- package/dist/cli/commands/plugin-commands.js +2 -2
- package/dist/cli/commands/publish-agent.js +5 -5
- package/dist/cli/commands/skill-install.js +1 -1
- package/dist/cli/commands/status.js +3 -3
- package/dist/cli/commands/storyteller.js +2 -2
- package/dist/cli/index.js +8 -8
- package/dist/cli/server.js +1 -1
- package/dist/core/agent-spawn-gate.d.ts +1 -1
- package/dist/core/agent-spawn-gate.js +1 -1
- package/dist/core/boot-orchestrator.d.ts +4 -4
- package/dist/core/boot-orchestrator.js +26 -26
- package/dist/core/bridge.mjs +22 -22
- package/dist/core/codex-formatter.js +2 -2
- package/dist/core/codex-injector.d.ts +4 -3
- package/dist/core/codex-injector.js +11 -10
- package/dist/core/config-loader.d.ts +5 -4
- package/dist/core/config-loader.js +4 -2
- package/dist/core/config-paths.d.ts +9 -8
- package/dist/core/config-paths.js +24 -23
- package/dist/core/context-loader.d.ts +4 -3
- package/dist/core/context-loader.js +7 -5
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/orchestrator.d.ts +1 -0
- package/dist/core/orchestrator.js +3 -2
- package/dist/core/system-prompt-generator.js +2 -2
- package/dist/core/xray-activation.d.ts +4 -4
- package/dist/core/xray-activation.js +29 -24
- package/dist/delegation/agent-delegator.d.ts +3 -3
- package/dist/delegation/agent-delegator.js +3 -3
- package/dist/delegation/metrics-aggregator.d.ts +11 -11
- package/dist/delegation/session-coordinator.d.ts +3 -3
- package/dist/delegation/voting-coordinator.d.ts +3 -3
- package/dist/enforcement/enforcer-tools.js +2 -2
- package/dist/enforcement/loaders/codex-loader.d.ts +1 -1
- package/dist/enforcement/loaders/codex-loader.js +2 -2
- package/dist/index.d.ts +5 -5
- package/dist/index.js +6 -6
- package/dist/inference/deploy-verifier.js +1 -1
- package/dist/inference/inference-cycle.js +7 -7
- package/dist/integrations/base/README.md +2 -2
- package/dist/integrations/governance/index.js +1 -1
- package/dist/integrations/grok/grok-cli.d.ts +1 -1
- package/dist/integrations/grok/grok-cli.js +6 -6
- package/dist/integrations/grok/hooks/pre-tool-use.js +1 -1
- package/dist/integrations/grok/plugin/0xray/.mcp.json +3 -3
- package/dist/integrations/grok/plugin/0xray/hooks/hooks.json +2 -2
- package/dist/integrations/hermes-agent/__init__.py +77 -71
- package/dist/integrations/hermes-agent/__pycache__/__init__.cpython-313.pyc +0 -0
- package/dist/integrations/hermes-agent/__pycache__/conftest.cpython-313-pytest-9.0.2.pyc +0 -0
- package/dist/integrations/hermes-agent/__pycache__/schemas.cpython-313.pyc +0 -0
- package/dist/integrations/hermes-agent/__pycache__/test_plugin.cpython-313-pytest-9.0.2.pyc +0 -0
- package/dist/integrations/hermes-agent/__pycache__/test_plugin.cpython-313.pyc +0 -0
- package/dist/integrations/hermes-agent/__pycache__/tools.cpython-313.pyc +0 -0
- package/dist/integrations/hermes-agent/after-install.md +14 -14
- package/dist/integrations/hermes-agent/bridge.mjs +14 -14
- package/dist/integrations/hermes-agent/logs/framework/routing-outcomes.json +1 -0
- package/dist/integrations/hermes-agent/plugin.yaml +5 -5
- package/dist/integrations/hermes-agent/schemas.py +12 -12
- package/dist/integrations/hermes-agent/test_plugin.py +128 -125
- package/dist/integrations/hermes-agent/tools.py +85 -23
- package/dist/integrations/openclaw/README.md +16 -16
- package/dist/integrations/openclaw/api-server.d.ts +4 -4
- package/dist/integrations/openclaw/api-server.js +9 -9
- package/dist/integrations/openclaw/config.js +1 -1
- package/dist/integrations/openclaw/hooks/{strray-hooks.d.ts → xray-hooks.d.ts} +4 -4
- package/dist/integrations/openclaw/index.d.ts +4 -4
- package/dist/integrations/openclaw/index.js +4 -4
- package/dist/integrations/openclaw/types.d.ts +1 -1
- package/dist/integrations/plugins/plugin-registry.js +2 -2
- package/dist/mcps/architect-tools.server.d.ts +2 -2
- package/dist/mcps/architect-tools.server.js +3 -3
- package/dist/mcps/auto-format.server.d.ts +2 -2
- package/dist/mcps/auto-format.server.js +3 -3
- package/dist/mcps/boot-orchestrator.server.d.ts +2 -2
- package/dist/mcps/boot-orchestrator.server.js +3 -3
- package/dist/mcps/config/server-config-registry.d.ts +1 -1
- package/dist/mcps/config/server-config-registry.js +7 -7
- package/dist/mcps/connection/mcp-connection.js +1 -1
- package/dist/mcps/enforcer-tools.server.d.ts +2 -2
- package/dist/mcps/enforcer-tools.server.js +3 -3
- package/dist/mcps/framework-compliance-audit.server.d.ts +2 -2
- package/dist/mcps/framework-compliance-audit.server.js +3 -3
- package/dist/mcps/framework-help.server.js +6 -6
- package/dist/mcps/in-process-skill-registry.js +6 -6
- package/dist/mcps/knowledge-skills/api-design.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/api-design.server.js +3 -3
- package/dist/mcps/knowledge-skills/architecture-patterns.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/architecture-patterns.server.js +3 -3
- package/dist/mcps/knowledge-skills/code-review.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/code-review.server.js +3 -3
- package/dist/mcps/knowledge-skills/database-design.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/database-design.server.js +3 -3
- package/dist/mcps/knowledge-skills/devops-deployment.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/devops-deployment.server.js +3 -3
- package/dist/mcps/knowledge-skills/git-workflow.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/git-workflow.server.js +3 -3
- package/dist/mcps/knowledge-skills/mobile-development.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/mobile-development.server.js +3 -3
- package/dist/mcps/knowledge-skills/performance-optimization.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/performance-optimization.server.js +3 -3
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.js +3 -3
- package/dist/mcps/knowledge-skills/security-audit.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/security-audit.server.js +3 -3
- package/dist/mcps/knowledge-skills/tech-writer.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/tech-writer.server.js +3 -3
- package/dist/mcps/knowledge-skills/testing-best-practices.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/testing-best-practices.server.js +3 -3
- package/dist/mcps/knowledge-skills/testing-strategy.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/testing-strategy.server.js +3 -3
- package/dist/mcps/knowledge-skills/ui-ux-design.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/ui-ux-design.server.js +5 -5
- package/dist/mcps/lint.server.d.ts +2 -2
- package/dist/mcps/lint.server.js +5 -5
- package/dist/mcps/mcp-client.js +3 -3
- package/dist/mcps/model-health-check.server.d.ts +2 -2
- package/dist/mcps/model-health-check.server.js +3 -3
- package/dist/mcps/orchestrator/server.js +2 -2
- package/dist/mcps/performance-analysis.server.d.ts +2 -2
- package/dist/mcps/performance-analysis.server.js +3 -3
- package/dist/mcps/processor-pipeline.server.d.ts +2 -2
- package/dist/mcps/processor-pipeline.server.js +3 -3
- package/dist/mcps/researcher.server.d.ts +3 -3
- package/dist/mcps/researcher.server.js +4 -4
- package/dist/mcps/security-scan.server.d.ts +2 -2
- package/dist/mcps/security-scan.server.js +3 -3
- package/dist/mcps/simulation/server-simulations.js +3 -3
- package/dist/metrics/agent-metrics.d.ts +4 -4
- package/dist/metrics/agent-metrics.js +1 -1
- package/dist/orchestrator/enhanced-multi-agent-orchestrator.d.ts +2 -2
- package/dist/orchestrator/enhanced-multi-agent-orchestrator.js +2 -2
- package/dist/orchestrator/intelligent-commit-batcher.d.ts +1 -1
- package/dist/orchestrator/intelligent-commit-batcher.js +3 -3
- package/dist/orchestrator/multi-agent-orchestration-coordinator.d.ts +3 -3
- package/dist/orchestrator/multi-agent-orchestration-coordinator.js +9 -9
- package/dist/orchestrator/orchestrator.d.ts +3 -2
- package/dist/orchestrator/orchestrator.js +8 -6
- package/dist/plugin/xray-codex-injection.d.ts +1 -1
- package/dist/plugin/xray-codex-injection.js +8 -7
- package/dist/postprocessor/PostProcessor.d.ts +2 -2
- package/dist/postprocessor/PostProcessor.js +1 -1
- package/dist/postprocessor/monitoring/MonitoringEngine.d.ts +2 -2
- package/dist/postprocessor/services/RegressionAnalysisService.js +2 -2
- package/dist/postprocessor/triggers/GitHookTrigger.js +14 -14
- package/dist/processors/implementations/agents-md-validation-processor.js +2 -2
- package/dist/processors/implementations/inference-improvement-processor.js +2 -2
- package/dist/processors/implementations/log-protection-processor.d.ts +1 -1
- package/dist/processors/implementations/log-protection-processor.js +2 -2
- package/dist/processors/implementations/publish-preflight-processor.d.ts +1 -1
- package/dist/processors/implementations/publish-preflight-processor.js +3 -3
- package/dist/processors/implementations/regression-testing-processor.js +2 -2
- package/dist/processors/implementations/session-summary-processor.js +2 -2
- package/dist/processors/implementations/storytelling-trigger-processor.js +2 -2
- package/dist/processors/processor-manager.d.ts +2 -2
- package/dist/public/about.html +6 -6
- package/dist/public/enterprise.html +1 -1
- package/dist/public/features.html +2 -2
- package/dist/public/index.html +4 -4
- package/dist/reporting/report-formatter.js +1 -1
- package/dist/scripts/activate-kernel-pipeline.js +2 -2
- package/dist/scripts/pre-command +1 -1
- package/dist/services/inference-tuner.js +2 -2
- package/dist/session/session-cleanup-manager.d.ts +3 -3
- package/dist/session/session-monitor.d.ts +3 -3
- package/dist/session/session-state-manager.d.ts +3 -3
- package/dist/skills/hermes-agent/SKILL.md +11 -11
- package/dist/skills/storyteller/SKILL.md +1 -1
- package/dist/skills/xray-orchestrator/SKILL.md +141 -0
- package/dist/skills/xray-orchestrator/index.d.ts +13 -0
- package/dist/skills/xray-orchestrator/index.js +224 -0
- package/dist/state/index.d.ts +2 -1
- package/dist/state/index.js +2 -1
- package/dist/state/state-manager.d.ts +2 -2
- package/dist/state/state-manager.js +5 -4
- package/dist/utils/import-resolver.js +1 -1
- package/dist/utils/path-resolver.js +2 -2
- package/dist/utils/token-manager.js +1 -1
- package/dist/validation/estimation-validator.js +1 -1
- package/package.json +2 -2
- package/scripts/hooks/pre-command +1 -1
- package/scripts/hooks/run-hook.js +2 -2
- package/scripts/node/auto-reflection-generator.mjs +2 -2
- package/scripts/node/postinstall.cjs +1 -1
- package/scripts/node/release.js +6 -6
- package/scripts/node/release.mjs +10 -10
- package/scripts/node/version-manager.mjs +1 -1
- package/src/integrations/grok/plugin/0xray/.mcp.json +3 -3
- package/src/integrations/grok/plugin/0xray/hooks/hooks.json +2 -2
- package/src/mcps/architect-tools.server.ts +3 -3
- package/src/mcps/auto-format.server.ts +3 -3
- package/src/mcps/boot-orchestrator.server.ts +3 -3
- package/src/mcps/config/server-config-registry.ts +7 -7
- package/src/mcps/connection/mcp-connection.ts +1 -1
- package/src/mcps/enforcer-tools.server.ts +3 -3
- package/src/mcps/framework-compliance-audit.server.ts +3 -3
- package/src/mcps/framework-help.server.ts +6 -6
- package/src/mcps/in-process-skill-registry.ts +6 -6
- package/src/mcps/knowledge-skills/api-design.server.test.ts +8 -8
- package/src/mcps/knowledge-skills/api-design.server.ts +3 -3
- package/src/mcps/knowledge-skills/architecture-patterns.server.ts +3 -3
- package/src/mcps/knowledge-skills/code-review.server.ts +3 -3
- package/src/mcps/knowledge-skills/database-design.server.ts +3 -3
- package/src/mcps/knowledge-skills/devops-deployment.server.ts +3 -3
- package/src/mcps/knowledge-skills/git-workflow.server.ts +3 -3
- package/src/mcps/knowledge-skills/mobile-development.server.ts +3 -3
- package/src/mcps/knowledge-skills/performance-optimization.server.ts +3 -3
- package/src/mcps/knowledge-skills/refactoring-strategies.server.ts +3 -3
- package/src/mcps/knowledge-skills/security-audit.server.test.ts +23 -23
- package/src/mcps/knowledge-skills/security-audit.server.ts +3 -3
- package/src/mcps/knowledge-skills/tech-writer.server.ts +3 -3
- package/src/mcps/knowledge-skills/testing-best-practices.server.test.ts +28 -28
- package/src/mcps/knowledge-skills/testing-best-practices.server.ts +3 -3
- package/src/mcps/knowledge-skills/testing-strategy.server.test.ts +19 -19
- package/src/mcps/knowledge-skills/testing-strategy.server.ts +3 -3
- package/src/mcps/knowledge-skills/ui-ux-design.server.ts +5 -5
- package/src/mcps/lint.server.ts +5 -5
- package/src/mcps/mcp-client.ts +3 -3
- package/src/mcps/model-health-check.server.ts +3 -3
- package/src/mcps/orchestrator/server.ts +2 -2
- package/src/mcps/performance-analysis.server.ts +3 -3
- package/src/mcps/processor-pipeline.server.ts +3 -3
- package/src/mcps/researcher.server.ts +4 -4
- package/src/mcps/security-scan.server.ts +3 -3
- package/src/mcps/simulation/server-simulations.ts +3 -3
- package/src/opencode/codex.codex +1 -1
- package/src/skills/hermes-agent/SKILL.md +11 -11
- package/src/skills/storyteller/SKILL.md +1 -1
- package/src/skills/xray-orchestrator/SKILL.md +141 -0
- package/src/skills/xray-orchestrator/index.ts +268 -0
- package/scripts/validate-stringray-comprehensive.js +0 -636
- /package/dist/integrations/openclaw/hooks/{strray-hooks.js → xray-hooks.js} +0 -0
|
@@ -13,7 +13,7 @@ import { frameworkLogger } from "../core/framework-logger.js";
|
|
|
13
13
|
import { resolveCodexPath } from "./config-paths.js";
|
|
14
14
|
// Dynamic imports for cross-environment compatibility
|
|
15
15
|
let extractCodexMetadata;
|
|
16
|
-
let
|
|
16
|
+
let XrayContextLoader;
|
|
17
17
|
let importsInitialized = false;
|
|
18
18
|
async function initializeImports() {
|
|
19
19
|
if (importsInitialized)
|
|
@@ -22,13 +22,13 @@ async function initializeImports() {
|
|
|
22
22
|
const codexParser = await import("../utils/codex-parser.js");
|
|
23
23
|
const contextLoaderModule = await import("./context-loader.js");
|
|
24
24
|
extractCodexMetadata = codexParser.extractCodexMetadata;
|
|
25
|
-
|
|
25
|
+
XrayContextLoader = contextLoaderModule.XrayContextLoader;
|
|
26
26
|
}
|
|
27
27
|
catch {
|
|
28
28
|
const codexParser = await import("../utils/codex-parser");
|
|
29
29
|
const contextLoaderModule = await import("./context-loader");
|
|
30
30
|
extractCodexMetadata = codexParser.extractCodexMetadata;
|
|
31
|
-
|
|
31
|
+
XrayContextLoader = contextLoaderModule.XrayContextLoader;
|
|
32
32
|
}
|
|
33
33
|
importsInitialized = true;
|
|
34
34
|
}
|
|
@@ -38,7 +38,7 @@ async function initializeImports() {
|
|
|
38
38
|
const codexCache = new Map();
|
|
39
39
|
/**
|
|
40
40
|
* Codex file locations resolved through the standard priority chain.
|
|
41
|
-
* Uses config-paths.ts resolver so
|
|
41
|
+
* Uses config-paths.ts resolver so XRAY_CONFIG_DIR and .xray/ work.
|
|
42
42
|
*/
|
|
43
43
|
function getCodexFileLocations(projectRoot) {
|
|
44
44
|
const root = projectRoot || process.cwd();
|
|
@@ -68,7 +68,7 @@ async function createCodexContextEntry(filePath, content) {
|
|
|
68
68
|
}
|
|
69
69
|
const metadata = extractCodexMetadata(content);
|
|
70
70
|
return {
|
|
71
|
-
id: `
|
|
71
|
+
id: `xray-codex-${path.basename(filePath)}`,
|
|
72
72
|
source: filePath,
|
|
73
73
|
content,
|
|
74
74
|
priority: "critical",
|
|
@@ -121,15 +121,15 @@ function formatCodexContext(contexts, sessionId) {
|
|
|
121
121
|
return parts.join("\n");
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
|
-
* Create
|
|
124
|
+
* Create xray-codex-injector hook
|
|
125
125
|
*
|
|
126
126
|
* This hook injects codex context into tool outputs and displays
|
|
127
127
|
* a welcome message on agent startup, following the production-tested
|
|
128
128
|
* pattern from OpenCode's rules-injector.
|
|
129
129
|
*/
|
|
130
|
-
export function
|
|
130
|
+
export function createXrayCodexInjectorHook() {
|
|
131
131
|
return {
|
|
132
|
-
name: "
|
|
132
|
+
name: "xray-codex-injector",
|
|
133
133
|
hooks: {
|
|
134
134
|
"agent.start": async (sessionId) => {
|
|
135
135
|
const jobId = `agent-start-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
|
|
@@ -145,7 +145,7 @@ export function createStringRayCodexInjectorHook() {
|
|
|
145
145
|
await frameworkLogger.log("codex-injector", "codex context loaded successfully", "success", { jobId, ...stats });
|
|
146
146
|
}
|
|
147
147
|
else {
|
|
148
|
-
await frameworkLogger.log("codex-injector", "-no-codex-files-found-checked-
|
|
148
|
+
await frameworkLogger.log("codex-injector", "-no-codex-files-found-checked-xray-codex-json-co", "info", {
|
|
149
149
|
message: `⚠️ No codex files found. Checked: ${getCodexFileLocations().join(", ")}`,
|
|
150
150
|
});
|
|
151
151
|
await frameworkLogger.log("codex-injector", "no codex files found", "error", { jobId });
|
|
@@ -193,7 +193,7 @@ export function createStringRayCodexInjectorHook() {
|
|
|
193
193
|
await frameworkLogger.log("codex-injector", "codex context loaded for validation", "success", { jobId, contextCount: codexContexts.length });
|
|
194
194
|
// Use the initialized context loader
|
|
195
195
|
await initializeImports();
|
|
196
|
-
const ContextLoaderClass =
|
|
196
|
+
const ContextLoaderClass = XrayContextLoader;
|
|
197
197
|
const contextLoader = new ContextLoaderClass();
|
|
198
198
|
const loadResult = await contextLoader.loadCodexContext(sessionId);
|
|
199
199
|
if (!loadResult.success || !loadResult.context) {
|
|
@@ -422,3 +422,4 @@ export class CodexInjector {
|
|
|
422
422
|
return { guidance, concerns };
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
|
+
export { createXrayCodexInjectorHook as createStringRayCodexInjectorHook };
|
|
@@ -27,12 +27,12 @@ export interface AutonomousReportingConfig {
|
|
|
27
27
|
report_retention_days: number;
|
|
28
28
|
notification_channels: string[];
|
|
29
29
|
}
|
|
30
|
-
export interface
|
|
30
|
+
export interface XrayConfig {
|
|
31
31
|
multi_agent_orchestration: MultiAgentOrchestrationConfig;
|
|
32
32
|
autonomous_reporting: AutonomousReportingConfig;
|
|
33
33
|
disabled_agents: string[];
|
|
34
34
|
}
|
|
35
|
-
export declare class
|
|
35
|
+
export declare class XrayConfigLoader {
|
|
36
36
|
private configPath;
|
|
37
37
|
private cachedConfig;
|
|
38
38
|
private cacheExpiry;
|
|
@@ -41,7 +41,7 @@ export declare class StringRayConfigLoader {
|
|
|
41
41
|
/**
|
|
42
42
|
* Load 0xRay configuration from the resolved config directory
|
|
43
43
|
*/
|
|
44
|
-
loadConfig():
|
|
44
|
+
loadConfig(): XrayConfig;
|
|
45
45
|
/**
|
|
46
46
|
* Parse configuration data with validation
|
|
47
47
|
*/
|
|
@@ -67,4 +67,5 @@ export declare class StringRayConfigLoader {
|
|
|
67
67
|
*/
|
|
68
68
|
clearCache(): void;
|
|
69
69
|
}
|
|
70
|
-
export declare const
|
|
70
|
+
export declare const xrayConfigLoader: XrayConfigLoader;
|
|
71
|
+
export { xrayConfigLoader as strRayConfigLoader, XrayConfigLoader as StringRayConfigLoader };
|
|
@@ -10,7 +10,7 @@ import * as fs from "fs";
|
|
|
10
10
|
import * as path from "path";
|
|
11
11
|
import { frameworkLogger } from "./framework-logger.js";
|
|
12
12
|
import { getConfigDir, resolveConfigPath } from "./config-paths.js";
|
|
13
|
-
export class
|
|
13
|
+
export class XrayConfigLoader {
|
|
14
14
|
configPath;
|
|
15
15
|
cachedConfig = null;
|
|
16
16
|
cacheExpiry = 30000; // 30 seconds
|
|
@@ -145,4 +145,6 @@ export class StringRayConfigLoader {
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
// Export singleton instance
|
|
148
|
-
export const
|
|
148
|
+
export const xrayConfigLoader = new XrayConfigLoader();
|
|
149
|
+
// Backward compat alias
|
|
150
|
+
export { xrayConfigLoader as strRayConfigLoader, XrayConfigLoader as StringRayConfigLoader };
|
|
@@ -2,22 +2,23 @@
|
|
|
2
2
|
* Config Path Resolver
|
|
3
3
|
*
|
|
4
4
|
* Centralizes all 0xRay config file path resolution.
|
|
5
|
-
* Supports
|
|
6
|
-
* making .opencode/ completely optional for environments like Hermes Agent.
|
|
5
|
+
* Supports XRAY_CONFIG_DIR env var for custom config roots.
|
|
7
6
|
*
|
|
8
7
|
* Resolution order (per file type):
|
|
9
|
-
* 1.
|
|
10
|
-
* 2. .
|
|
11
|
-
* 3. .opencode/
|
|
8
|
+
* 1. XRAY_CONFIG_DIR/<relative_path> (if env var set)
|
|
9
|
+
* 2. .xray/<relative_path> (preferred lightweight root)
|
|
10
|
+
* 3. .opencode/xray/<relative_path> (OpenCode root)
|
|
12
11
|
* 4. null (callers fall back to built-in defaults)
|
|
13
12
|
*
|
|
14
13
|
* For state/data directories, uses:
|
|
15
|
-
* 1.
|
|
16
|
-
* 2. .
|
|
14
|
+
* 1. XRAY_CONFIG_DIR/state (if env var set)
|
|
15
|
+
* 2. .xray/state
|
|
17
16
|
* 3. .opencode/state (legacy)
|
|
18
|
-
* 4. .
|
|
17
|
+
* 4. .xray/state (default — always writable)
|
|
19
18
|
*/
|
|
20
19
|
/** Environment variable name for custom config root */
|
|
20
|
+
export declare const XRAY_CONFIG_DIR_ENV = "XRAY_CONFIG_DIR";
|
|
21
|
+
/** Legacy env var name (backward compat) */
|
|
21
22
|
export declare const STRRAY_CONFIG_DIR_ENV = "STRRAY_CONFIG_DIR";
|
|
22
23
|
/**
|
|
23
24
|
* Detect the best available config directory.
|
|
@@ -2,24 +2,25 @@
|
|
|
2
2
|
* Config Path Resolver
|
|
3
3
|
*
|
|
4
4
|
* Centralizes all 0xRay config file path resolution.
|
|
5
|
-
* Supports
|
|
6
|
-
* making .opencode/ completely optional for environments like Hermes Agent.
|
|
5
|
+
* Supports XRAY_CONFIG_DIR env var for custom config roots.
|
|
7
6
|
*
|
|
8
7
|
* Resolution order (per file type):
|
|
9
|
-
* 1.
|
|
10
|
-
* 2. .
|
|
11
|
-
* 3. .opencode/
|
|
8
|
+
* 1. XRAY_CONFIG_DIR/<relative_path> (if env var set)
|
|
9
|
+
* 2. .xray/<relative_path> (preferred lightweight root)
|
|
10
|
+
* 3. .opencode/xray/<relative_path> (OpenCode root)
|
|
12
11
|
* 4. null (callers fall back to built-in defaults)
|
|
13
12
|
*
|
|
14
13
|
* For state/data directories, uses:
|
|
15
|
-
* 1.
|
|
16
|
-
* 2. .
|
|
14
|
+
* 1. XRAY_CONFIG_DIR/state (if env var set)
|
|
15
|
+
* 2. .xray/state
|
|
17
16
|
* 3. .opencode/state (legacy)
|
|
18
|
-
* 4. .
|
|
17
|
+
* 4. .xray/state (default — always writable)
|
|
19
18
|
*/
|
|
20
19
|
import { existsSync } from "fs";
|
|
21
20
|
import { join, resolve } from "path";
|
|
22
21
|
/** Environment variable name for custom config root */
|
|
22
|
+
export const XRAY_CONFIG_DIR_ENV = "XRAY_CONFIG_DIR";
|
|
23
|
+
/** Legacy env var name (backward compat) */
|
|
23
24
|
export const STRRAY_CONFIG_DIR_ENV = "STRRAY_CONFIG_DIR";
|
|
24
25
|
/** Resolved config directories, cached per projectRoot */
|
|
25
26
|
const _resolvedConfigDirs = new Map();
|
|
@@ -32,7 +33,7 @@ export function getConfigDir(projectRoot) {
|
|
|
32
33
|
const cached = _resolvedConfigDirs.get(root);
|
|
33
34
|
if (cached)
|
|
34
35
|
return cached;
|
|
35
|
-
const envDir = process.env[STRRAY_CONFIG_DIR_ENV];
|
|
36
|
+
const envDir = process.env[XRAY_CONFIG_DIR_ENV] || process.env[STRRAY_CONFIG_DIR_ENV];
|
|
36
37
|
// Priority candidates
|
|
37
38
|
const candidates = [];
|
|
38
39
|
if (envDir) {
|
|
@@ -40,8 +41,8 @@ export function getConfigDir(projectRoot) {
|
|
|
40
41
|
const resolved = resolve(root, envDir);
|
|
41
42
|
candidates.push({ dir: resolved, source: "env" });
|
|
42
43
|
}
|
|
43
|
-
candidates.push({ dir: join(root, ".
|
|
44
|
-
candidates.push({ dir: join(root, ".opencode", "
|
|
44
|
+
candidates.push({ dir: join(root, ".xray"), source: "dot-xray" });
|
|
45
|
+
candidates.push({ dir: join(root, ".opencode", "xray"), source: "dot-opencode" });
|
|
45
46
|
// Return the first that exists, or the highest-priority default
|
|
46
47
|
for (const c of candidates) {
|
|
47
48
|
if (existsSync(c.dir)) {
|
|
@@ -49,7 +50,7 @@ export function getConfigDir(projectRoot) {
|
|
|
49
50
|
return c.dir;
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
|
-
// Nothing exists — use highest priority default (env > .
|
|
53
|
+
// Nothing exists — use highest priority default (env > .xray > .opencode)
|
|
53
54
|
const defaultDir = candidates[0];
|
|
54
55
|
_resolvedConfigDirs.set(root, defaultDir.dir);
|
|
55
56
|
return defaultDir.dir;
|
|
@@ -63,13 +64,13 @@ export function getConfigDir(projectRoot) {
|
|
|
63
64
|
*/
|
|
64
65
|
export function resolveConfigPath(relativePath, projectRoot) {
|
|
65
66
|
const root = projectRoot || process.cwd();
|
|
66
|
-
const envDir = process.env[STRRAY_CONFIG_DIR_ENV];
|
|
67
|
+
const envDir = process.env[XRAY_CONFIG_DIR_ENV] || process.env[STRRAY_CONFIG_DIR_ENV];
|
|
67
68
|
const candidates = [];
|
|
68
69
|
if (envDir) {
|
|
69
70
|
candidates.push(resolve(root, envDir, relativePath));
|
|
70
71
|
}
|
|
71
|
-
candidates.push(join(root, ".
|
|
72
|
-
candidates.push(join(root, ".opencode", "
|
|
72
|
+
candidates.push(join(root, ".xray", relativePath));
|
|
73
|
+
candidates.push(join(root, ".opencode", "xray", relativePath));
|
|
73
74
|
for (const candidate of candidates) {
|
|
74
75
|
if (existsSync(candidate)) {
|
|
75
76
|
return candidate;
|
|
@@ -85,12 +86,12 @@ export function resolveConfigPath(relativePath, projectRoot) {
|
|
|
85
86
|
*/
|
|
86
87
|
export function resolveStateDir(projectRoot) {
|
|
87
88
|
const root = projectRoot || process.cwd();
|
|
88
|
-
const envDir = process.env[STRRAY_CONFIG_DIR_ENV];
|
|
89
|
+
const envDir = process.env[XRAY_CONFIG_DIR_ENV] || process.env[STRRAY_CONFIG_DIR_ENV];
|
|
89
90
|
const candidates = [];
|
|
90
91
|
if (envDir) {
|
|
91
92
|
candidates.push(join(root, envDir, "state"));
|
|
92
93
|
}
|
|
93
|
-
candidates.push(join(root, ".
|
|
94
|
+
candidates.push(join(root, ".xray", "state"));
|
|
94
95
|
candidates.push(join(root, ".opencode", "state"));
|
|
95
96
|
for (const candidate of candidates) {
|
|
96
97
|
if (existsSync(candidate)) {
|
|
@@ -112,13 +113,13 @@ export function resolveStateFilePath(projectRoot) {
|
|
|
112
113
|
*/
|
|
113
114
|
export function resolveProfilesDir(projectRoot) {
|
|
114
115
|
const root = projectRoot || process.cwd();
|
|
115
|
-
const envDir = process.env[STRRAY_CONFIG_DIR_ENV];
|
|
116
|
+
const envDir = process.env[XRAY_CONFIG_DIR_ENV] || process.env[STRRAY_CONFIG_DIR_ENV];
|
|
116
117
|
const candidates = [];
|
|
117
118
|
if (envDir) {
|
|
118
119
|
candidates.push(join(root, envDir, "profiles"));
|
|
119
120
|
}
|
|
120
|
-
candidates.push(join(root, ".
|
|
121
|
-
candidates.push(join(root, ".opencode", "
|
|
121
|
+
candidates.push(join(root, ".xray", "profiles"));
|
|
122
|
+
candidates.push(join(root, ".opencode", "xray", "profiles"));
|
|
122
123
|
for (const candidate of candidates) {
|
|
123
124
|
if (existsSync(candidate)) {
|
|
124
125
|
return candidate;
|
|
@@ -132,14 +133,14 @@ export function resolveProfilesDir(projectRoot) {
|
|
|
132
133
|
*/
|
|
133
134
|
export function resolveCodexPath(projectRoot) {
|
|
134
135
|
const root = projectRoot || process.cwd();
|
|
135
|
-
const envDir = process.env[STRRAY_CONFIG_DIR_ENV];
|
|
136
|
+
const envDir = process.env[XRAY_CONFIG_DIR_ENV] || process.env[STRRAY_CONFIG_DIR_ENV];
|
|
136
137
|
const candidates = [];
|
|
137
138
|
if (envDir) {
|
|
138
139
|
candidates.push(join(root, envDir, "codex.json"));
|
|
139
140
|
}
|
|
140
|
-
candidates.push(join(root, ".
|
|
141
|
+
candidates.push(join(root, ".xray", "codex.json"));
|
|
141
142
|
candidates.push(join(root, "xray", "codex.json"));
|
|
142
|
-
candidates.push(join(root, ".opencode", "
|
|
143
|
+
candidates.push(join(root, ".opencode", "xray", "codex.json"));
|
|
143
144
|
// Additional fallback locations (for standalone usage)
|
|
144
145
|
candidates.push(join(root, "codex.json"));
|
|
145
146
|
candidates.push(join(root, "src", "codex.json"));
|
|
@@ -46,7 +46,7 @@ export interface ContextLoadResult {
|
|
|
46
46
|
*
|
|
47
47
|
* Loads and parses the Universal Development Codex v1.2.0 from codex.json
|
|
48
48
|
*/
|
|
49
|
-
export declare class
|
|
49
|
+
export declare class XrayContextLoader {
|
|
50
50
|
private static instance;
|
|
51
51
|
private cachedContext;
|
|
52
52
|
private codexFilePaths;
|
|
@@ -54,7 +54,7 @@ export declare class StringRayContextLoader {
|
|
|
54
54
|
/**
|
|
55
55
|
* Get singleton instance
|
|
56
56
|
*/
|
|
57
|
-
static getInstance():
|
|
57
|
+
static getInstance(): XrayContextLoader;
|
|
58
58
|
/**
|
|
59
59
|
* Load codex context
|
|
60
60
|
*
|
|
@@ -118,4 +118,5 @@ export declare class StringRayContextLoader {
|
|
|
118
118
|
/**
|
|
119
119
|
* Export singleton instance
|
|
120
120
|
*/
|
|
121
|
-
export declare const
|
|
121
|
+
export declare const xrayContextLoader: XrayContextLoader;
|
|
122
|
+
export { xrayContextLoader as strRayContextLoader, XrayContextLoader as StringRayContextLoader };
|
|
@@ -22,7 +22,7 @@ function isValidMatch(match, index) {
|
|
|
22
22
|
*
|
|
23
23
|
* Loads and parses the Universal Development Codex v1.2.0 from codex.json
|
|
24
24
|
*/
|
|
25
|
-
export class
|
|
25
|
+
export class XrayContextLoader {
|
|
26
26
|
static instance;
|
|
27
27
|
cachedContext = null;
|
|
28
28
|
codexFilePaths = [];
|
|
@@ -33,10 +33,10 @@ export class StringRayContextLoader {
|
|
|
33
33
|
* Get singleton instance
|
|
34
34
|
*/
|
|
35
35
|
static getInstance() {
|
|
36
|
-
if (!
|
|
37
|
-
|
|
36
|
+
if (!XrayContextLoader.instance) {
|
|
37
|
+
XrayContextLoader.instance = new XrayContextLoader();
|
|
38
38
|
}
|
|
39
|
-
return
|
|
39
|
+
return XrayContextLoader.instance;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Load codex context
|
|
@@ -266,4 +266,6 @@ export class StringRayContextLoader {
|
|
|
266
266
|
/**
|
|
267
267
|
* Export singleton instance
|
|
268
268
|
*/
|
|
269
|
-
export const
|
|
269
|
+
export const xrayContextLoader = XrayContextLoader.getInstance();
|
|
270
|
+
// Backward compat alias
|
|
271
|
+
export { xrayContextLoader as strRayContextLoader, XrayContextLoader as StringRayContextLoader };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { KernelOrchestrator } from "./orchestrator.js";
|
|
2
|
-
export { defaultStringRayConfig } from "./xray-activation.js";
|
|
2
|
+
export { defaultXrayConfig, defaultXrayConfig as defaultStringRayConfig } from "./xray-activation.js";
|
|
3
3
|
export { getConfigDir, resolveConfigPath, resolveStateDir, resolveProfilesDir, resolveCodexPath, resolveLogDir, resetConfigDirCache, STRRAY_CONFIG_DIR_ENV, } from "./config-paths.js";
|
|
4
4
|
export { formatCodexPrompt, formatMinimalCodexPrompt, getCodexConfig, findCodexPath, loadCodex, BUILTIN_CODEX, } from "./codex-formatter.js";
|
|
5
5
|
export type { CodexTerm, CodexConfig, FormatOptions, FormatResult, } from "./codex-formatter.js";
|
package/dist/core/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { KernelOrchestrator } from "./orchestrator.js";
|
|
2
|
-
export { defaultStringRayConfig } from "./xray-activation.js"; // consumer runtime compat from prior StringRay releases (1-line min per Scope Rule)
|
|
2
|
+
export { defaultXrayConfig, defaultXrayConfig as defaultStringRayConfig } from "./xray-activation.js"; // consumer runtime compat from prior StringRay releases (1-line min per Scope Rule)
|
|
3
3
|
// Decoupled config path resolution (Layer 1)
|
|
4
4
|
export { getConfigDir, resolveConfigPath, resolveStateDir, resolveProfilesDir, resolveCodexPath, resolveLogDir, resetConfigDirCache, STRRAY_CONFIG_DIR_ENV, } from "./config-paths.js";
|
|
5
5
|
// Standalone codex formatter (Layer 2)
|
|
@@ -267,7 +267,7 @@ export class KernelOrchestrator {
|
|
|
267
267
|
`B) Use a single orchestrator for all dependent tasks\n` +
|
|
268
268
|
`C) Remove the dependency if it's not needed\n\n` +
|
|
269
269
|
`Example of correct usage:\n` +
|
|
270
|
-
` const orch = new
|
|
270
|
+
` const orch = new XrayOrchestrator();\n` +
|
|
271
271
|
` await orch.executeComplexTask("test", [\n` +
|
|
272
272
|
` { id: "task-1" },\n` +
|
|
273
273
|
` { id: "task-2", dependencies: ["task-1"] } // ✅ Same orchestrator\n` +
|
|
@@ -405,4 +405,5 @@ export class KernelOrchestrator {
|
|
|
405
405
|
};
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
export const
|
|
408
|
+
export const xrayOrchestrator = new KernelOrchestrator();
|
|
409
|
+
export const strRayOrchestrator = xrayOrchestrator; // backward compat
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @version 1.0.0
|
|
8
8
|
* @since 2026-03-03
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
10
|
+
import { XrayContextLoader } from "./context-loader.js";
|
|
11
11
|
import { validateContext, preventSystemPromptBloat } from "./context-validator.js";
|
|
12
12
|
import fs from "fs";
|
|
13
13
|
import path from "path";
|
|
@@ -140,7 +140,7 @@ export async function generateLeanSystemPrompt(config = {}) {
|
|
|
140
140
|
let finalPrompt = systemPrompt;
|
|
141
141
|
if (showCodexContext && enableTokenOptimization) {
|
|
142
142
|
try {
|
|
143
|
-
const contextLoader =
|
|
143
|
+
const contextLoader = XrayContextLoader.getInstance();
|
|
144
144
|
const loadResult = await contextLoader.loadCodexContext(process.cwd());
|
|
145
145
|
if (loadResult.success && loadResult.context) {
|
|
146
146
|
const codexSummary = generateCodexSummary(loadResult.context, maxTokenBudget);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 0xRay activation — reads config from .xray/ runtime state directory.
|
|
3
3
|
*/
|
|
4
|
-
export interface
|
|
4
|
+
export interface XrayActivationConfig {
|
|
5
5
|
enableOrchestrator: boolean;
|
|
6
6
|
enableBootOrchestrator: boolean;
|
|
7
7
|
enableStateManagement: boolean;
|
|
@@ -10,5 +10,5 @@ export interface StringRayActivationConfig {
|
|
|
10
10
|
enableProcessors: boolean;
|
|
11
11
|
enablePostProcessor: boolean;
|
|
12
12
|
}
|
|
13
|
-
export declare const
|
|
14
|
-
export declare function
|
|
13
|
+
export declare const defaultXrayConfig: XrayActivationConfig;
|
|
14
|
+
export declare function activateXrayFramework(config?: Partial<XrayActivationConfig>): Promise<void>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 0xRay activation — reads config from .xray/ runtime state directory.
|
|
3
3
|
*/
|
|
4
4
|
import { frameworkLogger } from "../core/framework-logger.js";
|
|
5
5
|
import { ensureCriticalComponents } from "../architect/architectural-integrity.js";
|
|
6
6
|
import { validateRegistryConsistency } from "../agents/registry.js";
|
|
7
|
-
export const
|
|
7
|
+
export const defaultXrayConfig = {
|
|
8
8
|
enableOrchestrator: true,
|
|
9
9
|
enableBootOrchestrator: true,
|
|
10
10
|
enableStateManagement: true,
|
|
@@ -13,9 +13,9 @@ export const defaultStringRayConfig = {
|
|
|
13
13
|
enableProcessors: true,
|
|
14
14
|
enablePostProcessor: true,
|
|
15
15
|
};
|
|
16
|
-
export async function
|
|
16
|
+
export async function activateXrayFramework(config = {}) {
|
|
17
17
|
const jobId = `activation-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
|
|
18
|
-
const activationConfig = { ...
|
|
18
|
+
const activationConfig = { ...defaultXrayConfig, ...config };
|
|
19
19
|
// Banner display moved to init.sh execution in plugin
|
|
20
20
|
// Framework activation proceeds quietly
|
|
21
21
|
frameworkLogger.log("stringray-activation", "beginning xray framework activation", "info", { jobId, ...activationConfig });
|
|
@@ -57,25 +57,25 @@ export async function activateStringRayFramework(config = {}) {
|
|
|
57
57
|
}
|
|
58
58
|
async function activateCodexInjection(jobId) {
|
|
59
59
|
frameworkLogger.log("stringray-activation", "activating codex injection", "info", { jobId });
|
|
60
|
-
const {
|
|
61
|
-
const hook =
|
|
62
|
-
globalThis.
|
|
63
|
-
globalThis.
|
|
60
|
+
const { createXrayCodexInjectorHook } = await import("./codex-injector.js");
|
|
61
|
+
const hook = createXrayCodexInjectorHook();
|
|
62
|
+
globalThis.xrayHooks = globalThis.xrayHooks || [];
|
|
63
|
+
globalThis.xrayHooks.push(hook);
|
|
64
64
|
frameworkLogger.log("stringray-activation", "codex injection activated", "success", { jobId, hookName: hook.name });
|
|
65
65
|
}
|
|
66
66
|
async function activateHooks(jobId) {
|
|
67
67
|
try {
|
|
68
68
|
frameworkLogger.log("stringray-activation", "activating xray hooks", "info", { jobId });
|
|
69
69
|
// Create and register the Codex injector hook
|
|
70
|
-
const {
|
|
71
|
-
const hook =
|
|
70
|
+
const { createXrayCodexInjectorHook } = await import("./codex-injector");
|
|
71
|
+
const hook = createXrayCodexInjectorHook();
|
|
72
72
|
// Store hook globally for OpenCode to pick up
|
|
73
|
-
globalThis.
|
|
74
|
-
globalThis.
|
|
73
|
+
globalThis.xrayHooks = globalThis.xrayHooks || [];
|
|
74
|
+
globalThis.xrayHooks.push(hook);
|
|
75
75
|
frameworkLogger.log("stringray-activation", "xray hooks activated", "success", {
|
|
76
76
|
jobId,
|
|
77
77
|
hookName: hook.name,
|
|
78
|
-
hooksRegistered: globalThis.
|
|
78
|
+
hooksRegistered: globalThis.xrayHooks.length
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
catch (error) {
|
|
@@ -90,15 +90,16 @@ async function activateBootOrchestrator(jobId) {
|
|
|
90
90
|
}
|
|
91
91
|
async function activateStateManagement(jobId) {
|
|
92
92
|
frameworkLogger.log("stringray-activation", "activating state management", "info", { jobId });
|
|
93
|
-
const {
|
|
94
|
-
const stateManager = new
|
|
93
|
+
const { XrayStateManager } = await import("../state/state-manager");
|
|
94
|
+
const stateManager = new XrayStateManager();
|
|
95
95
|
// Store the state manager instance globally for framework use
|
|
96
|
-
globalThis.
|
|
96
|
+
globalThis.xrayStateManager = stateManager;
|
|
97
|
+
globalThis.strRayStateManager = stateManager; // backward compat
|
|
97
98
|
frameworkLogger.log("stringray-activation", "state management activated", "success", { jobId });
|
|
98
99
|
}
|
|
99
100
|
async function activateOrchestrator(jobId) {
|
|
100
101
|
frameworkLogger.log("stringray-activation", "activating xray orchestrator", "info", { jobId });
|
|
101
|
-
const {
|
|
102
|
+
const { xrayOrchestrator } = await import("./orchestrator");
|
|
102
103
|
// Also activate the multi-agent orchestration coordinator
|
|
103
104
|
const { multiAgentOrchestrationCoordinator } = await import("../orchestrator/multi-agent-orchestration-coordinator");
|
|
104
105
|
frameworkLogger.log("stringray-activation", "xray orchestrator and multi-agent coordination activated", "success", { jobId });
|
|
@@ -106,29 +107,33 @@ async function activateOrchestrator(jobId) {
|
|
|
106
107
|
async function activateProcessors(jobId) {
|
|
107
108
|
frameworkLogger.log("stringray-activation", "activating processor pipeline", "info", { jobId });
|
|
108
109
|
const { ProcessorManager } = await import("../processors/processor-manager");
|
|
109
|
-
const {
|
|
110
|
-
const stateManager = new
|
|
110
|
+
const { XrayStateManager } = await import("../state/state-manager");
|
|
111
|
+
const stateManager = new XrayStateManager();
|
|
111
112
|
const processorManager = new ProcessorManager(stateManager);
|
|
112
113
|
// Store the processor manager instance globally for framework use
|
|
113
|
-
globalThis.
|
|
114
|
+
globalThis.xrayProcessorManager = processorManager;
|
|
115
|
+
globalThis.strRayProcessorManager = processorManager; // backward compat
|
|
114
116
|
frameworkLogger.log("stringray-activation", "processor pipeline activated", "success", { jobId });
|
|
115
117
|
}
|
|
116
118
|
async function activatePostProcessor(jobId) {
|
|
117
119
|
frameworkLogger.log("stringray-activation", "activating post-processor system", "info", { jobId });
|
|
118
120
|
const { PostProcessor } = await import("../postprocessor/PostProcessor");
|
|
119
121
|
// Get existing state manager (should be initialized by boot orchestrator)
|
|
120
|
-
const stateManager = globalThis.
|
|
122
|
+
const stateManager = globalThis.xrayStateManager;
|
|
121
123
|
if (!stateManager) {
|
|
122
124
|
throw new Error("State manager not initialized - boot orchestrator must run first");
|
|
123
125
|
}
|
|
124
126
|
const postProcessor = new PostProcessor(stateManager, null, {});
|
|
125
|
-
globalThis.
|
|
127
|
+
globalThis.xrayPostProcessor = postProcessor;
|
|
128
|
+
globalThis.strRayPostProcessor = postProcessor; // backward compat
|
|
126
129
|
frameworkLogger.log("stringray-activation", "post-processor system activated", "success", { jobId });
|
|
127
130
|
const { pathResolver } = await import("../utils/path-resolver.js");
|
|
128
|
-
globalThis.
|
|
131
|
+
globalThis.xrayPathResolver = pathResolver;
|
|
132
|
+
globalThis.strRayPathResolver = pathResolver; // backward compat
|
|
129
133
|
frameworkLogger.log("stringray-activation", "path resolver activated", "success", { jobId });
|
|
130
134
|
const { CodexInjector } = await import("./codex-injector.js");
|
|
131
135
|
const codexInjector = new CodexInjector();
|
|
132
|
-
globalThis.
|
|
136
|
+
globalThis.xrayCodexInjector = codexInjector;
|
|
137
|
+
globalThis.strRayCodexInjector = codexInjector; // backward compat
|
|
133
138
|
frameworkLogger.log("stringray-activation", "codex injector activated", "success", { jobId });
|
|
134
139
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @since 2026-01-07
|
|
11
11
|
*/
|
|
12
12
|
import { ComplexityScore } from "./complexity-analyzer.js";
|
|
13
|
-
import {
|
|
13
|
+
import { XrayStateManager } from "../state/state-manager.js";
|
|
14
14
|
import { strRayConfigLoader } from "../core/config-loader.js";
|
|
15
15
|
import { type AggregatedMetrics, type MetricsExport } from "./metrics-aggregator.js";
|
|
16
16
|
export interface AgentCapability {
|
|
@@ -102,7 +102,7 @@ export declare class AgentDelegator {
|
|
|
102
102
|
private agentMetrics;
|
|
103
103
|
/** Minimum confidence for a learned mapping to override hardcoded routing. */
|
|
104
104
|
private static readonly MAPPING_CONFIDENCE_THRESHOLD;
|
|
105
|
-
constructor(stateManager:
|
|
105
|
+
constructor(stateManager: XrayStateManager, configLoader: typeof strRayConfigLoader);
|
|
106
106
|
/**
|
|
107
107
|
* Load routing-mappings.json from disk (fresh each call — picks up tuner writes).
|
|
108
108
|
* Same path resolution as inference-tuner.ts.
|
|
@@ -183,4 +183,4 @@ export declare class AgentDelegator {
|
|
|
183
183
|
exportMetricsData(format?: "json" | "csv" | "summary"): MetricsExport;
|
|
184
184
|
updateAgentCapability(agentName: string, capabilities: Partial<AgentCapability>): void;
|
|
185
185
|
}
|
|
186
|
-
export declare function createAgentDelegator(stateManager:
|
|
186
|
+
export declare function createAgentDelegator(stateManager: XrayStateManager, configLoader: typeof strRayConfigLoader): AgentDelegator;
|
|
@@ -45,9 +45,9 @@ export class AgentDelegator {
|
|
|
45
45
|
*/
|
|
46
46
|
loadRoutingMappings() {
|
|
47
47
|
const candidates = [
|
|
48
|
-
path.resolve(process.cwd(), ".
|
|
48
|
+
path.resolve(process.cwd(), ".xray/routing-mappings.json"),
|
|
49
49
|
path.resolve(process.cwd(), "xray/routing-mappings.json"),
|
|
50
|
-
path.resolve(process.cwd(), ".opencode/
|
|
50
|
+
path.resolve(process.cwd(), ".opencode/xray/routing-mappings.json"),
|
|
51
51
|
path.resolve(process.cwd(), "routing-mappings.json"),
|
|
52
52
|
];
|
|
53
53
|
for (const p of candidates) {
|
|
@@ -451,7 +451,7 @@ export class AgentDelegator {
|
|
|
451
451
|
*/
|
|
452
452
|
resolveProjectDirectory() {
|
|
453
453
|
const root = process.cwd();
|
|
454
|
-
if (fs.existsSync(`${root}/package.json`) || fs.existsSync(`${root}/
|
|
454
|
+
if (fs.existsSync(`${root}/package.json`) || fs.existsSync(`${root}/xray.config.json`)) {
|
|
455
455
|
return root;
|
|
456
456
|
}
|
|
457
457
|
let current = root;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @version 1.0.0
|
|
8
8
|
* @since 2026-04-16
|
|
9
9
|
*/
|
|
10
|
-
import type {
|
|
10
|
+
import type { XrayStateManager } from "../state/state-manager.js";
|
|
11
11
|
export interface DelegationMetricEntry {
|
|
12
12
|
timestamp: number;
|
|
13
13
|
operation: string;
|
|
@@ -74,19 +74,19 @@ export interface MetricsExport {
|
|
|
74
74
|
exportedAt: number;
|
|
75
75
|
entryCount: number;
|
|
76
76
|
}
|
|
77
|
-
export declare function getDelegationMetrics(stateManager:
|
|
78
|
-
export declare function getOrchestrationMetrics(stateManager:
|
|
79
|
-
export declare function aggregateDelegationMetrics(stateManager:
|
|
80
|
-
export declare function aggregateOrchestrationMetrics(stateManager:
|
|
81
|
-
export declare function summarizeByAgent(stateManager:
|
|
82
|
-
export declare function summarizeByComplexityLevel(stateManager:
|
|
83
|
-
export declare function summarizeByTimePeriod(stateManager:
|
|
84
|
-
export declare function rotateMetrics(stateManager:
|
|
77
|
+
export declare function getDelegationMetrics(stateManager: XrayStateManager): DelegationMetricEntry[];
|
|
78
|
+
export declare function getOrchestrationMetrics(stateManager: XrayStateManager): OrchestrationMetricEntry[];
|
|
79
|
+
export declare function aggregateDelegationMetrics(stateManager: XrayStateManager): AggregatedMetrics;
|
|
80
|
+
export declare function aggregateOrchestrationMetrics(stateManager: XrayStateManager): AggregatedMetrics;
|
|
81
|
+
export declare function summarizeByAgent(stateManager: XrayStateManager, type?: "delegation" | "orchestration"): Record<string, unknown>;
|
|
82
|
+
export declare function summarizeByComplexityLevel(stateManager: XrayStateManager, type?: "delegation" | "orchestration"): Record<string, unknown>;
|
|
83
|
+
export declare function summarizeByTimePeriod(stateManager: XrayStateManager, type?: "delegation" | "orchestration"): Record<string, unknown>;
|
|
84
|
+
export declare function rotateMetrics(stateManager: XrayStateManager, maxEntries?: number): {
|
|
85
85
|
delegation: number;
|
|
86
86
|
orchestration: number;
|
|
87
87
|
};
|
|
88
|
-
export declare function cleanupOldMetrics(stateManager:
|
|
88
|
+
export declare function cleanupOldMetrics(stateManager: XrayStateManager, olderThan: number): {
|
|
89
89
|
delegation: number;
|
|
90
90
|
orchestration: number;
|
|
91
91
|
};
|
|
92
|
-
export declare function exportMetrics(stateManager:
|
|
92
|
+
export declare function exportMetrics(stateManager: XrayStateManager, format?: "json" | "csv" | "summary"): MetricsExport;
|