ciscollm-cli 1.3.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/cli/commands/dashboardCommand.d.ts +1 -0
  2. package/dist/cli/commands/dashboardCommand.js +16 -0
  3. package/dist/cli/commands/dashboardCommand.js.map +1 -0
  4. package/dist/cli/commands/monitorCommand.d.ts +4 -0
  5. package/dist/cli/commands/monitorCommand.js +132 -0
  6. package/dist/cli/commands/monitorCommand.js.map +1 -0
  7. package/dist/cli/commands/runCommand.d.ts +6 -0
  8. package/dist/cli/commands/runCommand.js +635 -0
  9. package/dist/cli/commands/runCommand.js.map +1 -0
  10. package/dist/cli/commands/serverCommand.d.ts +1 -0
  11. package/dist/cli/commands/serverCommand.js +11 -0
  12. package/dist/cli/commands/serverCommand.js.map +1 -0
  13. package/dist/cli/commands/shellCommand.d.ts +1 -0
  14. package/dist/cli/commands/shellCommand.js +44 -0
  15. package/dist/cli/commands/shellCommand.js.map +1 -0
  16. package/dist/core/agent/AgentLoop.d.ts +0 -4
  17. package/dist/core/agent/AgentLoop.js +1 -158
  18. package/dist/core/agent/AgentLoop.js.map +1 -1
  19. package/dist/core/agent/AutoHealer.d.ts +12 -0
  20. package/dist/core/agent/AutoHealer.js +106 -3
  21. package/dist/core/agent/AutoHealer.js.map +1 -1
  22. package/dist/core/agent/PromptEngine.js +27 -63
  23. package/dist/core/agent/PromptEngine.js.map +1 -1
  24. package/dist/index.js +24 -903
  25. package/dist/index.js.map +1 -1
  26. package/dist/infrastructure/llm/LLMClient.js +102 -4
  27. package/dist/infrastructure/llm/LLMClient.js.map +1 -1
  28. package/dist/infrastructure/llm/ToolDefinitions.d.ts +0 -136
  29. package/dist/infrastructure/llm/ToolDefinitions.js +0 -102
  30. package/dist/infrastructure/llm/ToolDefinitions.js.map +1 -1
  31. package/dist/server/shell-simulator.d.ts +11 -0
  32. package/dist/server/shell-simulator.js +346 -4
  33. package/dist/server/shell-simulator.js.map +1 -1
  34. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ export declare function dashboardAction(options: any): void;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.dashboardAction = dashboardAction;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const MultiAgentCoordinator_1 = require("../../core/agent/MultiAgentCoordinator");
