4runr-os 1.0.23 → 1.0.28
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/dist/events.d.ts +35 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +89 -0
- package/dist/events.js.map +1 -0
- package/dist/index.js +166 -31
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +74 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +7 -0
- package/dist/models.js.map +1 -0
- package/dist/store.d.ts +3 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +2 -0
- package/dist/store.js.map +1 -1
- package/dist/system-state.d.ts +96 -0
- package/dist/system-state.d.ts.map +1 -0
- package/dist/system-state.js +273 -0
- package/dist/system-state.js.map +1 -0
- package/dist/ui/intelligence-posture-view.d.ts +22 -0
- package/dist/ui/intelligence-posture-view.d.ts.map +1 -0
- package/dist/ui/intelligence-posture-view.js +169 -0
- package/dist/ui/intelligence-posture-view.js.map +1 -0
- package/dist/ui-primitives.d.ts +5 -2
- package/dist/ui-primitives.d.ts.map +1 -1
- package/dist/ui-primitives.js +22 -9
- package/dist/ui-primitives.js.map +1 -1
- package/package.json +1 -1
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event Ring Buffer
|
|
3
|
+
* Phase 2: Track meaningful operational events for Live Operations Feed
|
|
4
|
+
*/
|
|
5
|
+
import type { OperationEvent } from './models.js';
|
|
6
|
+
/**
|
|
7
|
+
* Add event to operations feed
|
|
8
|
+
* Events are structured objects, not strings
|
|
9
|
+
*/
|
|
10
|
+
export declare function addOperationEvent(event: OperationEvent): void;
|
|
11
|
+
/**
|
|
12
|
+
* Helper: Create event for run started
|
|
13
|
+
*/
|
|
14
|
+
export declare function eventRunStarted(agentName: string, runId: string): OperationEvent;
|
|
15
|
+
/**
|
|
16
|
+
* Helper: Create event for run completed
|
|
17
|
+
*/
|
|
18
|
+
export declare function eventRunCompleted(agentName: string, runId: string, status: 'SUCCESS' | 'FAILED'): OperationEvent;
|
|
19
|
+
/**
|
|
20
|
+
* Helper: Create event for error detected
|
|
21
|
+
*/
|
|
22
|
+
export declare function eventErrorDetected(description: string, metadata?: Record<string, any>, severity?: 'warning' | 'critical'): OperationEvent;
|
|
23
|
+
/**
|
|
24
|
+
* Helper: Create event for connection established
|
|
25
|
+
*/
|
|
26
|
+
export declare function eventConnectionEstablished(target: string): OperationEvent;
|
|
27
|
+
/**
|
|
28
|
+
* Helper: Create event for connection lost
|
|
29
|
+
*/
|
|
30
|
+
export declare function eventConnectionLost(): OperationEvent;
|
|
31
|
+
/**
|
|
32
|
+
* Helper: Create event for system state change
|
|
33
|
+
*/
|
|
34
|
+
export declare function eventSystemStateChange(description: string, metadata?: Record<string, any>): OperationEvent;
|
|
35
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAKlD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAQ7D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc,CAQhF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,cAAc,CAQhH;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,GAAE,SAAS,GAAG,UAAsB,GAAG,cAAc,CAQpJ;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAQzE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,cAAc,CAOpD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,cAAc,CAQ1G"}
|
package/dist/events.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event Ring Buffer
|
|
3
|
+
* Phase 2: Track meaningful operational events for Live Operations Feed
|
|
4
|
+
*/
|
|
5
|
+
import { updateAppState, getState } from './store.js';
|
|
6
|
+
const MAX_EVENTS = 10; // Ring buffer size
|
|
7
|
+
/**
|
|
8
|
+
* Add event to operations feed
|
|
9
|
+
* Events are structured objects, not strings
|
|
10
|
+
*/
|
|
11
|
+
export function addOperationEvent(event) {
|
|
12
|
+
const state = getState();
|
|
13
|
+
const events = [...state.operationEvents, event];
|
|
14
|
+
// Keep only last MAX_EVENTS
|
|
15
|
+
const trimmedEvents = events.slice(-MAX_EVENTS);
|
|
16
|
+
updateAppState({ operationEvents: trimmedEvents });
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Helper: Create event for run started
|
|
20
|
+
*/
|
|
21
|
+
export function eventRunStarted(agentName, runId) {
|
|
22
|
+
return {
|
|
23
|
+
type: 'RUN_STARTED',
|
|
24
|
+
description: `Execution started: ${agentName}`,
|
|
25
|
+
timestamp: Date.now(),
|
|
26
|
+
severity: 'info',
|
|
27
|
+
metadata: { agentName, runId },
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Helper: Create event for run completed
|
|
32
|
+
*/
|
|
33
|
+
export function eventRunCompleted(agentName, runId, status) {
|
|
34
|
+
return {
|
|
35
|
+
type: 'RUN_COMPLETED',
|
|
36
|
+
description: `Execution ${status.toLowerCase()}: ${agentName}`,
|
|
37
|
+
timestamp: Date.now(),
|
|
38
|
+
severity: status === 'FAILED' ? 'warning' : 'info',
|
|
39
|
+
metadata: { agentName, runId, status },
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Helper: Create event for error detected
|
|
44
|
+
*/
|
|
45
|
+
export function eventErrorDetected(description, metadata, severity = 'warning') {
|
|
46
|
+
return {
|
|
47
|
+
type: 'ERROR_DETECTED',
|
|
48
|
+
description,
|
|
49
|
+
timestamp: Date.now(),
|
|
50
|
+
severity,
|
|
51
|
+
metadata,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Helper: Create event for connection established
|
|
56
|
+
*/
|
|
57
|
+
export function eventConnectionEstablished(target) {
|
|
58
|
+
return {
|
|
59
|
+
type: 'CONNECTION_ESTABLISHED',
|
|
60
|
+
description: `Connected to ${target}`,
|
|
61
|
+
timestamp: Date.now(),
|
|
62
|
+
severity: 'info',
|
|
63
|
+
metadata: { target },
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Helper: Create event for connection lost
|
|
68
|
+
*/
|
|
69
|
+
export function eventConnectionLost() {
|
|
70
|
+
return {
|
|
71
|
+
type: 'CONNECTION_LOST',
|
|
72
|
+
description: 'Connection lost',
|
|
73
|
+
timestamp: Date.now(),
|
|
74
|
+
severity: 'warning',
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Helper: Create event for system state change
|
|
79
|
+
*/
|
|
80
|
+
export function eventSystemStateChange(description, metadata) {
|
|
81
|
+
return {
|
|
82
|
+
type: 'SYSTEM_STATE_CHANGE',
|
|
83
|
+
description,
|
|
84
|
+
timestamp: Date.now(),
|
|
85
|
+
severity: 'info',
|
|
86
|
+
metadata,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtD,MAAM,UAAU,GAAG,EAAE,CAAC,CAAC,mBAAmB;AAE1C;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAqB;IACrD,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IAEjD,4BAA4B;IAC5B,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC;IAEhD,cAAc,CAAC,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,SAAiB,EAAE,KAAa;IAC9D,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,sBAAsB,SAAS,EAAE;QAC9C,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;KAC/B,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAiB,EAAE,KAAa,EAAE,MAA4B;IAC9F,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,aAAa,MAAM,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE;QAC9D,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,QAAQ,EAAE,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;QAClD,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE;KACvC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAAmB,EAAE,QAA8B,EAAE,WAAmC,SAAS;IAClI,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,WAAW;QACX,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,QAAQ;QACR,QAAQ;KACT,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAc;IACvD,OAAO;QACL,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,gBAAgB,MAAM,EAAE;QACrC,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,EAAE,MAAM,EAAE;KACrB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,iBAAiB;QAC9B,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,QAAQ,EAAE,SAAS;KACpB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,WAAmB,EAAE,QAA8B;IACxF,OAAO;QACL,IAAI,EAAE,qBAAqB;QAC3B,WAAW;QACX,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,QAAQ,EAAE,MAAM;QAChB,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,9 @@ import { getLastAgent, setLastAgent, setLastConnectionTarget, setLastMode, } fro
|
|
|
17
17
|
import { Copy } from './copy.js';
|
|
18
18
|
import { createProgress, stopAllAnimations } from './animations.js';
|
|
19
19
|
import { getState, updateAppState } from './store.js';
|
|
20
|
-
import {
|
|
20
|
+
import { renderIntelligencePostureView } from './ui/intelligence-posture-view.js';
|
|
21
|
+
import { systemStateProvider } from './system-state.js';
|
|
22
|
+
import { addOperationEvent, eventConnectionEstablished, } from './events.js';
|
|
21
23
|
// Legacy color aliases for backward compatibility during refactor
|
|
22
24
|
const cyan = C_ACCENT;
|
|
23
25
|
const green = C_SUCCESS;
|
|
@@ -212,6 +214,7 @@ async function bootSequence() {
|
|
|
212
214
|
gatewayUrl = urlToUse;
|
|
213
215
|
gatewayStatus = 'OK';
|
|
214
216
|
setLastConnectionTarget(urlToUse);
|
|
217
|
+
addOperationEvent(eventConnectionEstablished(urlToUse));
|
|
215
218
|
}
|
|
216
219
|
catch {
|
|
217
220
|
gatewayStatus = 'WARN';
|
|
@@ -287,9 +290,9 @@ async function bootSequence() {
|
|
|
287
290
|
}
|
|
288
291
|
// Save mode to state
|
|
289
292
|
setLastMode(localMode ? 'LOCAL' : 'REMOTE');
|
|
290
|
-
// Auto transition to
|
|
293
|
+
// Auto transition to Intelligence Posture View
|
|
291
294
|
await sleep(200);
|
|
292
|
-
await
|
|
295
|
+
await showIntelligencePostureView();
|
|
293
296
|
}
|
|
294
297
|
/**
|
|
295
298
|
* Start session expiry checker
|
|
@@ -412,11 +415,10 @@ function formatUptime() {
|
|
|
412
415
|
*
|
|
413
416
|
* This is the pattern all views should follow.
|
|
414
417
|
*/
|
|
415
|
-
async function
|
|
418
|
+
async function showIntelligencePostureView() {
|
|
416
419
|
// 1. Update state
|
|
417
|
-
currentView = '
|
|
420
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
418
421
|
// 2. Sync legacy globals to state store
|
|
419
|
-
// TODO: Once all code uses state store, this sync won't be needed
|
|
420
422
|
syncStateToStore();
|
|
421
423
|
// 3. Sync customAgents and runHistory to store
|
|
422
424
|
const state = getState();
|
|
@@ -424,10 +426,14 @@ async function showHomeView() {
|
|
|
424
426
|
customAgents: customAgents,
|
|
425
427
|
runHistory: runHistory,
|
|
426
428
|
});
|
|
427
|
-
//
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
429
|
+
// Phase 5: SystemState is computed on-demand, not stored
|
|
430
|
+
// The UI reads from SystemState, which is computed from AppState
|
|
431
|
+
// Invalidate cache to force fresh computation
|
|
432
|
+
systemStateProvider.invalidate();
|
|
433
|
+
// 5. Call pure renderer (state → string)
|
|
434
|
+
const finalState = getState();
|
|
435
|
+
const output = renderIntelligencePostureView(finalState);
|
|
436
|
+
// 6. Output result
|
|
431
437
|
console.log();
|
|
432
438
|
console.log(output);
|
|
433
439
|
}
|
|
@@ -478,7 +484,7 @@ const commands = {
|
|
|
478
484
|
else {
|
|
479
485
|
// Clean, precise help menu
|
|
480
486
|
const commandLines = [];
|
|
481
|
-
commandLines.push(`${C_LINK}
|
|
487
|
+
commandLines.push(`${C_LINK}posture${RESET} Intelligence briefing`);
|
|
482
488
|
commandLines.push(`${C_LINK}connect${RESET} Connect to remote`);
|
|
483
489
|
commandLines.push(`${C_LINK}build${RESET} Create or edit agent`);
|
|
484
490
|
commandLines.push(`${C_LINK}start${RESET} Begin execution`);
|
|
@@ -692,7 +698,7 @@ const commands = {
|
|
|
692
698
|
}
|
|
693
699
|
console.log(Section('ACTIONS', actionLines));
|
|
694
700
|
console.log();
|
|
695
|
-
currentView = '
|
|
701
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
696
702
|
return;
|
|
697
703
|
}
|
|
698
704
|
// Handle edit action
|
|
@@ -701,7 +707,7 @@ const commands = {
|
|
|
701
707
|
if (!agent) {
|
|
702
708
|
console.log(Alert('error', `Agent not found: ${agentName}`, undefined, 'build'));
|
|
703
709
|
console.log();
|
|
704
|
-
currentView = '
|
|
710
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
705
711
|
return;
|
|
706
712
|
}
|
|
707
713
|
await showAgentConfig(agent);
|
|
@@ -725,14 +731,14 @@ const commands = {
|
|
|
725
731
|
console.log(`${red}Providers unavailable${reset}`);
|
|
726
732
|
console.log(`${dim}Reason: ${error.message}${reset}`);
|
|
727
733
|
console.log(`${dim}Next: ${cyan}config${reset}${dim} to configure providers${reset}\n`);
|
|
728
|
-
currentView = '
|
|
734
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
729
735
|
return;
|
|
730
736
|
}
|
|
731
737
|
if (providers.length === 0) {
|
|
732
738
|
console.log(`${red}No providers configured${reset}`);
|
|
733
739
|
console.log(`${dim}Reason: No API keys found${reset}`);
|
|
734
740
|
console.log(`${dim}Next: ${cyan}config${reset}${dim} to add API keys${reset}\n`);
|
|
735
|
-
currentView = '
|
|
741
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
736
742
|
return;
|
|
737
743
|
}
|
|
738
744
|
// Auto-select provider/model if not set
|
|
@@ -1053,11 +1059,11 @@ const commands = {
|
|
|
1053
1059
|
// Show actions
|
|
1054
1060
|
const actionLines = [];
|
|
1055
1061
|
actionLines.push(`${C_LINK}start ${name}${RESET} ${C_MUTED}Begin execution${RESET}`);
|
|
1056
|
-
actionLines.push(`${C_LINK}
|
|
1062
|
+
actionLines.push(`${C_LINK}posture${RESET} ${C_MUTED}Intelligence briefing${RESET}`);
|
|
1057
1063
|
console.log(Section('ACTIONS', actionLines));
|
|
1058
1064
|
console.log();
|
|
1059
|
-
// Transition: AGENT_LAB →
|
|
1060
|
-
currentView = '
|
|
1065
|
+
// Transition: AGENT_LAB → INTELLIGENCE_POSTURE
|
|
1066
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
1061
1067
|
}
|
|
1062
1068
|
},
|
|
1063
1069
|
agents: {
|
|
@@ -1260,7 +1266,7 @@ const commands = {
|
|
|
1260
1266
|
lastAction: 'system',
|
|
1261
1267
|
}));
|
|
1262
1268
|
console.log();
|
|
1263
|
-
currentView = '
|
|
1269
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
1264
1270
|
}
|
|
1265
1271
|
},
|
|
1266
1272
|
status: {
|
|
@@ -1362,6 +1368,135 @@ const commands = {
|
|
|
1362
1368
|
console.log(` Use ${cyan}start ${run.id}${reset} to execute\n`);
|
|
1363
1369
|
}
|
|
1364
1370
|
},
|
|
1371
|
+
deploy: {
|
|
1372
|
+
description: 'Promote assets to active operational state',
|
|
1373
|
+
usage: 'deploy [asset-name]',
|
|
1374
|
+
handler: async (args, rl) => {
|
|
1375
|
+
// Phase 3: deploy command - future-safe placeholder
|
|
1376
|
+
if (args.length === 0) {
|
|
1377
|
+
console.log(Alert('error', 'Asset name required', undefined, 'deploy <asset-name>'));
|
|
1378
|
+
console.log();
|
|
1379
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
1380
|
+
return;
|
|
1381
|
+
}
|
|
1382
|
+
const assetName = args.join(' ').trim();
|
|
1383
|
+
const asset = customAgents.get(assetName.toLowerCase());
|
|
1384
|
+
if (!asset) {
|
|
1385
|
+
console.log(Alert('error', `Asset not found: ${assetName}`, undefined, 'build'));
|
|
1386
|
+
console.log();
|
|
1387
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
1388
|
+
return;
|
|
1389
|
+
}
|
|
1390
|
+
// For v1, deploy is a no-op (future: promote to production/active state)
|
|
1391
|
+
console.log(Alert('info', `Asset "${assetName}" is already operational`, undefined, 'start'));
|
|
1392
|
+
console.log();
|
|
1393
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
1394
|
+
await showIntelligencePostureView();
|
|
1395
|
+
}
|
|
1396
|
+
},
|
|
1397
|
+
inspect: {
|
|
1398
|
+
description: 'Drill into assets, runs, or system components',
|
|
1399
|
+
usage: 'inspect [asset|run|system] [name|id]',
|
|
1400
|
+
handler: async (args, rl) => {
|
|
1401
|
+
// Phase 3: inspect command - drill into components
|
|
1402
|
+
if (args.length === 0) {
|
|
1403
|
+
console.log(Alert('error', 'Inspection target required', undefined, 'inspect [asset|run|system] [name|id]'));
|
|
1404
|
+
console.log();
|
|
1405
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
1406
|
+
return;
|
|
1407
|
+
}
|
|
1408
|
+
const target = args[0].toLowerCase();
|
|
1409
|
+
if (target === 'asset' || target === 'assets') {
|
|
1410
|
+
if (args.length < 2) {
|
|
1411
|
+
// List all assets
|
|
1412
|
+
if (customAgents.size === 0) {
|
|
1413
|
+
console.log(Alert('info', 'No assets available', undefined, 'build'));
|
|
1414
|
+
console.log();
|
|
1415
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
1416
|
+
return;
|
|
1417
|
+
}
|
|
1418
|
+
console.log(Section('AVAILABLE ASSETS', []));
|
|
1419
|
+
Array.from(customAgents.values()).forEach(agent => {
|
|
1420
|
+
console.log(` ${C_ACCENT}${agent.name}${RESET} ${C_MUTED}${agent.description || 'No description'}${RESET}`);
|
|
1421
|
+
});
|
|
1422
|
+
console.log();
|
|
1423
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
1424
|
+
return;
|
|
1425
|
+
}
|
|
1426
|
+
const assetName = args.slice(1).join(' ').trim();
|
|
1427
|
+
const asset = customAgents.get(assetName.toLowerCase());
|
|
1428
|
+
if (!asset) {
|
|
1429
|
+
console.log(Alert('error', `Asset not found: ${assetName}`, undefined, 'build'));
|
|
1430
|
+
console.log();
|
|
1431
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
1432
|
+
return;
|
|
1433
|
+
}
|
|
1434
|
+
// Show asset details (read-only inspection)
|
|
1435
|
+
const detailLines = [];
|
|
1436
|
+
detailLines.push(`NAME: ${C_TEXT}${asset.name}${RESET}`);
|
|
1437
|
+
if (asset.description) {
|
|
1438
|
+
detailLines.push(`DESCRIPTION: ${C_MUTED}${asset.description}${RESET}`);
|
|
1439
|
+
}
|
|
1440
|
+
detailLines.push(`BASE: ${C_ACCENT}${asset.baseAgent}${RESET}`);
|
|
1441
|
+
if (asset.temperature !== undefined) {
|
|
1442
|
+
detailLines.push(`TEMPERATURE: ${C_ACCENT}${asset.temperature}${RESET}`);
|
|
1443
|
+
}
|
|
1444
|
+
if (asset.tools && asset.tools.length > 0) {
|
|
1445
|
+
detailLines.push(`TOOLS: ${C_ACCENT}${asset.tools.length}${RESET}`);
|
|
1446
|
+
}
|
|
1447
|
+
console.log(Section('ASSET INSPECTION', detailLines));
|
|
1448
|
+
console.log();
|
|
1449
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
1450
|
+
}
|
|
1451
|
+
else if (target === 'run' || target === 'runs') {
|
|
1452
|
+
if (args.length < 2) {
|
|
1453
|
+
// List recent runs
|
|
1454
|
+
if (runHistory.length === 0) {
|
|
1455
|
+
console.log(Alert('info', 'No runs available', undefined, 'start'));
|
|
1456
|
+
console.log();
|
|
1457
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
1458
|
+
return;
|
|
1459
|
+
}
|
|
1460
|
+
console.log(Section('RECENT RUNS', []));
|
|
1461
|
+
runHistory.slice(-5).reverse().forEach(run => {
|
|
1462
|
+
const statusColor = run.status === 'SUCCESS' ? C_SUCCESS :
|
|
1463
|
+
run.status === 'FAILED' ? C_ERROR : C_ACCENT;
|
|
1464
|
+
console.log(` ${statusColor}${run.status}${RESET} ${C_TEXT}${run.agentName}${RESET} ${C_MUTED}${truncateId(run.runId, 8)}${RESET}`);
|
|
1465
|
+
});
|
|
1466
|
+
console.log();
|
|
1467
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
1468
|
+
return;
|
|
1469
|
+
}
|
|
1470
|
+
const runId = args[1];
|
|
1471
|
+
const run = runHistory.find(r => r.runId.includes(runId));
|
|
1472
|
+
if (!run) {
|
|
1473
|
+
console.log(Alert('error', `Run not found: ${runId}`, undefined, 'start'));
|
|
1474
|
+
console.log();
|
|
1475
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
1476
|
+
return;
|
|
1477
|
+
}
|
|
1478
|
+
// Show run details
|
|
1479
|
+
const runLines = [];
|
|
1480
|
+
runLines.push(`ID: ${C_ACCENT}${run.runId}${RESET}`);
|
|
1481
|
+
runLines.push(`ASSET: ${C_TEXT}${run.agentName}${RESET}`);
|
|
1482
|
+
runLines.push(`STATUS: ${run.status === 'SUCCESS' ? C_SUCCESS : run.status === 'FAILED' ? C_ERROR : C_ACCENT}${run.status}${RESET}`);
|
|
1483
|
+
runLines.push(`TIMESTAMP: ${C_MUTED}${new Date(run.timestamp).toISOString()}${RESET}`);
|
|
1484
|
+
console.log(Section('RUN INSPECTION', runLines));
|
|
1485
|
+
console.log();
|
|
1486
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
1487
|
+
}
|
|
1488
|
+
else if (target === 'system') {
|
|
1489
|
+
// System inspection (same as system command)
|
|
1490
|
+
currentView = 'SYSTEM';
|
|
1491
|
+
await commands.system.handler([], rl);
|
|
1492
|
+
}
|
|
1493
|
+
else {
|
|
1494
|
+
console.log(Alert('error', `Unknown inspection target: ${target}`, undefined, 'inspect [asset|run|system]'));
|
|
1495
|
+
console.log();
|
|
1496
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
},
|
|
1365
1500
|
start: {
|
|
1366
1501
|
description: 'Begin execution',
|
|
1367
1502
|
usage: 'start [agent]',
|
|
@@ -1410,7 +1545,7 @@ const commands = {
|
|
|
1410
1545
|
else {
|
|
1411
1546
|
console.log(Alert('error', Copy.error.invalidCommand, undefined, 'start'));
|
|
1412
1547
|
console.log();
|
|
1413
|
-
currentView = '
|
|
1548
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
1414
1549
|
return;
|
|
1415
1550
|
}
|
|
1416
1551
|
}
|
|
@@ -1422,7 +1557,7 @@ const commands = {
|
|
|
1422
1557
|
if (!agent) {
|
|
1423
1558
|
console.log(Alert('error', `Agent not found: ${agentName}`, undefined, 'build'));
|
|
1424
1559
|
console.log();
|
|
1425
|
-
currentView = '
|
|
1560
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
1426
1561
|
return;
|
|
1427
1562
|
}
|
|
1428
1563
|
}
|
|
@@ -1472,7 +1607,7 @@ const commands = {
|
|
|
1472
1607
|
lastAction: `start ${agent.name}`,
|
|
1473
1608
|
}));
|
|
1474
1609
|
console.log();
|
|
1475
|
-
currentView = '
|
|
1610
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
1476
1611
|
}
|
|
1477
1612
|
},
|
|
1478
1613
|
get: {
|
|
@@ -1617,7 +1752,7 @@ const commands = {
|
|
|
1617
1752
|
lastAction: 'metrics',
|
|
1618
1753
|
}));
|
|
1619
1754
|
console.log();
|
|
1620
|
-
currentView = '
|
|
1755
|
+
currentView = 'INTELLIGENCE_POSTURE';
|
|
1621
1756
|
}
|
|
1622
1757
|
},
|
|
1623
1758
|
clear: {
|
|
@@ -1625,7 +1760,7 @@ const commands = {
|
|
|
1625
1760
|
usage: 'clear',
|
|
1626
1761
|
handler: async () => {
|
|
1627
1762
|
console.clear();
|
|
1628
|
-
await
|
|
1763
|
+
await showIntelligencePostureView();
|
|
1629
1764
|
}
|
|
1630
1765
|
},
|
|
1631
1766
|
exit: {
|
|
@@ -1677,24 +1812,24 @@ const commands = {
|
|
|
1677
1812
|
setLastMode('REMOTE');
|
|
1678
1813
|
// Start session checker
|
|
1679
1814
|
startSessionChecker();
|
|
1680
|
-
// Transition: SYSTEM →
|
|
1815
|
+
// Transition: SYSTEM → INTELLIGENCE_POSTURE
|
|
1681
1816
|
currentView = 'SYSTEM';
|
|
1682
1817
|
await sleep(200);
|
|
1683
|
-
await
|
|
1818
|
+
await showIntelligencePostureView();
|
|
1684
1819
|
}
|
|
1685
1820
|
catch (error) {
|
|
1686
1821
|
console.log(Alert('warn', 'Connected, but gateway unavailable', 'Local features only', 'system diagnose'));
|
|
1687
1822
|
console.log();
|
|
1688
1823
|
gatewayConnected = false;
|
|
1689
1824
|
setLastMode('LOCAL');
|
|
1690
|
-
await
|
|
1825
|
+
await showIntelligencePostureView();
|
|
1691
1826
|
}
|
|
1692
1827
|
}
|
|
1693
1828
|
else {
|
|
1694
1829
|
console.log(Alert('success', 'Connected', 'No gateway URL configured'));
|
|
1695
1830
|
console.log();
|
|
1696
1831
|
setLastMode('LOCAL');
|
|
1697
|
-
await
|
|
1832
|
+
await showIntelligencePostureView();
|
|
1698
1833
|
}
|
|
1699
1834
|
}
|
|
1700
1835
|
},
|
|
@@ -2191,7 +2326,7 @@ async function startREPL() {
|
|
|
2191
2326
|
await cmd.handler(args, rl);
|
|
2192
2327
|
// Return to stable view after command (if not already in a view)
|
|
2193
2328
|
if (currentView === 'BOOT') {
|
|
2194
|
-
await
|
|
2329
|
+
await showIntelligencePostureView();
|
|
2195
2330
|
}
|
|
2196
2331
|
}
|
|
2197
2332
|
catch (error) {
|
|
@@ -2211,8 +2346,8 @@ async function startREPL() {
|
|
|
2211
2346
|
console.log(`${dim}Next: ${cyan}help${reset}${dim} for available commands${reset}\n`);
|
|
2212
2347
|
}
|
|
2213
2348
|
// Return to previous stable view
|
|
2214
|
-
if (currentView !== '
|
|
2215
|
-
await
|
|
2349
|
+
if (currentView !== 'INTELLIGENCE_POSTURE' && currentView !== 'BOOT') {
|
|
2350
|
+
await showIntelligencePostureView();
|
|
2216
2351
|
}
|
|
2217
2352
|
}
|
|
2218
2353
|
}
|