0xray 4.0.34 → 4.0.36

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 (160) hide show
  1. package/.grok-plugin/plugin.json +1 -1
  2. package/.xray/codex.json +12 -4
  3. package/.xray/features.json +1 -1
  4. package/AGENTS-consumer.md +6 -6
  5. package/AGENTS.md +5 -5
  6. package/README.md +2 -2
  7. package/dist/AGENTS.md +5 -5
  8. package/dist/CHANGELOG.md +26 -0
  9. package/dist/README.md +2 -2
  10. package/dist/cli/index.js +2 -5
  11. package/dist/governance/governance-service.js +1 -1
  12. package/dist/integrations/base/README.md +1 -9
  13. package/dist/integrations/base/index.d.ts +0 -1
  14. package/dist/integrations/base/index.js +0 -2
  15. package/dist/integrations/governance/index.js +31 -8
  16. package/dist/integrations/grok/hooks/grok-hook-utils.js +1 -1
  17. package/dist/integrations/grok/hooks/session-start.js +12 -0
  18. package/dist/integrations/grok/plugin/0xray/hooks/hooks.json +6 -6
  19. package/dist/integrations/hooks/goggles-mcp.mjs +10 -3
  20. package/dist/integrations/hooks/goggles-pipeline.mjs +110 -23
  21. package/dist/integrations/hooks/host-truth.mjs +74 -0
  22. package/dist/integrations/hooks/station-hook-runtime.cjs +3 -0
  23. package/dist/integrations/openclaw/plugin/xray-pre-tool/package.json +1 -1
  24. package/dist/mcps/knowledge-skills/storyteller.server.js +0 -1
  25. package/dist/nucleus/delegation-gate.d.ts +2 -2
  26. package/dist/nucleus/delegation-gate.js +13 -2
  27. package/dist/nucleus/work-freshness.mjs +189 -0
  28. package/dist/processors/implementations/agents-md-validation-processor.js +1 -1
  29. package/docs-site/docs/plates/boot.md +17 -2
  30. package/docs-site/docs/plates/governance.md +3 -2
  31. package/docs-site/docs/plates/index.md +3 -1
  32. package/docs-site/docs/plates/memory-recall.md +26 -35
  33. package/docs-site/docs/plates/orchestration.md +39 -35
  34. package/docs-site/docs/plates/processor.md +34 -36
  35. package/docs-site/docs/plates/reporting.md +3 -8
  36. package/docs-site/docs/plates/routing.md +22 -11
  37. package/package.json +3 -2
  38. package/scripts/foundry/release.mjs +48 -5
  39. package/scripts/mjs/run-grok-hook.mjs +50 -0
  40. package/scripts/mjs/test-consumer-readiness.mjs +1 -0
  41. package/scripts/mjs/test-mcp-functionality.mjs +14 -9
  42. package/scripts/node/basic-security-audit.cjs +0 -1
  43. package/scripts/node/bridge-mcp-wiring.cjs +66 -3
  44. package/scripts/node/install-bridges.cjs +3 -3
  45. package/scripts/node/postinstall.cjs +1 -1
  46. package/scripts/node/prepare-consumer.cjs +11 -7
  47. package/scripts/node/setup-dev.cjs +18 -26
  48. package/scripts/node/validate-mcp-connectivity.js +2 -1
  49. package/src/integrations/grok/plugin/0xray/hooks/hooks.json +6 -6
  50. package/src/integrations/openclaw/plugin/xray-pre-tool/package.json +1 -1
  51. package/src/mcps/knowledge-skills/storyteller.server.ts +0 -1
  52. package/xray/agents_template.md +5 -5
  53. package/xray/codex.json +12 -4
  54. package/xray/features.json +1 -1
  55. package/dist/agents/known-names.d.ts +0 -26
  56. package/dist/agents/known-names.js +0 -72
  57. package/dist/analytics/consent-manager.d.ts +0 -92
  58. package/dist/analytics/consent-manager.js +0 -257
  59. package/dist/benchmark/performance-benchmark.d.ts +0 -103
  60. package/dist/benchmark/performance-benchmark.js +0 -373
  61. package/dist/cli/commands/analytics-disable.d.ts +0 -9
  62. package/dist/cli/commands/analytics-disable.js +0 -72
  63. package/dist/cli/commands/analytics-enable-action.d.ts +0 -8
  64. package/dist/cli/commands/analytics-enable-action.js +0 -82
  65. package/dist/cli/commands/analytics-preview.d.ts +0 -9
  66. package/dist/cli/commands/analytics-preview.js +0 -106
  67. package/dist/cli/commands/analytics-status.d.ts +0 -9
  68. package/dist/cli/commands/analytics-status.js +0 -68
  69. package/dist/cli/commands/enforce.d.ts +0 -12
  70. package/dist/cli/commands/enforce.js +0 -78
  71. package/dist/cli/commands/govern.d.ts +0 -29
  72. package/dist/cli/commands/govern.js +0 -149
  73. package/dist/cli/commands/security-audit.d.ts +0 -23
  74. package/dist/cli/commands/security-audit.js +0 -219
  75. package/dist/cli/server.d.ts +0 -1
  76. package/dist/cli/server.js +0 -147
  77. package/dist/config/routing-mappings.d.ts +0 -26
  78. package/dist/config/routing-mappings.js +0 -151
  79. package/dist/core/bridge.mjs +0 -922
  80. package/dist/core/trace-context.d.ts +0 -12
  81. package/dist/core/trace-context.js +0 -33
  82. package/dist/enforcement/index.d.ts +0 -22
  83. package/dist/enforcement/index.js +0 -40
  84. package/dist/enforcement/loaders/index.d.ts +0 -36
  85. package/dist/enforcement/loaders/index.js +0 -39
  86. package/dist/enforcement/test-auto-healing.d.ts +0 -83
  87. package/dist/enforcement/test-auto-healing.js +0 -325
  88. package/dist/inference/index.d.ts +0 -10
  89. package/dist/inference/index.js +0 -5
  90. package/dist/infrastructure/iac-validator.d.ts +0 -150
  91. package/dist/infrastructure/iac-validator.js +0 -465
  92. package/dist/infrastructure/schemas/cloud-schemas.d.ts +0 -482
  93. package/dist/infrastructure/schemas/cloud-schemas.js +0 -488
  94. package/dist/integrations/base/ExampleIntegration.d.ts +0 -46
  95. package/dist/integrations/base/ExampleIntegration.js +0 -180
  96. package/dist/integrations/enforcement-gate.d.ts +0 -44
  97. package/dist/integrations/enforcement-gate.js +0 -348
  98. package/dist/mcps/connection/connection-manager.d.ts +0 -39
  99. package/dist/mcps/connection/connection-manager.js +0 -79
  100. package/dist/mcps/index.d.ts +0 -17
  101. package/dist/mcps/index.js +0 -65
  102. package/dist/mcps/orchestrator/index.d.ts +0 -6
  103. package/dist/mcps/orchestrator/index.js +0 -5
  104. package/dist/metrics/index.d.ts +0 -6
  105. package/dist/metrics/index.js +0 -6
  106. package/dist/orchestrator/self-direction-activation.d.ts +0 -108
  107. package/dist/orchestrator/self-direction-activation.js +0 -244
  108. package/dist/orchestrator/universal-registry-bridge.d.ts +0 -84
  109. package/dist/orchestrator/universal-registry-bridge.js +0 -246
  110. package/dist/performance/performance-budget-enforcer.d.ts +0 -157
  111. package/dist/performance/performance-budget-enforcer.js +0 -433
  112. package/dist/performance/performance-regression-tester.d.ts +0 -107
  113. package/dist/performance/performance-regression-tester.js +0 -341
  114. package/dist/postprocessor/analysis/CodeChangeAnalyzer.d.ts +0 -11
  115. package/dist/postprocessor/analysis/CodeChangeAnalyzer.js +0 -50
  116. package/dist/postprocessor/config/ProcessorConfigLoader.d.ts +0 -44
  117. package/dist/postprocessor/config/ProcessorConfigLoader.js +0 -16
  118. package/dist/postprocessor/integration.d.ts +0 -156
  119. package/dist/postprocessor/integration.js +0 -194
  120. package/dist/postprocessor/metamorphosis/index.d.ts +0 -2
  121. package/dist/postprocessor/metamorphosis/index.js +0 -1
  122. package/dist/postprocessor/redeploy/RetryHandler.d.ts +0 -49
  123. package/dist/postprocessor/redeploy/RetryHandler.js +0 -118
  124. package/dist/processors/implementations/session-capture-processor.d.ts +0 -14
  125. package/dist/processors/implementations/session-capture-processor.js +0 -37
  126. package/dist/public/XrayService.d.ts +0 -17
  127. package/dist/public/XrayService.js +0 -40
  128. package/dist/public/index.d.ts +0 -4
  129. package/dist/public/index.js +0 -2
  130. package/dist/security/comprehensive-security-audit.d.ts +0 -157
  131. package/dist/security/comprehensive-security-audit.js +0 -1004
  132. package/dist/security/index.d.ts +0 -13
  133. package/dist/security/index.js +0 -13
  134. package/dist/security/security-agent-coordinator.d.ts +0 -71
  135. package/dist/security/security-agent-coordinator.js +0 -203
  136. package/dist/security/security-hardening-system.d.ts +0 -238
  137. package/dist/security/security-hardening-system.js +0 -726
  138. package/dist/security/security-orchestration-layer.d.ts +0 -118
  139. package/dist/security/security-orchestration-layer.js +0 -495
  140. package/dist/testing/memory-regression-suite.d.ts +0 -105
  141. package/dist/testing/memory-regression-suite.js +0 -258
  142. package/dist/tools/assess-complexity-tool.d.ts +0 -28
  143. package/dist/tools/assess-complexity-tool.js +0 -44
  144. package/dist/tools/query-routing-tool.d.ts +0 -17
  145. package/dist/tools/query-routing-tool.js +0 -59
  146. package/dist/utils/batch-operations.d.ts +0 -25
  147. package/dist/utils/batch-operations.js +0 -292
  148. package/dist/utils/task-graph.d.ts +0 -29
  149. package/dist/utils/task-graph.js +0 -106
  150. package/dist/utils/test-template-generator.d.ts +0 -25
  151. package/dist/utils/test-template-generator.js +0 -178
  152. package/dist/utils/token-manager.d.ts +0 -48
  153. package/dist/utils/token-manager.js +0 -163
  154. package/dist/validation/agent-config-validator.d.ts +0 -110
  155. package/dist/validation/agent-config-validator.js +0 -280
  156. package/dist/validation/orchestration-flow-validator.d.ts +0 -87
  157. package/dist/validation/orchestration-flow-validator.js +0 -606
  158. package/src/mcps/connection/connection-manager.ts +0 -91
  159. package/src/mcps/index.ts +0 -80
  160. package/src/mcps/orchestrator/index.ts +0 -29
