@agents-at-scale/ark 0.1.36-rc1 → 0.1.37
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/README.md +53 -70
- package/dist/arkServices.d.ts +3 -27
- package/dist/arkServices.js +31 -3
- package/dist/arkServices.spec.js +118 -10
- package/dist/commands/completion/index.js +0 -2
- package/dist/commands/install/index.js +49 -58
- package/dist/commands/models/create.d.ts +9 -1
- package/dist/commands/models/create.js +97 -90
- package/dist/commands/models/create.spec.js +9 -37
- package/dist/commands/models/index.js +8 -2
- package/dist/commands/models/index.spec.js +1 -1
- package/dist/commands/status/index.d.ts +3 -1
- package/dist/commands/status/index.js +54 -2
- package/dist/components/ChatUI.js +19 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/arkApiClient.d.ts +1 -2
- package/dist/lib/arkApiClient.js +5 -6
- package/dist/lib/config.d.ts +4 -0
- package/dist/lib/config.js +9 -0
- package/dist/lib/nextSteps.js +1 -1
- package/dist/lib/nextSteps.spec.js +1 -1
- package/dist/lib/security.js +4 -0
- package/dist/lib/startup.js +6 -2
- package/dist/lib/startup.spec.js +1 -1
- package/dist/lib/timeout.d.ts +1 -0
- package/dist/lib/timeout.js +20 -0
- package/dist/lib/timeout.spec.js +14 -0
- package/dist/lib/waitForReady.d.ts +8 -0
- package/dist/lib/waitForReady.js +32 -0
- package/dist/lib/waitForReady.spec.js +104 -0
- package/dist/types/arkService.d.ts +27 -0
- package/package.json +3 -3
- 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/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.d.ts +0 -2
- package/dist/commands/chat.js +0 -45
- package/dist/commands/cluster/get-ip.d.ts +0 -2
- package/dist/commands/cluster/get-ip.js +0 -32
- package/dist/commands/cluster/get-type.d.ts +0 -2
- package/dist/commands/cluster/get-type.js +0 -26
- package/dist/commands/completion.d.ts +0 -2
- package/dist/commands/completion.js +0 -265
- package/dist/commands/config.d.ts +0 -2
- package/dist/commands/config.js +0 -44
- 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 -258
- 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.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.js +0 -48
- package/dist/commands/install.d.ts +0 -3
- package/dist/commands/install.js +0 -147
- package/dist/commands/models/selector.d.ts +0 -8
- package/dist/commands/models/selector.js +0 -53
- package/dist/commands/routes.d.ts +0 -2
- package/dist/commands/routes.js +0 -101
- package/dist/commands/status.d.ts +0 -3
- package/dist/commands/status.js +0 -33
- package/dist/commands/targets.d.ts +0 -2
- package/dist/commands/targets.js +0 -65
- package/dist/commands/teams/selector.d.ts +0 -8
- package/dist/commands/teams/selector.js +0 -55
- package/dist/commands/tools/selector.d.ts +0 -8
- package/dist/commands/tools/selector.js +0 -53
- package/dist/commands/uninstall.d.ts +0 -2
- package/dist/commands/uninstall.js +0 -83
- package/dist/components/DashboardCLI.d.ts +0 -3
- package/dist/components/DashboardCLI.js +0 -149
- package/dist/components/StatusView.d.ts +0 -10
- package/dist/components/StatusView.js +0 -39
- package/dist/config.d.ts +0 -23
- package/dist/config.js +0 -92
- package/dist/lib/arkClient.d.ts +0 -32
- package/dist/lib/arkClient.js +0 -43
- 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/config.test.d.ts +0 -1
- package/dist/lib/config.test.js +0 -93
- package/dist/lib/consts.d.ts +0 -9
- package/dist/lib/consts.js +0 -13
- 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/exec.d.ts +0 -1
- package/dist/lib/exec.js +0 -9
- package/dist/lib/gatewayManager.d.ts +0 -24
- package/dist/lib/gatewayManager.js +0 -85
- package/dist/lib/kubernetes.d.ts +0 -28
- package/dist/lib/kubernetes.js +0 -122
- package/dist/lib/portUtils.d.ts +0 -8
- package/dist/lib/portUtils.js +0 -39
- package/dist/lib/progress.d.ts +0 -128
- package/dist/lib/progress.js +0 -273
- package/dist/lib/queryRunner.d.ts +0 -22
- package/dist/lib/queryRunner.js +0 -142
- package/dist/lib/wrappers/git.d.ts +0 -2
- package/dist/lib/wrappers/git.js +0 -43
- /package/dist/{charts/types.js → lib/timeout.spec.d.ts} +0 -0
- /package/dist/{commands/dev/tool-generate.spec.d.ts → lib/waitForReady.spec.d.ts} +0 -0
- /package/dist/{commands/dev/tool.spec.d.ts → types/arkService.js} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function parseTimeoutToSeconds(value) {
|
|
2
|
+
const match = value.match(/^(\d+)([smh])?$/);
|
|
3
|
+
if (!match) {
|
|
4
|
+
throw new Error('Invalid timeout format. Use format like 30s, 2m, or 1h');
|
|
5
|
+
}
|
|
6
|
+
const num = parseInt(match[1], 10);
|
|
7
|
+
const unit = match[2];
|
|
8
|
+
if (!unit)
|
|
9
|
+
return num;
|
|
10
|
+
switch (unit) {
|
|
11
|
+
case 's':
|
|
12
|
+
return num;
|
|
13
|
+
case 'm':
|
|
14
|
+
return num * 60;
|
|
15
|
+
case 'h':
|
|
16
|
+
return num * 3600;
|
|
17
|
+
default:
|
|
18
|
+
return num;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { describe, it, expect } from '@jest/globals';
|
|
2
|
+
import { parseTimeoutToSeconds } from './timeout.js';
|
|
3
|
+
describe('parseTimeoutToSeconds', () => {
|
|
4
|
+
it('should parse time units correctly', () => {
|
|
5
|
+
expect(parseTimeoutToSeconds('30s')).toBe(30);
|
|
6
|
+
expect(parseTimeoutToSeconds('2m')).toBe(120);
|
|
7
|
+
expect(parseTimeoutToSeconds('1h')).toBe(3600);
|
|
8
|
+
expect(parseTimeoutToSeconds('60')).toBe(60);
|
|
9
|
+
});
|
|
10
|
+
it('should throw error for invalid formats', () => {
|
|
11
|
+
expect(() => parseTimeoutToSeconds('abc')).toThrow('Invalid timeout format');
|
|
12
|
+
expect(() => parseTimeoutToSeconds('-5s')).toThrow('Invalid timeout format');
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ArkService } from '../types/arkService.js';
|
|
2
|
+
export interface WaitProgress {
|
|
3
|
+
serviceName: string;
|
|
4
|
+
ready: boolean;
|
|
5
|
+
error?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function waitForDeploymentReady(deploymentName: string, namespace: string, timeoutSeconds: number): Promise<boolean>;
|
|
8
|
+
export declare function waitForServicesReady(services: ArkService[], timeoutSeconds: number, onProgress?: (progress: WaitProgress) => void): Promise<boolean>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { execa } from 'execa';
|
|
2
|
+
export async function waitForDeploymentReady(deploymentName, namespace, timeoutSeconds) {
|
|
3
|
+
try {
|
|
4
|
+
await execa('kubectl', [
|
|
5
|
+
'wait',
|
|
6
|
+
'--for=condition=available',
|
|
7
|
+
`deployment/${deploymentName}`,
|
|
8
|
+
'-n',
|
|
9
|
+
namespace,
|
|
10
|
+
`--timeout=${timeoutSeconds}s`,
|
|
11
|
+
], { timeout: timeoutSeconds * 1000 });
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export async function waitForServicesReady(services, timeoutSeconds, onProgress) {
|
|
19
|
+
const validServices = services.filter((s) => s.k8sDeploymentName && s.namespace);
|
|
20
|
+
const checkPromises = validServices.map(async (service) => {
|
|
21
|
+
const isReady = await waitForDeploymentReady(service.k8sDeploymentName, service.namespace, timeoutSeconds);
|
|
22
|
+
if (onProgress) {
|
|
23
|
+
onProgress({
|
|
24
|
+
serviceName: service.name,
|
|
25
|
+
ready: isReady,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return isReady;
|
|
29
|
+
});
|
|
30
|
+
const results = await Promise.all(checkPromises);
|
|
31
|
+
return results.every((ready) => ready);
|
|
32
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { describe, it, expect, jest, beforeEach } from '@jest/globals';
|
|
2
|
+
jest.unstable_mockModule('execa', () => ({
|
|
3
|
+
execa: jest.fn(),
|
|
4
|
+
}));
|
|
5
|
+
const { execa } = await import('execa');
|
|
6
|
+
const { waitForDeploymentReady, waitForServicesReady } = await import('./waitForReady.js');
|
|
7
|
+
const mockedExeca = execa;
|
|
8
|
+
describe('waitForDeploymentReady', () => {
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
jest.clearAllMocks();
|
|
11
|
+
});
|
|
12
|
+
it('returns true when deployment is ready', async () => {
|
|
13
|
+
mockedExeca.mockResolvedValueOnce({
|
|
14
|
+
stdout: 'deployment.apps/ark-controller condition met',
|
|
15
|
+
stderr: '',
|
|
16
|
+
exitCode: 0,
|
|
17
|
+
});
|
|
18
|
+
const result = await waitForDeploymentReady('ark-controller', 'ark-system', 30);
|
|
19
|
+
expect(result).toBe(true);
|
|
20
|
+
expect(mockedExeca).toHaveBeenCalledWith('kubectl', [
|
|
21
|
+
'wait',
|
|
22
|
+
'--for=condition=available',
|
|
23
|
+
'deployment/ark-controller',
|
|
24
|
+
'-n',
|
|
25
|
+
'ark-system',
|
|
26
|
+
'--timeout=30s',
|
|
27
|
+
], { timeout: 30000 });
|
|
28
|
+
});
|
|
29
|
+
it('returns false on error', async () => {
|
|
30
|
+
mockedExeca.mockRejectedValueOnce(new Error('kubectl error'));
|
|
31
|
+
const result = await waitForDeploymentReady('ark-api', 'default', 10);
|
|
32
|
+
expect(result).toBe(false);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
describe('waitForServicesReady', () => {
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
jest.clearAllMocks();
|
|
38
|
+
});
|
|
39
|
+
const service1 = {
|
|
40
|
+
name: 'ark-controller',
|
|
41
|
+
helmReleaseName: 'ark-controller',
|
|
42
|
+
description: 'Core controller',
|
|
43
|
+
enabled: true,
|
|
44
|
+
category: 'core',
|
|
45
|
+
namespace: 'ark-system',
|
|
46
|
+
k8sDeploymentName: 'ark-controller',
|
|
47
|
+
};
|
|
48
|
+
const service2 = {
|
|
49
|
+
name: 'ark-api',
|
|
50
|
+
helmReleaseName: 'ark-api',
|
|
51
|
+
description: 'API service',
|
|
52
|
+
enabled: true,
|
|
53
|
+
category: 'service',
|
|
54
|
+
namespace: 'default',
|
|
55
|
+
k8sDeploymentName: 'ark-api',
|
|
56
|
+
};
|
|
57
|
+
it('returns true when all services are ready', async () => {
|
|
58
|
+
mockedExeca.mockResolvedValue({
|
|
59
|
+
stdout: 'condition met',
|
|
60
|
+
stderr: '',
|
|
61
|
+
exitCode: 0,
|
|
62
|
+
});
|
|
63
|
+
const result = await waitForServicesReady([service1, service2], 30);
|
|
64
|
+
expect(result).toBe(true);
|
|
65
|
+
expect(mockedExeca).toHaveBeenCalledTimes(2);
|
|
66
|
+
});
|
|
67
|
+
it('returns false when any service fails', async () => {
|
|
68
|
+
mockedExeca
|
|
69
|
+
.mockResolvedValueOnce({ stdout: 'ok', stderr: '', exitCode: 0 })
|
|
70
|
+
.mockRejectedValueOnce(new Error('timeout'));
|
|
71
|
+
const result = await waitForServicesReady([service1, service2], 30);
|
|
72
|
+
expect(result).toBe(false);
|
|
73
|
+
});
|
|
74
|
+
it('calls progress callback', async () => {
|
|
75
|
+
mockedExeca.mockResolvedValue({
|
|
76
|
+
stdout: 'ok',
|
|
77
|
+
stderr: '',
|
|
78
|
+
exitCode: 0,
|
|
79
|
+
});
|
|
80
|
+
const onProgress = jest.fn();
|
|
81
|
+
await waitForServicesReady([service1], 30, onProgress);
|
|
82
|
+
expect(onProgress).toHaveBeenCalledWith({
|
|
83
|
+
serviceName: 'ark-controller',
|
|
84
|
+
ready: true,
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
it('skips services without deployment info', async () => {
|
|
88
|
+
const incompleteService = {
|
|
89
|
+
name: 'incomplete',
|
|
90
|
+
helmReleaseName: 'incomplete',
|
|
91
|
+
description: 'No deployment info',
|
|
92
|
+
enabled: true,
|
|
93
|
+
category: 'service',
|
|
94
|
+
};
|
|
95
|
+
mockedExeca.mockResolvedValue({
|
|
96
|
+
stdout: 'ok',
|
|
97
|
+
stderr: '',
|
|
98
|
+
exitCode: 0,
|
|
99
|
+
});
|
|
100
|
+
const result = await waitForServicesReady([service1, incompleteService], 30);
|
|
101
|
+
expect(result).toBe(true);
|
|
102
|
+
expect(mockedExeca).toHaveBeenCalledTimes(1);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface ArkService {
|
|
2
|
+
name: string;
|
|
3
|
+
helmReleaseName: string;
|
|
4
|
+
description: string;
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
category: string;
|
|
7
|
+
namespace?: string;
|
|
8
|
+
chartPath?: string;
|
|
9
|
+
installArgs?: string[];
|
|
10
|
+
k8sServiceName?: string;
|
|
11
|
+
k8sServicePort?: number;
|
|
12
|
+
k8sPortForwardLocalPort?: number;
|
|
13
|
+
k8sDeploymentName?: string;
|
|
14
|
+
k8sDevDeploymentName?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ServiceCollection {
|
|
17
|
+
[key: string]: ArkService;
|
|
18
|
+
}
|
|
19
|
+
export interface ArkDependency {
|
|
20
|
+
name: string;
|
|
21
|
+
command: string;
|
|
22
|
+
args: string[];
|
|
23
|
+
description: string;
|
|
24
|
+
}
|
|
25
|
+
export interface DependencyCollection {
|
|
26
|
+
[key: string]: ArkDependency;
|
|
27
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agents-at-scale/ark",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.37",
|
|
4
|
+
"description": "Ark CLI - Interactive terminal interface for ARK agents",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"lint": "eslint src/ --fix && prettier --write src/",
|
|
19
19
|
"lint:check": "eslint src/ && prettier --check src/",
|
|
20
20
|
"test": "NODE_OPTIONS=\"--experimental-vm-modules\" jest --coverage --coverageDirectory=./artifacts/coverage --coverageReporters=text --coverageReporters=lcov --coverageReporters=text-summary",
|
|
21
|
-
"postinstall": "echo \"
|
|
21
|
+
"postinstall": "echo \"Ark CLI installed. Run 'ark' to try it out.\""
|
|
22
22
|
},
|
|
23
23
|
"keywords": [
|
|
24
24
|
"ark",
|
package/dist/charts/charts.d.ts
DELETED
package/dist/charts/charts.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { getInstallableServices } from '../arkServices.js';
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated Use arkServices.ts instead. This file is kept for backward compatibility.
|
|
4
|
-
* Charts are now defined in arkServices.ts with comprehensive service definitions.
|
|
5
|
-
*/
|
|
6
|
-
export const charts = getInstallableServices();
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dependencies that should be installed before ARK charts
|
|
3
|
-
* Note: Dependencies will be installed in the order they are defined here
|
|
4
|
-
*/
|
|
5
|
-
export const dependencies = {
|
|
6
|
-
'cert-manager-repo': {
|
|
7
|
-
name: 'cert-manager-repo',
|
|
8
|
-
command: 'helm',
|
|
9
|
-
args: [
|
|
10
|
-
'repo',
|
|
11
|
-
'add',
|
|
12
|
-
'jetstack',
|
|
13
|
-
'https://charts.jetstack.io',
|
|
14
|
-
'--force-update',
|
|
15
|
-
],
|
|
16
|
-
description: 'Add Jetstack Helm repository',
|
|
17
|
-
},
|
|
18
|
-
'helm-repo-update': {
|
|
19
|
-
name: 'helm-repo-update',
|
|
20
|
-
command: 'helm',
|
|
21
|
-
args: ['repo', 'update'],
|
|
22
|
-
description: 'Update Helm repositories',
|
|
23
|
-
},
|
|
24
|
-
'cert-manager': {
|
|
25
|
-
name: 'cert-manager',
|
|
26
|
-
command: 'helm',
|
|
27
|
-
args: [
|
|
28
|
-
'upgrade',
|
|
29
|
-
'--install',
|
|
30
|
-
'cert-manager',
|
|
31
|
-
'jetstack/cert-manager',
|
|
32
|
-
'--namespace',
|
|
33
|
-
'cert-manager',
|
|
34
|
-
'--create-namespace',
|
|
35
|
-
'--set',
|
|
36
|
-
'crds.enabled=true',
|
|
37
|
-
],
|
|
38
|
-
description: 'Certificate management for Kubernetes',
|
|
39
|
-
},
|
|
40
|
-
'gateway-api-crds': {
|
|
41
|
-
name: 'gateway-api-crds',
|
|
42
|
-
command: 'kubectl',
|
|
43
|
-
args: [
|
|
44
|
-
'apply',
|
|
45
|
-
'-f',
|
|
46
|
-
'https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.3.0/standard-install.yaml',
|
|
47
|
-
],
|
|
48
|
-
description: 'Gateway API CRDs',
|
|
49
|
-
},
|
|
50
|
-
};
|
package/dist/charts/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
|
-
}
|
|
@@ -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 {};
|
|
@@ -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
|
-
}
|
package/dist/commands/agents.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { ArkApiProxy } from '../lib/arkApiProxy.js';
|
|
3
|
-
import output from '../lib/output.js';
|
|
4
|
-
async function listAgents(options) {
|
|
5
|
-
let proxy;
|
|
6
|
-
try {
|
|
7
|
-
proxy = new ArkApiProxy();
|
|
8
|
-
const arkApiClient = await proxy.start();
|
|
9
|
-
const agents = await arkApiClient.getAgents();
|
|
10
|
-
if (options.output === 'json') {
|
|
11
|
-
console.log(JSON.stringify(agents, null, 2));
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
if (agents.length === 0) {
|
|
15
|
-
output.warning('no agents available');
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
// Simple list output - just agent names with namespace prefix
|
|
19
|
-
agents.forEach(agent => {
|
|
20
|
-
console.log(`agent/${agent.name}`);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
output.error('fetching agents:', error instanceof Error ? error.message : error);
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
finally {
|
|
29
|
-
if (proxy) {
|
|
30
|
-
proxy.stop();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
export function createAgentsCommand() {
|
|
35
|
-
const agentsCommand = new Command('agents');
|
|
36
|
-
agentsCommand
|
|
37
|
-
.description('list available agents')
|
|
38
|
-
.alias('agent')
|
|
39
|
-
.option('-o, --output <format>', 'output format (json or text)', 'text')
|
|
40
|
-
.action(async (options) => {
|
|
41
|
-
await listAgents(options);
|
|
42
|
-
});
|
|
43
|
-
// Add list subcommand (same as default action)
|
|
44
|
-
agentsCommand
|
|
45
|
-
.command('list')
|
|
46
|
-
.alias('ls')
|
|
47
|
-
.description('list all available agents')
|
|
48
|
-
.option('-o, --output <format>', 'output format (json or text)', 'text')
|
|
49
|
-
.action(async (options) => {
|
|
50
|
-
await listAgents(options);
|
|
51
|
-
});
|
|
52
|
-
return agentsCommand;
|
|
53
|
-
}
|
package/dist/commands/chat.d.ts
DELETED
package/dist/commands/chat.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
import { render } from 'ink';
|
|
4
|
-
import ChatUI from '../components/ChatUI.js';
|
|
5
|
-
import { ArkApiProxy } from '../lib/arkApiProxy.js';
|
|
6
|
-
import { loadConfig } from '../lib/config.js';
|
|
7
|
-
import output from '../lib/output.js';
|
|
8
|
-
export function createChatCommand() {
|
|
9
|
-
const chatCommand = new Command('chat');
|
|
10
|
-
chatCommand
|
|
11
|
-
.description('Start an interactive chat session with ARK agents or models')
|
|
12
|
-
.argument('[target]', 'Target to connect to (e.g., agent/sample-agent, model/default)')
|
|
13
|
-
.option('-a, --agent <name>', 'Connect directly to a specific agent')
|
|
14
|
-
.option('-m, --model <name>', 'Connect directly to a specific model')
|
|
15
|
-
.action(async (targetArg, options) => {
|
|
16
|
-
// Determine initial target from argument or options
|
|
17
|
-
let initialTargetId;
|
|
18
|
-
if (targetArg) {
|
|
19
|
-
// Direct target argument (e.g., "agent/sample-agent")
|
|
20
|
-
initialTargetId = targetArg;
|
|
21
|
-
}
|
|
22
|
-
else if (options.agent) {
|
|
23
|
-
// Agent option
|
|
24
|
-
initialTargetId = `agent/${options.agent}`;
|
|
25
|
-
}
|
|
26
|
-
else if (options.model) {
|
|
27
|
-
// Model option
|
|
28
|
-
initialTargetId = `model/${options.model}`;
|
|
29
|
-
}
|
|
30
|
-
// Load config
|
|
31
|
-
const config = loadConfig();
|
|
32
|
-
// Initialize proxy first - no spinner, just let ChatUI handle loading state
|
|
33
|
-
try {
|
|
34
|
-
const proxy = new ArkApiProxy();
|
|
35
|
-
const arkApiClient = await proxy.start();
|
|
36
|
-
// Pass the initialized client and config to ChatUI
|
|
37
|
-
render(_jsx(ChatUI, { initialTargetId: initialTargetId, arkApiClient: arkApiClient, arkApiProxy: proxy, config: config }));
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
output.error(error instanceof Error ? error.message : 'ARK API connection failed');
|
|
41
|
-
process.exit(1);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
return chatCommand;
|
|
45
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
import { getClusterIp } from '../../lib/cluster.js';
|
|
4
|
-
export function createGetIpCommand() {
|
|
5
|
-
const getIp = new Command('get-ip');
|
|
6
|
-
getIp
|
|
7
|
-
.description('Get the IP address of the current Kubernetes cluster')
|
|
8
|
-
.option('-c, --context <context>', 'Kubernetes context to use')
|
|
9
|
-
.action(async (options) => {
|
|
10
|
-
try {
|
|
11
|
-
const clusterInfo = await getClusterIp(options.context);
|
|
12
|
-
if (clusterInfo.error) {
|
|
13
|
-
console.error(chalk.red('Error getting cluster IP:'), clusterInfo.error);
|
|
14
|
-
process.exit(1);
|
|
15
|
-
}
|
|
16
|
-
if (!clusterInfo.ip) {
|
|
17
|
-
console.error(chalk.red('Could not determine cluster IP'));
|
|
18
|
-
process.exit(1);
|
|
19
|
-
}
|
|
20
|
-
console.log(clusterInfo.ip);
|
|
21
|
-
console.error(chalk.grey(`Cluster type: ${clusterInfo.type}`));
|
|
22
|
-
if (clusterInfo.context) {
|
|
23
|
-
console.error(chalk.grey(`Context: ${clusterInfo.context}`));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
console.error(chalk.red('Failed to get cluster IP:'), error.message);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
return getIp;
|
|
32
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
import { detectClusterType } from '../../lib/cluster.js';
|
|
4
|
-
export function createGetTypeCommand() {
|
|
5
|
-
const getType = new Command('get-type');
|
|
6
|
-
getType
|
|
7
|
-
.description('Detect and display the current Kubernetes cluster type')
|
|
8
|
-
.action(async () => {
|
|
9
|
-
try {
|
|
10
|
-
const clusterInfo = await detectClusterType();
|
|
11
|
-
if (clusterInfo.error) {
|
|
12
|
-
console.error(chalk.red('Error detecting cluster type:'), clusterInfo.error);
|
|
13
|
-
process.exit(1);
|
|
14
|
-
}
|
|
15
|
-
console.log(clusterInfo.type);
|
|
16
|
-
if (clusterInfo.context) {
|
|
17
|
-
console.error(chalk.grey(`Context: ${clusterInfo.context}`));
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
console.error(chalk.red('Failed to detect cluster type:'), error.message);
|
|
22
|
-
process.exit(1);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
return getType;
|
|
26
|
-
}
|