0xray 3.5.0 → 3.5.2

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.
Files changed (60) hide show
  1. package/.gitignore.default +8 -0
  2. package/.opencode/hooks/post-commit +7 -27
  3. package/.xray/features.json +6 -0
  4. package/.xray/features.schema.json +17 -0
  5. package/AGENTS-consumer.md +1 -1
  6. package/AGENTS.md +1 -1
  7. package/README.md +1 -1
  8. package/SKILLS.md +1 -1
  9. package/dist/.gitignore.default +8 -0
  10. package/dist/AGENTS.md +1 -1
  11. package/dist/CHANGELOG.md +32 -0
  12. package/dist/README.md +1 -1
  13. package/dist/SKILLS.md +1 -1
  14. package/dist/core/bridge.mjs +10 -32
  15. package/dist/core/features-config.d.ts +16 -0
  16. package/dist/core/features-config.js +24 -0
  17. package/dist/integrations/grok/hooks/grok-hook-utils.js +32 -385
  18. package/dist/integrations/grok/hooks/post-tool-use.js +1 -1
  19. package/dist/integrations/grok/hooks/pre-tool-use.js +23 -32
  20. package/dist/integrations/grok/hooks/session-start.js +20 -1
  21. package/dist/integrations/grok/plugin/0xray/hooks/hooks.json +2 -1
  22. package/dist/integrations/hermes-agent/__init__.py +50 -3
  23. package/dist/integrations/hermes-agent/bridge.mjs +71 -30
  24. package/dist/integrations/hooks/delegation-gate-runtime.mjs +75 -0
  25. package/dist/integrations/hooks/synthesis-hook-runtime.mjs +50 -0
  26. package/dist/mcps/orchestrator/handlers/complexity-handler.d.ts +3 -0
  27. package/dist/mcps/orchestrator/handlers/complexity-handler.js +25 -10
  28. package/dist/mcps/orchestrator/server.js +124 -4
  29. package/dist/memory-routing/types.d.ts +7 -0
  30. package/dist/nucleus/autonomy-kernel.d.ts +3 -0
  31. package/dist/nucleus/autonomy-kernel.js +40 -0
  32. package/dist/nucleus/delegation-gate.d.ts +88 -0
  33. package/dist/nucleus/delegation-gate.js +347 -0
  34. package/dist/nucleus/lead-dev-plan-persistence.d.ts +3 -0
  35. package/dist/nucleus/lead-dev-plan-persistence.js +47 -4
  36. package/dist/nucleus/synthesis-completion.d.ts +6 -0
  37. package/dist/nucleus/synthesis-completion.js +29 -0
  38. package/dist/nucleus/synthesis-context.d.ts +31 -0
  39. package/dist/nucleus/synthesis-context.js +86 -0
  40. package/dist/nucleus/synthesis.d.ts +54 -0
  41. package/dist/nucleus/synthesis.js +196 -0
  42. package/dist/plugin/xray-codex-injection.js +50 -0
  43. package/package.json +11 -2
  44. package/scripts/helpers/find-project-root.mjs +92 -0
  45. package/scripts/hooks/install-hooks.cjs +136 -36
  46. package/scripts/hooks/run-hook.js +46 -9
  47. package/scripts/mjs/delegation-gate-fixture.mjs +121 -0
  48. package/scripts/mjs/verify-delegation-gate-core.mjs +99 -0
  49. package/scripts/mjs/verify-grok-delegation-gate.mjs +9 -69
  50. package/scripts/mjs/verify-hermes-delegation-gate.mjs +89 -0
  51. package/scripts/node/auto-reflection-generator.mjs +7 -0
  52. package/scripts/node/consumer-gitignore.cjs +101 -0
  53. package/scripts/node/load-reflection-config.mjs +77 -0
  54. package/scripts/node/postinstall.cjs +9 -6
  55. package/scripts/node/universal-version-manager.js +1 -1
  56. package/src/integrations/grok/plugin/0xray/hooks/hooks.json +2 -1
  57. package/src/mcps/orchestrator/handlers/complexity-handler.ts +33 -8
  58. package/src/mcps/orchestrator/server.ts +181 -5
  59. package/xray/features.json +6 -0
  60. package/xray/features.schema.json +17 -0
@@ -20,6 +20,13 @@ credentials.json
20
20
  *.pem