@@ -5,45 +5,36 @@ sidebar_label: Memory recall
5
5
 
6
6
  # Memory recall
7
7
 
8
- Speech becomes a lesson. Intent names one plate. Compact points at the station card. The card names the stamp. The stamp file is the schematic.
8
+ Intent names one plate. Equal top scores recall nothing. A missing worn copy is stamped from the docs plate. An edited copy stays.
9
9
 
10
10
  ```
11
11
  ┌──────────────────────────────────────────────────────────────┐
12
12
  │ INPUT LAYER │
13
13
  │ │
14
- │ ┌──────────────┐ ┌──────────────┐ ┌────────────────┐ │
15
- │ │ speech │ │ intent │ │ compact cut │ │
16
- │ └──────┬───────┘ └──────┬───────┘ └───────┬────────┘ │
17
- └──────────┼──────────────────┼───────────────────┼───────────┘
18
- v v v
19
- ┌──────────┼──────────────────┼───────────────────┼───────────┐
20
- │ PROCESSING LAYER │ │ │
21
- │ v v v │
22
- │ ┌──────────────┐ ┌──────────────┐ ┌────────────────┐ │
23
- │ │ speech grades│ │ intent │ │ compact says │ │
24
- │ │ to a lesson │ │ recalls one │ │ Read STATION.md│ │
25
- │ │ on a signal │ │ plate │ │ │ │
26
- │ └──────┬───────┘ └──────┬───────┘ └───────┬────────┘ │
27
- │ │ │ │ │
28
- │ │ v │ │
29
- │ │ ┌────────────────────────────┐ │ │
30
- │ │ │ card keeps the short │ │ │
31
- │ │ │ subsystem table │ │ │
32
- │ │ │ card names Plate: <id> │ │ │
33
- │ │ └─────────────┬──────────────┘ │ │
34
- └──────────┼───────────────────┼──────────────────┼──────────┘
35
- v v v
36
- ┌──────────┴───────────────────┴──────────────────┴──────────┐
37
- │ OUTPUT LAYER │
38
- │ │
39
- │ ┌────────────────────────────┐ ┌─────────────────────┐ │
40
- │ │ lesson on the signal │ │ stamp file │ │
41
- │ │ an episode of what happened│ │ the schematic │ │
42
- │ └────────────────────────────┘ │ docs-site/docs/ │ │
43
- │ │ plates/<id>.md │ │
44
- │ │ worn copy only when │ │
45
- │ │ .xray/state/plates/ │ │
46
- │ │ <id>.md is missing │ │
47
- │ └─────────────────────┘ │
14
+ │ ┌──────────────────────────────────────────────────────┐ │
15
+ │ │ intent │ │
16
+ │ └──────────────────────────┬───────────────────────────┘ │
17
+ └──────────────────────────────┼──────────────────────────────┘
18
+ v
19
+ ┌──────────────────────────────┼──────────────────────────────┐
20
+ │ PROCESSING LAYER v │
21
+ │ ┌──────────────────────────────────────────────────────┐ │
22
+ │ │ score cues │ │
23
+ │ │ one winner loads that plate │ │
24
+ │ │ a tie returns nothing │ │
25
+ │ └──────────────────────────┬───────────────────────────┘ │
26
+ │ v │
27
+ │ ┌──────────────────────────────────────────────────────┐ │
28
+ │ │ stampPlateIfMissing │ │
29
+ │ │ writes .xray/state/plates only when that file │ │
30
+ │ │ is missing │ │
31
+ │ └──────────────────────────┬───────────────────────────┘ │
32
+ └──────────────────────────────┼──────────────────────────────┘
33
+ v
34
+ ┌──────────────────────────────┼──────────────────────────────┐
35
+ │ OUTPUT LAYER v │
36
+ │ ┌────────────────────┐ ┌────────────────────────┐ │
37
+ │ │ plate line │ │ stamp file │ │
38
+ │ └────────────────────┘ └────────────────────────┘ │
48
39
  └──────────────────────────────────────────────────────────────┘
49
40
  ```
