ciscollm-cli 1.3.2 → 1.3.4

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 (72) hide show
  1. package/README.md +19 -25
  2. package/dist/cli/commands/monitorCommand.js +17 -0
  3. package/dist/cli/commands/monitorCommand.js.map +1 -1
  4. package/dist/cli/commands/runCommand.d.ts +1 -3
  5. package/dist/cli/commands/runCommand.js +126 -452
  6. package/dist/cli/commands/runCommand.js.map +1 -1
  7. package/dist/cli/ui/interactiveWizard.d.ts +1 -0
  8. package/dist/cli/ui/interactiveWizard.js +429 -0
  9. package/dist/cli/ui/interactiveWizard.js.map +1 -0
  10. package/dist/cli/ui/ui.js +0 -5
  11. package/dist/cli/ui/ui.js.map +1 -1
  12. package/dist/core/agent/AgentLoop.d.ts +3 -0
  13. package/dist/core/agent/AgentLoop.js +71 -16
  14. package/dist/core/agent/AgentLoop.js.map +1 -1
  15. package/dist/core/agent/DigitalTwin.d.ts +10 -0
  16. package/dist/core/agent/DigitalTwin.js +40 -0
  17. package/dist/core/agent/DigitalTwin.js.map +1 -0
  18. package/dist/core/agent/IntentTranslator.d.ts +6 -0
  19. package/dist/core/agent/IntentTranslator.js +37 -0
  20. package/dist/core/agent/IntentTranslator.js.map +1 -0
  21. package/dist/core/agent/MemoryManager.d.ts +14 -0
  22. package/dist/core/agent/MemoryManager.js +89 -0
  23. package/dist/core/agent/MemoryManager.js.map +1 -0
  24. package/dist/core/agent/MultiAgentCoordinator.js +0 -2
  25. package/dist/core/agent/MultiAgentCoordinator.js.map +1 -1
  26. package/dist/core/agent/NetworkPlanner.d.ts +8 -0
  27. package/dist/core/agent/NetworkPlanner.js +78 -0
  28. package/dist/core/agent/NetworkPlanner.js.map +1 -0
  29. package/dist/core/agent/PromptEngine.d.ts +1 -1
  30. package/dist/core/agent/PromptEngine.js +10 -5
  31. package/dist/core/agent/PromptEngine.js.map +1 -1
  32. package/dist/core/plugins/PluginManager.d.ts +17 -0
  33. package/dist/core/plugins/PluginManager.js +106 -0
  34. package/dist/core/plugins/PluginManager.js.map +1 -0
  35. package/dist/core/rollback/TransactionManager.js +1 -6
  36. package/dist/core/rollback/TransactionManager.js.map +1 -1
  37. package/dist/index.js +26 -61
  38. package/dist/index.js.map +1 -1
  39. package/dist/infrastructure/llm/LLMClient.d.ts +1 -0
  40. package/dist/infrastructure/llm/LLMClient.js +32 -7
  41. package/dist/infrastructure/llm/LLMClient.js.map +1 -1
  42. package/dist/infrastructure/protocols/SshSession.d.ts +1 -0
  43. package/dist/infrastructure/protocols/SshSession.js +5 -4
  44. package/dist/infrastructure/protocols/SshSession.js.map +1 -1
  45. package/dist/infrastructure/protocols/TelnetSession.d.ts +1 -0
  46. package/dist/infrastructure/protocols/TelnetSession.js +5 -1
  47. package/dist/infrastructure/protocols/TelnetSession.js.map +1 -1
  48. package/dist/server/shell-simulator.js +1 -2
  49. package/dist/server/shell-simulator.js.map +1 -1
  50. package/dist/server/ssh.js +2 -2
  51. package/dist/server/ssh.js.map +1 -1
  52. package/dist/server/telnet.js +2 -2
  53. package/dist/server/telnet.js.map +1 -1
  54. package/dist/shared/bootBanner.d.ts +1 -0
  55. package/dist/shared/bootBanner.js +93 -0
  56. package/dist/shared/bootBanner.js.map +1 -0
  57. package/package.json +1 -1
  58. package/dist/cli/commands/dashboardCommand.d.ts +0 -1
  59. package/dist/cli/commands/dashboardCommand.js +0 -16
  60. package/dist/cli/commands/dashboardCommand.js.map +0 -1
  61. package/dist/cli/commands/shellCommand.d.ts +0 -1
  62. package/dist/cli/commands/shellCommand.js +0 -44
  63. package/dist/cli/commands/shellCommand.js.map +0 -1
  64. package/dist/infrastructure/protocols/CmlSession.d.ts +0 -26
  65. package/dist/infrastructure/protocols/CmlSession.js +0 -448
  66. package/dist/infrastructure/protocols/CmlSession.js.map +0 -1
  67. package/dist/infrastructure/protocols/NetconfSession.d.ts +0 -74
  68. package/dist/infrastructure/protocols/NetconfSession.js +0 -553
  69. package/dist/infrastructure/protocols/NetconfSession.js.map +0 -1
  70. package/dist/server/dashboard.d.ts +0 -3
  71. package/dist/server/dashboard.js +0 -1149
  72. package/dist/server/dashboard.js.map +0 -1