21
21
  *.key
22
22
 
23
+ # 0xray suit artifacts (postinstall / bridge install)
24
+ .grok/
25
+ .mcp.json
26
+ opencode.json
27
+ AGENTS.md
28
+ SKILLS.md
29
+
23
30
  # Runtime state (xray inference workflows, session state)
24
31
  .xray/
25
32
  .strray/
@@ -41,6 +48,7 @@ xray/inference/
41
48
 
42
49
  # Logs
43
50
  logs/
51
+ logs/framework/
44
52
  *.log
45
53
 
46
54
  # OS files
@@ -20,39 +20,19 @@ BRANCH=$(git rev-parse --abbrev-ref HEAD)
20
20
  fi
21
21
  ) &
22
22
 
23
- # Load auto_reflection config from features.json
24
- CONFIG_FILE="$PROJECT_ROOT/.xray/features.json"
23
+ # Load reflection config — synthesis.reflection SSOT, fallback auto_reflection
25
24
  MODE="minimal"
26
25
  COMMIT_THRESHOLD=25
27
26
  DAYS_THRESHOLD=14
28
27
  AUTO_GENERATE=true
29
28
  PROMPT_USER=true
30
29
 
31
- if [ -f "$CONFIG_FILE" ]; then
32
- MODE=$(grep -o '"mode": *"[^"]*"' "$CONFIG_FILE" | cut -d'"' -f4)
33
- MODE=${MODE:-minimal}
34
-
35
- # Get thresholds based on mode
36
- case "$MODE" in
37
- full)
38
- COMMIT_THRESHOLD=10
39
- DAYS_THRESHOLD=5
40
- AUTO_GENERATE=true
41
- PROMPT_USER=true
42
- ;;
43
- minimal)
44
- COMMIT_THRESHOLD=25
45
- DAYS_THRESHOLD=14
46
- AUTO_GENERATE=true
47
- PROMPT_USER=true
48
- ;;
49
- off)
50
- COMMIT_THRESHOLD=999
51
- DAYS_THRESHOLD=365
52
- AUTO_GENERATE=false
53
- PROMPT_USER=false
54
- ;;
55
- esac
30
+ if command -v node >/dev/null 2>&1; then
31
+ LOAD_SCRIPT="$PROJECT_ROOT/scripts/node/load-reflection-config.mjs"
32
+ if [ -f "$LOAD_SCRIPT" ]; then
33
+ export PROJECT_ROOT="$PROJECT_ROOT"
34
+ eval "$(node "$LOAD_SCRIPT")"
35
+ fi
56
36
  fi
57
37
 
58
38
  # Check if this was a significant commit - prompt for reflection
@@ -141,6 +141,12 @@
141
141
  "module_path": "",
142
142
  "config": {}
143
143
  },
144
+ "synthesis": {
145
+ "enabled": false,
146
+ "every_n_gates": 12,
147
+ "every_n_turns": 0,
148
+ "every_n_todos_completed": 0
149
+ },
144
150
  "inference_governance": {
145
151
  "enabled": false,
146
152
  "request_timeout_ms": 10000,
@@ -27,6 +27,23 @@
27
27
  "then": {
28
28
  "required": ["module_path"]
29
29
  }
30
+ },
31
+ "synthesis": {
32
+ "type": "object",
33
+ "properties": {
34
+ "enabled": { "type": "boolean" },
35
+ "every_n_gates": { "type": "integer", "minimum": 0 },
36
+ "every_n_turns": { "type": "integer", "minimum": 0 },
37
+ "every_n_todos_completed": { "type": "integer", "minimum": 0 },
38
+ "reflection": {
39
+ "type": "object",
40
+ "properties": {
41
+ "mode": { "type": "string", "enum": ["full", "minimal", "off"] },
42
+ "triggers": { "type": "object" },
43
+ "thresholds": { "type": "object" }
44
+ }
45
+ }
46
+ }
30
47
  }
31
48
  },
32
49
  "additionalProperties": true
@@ -4,7 +4,7 @@
4
4
 
5
5
  Quick reference for the 0xRay AI orchestration framework (shipped to your project on `npm install 0xray`).
6
6
 
7
- **v3.5.0** — 7 MCP servers · 45 skills · 68 codex terms · 4 platform bridges
7
+ **v3.5.2** — 7 MCP servers · 45 skills · 68 codex terms · 4 platform bridges
8
8
 