@@ -5,51 +5,55 @@ sidebar_label: Orchestration
5
5
 
6
6
  # Orchestration
7
7
 
8
- Multi-step work is planned, run, and closed. Routing picks an agent. This plate is the coordination around that pick.
8
+ Each tool is its own call. `spawnAside` opens around `orchestrate-task`, `analyze-complexity`, and `govern-and-apply`. `closeAside` runs when that call returns.
9
9
 
10
10
  ```
11
11
  ┌────────────────────────────────────────────────────────────┐
12
12
  │ INPUT LAYER │
13
13
  │ │
14
- │ ┌────────────────────────────────────────────────────┐ │
15
- │ │ tasks │ │
16
- │ │ descriptions · dependencies · type │ │
17
- │ └──────────────────────────┬─────────────────────────┘ │
18
- └──────────────────────────────┼────────────────────────────┘
19
- v
20
- ┌──────────────────────────────┼────────────────────────────┐
21
- │ PROCESSING LAYER v │
22
- │ ┌────────────────────────────────────────────────────┐ │
23
- │ │ analyze-complexity │ │
24
- │ │ ExecutionPlanner validates and plans │ │
25
- │ └──────────────────────────┬─────────────────────────┘ │
26
- │ v │
27
- │ ┌────────────────────────────────────────────────────┐ │
28
- │ │ orchestrate-task │ │
29
- │ │ lead stays on the main thread │ │
30
- │ └──────────────────────────┬─────────────────────────┘ │
31
- │ v │
32
- │ ┌────────────────────────────────────────────────────┐ │
33
- │ │ spawnAside │ │
34
- │ │ on orchestrate-task, analyze-complexity, │ │
35
- │ │ and govern-and-apply │ │
36
- │ │ observations from the three flows │ │
37
- │ └──────────────────────────┬─────────────────────────┘ │
38
- │ v │
39
- │ ┌────────────────────────────────────────────────────┐ │
40
- │ │ confidence gate │ │
41
- │ │ getTaskConfidence when Repertoire is worn │ │
42
- │ └──────────────────────────┬─────────────────────────┘ │
43
- │ v │
44
- │ ┌────────────────────────────────────────────────────┐ │
45
- │ │ closeAside │ │
46
- │ └──────────────────────────┬─────────────────────────┘ │
14
+ │ ┌──────────────────────┐ ┌──────────────────────┐ │
15
+ │ │ tool name │ │ arguments │ │
16
+ │ └──────────┬───────────┘ └──────────┬───────────┘ │
17
+ └──────────────┼─────────────────────────────┼──────────────┘
18
+ v v
19
+ ┌──────────────┼─────────────────────────────┼──────────────┐
20
+ │ PROCESSING LAYER │ │
21
+ │ v v │
22
+ │ ┌────────────────────────────────────────────────────┐ │
23
+ │ │ orchestrate-task │ │
24
+ │ │ spawnAside · handleOrchestrateTask · closeAside │ │
25
+ │ └──────────────────────────┬─────────────────────────┘ │
26
+ │ v │
27
+ │ ┌────────────────────────────────────────────────────┐ │
28
+ │ │ analyze-complexity │ │
29
+ │ │ a due synthesis checkpoint can return first │ │
30
+ │ │ spawnAside · handleAnalyzeComplexity · closeAside │ │
31
+ │ └──────────────────────────┬─────────────────────────┘ │
32
+ │ v │
33
+ │ ┌────────────────────────────────────────────────────┐ │
34
+ │ │ govern-and-apply │ │
35
+ │ │ a due synthesis checkpoint blocks first │ │
36
+ │ │ spawnAside · governExternalProposals · closeAside │ │
37
+ │ └──────────────────────────┬─────────────────────────┘ │
38
+ │ v │
39
+ │ ┌────────────────────────────────────────────────────┐ │
40
+ │ │ get-orchestration-status │ │
41
+ │ └──────────────────────────┬─────────────────────────┘ │
42
+ │ v │
43
+ │ ┌────────────────────────────────────────────────────┐ │
44
+ │ │ cancel-orchestration │ │
45
+ │ │ closeAside on a forced cancel or a matching session│ │
46
+ │ └──────────────────────────┬─────────────────────────┘ │
47
+ │ v │
48
+ │ ┌────────────────────────────────────────────────────┐ │
49
+ │ │ optimize-orchestration │ │
50
+ │ └──────────────────────────┬─────────────────────────┘ │
47
51
  └──────────────────────────────┼────────────────────────────┘
48
52
  v
49
53
  ┌──────────────────────────────┼────────────────────────────┐
50
54
  │ OUTPUT LAYER v │
51
55
  │ ┌─────────────────────┐ ┌─────────────────────────┐ │
52
- │ │ execution result │ │ aside observations │ │
56
+ │ │ tool result │ │ aside id │ │
53
57
  │ └─────────────────────┘ └─────────────────────────┘ │
54
58
  └────────────────────────────────────────────────────────────┘
55
59
  ```
