ciscollm-cli 1.0.5 โ 1.0.7
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 +0 -127
- package/dist/cli/ui/ui.d.ts +16 -0
- package/dist/cli/ui/ui.js +188 -4
- package/dist/cli/ui/ui.js.map +1 -1
- package/dist/core/agent/AgentLoop.js +54 -23
- package/dist/core/agent/AgentLoop.js.map +1 -1
- package/dist/index.js +12 -17
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/llm/LLMClient.d.ts +8 -1
- package/dist/infrastructure/llm/LLMClient.js +232 -62
- package/dist/infrastructure/llm/LLMClient.js.map +1 -1
- package/dist/infrastructure/protocols/MockSession.js +2 -1
- package/dist/infrastructure/protocols/MockSession.js.map +1 -1
- package/dist/infrastructure/protocols/PlinkSerial.js +147 -29
- package/dist/infrastructure/protocols/PlinkSerial.js.map +1 -1
- package/dist/infrastructure/protocols/SshSession.js +19 -5
- package/dist/infrastructure/protocols/SshSession.js.map +1 -1
- package/dist/infrastructure/protocols/TelnetSession.js +22 -18
- package/dist/infrastructure/protocols/TelnetSession.js.map +1 -1
- package/dist/shared/constants.js +2 -2
- package/dist/shared/constants.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -206,130 +206,3 @@ Validate features including the Command Firewall, Transaction Manager, and Error
|
|
|
206
206
|
npm run test
|
|
207
207
|
```
|
|
208
208
|
|
|
209
|
-
---
|
|
210
|
-
|
|
211
|
-
## ๐งช Agent Test Results
|
|
212
|
-
|
|
213
|
-
All tests were executed using **LM Studio (qwen3.5-4b)** in `--protocol mock --non-interactive` mode against a simulated `Switch1` device.
|
|
214
|
-
|
|
215
|
-
---
|
|
216
|
-
|
|
217
|
-
### Test 1 โ Basic Interface & Static Route Configuration โ
PASSED
|
|
218
|
-
|
|
219
|
-
**Goal:** Configure `GigabitEthernet0/1` with IP `10.0.0.1/24`, add static route to `192.168.10.0/24` via `10.0.0.2`, and verify connectivity.
|
|
220
|
-
|
|
221
|
-
```bash
|
|
222
|
-
npx ts-node src/index.ts run --protocol mock --provider local --local-type lmstudio \
|
|
223
|
-
--model "qwen3.5-4b" \
|
|
224
|
-
--goal "Configure GigabitEthernet0/1 with IP 10.0.0.1/24, add static route 192.168.10.0/24 via 10.0.0.2, ping 192.168.10.5" \
|
|
225
|
-
--non-interactive
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
| Step | Command | Result | State Diff |
|
|
229
|
-
|------|---------|--------|------------|
|
|
230
|
-
| 1 | `configure terminal` | โ
| Mode entered |
|
|
231
|
-
| 2 | `interface GigabitEthernet0/1` | โ
| Interface mode |
|
|
232
|
-
| 3 | `description Primary` | โ
| description: unassigned โ "Primary" |
|
|
233
|
-
| 4 | `ip address 10.0.0.1 255.255.255.0` | โ
| IP + Connected route added |
|
|
234
|
-
| 5 | `exit` | โ
| Returned to Global Config |
|
|
235
|
-
| 6 | `ip route 192.168.10.0 255.255.255.0 10.0.0.2` | โ
| Static route added |
|
|
236
|
-
| 7 | `ping 192.168.10.5` | โ
| **100% success (5/5)** |
|
|
237
|
-
|
|
238
|
-
**Outcome:** All 8 steps completed. Ping 100% success rate confirmed.
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
### Test 2 โ Rollback on Invalid Interface โ
PASSED
|
|
243
|
-
|
|
244
|
-
**Goal:** Trigger automated rollback by trying to configure non-existent `GigabitEthernet0/777`.
|
|
245
|
-
|
|
246
|
-
| Behaviour | Result |
|
|
247
|
-
|-----------|--------|
|
|
248
|
-
| Command `interface GigabitEthernet0/777` issued | โ `InvalidInput` error returned |
|
|
249
|
-
| `TransactionManager` triggered rollback | โ
Backup restore completed |
|
|
250
|
-
| CLI submode context restored after rollback | โ
Returned to correct mode |
|
|
251
|
-
| Agent continued to next step | โ
No infinite retry loop |
|
|
252
|
-
|
|
253
|
-
---
|
|
254
|
-
|
|
255
|
-
### Test 3 โ Enterprise Multi-Step: VLAN + Interface + Route โ
PASSED (12/13 steps)
|
|
256
|
-
|
|
257
|
-
**Goal:** VLAN 100 (Engineering) + VLAN 200 (Finance), configure Gi0/1, trigger rollback on Gi0/999, add static route, verify with ping and `show vlan brief`.
|
|
258
|
-
|
|
259
|
-
```bash
|
|
260
|
-
npx ts-node src/index.ts run --protocol mock --provider local --local-type lmstudio \
|
|
261
|
-
--model "qwen3.5-4b" \
|
|
262
|
-
--goal "...17-step enterprise configuration..." \
|
|
263
|
-
--non-interactive
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
| Step | Command | Result | State Diff |
|
|
267
|
-
|------|---------|--------|------------|
|
|
268
|
-
| 1 | `configure terminal` | โ
| Global Config mode |
|
|
269
|
-
| 2 | `vlan 100` | โ
| **VLANs Added (+): 100** |
|
|
270
|
-
| 3 | `name Engineering` | โ
| Name stored |
|
|
271
|
-
| 4 | `exit` | โ
| Back to Global Config |
|
|
272
|
-
| 5 | `vlan 200` | โ
| **VLANs Added (+): 200** |
|
|
273
|
-
| 6 | `name Finance` | โ
| Name stored |
|
|
274
|
-
| 7 | `exit` | โ
| Back to Global Config |
|
|
275
|
-
| 8 | `interface GigabitEthernet0/1` | โ
| Interface mode |
|
|
276
|
-
| 9 | `description Uplink` | โ
| description: unassigned โ "Uplink" |
|
|
277
|
-
| 10 | `ip address 172.16.0.1 255.255.255.0` | โ
| IP + Connected route added |
|
|
278
|
-
| 11 | `no shutdown` | โ
| shutdown: YES โ NO |
|
|
279
|
-
| 12 | `exit` | โ
| Back to Global Config |
|
|
280
|
-
| 13 | `interface GigabitEthernet0/999` | โ ๏ธ | Not executed โ agent exited early |
|
|
281
|
-
| 14โ17 | route + ping + show vlan | โ ๏ธ | Skipped due to early exit |
|
|
282
|
-
|
|
283
|
-
**Issues found & fixed:**
|
|
284
|
-
- Agent stopped early (after step 12) before `show vlan brief` โ root cause: missing **Goal Completion Discipline** rule in system prompt.
|
|
285
|
-
- Fallback ping used `127.0.0.1` instead of actual route target โ root cause: `resolveValidationDestination` only checked interface IPs, not static routes.
|
|
286
|
-
|
|
287
|
-
**Fixes applied (`2026-05-28`):**
|
|
288
|
-
- `PromptEngine.ts` โ Added **Rule 8 (Goal Completion Discipline)**: agent must not stop until ALL numbered steps are done.
|
|
289
|
-
- `AgentLoop.ts` โ `resolveValidationDestination` now checks `show ip route` (static routes) first, then falls back to interface IPs.
|
|
290
|
-
- `AgentLoop.ts` โ Nudge message now injects the resolved destination IP instead of hardcoding `127.0.0.1`.
|
|
291
|
-
|
|
292
|
-
---
|
|
293
|
-
|
|
294
|
-
### Test 4 โ Enterprise Multi-Step (Post-Fix Re-Run) โ
PASSED (15/15 steps + MAX_STEPS hit)
|
|
295
|
-
|
|
296
|
-
Re-running Test 3 with **Rule 8 (Goal Completion Discipline)** and improved `resolveValidationDestination` applied.
|
|
297
|
-
|
|
298
|
-
| Step | Command | Result | State Diff |
|
|
299
|
-
|------|---------|--------|------------|
|
|
300
|
-
| 1 | `configure terminal` | โ
| Global Config mode |
|
|
301
|
-
| 2 | `vlan 100` | โ
| **VLANs Added (+): 100** |
|
|
302
|
-
| 3 | `name Engineering` | โ
| Name stored |
|
|
303
|
-
| 4 | `exit` | โ
| Back to Global Config |
|
|
304
|
-
| 5 | `vlan 200` | โ
| **VLANs Added (+): 200** |
|
|
305
|
-
| 6 | `name Finance` | โ
| Name stored |
|
|
306
|
-
| 7 | `exit` | โ
| Back to Global Config |
|
|
307
|
-
| 8 | `interface GigabitEthernet0/1` | โ
| Interface mode |
|
|
308
|
-
| 9 | `description Uplink` | โ
| description: unassigned โ "Uplink" |
|
|
309
|
-
| 10 | `ip address 172.16.0.1 255.255.255.0` | โ
| IP + Connected route added |
|
|
310
|
-
| 11 | `no shutdown` | โ
| shutdown: YES โ NO |
|
|
311
|
-
| 12 | `exit` | โ
| Back to Global Config |
|
|
312
|
-
| 13 | `interface GigabitEthernet0/999` | โ
| `BadInterfaceParameter` โ **Rollback triggered + context restored** |
|
|
313
|
-
| 14 | `ip route 10.50.0.0 255.255.255.0 172.16.0.254` | โ
| **Routes Added (+): 10.50.0.0/24 via 172.16.0.254** |
|
|
314
|
-
| 15 | `end` | โ
| Returned to Privileged EXEC |
|
|
315
|
-
| 16 | `ping 10.50.0.1` | โ ๏ธ | Not reached โ `MAX_STEPS = 15` limit hit |
|
|
316
|
-
| 17 | `show vlan brief` | โ ๏ธ | Not reached โ `MAX_STEPS = 15` limit hit |
|
|
317
|
-
|
|
318
|
-
**Progress vs Test 3:** Steps 13โ15 now execute correctly (was stopping at step 12). Rollback + context restore confirmed working. Static route `10.50.0.0/24` successfully added after rollback.
|
|
319
|
-
|
|
320
|
-
**Remaining issue:** `MAX_STEPS = 15` cap prevented steps 16โ17 from running.
|
|
321
|
-
**Fix applied:** `MAX_STEPS` increased to `20` in `AgentLoop.ts`.
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
---
|
|
325
|
-
|
|
326
|
-
### GPU Metrics (Live โ during inference)
|
|
327
|
-
|
|
328
|
-
| Metric | Observed Range |
|
|
329
|
-
|--------|---------------|
|
|
330
|
-
| GPU Utilization | 58% โ 85% |
|
|
331
|
-
| VRAM Used | 5019 โ 5094 MB / 6144 MB |
|
|
332
|
-
| Temperature | 77ยฐC โ 84ยฐC |
|
|
333
|
-
| Power Draw | 55 W โ 120 W |
|
|
334
|
-
|
|
335
|
-
GPU metrics are displayed in real-time in the thinking spinner via `nvidia-smi` polling every 1.5 seconds.
|
package/dist/cli/ui/ui.d.ts
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import ora from 'ora';
|
|
2
|
+
export declare function getTerminalWidth(): number;
|
|
3
|
+
export declare function wrapText(text: string, maxWidth: number): string[];
|
|
4
|
+
export declare class StreamWordWrapper {
|
|
5
|
+
private maxTextWidth;
|
|
6
|
+
private currentLineLength;
|
|
7
|
+
private wordBuffer;
|
|
8
|
+
private border;
|
|
9
|
+
constructor(maxTextWidth: number);
|
|
10
|
+
write(chunk: string): void;
|
|
11
|
+
flush(): void;
|
|
12
|
+
private flushWord;
|
|
13
|
+
}
|
|
2
14
|
export declare const logger: {
|
|
3
15
|
info: (msg: string) => void;
|
|
4
16
|
success: (msg: string) => void;
|
|
@@ -7,5 +19,9 @@ export declare const logger: {
|
|
|
7
19
|
critical: (msg: string) => void;
|
|
8
20
|
heading: (msg: string) => void;
|
|
9
21
|
reasoning: (msg: string) => void;
|
|
22
|
+
banner: () => void;
|
|
23
|
+
modelStatus: (model: string) => void;
|
|
24
|
+
diamond: (msg: string) => void;
|
|
25
|
+
toolBox: (title: string, content: string, success?: boolean) => void;
|
|
10
26
|
};
|
|
11
27
|
export declare function createSpinner(text: string): ora.Ora;
|
package/dist/cli/ui/ui.js
CHANGED
|
@@ -3,10 +3,132 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.logger = void 0;
|
|
6
|
+
exports.logger = exports.StreamWordWrapper = void 0;
|
|
7
|
+
exports.getTerminalWidth = getTerminalWidth;
|
|
8
|
+
exports.wrapText = wrapText;
|
|
7
9
|
exports.createSpinner = createSpinner;
|
|
8
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
11
|
const ora_1 = __importDefault(require("ora"));
|
|
12
|
+
const stripAnsi = (str) => str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
|
|
13
|
+
function applyHorizontalGradient(line) {
|
|
14
|
+
const colors = [
|
|
15
|
+
'#00f2fe',
|
|
16
|
+
'#4facfe',
|
|
17
|
+
'#7f00ff',
|
|
18
|
+
'#e100ff',
|
|
19
|
+
'#ff007f'
|
|
20
|
+
];
|
|
21
|
+
let result = '';
|
|
22
|
+
const len = line.length;
|
|
23
|
+
for (let i = 0; i < len; i++) {
|
|
24
|
+
const ratio = i / len;
|
|
25
|
+
const colorIndex = Math.min(Math.floor(ratio * colors.length), colors.length - 1);
|
|
26
|
+
result += chalk_1.default.hex(colors[colorIndex])(line[i]);
|
|
27
|
+
}
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
function getTerminalWidth() {
|
|
31
|
+
const cols = process.stdout.columns || 80;
|
|
32
|
+
return Math.min(100, Math.max(60, cols));
|
|
33
|
+
}
|
|
34
|
+
function wrapText(text, maxWidth) {
|
|
35
|
+
const lines = text.split(/\r?\n/);
|
|
36
|
+
const result = [];
|
|
37
|
+
for (const line of lines) {
|
|
38
|
+
if (line.length <= maxWidth) {
|
|
39
|
+
result.push(line);
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const words = line.split(' ');
|
|
43
|
+
let currentLine = '';
|
|
44
|
+
for (const word of words) {
|
|
45
|
+
let processedWord = word;
|
|
46
|
+
while (processedWord.length > maxWidth) {
|
|
47
|
+
if (currentLine) {
|
|
48
|
+
result.push(currentLine);
|
|
49
|
+
currentLine = '';
|
|
50
|
+
}
|
|
51
|
+
result.push(processedWord.slice(0, maxWidth));
|
|
52
|
+
processedWord = processedWord.slice(maxWidth);
|
|
53
|
+
}
|
|
54
|
+
if (currentLine.length === 0) {
|
|
55
|
+
currentLine = processedWord;
|
|
56
|
+
}
|
|
57
|
+
else if (currentLine.length + 1 + processedWord.length <= maxWidth) {
|
|
58
|
+
currentLine += ' ' + processedWord;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
result.push(currentLine);
|
|
62
|
+
currentLine = processedWord;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (currentLine) {
|
|
66
|
+
result.push(currentLine);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
class StreamWordWrapper {
|
|
72
|
+
maxTextWidth;
|
|
73
|
+
currentLineLength = 0;
|
|
74
|
+
wordBuffer = '';
|
|
75
|
+
border = chalk_1.default.blue('โ');
|
|
76
|
+
constructor(maxTextWidth) {
|
|
77
|
+
this.maxTextWidth = maxTextWidth;
|
|
78
|
+
}
|
|
79
|
+
write(chunk) {
|
|
80
|
+
for (let i = 0; i < chunk.length; i++) {
|
|
81
|
+
const char = chunk[i];
|
|
82
|
+
if (char === '\n') {
|
|
83
|
+
this.flushWord();
|
|
84
|
+
process.stdout.write('\n' + this.border + ' ');
|
|
85
|
+
this.currentLineLength = 0;
|
|
86
|
+
}
|
|
87
|
+
else if (char === ' ' || char === '\t') {
|
|
88
|
+
this.flushWord();
|
|
89
|
+
if (this.currentLineLength + 1 > this.maxTextWidth) {
|
|
90
|
+
process.stdout.write('\n' + this.border + ' ');
|
|
91
|
+
this.currentLineLength = 0;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
process.stdout.write(char);
|
|
95
|
+
this.currentLineLength += 1;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this.wordBuffer += char;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
flush() {
|
|
104
|
+
this.flushWord();
|
|
105
|
+
}
|
|
106
|
+
flushWord() {
|
|
107
|
+
if (this.wordBuffer.length === 0)
|
|
108
|
+
return;
|
|
109
|
+
if (this.currentLineLength + this.wordBuffer.length > this.maxTextWidth) {
|
|
110
|
+
if (this.currentLineLength > 0) {
|
|
111
|
+
process.stdout.write('\n' + this.border + ' ');
|
|
112
|
+
this.currentLineLength = 0;
|
|
113
|
+
}
|
|
114
|
+
let word = this.wordBuffer;
|
|
115
|
+
while (word.length > this.maxTextWidth) {
|
|
116
|
+
const part = word.slice(0, this.maxTextWidth);
|
|
117
|
+
process.stdout.write(chalk_1.default.gray.italic(part));
|
|
118
|
+
process.stdout.write('\n' + this.border + ' ');
|
|
119
|
+
word = word.slice(this.maxTextWidth);
|
|
120
|
+
}
|
|
121
|
+
process.stdout.write(chalk_1.default.gray.italic(word));
|
|
122
|
+
this.currentLineLength = word.length;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
process.stdout.write(chalk_1.default.gray.italic(this.wordBuffer));
|
|
126
|
+
this.currentLineLength += this.wordBuffer.length;
|
|
127
|
+
}
|
|
128
|
+
this.wordBuffer = '';
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.StreamWordWrapper = StreamWordWrapper;
|
|
10
132
|
exports.logger = {
|
|
11
133
|
info: (msg) => console.log(chalk_1.default.cyan('โน ') + msg),
|
|
12
134
|
success: (msg) => console.log(chalk_1.default.green('โ ') + chalk_1.default.bold.green(msg)),
|
|
@@ -22,12 +144,74 @@ exports.logger = {
|
|
|
22
144
|
console.log(chalk_1.default.magenta.bold(` โ${line}โ`) + '\n');
|
|
23
145
|
},
|
|
24
146
|
reasoning: (msg) => {
|
|
147
|
+
const width = getTerminalWidth();
|
|
25
148
|
const border = chalk_1.default.blue('โ');
|
|
26
|
-
|
|
27
|
-
|
|
149
|
+
const title = 'โโโโ ๐ค Agent Reasoning Thought Process ';
|
|
150
|
+
const topBorder = chalk_1.default.blue(title + 'โ'.repeat(Math.max(0, width - title.length)));
|
|
151
|
+
const bottomBorder = chalk_1.default.blue('โ' + 'โ'.repeat(Math.max(0, width - 1)));
|
|
152
|
+
console.log('\n' + topBorder);
|
|
153
|
+
const wrappedLines = wrapText(msg.trim(), width - 4);
|
|
154
|
+
wrappedLines.forEach(line => {
|
|
28
155
|
console.log(`${border} ${chalk_1.default.gray.italic(line)}`);
|
|
29
156
|
});
|
|
30
|
-
console.log(
|
|
157
|
+
console.log(bottomBorder + '\n');
|
|
158
|
+
},
|
|
159
|
+
banner: () => {
|
|
160
|
+
const logoLines = [
|
|
161
|
+
" > โโโโโโ โโ โโโโโโโ โโโโโโ โโโโโโ โโ โโ โโโ โโโ ",
|
|
162
|
+
" โโ โโ โโ โโ โโ โโ โโ โโ โโโโ โโโโ ",
|
|
163
|
+
" โโ โโ โโโโโโโ โโ โโ โโ โโ โโ โโ โโโโ โโ ",
|
|
164
|
+
" โโ โโ โโ โโ โโ โโ โโ โโ โโ โโ โโ ",
|
|
165
|
+
" โโโโโโ โโ โโโโโโโ โโโโโโ โโโโโโ โโโโโโโ โโโโโโโ โโ โโ "
|
|
166
|
+
];
|
|
167
|
+
console.log('');
|
|
168
|
+
for (const line of logoLines) {
|
|
169
|
+
console.log(applyHorizontalGradient(line));
|
|
170
|
+
}
|
|
171
|
+
console.log('');
|
|
172
|
+
console.log(chalk_1.default.white('Tips for getting started:'));
|
|
173
|
+
console.log(chalk_1.default.gray('1. Define configuration goals clearly.'));
|
|
174
|
+
console.log(chalk_1.default.gray('2. Ensure hardware serial or network connections are active.'));
|
|
175
|
+
console.log(chalk_1.default.gray('3. Dangerous commands will require human authorization.'));
|
|
176
|
+
console.log('');
|
|
177
|
+
},
|
|
178
|
+
modelStatus: (model) => {
|
|
179
|
+
console.log('\n' + chalk_1.default.gray.italic(` Responding with ${model}`));
|
|
180
|
+
},
|
|
181
|
+
diamond: (msg) => {
|
|
182
|
+
console.log(chalk_1.default.bold.magenta('โฆ ') + chalk_1.default.white(msg));
|
|
183
|
+
},
|
|
184
|
+
toolBox: (title, content, success = true) => {
|
|
185
|
+
const width = getTerminalWidth();
|
|
186
|
+
const border = chalk_1.default.gray('โ');
|
|
187
|
+
const top = chalk_1.default.gray('โ' + 'โ'.repeat(width - 2) + 'โ');
|
|
188
|
+
const bottom = chalk_1.default.gray('โ' + 'โ'.repeat(width - 2) + 'โ');
|
|
189
|
+
console.log(top);
|
|
190
|
+
const icon = success ? chalk_1.default.green('โ') : chalk_1.default.red('โ');
|
|
191
|
+
const maxWidth = width - 6;
|
|
192
|
+
const wrappedTitleLines = wrapText(title, maxWidth);
|
|
193
|
+
const firstTitle = wrappedTitleLines[0] || '';
|
|
194
|
+
const titleText = ` ${icon} ${chalk_1.default.white.bold(firstTitle)}`;
|
|
195
|
+
const cleanTitle = stripAnsi(titleText);
|
|
196
|
+
const paddedTitle = titleText + ' '.repeat(Math.max(0, width - 2 - cleanTitle.length));
|
|
197
|
+
console.log(`${border}${paddedTitle}${border}`);
|
|
198
|
+
for (let i = 1; i < wrappedTitleLines.length; i++) {
|
|
199
|
+
const extraTitleLine = ` ${chalk_1.default.white.bold(wrappedTitleLines[i])}`;
|
|
200
|
+
const cleanExtra = stripAnsi(extraTitleLine);
|
|
201
|
+
const paddedExtra = extraTitleLine + ' '.repeat(Math.max(0, width - 2 - cleanExtra.length));
|
|
202
|
+
console.log(`${border}${paddedExtra}${border}`);
|
|
203
|
+
}
|
|
204
|
+
console.log(`${border}${' '.repeat(width - 2)}${border}`);
|
|
205
|
+
const lines = content.split(/\r?\n/);
|
|
206
|
+
for (const line of lines) {
|
|
207
|
+
const wrappedLines = wrapText(line, maxWidth);
|
|
208
|
+
for (const wrappedLine of wrappedLines) {
|
|
209
|
+
const cleanLine = stripAnsi(wrappedLine);
|
|
210
|
+
const paddedLine = ` ${wrappedLine}` + ' '.repeat(Math.max(0, width - 2 - 2 - cleanLine.length));
|
|
211
|
+
console.log(`${border}${paddedLine}${border}`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
console.log(bottom);
|
|
31
215
|
}
|
|
32
216
|
};
|
|
33
217
|
function createSpinner(text) {
|
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":";;;;;;AAuBA,4CAGC;AAED,4BAuCC;AA2JD,sCAMC;AApOD,kDAA0B;AAC1B,8CAAsB;AAEtB,MAAM,SAAS,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,6EAA6E,EAAE,EAAE,CAAC,CAAC;AAElI,SAAS,uBAAuB,CAAC,IAAY;IACzC,MAAM,MAAM,GAAG;QACX,SAAS;QACT,SAAS;QAC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AAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;YAC5F,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,EAAE,CAAC,CAAC;QACpD,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,CAAC;QAE1D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACrC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC9C,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;gBACrC,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC;gBACzC,MAAM,UAAU,GAAG,KAAK,WAAW,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;gBAClG,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,EAAE,CAAC,CAAC;YACnD,CAAC;QACL,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACxB,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"}
|
|
@@ -69,13 +69,6 @@ class CiscoAgentLoop {
|
|
|
69
69
|
this.commandHints = await this.commandReferenceEngine.getPromptHints(userGoal, 6);
|
|
70
70
|
const telemetry = this.commandReferenceEngine.getWarmupTelemetry();
|
|
71
71
|
refSpinner.succeed(`Cisco command reference hints loaded${this.strictReferenceMode ? ' with strict-mode validation enabled' : ''}.`);
|
|
72
|
-
if (this.referenceTelemetry) {
|
|
73
|
-
ui_1.logger.info(`[RefTelemetry] source=${telemetry.source} commands=${telemetry.commandCount} loadMs=${telemetry.durationMs} strict=${telemetry.strictMode ? 'on' : 'off'}`);
|
|
74
|
-
ui_1.logger.info(`[RefTelemetry] cache=${telemetry.cachePath}`);
|
|
75
|
-
if (telemetry.error) {
|
|
76
|
-
ui_1.logger.warn(`[RefTelemetry] detail=${telemetry.error}`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
72
|
}
|
|
80
73
|
catch (err) {
|
|
81
74
|
this.commandHints = `Reference status: unavailable (${err.message}).`;
|
|
@@ -113,6 +106,7 @@ class CiscoAgentLoop {
|
|
|
113
106
|
}
|
|
114
107
|
return true;
|
|
115
108
|
});
|
|
109
|
+
ui_1.logger.modelStatus(this.llmClient.getModelName());
|
|
116
110
|
const modelSpinner = (0, ui_1.createSpinner)(`[Step ${executionDepth}/${MAX_STEPS}] Agent is thinking...`).start();
|
|
117
111
|
let gpuTimer = null;
|
|
118
112
|
let isThinking = true;
|
|
@@ -127,19 +121,48 @@ class CiscoAgentLoop {
|
|
|
127
121
|
updateGpu();
|
|
128
122
|
gpuTimer = setInterval(updateGpu, 1500);
|
|
129
123
|
let response;
|
|
124
|
+
let hasStartedStreaming = false;
|
|
125
|
+
const border = chalk_1.default.blue('โ');
|
|
126
|
+
let wrapper = undefined;
|
|
127
|
+
const onChunk = (chunk) => {
|
|
128
|
+
if (!hasStartedStreaming) {
|
|
129
|
+
hasStartedStreaming = true;
|
|
130
|
+
isThinking = false;
|
|
131
|
+
if (gpuTimer)
|
|
132
|
+
clearInterval(gpuTimer);
|
|
133
|
+
modelSpinner.stop();
|
|
134
|
+
ui_1.logger.diamond(`Step ${executionDepth}/${MAX_STEPS} โ Agent thought process:`);
|
|
135
|
+
const totalWidth = (0, ui_1.getTerminalWidth)();
|
|
136
|
+
const title = 'โโโโ ๐ค Agent Reasoning (Streaming) ';
|
|
137
|
+
const topBorder = chalk_1.default.blue(title + 'โ'.repeat(Math.max(0, totalWidth - title.length)));
|
|
138
|
+
console.log(topBorder);
|
|
139
|
+
process.stdout.write(`${border} `);
|
|
140
|
+
wrapper = new ui_1.StreamWordWrapper(totalWidth - 4);
|
|
141
|
+
}
|
|
142
|
+
const text = (chunk.reasoning || chunk.content || '').replace(/\r/g, '');
|
|
143
|
+
if (text && wrapper) {
|
|
144
|
+
wrapper.write(text);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
130
147
|
try {
|
|
131
|
-
response = await this.llmClient.generateCompletion(this.messages, activeTools);
|
|
148
|
+
response = await this.llmClient.generateCompletion(this.messages, activeTools, onChunk);
|
|
132
149
|
isThinking = false;
|
|
133
150
|
if (gpuTimer)
|
|
134
151
|
clearInterval(gpuTimer);
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
152
|
+
if (hasStartedStreaming) {
|
|
153
|
+
if (wrapper) {
|
|
154
|
+
wrapper.flush();
|
|
155
|
+
}
|
|
156
|
+
const totalWidth = (0, ui_1.getTerminalWidth)();
|
|
157
|
+
const bottomBorder = chalk_1.default.blue('โ' + 'โ'.repeat(Math.max(0, totalWidth - 1)));
|
|
158
|
+
console.log('\n' + bottomBorder + '\n');
|
|
142
159
|
}
|
|
160
|
+
else {
|
|
161
|
+
const finalGpu = await this.getGpuInfoAsync();
|
|
162
|
+
const gpuSuffix = finalGpu ? ` [GPU: ${finalGpu}]` : '';
|
|
163
|
+
modelSpinner.succeed(`[Step ${executionDepth}/${MAX_STEPS}] Thinking complete.${gpuSuffix}`);
|
|
164
|
+
}
|
|
165
|
+
this.messages.push(response);
|
|
143
166
|
}
|
|
144
167
|
catch (err) {
|
|
145
168
|
isThinking = false;
|
|
@@ -441,13 +464,15 @@ class CiscoAgentLoop {
|
|
|
441
464
|
const processedOutput = this.truncateOutput(rawOutput);
|
|
442
465
|
const verification = ErrorAnalyzer_1.ErrorAnalyzer.checkOutput(processedOutput);
|
|
443
466
|
if (verification.hasError) {
|
|
444
|
-
cmdSpinner.
|
|
467
|
+
cmdSpinner.stop();
|
|
468
|
+
ui_1.logger.toolBox(`execute_ios_command running "${cleanCommand}" on ${targetDeviceId}`, `IOS Error [${verification.errorType}]:\n${processedOutput}`, false);
|
|
445
469
|
const rbSpinner = (0, ui_1.createSpinner)(`[${targetDeviceId}] Reverting configuration changes...`).start();
|
|
446
470
|
let rollbackLogs = '';
|
|
447
471
|
if (tx) {
|
|
448
472
|
rollbackLogs = await tx.executeRollback(session, cleanCommand);
|
|
449
473
|
}
|
|
450
|
-
rbSpinner.
|
|
474
|
+
rbSpinner.stop();
|
|
475
|
+
ui_1.logger.toolBox(`automated_rollback on ${targetDeviceId}`, rollbackLogs || 'Rollback completed.', false);
|
|
451
476
|
AuditLogger_1.AuditLogger.log({
|
|
452
477
|
timestamp: new Date().toISOString(),
|
|
453
478
|
deviceId: targetDeviceId,
|
|
@@ -460,7 +485,8 @@ class CiscoAgentLoop {
|
|
|
460
485
|
this.injectToolResponse(call.id, 'execute_ios_command', `IOS Error [${verification.errorType}]:\n${processedOutput}\n\nAutomated configuration rollback executed:\n${rollbackLogs}`);
|
|
461
486
|
}
|
|
462
487
|
else {
|
|
463
|
-
cmdSpinner.
|
|
488
|
+
cmdSpinner.stop();
|
|
489
|
+
ui_1.logger.toolBox(`execute_ios_command running "${cleanCommand}" on ${targetDeviceId}`, processedOutput, true);
|
|
464
490
|
const snapshotB = await this.captureDeviceSnapshot(targetDeviceId);
|
|
465
491
|
let diffSummary = '';
|
|
466
492
|
if (snapshotA && snapshotB) {
|
|
@@ -681,17 +707,20 @@ class CiscoAgentLoop {
|
|
|
681
707
|
const successMatch = /success rate is (\d+) percent/i.exec(pingOutput);
|
|
682
708
|
const isFail = successMatch ? parseInt(successMatch[1], 10) === 0 : pingOutput.includes('.....');
|
|
683
709
|
if (isFail) {
|
|
684
|
-
pingSpinner.
|
|
710
|
+
pingSpinner.stop();
|
|
685
711
|
const failReason = `Remote ping failed from device "${targetDeviceId}" to ${destination}. Success rate is 0%. Analyze routing table, interfaces, and trunk links to troubleshoot.`;
|
|
712
|
+
ui_1.logger.toolBox(`ping_test from ${targetDeviceId} to ${destination}`, `PING TEST FAILED:\n${pingOutput}\n\n[Diagnostic Alert]: ${failReason}`, false);
|
|
686
713
|
this.injectToolResponse(call.id, 'ping_test', `PING TEST FAILED:\n${pingOutput}\n\n[Diagnostic Alert]: ${failReason}`);
|
|
687
714
|
}
|
|
688
715
|
else {
|
|
689
|
-
pingSpinner.
|
|
716
|
+
pingSpinner.stop();
|
|
717
|
+
ui_1.logger.toolBox(`ping_test from ${targetDeviceId} to ${destination}`, pingOutput, true);
|
|
690
718
|
this.injectToolResponse(call.id, 'ping_test', pingOutput);
|
|
691
719
|
}
|
|
692
720
|
}
|
|
693
721
|
catch (err) {
|
|
694
|
-
pingSpinner.
|
|
722
|
+
pingSpinner.stop();
|
|
723
|
+
ui_1.logger.toolBox(`ping_test from ${targetDeviceId} to ${destination}`, `Cisco Remote Ping Error: ${err.message}`, false);
|
|
695
724
|
this.injectToolResponse(call.id, 'ping_test', `Cisco Remote Ping Error: ${err.message}`);
|
|
696
725
|
}
|
|
697
726
|
}
|
|
@@ -703,12 +732,14 @@ class CiscoAgentLoop {
|
|
|
703
732
|
hostPingOutput.includes('Destination host unreachable') ||
|
|
704
733
|
hostPingOutput.includes('PING FAILED');
|
|
705
734
|
if (isLost) {
|
|
706
|
-
pingSpinner.
|
|
735
|
+
pingSpinner.stop();
|
|
707
736
|
const failReason = `Local host ping failed to destination ${destination}. Connection is unreachable. Verify router interfaces and routing configurations.`;
|
|
737
|
+
ui_1.logger.toolBox(`ping_test from Local Host to ${destination}`, `PING TEST FAILED:\n${hostPingOutput}\n\n[Diagnostic Alert]: ${failReason}`, false);
|
|
708
738
|
this.injectToolResponse(call.id, 'ping_test', `PING TEST FAILED:\n${hostPingOutput}\n\n[Diagnostic Alert]: ${failReason}`);
|
|
709
739
|
}
|
|
710
740
|
else {
|
|
711
|
-
pingSpinner.
|
|
741
|
+
pingSpinner.stop();
|
|
742
|
+
ui_1.logger.toolBox(`ping_test from Local Host to ${destination}`, hostPingOutput, true);
|
|
712
743
|
this.injectToolResponse(call.id, 'ping_test', hostPingOutput);
|
|
713
744
|
}
|
|
714
745
|
}
|