snow-flow 3.0.9 โ 3.0.13
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.
- package/claude-flow.bat +0 -0
- package/claude-flow.ps1 +0 -0
- package/dist/mcp/intelligent-reporting-mcp.d.ts +7 -0
- package/dist/mcp/intelligent-reporting-mcp.js +379 -0
- package/dist/mcp/servicenow-automation-mcp.js +0 -0
- package/dist/mcp/servicenow-deployment-mcp.js +0 -0
- package/dist/mcp/servicenow-integration-mcp.js +0 -0
- package/dist/mcp/servicenow-mcp-server.js +0 -0
- package/dist/mcp/servicenow-operations-mcp.js +0 -0
- package/dist/mcp/servicenow-platform-development-mcp.js +0 -0
- package/dist/mcp/servicenow-progressive-indexer.js +0 -0
- package/dist/mcp/servicenow-reporting-analytics-mcp.js +280 -29
- package/dist/mcp/servicenow-security-compliance-mcp.js +0 -0
- package/dist/mcp/servicenow-update-set-mcp.js +0 -0
- package/dist/mcp/start-all-mcp-servers.js +0 -0
- package/dist/mcp/start-servicenow-mcp.js +0 -0
- package/dist/services/widget-deployment-service.d.ts +2 -1
- package/dist/services/widget-deployment-service.js +17 -16
- package/dist/utils/anti-mock-data-validator.d.ts +66 -0
- package/dist/utils/anti-mock-data-validator.js +316 -0
- package/dist/utils/servicenow-eventual-consistency.d.ts +120 -0
- package/dist/utils/servicenow-eventual-consistency.js +220 -0
- package/memory/agents/README.md +1 -1
- package/memory/claude-flow-data.json +1 -1
- package/memory/sessions/README.md +1 -1
- package/package.json +4 -3
- package/.mcp.json +0 -22
- package/claude-flow.config.json +0 -20
- package/dist/agents/app-creator.agent.d.ts +0 -55
- package/dist/agents/app-creator.agent.js +0 -1292
- package/dist/agents/base/base-snow-agent.d.ts +0 -75
- package/dist/agents/base/base-snow-agent.js +0 -169
- package/dist/agents/base-snow-agent.d.ts +0 -63
- package/dist/agents/base-snow-agent.js +0 -296
- package/dist/agents/coordinator.d.ts +0 -200
- package/dist/agents/coordinator.js +0 -777
- package/dist/agents/flow-builder-agent.d.ts +0 -18
- package/dist/agents/flow-builder-agent.js +0 -197
- package/dist/agents/queen-403-handler.d.ts +0 -47
- package/dist/agents/queen-403-handler.js +0 -175
- package/dist/agents/queen-agent-example.d.ts +0 -23
- package/dist/agents/queen-agent-example.js +0 -240
- package/dist/agents/queen-agent.test.d.ts +0 -6
- package/dist/agents/script-generator.agent.d.ts +0 -32
- package/dist/agents/script-generator.agent.js +0 -772
- package/dist/agents/script-writer-agent.d.ts +0 -22
- package/dist/agents/script-writer-agent.js +0 -695
- package/dist/agents/security-agent.d.ts +0 -23
- package/dist/agents/security-agent.js +0 -619
- package/dist/agents/specialists/automation-specialist.agent.d.ts +0 -44
- package/dist/agents/specialists/automation-specialist.agent.js +0 -204
- package/dist/agents/specialists/data-specialist.agent.d.ts +0 -165
- package/dist/agents/specialists/data-specialist.agent.js +0 -484
- package/dist/agents/specialists/integration-specialist.agent.d.ts +0 -227
- package/dist/agents/specialists/integration-specialist.agent.js +0 -725
- package/dist/agents/specialists/reporting-specialist.agent.d.ts +0 -54
- package/dist/agents/specialists/reporting-specialist.agent.js +0 -193
- package/dist/agents/specialists/security-specialist.agent.d.ts +0 -85
- package/dist/agents/specialists/security-specialist.agent.js +0 -309
- package/dist/agents/teams/adaptive/adaptive-coordinator.agent.d.ts +0 -111
- package/dist/agents/teams/adaptive/adaptive-coordinator.agent.js +0 -383
- package/dist/agents/teams/base-team.d.ts +0 -72
- package/dist/agents/teams/base-team.js +0 -253
- package/dist/agents/teams/team-types.d.ts +0 -265
- package/dist/agents/teams/team-types.js +0 -3
- package/dist/agents/teams/widget/widget-architect.agent.d.ts +0 -61
- package/dist/agents/teams/widget/widget-architect.agent.js +0 -436
- package/dist/agents/teams/widget/widget-backend.agent.d.ts +0 -74
- package/dist/agents/teams/widget/widget-backend.agent.js +0 -1531
- package/dist/agents/teams/widget/widget-frontend.agent.d.ts +0 -67
- package/dist/agents/teams/widget/widget-frontend.agent.js +0 -1014
- package/dist/agents/teams/widget/widget-platform.agent.d.ts +0 -90
- package/dist/agents/teams/widget/widget-platform.agent.js +0 -1190
- package/dist/agents/teams/widget/widget-uiux.agent.d.ts +0 -107
- package/dist/agents/teams/widget/widget-uiux.agent.js +0 -1033
- package/dist/agents/test-agent.d.ts +0 -26
- package/dist/agents/test-agent.js +0 -734
- package/dist/agents/test-agents.d.ts +0 -7
- package/dist/agents/test-agents.js +0 -64
- package/dist/agents/ui-builder.agent.d.ts +0 -50
- package/dist/agents/ui-builder.agent.js +0 -1539
- package/dist/agents/widget-builder.agent.d.ts +0 -32
- package/dist/agents/widget-builder.agent.js +0 -439
- package/dist/agents/widget-creator-agent.d.ts +0 -18
- package/dist/agents/widget-creator-agent.js +0 -498
- package/dist/agents/workflow-designer.agent.d.ts +0 -31
- package/dist/agents/workflow-designer.agent.js +0 -583
- package/dist/api/error-handling.d.ts +0 -325
- package/dist/api/error-handling.js +0 -1488
- package/dist/api/flow-designer-api.d.ts +0 -167
- package/dist/api/flow-designer-api.js +0 -554
- package/dist/api/natural-language-mapper.d.ts +0 -124
- package/dist/api/natural-language-mapper.js +0 -501
- package/dist/api/performance-optimizer.d.ts +0 -240
- package/dist/api/performance-optimizer.js +0 -706
- package/dist/api/transaction-manager.d.ts +0 -189
- package/dist/api/transaction-manager.js +0 -576
- package/dist/assembly/team-assembler.d.ts +0 -140
- package/dist/assembly/team-assembler.js +0 -502
- package/dist/benchmark-performance.d.ts +0 -41
- package/dist/benchmark-performance.js +0 -230
- package/dist/cli/snow-flow-cli-integration.d.ts +0 -30
- package/dist/cli/snow-flow-cli-integration.js +0 -396
- package/dist/coordination/coordination-engine.d.ts +0 -41
- package/dist/coordination/coordination-engine.js +0 -324
- package/dist/coordination/coordination.test.d.ts +0 -6
- package/dist/coordination/example.d.ts +0 -31
- package/dist/coordination/example.js +0 -394
- package/dist/coordination/execution-patterns.d.ts +0 -43
- package/dist/coordination/execution-patterns.js +0 -507
- package/dist/coordination/factory.d.ts +0 -94
- package/dist/coordination/factory.js +0 -433
- package/dist/coordination/index.d.ts +0 -71
- package/dist/coordination/index.js +0 -135
- package/dist/coordination/progress-monitor.d.ts +0 -71
- package/dist/coordination/progress-monitor.js +0 -505
- package/dist/coordination/quality-gates.d.ts +0 -124
- package/dist/coordination/quality-gates.js +0 -577
- package/dist/coordination/shared-memory.d.ts +0 -39
- package/dist/coordination/shared-memory.js +0 -289
- package/dist/coordination/task-dependencies.d.ts +0 -50
- package/dist/coordination/task-dependencies.js +0 -407
- package/dist/coordination/team-coordinator.d.ts +0 -59
- package/dist/coordination/team-coordinator.js +0 -550
- package/dist/coordination/types.d.ts +0 -152
- package/dist/coordination/types.js +0 -3
- package/dist/mcp/mcp-wrapper.d.ts +0 -8
- package/dist/mcp/mcp-wrapper.js +0 -77
- package/dist/mcp/servicenow-flow-composer-enhanced.js +0 -396
- package/dist/mcp/servicenow-flow-composer-mcp.d.ts +0 -7
- package/dist/mcp/servicenow-flow-composer-mcp.js +0 -3103
- package/dist/mcp/servicenow-graph-memory-mcp.d.ts +0 -7
- package/dist/mcp/servicenow-intelligent-mcp.d.ts +0 -143
- package/dist/mcp/servicenow-intelligent-mcp.js +0 -4156
- package/dist/mcp/servicenow-xml-flow-mcp.d.ts +0 -53
- package/dist/mcp/servicenow-xml-flow-mcp.js +0 -1704
- package/dist/mcp/singleton-check.js +0 -31
- package/dist/mcp/test-simple-mcp.d.ts +0 -6
- package/dist/mcp/test-simple-mcp.js +0 -63
- package/dist/memory/hierarchical-memory-system.d.ts +0 -90
- package/dist/memory/hierarchical-memory-system.js +0 -400
- package/dist/memory/index.d.ts +0 -9
- package/dist/memory/index.js +0 -20
- package/dist/memory/mcp-integration-example.d.ts +0 -6
- package/dist/memory/mcp-integration-example.js +0 -281
- package/dist/memory/memory-client.d.ts +0 -199
- package/dist/memory/memory-client.js +0 -364
- package/dist/memory/memory-manager.d.ts +0 -29
- package/dist/memory/memory-manager.js +0 -280
- package/dist/memory/memory-operations.d.ts +0 -179
- package/dist/memory/memory-operations.js +0 -691
- package/dist/memory/memory-system.d.ts +0 -153
- package/dist/memory/memory-system.js +0 -651
- package/dist/memory/memory-test.d.ts +0 -6
- package/dist/memory/memory-test.js +0 -161
- package/dist/memory/snow-flow-memory-patterns.d.ts +0 -213
- package/dist/memory/snow-flow-memory-patterns.js +0 -200
- package/dist/memory/snow-memory.d.ts +0 -54
- package/dist/memory/snow-memory.js +0 -301
- package/dist/memory/swarm-memory.d.ts +0 -135
- package/dist/memory/swarm-memory.js +0 -378
- package/dist/optimization/flow-performance-optimizer.js +0 -723
- package/dist/orchestration/discovery/service-discovery.d.ts +0 -81
- package/dist/orchestration/discovery/service-discovery.js +0 -808
- package/dist/orchestration/distributed-orchestrator.d.ts +0 -131
- package/dist/orchestration/distributed-orchestrator.js +0 -712
- package/dist/orchestration/distribution/task-distribution-engine.d.ts +0 -53
- package/dist/orchestration/distribution/task-distribution-engine.js +0 -586
- package/dist/orchestration/flow-update-orchestrator.js +0 -648
- package/dist/orchestration/interfaces/distributed-orchestration.interface.d.ts +0 -606
- package/dist/orchestration/interfaces/distributed-orchestration.interface.js +0 -65
- package/dist/orchestration/protocols/mcpx-protocol.d.ts +0 -71
- package/dist/orchestration/protocols/mcpx-protocol.js +0 -668
- package/dist/orchestration/state/distributed-state-manager.d.ts +0 -89
- package/dist/orchestration/state/distributed-state-manager.js +0 -716
- package/dist/orchestrator/flow-composer.d.ts +0 -105
- package/dist/orchestrator/flow-composer.js +0 -404
- package/dist/orchestrator/flow-pattern-templates.d.ts +0 -260
- package/dist/orchestrator/flow-pattern-templates.js +0 -908
- package/dist/orchestrator/flow-subflow-decision-engine.d.ts +0 -202
- package/dist/orchestrator/flow-subflow-decision-engine.js +0 -769
- package/dist/orchestrator/flow-validation-engine.d.ts +0 -169
- package/dist/orchestrator/flow-validation-engine.js +0 -913
- package/dist/orchestrator/snow-orchestrator.d.ts +0 -49
- package/dist/orchestrator/snow-orchestrator.js +0 -235
- package/dist/orchestrator/subflow-creation-handler.d.ts +0 -230
- package/dist/orchestrator/subflow-creation-handler.js +0 -791
- package/dist/patterns/adaptive-patterns.d.ts +0 -140
- package/dist/patterns/adaptive-patterns.js +0 -549
- package/dist/queen/advanced-integration-test.d.ts +0 -48
- package/dist/queen/advanced-integration-test.js +0 -473
- package/dist/queen/integration-example.d.ts +0 -82
- package/dist/queen/integration-example.js +0 -219
- package/dist/queen/integration-test.d.ts +0 -72
- package/dist/queen/integration-test.js +0 -563
- package/dist/queen/mock-mcp-client.d.ts +0 -71
- package/dist/queen/mock-mcp-client.js +0 -317
- package/dist/queen/run-integration-tests.d.ts +0 -9
- package/dist/queen/run-integration-tests.js +0 -27
- package/dist/sparc/coordinators/adaptive-coordinator.d.ts +0 -54
- package/dist/sparc/coordinators/adaptive-coordinator.js +0 -367
- package/dist/sparc/coordinators/team-coordinator.d.ts +0 -66
- package/dist/sparc/coordinators/team-coordinator.js +0 -402
- package/dist/sparc/modes/team-modes.d.ts +0 -33
- package/dist/sparc/modes/team-modes.js +0 -399
- package/dist/sparc/teams/application-team.d.ts +0 -73
- package/dist/sparc/teams/application-team.js +0 -463
- package/dist/sparc/teams/flow-team.d.ts +0 -67
- package/dist/sparc/teams/flow-team.js +0 -373
- package/dist/sparc/teams/widget-team.d.ts +0 -61
- package/dist/sparc/teams/widget-team.js +0 -280
- package/dist/specialists/app-specialists.d.ts +0 -93
- package/dist/specialists/app-specialists.js +0 -1639
- package/dist/specialists/base-specialist.d.ts +0 -19
- package/dist/specialists/base-specialist.js +0 -54
- package/dist/specialists/flow-specialists.d.ts +0 -113
- package/dist/specialists/flow-specialists.js +0 -1787
- package/dist/specialists/individual-specialists.d.ts +0 -67
- package/dist/specialists/individual-specialists.js +0 -632
- package/dist/specialists/widget-specialists.d.ts +0 -70
- package/dist/specialists/widget-specialists.js +0 -1264
- package/dist/src/utils/agent-detector.js +0 -655
- package/dist/teams/adaptive-team.d.ts +0 -81
- package/dist/teams/adaptive-team.js +0 -1153
- package/dist/teams/application-team.d.ts +0 -30
- package/dist/teams/application-team.js +0 -547
- package/dist/teams/base-team.d.ts +0 -55
- package/dist/teams/base-team.js +0 -243
- package/dist/teams/flow-team.d.ts +0 -28
- package/dist/teams/flow-team.js +0 -525
- package/dist/teams/widget-team.d.ts +0 -26
- package/dist/teams/widget-team.js +0 -459
- package/dist/templates/flow-template-system.js +0 -625
- package/dist/test-fetch-incidents.d.ts +0 -2
- package/dist/test-fetch-incidents.js +0 -84
- package/dist/test-incident-access.d.ts +0 -2
- package/dist/test-incident-access.js +0 -72
- package/dist/test-iphone-flow.js +0 -189
- package/dist/test-limit-problem.d.ts +0 -2
- package/dist/test-limit-problem.js +0 -60
- package/dist/test-ml-batch-fix.d.ts +0 -2
- package/dist/test-ml-batch-fix.js +0 -104
- package/dist/test-ml-batch.d.ts +0 -2
- package/dist/test-ml-batch.js +0 -87
- package/dist/test-ml-query.d.ts +0 -2
- package/dist/test-ml-query.js +0 -100
- package/dist/test-ml-training-fix.d.ts +0 -12
- package/dist/test-ml-training-fix.js +0 -113
- package/dist/test-ml-training.d.ts +0 -2
- package/dist/test-ml-training.js +0 -32
- package/dist/test-operations-query.d.ts +0 -2
- package/dist/test-operations-query.js +0 -84
- package/dist/test-performance-query.d.ts +0 -2
- package/dist/test-performance-query.js +0 -52
- package/dist/test-singleton-protection.d.ts +0 -8
- package/dist/test-singleton-protection.js +0 -110
- package/dist/test-smart-limits.d.ts +0 -13
- package/dist/test-smart-limits.js +0 -100
- package/dist/test-snow-query-incidents.d.ts +0 -2
- package/dist/test-snow-query-incidents.js +0 -66
- package/dist/test-universal-query.d.ts +0 -2
- package/dist/test-universal-query.js +0 -106
- package/dist/testing/flow-testing-automation.js +0 -641
- package/dist/utils/complete-flow-xml-generator.js +0 -1285
- package/dist/utils/file-storage-fallback.d.ts +0 -62
- package/dist/utils/file-storage-fallback.js +0 -289
- package/dist/utils/flow-api-discovery.d.ts +0 -151
- package/dist/utils/flow-api-discovery.js +0 -439
- package/dist/utils/flow-examples.js +0 -720
- package/dist/utils/flow-structure-builder.js +0 -677
- package/dist/utils/flow-xml-generator.d.ts +0 -41
- package/dist/utils/flow-xml-generator.js +0 -258
- package/dist/utils/improved-flow-xml-generator.js +0 -820
- package/dist/utils/mcp-process-manager.backup.d.ts +0 -58
- package/dist/utils/mcp-process-manager.backup.js +0 -220
- package/dist/utils/mcp-singleton-enforcer.d.ts +0 -36
- package/dist/utils/mcp-singleton-enforcer.js +0 -201
- package/dist/utils/mcp-timeout-fix.d.ts +0 -53
- package/dist/utils/mcp-timeout-fix.js +0 -221
- package/dist/utils/migrate-claude-flow.d.ts +0 -22
- package/dist/utils/migrate-claude-flow.js +0 -120
- package/dist/utils/scope-utils.d.ts +0 -72
- package/dist/utils/scope-utils.js +0 -386
- package/dist/utils/snow-oauth-old.d.ts +0 -65
- package/dist/utils/snow-oauth-old.js +0 -345
- package/dist/utils/xml-first-flow-generator.js +0 -513
- package/memory/servicenow_artifacts/000d9224c895221055906c7518aa2d3d.json +0 -30
- package/memory/servicenow_artifacts/0196b66173303010e46b4a2214f6a7a2.json +0 -36
- package/memory/servicenow_artifacts/125e5d1d837e2a102a7ea130ceaad397.json +0 -30
- package/memory/servicenow_artifacts/7637c1f2b7112210a5e5911cde11a972.json +0 -30
- package/memory/servicenow_artifacts/default_documentation_tables_1754056582292.json +0 -55
- package/memory/servicenow_artifacts/default_documentation_tables_1754057477189.json +0 -55
- package/memory/update-set-sessions/01f82af583faea102a7ea130ceaad3d4.json +0 -9
- package/memory/update-set-sessions/27718fb983faea102a7ea130ceaad34b.json +0 -9
- package/memory/update-set-sessions/412e9bf6833e22502a7ea130ceaad30a.json +0 -8
- package/memory/update-set-sessions/66fc5a79837aea102a7ea130ceaad3ab.json +0 -9
- package/memory/update-set-sessions/71a30ff5837eea102a7ea130ceaad37f.json +0 -9
- package/memory/update-set-sessions/74fba27983faea102a7ea130ceaad3bd.json +0 -9
- package/memory/update-set-sessions/a0b147b5837eea102a7ea130ceaad344.json +0 -58
- package/memory/update-set-sessions/b13f5eb983baea102a7ea130ceaad33e.json +0 -9
- package/reports/swarm-auto-centralized-1752649029776.json +0 -13
- package/src/memory/README.md +0 -240
package/dist/test-ml-query.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const servicenow_client_js_1 = require("./utils/servicenow-client.js");
|
|
4
|
-
const logger_js_1 = require("./utils/logger.js");
|
|
5
|
-
async function testMLQuery() {
|
|
6
|
-
const logger = new logger_js_1.Logger('MLQueryTest');
|
|
7
|
-
const client = new servicenow_client_js_1.ServiceNowClient();
|
|
8
|
-
logger.info('Testing ML training query...');
|
|
9
|
-
// Build the exact same intelligent query as ML training
|
|
10
|
-
const queries = [];
|
|
11
|
-
queries.push('sys_created_onONLast 6 months');
|
|
12
|
-
queries.push('(priority=1^ORpriority=2^ORpriority=3^ORpriority=4)');
|
|
13
|
-
queries.push('(active=true^ORactive=false)');
|
|
14
|
-
queries.push('categoryISNOTEMPTY');
|
|
15
|
-
const finalQuery = queries.join('^');
|
|
16
|
-
logger.info(`Using ML intelligent query: ${finalQuery}`);
|
|
17
|
-
// Test 1: Without ordering
|
|
18
|
-
try {
|
|
19
|
-
logger.info('\nTest 1: Query without ordering...');
|
|
20
|
-
const result1 = await client.searchRecords('incident', finalQuery, 10);
|
|
21
|
-
logger.info(`Result: ${result1.success ? 'SUCCESS' : 'FAILED'}`);
|
|
22
|
-
logger.info(`Count: ${result1.data?.result?.length || 0}`);
|
|
23
|
-
if (result1.data?.result?.length > 0) {
|
|
24
|
-
logger.info('Sample incidents:');
|
|
25
|
-
result1.data.result.slice(0, 3).forEach((inc) => {
|
|
26
|
-
logger.info(`- ${inc.number}: created=${inc.sys_created_on}, priority=${inc.priority}, category=${inc.category || 'none'}`);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
logger.error('Test 1 failed:', error);
|
|
32
|
-
}
|
|
33
|
-
// Test 2: With ordering (as ML uses)
|
|
34
|
-
try {
|
|
35
|
-
logger.info('\nTest 2: Query with ordering...');
|
|
36
|
-
const orderedQuery = finalQuery + '^ORDERBYDESCsys_created_on';
|
|
37
|
-
const result2 = await client.searchRecords('incident', orderedQuery, 10);
|
|
38
|
-
logger.info(`Result: ${result2.success ? 'SUCCESS' : 'FAILED'}`);
|
|
39
|
-
logger.info(`Count: ${result2.data?.result?.length || 0}`);
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
logger.error('Test 2 failed:', error);
|
|
43
|
-
}
|
|
44
|
-
// Test 3: With offset (for streaming)
|
|
45
|
-
try {
|
|
46
|
-
logger.info('\nTest 3: Query with offset...');
|
|
47
|
-
const orderedQuery = finalQuery + '^ORDERBYDESCsys_created_on';
|
|
48
|
-
const result3 = await client.searchRecordsWithOffset('incident', orderedQuery, 10, 0);
|
|
49
|
-
logger.info(`Result: ${result3.success ? 'SUCCESS' : 'FAILED'}`);
|
|
50
|
-
logger.info(`Count: ${result3.data?.result?.length || 0}`);
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
logger.error('Test 3 failed:', error);
|
|
54
|
-
}
|
|
55
|
-
// Test 4: Simplify query to find the issue
|
|
56
|
-
try {
|
|
57
|
-
logger.info('\nTest 4: Testing each query part separately...');
|
|
58
|
-
const testQueries = [
|
|
59
|
-
'sys_created_onONLast 6 months',
|
|
60
|
-
'priority=1^ORpriority=2^ORpriority=3^ORpriority=4',
|
|
61
|
-
'active=true^ORactive=false',
|
|
62
|
-
'categoryISNOTEMPTY',
|
|
63
|
-
'category!=null',
|
|
64
|
-
'categoryISNOT EMPTY',
|
|
65
|
-
'' // empty query
|
|
66
|
-
];
|
|
67
|
-
for (const q of testQueries) {
|
|
68
|
-
const result = await client.searchRecords('incident', q, 5);
|
|
69
|
-
logger.info(`Query "${q}" -> ${result.data?.result?.length || 0} results`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
logger.error('Test 4 failed:', error);
|
|
74
|
-
}
|
|
75
|
-
// Test 5: Check if categoryISNOTEMPTY is the problem
|
|
76
|
-
try {
|
|
77
|
-
logger.info('\nTest 5: Testing without category filter...');
|
|
78
|
-
const queriesWithoutCategory = [
|
|
79
|
-
'sys_created_onONLast 6 months',
|
|
80
|
-
'(priority=1^ORpriority=2^ORpriority=3^ORpriority=4)',
|
|
81
|
-
'(active=true^ORactive=false)'
|
|
82
|
-
];
|
|
83
|
-
const queryWithoutCategory = queriesWithoutCategory.join('^');
|
|
84
|
-
logger.info(`Query without category: ${queryWithoutCategory}`);
|
|
85
|
-
const result5 = await client.searchRecords('incident', queryWithoutCategory, 10);
|
|
86
|
-
logger.info(`Result: ${result5.success ? 'SUCCESS' : 'FAILED'}`);
|
|
87
|
-
logger.info(`Count: ${result5.data?.result?.length || 0}`);
|
|
88
|
-
if (result5.data?.result?.length > 0) {
|
|
89
|
-
logger.info('Categories in results:');
|
|
90
|
-
const categories = new Set(result5.data.result.map((inc) => inc.category || 'empty'));
|
|
91
|
-
logger.info(`Unique categories: ${Array.from(categories).join(', ')}`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
catch (error) {
|
|
95
|
-
logger.error('Test 5 failed:', error);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
// Run the test
|
|
99
|
-
testMLQuery().catch(console.error);
|
|
100
|
-
//# sourceMappingURL=test-ml-query.js.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Test ML Training with Enhanced Error Handling
|
|
4
|
-
*
|
|
5
|
-
* This script tests the ML training fixes for:
|
|
6
|
-
* 1. Model compilation errors
|
|
7
|
-
* 2. InputDim undefined errors
|
|
8
|
-
* 3. GatherV2 index out of bounds errors
|
|
9
|
-
*/
|
|
10
|
-
declare function testMLTrainingFix(): Promise<void>;
|
|
11
|
-
export { testMLTrainingFix };
|
|
12
|
-
//# sourceMappingURL=test-ml-training-fix.d.ts.map
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.testMLTrainingFix = testMLTrainingFix;
|
|
5
|
-
const servicenow_machine_learning_mcp_js_1 = require("./mcp/servicenow-machine-learning-mcp.js");
|
|
6
|
-
const logger_js_1 = require("./utils/logger.js");
|
|
7
|
-
/**
|
|
8
|
-
* Test ML Training with Enhanced Error Handling
|
|
9
|
-
*
|
|
10
|
-
* This script tests the ML training fixes for:
|
|
11
|
-
* 1. Model compilation errors
|
|
12
|
-
* 2. InputDim undefined errors
|
|
13
|
-
* 3. GatherV2 index out of bounds errors
|
|
14
|
-
*/
|
|
15
|
-
async function testMLTrainingFix() {
|
|
16
|
-
const logger = new logger_js_1.Logger('ML-Training-Test');
|
|
17
|
-
const mlServer = new servicenow_machine_learning_mcp_js_1.ServiceNowMachineLearningMCP();
|
|
18
|
-
console.log('๐ง Testing ML Training Fixes\n');
|
|
19
|
-
console.log('โ'.repeat(60));
|
|
20
|
-
try {
|
|
21
|
-
// Test 1: Small dataset to verify basic functionality
|
|
22
|
-
console.log('\n1๏ธโฃ Testing with small dataset (50 samples)...');
|
|
23
|
-
const result1 = await mlServer.handleTool('ml_train_incident_classifier', {
|
|
24
|
-
sample_size: 50,
|
|
25
|
-
epochs: 5,
|
|
26
|
-
batch_size: 10,
|
|
27
|
-
intelligent_selection: false,
|
|
28
|
-
query: 'active=true'
|
|
29
|
-
});
|
|
30
|
-
const response1 = JSON.parse(result1.content[0].text);
|
|
31
|
-
if (response1.status === 'error') {
|
|
32
|
-
console.log('โ Error:', response1.error);
|
|
33
|
-
console.log('๐ก Troubleshooting:');
|
|
34
|
-
response1.troubleshooting?.forEach((step) => console.log(` ${step}`));
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
console.log('โ
Training successful!');
|
|
38
|
-
console.log(` Accuracy: ${response1.final_accuracy}`);
|
|
39
|
-
}
|
|
40
|
-
// Test 2: Intelligent selection
|
|
41
|
-
console.log('\n2๏ธโฃ Testing with intelligent selection...');
|
|
42
|
-
const result2 = await mlServer.handleTool('ml_train_incident_classifier', {
|
|
43
|
-
sample_size: 100,
|
|
44
|
-
epochs: 10,
|
|
45
|
-
intelligent_selection: true,
|
|
46
|
-
focus_categories: ['hardware', 'software', 'network']
|
|
47
|
-
});
|
|
48
|
-
const response2 = JSON.parse(result2.content[0].text);
|
|
49
|
-
if (response2.status === 'error') {
|
|
50
|
-
console.log('โ Error:', response2.error);
|
|
51
|
-
console.log('๐ก Details:', response2.details);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
console.log('โ
Training successful!');
|
|
55
|
-
console.log(` Categories: ${response2.categories?.join(', ')}`);
|
|
56
|
-
}
|
|
57
|
-
// Test 3: Streaming mode for larger datasets
|
|
58
|
-
console.log('\n3๏ธโฃ Testing streaming mode...');
|
|
59
|
-
const result3 = await mlServer.handleTool('ml_train_incident_classifier', {
|
|
60
|
-
sample_size: 200,
|
|
61
|
-
batch_size: 50,
|
|
62
|
-
epochs: 5,
|
|
63
|
-
streaming_mode: true
|
|
64
|
-
});
|
|
65
|
-
const response3 = JSON.parse(result3.content[0].text);
|
|
66
|
-
if (response3.status === 'error') {
|
|
67
|
-
console.log('โ Error:', response3.error);
|
|
68
|
-
if (response3.troubleshooting) {
|
|
69
|
-
console.log('๐ก Troubleshooting steps:');
|
|
70
|
-
response3.troubleshooting.forEach((step) => console.log(` ${step}`));
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
console.log('โ
Streaming training successful!');
|
|
75
|
-
console.log(` Training time: ${response3.training_time_seconds}s`);
|
|
76
|
-
}
|
|
77
|
-
// Test 4: Model status check
|
|
78
|
-
console.log('\n4๏ธโฃ Checking model status...');
|
|
79
|
-
const statusResult = await mlServer.handleTool('ml_model_status', {
|
|
80
|
-
model: 'incident_classifier'
|
|
81
|
-
});
|
|
82
|
-
const status = JSON.parse(statusResult.content[0].text);
|
|
83
|
-
console.log('๐ Model Status:');
|
|
84
|
-
console.log(` Trained: ${status.models?.incident_classifier?.trained || false}`);
|
|
85
|
-
console.log(` Accuracy: ${status.models?.incident_classifier?.accuracy || 'N/A'}`);
|
|
86
|
-
// Summary
|
|
87
|
-
console.log('\n' + 'โ'.repeat(60));
|
|
88
|
-
console.log('\n๐ TEST SUMMARY:\n');
|
|
89
|
-
console.log('โ
Model compilation issues: FIXED');
|
|
90
|
-
console.log('โ
InputDim undefined: FIXED (validates vocabulary size)');
|
|
91
|
-
console.log('โ
GatherV2 index errors: FIXED (bounds checking)');
|
|
92
|
-
console.log('โ
Better error messages with troubleshooting steps');
|
|
93
|
-
console.log('โ
Graceful handling of missing/empty data');
|
|
94
|
-
console.log('\n๐ฏ Recommendations:');
|
|
95
|
-
console.log('1. Ensure ServiceNow OAuth is configured: snow-flow auth login');
|
|
96
|
-
console.log('2. Verify incident table has data: state!=7');
|
|
97
|
-
console.log('3. Start with small sample_size (50-100) for testing');
|
|
98
|
-
console.log('4. Use intelligent_selection for balanced training data');
|
|
99
|
-
}
|
|
100
|
-
catch (error) {
|
|
101
|
-
logger.error('Test failed:', error);
|
|
102
|
-
console.log('\nโ Critical Error:', error.message);
|
|
103
|
-
console.log('\n๐ง Debug Steps:');
|
|
104
|
-
console.log('1. Check MCP server: snow-flow mcp status');
|
|
105
|
-
console.log('2. Verify auth: snow-flow auth status');
|
|
106
|
-
console.log('3. Test incident access: node dist/test-incident-access.js');
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
// Run test
|
|
110
|
-
if (require.main === module) {
|
|
111
|
-
testMLTrainingFix().catch(console.error);
|
|
112
|
-
}
|
|
113
|
-
//# sourceMappingURL=test-ml-training-fix.js.map
|
package/dist/test-ml-training.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const servicenow_machine_learning_mcp_js_1 = require("./mcp/servicenow-machine-learning-mcp.js");
|
|
4
|
-
async function testMLTraining() {
|
|
5
|
-
console.log('๐ฅ Testing ML training with 2000+ incidents...');
|
|
6
|
-
try {
|
|
7
|
-
// Test the ML training directly
|
|
8
|
-
const result = await (0, servicenow_machine_learning_mcp_js_1.mcp__servicenow_machine_learning__ml_train_incident_classifier)({
|
|
9
|
-
sample_size: 2000,
|
|
10
|
-
query: '', // Use intelligent selection
|
|
11
|
-
intelligent_selection: true,
|
|
12
|
-
streaming_mode: false, // Test non-streaming first
|
|
13
|
-
batch_size: 200,
|
|
14
|
-
epochs: 50,
|
|
15
|
-
validation_split: 0.2,
|
|
16
|
-
max_vocabulary_size: 10000,
|
|
17
|
-
focus_categories: []
|
|
18
|
-
});
|
|
19
|
-
console.log('โ
ML Training Result:');
|
|
20
|
-
console.log(JSON.stringify(JSON.parse(result.content[0].text), null, 2));
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
console.error('โ ML Training failed:', error);
|
|
24
|
-
// If it fails, show more details
|
|
25
|
-
if (error instanceof Error) {
|
|
26
|
-
console.error('Error message:', error.message);
|
|
27
|
-
console.error('Stack trace:', error.stack);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
testMLTraining().catch(console.error);
|
|
32
|
-
//# sourceMappingURL=test-ml-training.js.map
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const servicenow_client_js_1 = require("./utils/servicenow-client.js");
|
|
4
|
-
const logger_js_1 = require("./utils/logger.js");
|
|
5
|
-
async function testOperationsQuery() {
|
|
6
|
-
const logger = new logger_js_1.Logger('OperationsQueryTest');
|
|
7
|
-
const client = new servicenow_client_js_1.ServiceNowClient();
|
|
8
|
-
logger.info('Testing operations query processing...');
|
|
9
|
-
// Test processNaturalLanguageQuery logic
|
|
10
|
-
const testQuery = (query) => {
|
|
11
|
-
const lowerQuery = query.toLowerCase();
|
|
12
|
-
// If already a ServiceNow encoded query, return as-is
|
|
13
|
-
if (query.includes('=') || query.includes('!=') || query.includes('^') || query.includes('LIKE')) {
|
|
14
|
-
logger.info(`Recognized as ServiceNow query: ${query}`);
|
|
15
|
-
return query;
|
|
16
|
-
}
|
|
17
|
-
logger.info(`Treating as natural language: ${query}`);
|
|
18
|
-
return `short_descriptionLIKE${query}^ORdescriptionLIKE${query}`;
|
|
19
|
-
};
|
|
20
|
-
// Test queries
|
|
21
|
-
const queries = [
|
|
22
|
-
'state!=7',
|
|
23
|
-
'active=true',
|
|
24
|
-
'priority=1',
|
|
25
|
-
'all incidents',
|
|
26
|
-
'high priority',
|
|
27
|
-
''
|
|
28
|
-
];
|
|
29
|
-
logger.info('\n--- Testing Query Processing ---');
|
|
30
|
-
for (const query of queries) {
|
|
31
|
-
const processed = testQuery(query);
|
|
32
|
-
logger.info(`Input: "${query}" -> Output: "${processed}"`);
|
|
33
|
-
}
|
|
34
|
-
logger.info('\n--- Testing Actual Queries ---');
|
|
35
|
-
// Test 1: Raw ServiceNow query
|
|
36
|
-
try {
|
|
37
|
-
logger.info('\nTest 1: Testing with state!=7...');
|
|
38
|
-
const result1 = await client.searchRecords('incident', 'state!=7', 10);
|
|
39
|
-
logger.info(`Result: ${result1.success ? 'SUCCESS' : 'FAILED'}`);
|
|
40
|
-
logger.info(`Count: ${result1.data?.result?.length || 0}`);
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
logger.error('Test 1 failed:', error);
|
|
44
|
-
}
|
|
45
|
-
// Test 2: Empty query
|
|
46
|
-
try {
|
|
47
|
-
logger.info('\nTest 2: Testing with empty query...');
|
|
48
|
-
const result2 = await client.searchRecords('incident', '', 10);
|
|
49
|
-
logger.info(`Result: ${result2.success ? 'SUCCESS' : 'FAILED'}`);
|
|
50
|
-
logger.info(`Count: ${result2.data?.result?.length || 0}`);
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
logger.error('Test 2 failed:', error);
|
|
54
|
-
}
|
|
55
|
-
// Test 3: Complex query
|
|
56
|
-
try {
|
|
57
|
-
logger.info('\nTest 3: Testing with complex query...');
|
|
58
|
-
const result3 = await client.searchRecords('incident', 'active=true^state!=6^state!=7', 10);
|
|
59
|
-
logger.info(`Result: ${result3.success ? 'SUCCESS' : 'FAILED'}`);
|
|
60
|
-
logger.info(`Count: ${result3.data?.result?.length || 0}`);
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
logger.error('Test 3 failed:', error);
|
|
64
|
-
}
|
|
65
|
-
// Test 4: Test natural language conversion
|
|
66
|
-
try {
|
|
67
|
-
logger.info('\nTest 4: Testing natural language conversion...');
|
|
68
|
-
const nlQuery = 'high priority';
|
|
69
|
-
const processedQuery = testQuery(nlQuery);
|
|
70
|
-
logger.info(`Natural language: "${nlQuery}" -> "${processedQuery}"`);
|
|
71
|
-
// Now test the actual operations MCP logic
|
|
72
|
-
const operationsQuery = nlQuery.toLowerCase().includes('high priority') ? 'priority=1' : processedQuery;
|
|
73
|
-
logger.info(`Operations MCP would use: "${operationsQuery}"`);
|
|
74
|
-
const result4 = await client.searchRecords('incident', operationsQuery, 10);
|
|
75
|
-
logger.info(`Result: ${result4.success ? 'SUCCESS' : 'FAILED'}`);
|
|
76
|
-
logger.info(`Count: ${result4.data?.result?.length || 0}`);
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
logger.error('Test 4 failed:', error);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
// Run the test
|
|
83
|
-
testOperationsQuery().catch(console.error);
|
|
84
|
-
//# sourceMappingURL=test-operations-query.js.map
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const servicenow_client_js_1 = require("./utils/servicenow-client.js");
|
|
4
|
-
const logger_js_1 = require("./utils/logger.js");
|
|
5
|
-
// Test performance-optimized querying
|
|
6
|
-
async function testPerformanceQuery() {
|
|
7
|
-
const logger = new logger_js_1.Logger('PerformanceQueryTest');
|
|
8
|
-
const client = new servicenow_client_js_1.ServiceNowClient();
|
|
9
|
-
console.log('๐ Testing performance-optimized incident querying...\n');
|
|
10
|
-
try {
|
|
11
|
-
// Test 1: Count only (default behavior - fast)
|
|
12
|
-
console.log('1๏ธโฃ Test count-only query (default, fast):');
|
|
13
|
-
const startCount = Date.now();
|
|
14
|
-
const countResult = await client.searchRecords('incident', 'state!=7', 100);
|
|
15
|
-
const countTime = Date.now() - startCount;
|
|
16
|
-
console.log(` โ
Found ${countResult.data.result.length} incidents in ${countTime}ms`);
|
|
17
|
-
console.log(` ๐ Memory used: ~${JSON.stringify(countResult).length} bytes (minimal)\n`);
|
|
18
|
-
// Test 2: With full content (slower, more memory)
|
|
19
|
-
console.log('2๏ธโฃ Test with full content (include_content=true):');
|
|
20
|
-
const startFull = Date.now();
|
|
21
|
-
const fullResult = await client.searchRecords('incident', 'state!=7', 100);
|
|
22
|
-
const fullTime = Date.now() - startFull;
|
|
23
|
-
console.log(` โ
Retrieved ${fullResult.data.result.length} full incidents in ${fullTime}ms`);
|
|
24
|
-
console.log(` ๐ Memory used: ~${JSON.stringify(fullResult).length} bytes (full data)\n`);
|
|
25
|
-
// Test 3: With specific fields only
|
|
26
|
-
console.log('3๏ธโฃ Test with specific fields (optimized):');
|
|
27
|
-
const fieldsResult = await client.searchRecords('incident', 'state!=7', 10);
|
|
28
|
-
const filtered = fieldsResult.data.result.map((inc) => ({
|
|
29
|
-
number: inc.number,
|
|
30
|
-
short_description: inc.short_description,
|
|
31
|
-
state: inc.state
|
|
32
|
-
}));
|
|
33
|
-
console.log(` โ
Retrieved ${filtered.length} incidents with 3 fields only`);
|
|
34
|
-
console.log(` ๐ Memory used: ~${JSON.stringify(filtered).length} bytes (filtered)\n`);
|
|
35
|
-
// Show memory comparison
|
|
36
|
-
console.log('๐ Memory Usage Comparison:');
|
|
37
|
-
console.log(` Count-only: ~${JSON.stringify({ count: countResult.data.result.length }).length} bytes`);
|
|
38
|
-
console.log(` Filtered (3 fields): ~${JSON.stringify(filtered).length} bytes`);
|
|
39
|
-
console.log(` Full data: ~${JSON.stringify(fullResult).length} bytes`);
|
|
40
|
-
// Calculate savings
|
|
41
|
-
const fullSize = JSON.stringify(fullResult).length;
|
|
42
|
-
const countSize = JSON.stringify({ count: countResult.data.result.length }).length;
|
|
43
|
-
const savings = Math.round(((fullSize - countSize) / fullSize) * 100);
|
|
44
|
-
console.log(`\n๐ฐ Memory savings with count-only: ${savings}%`);
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
logger.error('Test failed:', error);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
// Run the test
|
|
51
|
-
testPerformanceQuery().catch(console.error);
|
|
52
|
-
//# sourceMappingURL=test-performance-query.js.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Test Singleton Protection for MCP Servers
|
|
4
|
-
* Verifies that duplicate MCP server instances cannot start
|
|
5
|
-
*/
|
|
6
|
-
declare function testSingletonProtection(): Promise<boolean>;
|
|
7
|
-
export { testSingletonProtection };
|
|
8
|
-
//# sourceMappingURL=test-singleton-protection.d.ts.map
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
/**
|
|
4
|
-
* Test Singleton Protection for MCP Servers
|
|
5
|
-
* Verifies that duplicate MCP server instances cannot start
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.testSingletonProtection = testSingletonProtection;
|
|
9
|
-
const mcp_singleton_lock_js_1 = require("./utils/mcp-singleton-lock.js");
|
|
10
|
-
const logger_js_1 = require("./utils/logger.js");
|
|
11
|
-
const logger = new logger_js_1.Logger('SingletonTest');
|
|
12
|
-
async function testSingletonProtection() {
|
|
13
|
-
console.log('๐งช Testing MCP Singleton Protection\n');
|
|
14
|
-
console.log('โ'.repeat(60));
|
|
15
|
-
try {
|
|
16
|
-
// Test 1: First instance should acquire lock successfully
|
|
17
|
-
console.log('\n1๏ธโฃ Testing first instance lock acquisition...');
|
|
18
|
-
const firstLock = (0, mcp_singleton_lock_js_1.getMCPSingletonLock)();
|
|
19
|
-
const firstResult = firstLock.acquire();
|
|
20
|
-
if (firstResult) {
|
|
21
|
-
console.log('โ
First instance successfully acquired lock');
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
console.log('โ First instance failed to acquire lock');
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
// Test 2: Second instance should fail to acquire lock
|
|
28
|
-
console.log('\n2๏ธโฃ Testing second instance prevention...');
|
|
29
|
-
const secondLock = new mcp_singleton_lock_js_1.MCPSingletonLock();
|
|
30
|
-
const secondResult = secondLock.acquire();
|
|
31
|
-
if (!secondResult) {
|
|
32
|
-
console.log('โ
Second instance correctly prevented (singleton working!)');
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
console.log('โ Second instance acquired lock (singleton BROKEN!)');
|
|
36
|
-
secondLock.release();
|
|
37
|
-
firstLock.release();
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
// Test 3: Lock release and re-acquisition
|
|
41
|
-
console.log('\n3๏ธโฃ Testing lock release and re-acquisition...');
|
|
42
|
-
firstLock.release();
|
|
43
|
-
// Wait a moment for cleanup
|
|
44
|
-
await new Promise(resolve => setTimeout(resolve, 100));
|
|
45
|
-
const thirdLock = new mcp_singleton_lock_js_1.MCPSingletonLock();
|
|
46
|
-
const thirdResult = thirdLock.acquire();
|
|
47
|
-
if (thirdResult) {
|
|
48
|
-
console.log('โ
Lock successfully re-acquired after release');
|
|
49
|
-
thirdLock.release();
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
console.log('โ Failed to re-acquire lock after release');
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
// Test 4: Force release functionality
|
|
56
|
-
console.log('\n4๏ธโฃ Testing force release functionality...');
|
|
57
|
-
const fourthLock = new mcp_singleton_lock_js_1.MCPSingletonLock();
|
|
58
|
-
fourthLock.acquire();
|
|
59
|
-
const forceResult = mcp_singleton_lock_js_1.MCPSingletonLock.forceRelease();
|
|
60
|
-
if (forceResult) {
|
|
61
|
-
console.log('โ
Force release successful');
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
console.log('โ ๏ธ No lock to force release (expected if cleanup worked)');
|
|
65
|
-
}
|
|
66
|
-
// Clean up
|
|
67
|
-
fourthLock.release();
|
|
68
|
-
// Summary
|
|
69
|
-
console.log('\n' + 'โ'.repeat(60));
|
|
70
|
-
console.log('\n๐ SINGLETON PROTECTION TEST RESULTS:\n');
|
|
71
|
-
console.log('โ
First instance acquires lock correctly');
|
|
72
|
-
console.log('โ
Duplicate instances are prevented');
|
|
73
|
-
console.log('โ
Lock release works correctly');
|
|
74
|
-
console.log('โ
Lock re-acquisition works after release');
|
|
75
|
-
console.log('โ
Force release works for cleanup');
|
|
76
|
-
console.log('\n๐ฏ Practical Impact:');
|
|
77
|
-
console.log('โข No more duplicate MCP servers');
|
|
78
|
-
console.log('โข No more memory exhaustion (1.5GB+ usage)');
|
|
79
|
-
console.log('โข No more random timeouts in swarm operations');
|
|
80
|
-
console.log('โข MCP servers cleanly prevent conflicts');
|
|
81
|
-
console.log('\n๐ง Usage:');
|
|
82
|
-
console.log('โข MCP servers automatically use singleton protection');
|
|
83
|
-
console.log('โข If stuck: run "npm run cleanup-mcp"');
|
|
84
|
-
console.log('โข Or kill manually: "pkill -f mcp"');
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
catch (error) {
|
|
88
|
-
console.error('\nโ Singleton test failed:', error.message);
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
// Run test if executed directly
|
|
93
|
-
if (require.main === module) {
|
|
94
|
-
testSingletonProtection()
|
|
95
|
-
.then(success => {
|
|
96
|
-
if (success) {
|
|
97
|
-
console.log('\n๐ All singleton protection tests PASSED!');
|
|
98
|
-
process.exit(0);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
console.log('\n๐ฅ Singleton protection tests FAILED!');
|
|
102
|
-
process.exit(1);
|
|
103
|
-
}
|
|
104
|
-
})
|
|
105
|
-
.catch(error => {
|
|
106
|
-
console.error('\n๐ฅ Test execution failed:', error);
|
|
107
|
-
process.exit(1);
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
//# sourceMappingURL=test-singleton-protection.js.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Test Smart Limits for snow_query_table
|
|
4
|
-
*
|
|
5
|
-
* This script validates that the smart default limit system works correctly:
|
|
6
|
-
* - ML context: 5000 default
|
|
7
|
-
* - Count-only: 2000 default
|
|
8
|
-
* - Normal content: 1000 default
|
|
9
|
-
* - Explicit limits: Always respected
|
|
10
|
-
*/
|
|
11
|
-
declare function testSmartLimits(): Promise<void>;
|
|
12
|
-
export { testSmartLimits };
|
|
13
|
-
//# sourceMappingURL=test-smart-limits.d.ts.map
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
/**
|
|
4
|
-
* Test Smart Limits for snow_query_table
|
|
5
|
-
*
|
|
6
|
-
* This script validates that the smart default limit system works correctly:
|
|
7
|
-
* - ML context: 5000 default
|
|
8
|
-
* - Count-only: 2000 default
|
|
9
|
-
* - Normal content: 1000 default
|
|
10
|
-
* - Explicit limits: Always respected
|
|
11
|
-
*/
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.testSmartLimits = testSmartLimits;
|
|
14
|
-
const servicenow_operations_mcp_js_1 = require("./mcp/servicenow-operations-mcp.js");
|
|
15
|
-
const logger_js_1 = require("./utils/logger.js");
|
|
16
|
-
const logger = new logger_js_1.Logger('SmartLimitsTest');
|
|
17
|
-
async function testSmartLimits() {
|
|
18
|
-
console.log('๐งช Testing Smart Default Limits\n');
|
|
19
|
-
console.log('โ'.repeat(60));
|
|
20
|
-
const operationsMCP = new servicenow_operations_mcp_js_1.ServiceNowOperationsMCP();
|
|
21
|
-
try {
|
|
22
|
-
// Test 1: ML Training Context Detection
|
|
23
|
-
console.log('\n1๏ธโฃ Testing ML Training Context (should use 5000 default)...');
|
|
24
|
-
// Simulate ML training query
|
|
25
|
-
const mlResult = await operationsMCP.handleTool('snow_query_table', {
|
|
26
|
-
table: 'incident',
|
|
27
|
-
query: 'category!=null', // ML-style query
|
|
28
|
-
include_content: true // ML needs content
|
|
29
|
-
});
|
|
30
|
-
console.log('โ
ML Context test completed');
|
|
31
|
-
// Note: In real scenario, smart limit would be applied and logged
|
|
32
|
-
// Test 2: Count-only Query (should use 2000 default)
|
|
33
|
-
console.log('\n2๏ธโฃ Testing Count-only Query (should use 2000 default)...');
|
|
34
|
-
const countResult = await operationsMCP.handleTool('snow_query_table', {
|
|
35
|
-
table: 'incident',
|
|
36
|
-
query: 'state!=7',
|
|
37
|
-
include_content: false // Count only
|
|
38
|
-
});
|
|
39
|
-
console.log('โ
Count-only test completed');
|
|
40
|
-
// Test 3: Normal Content Query (should use 1000 default)
|
|
41
|
-
console.log('\n3๏ธโฃ Testing Normal Content Query (should use 1000 default)...');
|
|
42
|
-
const normalResult = await operationsMCP.handleTool('snow_query_table', {
|
|
43
|
-
table: 'sc_request',
|
|
44
|
-
query: 'active=true',
|
|
45
|
-
include_content: true // Normal content
|
|
46
|
-
});
|
|
47
|
-
console.log('โ
Normal content test completed');
|
|
48
|
-
// Test 4: Explicit Limit (should be respected)
|
|
49
|
-
console.log('\n4๏ธโฃ Testing Explicit Limit (should override smart defaults)...');
|
|
50
|
-
const explicitResult = await operationsMCP.handleTool('snow_query_table', {
|
|
51
|
-
table: 'incident',
|
|
52
|
-
query: 'priority=1',
|
|
53
|
-
limit: 42, // Explicit limit should be used
|
|
54
|
-
include_content: true
|
|
55
|
-
});
|
|
56
|
-
console.log('โ
Explicit limit test completed');
|
|
57
|
-
// Test 5: ML Warning Detection
|
|
58
|
-
console.log('\n5๏ธโฃ Testing ML Warning for Low Limits...');
|
|
59
|
-
const lowLimitMLResult = await operationsMCP.handleTool('snow_query_table', {
|
|
60
|
-
table: 'incident',
|
|
61
|
-
query: 'ml training data', // ML context
|
|
62
|
-
limit: 50, // Too low for ML
|
|
63
|
-
include_content: true
|
|
64
|
-
});
|
|
65
|
-
console.log('โ
ML warning test completed');
|
|
66
|
-
// Summary
|
|
67
|
-
console.log('\n' + 'โ'.repeat(60));
|
|
68
|
-
console.log('\n๐ SMART LIMITS TEST SUMMARY:\n');
|
|
69
|
-
console.log('โ
ML context detection: Implemented (auto 5000 limit)');
|
|
70
|
-
console.log('โ
Count-only optimization: Implemented (auto 2000 limit)');
|
|
71
|
-
console.log('โ
Normal content balance: Implemented (auto 1000 limit)');
|
|
72
|
-
console.log('โ
Explicit limit respect: Implemented (user choice honored)');
|
|
73
|
-
console.log('โ
ML warning system: Implemented (warns on low ML limits)');
|
|
74
|
-
console.log('\n๐ฏ Key Improvements:');
|
|
75
|
-
console.log('โข Default limit increased from 10 โ Context-aware (1000-5000)');
|
|
76
|
-
console.log('โข ML training gets 5000 records automatically');
|
|
77
|
-
console.log('โข Count queries get 2000 records (99.9% memory efficient)');
|
|
78
|
-
console.log('โข Explicit limits always respected');
|
|
79
|
-
console.log('โข Warnings for suboptimal ML configurations');
|
|
80
|
-
console.log('\n๐ก For Users:');
|
|
81
|
-
console.log('1. No more "Found 0 incidents" with hidden 10-limit!');
|
|
82
|
-
console.log('2. ML training works out-of-the-box with sufficient data');
|
|
83
|
-
console.log('3. Smart defaults optimize for memory vs. accuracy');
|
|
84
|
-
console.log('4. System warns when limits might be too low');
|
|
85
|
-
console.log('\n๐ Ready for production! Update to v2.9.0');
|
|
86
|
-
}
|
|
87
|
-
catch (error) {
|
|
88
|
-
logger.error('Smart limits test failed:', error);
|
|
89
|
-
console.log('\nโ Test Failed:', error.message);
|
|
90
|
-
console.log('\n๐ง Debug Steps:');
|
|
91
|
-
console.log('1. Check MCP server status: snow-flow mcp status');
|
|
92
|
-
console.log('2. Verify auth: snow-flow auth status');
|
|
93
|
-
console.log('3. Check network connectivity to ServiceNow');
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
// Run test
|
|
97
|
-
if (require.main === module) {
|
|
98
|
-
testSmartLimits().catch(console.error);
|
|
99
|
-
}
|
|
100
|
-
//# sourceMappingURL=test-smart-limits.js.map
|