@@ -5,42 +5,40 @@ sidebar_label: Processor
5
5
 
6
6
  # Processor
7
7
 
8
- Three pipelines run in parallel. A is the live suit. B is the legacy processor manager. C is mill, git, and CI. Nothing in A is an input to B or C.
8
+ `ProcessorManager` runs the enabled pre processors, then the enabled post processors. Prompt text longer than 10 characters is checked inside the pre pass.
9
9
 
10
10
  ```
11
- ┌────────────────────────────────────────────────────────────────────────┐
12
- │ INPUT LAYER │
13
- │ │
14
- │ ┌──────────────────┐ ┌──────────────────┐ ┌────────────────────┐ │
15
- │ │ tool / session │ │ prompt text │ │ commit / release │ │
16
- │ └────────┬─────────┘ └────────┬─────────┘ └─────────┬──────────┘ │
17
- └────────────┼─────────────────────┼──────────────────────┼─────────────┘
18
- v v v
19
- ┌────────────┼─────────────────────┼──────────────────────┼─────────────┐
20
- │ PROCESSING LAYER three parallel pipelines │ │
21
- │ │ │ │ │
22
- │ ┌─────────┴──────────┐ ┌────────┴─────────┐ ┌──────────┴──────────┐ │
23
- │ │ A suit (live OS) │ │ B legacy manager │ │ C mill / git / CI │ │
24
- │ │ │ │ │ │ │ │
25
- │ │ SessionStart │ │ prompt-security │ │ mint │ │
26
- │ │ v │ │ v │ │ v │ │
27
- │ │ PreToolUse │ │ executePre │ │ inspect │ │
28
- │ │ v │ │ v │ │ v │ │
29
- │ │ tool runs │ │ work │ │ pre-commit │ │
30
- │ │ v │ │ v │ │ v │ │
31
- │ │ PostToolUse │ │ executePost │ │ pre-push │ │
32
- │ │ v │ │ │ │ v │ │
33
- │ │ compact heat │ │ │ │ foundry release │ │
34
- │ │ │ │ │ │ v │ │
35
- │ │ │ │ │ │ CI quality → docs │ │
36
- │ └─────────┬──────────┘ └────────┬─────────┘ └──────────┬──────────┘ │
37
- └────────────┼─────────────────────┼──────────────────────┼────────────┘
38
- v v v
39
- ┌────────────┴─────────────────────┴──────────────────────┴────────────┐
40
- │ OUTPUT LAYER │
41
- │ │
42
- │ ┌──────────────────┐ ┌──────────────────┐ ┌────────────────────┐ │
43
- │ │ allow / deny │ │ processor result │ │ gate / tag │ │
44
- │ └──────────────────┘ └──────────────────┘ └────────────────────┘ │
45
- └────────────────────────────────────────────────────────────────────────┘
11
+ ┌──────────────────────────────────────────────────────────────┐
12
+ │ INPUT LAYER │
13
+ │ │
14
+ │ ┌──────────────┐ ┌──────────────┐ ┌────────────────┐ │
15
+ │ │ tool │ │ args │ │ operation │ │
16
+ │ └──────┬───────┘ └──────┬───────┘ └───────┬────────┘ │
17
+ └──────────┼──────────────────┼───────────────────┼───────────┘
18
+ v v v
19
+ ┌──────────┼──────────────────┼───────────────────┼───────────┐
20
+ │ PROCESSING LAYER │ │ │
21
+ │ v v v │
22
+ │ ┌──────────────────────────────────────────────────────┐ │
23
+ │ │ executePreProcessors │ │
24
+ │ │ prompt-security-validator when the prompt is longer │ │
25
+ │ │ than 10 characters │ │
26
+ │ │ enabled pre processors, by priority │ │
27
+ │ └──────────────────────────┬───────────────────────────┘ │
28
+ │ v │
29
+ │ ┌──────────────────────────────────────────────────────┐ │
30
+ │ │ executePostProcessors │ │
31
+ │ │ enabled post processors, by priority │ │
32
+ │ │ a stagger waits out its minimum interval │ │
33
+ │ │ pre results are passed in │ │
34
+ │ └──────────────────────────┬───────────────────────────┘ │
35
+ └──────────────────────────────┼──────────────────────────────┘
36
+ v
37
+ ┌──────────────────────────────┼──────────────────────────────┐
38
+ │ OUTPUT LAYER v │
39
+ │ ┌──────────────────────────┐ ┌───────────────────────┐ │
40
+ │ │ pre result │ │ post results │ │
41
+ │ │ success and results │ │ │ │
42
+ │ └──────────────────────────┘ └───────────────────────┘ │
43
+ └──────────────────────────────────────────────────────────────┘
46
44
  ```
