@kal-elsam/kairo-runtime 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kal-elsam/kairo-runtime",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Kairo Runtime — local agent operating system for Codex, Cursor, Claude, Gemini, Copilot, Engram, and Graphify.",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/Kal-elSam/harness#readme",
@@ -7,9 +7,13 @@ import {
7
7
  ORCHESTRATOR_MENU,
8
8
  ORCHESTRATOR_VIEWS,
9
9
  formatAgentStatusLines,
10
+ formatDiagnosticsLines,
10
11
  formatIntelligenceLines,
11
12
  formatPlanLines,
12
- formatProfileLines
13
+ formatProfileLines,
14
+ resolveMenuItem,
15
+ resolveMenuItemView,
16
+ shiftMenuIndex
13
17
  } from "./orchestrator-state.js";
14
18
 
15
19
  const COLORS = {
@@ -96,19 +100,19 @@ export function OrchestratorApp({
96
100
  if (view !== ORCHESTRATOR_VIEWS.HOME) return;
97
101
 
98
102
  if (key.upArrow) {
99
- setMenuIndex((index) => Math.max(0, index - 1));
103
+ setMenuIndex((index) => shiftMenuIndex(index, "up"));
100
104
  return;
101
105
  }
102
106
 
103
107
  if (key.downArrow) {
104
- setMenuIndex((index) => Math.min(ORCHESTRATOR_MENU.length - 1, index + 1));
108
+ setMenuIndex((index) => shiftMenuIndex(index, "down"));
105
109
  return;
106
110
  }
107
111
 
108
112
  if (!key.return) return;
109
113
 
110
- const item = ORCHESTRATOR_MENU[menuIndex];
111
- if (item.action === "setup") {
114
+ const item = resolveMenuItem(menuIndex);
115
+ if (item?.action === "setup") {
112
116
  buildActionPlan({
113
117
  action: PLAN_ACTIONS.SETUP,
114
118
  homeDir,
@@ -124,7 +128,7 @@ export function OrchestratorApp({
124
128
  return;
125
129
  }
126
130
 
127
- setView(item.view);
131
+ setView(resolveMenuItemView(menuIndex));
128
132
  });
129
133
 
130
134
  if (loading) {
@@ -174,6 +178,12 @@ function renderView({ view, diagnostics, profileJson, plan, menuIndex }) {
174
178
  `Intelligence: local=${diagnostics.intelligence.summary.localAvailable ? "yes" : "no"} cloud=${diagnostics.intelligence.summary.cloudAuthenticated ? "yes" : "no"}`
175
179
  )
176
180
  );
181
+ case ORCHESTRATOR_VIEWS.DIAGNOSTICS:
182
+ return React.createElement(Box, { flexDirection: "column" },
183
+ React.createElement(Text, { bold: true }, "Diagnostics"),
184
+ formatDiagnosticsLines(diagnostics)
185
+ .map((line) => React.createElement(Text, { key: line }, line))
186
+ );
177
187
  case ORCHESTRATOR_VIEWS.AGENTS:
178
188
  return React.createElement(Box, { flexDirection: "column" },
179
189
  React.createElement(Text, { bold: true }, "Agent capabilities"),
@@ -12,6 +12,7 @@ export function canUseOrchestratorShell({
12
12
 
13
13
  export const ORCHESTRATOR_VIEWS = {
14
14
  HOME: "home",
15
+ DIAGNOSTICS: "diagnostics",
15
16
  AGENTS: "agents",
16
17
  PROFILE: "profile",
17
18
  PLAN: "plan",
@@ -21,7 +22,7 @@ export const ORCHESTRATOR_VIEWS = {
21
22
  };
22
23
 
23
24
  export const ORCHESTRATOR_MENU = [
24
- { id: "status", label: "Diagnostics", view: ORCHESTRATOR_VIEWS.HOME },
25
+ { id: "status", label: "Diagnostics", view: ORCHESTRATOR_VIEWS.DIAGNOSTICS },
25
26
  { id: "agents", label: "Agents", view: ORCHESTRATOR_VIEWS.AGENTS },
26
27
  { id: "intelligence", label: "Intelligence", view: ORCHESTRATOR_VIEWS.INTELLIGENCE },
27
28
  { id: "profile", label: "Profile", view: ORCHESTRATOR_VIEWS.PROFILE },
@@ -29,6 +30,47 @@ export const ORCHESTRATOR_MENU = [
29
30
  { id: "help", label: "Help", view: ORCHESTRATOR_VIEWS.HELP }
30
31
  ];
31
32
 
33
+ export function resolveMenuItem(menuIndex) {
34
+ return ORCHESTRATOR_MENU[menuIndex] ?? null;
35
+ }
36
+
37
+ export function resolveMenuItemView(menuIndex) {
38
+ return resolveMenuItem(menuIndex)?.view ?? ORCHESTRATOR_VIEWS.HOME;
39
+ }
40
+
41
+ export function shiftMenuIndex(currentIndex, direction, menuLength = ORCHESTRATOR_MENU.length) {
42
+ const delta = direction === "up" ? -1 : direction === "down" ? 1 : 0;
43
+ return Math.min(menuLength - 1, Math.max(0, currentIndex + delta));
44
+ }
45
+
46
+ export function formatDiagnosticsLines(diagnostics) {
47
+ const summary = diagnostics?.diagnostics;
48
+ const lines = [
49
+ "Summary",
50
+ `CLI version: ${diagnostics?.cliVersion ?? "unknown"}`,
51
+ `Agents detected: ${summary?.detected ?? 0}/${diagnostics?.capabilities?.length ?? 0}`,
52
+ `Available: ${summary?.available ?? 0}`,
53
+ `Unknown: ${summary?.unknown ?? 0}`,
54
+ `Errors: ${summary?.errors ?? 0}`,
55
+ "",
56
+ "Intelligence availability",
57
+ ...formatIntelligenceLines(diagnostics),
58
+ "",
59
+ "Agent capabilities",
60
+ ...formatAgentStatusLines(diagnostics?.capabilities ?? [])
61
+ ];
62
+
63
+ const recommendations = diagnostics?.recommendations ?? [];
64
+ if (recommendations.length > 0) {
65
+ lines.push("", "Recommendations");
66
+ for (const recommendation of recommendations) {
67
+ lines.push(` • ${recommendation}`);
68
+ }
69
+ }
70
+
71
+ return lines;
72
+ }
73
+
32
74
  export function formatAgentStatusLines(capabilities) {
33
75
  return capabilities.map((entry) => {
34
76
  const auth = entry.authenticated == null ? "n/a" : (entry.authenticated ? "yes" : "no");