9
9
  ## Postinstall (automatic)
10
10
 
package/AGENTS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # xray Agents
2
2
 
3
- Quick reference for the xray AI orchestration framework (**v3.5.0**).
3
+ Quick reference for the xray AI orchestration framework (**v3.5.2**).
4
4
 
5
5
  **42 agents** · **45 skills** · **7 consumer MCP servers** · **68 codex terms** · **3,226 tests**
6
6
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # xray — MCP-Centric AI Governance OS
2
2
 
3
- **v3.5.0** — 42 agents · 45 skills · 7 MCP servers · 68 codex terms · 3,226 tests
3
+ **v3.5.2** — 42 agents · 45 skills · 7 MCP servers · 68 codex terms · 3,226 tests
4
4
 
5
5
  ## Your AI Power Suit
6
6
 
package/SKILLS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # 0xray Skills
2
2
 
3
- **v3.5.0** — **45 skills** · invoked via `xray-skills` MCP · synced on postinstall
3
+ **v3.5.2** — **45 skills** · invoked via `xray-skills` MCP · synced on postinstall
4
4
 
5
5
  xray ships 45 knowledge skills (`src/skills/<name>/SKILL.md`) across the full software lifecycle. Lead-dev operating model lives in **`orchestrator`** skill + `multi_agent_orchestration.lead_dev_mode` in features.json. Skills load on demand via the **xray-skills** MCP server (`npx -y 0xray mcp skills`), agent `@mentions`, or platform skill directories after postinstall.
6
6
 
@@ -20,6 +20,13 @@ credentials.json
20
20
  *.pem
21
21
  *.key
22
22
 
23
+ # 0xray suit artifacts (postinstall / bridge install)
24
+ .grok/
25
+ .mcp.json
26
+ opencode.json
27
+ AGENTS.md
28
+ SKILLS.md
29
+
23
30
  # Runtime state (xray inference workflows, session state)
24
31
  .xray/
25
32
  .strray/
@@ -41,6 +48,7 @@ xray/inference/
41
48
 
42
49
  # Logs
43
50
  logs/
51
+ logs/framework/
44
52
  *.log
45
53
 
46
54
  # OS files
package/dist/AGENTS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # xray Agents
2
2
 
3
- Quick reference for the xray AI orchestration framework (**v3.5.0**).
3
+ Quick reference for the xray AI orchestration framework (**v3.5.2**).
4
4
 
5
5
  **42 agents** · **45 skills** · **7 consumer MCP servers** · **68 codex terms** · **3,226 tests**
6
6
 