@@ -5,7 +5,7 @@ sidebar_label: Reporting
5
5
 
6
6
  # Reporting
7
7
 
8
- Logs become a report. Session start can also drop a schedule marker. The marker is a side output, not a second chain through the formatter.
8
+ Logs become a report. A valid cache returns the formatted report and does not write the file again.
9
9
 
10
10
  ```
11
11
  ┌────────────────────────────────────────────────────────────┐
@@ -22,14 +22,9 @@ Logs become a report. Session start can also drop a schedule marker. The marker
22
22
  │ ┌────────────────────────────────────────────────────┐ │
23
23
  │ │ FrameworkReportingSystem │ │
24
24
  │ │ collect logs → metrics → formatReport │ │
25
- │ │ cache a fresh report, then write the file │ │
25
+ │ │ cache the fresh report │ │
26
+ │ │ write the file when outputPath is set │ │
26
27
  │ └──────────────────────────┬─────────────────────────┘ │
27
- │ │ │
28
- │ ┌──────────────────────────┼─────────────────────────┐ │
29
- │ │ SessionStart marker │ │ │
30
- │ │ autonomous-reporting │ side output │ │
31
- │ │ scheduled flag │ │ │
32
- │ └──────────────────────────┼─────────────────────────┘ │
33
28
  └──────────────────────────────┼────────────────────────────┘
34
29
  v
35
30
  ┌──────────────────────────────┼────────────────────────────┐
@@ -5,14 +5,14 @@ sidebar_label: Routing
5
5
 
6
6
  # Routing
7
7
 
8
- Task text becomes an agent. thinDispatch scores the work. Repertoire may adjust the score when the organ is worn.
8
+ Task text becomes an agent. `scoreAndRoute` scores the work, then `routeToAgent` picks the tier agent. Repertoire may replace that agent when a law matches. Naming no plane stops before that pick and returns nobody.
9
9
 
10
10
  ```
11
11
  ┌──────────────────────────────────────────────────────────────┐
12
12
  │ INPUT LAYER │
