@agents-at-scale/ark 0.1.35-rc1 → 0.1.35
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/commands/cluster/index.d.ts +1 -2
- package/dist/commands/cluster/index.js +5 -3
- package/dist/commands/completion.js +2 -159
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.js +321 -38
- package/dist/commands/generate/config.js +24 -5
- package/dist/commands/generate/generators/agent.js +2 -2
- package/dist/commands/generate/generators/mcpserver.d.ts +1 -2
- package/dist/commands/generate/generators/mcpserver.js +5 -26
- package/dist/commands/generate/generators/project.js +41 -22
- package/dist/commands/generate/generators/team.js +2 -2
- package/dist/commands/generate/index.d.ts +1 -2
- package/dist/commands/generate/index.js +1 -1
- package/dist/components/statusChecker.d.ts +23 -13
- package/dist/components/statusChecker.js +129 -275
- package/dist/config.d.ts +22 -3
- package/dist/config.js +161 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +42 -40
- package/dist/lib/cluster.d.ts +1 -2
- package/dist/lib/cluster.js +16 -37
- package/dist/lib/config.d.ts +80 -26
- package/dist/lib/config.js +205 -70
- package/dist/lib/consts.d.ts +1 -0
- package/dist/lib/consts.js +2 -0
- package/dist/lib/errors.js +1 -1
- package/dist/lib/exec.d.ts +4 -0
- package/dist/lib/exec.js +11 -0
- package/dist/lib/types.d.ts +3 -10
- package/dist/ui/MainMenu.d.ts +1 -5
- package/dist/ui/MainMenu.js +91 -222
- package/dist/ui/statusFormatter.d.ts +7 -22
- package/dist/ui/statusFormatter.js +39 -39
- package/package.json +5 -17
- package/dist/arkServices.d.ts +0 -42
- package/dist/arkServices.js +0 -138
- package/dist/arkServices.spec.d.ts +0 -1
- package/dist/arkServices.spec.js +0 -24
- package/dist/charts/charts.d.ts +0 -5
- package/dist/charts/charts.js +0 -6
- package/dist/charts/dependencies.d.ts +0 -6
- package/dist/charts/dependencies.js +0 -50
- package/dist/charts/types.d.ts +0 -40
- package/dist/charts/types.js +0 -1
- package/dist/commands/agents/index.d.ts +0 -3
- package/dist/commands/agents/index.js +0 -51
- package/dist/commands/agents/index.spec.d.ts +0 -1
- package/dist/commands/agents/index.spec.js +0 -67
- package/dist/commands/agents/selector.d.ts +0 -8
- package/dist/commands/agents/selector.js +0 -53
- package/dist/commands/agents.d.ts +0 -2
- package/dist/commands/agents.js +0 -53
- package/dist/commands/chat/index.d.ts +0 -3
- package/dist/commands/chat/index.js +0 -29
- package/dist/commands/chat.d.ts +0 -2
- package/dist/commands/chat.js +0 -45
- package/dist/commands/cluster/get.d.ts +0 -2
- package/dist/commands/cluster/get.js +0 -39
- package/dist/commands/cluster/get.spec.d.ts +0 -1
- package/dist/commands/cluster/get.spec.js +0 -92
- package/dist/commands/cluster/index.spec.d.ts +0 -1
- package/dist/commands/cluster/index.spec.js +0 -24
- package/dist/commands/completion/index.d.ts +0 -3
- package/dist/commands/completion/index.js +0 -268
- package/dist/commands/completion/index.spec.d.ts +0 -1
- package/dist/commands/completion/index.spec.js +0 -34
- package/dist/commands/config/index.d.ts +0 -3
- package/dist/commands/config/index.js +0 -42
- package/dist/commands/config/index.spec.d.ts +0 -1
- package/dist/commands/config/index.spec.js +0 -78
- package/dist/commands/dashboard/index.d.ts +0 -4
- package/dist/commands/dashboard/index.js +0 -39
- package/dist/commands/dashboard.d.ts +0 -3
- package/dist/commands/dashboard.js +0 -39
- package/dist/commands/dev/index.d.ts +0 -3
- package/dist/commands/dev/index.js +0 -9
- package/dist/commands/dev/tool/check.d.ts +0 -2
- package/dist/commands/dev/tool/check.js +0 -142
- package/dist/commands/dev/tool/clean.d.ts +0 -2
- package/dist/commands/dev/tool/clean.js +0 -153
- package/dist/commands/dev/tool/generate.d.ts +0 -2
- package/dist/commands/dev/tool/generate.js +0 -28
- package/dist/commands/dev/tool/index.d.ts +0 -2
- package/dist/commands/dev/tool/index.js +0 -14
- package/dist/commands/dev/tool/init.d.ts +0 -2
- package/dist/commands/dev/tool/init.js +0 -320
- package/dist/commands/dev/tool/shared.d.ts +0 -5
- package/dist/commands/dev/tool/shared.js +0 -256
- package/dist/commands/dev/tool/status.d.ts +0 -2
- package/dist/commands/dev/tool/status.js +0 -136
- package/dist/commands/dev/tool-generate.spec.d.ts +0 -1
- package/dist/commands/dev/tool-generate.spec.js +0 -163
- package/dist/commands/dev/tool.d.ts +0 -2
- package/dist/commands/dev/tool.js +0 -559
- package/dist/commands/dev/tool.spec.d.ts +0 -1
- package/dist/commands/dev/tool.spec.js +0 -48
- package/dist/commands/install/index.d.ts +0 -8
- package/dist/commands/install/index.js +0 -302
- package/dist/commands/install/index.spec.d.ts +0 -1
- package/dist/commands/install/index.spec.js +0 -135
- package/dist/commands/install.d.ts +0 -3
- package/dist/commands/install.js +0 -147
- package/dist/commands/models/create.d.ts +0 -1
- package/dist/commands/models/create.js +0 -213
- package/dist/commands/models/create.spec.d.ts +0 -1
- package/dist/commands/models/create.spec.js +0 -125
- package/dist/commands/models/index.d.ts +0 -3
- package/dist/commands/models/index.js +0 -60
- package/dist/commands/models/index.spec.d.ts +0 -1
- package/dist/commands/models/index.spec.js +0 -76
- package/dist/commands/models/selector.d.ts +0 -8
- package/dist/commands/models/selector.js +0 -53
- package/dist/commands/routes/index.d.ts +0 -3
- package/dist/commands/routes/index.js +0 -93
- package/dist/commands/routes.d.ts +0 -2
- package/dist/commands/routes.js +0 -101
- package/dist/commands/status/index.d.ts +0 -4
- package/dist/commands/status/index.js +0 -232
- package/dist/commands/status.d.ts +0 -3
- package/dist/commands/status.js +0 -33
- package/dist/commands/targets/index.d.ts +0 -3
- package/dist/commands/targets/index.js +0 -65
- package/dist/commands/targets/index.spec.d.ts +0 -1
- package/dist/commands/targets/index.spec.js +0 -105
- package/dist/commands/targets.d.ts +0 -2
- package/dist/commands/targets.js +0 -65
- package/dist/commands/teams/index.d.ts +0 -3
- package/dist/commands/teams/index.js +0 -49
- package/dist/commands/teams/index.spec.d.ts +0 -1
- package/dist/commands/teams/index.spec.js +0 -70
- package/dist/commands/teams/selector.d.ts +0 -8
- package/dist/commands/teams/selector.js +0 -55
- package/dist/commands/tools/index.d.ts +0 -3
- package/dist/commands/tools/index.js +0 -49
- package/dist/commands/tools/index.spec.d.ts +0 -1
- package/dist/commands/tools/index.spec.js +0 -70
- package/dist/commands/tools/selector.d.ts +0 -8
- package/dist/commands/tools/selector.js +0 -53
- package/dist/commands/uninstall/index.d.ts +0 -3
- package/dist/commands/uninstall/index.js +0 -107
- package/dist/commands/uninstall/index.spec.d.ts +0 -1
- package/dist/commands/uninstall/index.spec.js +0 -117
- package/dist/commands/uninstall.d.ts +0 -2
- package/dist/commands/uninstall.js +0 -83
- package/dist/components/ChatUI.d.ts +0 -16
- package/dist/components/ChatUI.js +0 -801
- package/dist/components/StatusView.d.ts +0 -10
- package/dist/components/StatusView.js +0 -39
- package/dist/lib/arkApiClient.d.ts +0 -53
- package/dist/lib/arkApiClient.js +0 -102
- package/dist/lib/arkApiProxy.d.ts +0 -9
- package/dist/lib/arkApiProxy.js +0 -22
- package/dist/lib/arkServiceProxy.d.ts +0 -14
- package/dist/lib/arkServiceProxy.js +0 -95
- package/dist/lib/arkStatus.d.ts +0 -10
- package/dist/lib/arkStatus.js +0 -79
- package/dist/lib/arkStatus.spec.d.ts +0 -1
- package/dist/lib/arkStatus.spec.js +0 -49
- package/dist/lib/chatClient.d.ts +0 -33
- package/dist/lib/chatClient.js +0 -99
- package/dist/lib/cluster.spec.d.ts +0 -1
- package/dist/lib/cluster.spec.js +0 -338
- package/dist/lib/commandUtils.d.ts +0 -4
- package/dist/lib/commandUtils.js +0 -18
- package/dist/lib/commandUtils.test.d.ts +0 -1
- package/dist/lib/commandUtils.test.js +0 -44
- package/dist/lib/commands.d.ts +0 -16
- package/dist/lib/commands.js +0 -29
- package/dist/lib/commands.spec.d.ts +0 -1
- package/dist/lib/commands.spec.js +0 -146
- package/dist/lib/config.spec.d.ts +0 -1
- package/dist/lib/config.spec.js +0 -99
- package/dist/lib/config.test.d.ts +0 -1
- package/dist/lib/config.test.js +0 -93
- package/dist/lib/consts.spec.d.ts +0 -1
- package/dist/lib/consts.spec.js +0 -15
- package/dist/lib/dev/tools/analyzer.d.ts +0 -30
- package/dist/lib/dev/tools/analyzer.js +0 -190
- package/dist/lib/dev/tools/discover_tools.py +0 -392
- package/dist/lib/dev/tools/mcp-types.d.ts +0 -28
- package/dist/lib/dev/tools/mcp-types.js +0 -86
- package/dist/lib/dev/tools/types.d.ts +0 -50
- package/dist/lib/dev/tools/types.js +0 -1
- package/dist/lib/errors.spec.d.ts +0 -1
- package/dist/lib/errors.spec.js +0 -221
- package/dist/lib/output.d.ts +0 -36
- package/dist/lib/output.js +0 -89
- package/dist/lib/output.spec.d.ts +0 -1
- package/dist/lib/output.spec.js +0 -123
- package/dist/lib/portUtils.d.ts +0 -8
- package/dist/lib/portUtils.js +0 -39
- package/dist/lib/startup.d.ts +0 -5
- package/dist/lib/startup.js +0 -73
- package/dist/lib/startup.spec.d.ts +0 -1
- package/dist/lib/startup.spec.js +0 -168
- package/dist/types/types.d.ts +0 -40
- package/dist/types/types.js +0 -1
- package/dist/ui/AgentSelector.d.ts +0 -8
- package/dist/ui/AgentSelector.js +0 -53
- package/dist/ui/ModelSelector.d.ts +0 -8
- package/dist/ui/ModelSelector.js +0 -53
- package/dist/ui/TeamSelector.d.ts +0 -8
- package/dist/ui/TeamSelector.js +0 -55
- package/dist/ui/ToolSelector.d.ts +0 -8
- package/dist/ui/ToolSelector.js +0 -53
- package/dist/ui/statusFormatter.spec.d.ts +0 -1
- package/dist/ui/statusFormatter.spec.js +0 -58
package/dist/lib/startup.spec.js
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
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
|
-
// Dynamic imports after mocks
|
|
20
|
-
const { checkCommandExists } = await import('./commands.js');
|
|
21
|
-
const { loadConfig } = await import('./config.js');
|
|
22
|
-
const { startup } = await import('./startup.js');
|
|
23
|
-
// Type the mocks
|
|
24
|
-
const mockCheckCommandExists = checkCommandExists;
|
|
25
|
-
const mockLoadConfig = loadConfig;
|
|
26
|
-
// Mock fetch globally
|
|
27
|
-
globalThis.fetch = jest.fn();
|
|
28
|
-
describe('startup', () => {
|
|
29
|
-
let mockExit;
|
|
30
|
-
let mockConsoleError;
|
|
31
|
-
beforeEach(() => {
|
|
32
|
-
jest.clearAllMocks();
|
|
33
|
-
globalThis.fetch.mockClear();
|
|
34
|
-
mockExit = jest.spyOn(process, 'exit').mockImplementation(() => {
|
|
35
|
-
throw new Error('process.exit');
|
|
36
|
-
});
|
|
37
|
-
mockConsoleError = jest
|
|
38
|
-
.spyOn(console, 'error')
|
|
39
|
-
.mockImplementation(() => { });
|
|
40
|
-
});
|
|
41
|
-
afterEach(() => {
|
|
42
|
-
mockExit.mockRestore();
|
|
43
|
-
mockConsoleError.mockRestore();
|
|
44
|
-
});
|
|
45
|
-
it('returns config when all required commands are installed', async () => {
|
|
46
|
-
const expectedConfig = {
|
|
47
|
-
chat: {
|
|
48
|
-
streaming: true,
|
|
49
|
-
outputFormat: 'text',
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
// Mock all commands as available
|
|
53
|
-
mockCheckCommandExists.mockResolvedValue(true);
|
|
54
|
-
mockLoadConfig.mockReturnValue(expectedConfig);
|
|
55
|
-
const config = await startup();
|
|
56
|
-
expect(config).toEqual(expectedConfig);
|
|
57
|
-
expect(mockCheckCommandExists).toHaveBeenCalledWith('kubectl', [
|
|
58
|
-
'version',
|
|
59
|
-
'--client',
|
|
60
|
-
]);
|
|
61
|
-
expect(mockCheckCommandExists).toHaveBeenCalledWith('helm', [
|
|
62
|
-
'version',
|
|
63
|
-
'--short',
|
|
64
|
-
]);
|
|
65
|
-
expect(mockLoadConfig).toHaveBeenCalledTimes(1);
|
|
66
|
-
expect(mockExit).not.toHaveBeenCalled();
|
|
67
|
-
});
|
|
68
|
-
it('exits with error when kubectl is missing', async () => {
|
|
69
|
-
// Mock kubectl as missing, helm as available
|
|
70
|
-
mockCheckCommandExists
|
|
71
|
-
.mockResolvedValueOnce(false) // kubectl
|
|
72
|
-
.mockResolvedValueOnce(true); // helm
|
|
73
|
-
await expect(startup()).rejects.toThrow('process.exit');
|
|
74
|
-
expect(mockConsoleError).toHaveBeenCalledWith('error: kubectl is required');
|
|
75
|
-
expect(mockConsoleError).toHaveBeenCalledWith(' https://kubernetes.io/docs/tasks/tools/');
|
|
76
|
-
expect(mockExit).toHaveBeenCalledWith(1);
|
|
77
|
-
});
|
|
78
|
-
it('exits with error when helm is missing', async () => {
|
|
79
|
-
// Mock kubectl as available, helm as missing
|
|
80
|
-
mockCheckCommandExists
|
|
81
|
-
.mockResolvedValueOnce(true) // kubectl
|
|
82
|
-
.mockResolvedValueOnce(false); // helm
|
|
83
|
-
await expect(startup()).rejects.toThrow('process.exit');
|
|
84
|
-
expect(mockConsoleError).toHaveBeenCalledWith('error: helm is required');
|
|
85
|
-
expect(mockConsoleError).toHaveBeenCalledWith(' https://helm.sh/docs/intro/install/');
|
|
86
|
-
expect(mockExit).toHaveBeenCalledWith(1);
|
|
87
|
-
});
|
|
88
|
-
it('exits with error when both commands are missing', async () => {
|
|
89
|
-
// Mock both commands as missing
|
|
90
|
-
mockCheckCommandExists.mockResolvedValue(false);
|
|
91
|
-
await expect(startup()).rejects.toThrow('process.exit');
|
|
92
|
-
expect(mockConsoleError).toHaveBeenCalledWith('error: kubectl is required');
|
|
93
|
-
expect(mockConsoleError).toHaveBeenCalledWith(' https://kubernetes.io/docs/tasks/tools/');
|
|
94
|
-
expect(mockConsoleError).toHaveBeenCalledWith('error: helm is required');
|
|
95
|
-
expect(mockConsoleError).toHaveBeenCalledWith(' https://helm.sh/docs/intro/install/');
|
|
96
|
-
expect(mockExit).toHaveBeenCalledWith(1);
|
|
97
|
-
});
|
|
98
|
-
it('checks commands with correct arguments', async () => {
|
|
99
|
-
mockCheckCommandExists.mockResolvedValue(true);
|
|
100
|
-
mockLoadConfig.mockReturnValue({ chat: {} });
|
|
101
|
-
await startup();
|
|
102
|
-
expect(mockCheckCommandExists).toHaveBeenCalledTimes(2);
|
|
103
|
-
expect(mockCheckCommandExists).toHaveBeenNthCalledWith(1, 'kubectl', [
|
|
104
|
-
'version',
|
|
105
|
-
'--client',
|
|
106
|
-
]);
|
|
107
|
-
expect(mockCheckCommandExists).toHaveBeenNthCalledWith(2, 'helm', [
|
|
108
|
-
'version',
|
|
109
|
-
'--short',
|
|
110
|
-
]);
|
|
111
|
-
});
|
|
112
|
-
it('loads config after checking requirements', async () => {
|
|
113
|
-
mockCheckCommandExists.mockResolvedValue(true);
|
|
114
|
-
const expectedConfig = { chat: { streaming: false } };
|
|
115
|
-
mockLoadConfig.mockReturnValue(expectedConfig);
|
|
116
|
-
const config = await startup();
|
|
117
|
-
// Verify order - checkCommandExists should be called before loadConfig
|
|
118
|
-
const checkCallOrder = mockCheckCommandExists.mock.invocationCallOrder[0];
|
|
119
|
-
const loadCallOrder = mockLoadConfig.mock.invocationCallOrder[0];
|
|
120
|
-
expect(checkCallOrder).toBeLessThan(loadCallOrder);
|
|
121
|
-
expect(config).toEqual(expectedConfig);
|
|
122
|
-
});
|
|
123
|
-
describe('version fetching', () => {
|
|
124
|
-
beforeEach(() => {
|
|
125
|
-
// Setup successful requirements check and config
|
|
126
|
-
mockCheckCommandExists.mockResolvedValue(true);
|
|
127
|
-
mockLoadConfig.mockReturnValue({ chat: { streaming: true } });
|
|
128
|
-
});
|
|
129
|
-
it('fetches latest version from GitHub API', async () => {
|
|
130
|
-
globalThis.fetch.mockResolvedValue({
|
|
131
|
-
ok: true,
|
|
132
|
-
json: async () => ({ tag_name: 'v0.1.35' }),
|
|
133
|
-
});
|
|
134
|
-
const config = await startup();
|
|
135
|
-
expect(globalThis.fetch).toHaveBeenCalledWith('https://api.github.com/repos/mckinsey/agents-at-scale-ark/releases/latest');
|
|
136
|
-
// Wait for async fetch to complete
|
|
137
|
-
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
138
|
-
expect(config.latestVersion).toBe('v0.1.35');
|
|
139
|
-
});
|
|
140
|
-
it('handles GitHub API failure gracefully', async () => {
|
|
141
|
-
globalThis.fetch.mockRejectedValue(new Error('Network error'));
|
|
142
|
-
const config = await startup();
|
|
143
|
-
// Wait for async fetch attempt
|
|
144
|
-
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
145
|
-
// Should not have latestVersion set
|
|
146
|
-
expect(config.latestVersion).toBeUndefined();
|
|
147
|
-
});
|
|
148
|
-
it('handles non-OK response from GitHub API', async () => {
|
|
149
|
-
globalThis.fetch.mockResolvedValue({
|
|
150
|
-
ok: false,
|
|
151
|
-
status: 403,
|
|
152
|
-
});
|
|
153
|
-
const config = await startup();
|
|
154
|
-
// Wait for async fetch to complete
|
|
155
|
-
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
156
|
-
// Should not have latestVersion set
|
|
157
|
-
expect(config.latestVersion).toBeUndefined();
|
|
158
|
-
});
|
|
159
|
-
it('continues startup even if version fetch fails', async () => {
|
|
160
|
-
globalThis.fetch.mockRejectedValue(new Error('API Error'));
|
|
161
|
-
const config = await startup();
|
|
162
|
-
// Startup should complete successfully
|
|
163
|
-
expect(config).toBeDefined();
|
|
164
|
-
expect(config.chat).toBeDefined();
|
|
165
|
-
expect(mockExit).not.toHaveBeenCalled();
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
});
|
package/dist/types/types.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/types/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
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 {};
|
package/dist/ui/AgentSelector.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
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 {};
|
package/dist/ui/ModelSelector.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
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 {};
|
package/dist/ui/TeamSelector.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
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 {};
|
package/dist/ui/ToolSelector.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, jest, beforeEach, afterEach } from '@jest/globals';
|
|
2
|
-
import { StatusFormatter } from './statusFormatter.js';
|
|
3
|
-
describe('StatusFormatter', () => {
|
|
4
|
-
let consoleLogSpy;
|
|
5
|
-
beforeEach(() => {
|
|
6
|
-
consoleLogSpy = jest.spyOn(console, 'log').mockImplementation(() => { });
|
|
7
|
-
});
|
|
8
|
-
afterEach(() => {
|
|
9
|
-
jest.restoreAllMocks();
|
|
10
|
-
});
|
|
11
|
-
it('prints sections', () => {
|
|
12
|
-
const sections = [
|
|
13
|
-
{
|
|
14
|
-
title: 'Test Section',
|
|
15
|
-
lines: [{ icon: '✓', status: 'ok', name: 'test' }],
|
|
16
|
-
},
|
|
17
|
-
];
|
|
18
|
-
StatusFormatter.printSections(sections);
|
|
19
|
-
expect(consoleLogSpy).toHaveBeenCalled();
|
|
20
|
-
const calls = consoleLogSpy.mock.calls.map((c) => c[0]);
|
|
21
|
-
expect(calls.some((c) => c?.includes('Test Section'))).toBe(true);
|
|
22
|
-
expect(calls.some((c) => c?.includes('✓ ok'))).toBe(true);
|
|
23
|
-
});
|
|
24
|
-
it('prints line with details', () => {
|
|
25
|
-
const sections = [
|
|
26
|
-
{
|
|
27
|
-
title: 'Test',
|
|
28
|
-
lines: [{ icon: '✓', status: 'ok', name: 'test', details: 'v1.0.0' }],
|
|
29
|
-
},
|
|
30
|
-
];
|
|
31
|
-
StatusFormatter.printSections(sections);
|
|
32
|
-
const calls = consoleLogSpy.mock.calls.map((c) => c[0]);
|
|
33
|
-
expect(calls.some((c) => c?.includes('v1.0.0'))).toBe(true);
|
|
34
|
-
});
|
|
35
|
-
it('prints subtext', () => {
|
|
36
|
-
const sections = [
|
|
37
|
-
{
|
|
38
|
-
title: 'Test',
|
|
39
|
-
lines: [
|
|
40
|
-
{ icon: '✗', status: 'error', name: 'test', subtext: 'Try again' },
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
];
|
|
44
|
-
StatusFormatter.printSections(sections);
|
|
45
|
-
const calls = consoleLogSpy.mock.calls.map((c) => c[0]);
|
|
46
|
-
expect(calls.some((c) => c?.includes('Try again'))).toBe(true);
|
|
47
|
-
});
|
|
48
|
-
it('adds spacing between sections', () => {
|
|
49
|
-
const sections = [
|
|
50
|
-
{ title: 'First', lines: [] },
|
|
51
|
-
{ title: 'Second', lines: [] },
|
|
52
|
-
];
|
|
53
|
-
StatusFormatter.printSections(sections);
|
|
54
|
-
const calls = consoleLogSpy.mock.calls;
|
|
55
|
-
// Should have blank lines for spacing
|
|
56
|
-
expect(calls.filter((c) => c.length === 0).length).toBeGreaterThan(0);
|
|
57
|
-
});
|
|
58
|
-
});
|