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
@@ -1,7 +0,0 @@
1
- /**
2
- * Kernel Pipeline Activation Script
3
- *
4
- * Triggers real delegations that should activate kernel patterns.
5
- * Observes the full pipeline in action.
6
- */
7
- export {};
@@ -1,101 +0,0 @@
1
- /**
2
- * Kernel Pipeline Activation Script
3
- *
4
- * Triggers real delegations that should activate kernel patterns.
5
- * Observes the full pipeline in action.
6
- */
7
- import { AgentDelegator } from '../delegation/agent-delegator.js';
8
- import { XrayStateManager } from '../state/state-manager.js';
9
- import { xrayConfigLoader } from '../core/config-loader.js';
10
- import { routingOutcomeTracker } from '../delegation/analytics/outcome-tracker.js';
11
- import { patternPerformanceTracker } from '../analytics/pattern-performance-tracker.js';
12
- const stateManager = new XrayStateManager();
13
- const delegator = new AgentDelegator(stateManager, xrayConfigLoader);
14
- console.log('=== KERNEL PIPELINE ACTIVATION TEST ===\n');
15
- // Test cases designed to trigger kernel patterns
16
- const testCases = [
17
- {
18
- operation: 'security',
19
- description: 'Add new API endpoint with user authentication but skip input validation for SQL injection prevention',
20
- expected: ['P6', 'A8']
21
- },
22
- {
23
- operation: 'fix',
24
- description: 'Fix infinite recursion in the calculateTotals function - it keeps calling itself',
25
- expected: ['P1']
26
- },
27
- {
28
- operation: 'test',
29
- description: 'All tests pass on my machine but fail in CI - I think its an environment issue',
30
- expected: ['A1', 'A9']
31
- },
32
- {
33
- operation: 'deploy',
34
- description: 'Run the deployment script but getting permission denied on execution',
35
- expected: ['P8']
36
- },
37
- {
38
- operation: 'update',
39
- description: 'Upgrade all dependencies to latest version at once - we need everything current',
40
- expected: ['P5']
41
- },
42
- {
43
- operation: 'refactor',
44
- description: 'The tests all pass but we still have bugs in production - I do not understand why',
45
- expected: ['A2', 'A3']
46
- },
47
- {
48
- operation: 'create',
49
- description: 'Skip security for internal API - its only used internally so authentication is optional',
50
- expected: ['A8']
51
- },
52
- {
53
- operation: 'optimize',
54
- description: 'Make the code 80% faster - use aggressive caching everywhere',
55
- expected: ['A7']
56
- },
57
- ];
58
- let kernelEvents = 0;
59
- let learningEvents = 0;
60
- async function runTest(testCase) {
61
- console.log(`\n--- Testing: ${testCase.operation} ---`);
62
- console.log(`Description: ${testCase.description}`);
63
- console.log(`Expected patterns: ${testCase.expected.join(', ')}`);
64
- try {
65
- const result = await delegator.analyzeDelegation({
66
- operation: testCase.operation,
67
- description: testCase.description,
68
- sessionId: 'kernel-activation-test',
69
- });
70
- console.log(`Selected agents:`);
71
- result.agentDetails.forEach(agent => {
72
- console.log(` - ${agent.name}: ${agent.role} (confidence: ${agent.confidence})`);
73
- });
74
- kernelEvents++;
75
- // Check outcomes tracked
76
- const outcomes = routingOutcomeTracker.getOutcomes();
77
- console.log(`Total outcomes tracked: ${outcomes.length}`);
78
- learningEvents++;
79
- }
80
- catch (error) {
81
- console.log(`Error: ${error instanceof Error ? error.message : String(error)}`);
82
- }
83
- }
84
- async function main() {
85
- console.log('Initial state:');
86
- console.log(` Outcomes: ${routingOutcomeTracker.getOutcomes().length}`);
87
- for (const testCase of testCases) {
88
- await runTest(testCase);
89
- await new Promise(r => setTimeout(r, 100));
90
- }
91
- console.log('\n=== FINAL STATE ===');
92
- console.log(`Delegations performed: ${kernelEvents}`);
93
- console.log(`Learning events: ${learningEvents}`);
94
- console.log(`Total outcomes: ${routingOutcomeTracker.getOutcomes().length}`);
95
- // Check pattern metrics
96
- const patternMetrics = patternPerformanceTracker.getMetrics?.() || {};
97
- console.log(`Pattern types tracked: ${Object.keys(patternMetrics).length}`);
98
- console.log('\n=== CHECKING ACTIVITY LOG ===');
99
- // Log should show kernel-pattern-applied events
100
- }
101
- main().catch(console.error);
@@ -1,199 +0,0 @@
1
- /**
2
- * 0xRay Framework - AI Prompt Security Validator
3
- *
4
- * Specialized security validation for AI agent prompts and responses
5
- * Prevents prompt injection, system prompt override, and malicious inputs
6
- */
7
-
8
- export interface PromptSecurityConfig {
9
- enabled: boolean;
10
- maxPromptLength: number;
11
- allowedPatterns: RegExp[];
12
- blockedPatterns: RegExp[];
13
- sanitizeLevel: "basic" | "strict" | "paranoid";
14
- }
15
-
16
- export interface SecurityValidationResult {
17
- isSafe: boolean;
18
- violations: string[];
19
- sanitizedPrompt?: string | undefined;
20
- riskLevel: "low" | "medium" | "high" | "critical";
21
- }
22
-
23
- export class PromptSecurityValidator {
24
- private config: PromptSecurityConfig;
25
-
26
- constructor(config: Partial<PromptSecurityConfig> = {}) {
27
- this.config = {
28
- enabled: true,
29
- maxPromptLength: 10000,
30
- allowedPatterns: [],
31
- blockedPatterns: [
32
- /system\s+prompt\s*[:=]/gi,
33
- /ignore\s+previous\s+instructions/gi,
34
- /you\s+are\s+now\s+/gi,
35
- /forget\s+your\s+previous\s+/gi,
36
- /override\s+(your\s+)?instructions/gi,
37
- /jailbreak/gi,
38
- /dan.*mode/gi,
39
- ],
40
- sanitizeLevel: "strict",
41
- ...config,
42
- };
43
- }
44
-
45
- /**
46
- * Validate AI prompt for security issues
47
- */
48
- validatePrompt(prompt: string): SecurityValidationResult {
49
- if (!this.config.enabled) {
50
- return { isSafe: true, violations: [], riskLevel: "low" };
51
- }
52
-
53
- const violations: string[] = [];
54
- let riskLevel: SecurityValidationResult["riskLevel"] = "low";
55
-
56
- // Length check
57
- if (prompt.length > this.config.maxPromptLength) {
58
- violations.push(
59
- `Prompt too long: ${prompt.length} > ${this.config.maxPromptLength}`,
60
- );
61
- riskLevel = "medium";
62
- }
63
-
64
- // Blocked pattern check
65
- for (const pattern of this.config.blockedPatterns) {
66
- if (pattern.test(prompt)) {
67
- violations.push(`Blocked pattern detected: ${pattern.source}`);
68
- riskLevel = "high";
69
- }
70
- }
71
-
72
- // Advanced pattern analysis
73
- if (this.containsSystemPromptOverride(prompt)) {
74
- violations.push("Potential system prompt override attempt");
75
- riskLevel = "critical";
76
- }
77
-
78
- if (this.containsInjectionAttempts(prompt)) {
79
- violations.push("Potential prompt injection detected");
80
- riskLevel = "high";
81
- }
82
-
83
- const isSafe = violations.length === 0;
84
- const sanitizedPrompt = isSafe ? undefined : this.sanitizePrompt(prompt);
85
-
86
- return {
87
- isSafe,
88
- violations,
89
- sanitizedPrompt,
90
- riskLevel,
91
- };
92
- }
93
-
94
- /**
95
- * Check for system prompt override attempts
96
- */
97
- private containsSystemPromptOverride(prompt: string): boolean {
98
- const overrideIndicators = [
99
- "you are now",
100
- "act as if",
101
- "pretend to be",
102
- "role-play as",
103
- "from now on you are",
104
- "ignore your system",
105
- "override your",
106
- "new personality",
107
- "different role",
108
- ];
109
-
110
- const lowerPrompt = prompt.toLowerCase();
111
- return overrideIndicators.some((indicator) =>
112
- lowerPrompt.includes(indicator),
113
- );
114
- }
115
-
116
- /**
117
- * Check for prompt injection attempts
118
- */
119
- private containsInjectionAttempts(prompt: string): boolean {
120
- const injectionIndicators = [
121
- "ignore previous",
122
- "forget instructions",
123
- "start over",
124
- "new conversation",
125
- "reset context",
126
- "clear memory",
127
- "delete history",
128
- ];
129
-
130
- const lowerPrompt = prompt.toLowerCase();
131
- return injectionIndicators.some((indicator) =>
132
- lowerPrompt.includes(indicator),
133
- );
134
- }
135
-
136
- /**
137
- * Sanitize prompt by removing dangerous patterns
138
- */
139
- private sanitizePrompt(prompt: string): string {
140
- let sanitized = prompt;
141
-
142
- // Remove blocked patterns
143
- for (const pattern of this.config.blockedPatterns) {
144
- sanitized = sanitized.replace(pattern, "[REDACTED]");
145
- }
146
-
147
- // Additional sanitization based on level
148
- if (
149
- this.config.sanitizeLevel === "strict" ||
150
- this.config.sanitizeLevel === "paranoid"
151
- ) {
152
- // Remove potential code execution
153
- sanitized = sanitized.replace(/```[\s\S]*?```/g, "[CODE_BLOCK_REMOVED]");
154
-
155
- // Remove potential file system access
156
- sanitized = sanitized.replace(/(?:\/|\\)\.\.(?:\/|\\)/g, "/");
157
-
158
- // Remove potential command injection
159
- sanitized = sanitized.replace(/[;&|`$()]/g, "");
160
- }
161
-
162
- if (this.config.sanitizeLevel === "paranoid") {
163
- // Extreme sanitization - only allow alphanumeric, spaces, and basic punctuation
164
- sanitized = sanitized.replace(/[^a-zA-Z0-9\s.,!?-]/g, "");
165
- }
166
-
167
- return sanitized;
168
- }
169
-
170
- /**
171
- * Validate agent response for safety
172
- */
173
- validateResponse(response: string): SecurityValidationResult {
174
- // Similar validation but focused on response safety
175
- const violations: string[] = [];
176
-
177
- // Check for potentially harmful content
178
- if (
179
- response.includes("system prompt") ||
180
- response.includes("internal instructions")
181
- ) {
182
- violations.push("Response contains sensitive system information");
183
- }
184
-
185
- // Check for code execution attempts
186
- if (/eval\s*\(|Function\s*\(/.test(response)) {
187
- violations.push("Response contains potential code execution");
188
- }
189
-
190
- return {
191
- isSafe: violations.length === 0,
192
- violations,
193
- riskLevel: violations.length > 0 ? "medium" : "low",
194
- };
195
- }
196
- }
197
-
198
- // Export singleton instance
199
- export const promptSecurityValidator = new PromptSecurityValidator();