13
13
  │ │
14
14
  │ ┌──────────────┐ ┌──────────────┐ ┌────────────────┐ │
15
- │ │ task text │ │ @agent │ │ scoreAndRoute │ │
15
+ │ │ task text │ │ context │ │ thresholds │ │
16
16
  │ └──────┬───────┘ └──────┬───────┘ └───────┬────────┘ │
17
17
  │ └──────────────────┴─────────┬─────────┘ │
18
18
  └────────────────────────────────────────┼─────────────────────┘
@@ -21,22 +21,30 @@ Task text becomes an agent. thinDispatch scores the work. Repertoire may adjust
21
21
  │ PROCESSING LAYER │ │
22
22
  │ v │
23
23
  │ ┌──────────────────────────────────────────────────────┐ │
24
- │ │ TaskSkillRouter │ │
25
- │ │ keyword facade into the route │ │
24
+ │ │ scoreComplexity │ │
25
+ │ │ ≤15 simple · single-agent │ │
26
+ │ │ ≤25 moderate · multi-agent │ │
27
+ │ │ ≤50 complex · orchestrator-led │ │
28
+ │ │ >50 enterprise · orchestrator-led │ │
26
29
  │ └──────────────────────────┬───────────────────────────┘ │
27
30
  │ v │
28
31
  │ ┌──────────────────────────────────────────────────────┐ │
29
- │ │ thinDispatch │ │
30
- │ │ ≤15 single agent │ │
31
- │ │ ≤25 single agent with tools │ │
32
- │ │ ≤50 multi-agent │ │
33
- │ │ >50 orchestrator-led │ │
32
+ │ │ lensPlane │ │
33
+ │ │ no plane named stops here and the agent is empty │ │
34
+ │ │ one plane attaches that file │ │
34
35
  │ └──────────────────────────┬───────────────────────────┘ │
35
36
  │ v │
36
37
  │ ┌──────────────────────────────────────────────────────┐ │
37
- │ │ Repertoire resolveThinDispatch │ │
38
- │ │ worn organ may change agent and score │ │
38
+ │ │ routeToAgent │ │
39
+ │ │ simple → code-reviewer │ │
40
+ │ │ moderate, complex, enterprise → architect │ │
41
+ │ └──────────────────────────┬───────────────────────────┘ │
42
+ │ v │
43
+ │ ┌──────────────────────────────────────────────────────┐ │
44
+ │ │ resolveThinDispatch │ │
45
+ │ │ worn repertoire may change agent and score │ │
39
46
  │ │ null provider leaves the score alone │ │
47
+ │ │ a stop never reaches this step │ │
40
48
  │ └──────────────────────────┬───────────────────────────┘ │
41
49
  └──────────────────────────────┼──────────────────────────────┘
42
50
  v
@@ -45,5 +53,8 @@ Task text becomes an agent. thinDispatch scores the work. Repertoire may adjust
45
53
  │ ┌────────────┐ ┌────────────────┐ ┌────────────────┐ │
46
54
  │ │ agent │ │ strategy │ │ adjusted score │ │
47
55
  │ └────────────┘ └────────────────┘ └────────────────┘ │
56
+ │ ┌────────────┐ │
57
+ │ │ file │ │
58
+ │ └────────────┘ │
48
59
  └──────────────────────────────────────────────────────────────┘
49
60
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "0xray",
3
- "version": "4.0.34",
3
+ "version": "4.0.36",
4
4
  "description": "Multi-agent orchestration and Codex governance for OpenCode, Hermes, Grok Build, and OpenClaw",
5
5
  "readme": "README.md",
6
6
  "license": "MIT",
@@ -73,7 +73,7 @@
73
73
  "test": "vitest run",
74
74
  "test:batch": "npm test",
75
75
  "test:unit": "npm test -- src/__tests__/unit/config-loader.test.ts src/__tests__/unit/state-manager.test.ts src/__tests__/unit/state-manager-persistence.test.ts src/__tests__/unit/context-loader.test.ts src/__tests__/unit/pattern-analyzer.test.ts src/__tests__/unit/complexity-calibrator.test.ts",
76
- "test:core-framework": "npm test -- src/__tests__/unit/self-direction-activation.test.ts src/__tests__/unit/ast-code-parser.test.ts src/__tests__/unit/v2-deletion-protection.test.ts",
76
+ "test:core-framework": "npm test -- src/__tests__/unit/v2-deletion-protection.test.ts",
77
77
  "test:security": "npm test -- src/__tests__/unit/security/security-hardener.test.ts src/__tests__/unit/security/security-headers.test.ts src/__tests__/unit/security/security-auditor.test.ts",
78
78
  "test:performance": "npm test -- src/__tests__/unit/monitoring.test.ts src/__tests__/unit/benchmark.test.ts src/__tests__/unit/analytics.test.ts",
79
79
  "test:session-management": "npm test -- src/__tests__/unit/session-state-manager.test.ts src/__tests__/unit/session-security-validator.test.ts src/__tests__/unit/session-coordination-validator.test.ts src/__tests__/unit/session-migration-validator.test.ts src/__tests__/unit/session-migration-logic.test.ts",
@@ -171,6 +171,7 @@
171
171
  "scripts/mjs/verify-four-floor-compact.mjs",
172
172
  "scripts/mjs/run-repertoire-mcp.mjs",
