@agents-at-scale/ark 0.1.35 → 0.1.36-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.
- package/dist/arkServices.d.ts +42 -0
- package/dist/arkServices.js +138 -0
- package/dist/arkServices.spec.d.ts +1 -0
- package/dist/arkServices.spec.js +24 -0
- package/dist/charts/charts.d.ts +5 -0
- package/dist/charts/charts.js +6 -0
- package/dist/charts/dependencies.d.ts +6 -0
- package/dist/charts/dependencies.js +50 -0
- package/dist/charts/types.d.ts +40 -0
- package/dist/charts/types.js +1 -0
- package/dist/commands/agents/index.d.ts +3 -0
- package/dist/commands/agents/index.js +65 -0
- package/dist/commands/agents/index.spec.d.ts +1 -0
- package/dist/commands/agents/index.spec.js +67 -0
- package/dist/commands/agents/selector.d.ts +8 -0
- package/dist/commands/agents/selector.js +53 -0
- package/dist/commands/agents.d.ts +2 -0
- package/dist/commands/agents.js +53 -0
- package/dist/commands/chat/index.d.ts +3 -0
- package/dist/commands/chat/index.js +29 -0
- package/dist/commands/chat.d.ts +2 -0
- package/dist/commands/chat.js +45 -0
- package/dist/commands/cluster/get.d.ts +2 -0
- package/dist/commands/cluster/get.js +39 -0
- package/dist/commands/cluster/get.spec.d.ts +1 -0
- package/dist/commands/cluster/get.spec.js +92 -0
- package/dist/commands/cluster/index.d.ts +2 -1
- package/dist/commands/cluster/index.js +3 -5
- package/dist/commands/cluster/index.spec.d.ts +1 -0
- package/dist/commands/cluster/index.spec.js +24 -0
- package/dist/commands/completion/index.d.ts +3 -0
- package/dist/commands/completion/index.js +230 -0
- package/dist/commands/completion/index.spec.d.ts +1 -0
- package/dist/commands/completion/index.spec.js +34 -0
- package/dist/commands/completion.js +159 -2
- package/dist/commands/config/index.d.ts +3 -0
- package/dist/commands/config/index.js +42 -0
- package/dist/commands/config/index.spec.d.ts +1 -0
- package/dist/commands/config/index.spec.js +78 -0
- package/dist/commands/config.d.ts +0 -3
- package/dist/commands/config.js +38 -321
- package/dist/commands/dashboard/index.d.ts +4 -0
- package/dist/commands/dashboard/index.js +39 -0
- package/dist/commands/dashboard.d.ts +3 -0
- package/dist/commands/dashboard.js +39 -0
- package/dist/commands/dev/index.d.ts +3 -0
- package/dist/commands/dev/index.js +9 -0
- package/dist/commands/dev/tool/check.d.ts +2 -0
- package/dist/commands/dev/tool/check.js +142 -0
- package/dist/commands/dev/tool/clean.d.ts +2 -0
- package/dist/commands/dev/tool/clean.js +153 -0
- package/dist/commands/dev/tool/generate.d.ts +2 -0
- package/dist/commands/dev/tool/generate.js +28 -0
- package/dist/commands/dev/tool/index.d.ts +2 -0
- package/dist/commands/dev/tool/index.js +14 -0
- package/dist/commands/dev/tool/init.d.ts +2 -0
- package/dist/commands/dev/tool/init.js +320 -0
- package/dist/commands/dev/tool/shared.d.ts +5 -0
- package/dist/commands/dev/tool/shared.js +258 -0
- package/dist/commands/dev/tool/status.d.ts +2 -0
- package/dist/commands/dev/tool/status.js +136 -0
- package/dist/commands/dev/tool-generate.spec.d.ts +1 -0
- package/dist/commands/dev/tool-generate.spec.js +163 -0
- package/dist/commands/dev/tool.d.ts +2 -0
- package/dist/commands/dev/tool.js +559 -0
- package/dist/commands/dev/tool.spec.d.ts +1 -0
- package/dist/commands/dev/tool.spec.js +48 -0
- package/dist/commands/docs/index.d.ts +4 -0
- package/dist/commands/docs/index.js +18 -0
- package/dist/commands/generate/config.js +5 -24
- package/dist/commands/generate/generators/mcpserver.d.ts +2 -1
- package/dist/commands/generate/generators/mcpserver.js +26 -5
- package/dist/commands/generate/generators/project.js +22 -41
- package/dist/commands/generate/index.d.ts +2 -1
- package/dist/commands/generate/index.js +1 -1
- package/dist/commands/install/index.d.ts +8 -0
- package/dist/commands/install/index.js +295 -0
- package/dist/commands/install/index.spec.d.ts +1 -0
- package/dist/commands/install/index.spec.js +143 -0
- package/dist/commands/install.d.ts +3 -0
- package/dist/commands/install.js +147 -0
- package/dist/commands/models/create.d.ts +1 -0
- package/dist/commands/models/create.js +213 -0
- package/dist/commands/models/create.spec.d.ts +1 -0
- package/dist/commands/models/create.spec.js +125 -0
- package/dist/commands/models/index.d.ts +3 -0
- package/dist/commands/models/index.js +75 -0
- package/dist/commands/models/index.spec.d.ts +1 -0
- package/dist/commands/models/index.spec.js +96 -0
- package/dist/commands/models/selector.d.ts +8 -0
- package/dist/commands/models/selector.js +53 -0
- package/dist/commands/query/index.d.ts +3 -0
- package/dist/commands/query/index.js +24 -0
- package/dist/commands/query/index.spec.d.ts +1 -0
- package/dist/commands/query/index.spec.js +53 -0
- package/dist/commands/routes/index.d.ts +3 -0
- package/dist/commands/routes/index.js +93 -0
- package/dist/commands/routes.d.ts +2 -0
- package/dist/commands/routes.js +101 -0
- package/dist/commands/status/index.d.ts +3 -0
- package/dist/commands/status/index.js +281 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.js +33 -0
- package/dist/commands/targets/index.d.ts +3 -0
- package/dist/commands/targets/index.js +72 -0
- package/dist/commands/targets/index.spec.d.ts +1 -0
- package/dist/commands/targets/index.spec.js +154 -0
- package/dist/commands/targets.d.ts +2 -0
- package/dist/commands/targets.js +65 -0
- package/dist/commands/teams/index.d.ts +3 -0
- package/dist/commands/teams/index.js +64 -0
- package/dist/commands/teams/index.spec.d.ts +1 -0
- package/dist/commands/teams/index.spec.js +70 -0
- package/dist/commands/teams/selector.d.ts +8 -0
- package/dist/commands/teams/selector.js +55 -0
- package/dist/commands/tools/index.d.ts +3 -0
- package/dist/commands/tools/index.js +49 -0
- package/dist/commands/tools/index.spec.d.ts +1 -0
- package/dist/commands/tools/index.spec.js +70 -0
- package/dist/commands/tools/selector.d.ts +8 -0
- package/dist/commands/tools/selector.js +53 -0
- package/dist/commands/uninstall/index.d.ts +3 -0
- package/dist/commands/uninstall/index.js +101 -0
- package/dist/commands/uninstall/index.spec.d.ts +1 -0
- package/dist/commands/uninstall/index.spec.js +125 -0
- package/dist/commands/uninstall.d.ts +2 -0
- package/dist/commands/uninstall.js +83 -0
- package/dist/components/ChatUI.d.ts +16 -0
- package/dist/components/ChatUI.js +801 -0
- package/dist/components/StatusView.d.ts +10 -0
- package/dist/components/StatusView.js +39 -0
- package/dist/components/statusChecker.d.ts +14 -24
- package/dist/components/statusChecker.js +295 -129
- package/dist/config.d.ts +3 -22
- package/dist/config.js +10 -161
- package/dist/index.d.ts +1 -1
- package/dist/index.js +42 -42
- package/dist/lib/arkApiClient.d.ts +53 -0
- package/dist/lib/arkApiClient.js +102 -0
- package/dist/lib/arkApiProxy.d.ts +9 -0
- package/dist/lib/arkApiProxy.js +22 -0
- package/dist/lib/arkServiceProxy.d.ts +14 -0
- package/dist/lib/arkServiceProxy.js +95 -0
- package/dist/lib/arkStatus.d.ts +10 -0
- package/dist/lib/arkStatus.js +79 -0
- package/dist/lib/arkStatus.spec.d.ts +1 -0
- package/dist/lib/arkStatus.spec.js +49 -0
- package/dist/lib/chatClient.d.ts +33 -0
- package/dist/lib/chatClient.js +93 -0
- package/dist/lib/cluster.d.ts +2 -1
- package/dist/lib/cluster.js +37 -16
- package/dist/lib/cluster.spec.d.ts +1 -0
- package/dist/lib/cluster.spec.js +338 -0
- package/dist/lib/commandUtils.d.ts +4 -0
- package/dist/lib/commandUtils.js +18 -0
- package/dist/lib/commandUtils.test.d.ts +1 -0
- package/dist/lib/commandUtils.test.js +44 -0
- package/dist/lib/commands.d.ts +16 -0
- package/dist/lib/commands.js +29 -0
- package/dist/lib/commands.spec.d.ts +1 -0
- package/dist/lib/commands.spec.js +146 -0
- package/dist/lib/config.d.ts +26 -80
- package/dist/lib/config.js +70 -205
- package/dist/lib/config.spec.d.ts +1 -0
- package/dist/lib/config.spec.js +99 -0
- package/dist/lib/config.test.d.ts +1 -0
- package/dist/lib/config.test.js +93 -0
- package/dist/lib/consts.d.ts +0 -1
- package/dist/lib/consts.js +0 -2
- package/dist/lib/consts.spec.d.ts +1 -0
- package/dist/lib/consts.spec.js +15 -0
- package/dist/lib/dev/tools/analyzer.d.ts +30 -0
- package/dist/lib/dev/tools/analyzer.js +190 -0
- package/dist/lib/dev/tools/discover_tools.py +392 -0
- package/dist/lib/dev/tools/mcp-types.d.ts +28 -0
- package/dist/lib/dev/tools/mcp-types.js +86 -0
- package/dist/lib/dev/tools/types.d.ts +50 -0
- package/dist/lib/dev/tools/types.js +1 -0
- package/dist/lib/errors.js +1 -1
- package/dist/lib/errors.spec.d.ts +1 -0
- package/dist/lib/errors.spec.js +221 -0
- package/dist/lib/exec.d.ts +0 -4
- package/dist/lib/exec.js +0 -11
- package/dist/lib/executeQuery.d.ts +20 -0
- package/dist/lib/executeQuery.js +135 -0
- package/dist/lib/executeQuery.spec.d.ts +1 -0
- package/dist/lib/executeQuery.spec.js +170 -0
- package/dist/lib/nextSteps.d.ts +4 -0
- package/dist/lib/nextSteps.js +20 -0
- package/dist/lib/nextSteps.spec.d.ts +1 -0
- package/dist/lib/nextSteps.spec.js +59 -0
- package/dist/lib/output.d.ts +36 -0
- package/dist/lib/output.js +89 -0
- package/dist/lib/output.spec.d.ts +1 -0
- package/dist/lib/output.spec.js +123 -0
- package/dist/lib/portUtils.d.ts +8 -0
- package/dist/lib/portUtils.js +39 -0
- package/dist/lib/queryRunner.d.ts +22 -0
- package/dist/lib/queryRunner.js +142 -0
- package/dist/lib/startup.d.ts +9 -0
- package/dist/lib/startup.js +87 -0
- package/dist/lib/startup.spec.d.ts +1 -0
- package/dist/lib/startup.spec.js +152 -0
- package/dist/lib/types.d.ts +87 -3
- package/dist/lib/versions.d.ts +23 -0
- package/dist/lib/versions.js +51 -0
- package/dist/types/types.d.ts +40 -0
- package/dist/types/types.js +1 -0
- package/dist/ui/AgentSelector.d.ts +8 -0
- package/dist/ui/AgentSelector.js +53 -0
- package/dist/ui/MainMenu.d.ts +5 -1
- package/dist/ui/MainMenu.js +226 -91
- package/dist/ui/ModelSelector.d.ts +8 -0
- package/dist/ui/ModelSelector.js +53 -0
- package/dist/ui/TeamSelector.d.ts +8 -0
- package/dist/ui/TeamSelector.js +55 -0
- package/dist/ui/ToolSelector.d.ts +8 -0
- package/dist/ui/ToolSelector.js +53 -0
- package/dist/ui/statusFormatter.d.ts +22 -7
- package/dist/ui/statusFormatter.js +39 -39
- package/dist/ui/statusFormatter.spec.d.ts +1 -0
- package/dist/ui/statusFormatter.spec.js +58 -0
- package/package.json +16 -5
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { describe, it, expect, jest, beforeEach, afterEach } from '@jest/globals';
|
|
2
|
+
// Mock chalk to avoid ANSI codes in tests
|
|
3
|
+
jest.unstable_mockModule('chalk', () => ({
|
|
4
|
+
default: {
|
|
5
|
+
red: (str) => str,
|
|
6
|
+
yellow: (str) => str,
|
|
7
|
+
gray: (str) => str,
|
|
8
|
+
blue: (str) => str,
|
|
9
|
+
},
|
|
10
|
+
}));
|
|
11
|
+
// Mock commands module
|
|
12
|
+
jest.unstable_mockModule('./commands.js', () => ({
|
|
13
|
+
checkCommandExists: jest.fn(),
|
|
14
|
+
}));
|
|
15
|
+
// Mock config module
|
|
16
|
+
jest.unstable_mockModule('./config.js', () => ({
|
|
17
|
+
loadConfig: jest.fn(),
|
|
18
|
+
}));
|
|
19
|
+
// Mock execa module
|
|
20
|
+
jest.unstable_mockModule('execa', () => ({
|
|
21
|
+
execa: jest.fn(),
|
|
22
|
+
}));
|
|
23
|
+
// Dynamic imports after mocks
|
|
24
|
+
const { checkCommandExists } = await import('./commands.js');
|
|
25
|
+
const { loadConfig } = await import('./config.js');
|
|
26
|
+
const { execa } = await import('execa');
|
|
27
|
+
const { startup } = await import('./startup.js');
|
|
28
|
+
// Type the mocks
|
|
29
|
+
const mockCheckCommandExists = checkCommandExists;
|
|
30
|
+
const mockLoadConfig = loadConfig;
|
|
31
|
+
const mockExeca = execa;
|
|
32
|
+
describe('startup', () => {
|
|
33
|
+
let mockExit;
|
|
34
|
+
let mockConsoleError;
|
|
35
|
+
beforeEach(() => {
|
|
36
|
+
jest.clearAllMocks();
|
|
37
|
+
// Mock execa to reject by default (no kubectl context)
|
|
38
|
+
mockExeca.mockRejectedValue(new Error('No context'));
|
|
39
|
+
mockExit = jest.spyOn(process, 'exit').mockImplementation(() => {
|
|
40
|
+
throw new Error('process.exit');
|
|
41
|
+
});
|
|
42
|
+
mockConsoleError = jest
|
|
43
|
+
.spyOn(console, 'error')
|
|
44
|
+
.mockImplementation(() => { });
|
|
45
|
+
});
|
|
46
|
+
afterEach(() => {
|
|
47
|
+
mockExit.mockRestore();
|
|
48
|
+
mockConsoleError.mockRestore();
|
|
49
|
+
});
|
|
50
|
+
it('returns config when all required commands are installed', async () => {
|
|
51
|
+
const expectedConfig = {
|
|
52
|
+
chat: {
|
|
53
|
+
streaming: true,
|
|
54
|
+
outputFormat: 'text',
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
// Mock all commands as available
|
|
58
|
+
mockCheckCommandExists.mockResolvedValue(true);
|
|
59
|
+
mockLoadConfig.mockReturnValue(expectedConfig);
|
|
60
|
+
const config = await startup();
|
|
61
|
+
expect(config).toEqual(expectedConfig);
|
|
62
|
+
expect(mockCheckCommandExists).toHaveBeenCalledWith('kubectl', [
|
|
63
|
+
'version',
|
|
64
|
+
'--client',
|
|
65
|
+
]);
|
|
66
|
+
expect(mockCheckCommandExists).toHaveBeenCalledWith('helm', [
|
|
67
|
+
'version',
|
|
68
|
+
'--short',
|
|
69
|
+
]);
|
|
70
|
+
expect(mockLoadConfig).toHaveBeenCalledTimes(1);
|
|
71
|
+
expect(mockExit).not.toHaveBeenCalled();
|
|
72
|
+
});
|
|
73
|
+
it('exits with error when kubectl is missing', async () => {
|
|
74
|
+
// Mock kubectl as missing, helm as available
|
|
75
|
+
mockCheckCommandExists
|
|
76
|
+
.mockResolvedValueOnce(false) // kubectl
|
|
77
|
+
.mockResolvedValueOnce(true); // helm
|
|
78
|
+
await expect(startup()).rejects.toThrow('process.exit');
|
|
79
|
+
expect(mockConsoleError).toHaveBeenCalledWith('error: kubectl is required');
|
|
80
|
+
expect(mockConsoleError).toHaveBeenCalledWith(' https://kubernetes.io/docs/tasks/tools/');
|
|
81
|
+
expect(mockExit).toHaveBeenCalledWith(1);
|
|
82
|
+
});
|
|
83
|
+
it('exits with error when helm is missing', async () => {
|
|
84
|
+
// Mock kubectl as available, helm as missing
|
|
85
|
+
mockCheckCommandExists
|
|
86
|
+
.mockResolvedValueOnce(true) // kubectl
|
|
87
|
+
.mockResolvedValueOnce(false); // helm
|
|
88
|
+
await expect(startup()).rejects.toThrow('process.exit');
|
|
89
|
+
expect(mockConsoleError).toHaveBeenCalledWith('error: helm is required');
|
|
90
|
+
expect(mockConsoleError).toHaveBeenCalledWith(' https://helm.sh/docs/intro/install/');
|
|
91
|
+
expect(mockExit).toHaveBeenCalledWith(1);
|
|
92
|
+
});
|
|
93
|
+
it('exits with error when both commands are missing', async () => {
|
|
94
|
+
// Mock both commands as missing
|
|
95
|
+
mockCheckCommandExists.mockResolvedValue(false);
|
|
96
|
+
await expect(startup()).rejects.toThrow('process.exit');
|
|
97
|
+
expect(mockConsoleError).toHaveBeenCalledWith('error: kubectl is required');
|
|
98
|
+
expect(mockConsoleError).toHaveBeenCalledWith(' https://kubernetes.io/docs/tasks/tools/');
|
|
99
|
+
expect(mockConsoleError).toHaveBeenCalledWith('error: helm is required');
|
|
100
|
+
expect(mockConsoleError).toHaveBeenCalledWith(' https://helm.sh/docs/intro/install/');
|
|
101
|
+
expect(mockExit).toHaveBeenCalledWith(1);
|
|
102
|
+
});
|
|
103
|
+
it('checks commands with correct arguments', async () => {
|
|
104
|
+
mockCheckCommandExists.mockResolvedValue(true);
|
|
105
|
+
mockLoadConfig.mockReturnValue({ chat: {} });
|
|
106
|
+
await startup();
|
|
107
|
+
expect(mockCheckCommandExists).toHaveBeenCalledTimes(2);
|
|
108
|
+
expect(mockCheckCommandExists).toHaveBeenNthCalledWith(1, 'kubectl', [
|
|
109
|
+
'version',
|
|
110
|
+
'--client',
|
|
111
|
+
]);
|
|
112
|
+
expect(mockCheckCommandExists).toHaveBeenNthCalledWith(2, 'helm', [
|
|
113
|
+
'version',
|
|
114
|
+
'--short',
|
|
115
|
+
]);
|
|
116
|
+
});
|
|
117
|
+
it('loads config after checking requirements', async () => {
|
|
118
|
+
mockCheckCommandExists.mockResolvedValue(true);
|
|
119
|
+
const expectedConfig = { chat: { streaming: false } };
|
|
120
|
+
mockLoadConfig.mockReturnValue(expectedConfig);
|
|
121
|
+
const config = await startup();
|
|
122
|
+
// Verify order - checkCommandExists should be called before loadConfig
|
|
123
|
+
const checkCallOrder = mockCheckCommandExists.mock.invocationCallOrder[0];
|
|
124
|
+
const loadCallOrder = mockLoadConfig.mock.invocationCallOrder[0];
|
|
125
|
+
expect(checkCallOrder).toBeLessThan(loadCallOrder);
|
|
126
|
+
expect(config).toEqual(expectedConfig);
|
|
127
|
+
});
|
|
128
|
+
it('includes cluster context when available', async () => {
|
|
129
|
+
mockCheckCommandExists.mockResolvedValue(true);
|
|
130
|
+
mockLoadConfig.mockReturnValue({ chat: { streaming: true } });
|
|
131
|
+
// Mock successful kubectl context check
|
|
132
|
+
mockExeca.mockResolvedValue({
|
|
133
|
+
stdout: 'minikube',
|
|
134
|
+
stderr: '',
|
|
135
|
+
});
|
|
136
|
+
const config = await startup();
|
|
137
|
+
expect(config.clusterInfo).toEqual({
|
|
138
|
+
type: 'unknown',
|
|
139
|
+
context: 'minikube',
|
|
140
|
+
});
|
|
141
|
+
expect(mockExeca).toHaveBeenCalledWith('kubectl', ['config', 'current-context']);
|
|
142
|
+
});
|
|
143
|
+
it('handles missing kubectl context gracefully', async () => {
|
|
144
|
+
mockCheckCommandExists.mockResolvedValue(true);
|
|
145
|
+
const expectedConfig = { chat: { streaming: false } };
|
|
146
|
+
mockLoadConfig.mockReturnValue(expectedConfig);
|
|
147
|
+
// mockExeca already mocked to reject in beforeEach
|
|
148
|
+
const config = await startup();
|
|
149
|
+
expect(config).toEqual(expectedConfig);
|
|
150
|
+
expect(config.clusterInfo).toBeUndefined();
|
|
151
|
+
});
|
|
152
|
+
});
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -13,25 +13,109 @@ export interface KubernetesConfig {
|
|
|
13
13
|
namespace?: string;
|
|
14
14
|
inCluster: boolean;
|
|
15
15
|
}
|
|
16
|
-
export
|
|
16
|
+
export type DeploymentStatus = 'available' | 'progressing' | 'replicafailure' | 'failed' | 'not found' | 'unknown';
|
|
17
|
+
export type ServiceStatus = {
|
|
17
18
|
name: string;
|
|
18
|
-
status: 'healthy' | 'unhealthy' | 'not installed';
|
|
19
|
+
status: 'healthy' | 'warning' | 'unhealthy' | 'not installed' | 'not ready';
|
|
20
|
+
deploymentStatus?: DeploymentStatus;
|
|
19
21
|
url?: string;
|
|
20
22
|
version?: string;
|
|
23
|
+
revision?: string;
|
|
21
24
|
details?: string;
|
|
22
|
-
|
|
25
|
+
isDev?: boolean;
|
|
26
|
+
namespace?: string;
|
|
27
|
+
};
|
|
23
28
|
export interface DependencyStatus {
|
|
24
29
|
name: string;
|
|
25
30
|
installed: boolean;
|
|
26
31
|
version?: string;
|
|
27
32
|
details?: string;
|
|
28
33
|
}
|
|
34
|
+
export interface ModelStatus {
|
|
35
|
+
exists: boolean;
|
|
36
|
+
available?: boolean;
|
|
37
|
+
provider?: string;
|
|
38
|
+
details?: string;
|
|
39
|
+
}
|
|
29
40
|
export interface StatusData {
|
|
30
41
|
services: ServiceStatus[];
|
|
31
42
|
dependencies: DependencyStatus[];
|
|
43
|
+
arkReady?: boolean;
|
|
44
|
+
defaultModelExists?: boolean;
|
|
45
|
+
defaultModel?: ModelStatus;
|
|
32
46
|
}
|
|
33
47
|
export interface CommandVersionConfig {
|
|
34
48
|
command: string;
|
|
35
49
|
versionArgs: string;
|
|
36
50
|
versionExtract: (_output: string) => string;
|
|
37
51
|
}
|
|
52
|
+
export interface K8sMetadata {
|
|
53
|
+
name: string;
|
|
54
|
+
namespace?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface K8sCondition {
|
|
57
|
+
type: string;
|
|
58
|
+
status: string;
|
|
59
|
+
message?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface K8sListResource<T> {
|
|
62
|
+
items: T[];
|
|
63
|
+
}
|
|
64
|
+
export interface HelmRelease {
|
|
65
|
+
name: string;
|
|
66
|
+
app_version?: string;
|
|
67
|
+
revision?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface K8sDeployment {
|
|
70
|
+
metadata: K8sMetadata;
|
|
71
|
+
spec?: {
|
|
72
|
+
replicas?: number;
|
|
73
|
+
};
|
|
74
|
+
status?: {
|
|
75
|
+
readyReplicas?: number;
|
|
76
|
+
availableReplicas?: number;
|
|
77
|
+
conditions?: K8sCondition[];
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export interface Model {
|
|
81
|
+
metadata: K8sMetadata;
|
|
82
|
+
status?: ModelStatus;
|
|
83
|
+
}
|
|
84
|
+
export interface Agent {
|
|
85
|
+
metadata: K8sMetadata;
|
|
86
|
+
}
|
|
87
|
+
export interface Team {
|
|
88
|
+
metadata: K8sMetadata;
|
|
89
|
+
}
|
|
90
|
+
export interface QueryTarget {
|
|
91
|
+
type: string;
|
|
92
|
+
name: string;
|
|
93
|
+
}
|
|
94
|
+
export interface QueryResponse {
|
|
95
|
+
content?: string;
|
|
96
|
+
}
|
|
97
|
+
export interface Query {
|
|
98
|
+
apiVersion: string;
|
|
99
|
+
kind: 'Query';
|
|
100
|
+
metadata: K8sMetadata;
|
|
101
|
+
spec?: {
|
|
102
|
+
input: string;
|
|
103
|
+
targets: QueryTarget[];
|
|
104
|
+
};
|
|
105
|
+
status?: {
|
|
106
|
+
phase?: 'initializing' | 'running' | 'done' | 'error' | 'canceled';
|
|
107
|
+
conditions?: K8sCondition[];
|
|
108
|
+
responses?: QueryResponse[];
|
|
109
|
+
message?: string;
|
|
110
|
+
error?: string;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export interface Tool {
|
|
114
|
+
metadata: K8sMetadata;
|
|
115
|
+
}
|
|
116
|
+
export interface ClusterInfo {
|
|
117
|
+
context?: string;
|
|
118
|
+
cluster?: string;
|
|
119
|
+
user?: string;
|
|
120
|
+
namespace?: string;
|
|
121
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version information for ARK
|
|
3
|
+
*/
|
|
4
|
+
export interface ArkVersionInfo {
|
|
5
|
+
current?: string;
|
|
6
|
+
latest?: string;
|
|
7
|
+
updateAvailable?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Fetch the latest ARK version from GitHub releases
|
|
11
|
+
* @returns Latest version string or undefined if fetch fails
|
|
12
|
+
*/
|
|
13
|
+
export declare function fetchLatestVersion(): Promise<string | undefined>;
|
|
14
|
+
/**
|
|
15
|
+
* Get current installed ARK version from Helm
|
|
16
|
+
* @returns Current version string or undefined if not found
|
|
17
|
+
*/
|
|
18
|
+
export declare function fetchCurrentVersion(): Promise<string | undefined>;
|
|
19
|
+
/**
|
|
20
|
+
* Fetch both current and latest versions in parallel
|
|
21
|
+
* @returns Version information
|
|
22
|
+
*/
|
|
23
|
+
export declare function fetchVersionInfo(): Promise<ArkVersionInfo>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { execa } from 'execa';
|
|
2
|
+
import { arkServices } from '../arkServices.js';
|
|
3
|
+
/**
|
|
4
|
+
* Fetch the latest ARK version from GitHub releases
|
|
5
|
+
* @returns Latest version string or undefined if fetch fails
|
|
6
|
+
*/
|
|
7
|
+
export async function fetchLatestVersion() {
|
|
8
|
+
try {
|
|
9
|
+
const response = await fetch('https://api.github.com/repos/mckinsey/agents-at-scale-ark/releases/latest');
|
|
10
|
+
if (response.ok) {
|
|
11
|
+
const data = (await response.json());
|
|
12
|
+
// Remove 'v' prefix if present for consistent comparison
|
|
13
|
+
return data.tag_name.replace(/^v/, '');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
// Silently fail
|
|
18
|
+
}
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get current installed ARK version from Helm
|
|
23
|
+
* @returns Current version string or undefined if not found
|
|
24
|
+
*/
|
|
25
|
+
export async function fetchCurrentVersion() {
|
|
26
|
+
try {
|
|
27
|
+
const controller = arkServices['ark-controller'];
|
|
28
|
+
const { stdout } = await execa('helm', ['list', '-n', controller.namespace, '-o', 'json'], { stdio: 'pipe' });
|
|
29
|
+
const releases = JSON.parse(stdout);
|
|
30
|
+
const arkController = releases.find((r) => r.name === controller.helmReleaseName);
|
|
31
|
+
return arkController?.app_version;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Fetch both current and latest versions in parallel
|
|
39
|
+
* @returns Version information
|
|
40
|
+
*/
|
|
41
|
+
export async function fetchVersionInfo() {
|
|
42
|
+
const [current, latest] = await Promise.all([
|
|
43
|
+
fetchCurrentVersion(),
|
|
44
|
+
fetchLatestVersion(),
|
|
45
|
+
]);
|
|
46
|
+
return {
|
|
47
|
+
current,
|
|
48
|
+
latest,
|
|
49
|
+
updateAvailable: current && latest ? current !== latest : undefined,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a Helm chart configuration for ARK components
|
|
3
|
+
*/
|
|
4
|
+
export interface ArkChart {
|
|
5
|
+
/** Name of the chart (used as release name) */
|
|
6
|
+
name: string;
|
|
7
|
+
/** Full chart path (OCI registry or local path) */
|
|
8
|
+
chartPath: string;
|
|
9
|
+
/** Kubernetes namespace to install into */
|
|
10
|
+
namespace: string;
|
|
11
|
+
/** Additional arguments to pass to helm (e.g., --create-namespace, --wait, --timeout 300s, --set key=value) */
|
|
12
|
+
args?: string[];
|
|
13
|
+
/** Description of what this chart provides */
|
|
14
|
+
description?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Collection of ARK charts
|
|
18
|
+
*/
|
|
19
|
+
export interface ChartCollection {
|
|
20
|
+
[key: string]: ArkChart;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Represents a dependency that needs to be installed
|
|
24
|
+
*/
|
|
25
|
+
export interface Dependency {
|
|
26
|
+
/** Name of the dependency */
|
|
27
|
+
name: string;
|
|
28
|
+
/** Command to execute (helm, kubectl, etc.) */
|
|
29
|
+
command: string;
|
|
30
|
+
/** Arguments to pass to the command */
|
|
31
|
+
args: string[];
|
|
32
|
+
/** Description of what this dependency provides */
|
|
33
|
+
description?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Collection of dependencies
|
|
37
|
+
*/
|
|
38
|
+
export interface DependencyCollection {
|
|
39
|
+
[key: string]: Dependency;
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Agent, ArkApiClient } from '../lib/arkApiClient.js';
|
|
2
|
+
interface AgentSelectorProps {
|
|
3
|
+
arkApiClient: ArkApiClient;
|
|
4
|
+
onSelect: (agent: Agent) => void;
|
|
5
|
+
onExit: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function AgentSelector({ arkApiClient, onSelect, onExit, }: AgentSelectorProps): 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 AgentSelector({ arkApiClient, onSelect, onExit, }) {
|
|
5
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
6
|
+
const [agents, setAgents] = useState([]);
|
|
7
|
+
const [loading, setLoading] = useState(true);
|
|
8
|
+
const [error, setError] = useState(null);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
arkApiClient
|
|
11
|
+
.getAgents()
|
|
12
|
+
.then((fetchedAgents) => {
|
|
13
|
+
setAgents(fetchedAgents);
|
|
14
|
+
setLoading(false);
|
|
15
|
+
})
|
|
16
|
+
.catch((err) => {
|
|
17
|
+
setError(err.message || 'Failed to fetch agents');
|
|
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 ? agents.length - 1 : prev - 1));
|
|
27
|
+
}
|
|
28
|
+
else if (key.downArrow || input === 'j') {
|
|
29
|
+
setSelectedIndex((prev) => (prev === agents.length - 1 ? 0 : prev + 1));
|
|
30
|
+
}
|
|
31
|
+
else if (key.return) {
|
|
32
|
+
onSelect(agents[selectedIndex]);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
// Handle number keys for quick selection
|
|
36
|
+
const num = parseInt(input, 10);
|
|
37
|
+
if (!isNaN(num) && num >= 1 && num <= agents.length) {
|
|
38
|
+
onSelect(agents[num - 1]);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
if (loading) {
|
|
43
|
+
return (_jsx(Box, { children: _jsx(Text, { children: "Loading agents..." }) }));
|
|
44
|
+
}
|
|
45
|
+
if (error) {
|
|
46
|
+
return (_jsx(Box, { children: _jsxs(Text, { color: "red", children: ["Error: ", error] }) }));
|
|
47
|
+
}
|
|
48
|
+
if (agents.length === 0) {
|
|
49
|
+
return (_jsx(Box, { children: _jsx(Text, { children: "No agents available" }) }));
|
|
50
|
+
}
|
|
51
|
+
const selectedAgent = agents[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 Agent" }) }), _jsx(Box, { marginBottom: 1, children: _jsx(Text, { dimColor: true, children: "Choose an agent to start a conversation with" }) }), _jsx(Box, { flexDirection: "column", children: agents.map((agent, index) => (_jsx(Box, { marginBottom: 0, children: _jsxs(Text, { color: index === selectedIndex ? 'green' : undefined, children: [index === selectedIndex ? '❯ ' : ' ', index + 1, ". ", agent.name] }) }, agent.name))) }), selectedAgent.description && (_jsx(Box, { marginTop: 1, paddingLeft: 2, children: _jsx(Text, { dimColor: true, wrap: "wrap", children: selectedAgent.description }) })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Enter to confirm \u00B7 Number to select \u00B7 Esc to exit" }) })] }));
|
|
53
|
+
}
|
package/dist/ui/MainMenu.d.ts
CHANGED