@agents-at-scale/ark 0.1.34 → 0.1.35-rc1

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 (205) hide show
  1. package/dist/arkServices.d.ts +42 -0
  2. package/dist/arkServices.js +138 -0
  3. package/dist/arkServices.spec.d.ts +1 -0
  4. package/dist/arkServices.spec.js +24 -0
  5. package/dist/charts/charts.d.ts +5 -0
  6. package/dist/charts/charts.js +6 -0
  7. package/dist/charts/dependencies.d.ts +6 -0
  8. package/dist/charts/dependencies.js +50 -0
  9. package/dist/charts/types.d.ts +40 -0
  10. package/dist/charts/types.js +1 -0
  11. package/dist/commands/agents/index.d.ts +3 -0
  12. package/dist/commands/agents/index.js +51 -0
  13. package/dist/commands/agents/index.spec.d.ts +1 -0
  14. package/dist/commands/agents/index.spec.js +67 -0
  15. package/dist/commands/agents/selector.d.ts +8 -0
  16. package/dist/commands/agents/selector.js +53 -0
  17. package/dist/commands/agents.d.ts +2 -0
  18. package/dist/commands/agents.js +53 -0
  19. package/dist/commands/chat/index.d.ts +3 -0
  20. package/dist/commands/chat/index.js +29 -0
  21. package/dist/commands/chat.d.ts +2 -0
  22. package/dist/commands/chat.js +45 -0
  23. package/dist/commands/cluster/get.d.ts +2 -0
  24. package/dist/commands/cluster/get.js +39 -0
  25. package/dist/commands/cluster/get.spec.d.ts +1 -0
  26. package/dist/commands/cluster/get.spec.js +92 -0
  27. package/dist/commands/cluster/index.d.ts +2 -1
  28. package/dist/commands/cluster/index.js +3 -5
  29. package/dist/commands/cluster/index.spec.d.ts +1 -0
  30. package/dist/commands/cluster/index.spec.js +24 -0
  31. package/dist/commands/completion/index.d.ts +3 -0
  32. package/dist/commands/completion/index.js +268 -0
  33. package/dist/commands/completion/index.spec.d.ts +1 -0
  34. package/dist/commands/completion/index.spec.js +34 -0
  35. package/dist/commands/completion.js +159 -2
  36. package/dist/commands/config/index.d.ts +3 -0
  37. package/dist/commands/config/index.js +42 -0
  38. package/dist/commands/config/index.spec.d.ts +1 -0
  39. package/dist/commands/config/index.spec.js +78 -0
  40. package/dist/commands/config.d.ts +0 -3
  41. package/dist/commands/config.js +38 -321
  42. package/dist/commands/dashboard/index.d.ts +4 -0
  43. package/dist/commands/dashboard/index.js +39 -0
  44. package/dist/commands/dashboard.d.ts +3 -0
  45. package/dist/commands/dashboard.js +39 -0
  46. package/dist/commands/dev/index.d.ts +3 -0
  47. package/dist/commands/dev/index.js +9 -0
  48. package/dist/commands/dev/tool/check.d.ts +2 -0
  49. package/dist/commands/dev/tool/check.js +142 -0
  50. package/dist/commands/dev/tool/clean.d.ts +2 -0
  51. package/dist/commands/dev/tool/clean.js +153 -0
  52. package/dist/commands/dev/tool/generate.d.ts +2 -0
  53. package/dist/commands/dev/tool/generate.js +28 -0
  54. package/dist/commands/dev/tool/index.d.ts +2 -0
  55. package/dist/commands/dev/tool/index.js +14 -0
  56. package/dist/commands/dev/tool/init.d.ts +2 -0
  57. package/dist/commands/dev/tool/init.js +320 -0
  58. package/dist/commands/dev/tool/shared.d.ts +5 -0
  59. package/dist/commands/dev/tool/shared.js +256 -0
  60. package/dist/commands/dev/tool/status.d.ts +2 -0
  61. package/dist/commands/dev/tool/status.js +136 -0
  62. package/dist/commands/dev/tool-generate.spec.d.ts +1 -0
  63. package/dist/commands/dev/tool-generate.spec.js +163 -0
  64. package/dist/commands/dev/tool.d.ts +2 -0
  65. package/dist/commands/dev/tool.js +559 -0
  66. package/dist/commands/dev/tool.spec.d.ts +1 -0
  67. package/dist/commands/dev/tool.spec.js +48 -0
  68. package/dist/commands/generate/config.js +5 -24
  69. package/dist/commands/generate/generators/mcpserver.d.ts +2 -1
  70. package/dist/commands/generate/generators/mcpserver.js +26 -5
  71. package/dist/commands/generate/generators/project.js +22 -41
  72. package/dist/commands/generate/index.d.ts +2 -1
  73. package/dist/commands/generate/index.js +1 -1
  74. package/dist/commands/install/index.d.ts +8 -0
  75. package/dist/commands/install/index.js +302 -0
  76. package/dist/commands/install/index.spec.d.ts +1 -0
  77. package/dist/commands/install/index.spec.js +135 -0
  78. package/dist/commands/install.d.ts +3 -0
  79. package/dist/commands/install.js +147 -0
  80. package/dist/commands/models/create.d.ts +1 -0
  81. package/dist/commands/models/create.js +213 -0
  82. package/dist/commands/models/create.spec.d.ts +1 -0
  83. package/dist/commands/models/create.spec.js +125 -0
  84. package/dist/commands/models/index.d.ts +3 -0
  85. package/dist/commands/models/index.js +60 -0
  86. package/dist/commands/models/index.spec.d.ts +1 -0
  87. package/dist/commands/models/index.spec.js +76 -0
  88. package/dist/commands/models/selector.d.ts +8 -0
  89. package/dist/commands/models/selector.js +53 -0
  90. package/dist/commands/routes/index.d.ts +3 -0
  91. package/dist/commands/routes/index.js +93 -0
  92. package/dist/commands/routes.d.ts +2 -0
  93. package/dist/commands/routes.js +101 -0
  94. package/dist/commands/status/index.d.ts +4 -0
  95. package/dist/commands/status/index.js +232 -0
  96. package/dist/commands/status.d.ts +3 -0
  97. package/dist/commands/status.js +33 -0
  98. package/dist/commands/targets/index.d.ts +3 -0
  99. package/dist/commands/targets/index.js +65 -0
  100. package/dist/commands/targets/index.spec.d.ts +1 -0
  101. package/dist/commands/targets/index.spec.js +105 -0
  102. package/dist/commands/targets.d.ts +2 -0
  103. package/dist/commands/targets.js +65 -0
  104. package/dist/commands/teams/index.d.ts +3 -0
  105. package/dist/commands/teams/index.js +49 -0
  106. package/dist/commands/teams/index.spec.d.ts +1 -0
  107. package/dist/commands/teams/index.spec.js +70 -0
  108. package/dist/commands/teams/selector.d.ts +8 -0
  109. package/dist/commands/teams/selector.js +55 -0
  110. package/dist/commands/tools/index.d.ts +3 -0
  111. package/dist/commands/tools/index.js +49 -0
  112. package/dist/commands/tools/index.spec.d.ts +1 -0
  113. package/dist/commands/tools/index.spec.js +70 -0
  114. package/dist/commands/tools/selector.d.ts +8 -0
  115. package/dist/commands/tools/selector.js +53 -0
  116. package/dist/commands/uninstall/index.d.ts +3 -0
  117. package/dist/commands/uninstall/index.js +107 -0
  118. package/dist/commands/uninstall/index.spec.d.ts +1 -0
  119. package/dist/commands/uninstall/index.spec.js +117 -0
  120. package/dist/commands/uninstall.d.ts +2 -0
  121. package/dist/commands/uninstall.js +83 -0
  122. package/dist/components/ChatUI.d.ts +16 -0
  123. package/dist/components/ChatUI.js +801 -0
  124. package/dist/components/StatusView.d.ts +10 -0
  125. package/dist/components/StatusView.js +39 -0
  126. package/dist/components/statusChecker.d.ts +13 -23
  127. package/dist/components/statusChecker.js +275 -129
  128. package/dist/config.d.ts +3 -22
  129. package/dist/config.js +10 -161
  130. package/dist/index.d.ts +1 -1
  131. package/dist/index.js +40 -42
  132. package/dist/lib/arkApiClient.d.ts +53 -0
  133. package/dist/lib/arkApiClient.js +102 -0
  134. package/dist/lib/arkApiProxy.d.ts +9 -0
  135. package/dist/lib/arkApiProxy.js +22 -0
  136. package/dist/lib/arkServiceProxy.d.ts +14 -0
  137. package/dist/lib/arkServiceProxy.js +95 -0
  138. package/dist/lib/arkStatus.d.ts +10 -0
  139. package/dist/lib/arkStatus.js +79 -0
  140. package/dist/lib/arkStatus.spec.d.ts +1 -0
  141. package/dist/lib/arkStatus.spec.js +49 -0
  142. package/dist/lib/chatClient.d.ts +33 -0
  143. package/dist/lib/chatClient.js +99 -0
  144. package/dist/lib/cluster.d.ts +2 -1
  145. package/dist/lib/cluster.js +37 -16
  146. package/dist/lib/cluster.spec.d.ts +1 -0
  147. package/dist/lib/cluster.spec.js +338 -0
  148. package/dist/lib/commandUtils.d.ts +4 -0
  149. package/dist/lib/commandUtils.js +18 -0
  150. package/dist/lib/commandUtils.test.d.ts +1 -0
  151. package/dist/lib/commandUtils.test.js +44 -0
  152. package/dist/lib/commands.d.ts +16 -0
  153. package/dist/lib/commands.js +29 -0
  154. package/dist/lib/commands.spec.d.ts +1 -0
  155. package/dist/lib/commands.spec.js +146 -0
  156. package/dist/lib/config.d.ts +26 -80
  157. package/dist/lib/config.js +70 -205
  158. package/dist/lib/config.spec.d.ts +1 -0
  159. package/dist/lib/config.spec.js +99 -0
  160. package/dist/lib/config.test.d.ts +1 -0
  161. package/dist/lib/config.test.js +93 -0
  162. package/dist/lib/consts.d.ts +0 -1
  163. package/dist/lib/consts.js +0 -2
  164. package/dist/lib/consts.spec.d.ts +1 -0
  165. package/dist/lib/consts.spec.js +15 -0
  166. package/dist/lib/dev/tools/analyzer.d.ts +30 -0
  167. package/dist/lib/dev/tools/analyzer.js +190 -0
  168. package/dist/lib/dev/tools/discover_tools.py +392 -0
  169. package/dist/lib/dev/tools/mcp-types.d.ts +28 -0
  170. package/dist/lib/dev/tools/mcp-types.js +86 -0
  171. package/dist/lib/dev/tools/types.d.ts +50 -0
  172. package/dist/lib/dev/tools/types.js +1 -0
  173. package/dist/lib/errors.js +1 -1
  174. package/dist/lib/errors.spec.d.ts +1 -0
  175. package/dist/lib/errors.spec.js +221 -0
  176. package/dist/lib/exec.d.ts +0 -4
  177. package/dist/lib/exec.js +0 -11
  178. package/dist/lib/output.d.ts +36 -0
  179. package/dist/lib/output.js +89 -0
  180. package/dist/lib/output.spec.d.ts +1 -0
  181. package/dist/lib/output.spec.js +123 -0
  182. package/dist/lib/portUtils.d.ts +8 -0
  183. package/dist/lib/portUtils.js +39 -0
  184. package/dist/lib/startup.d.ts +5 -0
  185. package/dist/lib/startup.js +73 -0
  186. package/dist/lib/startup.spec.d.ts +1 -0
  187. package/dist/lib/startup.spec.js +168 -0
  188. package/dist/lib/types.d.ts +10 -3
  189. package/dist/types/types.d.ts +40 -0
  190. package/dist/types/types.js +1 -0
  191. package/dist/ui/AgentSelector.d.ts +8 -0
  192. package/dist/ui/AgentSelector.js +53 -0
  193. package/dist/ui/MainMenu.d.ts +5 -1
  194. package/dist/ui/MainMenu.js +222 -91
  195. package/dist/ui/ModelSelector.d.ts +8 -0
  196. package/dist/ui/ModelSelector.js +53 -0
  197. package/dist/ui/TeamSelector.d.ts +8 -0
  198. package/dist/ui/TeamSelector.js +55 -0
  199. package/dist/ui/ToolSelector.d.ts +8 -0
  200. package/dist/ui/ToolSelector.js +53 -0
  201. package/dist/ui/statusFormatter.d.ts +22 -7
  202. package/dist/ui/statusFormatter.js +39 -39
  203. package/dist/ui/statusFormatter.spec.d.ts +1 -0
  204. package/dist/ui/statusFormatter.spec.js +58 -0
  205. package/package.json +17 -5
