0xray 4.0.33 → 4.0.35

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 (156) 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 +25 -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/hooks/goggles-pipeline.mjs +108 -22
  19. package/dist/integrations/hooks/goggles-planes.json +23 -0
  20. package/dist/integrations/hooks/host-truth.mjs +74 -0
  21. package/dist/integrations/hooks/station-hook-runtime.cjs +3 -0
  22. package/dist/integrations/openclaw/plugin/xray-pre-tool/package.json +1 -1
  23. package/dist/mcps/knowledge-skills/storyteller.server.js +0 -1
  24. package/dist/nucleus/delegation-gate.d.ts +2 -2
  25. package/dist/nucleus/delegation-gate.js +13 -2
  26. package/dist/nucleus/work-freshness.mjs +189 -0
  27. package/dist/processors/implementations/agents-md-validation-processor.js +1 -1
  28. package/docs-site/docs/plates/boot.md +17 -2
  29. package/docs-site/docs/plates/governance.md +3 -2
  30. package/docs-site/docs/plates/index.md +3 -1
  31. package/docs-site/docs/plates/memory-recall.md +26 -35
  32. package/docs-site/docs/plates/orchestration.md +39 -35
  33. package/docs-site/docs/plates/processor.md +34 -36
  34. package/docs-site/docs/plates/reporting.md +3 -8
  35. package/docs-site/docs/plates/routing.md +22 -11
  36. package/package.json +2 -2
  37. package/scripts/foundry/release.mjs +48 -5
  38. package/scripts/mjs/test-consumer-readiness.mjs +1 -0
  39. package/scripts/mjs/test-mcp-functionality.mjs +14 -9
  40. package/scripts/node/basic-security-audit.cjs +0 -1
  41. package/scripts/node/bridge-mcp-wiring.cjs +66 -3
  42. package/scripts/node/postinstall.cjs +1 -1
  43. package/scripts/node/prepare-consumer.cjs +11 -7
  44. package/scripts/node/setup-dev.cjs +18 -26
  45. package/scripts/node/validate-mcp-connectivity.js +2 -1
  46. package/src/integrations/openclaw/plugin/xray-pre-tool/package.json +1 -1
  47. package/src/mcps/knowledge-skills/storyteller.server.ts +0 -1
  48. package/xray/agents_template.md +5 -5
  49. package/xray/codex.json +12 -4
  50. package/xray/features.json +1 -1
  51. package/dist/agents/known-names.d.ts +0 -26
  52. package/dist/agents/known-names.js +0 -72
  53. package/dist/analytics/consent-manager.d.ts +0 -92
  54. package/dist/analytics/consent-manager.js +0 -257
  55. package/dist/benchmark/performance-benchmark.d.ts +0 -103
  56. package/dist/benchmark/performance-benchmark.js +0 -373
  57. package/dist/cli/commands/analytics-disable.d.ts +0 -9
  58. package/dist/cli/commands/analytics-disable.js +0 -72
  59. package/dist/cli/commands/analytics-enable-action.d.ts +0 -8
  60. package/dist/cli/commands/analytics-enable-action.js +0 -82
  61. package/dist/cli/commands/analytics-preview.d.ts +0 -9
  62. package/dist/cli/commands/analytics-preview.js +0 -106
  63. package/dist/cli/commands/analytics-status.d.ts +0 -9
  64. package/dist/cli/commands/analytics-status.js +0 -68
  65. package/dist/cli/commands/enforce.d.ts +0 -12
  66. package/dist/cli/commands/enforce.js +0 -78
  67. package/dist/cli/commands/govern.d.ts +0 -29
  68. package/dist/cli/commands/govern.js +0 -149
  69. package/dist/cli/commands/security-audit.d.ts +0 -23
  70. package/dist/cli/commands/security-audit.js +0 -219
  71. package/dist/cli/server.d.ts +0 -1
  72. package/dist/cli/server.js +0 -147
  73. package/dist/config/routing-mappings.d.ts +0 -26
  74. package/dist/config/routing-mappings.js +0 -151
  75. package/dist/core/bridge.mjs +0 -922
  76. package/dist/core/trace-context.d.ts +0 -12
  77. package/dist/core/trace-context.js +0 -33
  78. package/dist/enforcement/index.d.ts +0 -22
  79. package/dist/enforcement/index.js +0 -40
  80. package/dist/enforcement/loaders/index.d.ts +0 -36
  81. package/dist/enforcement/loaders/index.js +0 -39
  82. package/dist/enforcement/test-auto-healing.d.ts +0 -83
  83. package/dist/enforcement/test-auto-healing.js +0 -325
  84. package/dist/inference/index.d.ts +0 -10
  85. package/dist/inference/index.js +0 -5
  86. package/dist/infrastructure/iac-validator.d.ts +0 -150
  87. package/dist/infrastructure/iac-validator.js +0 -465
  88. package/dist/infrastructure/schemas/cloud-schemas.d.ts +0 -482
  89. package/dist/infrastructure/schemas/cloud-schemas.js +0 -488
  90. package/dist/integrations/base/ExampleIntegration.d.ts +0 -46
  91. package/dist/integrations/base/ExampleIntegration.js +0 -180
  92. package/dist/integrations/enforcement-gate.d.ts +0 -44
  93. package/dist/integrations/enforcement-gate.js +0 -348
  94. package/dist/mcps/connection/connection-manager.d.ts +0 -39
  95. package/dist/mcps/connection/connection-manager.js +0 -79
  96. package/dist/mcps/index.d.ts +0 -17
  97. package/dist/mcps/index.js +0 -65
  98. package/dist/mcps/orchestrator/index.d.ts +0 -6
  99. package/dist/mcps/orchestrator/index.js +0 -5
  100. package/dist/metrics/index.d.ts +0 -6
  101. package/dist/metrics/index.js +0 -6
  102. package/dist/orchestrator/self-direction-activation.d.ts +0 -108
  103. package/dist/orchestrator/self-direction-activation.js +0 -244
  104. package/dist/orchestrator/universal-registry-bridge.d.ts +0 -84
  105. package/dist/orchestrator/universal-registry-bridge.js +0 -246
  106. package/dist/performance/performance-budget-enforcer.d.ts +0 -157
  107. package/dist/performance/performance-budget-enforcer.js +0 -433
  108. package/dist/performance/performance-regression-tester.d.ts +0 -107
  109. package/dist/performance/performance-regression-tester.js +0 -341
  110. package/dist/postprocessor/analysis/CodeChangeAnalyzer.d.ts +0 -11
  111. package/dist/postprocessor/analysis/CodeChangeAnalyzer.js +0 -50
  112. package/dist/postprocessor/config/ProcessorConfigLoader.d.ts +0 -44
  113. package/dist/postprocessor/config/ProcessorConfigLoader.js +0 -16
  114. package/dist/postprocessor/integration.d.ts +0 -156
  115. package/dist/postprocessor/integration.js +0 -194
  116. package/dist/postprocessor/metamorphosis/index.d.ts +0 -2
  117. package/dist/postprocessor/metamorphosis/index.js +0 -1
  118. package/dist/postprocessor/redeploy/RetryHandler.d.ts +0 -49
  119. package/dist/postprocessor/redeploy/RetryHandler.js +0 -118
  120. package/dist/processors/implementations/session-capture-processor.d.ts +0 -14
  121. package/dist/processors/implementations/session-capture-processor.js +0 -37
  122. package/dist/public/XrayService.d.ts +0 -17
  123. package/dist/public/XrayService.js +0 -40
  124. package/dist/public/index.d.ts +0 -4
  125. package/dist/public/index.js +0 -2
  126. package/dist/security/comprehensive-security-audit.d.ts +0 -157
  127. package/dist/security/comprehensive-security-audit.js +0 -1004
  128. package/dist/security/index.d.ts +0 -13
  129. package/dist/security/index.js +0 -13
  130. package/dist/security/security-agent-coordinator.d.ts +0 -71
  131. package/dist/security/security-agent-coordinator.js +0 -203
  132. package/dist/security/security-hardening-system.d.ts +0 -238
  133. package/dist/security/security-hardening-system.js +0 -726
  134. package/dist/security/security-orchestration-layer.d.ts +0 -118
  135. package/dist/security/security-orchestration-layer.js +0 -495
  136. package/dist/testing/memory-regression-suite.d.ts +0 -105
  137. package/dist/testing/memory-regression-suite.js +0 -258
  138. package/dist/tools/assess-complexity-tool.d.ts +0 -28
  139. package/dist/tools/assess-complexity-tool.js +0 -44
  140. package/dist/tools/query-routing-tool.d.ts +0 -17
  141. package/dist/tools/query-routing-tool.js +0 -59
  142. package/dist/utils/batch-operations.d.ts +0 -25
  143. package/dist/utils/batch-operations.js +0 -292
  144. package/dist/utils/task-graph.d.ts +0 -29
  145. package/dist/utils/task-graph.js +0 -106
  146. package/dist/utils/test-template-generator.d.ts +0 -25
  147. package/dist/utils/test-template-generator.js +0 -178
  148. package/dist/utils/token-manager.d.ts +0 -48
  149. package/dist/utils/token-manager.js +0 -163
  150. package/dist/validation/agent-config-validator.d.ts +0 -110
  151. package/dist/validation/agent-config-validator.js +0 -280
  152. package/dist/validation/orchestration-flow-validator.d.ts +0 -87
  153. package/dist/validation/orchestration-flow-validator.js +0 -606
  154. package/src/mcps/connection/connection-manager.ts +0 -91
  155. package/src/mcps/index.ts +0 -80
  156. package/src/mcps/orchestrator/index.ts +0 -29