9
+ const dashboard_1 = require("../../server/dashboard");
10
+ function dashboardAction(options) {
11
+ const port = parseInt(options.port, 10);
12
+ const coordinator = new MultiAgentCoordinator_1.MultiAgentCoordinator();
13
+ (0, dashboard_1.startDashboardServer)(coordinator, port);
14
+ console.log(chalk_1.default.yellow('Standalone mode: Visualizing historical records and active topology when connected.'));
15
+ }
16
+ //# sourceMappingURL=dashboardCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dashboardCommand.js","sourceRoot":"","sources":["../../../src/cli/commands/dashboardCommand.ts"],"names":[],"mappings":";;;;;AAIA,0CAKC;AATD,kDAA0B;AAC1B,kFAA+E;AAC/E,sDAA8D;AAE9D,SAAgB,eAAe,CAAC,OAAY;IACxC,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACxC,MAAM,WAAW,GAAG,IAAI,6CAAqB,EAAE,CAAC;IAChD,IAAA,gCAAoB,EAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IACxC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,qFAAqF,CAAC,CAAC,CAAC;AACrH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { MultiAgentCoordinator } from '../../core/agent/MultiAgentCoordinator';
2
+ export declare function monitorAction(options: any, coordinatorWrapper: {
3
+ active: MultiAgentCoordinator | null;
4
+ }, cleanup: () => Promise<void>): Promise<void>;
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.monitorAction = monitorAction;
4
+ const fs_1 = require("fs");
5
+ const MultiAgentCoordinator_1 = require("../../core/agent/MultiAgentCoordinator");
6
+ const PlinkSerial_1 = require("../../infrastructure/protocols/PlinkSerial");
7
+ const SshSession_1 = require("../../infrastructure/protocols/SshSession");
8
+ const TelnetSession_1 = require("../../infrastructure/protocols/TelnetSession");
9
+ const LLMClient_1 = require("../../infrastructure/llm/LLMClient");
10
+ const ui_1 = require("../ui/ui");
11
+ async function monitorAction(options, coordinatorWrapper, cleanup) {
12
+ let provider = options.provider;
13
+ let localType = options.localType;
14
+ if (localType) {
15
+ localType = localType.toLowerCase().trim();
16
+ if (localType === 'llmstudio') {
17
+ localType = 'lmstudio';
18
+ }
19
+ }
20
+ let apiKey = options.api_key || options.apiKey;
21
+ let model = options.model;
22
+ let endpoint = options.endpoint;
23
+ let protocol = options.protocol;
24
+ let com = options.com;
25
+ let baud = options.baud;
26
+ let host = options.host;
27
+ let port = options.port;
28
+ let username = options.username;
29
+ let privateKey;
30
+ if (options.privateKey) {
31
+ privateKey = (0, fs_1.readFileSync)(options.privateKey, 'utf8');
32
+ }
33
+ let password = options.envPassword
34
+ ? (process.env.CISCOLLM_PASS || '')
35
+ : options.password;
36
+ let nonInteractive = options.nonInteractive === true;
37
+ let minConfidence = parseFloat(options.minConfidence || '0.80');
38
+ ui_1.logger.banner();
39
+ ui_1.logger.info(`Initializing auto-healing monitoring in [${provider.toUpperCase()}] mode...`);
40
+ if (!localType)
41
+ localType = 'ollama';
42
+ coordinatorWrapper.active = new MultiAgentCoordinator_1.MultiAgentCoordinator();
43
+ try {
44
+ if (protocol === 'serial') {
45
+ if (!com) {
46
+ throw new Error('COM port (-c, --com) is required for serial protocol connections.');
47
+ }
48
+ const ports = com.split(',').map((p) => p.trim()).filter((p) => p.length > 0);
49
+ for (const port of ports) {
50
+ const session = new PlinkSerial_1.PlinkSerialSession(port, parseInt(baud, 10));
51
+ coordinatorWrapper.active.registerSession(port, session);
52
+ }
53
+ }
54
+ else if (protocol === 'ssh') {
55
+ if (!host || !username) {
56
+ throw new Error('Host (--host) and Username (-u, --username) are required for SSH connections.');
57
+ }
58
+ const hosts = host.split(',').map((h) => h.trim()).filter((h) => h.length > 0);
59
+ for (const h of hosts) {
60
+ const session = new SshSession_1.SshSession({
61
+ host: h,
62
+ port: port ? parseInt(port, 10) : 22,
63
+ username: username,
64
+ password: password
65
+ });
66
+ coordinatorWrapper.active.registerSession(h, session);
67
+ }
68
+ }
69
+ else if (protocol === 'telnet') {
70
+ if (!host) {
71
+ throw new Error('Host (--host) is required for Telnet connections.');
72
+ }
73
+ const hosts = host.split(',').map((h) => h.trim()).filter((h) => h.length > 0);
74
+ for (const h of hosts) {
75
+ const session = new TelnetSession_1.TelnetSession({
76
+ host: h,
77
+ port: port ? parseInt(port, 10) : 23,
78
+ username: username,
79
+ password: password
80
+ });
81
+ coordinatorWrapper.active.registerSession(h, session);
82
+ }
83
+ }
84
+ else {
85
+ throw new Error(`Unsupported protocol for monitoring: ${protocol}`);
86
+ }
87
+ if (provider === 'local' && !endpoint) {
88
+ if (localType === 'lmstudio') {
89
+ endpoint = 'http://127.0.0.1:1234/v1';
90
+ }
91
+ else {
92
+ endpoint = 'http://127.0.0.1:11434/v1';
93
+ }
94
+ }
95
+ const localAIClient = new LLMClient_1.LLMClient(provider, endpoint, model, apiKey, localType);
96
+ const llmSpinner = (0, ui_1.createSpinner)('Preflight check: validating LLM endpoint reachability...').start();
97
+ try {
98
+ await localAIClient.ensureReachable();
99
+ llmSpinner.succeed('LLM endpoint is ready.');
100
+ }
101
+ catch (err) {
102
+ llmSpinner.fail('LLM endpoint preflight failed.');
103
+ throw err;
104
+ }
105
+ const connSpinner = (0, ui_1.createSpinner)('Connecting to target network devices...').start();
106
+ try {
107
+ await coordinatorWrapper.active.connectAll();
108
+ connSpinner.succeed('All hardware sessions synchronized successfully.');
109
+ }
110
+ catch (err) {
111
+ connSpinner.fail('Connection failed.');
112
+ throw err;
113
+ }
114
+ const { AutoHealer } = require('../../core/agent/AutoHealer');
115
+ const healer = new AutoHealer(localAIClient, coordinatorWrapper.active, {
116
+ nonInteractive,
117
+ minConfidence
118
+ });
119
+ healer.start();
120
+ ui_1.logger.info('Monitoring active. Press Ctrl+C to terminate session.');
121
+ await new Promise(() => { });
122
+ }
123
+ catch (err) {
124
+ ui_1.logger.critical(`Monitoring Error: ${err.message}`);
125
+ }
126
+ finally {
127
+ await cleanup();
128
+ ui_1.logger.info('Session Terminated. Pipelines detached.');
129
+ process.exit(0);
130
+ }
131
+ }
132
+ //# sourceMappingURL=monitorCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monitorCommand.js","sourceRoot":"","sources":["../../../src/cli/commands/monitorCommand.ts"],"names":[],"mappings":";;AAQA,sCAqIC;AA7ID,2BAAkC;AAClC,kFAA+E;AAC/E,4EAAgF;AAChF,0EAAuE;AACvE,gFAA6E;AAC7E,kEAA4E;AAC5E,iCAAiD;AAE1C,KAAK,UAAU,aAAa,CAC/B,OAAY,EACZ,kBAA4D,EAC5D,OAA4B;IAE5B,IAAI,QAAQ,GAAG,OAAO,CAAC,QAAuB,CAAC;IAC/C,IAAI,SAAS,GAAG,OAAO,CAAC,SAA+B,CAAC;IACxD,IAAI,SAAS,EAAE,CAAC;QACZ,SAAS,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;QAC3C,IAAI,SAAS,KAAK,WAAW,EAAE,CAAC;YAC5B,SAAS,GAAG,UAAU,CAAC;QAC3B,CAAC;IACL,CAAC;IACD,IAAI,MAAM,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAC/C,IAAI,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC1B,IAAI,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAChC,IAAI,QAAQ,GAAG,OAAO,CA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ordinator';
2
+ export declare function runAction(options: any, coordinatorWrapper: {
3
+ active: MultiAgentCoordinator | null;
4
+ }, dashboardWrapper: {
5
+ server: any;
6
+ }, cleanup: () => Promise<void>): Promise<never>;