0xray 4.0.20 → 4.0.22

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 (74) hide show
  1. package/.grok-plugin/plugin.json +1 -1
  2. package/.opencode/skills/hermes-agent/SKILL.md +1 -1
  3. package/.opencode/skills/orchestrator/SKILL.md +23 -1
  4. package/.xray/features.json +1 -1
  5. package/AGENTS-consumer.md +15 -15
  6. package/AGENTS.md +12 -12
  7. package/README.md +40 -40
  8. package/SKILLS.md +4 -4
  9. package/dist/AGENTS.md +12 -12
  10. package/dist/CHANGELOG.md +91 -8
  11. package/dist/README.md +40 -40
  12. package/dist/SKILLS.md +4 -4
  13. package/dist/cli/commands/validate.d.ts +1 -1
  14. package/dist/cli/commands/validate.js +7 -1
  15. package/dist/governance/governance-core.d.ts +2 -1
  16. package/dist/governance/governance-core.js +20 -11
  17. package/dist/governance/governance-service.js +9 -7
  18. package/dist/inference/inference-cycle.js +22 -5
  19. package/dist/integrations/cursor/README.md +7 -6
  20. package/dist/integrations/cursor/hooks/after-file-edit.sh +3 -0
  21. package/dist/integrations/cursor/hooks/before-read-file.sh +3 -0
  22. package/dist/integrations/cursor/hooks/before-shell-execution.sh +3 -0
  23. package/dist/integrations/cursor/hooks/cursor-hook-utils.js +112 -12
  24. package/dist/integrations/cursor/hooks/cursor-usage-receipt.js +3 -0
  25. package/dist/integrations/cursor/hooks/hooks.json +13 -3
  26. package/dist/integrations/cursor/hooks/pre-compact.js +9 -0
  27. package/dist/integrations/cursor/hooks/pre-compact.sh +3 -0
  28. package/dist/integrations/cursor/hooks/pre-tool-use.js +17 -12
  29. package/dist/integrations/cursor/hooks/pre-tool-use.sh +3 -0
  30. package/dist/integrations/cursor/hooks/xray-cloud-hook.sh +63 -0
  31. package/dist/integrations/grok/hooks/grok-hook-utils.js +3 -2
  32. package/dist/integrations/hooks/station-hook-runtime.cjs +310 -98
  33. package/dist/integrations/hooks/station-hook-runtime.mjs +10 -0
  34. package/dist/integrations/hooks/station-memory-ingest.mjs +4 -3
  35. package/dist/integrations/openclaw/plugin/xray-pre-tool/package.json +1 -1
  36. package/dist/memory-routing/provider-loader.d.ts +3 -1
  37. package/dist/memory-routing/provider-loader.js +3 -1
  38. package/dist/nucleus/suit-temperament.d.ts +0 -5
  39. package/dist/nucleus/suit-temperament.js +13 -1
  40. package/dist/nucleus/thin-dispatch.js +11 -2
  41. package/dist/processors/implementations/agents-md-validation-processor.js +1 -1
  42. package/dist/skills/hermes-agent/SKILL.md +1 -1
  43. package/dist/skills/orchestrator/SKILL.md +23 -1
  44. package/llms.txt +1 -1
  45. package/package.json +3 -3
  46. package/scripts/foundry/CHANGELOG.md +2 -0
  47. package/scripts/foundry/README.md +4 -4
  48. package/scripts/foundry/assert-packed-dist-cli.mjs +4 -0
  49. package/scripts/foundry/cli.mjs +1 -1
  50. package/scripts/foundry/inspect.mjs +160 -5
  51. package/scripts/foundry/plant/skills/inspect/SKILL.md +2 -0
  52. package/scripts/foundry/plant/skills/mill/SKILL.md +1 -1
  53. package/scripts/foundry/validate-release-docs.mjs +48 -0
  54. package/scripts/foundry/version-manager.mjs +127 -7
  55. package/scripts/mjs/test-consumer-readiness.mjs +10 -3
  56. package/scripts/node/install-bridges.cjs +256 -10
  57. package/src/integrations/openclaw/plugin/xray-pre-tool/package.json +1 -1
  58. package/src/skills/hermes-agent/SKILL.md +1 -1
  59. package/src/skills/orchestrator/SKILL.md +23 -1
  60. package/vendor/@0xray/repertoire/data/stack-overlay.json +154 -1
  61. package/vendor/@0xray/repertoire/dist/RepertoireService.js +7 -6
  62. package/vendor/@0xray/repertoire/dist/ingestion/xray-session-ingester.js +10 -11
  63. package/vendor/@0xray/repertoire/dist/paths.js +66 -4
  64. package/vendor/@0xray/repertoire/dist/registry/CuratedSignalsManager.js +54 -14
  65. package/xray/agents_template.md +10 -5
  66. package/xray/features.json +1 -1
  67. package/dist/mcps/shared/prompt-security-validator.d.ts +0 -44
  68. package/dist/mcps/shared/prompt-security-validator.js +0 -148
  69. package/dist/mcps/shared/security-scanner.d.ts +0 -119
  70. package/dist/mcps/shared/security-scanner.js +0 -429
  71. package/dist/scripts/activate-kernel-pipeline.d.ts +0 -7
  72. package/dist/scripts/activate-kernel-pipeline.js +0 -101
  73. package/src/mcps/shared/prompt-security-validator.ts +0 -199
  74. package/src/mcps/shared/security-scanner.ts +0 -599
