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
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.PerformanceBenchmark = void 0;
|
|
5
|
-
const servicenow_client_js_1 = require("./utils/servicenow-client.js");
|
|
6
|
-
const logger_js_1 = require("./utils/logger.js");
|
|
7
|
-
class PerformanceBenchmark {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.results = [];
|
|
10
|
-
this.client = new servicenow_client_js_1.ServiceNowClient();
|
|
11
|
-
this.logger = new logger_js_1.Logger('Benchmark');
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Measure memory usage of a data structure
|
|
15
|
-
*/
|
|
16
|
-
measureMemory(data) {
|
|
17
|
-
const jsonString = JSON.stringify(data);
|
|
18
|
-
return Buffer.byteLength(jsonString, 'utf8');
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Format bytes to human readable string
|
|
22
|
-
*/
|
|
23
|
-
formatBytes(bytes) {
|
|
24
|
-
if (bytes < 1024)
|
|
25
|
-
return `${bytes} B`;
|
|
26
|
-
if (bytes < 1024 * 1024)
|
|
27
|
-
return `${(bytes / 1024).toFixed(2)} KB`;
|
|
28
|
-
return `${(bytes / (1024 * 1024)).toFixed(2)} MB`;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Benchmark count-only queries (minimal memory footprint)
|
|
32
|
-
*/
|
|
33
|
-
async benchmarkCountOnly() {
|
|
34
|
-
console.log('\nš Benchmarking COUNT-ONLY Queries...\n');
|
|
35
|
-
const tables = ['incident', 'sc_request', 'problem', 'change_request'];
|
|
36
|
-
for (const table of tables) {
|
|
37
|
-
const startTime = Date.now();
|
|
38
|
-
// Count-only query
|
|
39
|
-
const response = await this.client.searchRecords(table, 'active=true', 100);
|
|
40
|
-
const count = response.data?.result?.length || 0;
|
|
41
|
-
// Minimal memory structure
|
|
42
|
-
const result = { count };
|
|
43
|
-
const executionTime = Date.now() - startTime;
|
|
44
|
-
const memoryUsed = this.measureMemory(result);
|
|
45
|
-
this.results.push({
|
|
46
|
-
operation: `${table} count-only`,
|
|
47
|
-
executionTime,
|
|
48
|
-
memoryUsed,
|
|
49
|
-
recordsProcessed: count,
|
|
50
|
-
efficiency: `${(count / (memoryUsed / 1024)).toFixed(2)} records/KB`
|
|
51
|
-
});
|
|
52
|
-
console.log(`ā
${table}: ${count} records`);
|
|
53
|
-
console.log(` Time: ${executionTime}ms | Memory: ${this.formatBytes(memoryUsed)}`);
|
|
54
|
-
console.log(` Efficiency: ${(count / (memoryUsed / 1024)).toFixed(2)} records/KB\n`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Benchmark specific field queries (optimized memory)
|
|
59
|
-
*/
|
|
60
|
-
async benchmarkSpecificFields() {
|
|
61
|
-
console.log('\nšÆ Benchmarking SPECIFIC FIELDS Queries...\n');
|
|
62
|
-
const startTime = Date.now();
|
|
63
|
-
// Fetch only essential fields
|
|
64
|
-
const response = await this.client.searchRecords('incident', 'priority=1', 50);
|
|
65
|
-
const filtered = response.data?.result?.map((inc) => ({
|
|
66
|
-
number: inc.number,
|
|
67
|
-
short_description: inc.short_description,
|
|
68
|
-
priority: inc.priority,
|
|
69
|
-
state: inc.state
|
|
70
|
-
})) || [];
|
|
71
|
-
const executionTime = Date.now() - startTime;
|
|
72
|
-
const memoryUsed = this.measureMemory(filtered);
|
|
73
|
-
this.results.push({
|
|
74
|
-
operation: 'incident specific fields',
|
|
75
|
-
executionTime,
|
|
76
|
-
memoryUsed,
|
|
77
|
-
recordsProcessed: filtered.length,
|
|
78
|
-
efficiency: `${(filtered.length / (memoryUsed / 1024)).toFixed(2)} records/KB`
|
|
79
|
-
});
|
|
80
|
-
console.log(`ā
Incidents with specific fields: ${filtered.length} records`);
|
|
81
|
-
console.log(` Time: ${executionTime}ms | Memory: ${this.formatBytes(memoryUsed)}`);
|
|
82
|
-
console.log(` Sample:`, filtered[0] || 'No data');
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Benchmark ML batch processing
|
|
86
|
-
*/
|
|
87
|
-
async benchmarkMLBatchProcessing() {
|
|
88
|
-
console.log('\nš¤ Benchmarking ML BATCH Processing...\n');
|
|
89
|
-
const batchSizes = [50, 100, 200];
|
|
90
|
-
for (const batchSize of batchSizes) {
|
|
91
|
-
const startTime = Date.now();
|
|
92
|
-
const batches = [];
|
|
93
|
-
// Simulate batch processing for ML
|
|
94
|
-
for (let offset = 0; offset < 500; offset += batchSize) {
|
|
95
|
-
const response = await this.client.searchRecords('incident', `sys_created_onONLast 6 months^ORDERBYDESCsys_created_on`, batchSize);
|
|
96
|
-
// Process only what's needed for ML (minimal fields)
|
|
97
|
-
const mlData = response.data?.result?.map((inc) => ({
|
|
98
|
-
text: `${inc.short_description} ${inc.description}`.substring(0, 500),
|
|
99
|
-
category: inc.category || 'uncategorized',
|
|
100
|
-
priority: inc.priority
|
|
101
|
-
})) || [];
|
|
102
|
-
batches.push(mlData);
|
|
103
|
-
// Break after first batch for demo
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
const executionTime = Date.now() - startTime;
|
|
107
|
-
const memoryUsed = this.measureMemory(batches);
|
|
108
|
-
const recordsProcessed = batches.reduce((sum, batch) => sum + batch.length, 0);
|
|
109
|
-
this.results.push({
|
|
110
|
-
operation: `ML batch size ${batchSize}`,
|
|
111
|
-
executionTime,
|
|
112
|
-
memoryUsed,
|
|
113
|
-
recordsProcessed,
|
|
114
|
-
efficiency: `${(recordsProcessed / (memoryUsed / 1024)).toFixed(2)} records/KB`
|
|
115
|
-
});
|
|
116
|
-
console.log(`ā
ML Batch Size ${batchSize}: ${recordsProcessed} records`);
|
|
117
|
-
console.log(` Time: ${executionTime}ms | Memory: ${this.formatBytes(memoryUsed)}`);
|
|
118
|
-
console.log(` Efficiency: ${(recordsProcessed / (memoryUsed / 1024)).toFixed(2)} records/KB\n`);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Compare full content vs optimized queries
|
|
123
|
-
*/
|
|
124
|
-
async benchmarkComparison() {
|
|
125
|
-
console.log('\nāļø Comparing FULL vs OPTIMIZED Queries...\n');
|
|
126
|
-
const limit = 100;
|
|
127
|
-
// Full content query
|
|
128
|
-
const fullStart = Date.now();
|
|
129
|
-
const fullResponse = await this.client.searchRecords('incident', 'active=true', limit);
|
|
130
|
-
const fullTime = Date.now() - fullStart;
|
|
131
|
-
const fullMemory = this.measureMemory(fullResponse.data?.result || []);
|
|
132
|
-
// Optimized query (count + sample)
|
|
133
|
-
const optStart = Date.now();
|
|
134
|
-
const optResponse = await this.client.searchRecords('incident', 'active=true', limit);
|
|
135
|
-
const optimized = {
|
|
136
|
-
count: optResponse.data?.result?.length || 0,
|
|
137
|
-
sample: optResponse.data?.result?.slice(0, 5).map((inc) => ({
|
|
138
|
-
number: inc.number,
|
|
139
|
-
short_description: inc.short_description
|
|
140
|
-
})) || []
|
|
141
|
-
};
|
|
142
|
-
const optTime = Date.now() - optStart;
|
|
143
|
-
const optMemory = this.measureMemory(optimized);
|
|
144
|
-
console.log('š Comparison Results:');
|
|
145
|
-
console.log('ā'.repeat(50));
|
|
146
|
-
console.log('Full Content Query:');
|
|
147
|
-
console.log(` Time: ${fullTime}ms`);
|
|
148
|
-
console.log(` Memory: ${this.formatBytes(fullMemory)}`);
|
|
149
|
-
console.log(` Records: ${fullResponse.data?.result?.length || 0}`);
|
|
150
|
-
console.log();
|
|
151
|
-
console.log('Optimized Query:');
|
|
152
|
-
console.log(` Time: ${optTime}ms`);
|
|
153
|
-
console.log(` Memory: ${this.formatBytes(optMemory)}`);
|
|
154
|
-
console.log(` Records: ${optimized.count}`);
|
|
155
|
-
console.log();
|
|
156
|
-
console.log('š Improvements:');
|
|
157
|
-
console.log(` Memory Saved: ${this.formatBytes(fullMemory - optMemory)} (${((1 - optMemory / fullMemory) * 100).toFixed(1)}% reduction)`);
|
|
158
|
-
console.log(` Speed: ${((fullTime - optTime) / fullTime * 100).toFixed(1)}% faster`);
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Generate summary report
|
|
162
|
-
*/
|
|
163
|
-
generateReport() {
|
|
164
|
-
console.log('\n' + 'ā'.repeat(60));
|
|
165
|
-
console.log('š PERFORMANCE BENCHMARK SUMMARY');
|
|
166
|
-
console.log('ā'.repeat(60));
|
|
167
|
-
console.log('\nš Best Practices for Query Optimization:\n');
|
|
168
|
-
console.log('1. ā
Use COUNT-ONLY for ML training data sizing');
|
|
169
|
-
console.log(' - 99.9% memory savings');
|
|
170
|
-
console.log(' - Instant performance metrics\n');
|
|
171
|
-
console.log('2. ā
Request SPECIFIC FIELDS when possible');
|
|
172
|
-
console.log(' - 70-80% memory reduction');
|
|
173
|
-
console.log(' - Faster network transfer\n');
|
|
174
|
-
console.log('3. ā
Use BATCH PROCESSING for large datasets');
|
|
175
|
-
console.log(' - Prevents memory overflow');
|
|
176
|
-
console.log(' - Enables streaming processing\n');
|
|
177
|
-
console.log('4. ā
Leverage GROUP BY for analytics');
|
|
178
|
-
console.log(' - Pre-aggregated results');
|
|
179
|
-
console.log(' - Minimal data transfer\n');
|
|
180
|
-
console.log('5. ā
Only use FULL CONTENT when necessary');
|
|
181
|
-
console.log(' - Reserve for detailed analysis');
|
|
182
|
-
console.log(' - Consider pagination for large sets\n');
|
|
183
|
-
console.log('š Benchmark Results:');
|
|
184
|
-
console.log('ā'.repeat(60));
|
|
185
|
-
const table = this.results.map(r => ({
|
|
186
|
-
Operation: r.operation,
|
|
187
|
-
Time: `${r.executionTime}ms`,
|
|
188
|
-
Memory: this.formatBytes(r.memoryUsed),
|
|
189
|
-
Records: r.recordsProcessed,
|
|
190
|
-
Efficiency: r.efficiency
|
|
191
|
-
}));
|
|
192
|
-
console.table(table);
|
|
193
|
-
// Calculate average improvements
|
|
194
|
-
const avgMemorySavings = this.results
|
|
195
|
-
.filter(r => r.operation.includes('count'))
|
|
196
|
-
.reduce((sum, r) => sum + (1000000 - r.memoryUsed), 0) / 4;
|
|
197
|
-
console.log('\nšÆ Key Metrics:');
|
|
198
|
-
console.log(`Average Memory Savings: ${this.formatBytes(avgMemorySavings)}`);
|
|
199
|
-
console.log(`ML Training Efficiency: ${this.results.find(r => r.operation.includes('ML'))?.efficiency || 'N/A'}`);
|
|
200
|
-
console.log(`Optimal Batch Size: 100-200 records for balanced performance`);
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Run all benchmarks
|
|
204
|
-
*/
|
|
205
|
-
async runAll() {
|
|
206
|
-
console.log('\nš Starting Snow-Flow Performance Benchmark...\n');
|
|
207
|
-
console.log('This benchmark demonstrates the efficiency improvements');
|
|
208
|
-
console.log('of the universal query tool and ML batch processing.\n');
|
|
209
|
-
console.log('ā'.repeat(60));
|
|
210
|
-
try {
|
|
211
|
-
await this.benchmarkCountOnly();
|
|
212
|
-
await this.benchmarkSpecificFields();
|
|
213
|
-
await this.benchmarkMLBatchProcessing();
|
|
214
|
-
await this.benchmarkComparison();
|
|
215
|
-
this.generateReport();
|
|
216
|
-
console.log('\nā
Benchmark completed successfully!');
|
|
217
|
-
}
|
|
218
|
-
catch (error) {
|
|
219
|
-
this.logger.error('Benchmark failed:', error);
|
|
220
|
-
console.error('\nā Benchmark failed. Check your ServiceNow connection.');
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
exports.PerformanceBenchmark = PerformanceBenchmark;
|
|
225
|
-
// Run benchmark if executed directly
|
|
226
|
-
if (require.main === module) {
|
|
227
|
-
const benchmark = new PerformanceBenchmark();
|
|
228
|
-
benchmark.runAll().catch(console.error);
|
|
229
|
-
}
|
|
230
|
-
//# sourceMappingURL=benchmark-performance.js.map
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Snow-Flow CLI Integration
|
|
3
|
-
* Integrates the hive-mind system with the CLI commands
|
|
4
|
-
*/
|
|
5
|
-
import { Command } from 'commander';
|
|
6
|
-
/**
|
|
7
|
-
* Initialize the swarm command with the integrated system
|
|
8
|
-
*/
|
|
9
|
-
export declare function createSwarmCommand(program: Command): void;
|
|
10
|
-
/**
|
|
11
|
-
* Create status command
|
|
12
|
-
*/
|
|
13
|
-
export declare function createStatusCommand(program: Command): void;
|
|
14
|
-
/**
|
|
15
|
-
* Create monitor command
|
|
16
|
-
*/
|
|
17
|
-
export declare function createMonitorCommand(program: Command): void;
|
|
18
|
-
/**
|
|
19
|
-
* Create memory management commands
|
|
20
|
-
*/
|
|
21
|
-
export declare function createMemoryCommands(program: Command): void;
|
|
22
|
-
/**
|
|
23
|
-
* Create configuration commands
|
|
24
|
-
*/
|
|
25
|
-
export declare function createConfigCommands(program: Command): void;
|
|
26
|
-
/**
|
|
27
|
-
* Integrate all commands with the main program
|
|
28
|
-
*/
|
|
29
|
-
export declare function integrateSnowFlowCommands(program: Command): void;
|
|
30
|
-
//# sourceMappingURL=snow-flow-cli-integration.d.ts.map
|
|
@@ -1,396 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Snow-Flow CLI Integration
|
|
4
|
-
* Integrates the hive-mind system with the CLI commands
|
|
5
|
-
*/
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.createSwarmCommand = createSwarmCommand;
|
|
11
|
-
exports.createStatusCommand = createStatusCommand;
|
|
12
|
-
exports.createMonitorCommand = createMonitorCommand;
|
|
13
|
-
exports.createMemoryCommands = createMemoryCommands;
|
|
14
|
-
exports.createConfigCommands = createConfigCommands;
|
|
15
|
-
exports.integrateSnowFlowCommands = integrateSnowFlowCommands;
|
|
16
|
-
const snow_flow_system_1 = require("../snow-flow-system");
|
|
17
|
-
const snow_flow_config_1 = require("../config/snow-flow-config");
|
|
18
|
-
const logger_1 = require("../utils/logger");
|
|
19
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
20
|
-
const ora_1 = __importDefault(require("ora"));
|
|
21
|
-
const logger = new logger_1.Logger('SnowFlowCLI');
|
|
22
|
-
/**
|
|
23
|
-
* Initialize the swarm command with the integrated system
|
|
24
|
-
*/
|
|
25
|
-
function createSwarmCommand(program) {
|
|
26
|
-
program
|
|
27
|
-
.command('swarm <objective>')
|
|
28
|
-
.description('š Execute multi-agent swarm coordination with REVOLUTIONARY Parallel Agent Engine (v1.1.90) - automatically spawns specialized agent teams working simultaneously with 2-5x performance improvement')
|
|
29
|
-
.option('--strategy <strategy>', 'Swarm strategy', 'development')
|
|
30
|
-
.option('--mode <mode>', 'Coordination mode', 'hierarchical')
|
|
31
|
-
.option('--max-agents <number>', 'Maximum number of agents', '10')
|
|
32
|
-
.option('--parallel', 'Enable parallel execution (auto-detected by default in v1.1.90)')
|
|
33
|
-
.option('--monitor', 'Real-time monitoring')
|
|
34
|
-
.option('--no-auto-permissions', 'Disable automatic permission escalation')
|
|
35
|
-
.option('--no-smart-discovery', 'Disable smart artifact discovery')
|
|
36
|
-
.option('--no-live-testing', 'Disable live testing')
|
|
37
|
-
.option('--no-auto-deploy', 'Disable automatic deployment')
|
|
38
|
-
.option('--no-auto-rollback', 'Disable automatic rollback')
|
|
39
|
-
.option('--no-shared-memory', 'Disable shared memory')
|
|
40
|
-
.option('--no-progress-monitoring', 'Disable progress monitoring')
|
|
41
|
-
.action(async (objective, options) => {
|
|
42
|
-
const spinner = (0, ora_1.default)('Initializing Snow-Flow System...').start();
|
|
43
|
-
try {
|
|
44
|
-
// Initialize system
|
|
45
|
-
await snow_flow_system_1.snowFlowSystem.initialize();
|
|
46
|
-
spinner.succeed('System initialized');
|
|
47
|
-
// Parse options
|
|
48
|
-
const swarmOptions = {
|
|
49
|
-
strategy: options.strategy,
|
|
50
|
-
mode: options.mode,
|
|
51
|
-
maxAgents: parseInt(options.maxAgents) || 10,
|
|
52
|
-
parallel: options.parallel,
|
|
53
|
-
monitor: options.monitor,
|
|
54
|
-
autoPermissions: options.autoPermissions,
|
|
55
|
-
smartDiscovery: options.smartDiscovery,
|
|
56
|
-
liveTesting: options.liveTesting,
|
|
57
|
-
autoDeploy: options.autoDeploy,
|
|
58
|
-
autoRollback: options.autoRollback,
|
|
59
|
-
sharedMemory: options.sharedMemory,
|
|
60
|
-
progressMonitoring: options.progressMonitoring
|
|
61
|
-
};
|
|
62
|
-
console.log(chalk_1.default.cyan('\nš Starting Swarm Execution'));
|
|
63
|
-
console.log(chalk_1.default.yellow('š NEW v1.1.93: Revolutionary Parallel Agent Spawning - 6+ specialized agents for 2.8x faster development!'));
|
|
64
|
-
console.log(chalk_1.default.gray('Objective:'), objective);
|
|
65
|
-
console.log(chalk_1.default.gray('Strategy:'), swarmOptions.strategy);
|
|
66
|
-
console.log(chalk_1.default.gray('Mode:'), swarmOptions.mode);
|
|
67
|
-
// Set up progress monitoring
|
|
68
|
-
if (swarmOptions.progressMonitoring) {
|
|
69
|
-
snow_flow_system_1.snowFlowSystem.on('swarm:progress', (data) => {
|
|
70
|
-
const { sessionId, progress } = data;
|
|
71
|
-
console.log(chalk_1.default.blue(`[${sessionId}]`), `Progress: ${progress.completed}/${progress.total} tasks`);
|
|
72
|
-
});
|
|
73
|
-
snow_flow_system_1.snowFlowSystem.on('agent:spawned', (agent) => {
|
|
74
|
-
console.log(chalk_1.default.green('ā
Agent spawned:'), agent.type);
|
|
75
|
-
if (agent.specialization) {
|
|
76
|
-
console.log(chalk_1.default.blue(' šÆ Specialization:'), agent.specialization);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
snow_flow_system_1.snowFlowSystem.on('agent:completed', (agent) => {
|
|
80
|
-
console.log(chalk_1.default.green('ā
Agent completed:'), agent.type);
|
|
81
|
-
});
|
|
82
|
-
snow_flow_system_1.snowFlowSystem.on('parallel:detected', (data) => {
|
|
83
|
-
console.log(chalk_1.default.magenta('š Parallel opportunities detected:'), data.opportunities.length);
|
|
84
|
-
data.opportunities.forEach((opp, index) => {
|
|
85
|
-
console.log(chalk_1.default.cyan(` ${index + 1}. ${opp.type}: ${opp.agentCount} agents, estimated ${opp.estimatedSpeedup}x speedup`));
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
// Execute swarm
|
|
90
|
-
const startTime = Date.now();
|
|
91
|
-
const result = await snow_flow_system_1.snowFlowSystem.executeSwarm(objective, swarmOptions);
|
|
92
|
-
const duration = Date.now() - startTime;
|
|
93
|
-
// Display results
|
|
94
|
-
console.log(chalk_1.default.green('\nā
Swarm execution completed successfully!'));
|
|
95
|
-
console.log(chalk_1.default.gray('Session ID:'), result.sessionId);
|
|
96
|
-
console.log(chalk_1.default.gray('Duration:'), `${(duration / 1000).toFixed(2)}s`);
|
|
97
|
-
console.log(chalk_1.default.gray('Artifacts created:'), result.artifacts.length);
|
|
98
|
-
if (result.artifacts.length > 0) {
|
|
99
|
-
console.log(chalk_1.default.yellow('\nš¦ Created Artifacts:'));
|
|
100
|
-
result.artifacts.forEach((artifact, index) => {
|
|
101
|
-
console.log(` ${index + 1}. ${artifact.type}: ${artifact.name} (${artifact.sys_id})`);
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
console.log(chalk_1.default.cyan('\nš Summary:'));
|
|
105
|
-
console.log(result.summary);
|
|
106
|
-
// Show metrics if available
|
|
107
|
-
if (result.metrics && Object.keys(result.metrics).length > 0) {
|
|
108
|
-
console.log(chalk_1.default.yellow('\nš Performance Metrics:'));
|
|
109
|
-
console.log(JSON.stringify(result.metrics, null, 2));
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
catch (error) {
|
|
113
|
-
spinner.fail('Swarm execution failed');
|
|
114
|
-
logger.error('Swarm execution error:', error);
|
|
115
|
-
console.error(chalk_1.default.red('\nā Error:'), error.message);
|
|
116
|
-
process.exit(1);
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Create status command
|
|
122
|
-
*/
|
|
123
|
-
function createStatusCommand(program) {
|
|
124
|
-
program
|
|
125
|
-
.command('status')
|
|
126
|
-
.description('Show comprehensive system status')
|
|
127
|
-
.action(async () => {
|
|
128
|
-
const spinner = (0, ora_1.default)('Checking system status...').start();
|
|
129
|
-
try {
|
|
130
|
-
const status = await snow_flow_system_1.snowFlowSystem.getStatus();
|
|
131
|
-
spinner.stop();
|
|
132
|
-
// Display system status
|
|
133
|
-
console.log(chalk_1.default.bold('\nš Snow-Flow System Status\n'));
|
|
134
|
-
const statusIcon = status.status === 'healthy' ? 'ā
' :
|
|
135
|
-
status.status === 'degraded' ? 'ā ļø' : 'ā';
|
|
136
|
-
console.log(`${statusIcon} Overall Status: ${chalk_1.default.bold(status.status.toUpperCase())}`);
|
|
137
|
-
console.log(chalk_1.default.gray('Initialized:'), status.initialized ? 'Yes' : 'No');
|
|
138
|
-
if (status.components) {
|
|
139
|
-
console.log(chalk_1.default.yellow('\nš¦ Component Health:'));
|
|
140
|
-
for (const [component, health] of Object.entries(status.components)) {
|
|
141
|
-
const icon = health.status === 'healthy' ? 'ā
' :
|
|
142
|
-
health.status === 'degraded' ? 'ā ļø' : 'ā';
|
|
143
|
-
console.log(` ${icon} ${component}: ${health.status}`);
|
|
144
|
-
if (health.message) {
|
|
145
|
-
console.log(chalk_1.default.gray(` ${health.message}`));
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if (status.activeSessions !== undefined) {
|
|
150
|
-
console.log(chalk_1.default.yellow('\nš Activity:'));
|
|
151
|
-
console.log(` - Active Sessions: ${status.activeSessions}`);
|
|
152
|
-
}
|
|
153
|
-
if (status.metrics) {
|
|
154
|
-
console.log(chalk_1.default.yellow('\nš System Metrics:'));
|
|
155
|
-
console.log(` - Total Sessions: ${status.metrics.totalSessions}`);
|
|
156
|
-
console.log(` - Success Rate: ${status.metrics.successRate.toFixed(2)}%`);
|
|
157
|
-
console.log(` - Avg Execution Time: ${(status.metrics.averageExecutionTime / 1000).toFixed(2)}s`);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
catch (error) {
|
|
161
|
-
spinner.fail('Failed to get system status');
|
|
162
|
-
console.error(chalk_1.default.red('Error:'), error.message);
|
|
163
|
-
process.exit(1);
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Create monitor command
|
|
169
|
-
*/
|
|
170
|
-
function createMonitorCommand(program) {
|
|
171
|
-
program
|
|
172
|
-
.command('monitor')
|
|
173
|
-
.description('Real-time system monitoring dashboard')
|
|
174
|
-
.option('--interval <ms>', 'Update interval in milliseconds', '5000')
|
|
175
|
-
.action(async (options) => {
|
|
176
|
-
console.log(chalk_1.default.bold.cyan('\nš Snow-Flow Real-time Monitor\n'));
|
|
177
|
-
console.log(chalk_1.default.gray('Press Ctrl+C to exit'));
|
|
178
|
-
console.log(chalk_1.default.gray('='.repeat(50)));
|
|
179
|
-
try {
|
|
180
|
-
// Initialize system if needed
|
|
181
|
-
const status = snow_flow_system_1.snowFlowSystem.getStatus();
|
|
182
|
-
if (!status.initialized) {
|
|
183
|
-
await snow_flow_system_1.snowFlowSystem.initialize();
|
|
184
|
-
}
|
|
185
|
-
// Set up event listeners
|
|
186
|
-
snow_flow_system_1.snowFlowSystem.on('swarm:progress', (data) => {
|
|
187
|
-
console.log(chalk_1.default.blue(`\n[${new Date().toISOString()}] Swarm Progress`));
|
|
188
|
-
console.log(` Session: ${data.sessionId}`);
|
|
189
|
-
console.log(` Progress: ${data.progress.completed}/${data.progress.total}`);
|
|
190
|
-
});
|
|
191
|
-
snow_flow_system_1.snowFlowSystem.on('agent:spawned', (agent) => {
|
|
192
|
-
console.log(chalk_1.default.green(`\n[${new Date().toISOString()}] Agent Spawned`));
|
|
193
|
-
console.log(` Type: ${agent.type}`);
|
|
194
|
-
console.log(` ID: ${agent.id}`);
|
|
195
|
-
});
|
|
196
|
-
snow_flow_system_1.snowFlowSystem.on('performance:metric', (metric) => {
|
|
197
|
-
console.log(chalk_1.default.yellow(`\n[${new Date().toISOString()}] Performance Metric`));
|
|
198
|
-
console.log(` Operation: ${metric.operation}`);
|
|
199
|
-
console.log(` Duration: ${metric.duration}ms`);
|
|
200
|
-
console.log(` Success: ${metric.success}`);
|
|
201
|
-
});
|
|
202
|
-
snow_flow_system_1.snowFlowSystem.on('health:alert', (alert) => {
|
|
203
|
-
console.log(chalk_1.default.red(`\n[${new Date().toISOString()}] Health Alert`));
|
|
204
|
-
console.log(` Type: ${alert.type}`);
|
|
205
|
-
console.log(` Severity: ${alert.severity}`);
|
|
206
|
-
console.log(` Message: ${alert.message}`);
|
|
207
|
-
});
|
|
208
|
-
// Periodic status update
|
|
209
|
-
const updateInterval = parseInt(options.interval) || 5000;
|
|
210
|
-
setInterval(async () => {
|
|
211
|
-
const status = await snow_flow_system_1.snowFlowSystem.getStatus();
|
|
212
|
-
const sessions = snow_flow_system_1.snowFlowSystem.listSessions({ status: 'active' });
|
|
213
|
-
console.log(chalk_1.default.dim(`\n[${new Date().toISOString()}] Status Update`));
|
|
214
|
-
console.log(chalk_1.default.dim(` System: ${status.status}`));
|
|
215
|
-
console.log(chalk_1.default.dim(` Active Sessions: ${sessions.length}`));
|
|
216
|
-
if (sessions.length > 0) {
|
|
217
|
-
sessions.forEach(session => {
|
|
218
|
-
console.log(chalk_1.default.dim(` - ${session.id}: ${session.completedTasks}/${session.totalTasks} tasks`));
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
}, updateInterval);
|
|
222
|
-
// Keep process running
|
|
223
|
-
process.stdin.resume();
|
|
224
|
-
}
|
|
225
|
-
catch (error) {
|
|
226
|
-
console.error(chalk_1.default.red('Monitor error:'), error.message);
|
|
227
|
-
process.exit(1);
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Create memory management commands
|
|
233
|
-
*/
|
|
234
|
-
function createMemoryCommands(program) {
|
|
235
|
-
const memory = program
|
|
236
|
-
.command('memory')
|
|
237
|
-
.description('Manage persistent memory system');
|
|
238
|
-
memory
|
|
239
|
-
.command('store <key> <value>')
|
|
240
|
-
.description('Store data in memory')
|
|
241
|
-
.option('--ttl <ms>', 'Time to live in milliseconds')
|
|
242
|
-
.action(async (key, value, options) => {
|
|
243
|
-
try {
|
|
244
|
-
await snow_flow_system_1.snowFlowSystem.initialize();
|
|
245
|
-
const memorySystem = snow_flow_system_1.snowFlowSystem.getMemory();
|
|
246
|
-
if (!memorySystem) {
|
|
247
|
-
throw new Error('Memory system not available');
|
|
248
|
-
}
|
|
249
|
-
// Parse value as JSON if possible
|
|
250
|
-
let parsedValue;
|
|
251
|
-
try {
|
|
252
|
-
parsedValue = JSON.parse(value);
|
|
253
|
-
}
|
|
254
|
-
catch {
|
|
255
|
-
parsedValue = value;
|
|
256
|
-
}
|
|
257
|
-
await memorySystem.store(key, parsedValue, options.ttl ? parseInt(options.ttl) : undefined);
|
|
258
|
-
console.log(chalk_1.default.green('ā
Data stored successfully'));
|
|
259
|
-
}
|
|
260
|
-
catch (error) {
|
|
261
|
-
console.error(chalk_1.default.red('Error:'), error.message);
|
|
262
|
-
process.exit(1);
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
memory
|
|
266
|
-
.command('get <key>')
|
|
267
|
-
.description('Retrieve data from memory')
|
|
268
|
-
.action(async (key) => {
|
|
269
|
-
try {
|
|
270
|
-
await snow_flow_system_1.snowFlowSystem.initialize();
|
|
271
|
-
const memorySystem = snow_flow_system_1.snowFlowSystem.getMemory();
|
|
272
|
-
if (!memorySystem) {
|
|
273
|
-
throw new Error('Memory system not available');
|
|
274
|
-
}
|
|
275
|
-
const value = await memorySystem.get(key);
|
|
276
|
-
if (value === null) {
|
|
277
|
-
console.log(chalk_1.default.yellow('Key not found or expired'));
|
|
278
|
-
}
|
|
279
|
-
else {
|
|
280
|
-
console.log(chalk_1.default.green('Value:'));
|
|
281
|
-
console.log(JSON.stringify(value, null, 2));
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
catch (error) {
|
|
285
|
-
console.error(chalk_1.default.red('Error:'), error.message);
|
|
286
|
-
process.exit(1);
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
memory
|
|
290
|
-
.command('stats')
|
|
291
|
-
.description('Show memory system statistics')
|
|
292
|
-
.action(async () => {
|
|
293
|
-
try {
|
|
294
|
-
await snow_flow_system_1.snowFlowSystem.initialize();
|
|
295
|
-
const memorySystem = snow_flow_system_1.snowFlowSystem.getMemory();
|
|
296
|
-
if (!memorySystem) {
|
|
297
|
-
throw new Error('Memory system not available');
|
|
298
|
-
}
|
|
299
|
-
const dbStats = await memorySystem.getDatabaseStats();
|
|
300
|
-
const cacheStats = await memorySystem.getCacheStats();
|
|
301
|
-
console.log(chalk_1.default.bold('\nš¾ Memory System Statistics\n'));
|
|
302
|
-
console.log(chalk_1.default.yellow('Database:'));
|
|
303
|
-
console.log(` Size: ${(dbStats.size / 1024 / 1024).toFixed(2)} MB`);
|
|
304
|
-
console.log(` Tables: ${dbStats.tableCount}`);
|
|
305
|
-
console.log(` Row Counts:`);
|
|
306
|
-
for (const [table, count] of Object.entries(dbStats.rowCounts)) {
|
|
307
|
-
console.log(` - ${table}: ${count} rows`);
|
|
308
|
-
}
|
|
309
|
-
console.log(chalk_1.default.yellow('\nCache:'));
|
|
310
|
-
console.log(` Size: ${cacheStats.size} entries`);
|
|
311
|
-
console.log(` Hits: ${cacheStats.hits}`);
|
|
312
|
-
console.log(` Misses: ${cacheStats.misses}`);
|
|
313
|
-
console.log(` Hit Rate: ${cacheStats.hits + cacheStats.misses > 0 ?
|
|
314
|
-
((cacheStats.hits / (cacheStats.hits + cacheStats.misses)) * 100).toFixed(2) : 0}%`);
|
|
315
|
-
console.log(` Evictions: ${cacheStats.evictions}`);
|
|
316
|
-
}
|
|
317
|
-
catch (error) {
|
|
318
|
-
console.error(chalk_1.default.red('Error:'), error.message);
|
|
319
|
-
process.exit(1);
|
|
320
|
-
}
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* Create configuration commands
|
|
325
|
-
*/
|
|
326
|
-
function createConfigCommands(program) {
|
|
327
|
-
const config = program
|
|
328
|
-
.command('config')
|
|
329
|
-
.description('Configuration management');
|
|
330
|
-
config
|
|
331
|
-
.command('show')
|
|
332
|
-
.description('Show current configuration')
|
|
333
|
-
.action(() => {
|
|
334
|
-
const currentConfig = snow_flow_config_1.snowFlowConfig.get();
|
|
335
|
-
console.log(chalk_1.default.bold('\nāļø Snow-Flow Configuration\n'));
|
|
336
|
-
console.log(JSON.stringify(currentConfig, null, 2));
|
|
337
|
-
});
|
|
338
|
-
config
|
|
339
|
-
.command('get <path>')
|
|
340
|
-
.description('Get a specific configuration value')
|
|
341
|
-
.action((path) => {
|
|
342
|
-
const value = snow_flow_config_1.snowFlowConfig.getValue(path);
|
|
343
|
-
if (value === undefined) {
|
|
344
|
-
console.log(chalk_1.default.yellow('Configuration key not found'));
|
|
345
|
-
}
|
|
346
|
-
else {
|
|
347
|
-
console.log(chalk_1.default.green('Value:'), JSON.stringify(value, null, 2));
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
config
|
|
351
|
-
.command('set <path> <value>')
|
|
352
|
-
.description('Set a configuration value')
|
|
353
|
-
.action((path, value) => {
|
|
354
|
-
try {
|
|
355
|
-
// Parse value as JSON if possible
|
|
356
|
-
let parsedValue;
|
|
357
|
-
try {
|
|
358
|
-
parsedValue = JSON.parse(value);
|
|
359
|
-
}
|
|
360
|
-
catch {
|
|
361
|
-
parsedValue = value;
|
|
362
|
-
}
|
|
363
|
-
snow_flow_config_1.snowFlowConfig.setValue(path, parsedValue);
|
|
364
|
-
console.log(chalk_1.default.green('ā
Configuration updated'));
|
|
365
|
-
}
|
|
366
|
-
catch (error) {
|
|
367
|
-
console.error(chalk_1.default.red('Error:'), error.message);
|
|
368
|
-
process.exit(1);
|
|
369
|
-
}
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Integrate all commands with the main program
|
|
374
|
-
*/
|
|
375
|
-
function integrateSnowFlowCommands(program) {
|
|
376
|
-
// Add all integrated commands
|
|
377
|
-
createSwarmCommand(program);
|
|
378
|
-
createStatusCommand(program);
|
|
379
|
-
createMonitorCommand(program);
|
|
380
|
-
createMemoryCommands(program);
|
|
381
|
-
createConfigCommands(program);
|
|
382
|
-
// Add shutdown handler
|
|
383
|
-
process.on('SIGINT', async () => {
|
|
384
|
-
console.log(chalk_1.default.yellow('\n\nShutting down Snow-Flow System...'));
|
|
385
|
-
try {
|
|
386
|
-
await snow_flow_system_1.snowFlowSystem.shutdown();
|
|
387
|
-
console.log(chalk_1.default.green('ā
Shutdown complete'));
|
|
388
|
-
process.exit(0);
|
|
389
|
-
}
|
|
390
|
-
catch (error) {
|
|
391
|
-
console.error(chalk_1.default.red('Shutdown error:'), error);
|
|
392
|
-
process.exit(1);
|
|
393
|
-
}
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
//# sourceMappingURL=snow-flow-cli-integration.js.map
|