ciscollm-cli 1.0.1
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/LICENSE +21 -0
- package/README.md +112 -0
- package/dist/cli/ui/ui.d.ts +10 -0
- package/dist/cli/ui/ui.js +25 -0
- package/dist/cli/ui/ui.js.map +1 -0
- package/dist/core/agent/AgentLoop.d.ts +38 -0
- package/dist/core/agent/AgentLoop.js +562 -0
- package/dist/core/agent/AgentLoop.js.map +1 -0
- package/dist/core/agent/CommandReferenceEngine.d.ts +43 -0
- package/dist/core/agent/CommandReferenceEngine.js +366 -0
- package/dist/core/agent/CommandReferenceEngine.js.map +1 -0
- package/dist/core/agent/MultiAgentCoordinator.d.ts +12 -0
- package/dist/core/agent/MultiAgentCoordinator.js +57 -0
- package/dist/core/agent/MultiAgentCoordinator.js.map +1 -0
- package/dist/core/agent/PromptEngine.d.ts +3 -0
- package/dist/core/agent/PromptEngine.js +57 -0
- package/dist/core/agent/PromptEngine.js.map +1 -0
- package/dist/core/guardrails/CommandFirewall.d.ts +10 -0
- package/dist/core/guardrails/CommandFirewall.js +108 -0
- package/dist/core/guardrails/CommandFirewall.js.map +1 -0
- package/dist/core/guardrails/ErrorAnalyzer.d.ts +7 -0
- package/dist/core/guardrails/ErrorAnalyzer.js +16 -0
- package/dist/core/guardrails/ErrorAnalyzer.js.map +1 -0
- package/dist/core/rollback/TransactionManager.d.ts +13 -0
- package/dist/core/rollback/TransactionManager.js +144 -0
- package/dist/core/rollback/TransactionManager.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +578 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/llm/LLMClient.d.ts +11 -0
- package/dist/infrastructure/llm/LLMClient.js +94 -0
- package/dist/infrastructure/llm/LLMClient.js.map +1 -0
- package/dist/infrastructure/llm/LocalLLMClient.d.ts +7 -0
- package/dist/infrastructure/llm/LocalLLMClient.js +39 -0
- package/dist/infrastructure/llm/LocalLLMClient.js.map +1 -0
- package/dist/infrastructure/llm/ToolDefinitions.d.ts +179 -0
- package/dist/infrastructure/llm/ToolDefinitions.js +150 -0
- package/dist/infrastructure/llm/ToolDefinitions.js.map +1 -0
- package/dist/infrastructure/protocols/BaseSession.d.ts +10 -0
- package/dist/infrastructure/protocols/BaseSession.js +39 -0
- package/dist/infrastructure/protocols/BaseSession.js.map +1 -0
- package/dist/infrastructure/protocols/MockSession.d.ts +43 -0
- package/dist/infrastructure/protocols/MockSession.js +505 -0
- package/dist/infrastructure/protocols/MockSession.js.map +1 -0
- package/dist/infrastructure/protocols/PlinkSerial.d.ts +16 -0
- package/dist/infrastructure/protocols/PlinkSerial.js +132 -0
- package/dist/infrastructure/protocols/PlinkSerial.js.map +1 -0
- package/dist/infrastructure/protocols/SshSession.d.ts +19 -0
- package/dist/infrastructure/protocols/SshSession.js +110 -0
- package/dist/infrastructure/protocols/SshSession.js.map +1 -0
- package/dist/infrastructure/protocols/TelnetSession.d.ts +17 -0
- package/dist/infrastructure/protocols/TelnetSession.js +177 -0
- package/dist/infrastructure/protocols/TelnetSession.js.map +1 -0
- package/dist/shared/constants.d.ts +8 -0
- package/dist/shared/constants.js +25 -0
- package/dist/shared/constants.js.map +1 -0
- package/dist/shared/types.d.ts +22 -0
- package/dist/shared/types.js +3 -0
- package/dist/shared/types.js.map +1 -0
- package/package.json +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ThemeHackers
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# ciscollm-cli
|
|
2
|
+
|
|
3
|
+
`ciscollm-cli` is a Cisco IOS automation agent CLI for configuration, troubleshooting, and simulation. It supports tool-calling with an LLM, safety guardrails, rollback handling, and a mock switch/router environment for offline testing.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Install the published package globally:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g ciscollm-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
After installation, the `ciscollm` command becomes available in your terminal.
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
Show the available commands and flags:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
ciscollm run --help
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Run the agent in mock mode for a safe offline simulation:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
ciscollm run --protocol mock --goal "Review LAN IP allocation for 192.168.1.0/24"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## What It Does
|
|
30
|
+
|
|
31
|
+
The CLI takes a user goal, sends it to the selected LLM provider, and lets the agent choose Cisco IOS tool calls step by step.
|
|
32
|
+
|
|
33
|
+
It can:
|
|
34
|
+
- inspect and modify Cisco-style configuration
|
|
35
|
+
- validate commands with guardrails
|
|
36
|
+
- roll back failed configuration changes
|
|
37
|
+
- simulate interfaces, IP addresses, shell commands, and ping checks in mock mode
|
|
38
|
+
|
|
39
|
+
## Common Usage
|
|
40
|
+
|
|
41
|
+
Start a mock session for learning or testing:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
ciscollm run --protocol mock --goal "Configure 192.168.1.1/24 on LAN A for 25 hosts"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Use a local LLM endpoint:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
ciscollm run --provider local --local-type lmstudio --endpoint http://127.0.0.1:1234/v1 --protocol mock --goal "Open privileged exec and review IP design"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Use cloud inference with an API key:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
ciscollm run --provider cloud --api-key YOUR_OPENROUTER_KEY --protocol mock --goal "Check interface status"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Enable strict command-reference enforcement:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
ciscollm run --strict-command-ref --protocol mock --goal "Review LAN design"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Disable startup telemetry if you want quieter output:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
ciscollm run --no-ref-telemetry --protocol mock --goal "Review LAN design"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Command Options
|
|
72
|
+
|
|
73
|
+
- `--protocol <type>`: Selects the device connection mode. Supported values: `serial`, `ssh`, `telnet`, `mock`.
|
|
74
|
+
- `--provider <type>`: Selects the LLM provider. Supported values: `local`, `cloud`.
|
|
75
|
+
- `--local-type <type>`: Chooses the local LLM server flavor. Supported values: `ollama`, `lmstudio`.
|
|
76
|
+
- `--endpoint <url>`: Sets the LLM API endpoint.
|
|
77
|
+
- `--model <name>`: Sets the model name to use.
|
|
78
|
+
- `--strict-command-ref`: Blocks commands that are not found in the command-reference index.
|
|
79
|
+
- `--no-ref-telemetry`: Turns off command-reference startup telemetry.
|
|
80
|
+
- `--goal <intent>`: Describes the configuration or troubleshooting task.
|
|
81
|
+
|
|
82
|
+
## Local LLM Notes
|
|
83
|
+
|
|
84
|
+
If you use a local provider, make sure the endpoint is already running before starting the CLI.
|
|
85
|
+
|
|
86
|
+
- Ollama usually listens on `http://127.0.0.1:11434/v1`
|
|
87
|
+
- LM Studio usually listens on `http://127.0.0.1:1234/v1`
|
|
88
|
+
|
|
89
|
+
If the endpoint is unavailable, the CLI will stop early with a clear preflight error.
|
|
90
|
+
|
|
91
|
+
## Mock Mode
|
|
92
|
+
|
|
93
|
+
Mock mode is designed for safe offline testing.
|
|
94
|
+
|
|
95
|
+
It simulates:
|
|
96
|
+
- device connection and prompt modes
|
|
97
|
+
- interface configuration
|
|
98
|
+
- ping behavior
|
|
99
|
+
- command parsing errors
|
|
100
|
+
- shell variable and function behavior
|
|
101
|
+
|
|
102
|
+
This is the recommended mode when you want to test agent behavior without hardware.
|
|
103
|
+
|
|
104
|
+
## Troubleshooting
|
|
105
|
+
|
|
106
|
+
- If you see `ENEEDAUTH`, you are not logged into npm with an account that can publish or access the package.
|
|
107
|
+
- If the CLI says the LLM endpoint is unreachable, start the local server or update `--endpoint`.
|
|
108
|
+
- If a command is blocked in strict mode, it was not matched in the command-reference index.
|
|
109
|
+
|
|
110
|
+
## Package Name
|
|
111
|
+
|
|
112
|
+
The package name on npm is `ciscollm-cli`, and it exposes the `ciscollm` executable through the package `bin` entry.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import ora from 'ora';
|
|
2
|
+
export declare const logger: {
|
|
3
|
+
info: (msg: string) => void;
|
|
4
|
+
success: (msg: string) => void;
|
|
5
|
+
warn: (msg: string) => void;
|
|
6
|
+
error: (msg: string) => void;
|
|
7
|
+
critical: (msg: string) => void;
|
|
8
|
+
heading: (msg: string) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare function createSpinner(text: string): ora.Ora;
|
|
@@ -0,0 +1,25 @@
|
|
|
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.logger = void 0;
|
|
7
|
+
exports.createSpinner = createSpinner;
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const ora_1 = __importDefault(require("ora"));
|
|
10
|
+
exports.logger = {
|
|
11
|
+
info: (msg) => console.log(chalk_1.default.blue('ℹ ') + msg),
|
|
12
|
+
success: (msg) => console.log(chalk_1.default.green('✔ ') + chalk_1.default.bold(msg)),
|
|
13
|
+
warn: (msg) => console.warn(chalk_1.default.yellow('⚠ ') + chalk_1.default.yellow(msg)),
|
|
14
|
+
error: (msg) => console.error(chalk_1.default.red('✖ ') + chalk_1.default.red.bold(msg)),
|
|
15
|
+
critical: (msg) => console.error(chalk_1.default.bgRed.white.bold(' CRITICAL ') + ' ' + chalk_1.default.red(msg)),
|
|
16
|
+
heading: (msg) => console.log('\n' + chalk_1.default.cyan.bold.underline(msg) + '\n')
|
|
17
|
+
};
|
|
18
|
+
function createSpinner(text) {
|
|
19
|
+
return (0, ora_1.default)({
|
|
20
|
+
text,
|
|
21
|
+
color: 'cyan',
|
|
22
|
+
spinner: 'dots'
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/cli/ui/ui.ts"],"names":[],"mappings":";;;;;;AAYA,sCAMC;AAlBD,kDAA0B;AAC1B,8CA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
|
2
|
+
import { MultiAgentCoordinator } from './MultiAgentCoordinator';
|
|
3
|
+
type AgentLoopOptions = {
|
|
4
|
+
strictReferenceMode?: boolean;
|
|
5
|
+
referenceTelemetry?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare class CiscoAgentLoop {
|
|
8
|
+
private llmClient;
|
|
9
|
+
private coordinator;
|
|
10
|
+
private messages;
|
|
11
|
+
private transactions;
|
|
12
|
+
private firewall;
|
|
13
|
+
private lastCommandPerDevice;
|
|
14
|
+
private commandHints;
|
|
15
|
+
private commandReferenceEngine;
|
|
16
|
+
private strictReferenceMode;
|
|
17
|
+
private referenceTelemetry;
|
|
18
|
+
private options;
|
|
19
|
+
private validationNudgeCount;
|
|
20
|
+
constructor(llmClient: LLMClient, coordinator: MultiAgentCoordinator, options?: AgentLoopOptions);
|
|
21
|
+
private applyOptions;
|
|
22
|
+
run(userGoal: string): Promise<void>;
|
|
23
|
+
private triggerAutomaticValidationPing;
|
|
24
|
+
private resolveValidationDestination;
|
|
25
|
+
private buildStateInfoString;
|
|
26
|
+
private findLastMutatedDevice;
|
|
27
|
+
private resolveTargetDevice;
|
|
28
|
+
private handleExecuteCommandCall;
|
|
29
|
+
private handleEnableIosShellCall;
|
|
30
|
+
private handleDefineShellVariableCall;
|
|
31
|
+
private handleExecuteShellLoopCall;
|
|
32
|
+
private handleDefineShellFunctionCall;
|
|
33
|
+
private handlePingTestCall;
|
|
34
|
+
private pingFromHost;
|
|
35
|
+
private injectToolResponse;
|
|
36
|
+
private truncateOutput;
|
|
37
|
+
}
|
|
38
|
+
export {};
|