@@ -3,17 +3,27 @@
3
3
  "hooks": {
4
4
  "preToolUse": [
5
5
  {
6
- "command": "XRAY_AI_PATH=\"${XRAY_AI_PATH:-node_modules/0xray}\" node \"${XRAY_AI_PATH:-node_modules/0xray}/dist/integrations/cursor/hooks/pre-tool-use.js\""
6
+ "command": ".cursor/hooks/pre-tool-use.sh"
7
7
  }
8
8
  ],
9
9
  "preCompact": [
10
10
  {
11
- "command": "XRAY_AI_PATH=\"${XRAY_AI_PATH:-node_modules/0xray}\" node \"${XRAY_AI_PATH:-node_modules/0xray}/dist/integrations/cursor/hooks/pre-compact.js\""
11
+ "command": ".cursor/hooks/pre-compact.sh"
12
12
  }
13
13
  ],
14
14
  "afterFileEdit": [
15
15
  {
16
- "command": "XRAY_AI_PATH=\"${XRAY_AI_PATH:-node_modules/0xray}\" node \"${XRAY_AI_PATH:-node_modules/0xray}/dist/integrations/cursor/hooks/after-file-edit.js\""
16
+ "command": ".cursor/hooks/after-file-edit.sh"
17
+ }
18
+ ],
19
+ "beforeShellExecution": [
20
+ {
21
+ "command": ".cursor/hooks/before-shell-execution.sh"
22
+ }
23
+ ],
24
+ "beforeReadFile": [
25
+ {
26
+ "command": ".cursor/hooks/before-read-file.sh"
17
27
  }
18
28
  ]
19
29
  }
