ciscollm-cli 1.0.1 → 1.0.3
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/README.md +169 -74
- package/dist/cli/ui/ui.d.ts +1 -0
- package/dist/cli/ui/ui.js +19 -4
- package/dist/cli/ui/ui.js.map +1 -1
- package/dist/core/agent/AgentLoop.d.ts +7 -0
- package/dist/core/agent/AgentLoop.js +177 -18
- package/dist/core/agent/AgentLoop.js.map +1 -1
- package/dist/core/agent/CommandReferenceEngine.d.ts +2 -0
- package/dist/core/agent/CommandReferenceEngine.js +73 -4
- package/dist/core/agent/CommandReferenceEngine.js.map +1 -1
- package/dist/core/agent/HierarchicalAgentManager.d.ts +11 -0
- package/dist/core/agent/HierarchicalAgentManager.js +70 -0
- package/dist/core/agent/HierarchicalAgentManager.js.map +1 -0
- package/dist/core/agent/MultiAgentCoordinator.d.ts +5 -1
- package/dist/core/agent/MultiAgentCoordinator.js +64 -5
- package/dist/core/agent/MultiAgentCoordinator.js.map +1 -1
- package/dist/core/agent/PromptEngine.d.ts +1 -1
- package/dist/core/agent/PromptEngine.js +64 -48
- package/dist/core/agent/PromptEngine.js.map +1 -1
- package/dist/core/guardrails/AuditLogger.d.ts +15 -0
- package/dist/core/guardrails/AuditLogger.js +66 -0
- package/dist/core/guardrails/AuditLogger.js.map +1 -0
- package/dist/core/guardrails/CommandFirewall.js +24 -0
- package/dist/core/guardrails/CommandFirewall.js.map +1 -1
- package/dist/core/guardrails/PreExecutionValidator.d.ts +9 -0
- package/dist/core/guardrails/PreExecutionValidator.js +58 -0
- package/dist/core/guardrails/PreExecutionValidator.js.map +1 -0
- package/dist/core/rollback/StateDiff.d.ts +47 -0
- package/dist/core/rollback/StateDiff.js +121 -0
- package/dist/core/rollback/StateDiff.js.map +1 -0
- package/dist/core/rollback/TransactionManager.d.ts +2 -0
- package/dist/core/rollback/TransactionManager.js +130 -54
- package/dist/core/rollback/TransactionManager.js.map +1 -1
- package/dist/core/topology/TopologyDiscovery.d.ts +5 -0
- package/dist/core/topology/TopologyDiscovery.js +54 -0
- package/dist/core/topology/TopologyDiscovery.js.map +1 -0
- package/dist/index.js +247 -31
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/llm/LLMClient.js +52 -2
- package/dist/infrastructure/llm/LLMClient.js.map +1 -1
- package/dist/infrastructure/protocols/BaseSession.js +1 -1
- package/dist/infrastructure/protocols/BaseSession.js.map +1 -1
- package/dist/infrastructure/protocols/CmlSession.d.ts +26 -0
- package/dist/infrastructure/protocols/CmlSession.js +448 -0
- package/dist/infrastructure/protocols/CmlSession.js.map +1 -0
- package/dist/infrastructure/protocols/MockSession.d.ts +33 -0
- package/dist/infrastructure/protocols/MockSession.js +433 -35
- package/dist/infrastructure/protocols/MockSession.js.map +1 -1
- package/dist/infrastructure/protocols/NetconfSession.d.ts +72 -0
- package/dist/infrastructure/protocols/NetconfSession.js +489 -0
- package/dist/infrastructure/protocols/NetconfSession.js.map +1 -0
- package/dist/infrastructure/protocols/PlinkSerial.js +112 -28
- package/dist/infrastructure/protocols/PlinkSerial.js.map +1 -1
- package/dist/infrastructure/protocols/SshSession.js +5 -5
- package/dist/infrastructure/protocols/SshSession.js.map +1 -1
- package/dist/infrastructure/protocols/TelnetSession.js +8 -8
- package/dist/infrastructure/protocols/TelnetSession.js.map +1 -1
- package/dist/shared/types.d.ts +12 -0
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -1,112 +1,207 @@
|
|
|
1
1
|
# ciscollm-cli
|
|
2
2
|
|
|
3
|
-
`ciscollm-cli` is a Cisco IOS automation agent CLI for configuration, troubleshooting, and simulation.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
`ciscollm-cli` is a premium, autonomous Cisco IOS automation agent CLI designed for network configuration, troubleshooting, and simulation. By leveraging LLM tool-calling capabilities, it allows engineers to manage local, remote, or simulated Cisco hardware safely and efficiently.
|
|
4
|
+
|
|
5
|
+
The CLI features an **Interactive Setup Wizard**, **Multi-Device Coordination**, **Safety Guardrails (Command Firewall)**, **Automatic Configuration Rollbacks**, **Mock Device Simulation**, and **Strict Command Reference Validation**.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🚀 Key Features
|
|
10
|
+
|
|
11
|
+
### 1. ⚙️ Interactive Setup Wizard
|
|
12
|
+
If `ciscollm run` is executed without a `--goal` parameter, the CLI automatically launches a step-by-step interactive setup wizard (using `inquirer`). The wizard guides the user through:
|
|
13
|
+
* **LLM Provider Selection:** Local (Ollama / LM Studio) or Cloud (OpenRouter).
|
|
14
|
+
* **Local LLM Settings:** Service type (Ollama/LM Studio), API endpoint URL, and model name.
|
|
15
|
+
* **Cloud LLM Settings:** OpenRouter API Key, model name, and endpoint.
|
|
16
|
+
* **Connection Protocol:** Serial (with automated COM port scanning), SSH, Telnet, or Mock simulation.
|
|
17
|
+
* **Connection Details:** COM port and Baud rate (for serial), or Host target, Port, Username, and Password (for SSH/Telnet).
|
|
18
|
+
* **Configuration Goal:** Prompting for the network task the agent needs to achieve.
|
|
19
|
+
* **Configuration Summary:** Displays a summary of the setup and prompts for final confirmation before starting execution.
|
|
20
|
+
|
|
21
|
+
### 2. 🔀 Multi-Device & Multi-Agent Coordination
|
|
22
|
+
Manage configurations across multiple Cisco hardware devices simultaneously. The `--com` (for serial) and `--host` (for SSH/Telnet) flags accept comma-separated inputs (e.g. `--com COM3,COM4` or `--host 10.0.0.1,10.0.0.2`). The internal `MultiAgentCoordinator` manages all connections in parallel, tracks status, and handles clean disconnections upon exit.
|
|
23
|
+
|
|
24
|
+
### 3. 🛡️ Command Firewall & Safety Guardrails
|
|
25
|
+
To prevent accidental lockouts, service disruptions, or losing device access, the built-in `CommandFirewall` monitors all LLM-generated commands.
|
|
26
|
+
* **Blocked Operations:**
|
|
27
|
+
* Removing default static routes (`no ip route 0.0.0.0...`) which can break management access.
|
|
28
|
+
* Disabling AAA authentication (`no aaa new-model`) or zeroizing crypto keys (`crypto key zeroize`).
|
|
29
|
+
* Deleting access lists or access groups (`no access-list`, `no ip access-group`).
|
|
30
|
+
* Shutting down active protected interfaces (e.g. `GigabitEthernet0/0`, `GigabitEthernet0/1`, `GigabitEthernet1/0`, `Vlan1`).
|
|
31
|
+
* Removing configured IP addresses on protected interfaces (`no ip address`).
|
|
32
|
+
* **Human-in-the-Loop Validation:** High-risk commands trigger a warning prompt, requiring the operator to manually authorize the execution.
|
|
33
|
+
* **Non-Interactive Mode:** Running with `--non-interactive` (or setting environment variable `CISCOLLM_NON_INTERACTIVE=true`) automatically rejects all blocked/high-risk commands.
|
|
34
|
+
|
|
35
|
+
### 4. 🔄 Transaction Rollback & Inversion Manager
|
|
36
|
+
If a configuration step fails or the agent encounters command errors, the `TransactionManager` restores the device state:
|
|
37
|
+
* **Atomic Backup:** Before modifying config, the agent attempts to back up the current running-config to `flash:backup-agent.cfg`.
|
|
38
|
+
* **Atomic Configuration Replace:** Rollbacks prioritize replacing the configuration atomically using `configure replace flash:backup-agent.cfg force`.
|
|
39
|
+
* **Command Inversion Fallback:** If flash storage is unreachable, it builds an inverse command sequence in reverse order (e.g. `ip address ...` -> `no ip address`, `shutdown` -> `no shutdown`, `no shutdown` -> `shutdown`, `description ...` -> `no description`) and executes them sequentially in their respective submodes.
|
|
40
|
+
|
|
41
|
+
### 5. 📚 Strict Command Reference Validation
|
|
42
|
+
Enforces compliance against an official Cisco IOS Command Reference index:
|
|
43
|
+
* **Strict Validation Mode:** Enabled via `--strict-command-ref` (or setting `CISCOLLM_STRICT_COMMAND_REF=true`). The agent will block any command not listed in the command-reference index.
|
|
44
|
+
* **PDF Command Indexer:** The engine reads `cf_command_ref.pdf`, extracts structural commands, and caches them in `.cache/cf_command_ref.index.json` to speed up startup times.
|
|
45
|
+
* **Fuzzy Command Family Expansion:** Automatically expands shortened commands (e.g. `sh` -> `show`, `conf t` -> `configure terminal`, `int gig0/1` -> `interface GigabitEthernet0/1`) to check they match valid command families in the index.
|
|
46
|
+
* **Reference Telemetry:** Telemetry logs detail the warmup time, source (PDF, cache, or memory), and matched command count. Can be disabled with `--no-ref-telemetry`.
|
|
47
|
+
|
|
48
|
+
### 6. 🧪 Mock Device Simulation
|
|
49
|
+
Mock mode (`--protocol mock`) provides a stateful simulation of a Cisco IOS device, allowing offline development and testing. It features:
|
|
50
|
+
* **Stateful Database:** Maintains interfaces, VLANs, shell variables, shell functions, and static routing tables, saved locally under `.mock-state-<device>.json`.
|
|
51
|
+
* **Interactive CLI Simulator:** Simulates user and privileged EXEC modes, configuration modes, VLAN databases, DHCP pools, OSPF routers, and IP routing tables.
|
|
52
|
+
* **Output Filtering (Pipes):** Supports standard IOS output piping such as `| include`, `| grep`, `| exclude`, and `| begin`.
|
|
53
|
+
* **Network Testing:** Simulates latency and ICMP ping responses.
|
|
54
|
+
|
|
55
|
+
### 7. 🛡️ Pre-Execution Safety Validation (Dry-Run Check)
|
|
56
|
+
Before executing any state-mutating command, the agent runs a dry-run check against the known network topology:
|
|
57
|
+
* **Topology Awareness:** Analyzes active physical/logical links between core, distribution, and access segments.
|
|
58
|
+
* **Accidental Disruption Prevention:** Detects and intercepts commands that could accidentally shut down critical uplink ports or neighbor nodes, ensuring continuous uptime.
|
|
59
|
+
* **Inspection Throttling:** Repeated inspection commands such as `show ip interface brief` are not treated as a harmful loop, but repeated configuration retries still are.
|
|
60
|
+
|
|
61
|
+
### 8. 🧠 Prompt Discipline for Safe Change Windows
|
|
62
|
+
The agent prompt now follows a tighter inspection/configuration/verification flow:
|
|
63
|
+
* **Single Pre-Check:** Perform one inspection pass before a configuration block instead of repeatedly polling the same status command.
|
|
64
|
+
* **Configuration Block:** Apply the requested changes as a focused sequence of commands.
|
|
65
|
+
* **Single Verification Pass:** Verify the applied change once with `show` or `ping_test`, then stop if the result is clean.
|
|
66
|
+
|
|
67
|
+
### 9. 📊 Live Configuration State Diff Engine
|
|
68
|
+
Maintains deep visibility of system modifications:
|
|
69
|
+
* **Before/After Snapshots:** Takes memory-efficient snapshots of device interfaces, IP addresses, subnets, routing tables, and active VLAN databases before and after executing any command.
|
|
70
|
+
* **Visual Colorized Diffs:** Automatically outputs a structured difference report highlighting additions in green, removals in red, and updates/modifications in yellow.
|
|
71
|
+
|
|
72
|
+
### 10. 🪵 Continuous Enterprise Audit Trails
|
|
73
|
+
Ensures accountability for automated activities:
|
|
74
|
+
* **Detailed Logs:** Generates structured records containing the timestamp, target device, active agent role, LLM reasoning thoughts, executed commands, and final output status.
|
|
75
|
+
* **Local Audit Store:** Persists all interactions locally to `audit.log` for easy integration with standard security information and event management (SIEM) systems.
|
|
76
|
+
|
|
77
|
+
### 11. 🔀 Hierarchical Network Swarms
|
|
78
|
+
Supports role-specific command delegation and intelligence:
|
|
79
|
+
* **Role Routing:** Multi-agent coordinator routes tasks to specialized personalities—**Core Agent**, **Distribution Agent**, and **Access Agent**—matching the logical tier of the configuration task.
|
|
80
|
+
* **RBAC Constraints:** Restricts operations according to the `--rbac-role` parameter. The `read_only` role safely blocks any modifying actions and logs violations to the audit log.
|
|
81
|
+
|
|
82
|
+
### 12. 🔌 NETCONF & CML Simulation Adapters
|
|
83
|
+
Extends sandbox capabilities beyond local mock devices:
|
|
84
|
+
* **Cisco Modeling Labs (CML):** Provides sessions to interact directly with digital twin network simulations.
|
|
85
|
+
* **NETCONF XML Sessions:** Supports programmatic configuration using structured XML RPC calls and YANG schemas.
|
|
86
|
+
* **NETCONF SSH Auth:** Supports username/password, SSH private key, passphrase, and NETCONF timeout tuning for real devices.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 📦 Installation
|
|
91
|
+
|
|
92
|
+
To install `ciscollm-cli` globally from npm:
|
|
8
93
|
|
|
9
94
|
```bash
|
|
10
95
|
npm install -g ciscollm-cli
|
|
11
96
|
```
|
|
12
97
|
|
|
13
|
-
|
|
98
|
+
Once installed, the global executable `ciscollm` becomes available.
|
|
14
99
|
|
|
15
|
-
|
|
100
|
+
---
|
|
16
101
|
|
|
17
|
-
|
|
102
|
+
## 🛠️ CLI Usage & Options
|
|
18
103
|
|
|
19
104
|
```bash
|
|
20
|
-
ciscollm run
|
|
105
|
+
ciscollm run [options]
|
|
21
106
|
```
|
|
22
107
|
|
|
23
|
-
|
|
24
|
-
|
|
108
|
+
### Options Table
|
|
109
|
+
|
|
110
|
+
| Option / Flag | Alias | Description | Default Value |
|
|
111
|
+
|---|---|---|---|
|
|
112
|
+
| `-g, --goal <intent>` | - | The goal of the configuration/troubleshooting task. If not specified, launches the Interactive Setup Wizard. | - |
|
|
113
|
+
| `--protocol <type>` | - | Connection protocol (`serial`, `ssh`, `telnet`, `mock`, `netconf`, `cml`). | `serial` |
|
|
114
|
+
| `--provider <type>` | - | LLM provider mode (`local`, `cloud`). | `local` |
|
|
115
|
+
| `--local-type <type>` | - | Local LLM server flavor (`ollama`, `lmstudio`). | `ollama` |
|
|
116
|
+
| `--model <name>` | - | Name of the LLM model to compile. | - |
|
|
117
|
+
| `--endpoint <url>` | - | The LLM API endpoint URL. | - |
|
|
118
|
+
| `--api-key <key>` | - | API key for the cloud provider (OpenRouter). | - |
|
|
119
|
+
| `-c, --com <ports>` | - | COM Port(s), comma-separated (e.g., `COM3` or `COM3,COM4`). | - |
|
|
120
|
+
| `-b, --baud <rate>` | - | Serial transmission baud rate. | `9600` |
|
|
121
|
+
| `--host <address>` | - | Target IP address or hostname (comma-separated for multi-device). | - |
|
|
122
|
+
| `--port <port>` | - | Target connection port. | - |
|
|
123
|
+
| `-u, --username <name>` | - | Device login username. | - |
|
|
124
|
+
| `-p, --password <pass>` | - | Device login password. | - |
|
|
125
|
+
| `--env-password` | - | Read the device password from the `CISCOLLM_PASS` environment variable. | `false` |
|
|
126
|
+
| `--private-key <path>` | - | SSH private key file path for SSH and NETCONF sessions. | - |
|
|
127
|
+
| `--passphrase <passphrase>` | - | Passphrase for the SSH private key file. | - |
|
|
128
|
+
| `--netconf-ready-timeout <ms>` | - | NETCONF SSH ready timeout in milliseconds. | `20000` |
|
|
129
|
+
| `--netconf-hello-timeout <ms>` | - | NETCONF hello exchange timeout in milliseconds. | `15000` |
|
|
130
|
+
| `--netconf-rpc-timeout <ms>` | - | NETCONF RPC response timeout in milliseconds. | `15000` |
|
|
131
|
+
| `--netconf-keepalive-interval <ms>` | - | NETCONF SSH keepalive interval in milliseconds. | `10000` |
|
|
132
|
+
| `--strict-command-ref` | - | Block commands not found in the `cf_command_ref.pdf` index. | `false` |
|
|
133
|
+
| `--no-ref-telemetry` | - | Disable command-reference warmup telemetry logs. | `false` |
|
|
134
|
+
| `--non-interactive` | - | Run without interactive prompts (auto-rejects dangerous commands). | `false` |
|
|
135
|
+
| `--rbac-role <role>` | - | Specify the Active Agent RBAC authorization role (`admin`, `read_only`). | `admin` |
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## 💡 Usage Examples
|
|
140
|
+
|
|
141
|
+
### 1. Launching the Interactive Setup Wizard
|
|
142
|
+
Start the interactive CLI configuration process:
|
|
25
143
|
```bash
|
|
26
|
-
ciscollm run
|
|
144
|
+
ciscollm run
|
|
27
145
|
```
|
|
28
146
|
|
|
29
|
-
|
|
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
|
-
|
|
147
|
+
### 2. Running a Quick Mock Simulation
|
|
43
148
|
```bash
|
|
44
|
-
ciscollm run --protocol mock --goal "Configure 192.168.
|
|
149
|
+
ciscollm run --protocol mock --goal "Configure GigabitEthernet0/1 with IP 192.168.2.1/24 and interface description 'LAN B'"
|
|
45
150
|
```
|
|
46
151
|
|
|
47
|
-
|
|
48
|
-
|
|
152
|
+
### 3. Local Model (Ollama)
|
|
49
153
|
```bash
|
|
50
|
-
ciscollm run --provider local --local-type
|
|
154
|
+
ciscollm run --provider local --local-type ollama --endpoint http://127.0.0.1:11434/v1 --model qwen3.5-4b --protocol mock --goal "Show IP routing table"
|
|
51
155
|
```
|
|
52
156
|
|
|
53
|
-
|
|
54
|
-
|
|
157
|
+
### 4. Cloud Inference via OpenRouter
|
|
55
158
|
```bash
|
|
56
|
-
ciscollm run --provider cloud --api-key
|
|
159
|
+
ciscollm run --provider cloud --api-key YOUR_OPENROUTER_API_KEY --protocol mock --goal "Verify interface states"
|
|
57
160
|
```
|
|
58
161
|
|
|
59
|
-
|
|
60
|
-
|
|
162
|
+
### 5. Enforcing Strict Validation Mode
|
|
61
163
|
```bash
|
|
62
|
-
ciscollm run --strict-command-ref --protocol mock --goal "
|
|
164
|
+
ciscollm run --strict-command-ref --protocol mock --goal "Configure router ospf 1 and advertise network 192.168.1.0/24"
|
|
63
165
|
```
|
|
64
166
|
|
|
65
|
-
|
|
66
|
-
|
|
167
|
+
### 6. NETCONF Session with SSH Key Auth
|
|
67
168
|
```bash
|
|
68
|
-
ciscollm run --
|
|
169
|
+
ciscollm run --protocol netconf --host 192.168.1.188 --port 830 --username admin --private-key C:\\Users\\me\\.ssh\\id_rsa --passphrase YOUR_PASSPHRASE --netconf-rpc-timeout 20000 --goal "Show running configuration"
|
|
69
170
|
```
|
|
70
171
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
|
172
|
+
### 7. NETCONF Session with Password from Environment
|
|
173
|
+
```bash
|
|
174
|
+
$env:CISCOLLM_PASS = '!@admin1234'
|
|
175
|
+
ciscollm run --protocol netconf --host 192.168.1.188 --username admin --env-password --goal "Show interface brief"
|
|
176
|
+
```
|
|
92
177
|
|
|
93
|
-
|
|
178
|
+
---
|
|
94
179
|
|
|
95
|
-
|
|
96
|
-
- device connection and prompt modes
|
|
97
|
-
- interface configuration
|
|
98
|
-
- ping behavior
|
|
99
|
-
- command parsing errors
|
|
100
|
-
- shell variable and function behavior
|
|
180
|
+
## 💻 Development & Contribution
|
|
101
181
|
|
|
102
|
-
|
|
182
|
+
Follow these steps to set up the project locally for development:
|
|
103
183
|
|
|
104
|
-
|
|
184
|
+
### 1. Clone & Install Dependencies
|
|
185
|
+
```bash
|
|
186
|
+
git clone https://github.com/ThemeHackers/ciscollm-cli.git
|
|
187
|
+
cd ciscollm-cli
|
|
188
|
+
npm install
|
|
189
|
+
```
|
|
105
190
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
191
|
+
### 2. Build the Project
|
|
192
|
+
Compile the TypeScript code to target JavaScript inside `dist/`:
|
|
193
|
+
```bash
|
|
194
|
+
npm run build
|
|
195
|
+
```
|
|
109
196
|
|
|
110
|
-
|
|
197
|
+
### 3. Run Development Build
|
|
198
|
+
Run the CLI locally from source code:
|
|
199
|
+
```bash
|
|
200
|
+
npm start -- run --protocol mock --goal "Show running config"
|
|
201
|
+
```
|
|
111
202
|
|
|
112
|
-
|
|
203
|
+
### 4. Run Unit Tests
|
|
204
|
+
Validate features including the Command Firewall, Transaction Manager, and Error Analyzer:
|
|
205
|
+
```bash
|
|
206
|
+
npm run test
|
|
207
|
+
```
|
package/dist/cli/ui/ui.d.ts
CHANGED
package/dist/cli/ui/ui.js
CHANGED
|
@@ -8,12 +8,27 @@ exports.createSpinner = createSpinner;
|
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const ora_1 = __importDefault(require("ora"));
|
|
10
10
|
exports.logger = {
|
|
11
|
-
info: (msg) => console.log(chalk_1.default.
|
|
12
|
-
success: (msg) => console.log(chalk_1.default.green('✔ ') + chalk_1.default.bold(msg)),
|
|
11
|
+
info: (msg) => console.log(chalk_1.default.cyan('ℹ ') + msg),
|
|
12
|
+
success: (msg) => console.log(chalk_1.default.green('✔ ') + chalk_1.default.bold.green(msg)),
|
|
13
13
|
warn: (msg) => console.warn(chalk_1.default.yellow('⚠ ') + chalk_1.default.yellow(msg)),
|
|
14
14
|
error: (msg) => console.error(chalk_1.default.red('✖ ') + chalk_1.default.red.bold(msg)),
|
|
15
|
-
critical: (msg) =>
|
|
16
|
-
|
|
15
|
+
critical: (msg) => {
|
|
16
|
+
console.error('\n' + chalk_1.default.bgRed.black.bold(' ⚡ CRITICAL ERROR ') + ' ' + chalk_1.default.red.bold(msg) + '\n');
|
|
17
|
+
},
|
|
18
|
+
heading: (msg) => {
|
|
19
|
+
const line = '━'.repeat(msg.length + 6);
|
|
20
|
+
console.log('\n' + chalk_1.default.magenta.bold(` ┏${line}┓`));
|
|
21
|
+
console.log(chalk_1.default.magenta.bold(` ┃ ${chalk_1.default.white.bold(msg)} ┃`));
|
|
22
|
+
console.log(chalk_1.default.magenta.bold(` ┗${line}┛`) + '\n');
|
|
23
|
+
},
|
|
24
|
+
reasoning: (msg) => {
|
|
25
|
+
const border = chalk_1.default.blue('│');
|
|
26
|
+
console.log('\n' + chalk_1.default.blue('┌─── 🤖 Agent Reasoning Thought Process ───────────────────────'));
|
|
27
|
+
msg.trim().split('\n').forEach(line => {
|
|
28
|
+
console.log(`${border} ${chalk_1.default.gray.italic(line)}`);
|
|
29
|
+
});
|
|
30
|
+
console.log(chalk_1.default.blue('└─────────────────────────────────────────────────────────────') + '\n');
|
|
31
|
+
}
|
|
17
32
|
};
|
|
18
33
|
function createSpinner(text) {
|
|
19
34
|
return (0, ora_1.default)({
|
package/dist/cli/ui/ui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/cli/ui/ui.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/cli/ui/ui.ts"],"names":[],"mappings":";;;;;;AA2BA,sCAMC;AAjCD,kDAA0B;AAC1B,8CAAsB;AAET,QAAA,MAAM,GAAG;IAClB,IAAI,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;IAC1D,OAAO,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,eAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChF,IAAI,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,eAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,eAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC3E,KAAK,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5E,QAAQ,EAAE,CAAC,GAAW,EAAE,EAAE;QACtB,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,eAAK,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,GAAG,GAAG,GAAG,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IAC1G,CAAC;IACD,OAAO,EAAE,CAAC,GAAW,EAAE,EAAE;QACrB,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,eAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,eAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QACpE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IAC1D,CAAC;IACD,SAAS,EAAE,CAAC,GAAW,EAAE,EAAE;QACvB,MAAM,MAAM,GAAG,eAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,eAAK,CAAC,IAAI,CAAC,iEAAiE,CAAC,CAAC,CAAC;QAClG,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAClC,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,KAAK,eAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,gEAAgE,CAAC,GAAG,IAAI,CAAC,CAAC;IACrG,CAAC;CACJ,CAAC;AAEF,SAAgB,aAAa,CAAC,IAAY;IACtC,OAAO,IAAA,aAAG,EAAC;QACP,IAAI;QACJ,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,MAAM;KAClB,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { MultiAgentCoordinator } from './MultiAgentCoordinator';
|
|
|
3
3
|
type AgentLoopOptions = {
|
|
4
4
|
strictReferenceMode?: boolean;
|
|
5
5
|
referenceTelemetry?: boolean;
|
|
6
|
+
rbacRole?: string;
|
|
6
7
|
};
|
|
7
8
|
export declare class CiscoAgentLoop {
|
|
8
9
|
private llmClient;
|
|
@@ -15,17 +16,23 @@ export declare class CiscoAgentLoop {
|
|
|
15
16
|
private commandReferenceEngine;
|
|
16
17
|
private strictReferenceMode;
|
|
17
18
|
private referenceTelemetry;
|
|
19
|
+
private rbacRole;
|
|
18
20
|
private options;
|
|
19
21
|
private validationNudgeCount;
|
|
22
|
+
private lastTopologyDiscoveryAt;
|
|
23
|
+
private readonly topologyRefreshIntervalMs;
|
|
20
24
|
constructor(llmClient: LLMClient, coordinator: MultiAgentCoordinator, options?: AgentLoopOptions);
|
|
21
25
|
private applyOptions;
|
|
22
26
|
run(userGoal: string): Promise<void>;
|
|
27
|
+
private buildTopologyInfoString;
|
|
23
28
|
private triggerAutomaticValidationPing;
|
|
24
29
|
private resolveValidationDestination;
|
|
25
30
|
private buildStateInfoString;
|
|
26
31
|
private findLastMutatedDevice;
|
|
27
32
|
private resolveTargetDevice;
|
|
33
|
+
private classifyCommand;
|
|
28
34
|
private handleExecuteCommandCall;
|
|
35
|
+
private captureDeviceSnapshot;
|
|
29
36
|
private handleEnableIosShellCall;
|
|
30
37
|
private handleDefineShellVariableCall;
|
|
31
38
|
private handleExecuteShellLoopCall;
|