173
173
  "scripts/mjs/run-goggles-mcp.mjs",
174
+ "scripts/mjs/run-grok-hook.mjs",
174
175
  "scripts/mjs/verify-delegation-gate-core.mjs",
175
176
  "scripts/mjs/delegation-gate-fixture.mjs",
176
177
  "src/opencode/",
@@ -9,7 +9,8 @@
9
9
  * 4. Commit release artifacts → push
10
10
  * 5. Verify gate (reconcile + git + release docs + smoke)
11
11
  * 6. npm publish (idempotent — skip if version already on registry)
12
- * 7. Tag → push tag (only after successful publish)
12
+ * 7. Poll npm view until the registry lists that version
13
+ * 8. Tag → push tag (only after the registry lists it)
13
14
  *
14
15
  * Usage:
15
16
  * npx @0xray/foundry release [patch|minor|major] --dry-run
@@ -90,9 +91,13 @@ function currentBranch() {
90
91
  return execSync("git rev-parse --abbrev-ref HEAD", { cwd: rootDir, encoding: "utf-8" }).trim();
91
92
  }
92
93
 
94
+ function say(line) {
95
+ process.stdout.write(`${line}\n`);
96
+ }
97
+
93
98
  function npmVersionPublished(version) {
94
99
  try {
95
- const out = execSync(`npm view ${packageName()}@${version} version`, {
100
+ const out = execSync(`npm view ${packageName()}@${version} version --prefer-online`, {
96
101
  cwd: rootDir,
97
102
  encoding: "utf-8",
98
103
  stdio: ["pipe", "pipe", "pipe"],
@@ -103,20 +108,58 @@ function npmVersionPublished(version) {
103
108
  }
104
109
  }
105
110
 
111
+ function sleepMs(ms) {
112
+ const seconds = Math.max(1, Math.round(Number(ms) / 1000));
113
+ execSync(`sleep ${seconds}`, { stdio: "ignore" });
114
+ }
115
+
116
+ /**
117
+ * npm publish exits 0 while the registry still says the version is processing.
118
+ * Tag only after npm view lists it. Returns false when the wait runs out.
119
+ * @param {string} version
120
+ * @param {object} [hooks]
121
+ */
122
+ export function waitUntilListed(version, hooks = {}) {
123
+ const name = hooks.name ?? packageName();
124
+ const listed = hooks.listed ?? (() => npmVersionPublished(version));
125
+ const sleep = hooks.sleep ?? sleepMs;
126
+ const now = hooks.now ?? Date.now;
127
+ const log = hooks.log ?? say;
128
+ const fail = hooks.fail ?? ((line) => {
129
+ process.stderr.write(`${line}\n`);
130
+ process.exit(1);
131
+ });
132
+ const intervalMs = hooks.intervalMs ?? Number(process.env.FOUNDRY_PUBLISH_POLL_MS || 15000);
133
+ const timeoutMs = hooks.timeoutMs ?? Number(process.env.FOUNDRY_PUBLISH_TIMEOUT_MS || 20 * 60 * 1000);
134
+ const started = now();
135
+ let attempt = 0;
136
+ while (!listed()) {
137
+ if (now() - started >= timeoutMs) {
138
+ fail(`❌ ${name}@${version} was uploaded but the registry has not listed it. Tag not pushed.`);
139
+ return false;
140
+ }
141
+ attempt += 1;
142
+ log(`… registry has not listed ${name}@${version} yet (try ${attempt})`);
143
+ sleep(intervalMs);
144
+ }
145
+ return true;
146
+ }
147
+
106
148
  function publishIdempotent(version) {
107
149
  if (dryRun) {
108
- console.log(` would: ${npmPublishCmd()} (check ${packageName()}@${version} first)`);
150
+ say(` would: ${npmPublishCmd()} then poll npm view ${packageName()}@${version} until listed`);
109
151
  return;
110
152
  }
111
153
  if (npmVersionPublished(version)) {
112
- console.log(`ℹ️ ${packageName()}@${version} already on npm — skipping publish`);
154
+ say(`ℹ️ ${packageName()}@${version} already on npm — skipping publish`);
113
155
  return;
114
156
  }
115
157
  if (isXrayExoRepo(rootDir)) {
116
158
  runMill("assert-packed-dist-cli.mjs", [], "packed dist/cli");
117
159
  }
118
160
  execSync(npmPublishCmd(), { cwd: rootDir, stdio: "inherit", encoding: "utf-8" });
119
- console.log(`✅ Published ${packageName()}@${version}`);
161
+ if (!waitUntilListed(version)) process.exit(1);
162
+ say(`✅ Published ${packageName()}@${version}`);
120
163
  }
121
164
 
122
165
  async function main() {
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Runs a Grok hook from dist, or from src when a rebuild has removed dist.
4
+ * The hook command stays on this file, which prebuild does not delete.
5
+ */
6
+ import { existsSync, realpathSync } from 'node:fs';
7
+ import { dirname, join } from 'node:path';
8
+ import { fileURLToPath, pathToFileURL } from 'node:url';
9
+
10
+ const here = dirname(fileURLToPath(import.meta.url));
11
+ const root = join(here, '..', '..');
12
+
13
+ export function resolveGrokHook(packageRoot, name) {
14
+ const base = String(name || '');
15
+ if (!base || base.includes('/') || base.includes('..') || !base.endsWith('.js')) return '';
16
+ const candidates = [
17
+ join(packageRoot, 'dist', 'integrations', 'grok', 'hooks', base),
18
+ join(packageRoot, 'src', 'integrations', 'grok', 'hooks', base),
19
+ ];
20
+ return candidates.find((file) => existsSync(file)) || '';
21
+ }
22
+
23
+ function allow() {
24
+ process.stdout.write('{"decision":"allow"}\n');
25
+ process.exit(0);
26
+ }
27
+
28
+ async function main() {
29
+ const name = process.argv[2];
30
+ const hit = resolveGrokHook(root, name);
31
+ if (!hit) allow();
32
+ const extra = process.argv.slice(3);
33
+ process.argv = [process.argv[0], hit, ...extra];
34
+ try {
35
+ await import(pathToFileURL(hit).href);
36
+ } catch {
37
+ allow();
38
+ }
39
+ }
40
+
41
+ function samePath(left, right) {
42
+ try {
43
+ return realpathSync(left) === realpathSync(right);
44
+ } catch {
45
+ return left === right;
46
+ }
47
+ }
48
+
49
+ const invoked = Boolean(process.argv[1]) && samePath(process.argv[1], fileURLToPath(import.meta.url));
50
+ if (invoked) await main();
@@ -213,6 +213,7 @@ class ConsumerReadinessCheck {
213
213
  async function runPathVerification() {
214
214
  const isConsumerEnv = process.cwd().includes('test-') ||
215
215
  process.cwd().includes('tmp') ||
216
+ fs.existsSync('node_modules/0xray') ||
216
217
  fs.existsSync('node_modules/xray');
217
218
 
218
219
  if (isConsumerEnv) {
@@ -14,10 +14,15 @@ import { fileURLToPath } from "url";
14
14
  const __filename = fileURLToPath(import.meta.url);
15
15
  const __dirname = path.dirname(__filename);
16
16
 
17
+ function isInstalledPackagePath(value) {
18
+ const normalized = String(value).replace(/\\/g, "/");
19
+ return normalized.includes("node_modules/0xray") || normalized.includes("node_modules/xray");
20
+ }
21
+
17
22
  class MCPFunctionalityTest {
18
23
  constructor() {
19
24
  this.results = { passed: [], failed: [] };
20
- this.isConsumerEnvironment = __dirname.includes("node_modules/xray");
25
+ this.isConsumerEnvironment = isInstalledPackagePath(__dirname);
21
26
  }
22
27
 
23
28
  async testMCPFunctionality() {
@@ -95,9 +100,9 @@ class MCPFunctionalityTest {
95
100
  // Determine environment: dev vs consumer vs CI
96
101
  // - Dev: running from project root with src/ directory
97
102
  // - CI: running from project root but building first (has dist/)
98
- // - Consumer: running from node_modules/xray/
103
+ // - Consumer: running from node_modules/0xray/ (legacy node_modules/xray/)
99
104
  const cwd = process.cwd();
100
- const isConsumerEnv = cwd.includes("node_modules/xray");
105
+ const isConsumerEnv = isInstalledPackagePath(cwd);
101
106
  const hasPackageJson = fs.existsSync(path.join(cwd, "package.json"));
102
107
  const hasDistDir = fs.existsSync(path.join(cwd, "dist"));
103
108
 
@@ -155,16 +160,16 @@ class MCPFunctionalityTest {
155
160
  if (serverPath) {
156
161
  // Handle various path formats:
157
162
  // - ./dist/mcps/xxx.js (local dev)
158
- // - node_modules/xray/dist/mcps/xxx.js (consumer)
163
+ // - node_modules/0xray/dist/mcps/xxx.js (consumer; legacy node_modules/xray/)
159
164
  // - dist/mcps/xxx.js (after stripping ./)
160
165
  let normalizedPath = serverPath.startsWith("./")
161
166
  ? serverPath.slice(2)
162
167
  : serverPath;
163
168
 
164
- // If path contains node_modules/xray/, extract just the relative part
165
- if (normalizedPath.includes("node_modules/xray/")) {
166
- normalizedPath = normalizedPath.replace("node_modules/xray/", "");
167
- }
169
+ normalizedPath = normalizedPath
170
+ .replace(/\\/g, "/")
171
+ .replace("node_modules/0xray/", "")
172
+ .replace("node_modules/xray/", "");
168
173
 
169
174
  // In CI/build environment, files are in cwd/dist/, not in node_modules
170
175
  // Try local paths first, then fall back to node_modules
@@ -249,7 +254,7 @@ class MCPFunctionalityTest {
249
254
  try {
250
255
  // Determine environment - reuse same logic
251
256
  const cwd = process.cwd();
252
- const isConsumerEnv = cwd.includes("node_modules/xray");
257
+ const isConsumerEnv = isInstalledPackagePath(cwd);
253
258
  const hasPackageJson = fs.existsSync(path.join(cwd, "package.json"));
254
259
  const isDevOrCi = hasPackageJson && !isConsumerEnv;
255
260
 
@@ -150,7 +150,6 @@ class BasicSecurityAuditor {
150
150
  /LightweightValidator\.ts$/,
151
151
  /codex-parser\.ts$/,
152
152
  /openclaw/,
153
- /advanced-features/,
154
153
  /tests\//,
155
154
  /global-processor-mocks/,
156
155
  ];