@@ -9,6 +9,7 @@ import {
9
9
  appendHookActivity,
10
10
  buildSessionBootPayload,
11
11
  classifyPreCompactEvent,
12
+ cursorGenerationId,
12
13
  cursorHeatRoots,
13
14
  cursorSessionId,
14
15
  cursorWorkspaceRoot,
@@ -40,6 +41,7 @@ async function main() {
40
41
  eventClass = classifyPreCompactEvent(event);
41
42
  const eventRoot = cursorWorkspaceRoot(event);
42
43
  const sessionId = cursorSessionId(event);
44
+ const generationId = cursorGenerationId(event);
43
45
  const intent = extractIntent(event);
44
46
  let bootPath = null;
45
47
  let receiptPath = null;
@@ -60,6 +62,13 @@ async function main() {
60
62
  hookEvent: 'pre_compact',
61
63
  trigger: event.trigger || 'synthetic',
62
64
  sessionId,
65
+ conversation_id: sessionId,
66
+ generation_id: generationId,
67
+ is_first_compaction:
68
+ typeof event.is_first_compaction === 'boolean' ? event.is_first_compaction : null,
69
+ message_count: typeof event.message_count === 'number' ? event.message_count : null,
70
+ messages_to_compact:
71
+ typeof event.messages_to_compact === 'number' ? event.messages_to_compact : null,
63
72
  bootPath,
64
73
  timestamp: new Date().toISOString(),
65
74
  });
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+ HERE="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
3
+ exec /bin/sh "${HERE}/xray-cloud-hook.sh" preCompact pre-compact.js
@@ -9,6 +9,7 @@ import {
9
9
  appendHookActivity,
10
10
  checkCodexPatterns,
11
11
  checkFullTestSuite,
12
+ cursorGateRoot,
12
13
  cursorHeatRoots,
13
14
  cursorSessionId,
14
15
  cursorToolContext,
@@ -49,56 +50,60 @@ async function main() {
49
50
  const event = await readStdinJson();
50
51
  const eventRoot = cursorWorkspaceRoot(event);
51
52
  const sessionId = cursorSessionId(event);
52
- for (const root of cursorHeatRoots(event)) {
53
+ const heatRoots = cursorHeatRoots(event);
54
+ for (const root of heatRoots) {
53
55
  ensureCursorSessionBoot(root, '0xray/cursor-pre-tool-use-boot', { sessionId });
54
56
  }
57
+ const gateRoot = cursorGateRoot(heatRoots, eventRoot);
55
58
 
56
- const features = loadFeatures(eventRoot);
57
- const gateFeatures = loadDelegationGateFeatures(eventRoot, 'cursor');
59
+ const features = loadFeatures(gateRoot);
60
+ const gateFeatures = loadDelegationGateFeatures(gateRoot, 'cursor');
58
61
  const ctx = cursorToolContext(event);
59
62
  toolName = ctx.toolName;
60
63
  const { content, cmd, toolInput } = ctx;
61
64
 
62
65
  const gateBlock = evaluatePreToolGate(toolName, toolInput, {
63
- projectRoot: eventRoot,
66
+ projectRoot: gateRoot,
64
67
  sessionId,
65
68
  features: gateFeatures,
66
69
  host: 'cursor',
67
70
  });
68
71
  if (!gateBlock.allow) {
69
- finish(eventRoot, 'deny', gateBlock.reason, gateBlock.hint, toolName, { gate: gateBlock.gate });
72
+ finish(gateRoot, 'deny', gateBlock.reason, gateBlock.hint, toolName, { gate: gateBlock.gate });
70
73
  }
71
74
 
72
75
  if (isWriteTool(toolName) && content) {
73
76
  const extraBlock = checkCodexPatterns(content, { terms: [11, 29] });
74
- if (extraBlock) finish(eventRoot, 'deny', extraBlock, null, toolName);
77
+ if (extraBlock) finish(gateRoot, 'deny', extraBlock, null, toolName);
75
78
  }
76
79
 
77
80
  if (isShellTool(toolName) && cmd) {
78
81
  const testHint = checkFullTestSuite(cmd, features);
79
- if (testHint) finish(eventRoot, 'allow', null, testHint, toolName);
82
+ if (testHint) finish(gateRoot, 'allow', null, testHint, toolName);
80
83
  }
81
84
 
82
85
  if (gateBlock.reason) {
83
- finish(eventRoot, 'allow', gateBlock.reason, gateBlock.hint, toolName, {
86
+ finish(gateRoot, 'allow', gateBlock.reason, gateBlock.hint, toolName, {
84
87
  gate: gateBlock.gate,
85
88
  warn: true,
86
89
  });
87
90
  }
88
91
 
89
- finish(eventRoot, 'allow', null, null, toolName);
92
+ finish(gateRoot, 'allow', null, null, toolName);
90
93
  } catch (err) {
91
94
  appendHookActivity(fallbackRoot, 'cursor-pre-tool-use', 'hook-error', 'error', {
92
95
  tool: toolName,
93
96
  error: err.message,
97
+ failOpen: true,
94
98
  });
99
+ // Dest EACCES on a Cloud workspace wrapper must not deny every tool.
95
100
  finish(
96
101
  fallbackRoot,
97
- 'deny',
98
- `preToolUse hook error — blocked for safety: ${err.message}`,
102
+ 'allow',
103
+ `preToolUse hook error — fail open: ${err.message}`,
99
104
  null,
100
105
  toolName,
101
- { gate: 'hook-error' },
106
+ { gate: 'hook-error-fail-open' },
102
107
  );
103
108
  }
104
109
  }
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+ HERE="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
3
+ exec /bin/sh "${HERE}/xray-cloud-hook.sh" preToolUse pre-tool-use.js
@@ -0,0 +1,63 @@
1
+ #!/bin/sh
2
+ # Cloud-safe Cursor hook runner. Command in hooks.json must be a relative path.
3
+ # Do not put env-assignment in hooks.json — Cloud execs argv[0] without a shell.
4
+ set -eu
5
+
6
+ EVENT="${1:-preToolUse}"
7
+ JS="${2:-pre-tool-use.js}"
8
+ MILL=""
9
+ REL=""
10
+
11
+ pick_mill() {
12
+ mill="$1"
13
+ rel="$2"
14
+ if [ -f "${mill}/${rel}" ]; then
15
+ MILL="$mill"
16
+ REL="$rel"
17
+ return 0
18
+ fi
19
+ return 1
20
+ }
21
+
22
+ if [ -n "${XRAY_AI_PATH:-}" ]; then
23
+ pick_mill "${XRAY_AI_PATH}" "src/integrations/cursor/hooks/${JS}" || \
24
+ pick_mill "${XRAY_AI_PATH}" "dist/integrations/cursor/hooks/${JS}" || true
25
+ fi
26
+ if [ -z "$MILL" ]; then
27
+ pick_mill "$(pwd)" "src/integrations/cursor/hooks/${JS}" || \
28
+ pick_mill "$(pwd)/../xray" "src/integrations/cursor/hooks/${JS}" || \
29
+ pick_mill "$(pwd)/repos/xray" "src/integrations/cursor/hooks/${JS}" || \
30
+ pick_mill "${CURSOR_PROJECT_DIR:-}/repos/xray" "src/integrations/cursor/hooks/${JS}" || \
31
+ pick_mill "$(pwd)/node_modules/0xray" "dist/integrations/cursor/hooks/${JS}" || \
32
+ pick_mill "$(pwd)/node_modules/0xray" "src/integrations/cursor/hooks/${JS}" || true
33
+ fi
34
+
35
+ if [ -n "$MILL" ] && [ -d "$MILL" ]; then
36
+ MILL="$(cd "$MILL" && pwd)"
37
+ fi
38
+
39
+ NODE_BIN="$(command -v node 2>/dev/null || true)"
40
+
41
+ log_invoke() {
42
+ dest="$1"
43
+ mkdir -p "${dest}/.xray/state" 2>/dev/null || true
44
+ {
45
+ printf 'ts=%s event=%s cwd=%s mill=%s node=%s\n' \
46
+ "$(date -Iseconds)" "$EVENT" "$(pwd)" "${MILL:-MISSING}" "${NODE_BIN:-MISSING}"
47
+ } >> "${dest}/.xray/state/cursor-hook-invoke.log" 2>/dev/null || true
48
+ }
49
+
50
+ log_invoke "$(pwd)"
51
+ if [ -n "$MILL" ]; then
52
+ log_invoke "$MILL"
53
+ fi
54
+
55
+ if [ -z "$NODE_BIN" ] || [ -z "$MILL" ] || [ ! -f "${MILL}/${REL}" ]; then
56
+ printf '{"permission":"allow","user_message":"xray-cloud-hook: mill missing — fail open"}\n'
57
+ exit 0
58
+ fi
59
+
60
+ export XRAY_HOOK_EVENT="$EVENT"
61
+ export XRAY_AI_PATH="$MILL"
62
+ export XRAY_ROOT="$MILL"
63
+ exec "$NODE_BIN" "${MILL}/${REL}"
@@ -25,6 +25,7 @@ import {
25
25
  applyStationHeat,
26
26
  buildRepertoireResume as stationRepertoireResume,
27
27
  readExistingBoot,
28
+ retainCompactFields,
28
29
  writeStationMarkdown,
29
30
  } from '../../hooks/station-hook-runtime.mjs';
30
31
 
@@ -285,8 +286,8 @@ export function buildSessionBootPayload(root, source = '0xray/grok-session-start
285
286
  const frontier = gateFeatures.ceremony === 'lite';
286
287
  const existing = readExistingBoot(root);
287
288
  const heat = applyStationHeat(root, extra.host || 'grok', extra, existing);
289
+ const compactHold = retainCompactFields(existing, extra);
288
290
  return {
289
- hook: source,
290
291
  lead_dev_mode: features.lead_dev_mode,
291
292
  no_new_surface: features.no_new_surface,
292
293
  host: extra.host || 'grok',
@@ -306,9 +307,9 @@ export function buildSessionBootPayload(root, source = '0xray/grok-session-start
306
307
  ...(conferPending ? { conferPending: true, conferTrigger: 'analyze-complexity at synthesis checkpoint' } : {}),
307
308
  ...(userAsideBoot ?? {}),
308
309
  sessionId,
309
- source,
310
310
  ...extra,
311
311
  ...heat,
312
+ ...compactHold,
312
313
  hook: source,
313
314
  source,
314
315
  timestamp: new Date().toISOString(),