package/dist/CHANGELOG.md CHANGED
@@ -4,6 +4,38 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Conventional Commits](https://www.conventionalcommits.org/).
6
6
 
7
+ ## [3.5.2] - 2026-06-19
8
+
9
+ ### 🐛 Bug Fixes
10
+ - **Grok synthesis gate** — `pre-tool-use.js` wires `evaluatePreToolGate` SSOT (synthesis deny, gate slices, `govern-and-apply` block); fail-closed on hook errors
11
+ - **Consumer bridge root** — `findProjectRoot` git-root + devDependency detection; `findGitRoot` applies `normalizePath`
12
+ - **Consumer hooks** — stale xray pre-commit reinstall; post-commit hook installed; pre-commit fails closed when runner missing; non-xray hooks backed up before overwrite
13
+ - **Consumer `.gitignore`** — idempotent suit block merge on postinstall; preserves orphan tail on incomplete marker
14
+ - **`bridge.mjs`** — `handleGetConfig` fixes undeclared `envDir` ReferenceError
15
+ - **Post-commit reflection** — `load-reflection-config.mjs` mode whitelist + `--json` output (no shell `eval`); macOS/BSD `stat` support
16
+
17
+ ### ✅ Tests
18
+ - `verify-grok-synthesis-gate.mjs` (4/4 live Grok hook); chained in `verify:grok-delegation-gate` and `verify:delegation-gate`
19
+ - `verify-consumer-gitignore` incomplete-marker fixture; `verify:find-project-root` 3/3
20
+
21
+ ---
22
+
23
+ ## [3.5.1] - 2026-06-19
24
+
25
+ ### ✨ Features
26
+ - **Multi-host delegation gates** — `src/nucleus/delegation-gate.ts` SSOT; `evaluatePreToolGate` / `evaluatePostToolSpawn` shared across Grok, Hermes, OpenCode
27
+ - **Hermes** — `pre_tool_call` returns `{"action":"block"}` via bridge `delegation-gate`; `post_tool_call` clears pending on `delegate_task`
28
+ - **OpenCode** — `tool.execute.before` / `after` enforce delegation gate + post-spawn clear
29
+
30
+ ### ✅ Tests
31
+ - `delegation-gate.test.ts`; `verify-delegation-gate-core.mjs`; `verify-hermes-delegation-gate.mjs`; shared `delegation-gate-fixture.mjs`
32
+ - Grok hook-utils deduped — re-exports nucleus SSOT via `delegation-gate-runtime.mjs`
33
+
34
+ ### 📋 Deferred
35
+ - **OpenClaw host veto** — no consumer tool-block API; observability-only until platform supports pre-tool deny
36
+
37
+ ---
38
+
7
39
  ## [3.5.0] - 2026-06-19
8
40
 
9
41
  ### ✨ Features
package/dist/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # xray — MCP-Centric AI Governance OS
2
2
 
3
- **v3.5.0** — 42 agents · 45 skills · 7 MCP servers · 68 codex terms · 3,226 tests
3
+ **v3.5.2** — 42 agents · 45 skills · 7 MCP servers · 68 codex terms · 3,226 tests
4
4
 
5
5
  ## Your AI Power Suit
6
6
 
package/dist/SKILLS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # 0xray Skills
2
2
 
3
- **v3.5.0** — **45 skills** · invoked via `xray-skills` MCP · synced on postinstall
3
+ **v3.5.2** — **45 skills** · invoked via `xray-skills` MCP · synced on postinstall
4
4
 
5
5
  xray ships 45 knowledge skills (`src/skills/<name>/SKILL.md`) across the full software lifecycle. Lead-dev operating model lives in **`orchestrator`** skill + `multi_agent_orchestration.lead_dev_mode` in features.json. Skills load on demand via the **xray-skills** MCP server (`npx -y 0xray mcp skills`), agent `@mentions`, or platform skill directories after postinstall.
6
6
 
@@ -51,6 +51,7 @@ import { join, dirname, resolve, relative } from "path";
51
51
  import { fileURLToPath } from "url";
52
52
  import { homedir } from "os";
53
53
  import { createServer } from "http";
54
+ import { findProjectRoot } from "../../scripts/helpers/find-project-root.mjs";
54
55
 
55
56
  const __dirname = dirname(fileURLToPath(import.meta.url));
56
57
 
@@ -63,35 +64,11 @@ let CodexFormatterModule = null;
63
64
  let frameworkReady = false;
64
65
  let frameworkLoadAttempted = false;
65
66
 
66
- // ============================================================================
67
- // Project Root Detection
68
- // ============================================================================
69
-
70
- function findProjectRoot() {
71
- const envHome = process.env.XRAY_HOME;
72
- if (envHome && existsSync(join(envHome, "package.json"))) return envHome;
73
-
74
- const candidates = [
75
- process.cwd(),
76
- join(homedir(), "dev", "xray"),
77
- join(dirname(__dirname), "..", ".."), // core/ -> project root
78
- join(dirname(__dirname), "..", "..", ".."), // integrations/ -> project root
79
- ];
80
-
81
- for (const dir of candidates) {
82
- try {
83
- const pkgPath = join(dir, "package.json");
84
- if (existsSync(pkgPath)) {
85
- const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
86
- if (pkg.name === "0xray" || pkg.dependencies?.["0xray"]) {
87
- return dir;
88
- }
89
- }
90
- } catch {
91
- continue;
92
- }
93
- }
94
- return process.cwd();
67
+ function resolveBridgeProjectRoot() {
68
+ return findProjectRoot([
69
+ join(dirname(__dirname), "..", ".."),
70
+ join(dirname(__dirname), "..", "..", ".."),
71
+ ]);
95
72
  }
96
73
 
97
74
  // ============================================================================
@@ -184,7 +161,7 @@ const BRIDGE_CODEX_FALLBACK = {
184
161
  // ============================================================================
185
162
 
186
163
  async function handleHealth(input) {
187
- const projectRoot = findProjectRoot();
164
+ const projectRoot = resolveBridgeProjectRoot();
188
165
  const loaded = await loadFramework(projectRoot);
189
166
 
190
167
  const pkgPath = join(projectRoot, "package.json");
@@ -313,6 +290,7 @@ async function handleGetCodexPrompt(input, projectRoot, logDir) {
313
290
 
314
291
  async function handleGetConfig(input, projectRoot, logDir) {
315
292
  logToActivity(logDir, "get-config");
293
+ const envDir = process.env.XRAY_CONFIG_DIR;
316
294
 
317
295
  const result = {
318
296
  status: "ok",
@@ -374,7 +352,7 @@ async function handleStats() {
374
352
  codexFormatterAvailable: !!CodexFormatterModule,
375
353
  qualityGateAvailable: !!QualityGateModule,
376
354
  nodeVersion: process.version,
377
- projectRoot: findProjectRoot(),
355
+ projectRoot: resolveBridgeProjectRoot(),
378
356
  };
379
357
  }
380
358
 
@@ -893,7 +871,7 @@ async function main() {
893
871
  }
894
872
  }
895
873
 
896
- const projectRoot = findProjectRoot();
874
+ const projectRoot = resolveBridgeProjectRoot();
897
875
  const logDir = ensureLogDir(projectRoot);
898
876
 
899
877
  // Lazy-load framework
@@ -66,6 +66,21 @@ export interface MultiAgentOrchestrationConfig {
66
66
  /** 3.5.0 — PreToolUse gate after delegate-deferred (default true when lead_dev_mode) */
67
67
  auto_chain_delegations?: boolean;
68
68
  }
69
+ /** Reflection triggers merged from legacy auto_reflection when synthesis is configured */
70
+ export interface SynthesisReflectionConfig {
71
+ mode?: AutoReflectionConfig['mode'];
72
+ triggers?: AutoReflectionConfig['triggers'];
73
+ thresholds?: AutoReflectionConfig['thresholds'];
74
+ }
75
+ /** 3.6.0 — periodic reflect & realign checkpoint (Synthesis PR1) */
76
+ export interface SynthesisConfig {
77
+ enabled: boolean;
78
+ every_n_gates: number;
79
+ every_n_turns: number;
80
+ every_n_todos_completed: number;
81
+ /** SSOT for reflection triggers when synthesis enabled; seeded from auto_reflection */
82
+ reflection?: SynthesisReflectionConfig;
83
+ }
69
84
  export interface AutonomousReportingConfig {
70
85
  enabled: boolean;
71
86
  interval_minutes: number;
@@ -369,6 +384,7 @@ export interface FeaturesConfig {
369
384
  auto_reflection?: AutoReflectionConfig;
370
385
  inference?: InferenceConfig;
371
386
  memory_routing?: MemoryRoutingConfig;
387
+ synthesis: SynthesisConfig;
372
388
  kernel?: KernelConfig;
373
389
  processors?: ProcessorsConfig;
374
390
  enforcement?: EnforcementConfig;
@@ -278,6 +278,24 @@ export class FeaturesConfigLoader {
278
278
  ...defaults.caching,
279
279
  ...configData.caching,
280
280
  },
281
+ synthesis: (() => {
282
+ const merged = {
283
+ ...defaults.synthesis,
284
+ ...configData.synthesis,
285
+ };
286
+ const reflection = configData.synthesis?.reflection ??
287
+ (configData.auto_reflection
288
+ ? {
289
+ mode: configData.auto_reflection.mode,
290
+ triggers: configData.auto_reflection.triggers,
291
+ thresholds: configData.auto_reflection.thresholds,
292
+ }
293
+ : undefined);
294
+ if (reflection) {
295
+ merged.reflection = reflection;
296
+ }
297
+ return merged;
298
+ })(),
281
299
  };
282
300
  }
283
301
  /**
@@ -391,6 +409,12 @@ export class FeaturesConfigLoader {
391
409
  cache_ttl_seconds: 300,
392
410
  max_cache_size_mb: 50,
393
411
  },
412
+ synthesis: {
413
+ enabled: false,
414
+ every_n_gates: 12,
415
+ every_n_turns: 0,
416
+ every_n_todos_completed: 0,
417
+ },
394
418
  };
395
419
  }
396
420
  /**