@@ -1,70 +1,232 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Text, Box, useInput } from 'ink';
3
- import SelectInput from 'ink-select-input';
2
+ import { Text, Box, render, useInput } from 'ink';
3
+ import Spinner from 'ink-spinner';
4
4
  import * as React from 'react';
5
- import DashboardCLI from '../components/DashboardCLI.js';
6
- import GeneratorUI from '../components/GeneratorUI.js';
7
- import { StatusChecker } from '../components/statusChecker.js';
8
- import { ConfigManager } from '../config.js';
9
- import { ArkClient } from '../lib/arkClient.js';
10
- const EXIT_TIMEOUT_MS = 1000;
11
- const MainMenu = () => {
12
- const [selectedChoice, setSelectedChoice] = React.useState(null);
13
- const [statusData, setStatusData] = React.useState(null);
14
- const [isLoading, setIsLoading] = React.useState(false);
15
- const [error, setError] = React.useState(null);
16
- const choices = [
17
- { label: '🏷️ Dashboard', value: 'dashboard' },
18
- { label: '🔍 Status Check', value: 'status' },
19
- { label: '🎯 Generate', value: 'generate' },
20
- { label: '👋 Exit', value: 'exit' },
21
- ];
22
- React.useEffect(() => {
23
- if (selectedChoice === 'exit') {
24
- const timer = setTimeout(() => {
25
- process.exit(0);
26
- }, EXIT_TIMEOUT_MS);
27
- return () => clearTimeout(timer);
5
+ import { isArkReady } from '../lib/arkStatus.js';
6
+ // Helper function to unmount the main ink app - used when we move from a
7
+ // React TUI app to basic input/output.
8
+ async function unmountInkApp() {
9
+ const app = globalThis.inkApp;
10
+ if (app) {
11
+ // Unmount the Ink app
12
+ app.unmount();
13
+ // Clear the global reference
14
+ delete globalThis.inkApp;
15
+ // Reset terminal to normal mode
16
+ if (process.stdin.isTTY) {
17
+ process.stdin.setRawMode(false);
18
+ process.stdin.pause();
28
19
  }
29
- }, [selectedChoice]);
20
+ // Clear screen
21
+ console.clear();
22
+ // Small delay to ensure everything is flushed
23
+ await new Promise((resolve) => setTimeout(resolve, 50));
24
+ }
25
+ }
26
+ const MainMenu = ({ config }) => {
27
+ const [selectedIndex, setSelectedIndex] = React.useState(0);
28
+ const [arkReady, setArkReady] = React.useState(null);
29
+ const [isChecking, setIsChecking] = React.useState(true);
30
30
  React.useEffect(() => {
31
- if (selectedChoice === 'status' && !statusData && !isLoading) {
32
- checkStatus();
31
+ const checkArkStatus = async () => {
32
+ setIsChecking(true);
33
+ const ready = await isArkReady();
34
+ setArkReady(ready);
35
+ setIsChecking(false);
36
+ // Reset selected index to 0 after status check
37
+ setSelectedIndex(0);
38
+ };
39
+ checkArkStatus();
40
+ }, []);
41
+ // Handle Ctrl+C to properly unmount Ink and restore terminal
42
+ React.useEffect(() => {
43
+ const handleExit = () => {
44
+ const app = globalThis.inkApp;
45
+ if (app) {
46
+ app.unmount();
47
+ }
48
+ process.exit(0);
49
+ };
50
+ process.on('SIGINT', handleExit);
51
+ return () => {
52
+ process.removeListener('SIGINT', handleExit);
53
+ };
54
+ }, []);
55
+ // Check if upgrade is available
56
+ const hasUpgrade = React.useMemo(() => {
57
+ if (!config.currentVersion || !config.latestVersion)
58
+ return false;
59
+ // Simple version comparison
60
+ return config.currentVersion !== config.latestVersion;
61
+ }, [config.currentVersion, config.latestVersion]);
62
+ const allChoices = [
63
+ {
64
+ label: 'Chat',
65
+ description: 'Interactive chat with Ark agents',
66
+ value: 'chat',
67
+ command: 'ark chat',
68
+ },
69
+ {
70
+ label: 'Install',
71
+ description: 'Install Ark',
72
+ value: 'install',
73
+ command: 'ark install',
74
+ },
75
+ {
76
+ label: 'Upgrade',
77
+ description: `Upgrade Ark from ${config.currentVersion} to ${config.latestVersion}`,
78
+ value: 'upgrade',
79
+ command: 'ark install -y',
80
+ },
81
+ {
82
+ label: 'Dashboard',
83
+ description: 'Open Ark dashboard in browser',
84
+ value: 'dashboard',
85
+ command: 'ark dashboard',
86
+ },
87
+ {
88
+ label: 'Status',
89
+ description: 'Check Ark services status',
90
+ value: 'status',
91
+ command: 'ark status',
92
+ },
93
+ {
94
+ label: 'Generate',
95
+ description: 'Generate new Ark components',
96
+ value: 'generate',
97
+ command: 'ark generate',
98
+ },
99
+ { label: 'Exit', description: 'Exit Ark CLI', value: 'exit' },
100
+ ];
101
+ // Filter choices based on Ark readiness
102
+ const choices = React.useMemo(() => {
103
+ // Don't return any choices while checking
104
+ if (isChecking)
105
+ return [];
106
+ if (!arkReady) {
107
+ // Only show Install, Status, and Exit when Ark is not ready
108
+ return allChoices.filter((choice) => ['install', 'status', 'exit'].includes(choice.value));
33
109
  }
34
- }, [selectedChoice, statusData, isLoading]);
35
- const checkStatus = async () => {
36
- setIsLoading(true);
37
- setError(null);
38
- try {
39
- const configManager = new ConfigManager();
40
- const apiBaseUrl = await configManager.getApiBaseUrl();
41
- const serviceUrls = await configManager.getServiceUrls();
42
- const arkClient = new ArkClient(apiBaseUrl);
43
- const statusChecker = new StatusChecker(arkClient);
44
- const status = await statusChecker.checkAll(serviceUrls, apiBaseUrl);
45
- setStatusData(status);
110
+ // Ark is ready - filter out install (already installed) and conditionally show upgrade
111
+ const filteredChoices = allChoices.filter((choice) => {
112
+ // Never show install when Ark is ready (it's already installed)
113
+ if (choice.value === 'install')
114
+ return false;
115
+ // Only show upgrade if there's actually an upgrade available
116
+ if (choice.value === 'upgrade' && !hasUpgrade)
117
+ return false;
118
+ return true;
119
+ });
120
+ return filteredChoices;
121
+ }, [arkReady, isChecking, hasUpgrade, allChoices]);
122
+ useInput((input, key) => {
123
+ // Don't process input while checking status
124
+ if (isChecking)
125
+ return;
126
+ if (key.upArrow || input === 'k') {
127
+ setSelectedIndex((prev) => (prev > 0 ? prev - 1 : choices.length - 1));
46
128
  }
47
- catch (err) {
48
- setError(err instanceof Error ? err.message : 'Unknown error occurred');
129
+ else if (key.downArrow || input === 'j') {
130
+ setSelectedIndex((prev) => (prev < choices.length - 1 ? prev + 1 : 0));
49
131
  }
50
- finally {
51
- setIsLoading(false);
132
+ else if (key.return) {
133
+ handleSelect(choices[selectedIndex]);
52
134
  }
53
- };
54
- useInput((input, key) => {
55
- if (selectedChoice && selectedChoice !== 'exit') {
56
- if (key.escape || input === 'q' || key.return) {
57
- // For generate, only reset on specific key combinations to avoid conflicts
58
- if (selectedChoice === 'generate' && !(key.escape || input === 'q')) {
59
- return;
60
- }
61
- setSelectedChoice(null);
62
- setStatusData(null);
63
- setError(null);
135
+ else {
136
+ // Handle number keys for quick selection
137
+ const num = parseInt(input, 10);
138
+ if (!isNaN(num) && num >= 1 && num <= choices.length) {
139
+ handleSelect(choices[num - 1]);
64
140
  }
65
141
  }
66
142
  });
67
- const renderBanner = () => (_jsxs(Box, { flexDirection: "column", alignItems: "center", marginBottom: 1, children: [_jsx(Text, { color: "cyan", bold: true, children: `
143
+ const handleSelect = async (item) => {
144
+ switch (item.value) {
145
+ case 'exit':
146
+ process.exit(0);
147
+ break;
148
+ case 'chat': {
149
+ // Unmount fullscreen app and clear screen.
150
+ await unmountInkApp();
151
+ // Import and start ChatUI in the same process
152
+ const { render } = await import('ink');
153
+ const { ArkApiProxy } = await import('../lib/arkApiProxy.js');
154
+ const ChatUI = (await import('../components/ChatUI.js')).default;
155
+ try {
156
+ const proxy = new ArkApiProxy();
157
+ const arkApiClient = await proxy.start();
158
+ // Render ChatUI as a new Ink app
159
+ render(_jsx(ChatUI, { arkApiClient: arkApiClient, arkApiProxy: proxy }));
160
+ }
161
+ catch (error) {
162
+ const output = (await import('../lib/output.js')).default;
163
+ output.error(error instanceof Error
164
+ ? error.message
165
+ : 'Failed to connect to Ark API');
166
+ process.exit(1);
167
+ }
168
+ break;
169
+ }
170
+ case 'install': {
171
+ // Unmount fullscreen app and clear screen.
172
+ await unmountInkApp();
173
+ // Spawn as a new process to avoid Ink/inquirer signal conflicts
174
+ const { execFileSync } = await import('child_process');
175
+ try {
176
+ execFileSync(process.execPath, [process.argv[1], 'install'], {
177
+ stdio: 'inherit',
178
+ env: { ...process.env, FORCE_COLOR: '1' },
179
+ });
180
+ }
181
+ catch (error) {
182
+ // execFileSync throws if the process exits with non-zero
183
+ process.exit(error.status || 1);
184
+ }
185
+ process.exit(0);
186
+ break; // Add break even though process.exit prevents reaching here
187
+ }
188
+ case 'upgrade': {
189
+ // Unmount fullscreen app and clear screen.
190
+ await unmountInkApp();
191
+ // Spawn as a new process with -y flag for automatic upgrade
192
+ const { execFileSync } = await import('child_process');
193
+ try {
194
+ execFileSync(process.execPath, [process.argv[1], 'install', '-y'], {
195
+ stdio: 'inherit',
196
+ env: { ...process.env, FORCE_COLOR: '1' },
197
+ });
198
+ }
199
+ catch (error) {
200
+ // execFileSync throws if the process exits with non-zero
201
+ process.exit(error.status || 1);
202
+ }
203
+ process.exit(0);
204
+ break; // Add break even though process.exit prevents reaching here
205
+ }
206
+ case 'dashboard': {
207
+ // Unmount fullscreen app and clear screen.
208
+ await unmountInkApp();
209
+ const { openDashboard } = await import('../commands/dashboard/index.js');
210
+ await openDashboard();
211
+ break;
212
+ }
213
+ case 'status': {
214
+ // Unmount fullscreen app and clear screen.
215
+ await unmountInkApp();
216
+ const { checkStatus } = await import('../commands/status/index.js');
217
+ await checkStatus(config);
218
+ process.exit(0);
219
+ break; // Add break even though process.exit prevents reaching here
220
+ }
221
+ case 'generate': {
222
+ const GeneratorUI = (await import('../components/GeneratorUI.js'))
223
+ .default;
224
+ render(_jsx(GeneratorUI, {}));
225
+ break;
226
+ }
227
+ }
228
+ };
229
+ return (_jsxs(_Fragment, { children: [_jsxs(Box, { flexDirection: "column", alignItems: "center", marginBottom: 1, children: [_jsx(Text, { color: "cyan", bold: true, children: `
68
230
  ╔═══════════════════════════════════════╗
69
231
  ║ ║
70
232
  ║ █████╗ ██████╗ ██╗ ██╗ ║
@@ -77,40 +239,9 @@ const MainMenu = () => {
77
239
  ║ Agents at Scale Platform ║
78
240
  ║ ║
79
241
  ╚═══════════════════════════════════════╝
80
- ` }), _jsx(Text, { color: "green", bold: true, children: "Welcome to ARK! \uD83D\uDE80" }), _jsx(Text, { color: "gray", children: "Interactive terminal interface for ARK agents" })] }));
81
- const renderServiceStatus = (service) => {
82
- const statusColor = service.status === 'healthy'
83
- ? 'green'
84
- : service.status === 'unhealthy'
85
- ? 'red'
86
- : 'yellow';
87
- const statusIcon = service.status === 'healthy'
88
- ? '✓'
89
- : service.status === 'unhealthy'
90
- ? '✗'
91
- : '?';
92
- return (_jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [_jsxs(Box, { children: [_jsxs(Text, { color: statusColor, children: [statusIcon, " "] }), _jsxs(Text, { bold: true, children: [service.name, ": "] }), _jsx(Text, { color: statusColor, children: service.status })] }), service.url && (_jsx(Box, { marginLeft: 2, children: _jsxs(Text, { color: "gray", children: ["URL: ", service.url] }) })), service.details && (_jsx(Box, { marginLeft: 2, children: _jsx(Text, { color: "gray", children: service.details }) }))] }, service.name));
93
- };
94
- const renderDependencyStatus = (dep) => {
95
- const statusColor = dep.installed ? 'green' : 'red';
96
- const statusIcon = dep.installed ? '✓' : '✗';
97
- const statusText = dep.installed ? 'installed' : 'missing';
98
- return (_jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [_jsxs(Box, { children: [_jsxs(Text, { color: statusColor, children: [statusIcon, " "] }), _jsxs(Text, { bold: true, children: [dep.name, ": "] }), _jsx(Text, { color: statusColor, children: statusText })] }), dep.version && (_jsx(Box, { marginLeft: 2, children: _jsxs(Text, { color: "gray", children: ["Version: ", dep.version] }) })), dep.details && (_jsx(Box, { marginLeft: 2, children: _jsx(Text, { color: "gray", children: dep.details }) }))] }, dep.name));
99
- };
100
- const renderStatus = () => {
101
- if (isLoading) {
102
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "yellow", children: "\uD83D\uDD0D Checking ARK system status..." }), _jsx(Text, { color: "gray", children: "Please wait while we verify services and dependencies." })] }));
103
- }
104
- if (error) {
105
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "red", children: "\u274C Error checking status:" }), _jsx(Text, { color: "red", children: error }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "gray", children: "Press ESC, 'q', or Enter to return to menu..." }) })] }));
106
- }
107
- if (!statusData) {
108
- return null;
109
- }
110
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "cyan", bold: true, children: "\uD83D\uDD0D ARK System Status" }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "cyan", bold: true, children: "\uD83D\uDCE1 ARK Services:" }) }), statusData.services.map(renderServiceStatus), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "cyan", bold: true, children: "\uD83D\uDEE0\uFE0F System Dependencies:" }) }), statusData.dependencies.map(renderDependencyStatus), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "gray", children: "Press ESC, 'q', or Enter to return to menu..." }) })] }));
111
- };
112
- return (_jsxs(_Fragment, { children: [renderBanner(), !selectedChoice && (_jsx(SelectInput, { items: choices, onSelect: (choice) => {
113
- setSelectedChoice(choice.value);
114
- } })), selectedChoice === 'status' && renderStatus(), selectedChoice === 'dashboard' && (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "green", children: "\uD83C\uDFF7\uFE0F Dashboard feature selected" }), _jsx(DashboardCLI, {})] })), selectedChoice === 'generate' && _jsx(GeneratorUI, {}), selectedChoice === 'exit' && _jsx(Text, { color: "yellow", children: "\uD83D\uDC4B Goodbye!" })] }));
242
+ ` }), isChecking ? (_jsxs(Text, { color: "gray", children: [_jsx(Spinner, { type: "dots" }), " Checking Ark status..."] })) : arkReady ? (_jsxs(Box, { children: [_jsx(Text, { color: "green", bold: true, children: "\u25CF Ark is ready" }), config.currentVersion && (_jsxs(Text, { color: "gray", children: [" (", config.currentVersion, ")"] }))] })) : (_jsx(Text, { color: "yellow", bold: true, children: "\u25CF Ark is not installed" })), _jsx(Text, { color: "gray", children: "Interactive terminal interface for Ark agents" })] }), !isChecking && (_jsx(Box, { flexDirection: "column", paddingX: 4, marginTop: 1, children: choices.map((choice, index) => {
243
+ const isSelected = index === selectedIndex;
244
+ return (_jsxs(Box, { flexDirection: "row", paddingY: 0, children: [_jsx(Text, { color: "gray", dimColor: true, children: isSelected ? '❯ ' : ' ' }), _jsxs(Text, { color: "gray", dimColor: true, children: [index + 1, "."] }), _jsx(Box, { marginLeft: 1, width: 20, children: _jsx(Text, { color: isSelected ? 'green' : 'white', bold: isSelected, children: choice.label }) }), _jsx(Text, { color: "gray", children: choice.description })] }, choice.value));
245
+ }) }))] }));
115
246
  };
116
247
  export default MainMenu;
@@ -0,0 +1,8 @@
1
+ import { Model, ArkApiClient } from '../lib/arkApiClient.js';
2
+ interface ModelSelectorProps {
3
+ arkApiClient: ArkApiClient;
4
+ onSelect: (model: Model) => void;
5
+ onExit: () => void;
6
+ }
7
+ export declare function ModelSelector({ arkApiClient, onSelect, onExit, }: ModelSelectorProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,53 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState, useEffect } from 'react';
3
+ import { Box, Text, useInput } from 'ink';
4
+ export function ModelSelector({ arkApiClient, onSelect, onExit, }) {
5
+ const [selectedIndex, setSelectedIndex] = useState(0);
6
+ const [models, setModels] = useState([]);
7
+ const [loading, setLoading] = useState(true);
8
+ const [error, setError] = useState(null);
9
+ useEffect(() => {
10
+ arkApiClient
11
+ .getModels()
12
+ .then((fetchedModels) => {
13
+ setModels(fetchedModels);
14
+ setLoading(false);
15
+ })
16
+ .catch((err) => {
17
+ setError(err.message || 'Failed to fetch models');
18
+ setLoading(false);
19
+ });
20
+ }, [arkApiClient]);
21
+ useInput((input, key) => {
22
+ if (key.escape) {
23
+ onExit();
24
+ }
25
+ else if (key.upArrow || input === 'k') {
26
+ setSelectedIndex((prev) => (prev === 0 ? models.length - 1 : prev - 1));
27
+ }
28
+ else if (key.downArrow || input === 'j') {
29
+ setSelectedIndex((prev) => (prev === models.length - 1 ? 0 : prev + 1));
30
+ }
31
+ else if (key.return) {
32
+ onSelect(models[selectedIndex]);
33
+ }
34
+ else {
35
+ // Handle number keys for quick selection
36
+ const num = parseInt(input, 10);
37
+ if (!isNaN(num) && num >= 1 && num <= models.length) {
38
+ onSelect(models[num - 1]);
39
+ }
40
+ }
41
+ });
42
+ if (loading) {
43
+ return (_jsx(Box, { children: _jsx(Text, { children: "Loading models..." }) }));
44
+ }
45
+ if (error) {
46
+ return (_jsx(Box, { children: _jsxs(Text, { color: "red", children: ["Error: ", error] }) }));
47
+ }
48
+ if (models.length === 0) {
49
+ return (_jsx(Box, { children: _jsx(Text, { children: "No models available" }) }));
50
+ }
51
+ const selectedModel = models[selectedIndex];
52
+ return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "gray", paddingX: 2, paddingY: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, children: "Select Model" }) }), _jsx(Box, { marginBottom: 1, children: _jsx(Text, { dimColor: true, children: "Choose a model to start a conversation with" }) }), _jsx(Box, { flexDirection: "column", children: models.map((model, index) => (_jsx(Box, { marginBottom: 0, children: _jsxs(Text, { color: index === selectedIndex ? 'green' : undefined, children: [index === selectedIndex ? '❯ ' : ' ', index + 1, ". ", model.name, model.type ? ` (${model.type})` : ''] }) }, model.name))) }), selectedModel && selectedModel.model && (_jsx(Box, { marginTop: 1, paddingLeft: 2, children: _jsxs(Text, { dimColor: true, wrap: "wrap", children: ["Model: ", selectedModel.model] }) })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Enter to confirm \u00B7 Number to select \u00B7 Esc to exit" }) })] }));
53
+ }
@@ -0,0 +1,8 @@
1
+ import { Team, ArkApiClient } from '../lib/arkApiClient.js';
2
+ interface TeamSelectorProps {
3
+ arkApiClient: ArkApiClient;
4
+ onSelect: (team: Team) => void;
5
+ onExit: () => void;
6
+ }
7
+ export declare function TeamSelector({ arkApiClient, onSelect, onExit, }: TeamSelectorProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,55 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState, useEffect } from 'react';
3
+ import { Box, Text, useInput } from 'ink';
4
+ export function TeamSelector({ arkApiClient, onSelect, onExit, }) {
5
+ const [selectedIndex, setSelectedIndex] = useState(0);
6
+ const [teams, setTeams] = useState([]);
7
+ const [loading, setLoading] = useState(true);
8
+ const [error, setError] = useState(null);
9
+ useEffect(() => {
10
+ arkApiClient
11
+ .getTeams()
12
+ .then((fetchedTeams) => {
13
+ setTeams(fetchedTeams);
14
+ setLoading(false);
15
+ })
16
+ .catch((err) => {
17
+ setError(err.message || 'Failed to fetch teams');
18
+ setLoading(false);
19
+ });
20
+ }, [arkApiClient]);
21
+ useInput((input, key) => {
22
+ if (key.escape) {
23
+ onExit();
24
+ }
25
+ else if (key.upArrow || input === 'k') {
26
+ setSelectedIndex((prev) => (prev === 0 ? teams.length - 1 : prev - 1));
27
+ }
28
+ else if (key.downArrow || input === 'j') {
29
+ setSelectedIndex((prev) => (prev === teams.length - 1 ? 0 : prev + 1));
30
+ }
31
+ else if (key.return) {
32
+ onSelect(teams[selectedIndex]);
33
+ }
34
+ else {
35
+ // Handle number keys for quick selection
36
+ const num = parseInt(input, 10);
37
+ if (!isNaN(num) && num >= 1 && num <= teams.length) {
38
+ onSelect(teams[num - 1]);
39
+ }
40
+ }
41
+ });
42
+ if (loading) {
43
+ return (_jsx(Box, { children: _jsx(Text, { children: "Loading teams..." }) }));
44
+ }
45
+ if (error) {
46
+ return (_jsx(Box, { children: _jsxs(Text, { color: "red", children: ["Error: ", error] }) }));
47
+ }
48
+ if (teams.length === 0) {
49
+ return (_jsx(Box, { children: _jsx(Text, { children: "No teams available" }) }));
50
+ }
51
+ const selectedTeam = teams[selectedIndex];
52
+ return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "gray", paddingX: 2, paddingY: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, children: "Select Team" }) }), _jsx(Box, { marginBottom: 1, children: _jsx(Text, { dimColor: true, children: "Choose a team to start a conversation with" }) }), _jsx(Box, { flexDirection: "column", children: teams.map((team, index) => (_jsx(Box, { marginBottom: 0, children: _jsxs(Text, { color: index === selectedIndex ? 'green' : undefined, children: [index === selectedIndex ? '❯ ' : ' ', index + 1, ". ", team.name, team.strategy ? ` (${team.strategy})` : ''] }) }, team.name))) }), selectedTeam &&
53
+ (selectedTeam.description || selectedTeam.members_count) && (_jsx(Box, { marginTop: 1, paddingLeft: 2, children: _jsx(Text, { dimColor: true, wrap: "wrap", children: selectedTeam.description ||
54
+ `Members: ${selectedTeam.members_count}` }) })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Enter to confirm \u00B7 Number to select \u00B7 Esc to exit" }) })] }));
55
+ }
@@ -0,0 +1,8 @@
1
+ import { Tool, ArkApiClient } from '../lib/arkApiClient.js';
2
+ interface ToolSelectorProps {
3
+ arkApiClient: ArkApiClient;
4
+ onSelect: (tool: Tool) => void;
5
+ onExit: () => void;
6
+ }
7
+ export declare function ToolSelector({ arkApiClient, onSelect, onExit, }: ToolSelectorProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,53 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState, useEffect } from 'react';
3
+ import { Box, Text, useInput } from 'ink';
4
+ export function ToolSelector({ arkApiClient, onSelect, onExit, }) {
5
+ const [selectedIndex, setSelectedIndex] = useState(0);
6
+ const [tools, setTools] = useState([]);
7
+ const [loading, setLoading] = useState(true);
8
+ const [error, setError] = useState(null);
9
+ useEffect(() => {
10
+ arkApiClient
11
+ .getTools()
12
+ .then((fetchedTools) => {
13
+ setTools(fetchedTools);
14
+ setLoading(false);
15
+ })
16
+ .catch((err) => {
17
+ setError(err.message || 'Failed to fetch tools');
18
+ setLoading(false);
19
+ });
20
+ }, [arkApiClient]);
21
+ useInput((input, key) => {
22
+ if (key.escape) {
23
+ onExit();
24
+ }
25
+ else if (key.upArrow || input === 'k') {
26
+ setSelectedIndex((prev) => (prev === 0 ? tools.length - 1 : prev - 1));
27
+ }
28
+ else if (key.downArrow || input === 'j') {
29
+ setSelectedIndex((prev) => (prev === tools.length - 1 ? 0 : prev + 1));
30
+ }
31
+ else if (key.return) {
32
+ onSelect(tools[selectedIndex]);
33
+ }
34
+ else {
35
+ // Handle number keys for quick selection
36
+ const num = parseInt(input, 10);
37
+ if (!isNaN(num) && num >= 1 && num <= tools.length) {
38
+ onSelect(tools[num - 1]);
39
+ }
40
+ }
41
+ });
42
+ if (loading) {
43
+ return (_jsx(Box, { children: _jsx(Text, { children: "Loading tools..." }) }));
44
+ }
45
+ if (error) {
46
+ return (_jsx(Box, { children: _jsxs(Text, { color: "red", children: ["Error: ", error] }) }));
47
+ }
48
+ if (tools.length === 0) {
49
+ return (_jsx(Box, { children: _jsx(Text, { children: "No tools available" }) }));
50
+ }
51
+ const selectedTool = tools[selectedIndex];
52
+ return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "gray", paddingX: 2, paddingY: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, children: "Select Tool" }) }), _jsx(Box, { marginBottom: 1, children: _jsx(Text, { dimColor: true, children: "Choose a tool to start a conversation with" }) }), _jsx(Box, { flexDirection: "column", children: tools.map((tool, index) => (_jsx(Box, { marginBottom: 0, children: _jsxs(Text, { color: index === selectedIndex ? 'green' : undefined, children: [index === selectedIndex ? '❯ ' : ' ', index + 1, ". ", tool.name] }) }, tool.name))) }), selectedTool && selectedTool.description && (_jsx(Box, { marginTop: 1, paddingLeft: 2, children: _jsx(Text, { dimColor: true, wrap: "wrap", children: selectedTool.description }) })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Enter to confirm \u00B7 Number to select \u00B7 Esc to exit" }) })] }));
53
+ }
@@ -1,9 +1,24 @@
1
- import { StatusData } from '../lib/types.js';
1
+ export type StatusColor = 'green' | 'red' | 'yellow' | 'gray' | 'white' | 'cyan' | 'bold';
2
+ export interface StatusLine {
3
+ icon: string;
4
+ iconColor?: StatusColor;
5
+ status: string;
6
+ statusColor?: StatusColor;
7
+ name: string;
8
+ nameColor?: StatusColor;
9
+ details?: string;
10
+ subtext?: string;
11
+ }
12
+ export interface StatusSection {
13
+ title: string;
14
+ lines: StatusLine[];
15
+ }
16
+ /**
17
+ * Simple status formatter that just formats sections and lines
18
+ * The caller is responsible for deciding what to show
19
+ */
2
20
  export declare class StatusFormatter {
3
- /**
4
- * Print status check results to console
5
- */
6
- static printStatus(statusData: StatusData): void;
7
- private static printService;
8
- private static printDependency;
21
+ static printSections(sections: StatusSection[]): void;
22
+ private static applyColor;
23
+ private static printLine;
9
24
  }