0xray 2.0.1 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.opencode/codex.codex +1 -1
- package/.opencode/commands/dependency-audit.md +3 -3
- package/.opencode/enforcer-config.json +2 -2
- package/.opencode/hooks/post-commit +1 -1
- package/.opencode/init.sh +2 -2
- package/AGENTS.md +1 -1
- package/README.md +2 -2
- package/dist/AGENTS.md +1 -1
- package/dist/CHANGELOG.md +10 -0
- package/dist/README.md +2 -2
- package/dist/analytics/routing-refiner.js +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 +27 -27
- 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/features-config.js +1 -1
- 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 +4 -4
- package/dist/mcps/auto-format.server.d.ts +2 -2
- package/dist/mcps/auto-format.server.js +4 -4
- package/dist/mcps/boot-orchestrator.server.d.ts +2 -2
- package/dist/mcps/boot-orchestrator.server.js +4 -4
- 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 +4 -4
- package/dist/mcps/estimation.server.js +1 -1
- package/dist/mcps/framework-compliance-audit.server.d.ts +2 -2
- package/dist/mcps/framework-compliance-audit.server.js +4 -4
- package/dist/mcps/framework-help.server.js +7 -7
- package/dist/mcps/governance.server.js +1 -1
- 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 +4 -4
- package/dist/mcps/knowledge-skills/architecture-patterns.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/architecture-patterns.server.js +4 -4
- package/dist/mcps/knowledge-skills/bug-triage-specialist.server.js +1 -1
- package/dist/mcps/knowledge-skills/code-analyzer.server.js +1 -1
- package/dist/mcps/knowledge-skills/code-review.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/code-review.server.js +4 -4
- package/dist/mcps/knowledge-skills/content-creator.server.js +1 -1
- package/dist/mcps/knowledge-skills/database-design.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/database-design.server.js +4 -4
- package/dist/mcps/knowledge-skills/devops-deployment.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/devops-deployment.server.js +4 -4
- package/dist/mcps/knowledge-skills/git-workflow.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/git-workflow.server.js +4 -4
- package/dist/mcps/knowledge-skills/growth-strategist.server.js +1 -1
- package/dist/mcps/knowledge-skills/log-monitor.server.js +1 -1
- package/dist/mcps/knowledge-skills/mobile-development.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/mobile-development.server.js +4 -4
- package/dist/mcps/knowledge-skills/multimodal-looker.server.js +1 -1
- package/dist/mcps/knowledge-skills/performance-optimization.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/performance-optimization.server.js +4 -4
- package/dist/mcps/knowledge-skills/project-analysis.server.js +1 -1
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.js +4 -4
- package/dist/mcps/knowledge-skills/security-audit.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/security-audit.server.js +4 -4
- package/dist/mcps/knowledge-skills/seo-consultant.server.js +1 -1
- package/dist/mcps/knowledge-skills/session-management.server.js +1 -1
- package/dist/mcps/knowledge-skills/skill-invocation.server.js +1 -1
- package/dist/mcps/knowledge-skills/strategist.server.js +1 -1
- package/dist/mcps/knowledge-skills/tech-writer.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/tech-writer.server.js +5 -5
- package/dist/mcps/knowledge-skills/testing-best-practices.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/testing-best-practices.server.js +4 -4
- package/dist/mcps/knowledge-skills/testing-strategy.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/testing-strategy.server.js +4 -4
- package/dist/mcps/knowledge-skills/ui-ux-design.server.d.ts +2 -2
- package/dist/mcps/knowledge-skills/ui-ux-design.server.js +6 -6
- package/dist/mcps/lint.server.d.ts +2 -2
- package/dist/mcps/lint.server.js +6 -6
- 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 +4 -4
- 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 +4 -4
- package/dist/mcps/processor-pipeline.server.d.ts +2 -2
- package/dist/mcps/processor-pipeline.server.js +4 -4
- package/dist/mcps/registry.json +1 -1
- package/dist/mcps/researcher.server.d.ts +3 -3
- package/dist/mcps/researcher.server.js +5 -5
- package/dist/mcps/security-scan.server.d.ts +2 -2
- package/dist/mcps/security-scan.server.js +4 -4
- package/dist/mcps/simulation/server-simulations.js +3 -3
- package/dist/mcps/state-manager.server.js +1 -1
- 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/orchestrator/universal-registry-bridge.js +1 -1
- 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 +12 -12
- package/dist/skills/registry.json +1 -1
- 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/pre-publish-guard.js +16 -10
- package/scripts/node/release.js +6 -6
- package/scripts/node/release.mjs +11 -11
- package/scripts/node/universal-version-manager.js +2 -2
- 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 +4 -4
- package/src/mcps/auto-format.server.ts +4 -4
- package/src/mcps/boot-orchestrator.server.ts +4 -4
- 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 +4 -4
- package/src/mcps/estimation.server.ts +1 -1
- package/src/mcps/framework-compliance-audit.server.ts +4 -4
- package/src/mcps/framework-help.server.ts +7 -7
- package/src/mcps/governance.server.ts +1 -1
- 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 +4 -4
- package/src/mcps/knowledge-skills/architecture-patterns.server.ts +4 -4
- package/src/mcps/knowledge-skills/bug-triage-specialist.server.ts +1 -1
- package/src/mcps/knowledge-skills/code-analyzer.server.ts +1 -1
- package/src/mcps/knowledge-skills/code-review.server.ts +4 -4
- package/src/mcps/knowledge-skills/content-creator.server.ts +1 -1
- package/src/mcps/knowledge-skills/database-design.server.ts +4 -4
- package/src/mcps/knowledge-skills/devops-deployment.server.ts +4 -4
- package/src/mcps/knowledge-skills/git-workflow.server.ts +4 -4
- package/src/mcps/knowledge-skills/growth-strategist.server.ts +1 -1
- package/src/mcps/knowledge-skills/log-monitor.server.ts +1 -1
- package/src/mcps/knowledge-skills/mobile-development.server.ts +4 -4
- package/src/mcps/knowledge-skills/multimodal-looker.server.ts +1 -1
- package/src/mcps/knowledge-skills/performance-optimization.server.ts +4 -4
- package/src/mcps/knowledge-skills/project-analysis.server.ts +1 -1
- package/src/mcps/knowledge-skills/refactoring-strategies.server.ts +4 -4
- package/src/mcps/knowledge-skills/security-audit.server.test.ts +23 -23
- package/src/mcps/knowledge-skills/security-audit.server.ts +4 -4
- package/src/mcps/knowledge-skills/seo-consultant.server.ts +1 -1
- package/src/mcps/knowledge-skills/session-management.server.ts +1 -1
- package/src/mcps/knowledge-skills/skill-invocation.server.ts +1 -1
- package/src/mcps/knowledge-skills/strategist.server.ts +1 -1
- package/src/mcps/knowledge-skills/tech-writer.server.ts +5 -5
- package/src/mcps/knowledge-skills/testing-best-practices.server.test.ts +28 -28
- package/src/mcps/knowledge-skills/testing-best-practices.server.ts +4 -4
- package/src/mcps/knowledge-skills/testing-strategy.server.test.ts +19 -19
- package/src/mcps/knowledge-skills/testing-strategy.server.ts +4 -4
- package/src/mcps/knowledge-skills/ui-ux-design.server.ts +6 -6
- package/src/mcps/lint.server.ts +6 -6
- package/src/mcps/mcp-client.ts +3 -3
- package/src/mcps/model-health-check.server.ts +4 -4
- package/src/mcps/orchestrator/server.ts +2 -2
- package/src/mcps/performance-analysis.server.ts +4 -4
- package/src/mcps/processor-pipeline.server.ts +4 -4
- package/src/mcps/registry.json +1 -1
- package/src/mcps/researcher.server.ts +5 -5
- package/src/mcps/security-scan.server.ts +4 -4
- package/src/mcps/simulation/server-simulations.ts +3 -3
- package/src/mcps/state-manager.server.ts +1 -1
- package/src/opencode/codex.codex +1 -1
- package/src/opencode/commands/dependency-audit.md +3 -3
- package/src/opencode/enforcer-config.json +2 -2
- package/src/skills/hermes-agent/SKILL.md +12 -12
- package/src/skills/registry.json +1 -1
- 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
package/dist/core/bridge.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Xray Universal Bridge
|
|
5
5
|
*
|
|
6
|
-
* Standalone bridge that provides
|
|
6
|
+
* Standalone bridge that provides Xray framework capabilities
|
|
7
7
|
* to ANY consumer — no OpenCode dependency.
|
|
8
8
|
*
|
|
9
9
|
* Supports three transport modes:
|
|
@@ -84,7 +84,7 @@ function findProjectRoot() {
|
|
|
84
84
|
const pkgPath = join(dir, "package.json");
|
|
85
85
|
if (existsSync(pkgPath)) {
|
|
86
86
|
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
87
|
-
if (pkg.name === "
|
|
87
|
+
if (pkg.name === "0xray" || pkg.dependencies?.["0xray"]) {
|
|
88
88
|
return dir;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -219,11 +219,11 @@ async function handleHealth(input) {
|
|
|
219
219
|
*/
|
|
220
220
|
/** Codex candidate paths — single source of truth for both loadCodexFromFs and handleGetConfig */
|
|
221
221
|
function getCodexCandidates(projectRoot) {
|
|
222
|
-
const envDir = process.env.STRRAY_CONFIG_DIR;
|
|
222
|
+
const envDir = process.env.XRAY_CONFIG_DIR || process.env.STRRAY_CONFIG_DIR;
|
|
223
223
|
const candidates = [];
|
|
224
224
|
if (envDir) candidates.push(join(projectRoot, envDir, "codex.json"));
|
|
225
|
-
candidates.push(join(projectRoot, ".
|
|
226
|
-
candidates.push(join(projectRoot, ".opencode", "
|
|
225
|
+
candidates.push(join(projectRoot, ".xray", "codex.json"));
|
|
226
|
+
candidates.push(join(projectRoot, ".opencode", "xray", "codex.json"));
|
|
227
227
|
candidates.push(join(projectRoot, "codex.json"));
|
|
228
228
|
return candidates;
|
|
229
229
|
}
|
|
@@ -281,7 +281,7 @@ async function handleGetCodexPrompt(input, projectRoot, logDir) {
|
|
|
281
281
|
terms.sort((a, b) => (severityOrder[a.severity] || 3) - (severityOrder[b.severity] || 3));
|
|
282
282
|
if (maxTerms) terms = terms.slice(0, maxTerms);
|
|
283
283
|
|
|
284
|
-
const lines = [`##
|
|
284
|
+
const lines = [`## Xray Universal Development Codex v${termsSource.version}`];
|
|
285
285
|
const emojis = { blocking: "🔴", high: "🟡", medium: "🟢" };
|
|
286
286
|
const labels = { blocking: "BLOCKING", high: "HIGH PRIORITY", medium: "MEDIUM" };
|
|
287
287
|
|
|
@@ -348,8 +348,8 @@ async function handleGetConfig(input, projectRoot, logDir) {
|
|
|
348
348
|
// Load features.json
|
|
349
349
|
const featurePaths = [];
|
|
350
350
|
if (envDir) featurePaths.push(join(projectRoot, envDir, "features.json"));
|
|
351
|
-
featurePaths.push(join(projectRoot, ".
|
|
352
|
-
featurePaths.push(join(projectRoot, ".opencode", "
|
|
351
|
+
featurePaths.push(join(projectRoot, ".xray", "features.json"));
|
|
352
|
+
featurePaths.push(join(projectRoot, ".opencode", "xray", "features.json"));
|
|
353
353
|
|
|
354
354
|
let featurePath = null;
|
|
355
355
|
for (const p of featurePaths) {
|
|
@@ -604,7 +604,7 @@ function handleHooks(input, projectRoot) {
|
|
|
604
604
|
const { action, hooks } = input;
|
|
605
605
|
const hookTypes = hooks || ["pre-commit", "post-commit", "pre-push", "post-push"];
|
|
606
606
|
const gitHooksDir = join(projectRoot, ".git", "hooks");
|
|
607
|
-
const
|
|
607
|
+
const xrayHooksDir = join(projectRoot, "hooks");
|
|
608
608
|
|
|
609
609
|
if (!existsSync(gitHooksDir)) {
|
|
610
610
|
return { error: "Not a git repository — no .git/hooks directory" };
|
|
@@ -616,14 +616,14 @@ function handleHooks(input, projectRoot) {
|
|
|
616
616
|
if (action === "list" || action === "status") {
|
|
617
617
|
for (const hookName of hookTypes) {
|
|
618
618
|
const gitHook = join(gitHooksDir, hookName);
|
|
619
|
-
const
|
|
619
|
+
const xrayHook = join(xrayHooksDir, hookName);
|
|
620
620
|
|
|
621
621
|
if (!existsSync(gitHook)) {
|
|
622
622
|
result.missing.push(hookName);
|
|
623
623
|
} else {
|
|
624
624
|
try {
|
|
625
625
|
const content = readFileSync(gitHook, "utf-8");
|
|
626
|
-
if (content.includes("StringRay") || content.includes("strray") || content.includes("run-hook.js")) {
|
|
626
|
+
if (content.includes("Xray") || content.includes("StringRay") || content.includes("xray") || content.includes("strray") || content.includes("run-hook.js")) {
|
|
627
627
|
result.managed.push(hookName);
|
|
628
628
|
} else {
|
|
629
629
|
result.external.push(hookName);
|
|
@@ -633,8 +633,8 @@ function handleHooks(input, projectRoot) {
|
|
|
633
633
|
}
|
|
634
634
|
}
|
|
635
635
|
|
|
636
|
-
// Check if
|
|
637
|
-
if (!existsSync(
|
|
636
|
+
// Check if xray source hook exists
|
|
637
|
+
if (!existsSync(xrayHook)) {
|
|
638
638
|
result.stale.push(hookName);
|
|
639
639
|
}
|
|
640
640
|
}
|
|
@@ -644,7 +644,7 @@ function handleHooks(input, projectRoot) {
|
|
|
644
644
|
action,
|
|
645
645
|
hooks: result,
|
|
646
646
|
gitHooksDir,
|
|
647
|
-
|
|
647
|
+
xrayHooksDir,
|
|
648
648
|
};
|
|
649
649
|
}
|
|
650
650
|
|
|
@@ -655,7 +655,7 @@ function handleHooks(input, projectRoot) {
|
|
|
655
655
|
const errors = [];
|
|
656
656
|
|
|
657
657
|
for (const hookName of hookTypes) {
|
|
658
|
-
const src = join(
|
|
658
|
+
const src = join(xrayHooksDir, hookName);
|
|
659
659
|
const dst = join(gitHooksDir, hookName);
|
|
660
660
|
|
|
661
661
|
if (!existsSync(src)) {
|
|
@@ -664,11 +664,11 @@ function handleHooks(input, projectRoot) {
|
|
|
664
664
|
}
|
|
665
665
|
|
|
666
666
|
try {
|
|
667
|
-
// Backup existing non-
|
|
667
|
+
// Backup existing non-xray hooks
|
|
668
668
|
if (existsSync(dst)) {
|
|
669
669
|
const content = readFileSync(dst, "utf-8");
|
|
670
|
-
if (!content.includes("StringRay") && !content.includes("strray") && !content.includes("run-hook.js")) {
|
|
671
|
-
renameSync(dst, `${dst}.
|
|
670
|
+
if (!content.includes("Xray") && !content.includes("StringRay") && !content.includes("xray") && !content.includes("strray") && !content.includes("run-hook.js")) {
|
|
671
|
+
renameSync(dst, `${dst}.xray-backup`);
|
|
672
672
|
} else {
|
|
673
673
|
unlinkSync(dst);
|
|
674
674
|
}
|
|
@@ -699,15 +699,15 @@ function handleHooks(input, projectRoot) {
|
|
|
699
699
|
|
|
700
700
|
for (const hookName of hookTypes) {
|
|
701
701
|
const dst = join(gitHooksDir, hookName);
|
|
702
|
-
const backup = `${dst}.
|
|
702
|
+
const backup = `${dst}.xray-backup`;
|
|
703
703
|
|
|
704
704
|
if (!existsSync(dst)) continue;
|
|
705
705
|
|
|
706
706
|
try {
|
|
707
707
|
const content = readFileSync(dst, "utf-8");
|
|
708
|
-
const
|
|
708
|
+
const isXray = content.includes("Xray") || content.includes("StringRay") || content.includes("xray") || content.includes("strray") || content.includes("run-hook.js");
|
|
709
709
|
|
|
710
|
-
if (
|
|
710
|
+
if (isXray || lstatSync(dst).isSymbolicLink()) {
|
|
711
711
|
unlinkSync(dst);
|
|
712
712
|
|
|
713
713
|
// Restore backup if exists
|
|
@@ -89,8 +89,8 @@ export function findCodexPath(projectRoot) {
|
|
|
89
89
|
if (envDir) {
|
|
90
90
|
candidates.push(resolve(root, envDir, "codex.json"));
|
|
91
91
|
}
|
|
92
|
-
candidates.push(join(root, ".
|
|
93
|
-
candidates.push(join(root, ".opencode", "
|
|
92
|
+
candidates.push(join(root, ".xray", "codex.json"));
|
|
93
|
+
candidates.push(join(root, ".opencode", "xray", "codex.json"));
|
|
94
94
|
// Additional fallback locations (for standalone usage)
|
|
95
95
|
candidates.push(join(root, "codex.json"));
|
|
96
96
|
candidates.push(join(root, "src", "codex.json"));
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
* @since 2026-01-06
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
11
|
-
* Create
|
|
11
|
+
* Create xray-codex-injector hook
|
|
12
12
|
*
|
|
13
13
|
* This hook injects codex context into tool outputs and displays
|
|
14
14
|
* a welcome message on agent startup, following the production-tested
|
|
15
15
|
* pattern from OpenCode's rules-injector.
|
|
16
16
|
*/
|
|
17
|
-
export declare function
|
|
18
|
-
name: "
|
|
17
|
+
export declare function createXrayCodexInjectorHook(): {
|
|
18
|
+
name: "xray-codex-injector";
|
|
19
19
|
hooks: {
|
|
20
20
|
"agent.start": (sessionId: string) => Promise<void>;
|
|
21
21
|
"tool.execute.before": (input: {
|
|
@@ -72,3 +72,4 @@ export declare class CodexInjector {
|
|
|
72
72
|
concerns: string[];
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
+
export { createXrayCodexInjectorHook as createStringRayCodexInjectorHook };
|
|
@@ -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>;
|