@@ -7,6 +7,7 @@ exports.runAction = runAction;
7
7
  const inquirer_1 = __importDefault(require("inquirer"));
8
8
  const chalk_1 = __importDefault(require("chalk"));
9
9
  const fs_1 = require("fs");
10
+ const path_1 = require("path");
10
11
  const MultiAgentCoordinator_1 = require("../../core/agent/MultiAgentCoordinator");
11
12
  const PlinkSerial_1 = require("../../infrastructure/protocols/PlinkSerial");
12
13
  const SshSession_1 = require("../../infrastructure/protocols/SshSession");
@@ -14,8 +15,9 @@ const TelnetSession_1 = require("../../infrastructure/protocols/TelnetSession");
14
15
  const LLMClient_1 = require("../../infrastructure/llm/LLMClient");
15
16
  const AgentLoop_1 = require("../../core/agent/AgentLoop");
16
17
  const ui_1 = require("../ui/ui");
17
- const dashboard_1 = require("../../server/dashboard");
18
- async function runAction(options, coordinatorWrapper, dashboardWrapper, cleanup) {
18
+ const interactiveWizard_1 = require("../ui/interactiveWizard");
19
+ const NetworkPlanner_1 = require("../../core/agent/NetworkPlanner");
20
+ async function runAction(options, coordinatorWrapper, cleanup) {
19
21
  let provider = options.provider;
20
22
  let localType = options.localType;
21
23
  if (localType) {
@@ -46,7 +48,6 @@ async function runAction(options, coordinatorWrapper, dashboardWrapper, cleanup)
46
48
  let refTelemetry = options.refTelemetry !== false;
47
49
  let nonInteractive = options.nonInteractive === true;
48
50
  let rbacRole = options.rbacRole || 'admin';
49
- let dashboardPort = options.dashboardPort ? parseInt(options.dashboardPort, 10) : 3000;
50
51
  if (nonInteractive) {
51
52
  process.env.CISCOLLM_NON_INTERACTIVE = 'true';
52
53
  }
@@ -79,462 +80,75 @@ async function runAction(options, coordinatorWrapper, dashboardWrapper, cleanup)
79
80
  }
80
81
  if (!localType)
81
82
  localType = 'ollama';
82
- if (!goal) {
83
- const detectedComs = await PlinkSerial_1.PlinkSerialSession.listAvailableComPorts();
84
- let currentStep = 'PROVIDER';
85
- const history = [];
86
- const answers = {
87
- provider: provider || 'local',
88
- localType: localType || 'ollama',
89
- apiKey: apiKey || '',
90
- model: model || '',
91
- endpoint: endpoint || '',
92
- protocol: protocol || 'serial',
93
- com: com || '',
94
- baud: baud || '9600',
95
- host: host || '',
96
- port: port || '',
97
- username: username || '',
98
- password: password || '',
99
- goal: ''
100
- };
101
- const goForward = (nextStep) => {
102
- history.push(currentStep);
103
- currentStep = nextStep;
104
- };
105
- const goBack = () => {
106
- if (history.length > 0) {
107
- currentStep = history.pop();
108
- }
109
- else {
110
- ui_1.logger.warn('Already at the first step.');
111
- }
112
- };
113
- const refreshConsole = () => {
114
- console.clear();
115
- ui_1.logger.banner();
116
- if (detectedComs.length > 0) {
117
- ui_1.logger.info('Detected active COM ports on system:');
118
- for (const port of detectedComs) {
119
- console.log(` ${chalk_1.default.yellow('•')} ${chalk_1.default.yellow(port)}`);
120
- }
121
- }
122
- console.log('');
123
- };
124
- while (currentStep !== 'CONFIRMATION') {
125
- refreshConsole();
126
- switch (currentStep) {
127
- case 'PROVIDER': {
128
- const ans = await inquirer_1.default.prompt([
129
- {
130
- type: 'list',
131
- name: 'provider',
132
- message: 'Select LLM Provider:',
133
- choices: [
134
- { name: 'Local (Ollama / LM Studio)', value: 'local' },
135
- { name: 'Cloud (OpenRouter)', value: 'cloud' }
136
- ],
137
- default: answers.provider
138
- }
139
- ]);
140
- answers.provider = ans.provider;
141
- if (answers.provider === 'local') {
142
- goForward('LOCAL_TYPE');
143
- }
144
- else {
145
- goForward('API_KEY');
146
- }
147
- break;
148
- }
149
- case 'LOCAL_TYPE': {
150
- const ans = await inquirer_1.default.prompt([
151
- {
152
- type: 'list',
153
- name: 'localType',
154
- message: 'Select Local LLM Service:',
155
- choices: [
156
- { name: 'Ollama', value: 'ollama' },
157
- { name: 'LM Studio', value: 'lmstudio' },
158
- { name: chalk_1.default.dim('< Go Back'), value: '__back__' }
159
- ],
160
- default: answers.localType
161
- }
162
- ]);
163
- if (ans.localType === '__back__') {
164
- goBack();
165
- }
166
- else {
167
- answers.localType = ans.localType;
168
- goForward('MODEL');
169
- }
170
- break;
171
- }
172
- case 'API_KEY': {
173
- const ans = await inquirer_1.default.prompt([
174
- {
175
- type: 'input',
176
- name: 'apiKey',
177
- message: 'Enter OpenRouter API Key (or type "back" to go back):',
178
- default: answers.apiKey || undefined
179
- }
180
- ]);
181
- if (ans.apiKey.trim().toLowerCase() === 'back') {
182
- goBack();
183
- }
184
- else {
185
- answers.apiKey = ans.apiKey;
186
- goForward('MODEL');
187
- }
188
- break;
189
- }
190
- case 'MODEL': {
191
- const defaultModel = answers.model || (answers.provider === 'cloud'
192
- ? 'nvidia/nemotron-3-super-120b-a12b:free'
193
- : 'qwen3.5:4b');
194
- const ans = await inquirer_1.default.prompt([
195
- {
196
- type: 'input',
197
- name: 'model',
198
- message: 'Enter LLM Model Name (or type "back" to go back):',
199
- default: defaultModel
200
- }
201
- ]);
202
- if (ans.model.trim().toLowerCase() === 'back') {
203
- goBack();
204
- }
205
- else {
206
- answers.model = ans.model;
207
- goForward('ENDPOINT');
208
- }
209
- break;
210
- }
211
- case 'ENDPOINT': {
212
- const defaultEndpoint = answers.endpoint || (answers.provider === 'cloud'
213
- ? 'https://openrouter.ai/api/v1'
214
- : (answers.localType === 'lmstudio'
215
- ? 'http://127.0.0.1:1234/v1'
216
- : 'http://127.0.0.1:11434/v1'));
217
- const ans = await inquirer_1.default.prompt([
218
- {
219
- type: 'input',
220
- name: 'endpoint',
221
- message: 'Enter LLM API Endpoint URL (or type "back" to go back):',
222
- default: defaultEndpoint
223
- }
224
- ]);
225
- if (ans.endpoint.trim().toLowerCase() === 'back') {
226
- goBack();
227
- }
228
- else {
229
- answers.endpoint = ans.endpoint;
230
- goForward('PROTOCOL');
231
- }
232
- break;
233
- }
234
- case 'PROTOCOL': {
235
- const ans = await inquirer_1.default.prompt([
236
- {
237
- type: 'list',
238
- name: 'protocol',
239
- message: 'Select Connection Protocol:',
240
- choices: [
241
- { name: 'serial', value: 'serial' },
242
- { name: 'ssh', value: 'ssh' },
243
- { name: 'telnet', value: 'telnet' },
244
- { name: chalk_1.default.dim('< Go Back'), value: '__back__' }
245
- ],
246
- default: answers.protocol
247
- }
248
- ]);
249
- if (ans.protocol === '__back__') {
250
- goBack();
251
- }
252
- else {
253
- answers.protocol = ans.protocol;
254
- if (answers.protocol === 'serial') {
255
- goForward('SERIAL_COM');
256
- }
257
- else {
258
- goForward('IP_HOST');
259
- }
260
- }
261
- break;
262
- }
263
- case 'SERIAL_COM': {
264
- if (detectedComs.length > 0) {
265
- const choices = detectedComs.map(port => {
266
- const match = /^(COM\d+)\b/i.exec(port);
267
- const portValue = match ? match[1].toUpperCase() : port;
268
- return { name: port, value: portValue };
269
- });
270
- choices.push({ name: 'Enter COM port(s) manually', value: '__manual__' });
271
- choices.push({ name: chalk_1.default.dim('< Go Back'), value: '__back__' });
272
- const ans = await inquirer_1.default.prompt([
273
- {
274
- type: 'checkbox',
275
- name: 'coms',
276
- message: 'Select COM Port(s) (Use Space to select, Enter to confirm):',
277
- choices: choices,
278
- validate: (input) => {
279
- if (input.length === 0) {
280
- return 'You must select at least one option.';
281
- }
282
- if (input.includes('__back__') && input.length > 1) {
283
- return 'Cannot select "< Go Back" along with other ports.';
284
- }
285
- if (input.includes('__manual__') && input.length > 1) {
286
- return 'Cannot select "Enter COM port(s) manually" along with other ports.';
287
- }
288
- return true;
289
- }
290
- }
291
- ]);
292
- if (ans.coms.includes('__back__')) {
293
- goBack();
294
- }
295
- else if (ans.coms.includes('__manual__')) {
296
- const manualAns = await inquirer_1.default.prompt([
297
- {
298
- type: 'input',
299
- name: 'com',
300
- message: 'Enter COM Port name(s) (comma-separated, e.g. COM3 or COM3,COM4):',
301
- validate: (input) => input.trim().length > 0 ? true : 'COM port is required.'
302
- }
303
- ]);
304
- answers.com = manualAns.com;
305
- goForward('SERIAL_BAUD');
306
- }
307
- else {
308
- answers.com = ans.coms.join(',');
309
- goForward('SERIAL_BAUD');
310
- }
311
- }
312
- else {
313
- const ans = await inquirer_1.default.prompt([
314
- {
315
- type: 'input',
316
- name: 'com',
317
- message: 'Enter COM Port name(s) (comma-separated, e.g. COM3 or COM3,COM4) (or type "back" to go back):',
318
- default: answers.com || undefined,
319
- validate: (input) => {
320
- if (input.trim().toLowerCase() === 'back')
321
- return true;
322
- return input.trim().length > 0 ? true : 'COM port is required.';
323
- }
324
- }
325
- ]);
326
- if (ans.com.trim().toLowerCase() === 'back') {
327
- goBack();
328
- }
329
- else {
330
- answers.com = ans.com;
331
- goForward('SERIAL_BAUD');
332
- }
333
- }
334
- break;
335
- }
336
- case 'SERIAL_BAUD': {
337
- const ans = await inquirer_1.default.prompt([
338
- {
339
- type: 'list',
340
- name: 'baud',
341
- message: 'Select Serial Baud Rate:',
342
- choices: [
343
- '9600', '19200', '38400', '57600', '115200',
344
- { name: chalk_1.default.dim('< Go Back'), value: '__back__' }
345
- ],
346
- default: answers.baud
347
- }
348
- ]);
349
- if (ans.baud === '__back__') {
350
- goBack();
351
- }
352
- else {
353
- answers.baud = ans.baud;
354
- goForward('GOAL');
355
- }
356
- break;
357
- }
358
- case 'IP_HOST': {
359
- const ans = await inquirer_1.default.prompt([
360
- {
361
- type: 'input',
362
- name: 'host',
363
- message: 'Enter Target IP address(es) / Hostname(s) (comma-separated) (or type "back" to go back):',
364
- default: answers.host || undefined,
365
- validate: (input) => {
366
- if (input.trim().toLowerCase() === 'back')
367
- return true;
368
- return input.trim().length > 0 ? true : 'Host address is required.';
369
- }
370
- }
371
- ]);
372
- if (ans.host.trim().toLowerCase() === 'back') {
373
- goBack();
374
- }
375
- else {
376
- answers.host = ans.host;
377
- goForward('IP_PORT');
378
- }
379
- break;
380
- }
381
- case 'IP_PORT': {
382
- const ans = await inquirer_1.default.prompt([
383
- {
384
- type: 'input',
385
- name: 'port',
386
- message: 'Enter Connection Port (leave empty for default) (or type "back" to go back):',
387
- default: answers.port || undefined
388
- }
389
- ]);
390
- if (ans.port.trim().toLowerCase() === 'back') {
391
- goBack();
392
- }
393
- else {
394
- answers.port = ans.port;
395
- goForward('IP_USER');
396
- }
397
- break;
398
- }
399
- case 'IP_USER': {
400
- const ans = await inquirer_1.default.prompt([
401
- {
402
- type: 'input',
403
- name: 'username',
404
- message: 'Enter Device Username (leave empty if none) (or type "back" to go back):',
405
- default: answers.username || undefined
406
- }
407
- ]);
408
- if (ans.username.trim().toLowerCase() === 'back') {
409
- goBack();
410
- }
411
- else {
412
- answers.username = ans.username;
413
- goForward('IP_PASS');
414
- }
415
- break;
416
- }
417
- case 'IP_PASS': {
418
- const ans = await inquirer_1.default.prompt([
419
- {
420
- type: 'password',
421
- name: 'password',
422
- message: 'Enter Device Password (or type "back" to go back):',
423
- default: answers.password || undefined
424
- }
425
- ]);
426
- if (ans.password === 'back') {
427
- goBack();
428
- }
429
- else {
430
- answers.password = ans.password;
431
- goForward('GOAL');
432
- }
433
- break;
434
- }
435
- case 'GOAL': {
436
- const ans = await inquirer_1.default.prompt([
437
- {
438
- type: 'input',
439
- name: 'goal',
440
- message: 'Enter Execution Goal / Intent (or type "back" to go back):',
441
- default: answers.goal || undefined,
442
- validate: (input) => {
443
- if (input.trim().toLowerCase() === 'back')
444
- return true;
445
- return input.trim().length > 0 ? true : 'Execution goal is required.';
446
- }
447
- }
448
- ]);
449
- if (ans.goal.trim().toLowerCase() === 'back') {
450
- goBack();
451
- }
452
- else {
453
- answers.goal = ans.goal;
454
- goForward('CONFIRMATION');
455
- }
456
- break;
457
- }
458
- case 'CONFIRMATION':
459
- break;
460
- }
461
- }
462
- // Show configuration confirmation wizard summary
463
- refreshConsole();
464
- console.log(chalk_1.default.bold.yellow('=== CISCOLLM CONFIGURATION CONFIRMATION ==='));
465
- console.log(`• Provider: ${chalk_1.default.green(answers.provider.toUpperCase())}`);
466
- if (answers.provider === 'local') {
467
- console.log(`• Local Type: ${chalk_1.default.green(answers.localType.toUpperCase())}`);
468
- }
469
- console.log(`• Model: ${chalk_1.default.green(answers.model || 'qwen3.5:4b')}`);
470
- console.log(`• Endpoint URL: ${chalk_1.default.green(answers.endpoint)}`);
471
- console.log(`• Protocol: ${chalk_1.default.green(answers.protocol.toUpperCase())}`);
472
- if (answers.protocol === 'serial') {
473
- console.log(`• COM Port(s): ${chalk_1.default.green(answers.com)}`);
474
- console.log(`• Baud Rate: ${chalk_1.default.green(answers.baud)}`);
475
- }
476
- else {
477
- console.log(`• Host IP(s): ${chalk_1.default.green(answers.host)}`);
478
- console.log(`• Connection Port: ${chalk_1.default.green(answers.port || '(default)')}`);
479
- console.log(`• Login Username: ${chalk_1.default.green(answers.username || '(none)')}`);
83
+ let sessionName = options.sessions;
84
+ const sessionsFilePath = (0, path_1.join)(process.cwd(), 'sessions.json');
85
+ let savedSessions = {};
86
+ if ((0, fs_1.existsSync)(sessionsFilePath)) {
87
+ try {
88
+ savedSessions = JSON.parse((0, fs_1.readFileSync)(sessionsFilePath, 'utf8'));
480
89
  }
481
- console.log(`• Execution Goal: ${chalk_1.default.cyan(answers.goal)}`);
482
- console.log(chalk_1.default.bold.yellow('==========================================='));
483
- const confirmAns = await inquirer_1.default.prompt([
484
- {
485
- type: 'list',
486
- name: 'confirm',
487
- message: 'Do you want to proceed with this configuration?',
488
- choices: [
489
- { name: 'Yes, start execution', value: 'yes' },
490
- { name: 'Edit Execution Goal', value: 'edit_goal' },
491
- { name: 'Restart Wizard', value: 'restart' },
492
- { name: 'Cancel and Exit', value: 'cancel' }
493
- ]
494
- }
495
- ]);
496
- if (confirmAns.confirm === 'yes') {
497
- provider = answers.provider;
498
- localType = answers.localType;
499
- apiKey = answers.apiKey;
500
- model = answers.model;
501
- endpoint = answers.endpoint;
502
- protocol = answers.protocol;
503
- com = answers.com;
504
- baud = answers.baud;
505
- host = answers.host;
506
- port = answers.port;
507
- username = answers.username;
508
- password = answers.password;
90
+ catch (e) { }
91
+ }
92
+ if (sessionName && savedSessions[sessionName]) {
93
+ const s = savedSessions[sessionName];
94
+ provider = provider || s.provider;
95
+ localType = localType || s.localType;
96
+ apiKey = apiKey || s.apiKey;
97
+ model = model || s.model;
98
+ endpoint = endpoint || s.endpoint;
99
+ protocol = protocol || s.protocol;
100
+ com = com || s.com;
101
+ baud = baud || s.baud;
102
+ host = host || s.host;
103
+ port = port || s.port;
104
+ username = username || s.username;
105
+ password = password || s.password;
106
+ ui_1.logger.info(`Loaded session '${sessionName}' from ${sessionsFilePath}`);
107
+ }
108
+ options.provider = provider;
109
+ options.localType = localType;
110
+ options.apiKey = apiKey;
111
+ options.model = model;
112
+ options.endpoint = endpoint;
113
+ options.protocol = protocol;
114
+ options.com = com;
115
+ options.baud = baud;
116
+ options.host = host;
117
+ options.port = port;
118
+ options.username = username;
119
+ options.password = password;
120
+ if (!com && !host) {
121
+ const answers = await (0, interactiveWizard_1.runInteractiveWizard)(options, false);
122
+ provider = answers.provider;
123
+ localType = answers.localType;
124
+ apiKey = answers.apiKey;
125
+ model = answers.model;
126
+ endpoint = answers.endpoint;
127
+ protocol = answers.protocol;
128
+ com = answers.com;
129
+ baud = answers.baud;
130
+ host = answers.host;
131
+ port = answers.port;
132
+ username = answers.username;
133
+ password = answers.password;
134
+ if (answers.goal)
509
135
  goal = answers.goal;
136
+ }
137
+ if (sessionName) {
138
+ savedSessions[sessionName] = {
139
+ provider, localType, apiKey, model, endpoint, protocol, com, baud, host, port, username, password
140
+ };
141
+ try {
142
+ (0, fs_1.writeFileSync)(sessionsFilePath, JSON.stringify(savedSessions, null, 2), 'utf8');
143
+ ui_1.logger.info(`Session setup saved to '${sessionName}' in ${sessionsFilePath}`);
510
144
  }
511
- else if (confirmAns.confirm === 'edit_goal') {
512
- answers.goal = '';
513
- currentStep = 'GOAL';
514
- // Loop back to prompt goal
515
- // Wait, we need to restart the wizard loop! Let's re-run this function or let the while loop run.
516
- // Because currentStep is set to 'GOAL' and answers are preserved, calling runAction again is easiest.
517
- options.goal = undefined;
518
- return runAction(options, coordinatorWrapper, dashboardWrapper, cleanup);
519
- }
520
- else if (confirmAns.confirm === 'restart') {
521
- options.goal = undefined;
522
- return runAction({ ...options, provider: undefined, localType: undefined, model: undefined, endpoint: undefined, protocol: undefined, com: undefined, host: undefined, username: undefined, password: undefined }, coordinatorWrapper, dashboardWrapper, cleanup);
523
- }
524
- else {
525
- ui_1.logger.info('Configuration wizard cancelled.');
526
- process.exit(0);
145
+ catch (err) {
146
+ ui_1.logger.warn(`Failed to save session: ${err.message}`);
527
147
  }
528
148
  }
529
149
  ui_1.logger.info(`Initializing system link in [${provider.toUpperCase()}] mode using ${protocol.toUpperCase()}...`);
530
150
  ui_1.logger.info(`Command reference policy: strict=${strictCommandRef ? 'on' : 'off'}, telemetry=${refTelemetry ? 'on' : 'off'}`);
531
151
  coordinatorWrapper.active = new MultiAgentCoordinator_1.MultiAgentCoordinator();
532
- try {
533
- dashboardWrapper.server = (0, dashboard_1.startDashboardServer)(coordinatorWrapper.active, dashboardPort);
534
- }
535
- catch (e) {
536
- ui_1.logger.warn(`Failed to auto-start live Visual Control Dashboard: ${e.message}`);
537
- }
538
152
  try {
539
153
  if (protocol === 'serial') {
540
154
  if (!com) {
@@ -621,7 +235,67 @@ async function runAction(options, coordinatorWrapper, dashboardWrapper, cleanup)
621
235
  referenceTelemetry: refTelemetry,
622
236
  rbacRole: rbacRole
623
237
  });
624
- await agent.run(goal);
238
+ const { wantToContinue } = await inquirer_1.default.prompt([
239
+ {
240
+ type: 'confirm',
241
+ name: 'wantToContinue',
242
+ message: chalk_1.default.cyan('Setup completed successfully. Do you want to continue chatting / start execution?'),
243
+ default: true
244
+ }
245
+ ]);
246
+ if (wantToContinue) {
247
+ if (!goal) {
248
+ const { chatGoal } = await inquirer_1.default.prompt([
249
+ {
250
+ type: 'input',
251
+ name: 'chatGoal',
252
+ message: 'Enter your goal or instruction:',
253
+ validate: (input) => input.trim().length > 0 ? true : 'Goal cannot be empty.'
254
+ }
255
+ ]);
256
+ goal = chatGoal;
257
+ }
258
+ const planner = new NetworkPlanner_1.NetworkPlanner(localAIClient, coordinatorWrapper.active);
259
+ let planApproved = false;
260
+ let currentGoal = goal;
261
+ while (!planApproved) {
262
+ const plan = await planner.generatePlan(currentGoal);
263
+ const { planAction } = await inquirer_1.default.prompt([
264
+ {
265
+ type: 'list',
266
+ name: 'planAction',
267
+ message: chalk_1.default.cyan('Review the Orchestration Plan above. What would you like to do?'),
268
+ choices: [
269
+ { name: 'Approve and Execute', value: 'approve' },
270
+ { name: 'Provide Feedback / Revise Plan', value: 'revise' },
271
+ { name: 'Cancel Execution', value: 'cancel' }
272
+ ]
273
+ }
274
+ ]);
275
+ if (planAction === 'approve') {
276
+ planApproved = true;
277
+ currentGoal = `Approved Execution Blueprint:\n${plan}\n\nUser Goal: ${currentGoal}`;
278
+ }
279
+ else if (planAction === 'revise') {
280
+ const { feedback } = await inquirer_1.default.prompt([
281
+ {
282
+ type: 'input',
283
+ name: 'feedback',
284
+ message: 'Enter your feedback to revise the plan:'
285
+ }
286
+ ]);
287
+ currentGoal = `${currentGoal}\nFeedback for revision: ${feedback}`;
288
+ }
289
+ else {
290
+ ui_1.logger.info('Execution cancelled by user.');
291
+ return;
292
+ }
293
+ }
294
+ await agent.run(currentGoal);
295
+ }
296
+ else {
297
+ ui_1.logger.info('Exiting normally as requested.');
298
+ }
625
299
  }
626
300
  catch (err) {
627
301
  ui_1.logger.critical(`Execution Error: ${err.message}`);