@@ -1,105 +0,0 @@
1
- import { EventEmitter } from "events";
2
- /**
3
- * Memory Regression Testing Suite
4
- * Automated testing for memory usage patterns and leak detection
5
- */
6
- export interface MemoryRegressionTest {
7
- name: string;
8
- description: string;
9
- setup?: (() => Promise<void> | void) | undefined;
10
- execute: () => Promise<any> | any;
11
- cleanup?: (() => Promise<void> | void) | undefined;
12
- expectedMemoryDelta: {
13
- maxIncrease: number;
14
- acceptableLeak: number;
15
- };
16
- }
17
- export interface MemoryRegressionResult {
18
- testName: string;
19
- passed: boolean;
20
- memoryDelta: number;
21
- leakRate: number;
22
- duration: number;
23
- error?: string;
24
- recommendations: string[];
25
- }
26
- export interface RegressionSuiteConfig {
27
- testTimeout: number;
28
- memorySamplingInterval: number;
29
- acceptableMemoryGrowth: number;
30
- leakDetectionThreshold: number;
31
- }
32
- export declare class MemoryRegressionTester extends EventEmitter {
33
- private config;
34
- private tests;
35
- constructor(config?: Partial<RegressionSuiteConfig>);
36
- /**
37
- * Add a regression test
38
- */
39
- addTest(test: MemoryRegressionTest): void;
40
- /**
41
- * Run all regression tests
42
- */
43
- runAllTests(): Promise<MemoryRegressionResult[]>;
44
- /**
45
- * Run a single regression test
46
- */
47
- private runTest;
48
- /**
49
- * Create a standard memory regression test
50
- */
51
- createStandardTest(name: string, description: string, testFunction: () => Promise<any> | any, options?: {
52
- maxMemoryIncrease?: number;
53
- acceptableLeakRate?: number;
54
- setup?: () => Promise<void> | void;
55
- cleanup?: () => Promise<void> | void;
56
- }): MemoryRegressionTest;
57
- /**
58
- * Generate test report
59
- */
60
- generateReport(results: MemoryRegressionResult[]): string;
61
- /**
62
- * Calculate variance of memory samples
63
- */
64
- private calculateVariance;
65
- }
66
- export declare const memoryTestTemplates: {
67
- sessionOperations: (sessionCount?: number) => {
68
- name: string;
69
- description: string;
70
- setup: () => Promise<void>;
71
- execute: () => Promise<{
72
- id: string;
73
- data: {
74
- userId: number;
75
- metadata: {
76
- created: number;
77
- active: boolean;
78
- };
79
- };
80
- }[]>;
81
- cleanup: () => Promise<void>;
82
- expectedMemoryDelta: {
83
- maxIncrease: number;
84
- acceptableLeak: number;
85
- };
86
- };
87
- cacheOperations: (cacheSize?: number) => {
88
- name: string;
89
- description: string;
90
- execute: () => Promise<number>;
91
- expectedMemoryDelta: {
92
- maxIncrease: number;
93
- acceptableLeak: number;
94
- };
95
- };
96
- streamingOperations: (messageCount?: number) => {
97
- name: string;
98
- description: string;
99
- execute: () => Promise<number>;
100
- expectedMemoryDelta: {
101
- maxIncrease: number;
102
- acceptableLeak: number;
103
- };
104
- };
105
- };
@@ -1,258 +0,0 @@
1
- import { EventEmitter } from "events";
2
- export class MemoryRegressionTester extends EventEmitter {
3
- config;
4
- tests = [];
5
- constructor(config = {}) {
6
- super();
7
- this.config = {
8
- testTimeout: 30000, // 30 seconds
9
- memorySamplingInterval: 1000, // 1 second
10
- acceptableMemoryGrowth: 10, // 10MB
11
- leakDetectionThreshold: 1, // 1MB per minute
12
- ...config,
13
- };
14
- }
15
- /**
16
- * Add a regression test
17
- */
18
- addTest(test) {
19
- this.tests.push(test);
20
- }
21
- /**
22
- * Run all regression tests
23
- */
24
- async runAllTests() {
25
- const results = [];
26
- for (const test of this.tests) {
27
- try {
28
- const result = await this.runTest(test);
29
- results.push(result);
30
- }
31
- catch (error) {
32
- results.push({
33
- testName: test.name,
34
- passed: false,
35
- memoryDelta: 0,
36
- leakRate: 0,
37
- duration: 0,
38
- error: error instanceof Error ? error.message : String(error),
39
- recommendations: [
40
- "Check test implementation",
41
- "Verify memory cleanup",
42
- ],
43
- });
44
- }
45
- }
46
- return results;
47
- }
48
- /**
49
- * Run a single regression test
50
- */
51
- async runTest(test) {
52
- const startTime = Date.now();
53
- try {
54
- // Setup
55
- if (test.setup) {
56
- await Promise.resolve(test.setup());
57
- }
58
- // Memory sampling during test
59
- const samples = [];
60
- const samplingInterval = setInterval(() => {
61
- const memUsage = process.memoryUsage();
62
- samples.push(memUsage.heapUsed);
63
- }, this.config.memorySamplingInterval);
64
- // Execute test with timeout
65
- const testPromise = test.execute();
66
- const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error("Test timeout")), this.config.testTimeout));
67
- await Promise.race([testPromise, timeoutPromise]);
68
- clearInterval(samplingInterval);
69
- // Calculate results
70
- const endTime = Date.now();
71
- const duration = endTime - startTime;
72
- if (samples.length === 0) {
73
- throw new Error("No memory samples collected");
74
- }
75
- const startMemory = samples[0];
76
- const endMemory = samples[samples.length - 1];
77
- const memoryDelta = (endMemory - startMemory) / 1024 / 1024; // MB
78
- // Calculate leak rate (MB per minute)
79
- const leakRate = duration > 0 ? memoryDelta / (duration / 1000 / 60) : 0;
80
- // Determine pass/fail
81
- const passed = Math.abs(memoryDelta) <= test.expectedMemoryDelta.maxIncrease &&
82
- Math.abs(leakRate) <= test.expectedMemoryDelta.acceptableLeak;
83
- // Generate recommendations
84
- const recommendations = [];
85
- if (memoryDelta > test.expectedMemoryDelta.maxIncrease) {
86
- recommendations.push(`Memory increased by ${memoryDelta.toFixed(2)}MB (expected ≤${test.expectedMemoryDelta.maxIncrease}MB)`);
87
- }
88
- if (leakRate > test.expectedMemoryDelta.acceptableLeak) {
89
- recommendations.push(`Memory leak rate: ${leakRate.toFixed(2)}MB/min (expected ≤${test.expectedMemoryDelta.acceptableLeak}MB/min)`);
90
- }
91
- if (samples.length > 10) {
92
- const variance = this.calculateVariance(samples);
93
- if (variance > 5 * 1024 * 1024) {
94
- // 5MB variance
95
- recommendations.push("High memory variance detected - consider stabilizing allocations");
96
- }
97
- }
98
- // Cleanup
99
- if (test.cleanup) {
100
- await Promise.resolve(test.cleanup());
101
- }
102
- return {
103
- testName: test.name,
104
- passed,
105
- memoryDelta,
106
- leakRate,
107
- duration,
108
- recommendations,
109
- };
110
- }
111
- catch (error) {
112
- // Cleanup on error
113
- if (test.cleanup) {
114
- try {
115
- await test.cleanup();
116
- }
117
- catch (cleanupError) {
118
- // Ignore cleanup errors
119
- }
120
- }
121
- throw error;
122
- }
123
- }
124
- /**
125
- * Create a standard memory regression test
126
- */
127
- createStandardTest(name, description, testFunction, options = {}) {
128
- return {
129
- name,
130
- description,
131
- setup: options.setup,
132
- execute: testFunction,
133
- cleanup: options.cleanup,
134
- expectedMemoryDelta: {
135
- maxIncrease: options.maxMemoryIncrease || this.config.acceptableMemoryGrowth,
136
- acceptableLeak: options.acceptableLeakRate || this.config.leakDetectionThreshold,
137
- },
138
- };
139
- }
140
- /**
141
- * Generate test report
142
- */
143
- generateReport(results) {
144
- const passed = results.filter((r) => r.passed).length;
145
- const failed = results.length - passed;
146
- let report = `# Memory Regression Test Report\n\n`;
147
- report += `**Summary:** ${passed}/${results.length} tests passed (${failed} failed)\n\n`;
148
- if (failed > 0) {
149
- report += `## Failed Tests\n\n`;
150
- results
151
- .filter((r) => !r.passed)
152
- .forEach((result) => {
153
- report += `### ${result.testName}\n`;
154
- report += `- Memory Delta: ${result.memoryDelta.toFixed(2)}MB\n`;
155
- report += `- Leak Rate: ${result.leakRate.toFixed(2)}MB/min\n`;
156
- report += `- Duration: ${result.duration}ms\n`;
157
- if (result.error) {
158
- report += `- Error: ${result.error}\n`;
159
- }
160
- if (result.recommendations.length > 0) {
161
- report += `- Recommendations:\n`;
162
- result.recommendations.forEach((rec) => {
163
- report += ` - ${rec}\n`;
164
- });
165
- }
166
- report += `\n`;
167
- });
168
- }
169
- report += `## Performance Metrics\n\n`;
170
- const avgDelta = results.reduce((sum, r) => sum + r.memoryDelta, 0) / results.length;
171
- const avgLeakRate = results.reduce((sum, r) => sum + r.leakRate, 0) / results.length;
172
- const totalDuration = results.reduce((sum, r) => sum + r.duration, 0);
173
- report += `- Average Memory Delta: ${avgDelta.toFixed(2)}MB\n`;
174
- report += `- Average Leak Rate: ${avgLeakRate.toFixed(2)}MB/min\n`;
175
- report += `- Total Test Duration: ${totalDuration}ms\n`;
176
- return report;
177
- }
178
- /**
179
- * Calculate variance of memory samples
180
- */
181
- calculateVariance(samples) {
182
- const mean = samples.reduce((sum, s) => sum + s, 0) / samples.length;
183
- const variance = samples.reduce((sum, s) => sum + Math.pow(s - mean, 2), 0) /
184
- samples.length;
185
- return variance;
186
- }
187
- }
188
- // Pre-configured test templates
189
- export const memoryTestTemplates = {
190
- sessionOperations: (sessionCount = 100) => ({
191
- name: "Session Operations Memory Test",
192
- description: `Test memory usage during ${sessionCount} session operations`,
193
- setup: async () => {
194
- // Setup would initialize session manager
195
- },
196
- execute: async () => {
197
- // Simulate session operations
198
- const operations = [];
199
- for (let i = 0; i < sessionCount; i++) {
200
- operations.push({
201
- id: `session-${i}`,
202
- data: { userId: i, metadata: { created: Date.now(), active: true } },
203
- });
204
- }
205
- return operations;
206
- },
207
- cleanup: async () => {
208
- // Cleanup sessions
209
- },
210
- expectedMemoryDelta: {
211
- maxIncrease: sessionCount * 0.01, // ~10KB per session
212
- acceptableLeak: 0.1, // 0.1MB per minute
213
- },
214
- }),
215
- cacheOperations: (cacheSize = 1000) => ({
216
- name: "Cache Operations Memory Test",
217
- description: `Test memory usage during ${cacheSize} cache operations`,
218
- execute: async () => {
219
- const cache = new Map();
220
- for (let i = 0; i < cacheSize; i++) {
221
- cache.set(`key-${i}`, {
222
- data: `value-${i}`.repeat(10), // ~100 bytes per entry
223
- timestamp: Date.now(),
224
- });
225
- }
226
- // Simulate cache operations
227
- for (let i = 0; i < cacheSize / 2; i++) {
228
- cache.get(`key-${i}`);
229
- }
230
- return cache.size;
231
- },
232
- expectedMemoryDelta: {
233
- maxIncrease: (cacheSize * 0.1) / 1024 / 1024, // ~100KB total
234
- acceptableLeak: 0.05, // 0.05MB per minute
235
- },
236
- }),
237
- streamingOperations: (messageCount = 1000) => ({
238
- name: "Streaming Operations Memory Test",
239
- description: `Test memory usage during ${messageCount} streaming operations`,
240
- execute: async () => {
241
- const messages = [];
242
- for (let i = 0; i < messageCount; i++) {
243
- messages.push({
244
- id: i,
245
- payload: Buffer.from(`message-${i}-`.repeat(50)), // ~500 bytes per message
246
- timestamp: Date.now(),
247
- });
248
- // Simulate processing delay
249
- await new Promise((resolve) => setTimeout(resolve, 1));
250
- }
251
- return messages.length;
252
- },
253
- expectedMemoryDelta: {
254
- maxIncrease: (messageCount * 0.5) / 1024 / 1024, // ~500KB total
255
- acceptableLeak: 0.2, // 0.2MB per minute
256
- },
257
- }),
258
- };
@@ -1,28 +0,0 @@
1
- /**
2
- * Assess Complexity Tool
3
- *
4
- * Wraps ComplexityAnalyzer so the main AI can query task complexity
5
- * and decide whether to delegate to subagents.
6
- *
7
- * Exposes:
8
- * - assessComplexity() — full analysis returning score, level, strategy, agents
9
- * - simple assess() helper for quick threshold checks
10
- */
11
- export interface AssessmentInput {
12
- taskDescription: string;
13
- files?: string[];
14
- dependencies?: string[];
15
- changeVolume?: number;
16
- riskLevel?: "low" | "medium" | "high" | "critical";
17
- estimatedDuration?: number;
18
- }
19
- export interface AssessmentResult {
20
- score: number;
21
- level: "simple" | "moderate" | "complex" | "enterprise";
22
- strategy: "single-agent" | "multi-agent" | "orchestrator-led";
23
- estimatedAgents: number;
24
- reasoning: string[];
25
- }
26
- export declare function assessComplexity(input: AssessmentInput): AssessmentResult;
27
- export declare function shouldDelegate(input: AssessmentInput): boolean;
28
- export declare function getDelegationStrategy(input: AssessmentInput): AssessmentResult;
@@ -1,44 +0,0 @@
1
- /**
2
- * Assess Complexity Tool
3
- *
4
- * Wraps ComplexityAnalyzer so the main AI can query task complexity
5
- * and decide whether to delegate to subagents.
6
- *
7
- * Exposes:
8
- * - assessComplexity() — full analysis returning score, level, strategy, agents
9
- * - simple assess() helper for quick threshold checks
10
- */
11
- import { getComplexityAnalyzer, } from "../delegation/complexity-analyzer.js";
12
- import { frameworkLogger } from "../core/framework-logger.js";
13
- const analyzer = getComplexityAnalyzer();
14
- export function assessComplexity(input) {
15
- const metrics = analyzer.analyzeComplexity(input.taskDescription, {
16
- files: input.files ?? [],
17
- dependencies: input.dependencies ?? [],
18
- changeVolume: input.changeVolume ?? 0,
19
- riskLevel: input.riskLevel ?? "low",
20
- estimatedDuration: input.estimatedDuration ?? 30,
21
- });
22
- const score = analyzer.calculateComplexityScore(metrics);
23
- frameworkLogger.log("assess-complexity-tool", "assessment-complete", "info", {
24
- taskDescription: input.taskDescription.substring(0, 80),
25
- score: score.score,
26
- level: score.level,
27
- strategy: score.recommendedStrategy,
28
- estimatedAgents: score.estimatedAgents,
29
- });
30
- return {
31
- score: score.score,
32
- level: score.level,
33
- strategy: score.recommendedStrategy,
34
- estimatedAgents: score.estimatedAgents,
35
- reasoning: score.reasoning,
36
- };
37
- }
38
- export function shouldDelegate(input) {
39
- const result = assessComplexity(input);
40
- return result.score > 15;
41
- }
42
- export function getDelegationStrategy(input) {
43
- return assessComplexity(input);
44
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * Query Routing Tool
3
- *
4
- * Lets the main AI discover which agent/skill best matches a task.
5
- * Combines ROUTING_MAPPINGS keyword lookup with AGENT_REGISTRY metadata.
6
- */
7
- export interface AgentRoutingDetail {
8
- agent: string;
9
- skill: string;
10
- confidence: number;
11
- matchedKeywords: string[];
12
- description: string | undefined;
13
- capabilities: string[];
14
- expertise: string | undefined;
15
- }
16
- export declare function queryRouting(keywords: string[]): AgentRoutingDetail[];
17
- export declare function listAllRoutes(): AgentRoutingDetail[];
@@ -1,59 +0,0 @@
1
- /**
2
- * Query Routing Tool
3
- *
4
- * Lets the main AI discover which agent/skill best matches a task.
5
- * Combines ROUTING_MAPPINGS keyword lookup with AGENT_REGISTRY metadata.
6
- */
7
- import { queryRoutingMappings, getAllRoutingMappings, } from "../config/routing-mappings.js";
8
- import { getAgentEntry, getAgentCapabilities, } from "../agents/registry.js";
9
- import { frameworkLogger } from "../core/framework-logger.js";
10
- export function queryRouting(keywords) {
11
- const matches = queryRoutingMappings(keywords);
12
- const enriched = matches.map((m) => {
13
- const entry = getAgentEntry(m.agent);
14
- return {
15
- agent: m.agent,
16
- skill: m.skill,
17
- confidence: m.confidence,
18
- matchedKeywords: m.matchedKeywords,
19
- description: entry?.description,
20
- capabilities: entry
21
- ? entry.capabilities
22
- : getAgentCapabilities(m.agent),
23
- expertise: entry?.expertise,
24
- };
25
- });
26
- frameworkLogger.log("query-routing-tool", "query-complete", "info", {
27
- keywords,
28
- matchCount: enriched.length,
29
- topMatch: enriched[0]
30
- ? { agent: enriched[0].agent, confidence: enriched[0].confidence }
31
- : null,
32
- });
33
- return enriched;
34
- }
35
- export function listAllRoutes() {
36
- const all = getAllRoutingMappings();
37
- const seen = new Set();
38
- const unique = [];
39
- for (const mapping of all) {
40
- const key = `${mapping.agent}:${mapping.skill}`;
41
- if (seen.has(key))
42
- continue;
43
- seen.add(key);
44
- const entry = getAgentEntry(mapping.agent);
45
- unique.push({
46
- agent: mapping.agent,
47
- skill: mapping.skill,
48
- confidence: mapping.confidence,
49
- matchedKeywords: mapping.keywords,
50
- description: entry?.description,
51
- capabilities: entry
52
- ? entry.capabilities
53
- : getAgentCapabilities(mapping.agent),
54
- expertise: entry?.expertise,
55
- });
56
- }
57
- unique.sort((a, b) => b.confidence - a.confidence);
58
- return unique;
59
- }
@@ -1,25 +0,0 @@
1
- export interface ReplacementOperation {
2
- pattern: string;
3
- replacement: string;
4
- isRegex?: boolean;
5
- caseSensitive?: boolean;
6
- }
7
- export interface BatchResult {
8
- success: boolean;
9
- filesModified: number;
10
- errors: Array<{
11
- file: string;
12
- error: string;
13
- }>;
14
- duration: number;
15
- }
16
- export interface FileOperation {
17
- filePath: string;
18
- operation: "replace" | "append" | "prepend" | "delete";
19
- content?: string;
20
- pattern?: string;
21
- }
22
- export declare function batchReplace(files: string[], operations: ReplacementOperation[]): Promise<BatchResult>;
23
- export declare function batchFileOperations(operations: FileOperation[]): Promise<BatchResult>;
24
- export declare function findFilesWithPattern(directory: string, pattern: string, extensions?: string[]): string[];
25
- export declare function bulkRename(directory: string, oldName: string, newName: string, extensions?: string[]): Promise<BatchResult>;