@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
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
import path, { dirname } from 'path';
|
|
5
|
-
import { fileURLToPath } from 'url';
|
|
6
|
-
import axios from 'axios';
|
|
7
|
-
import { execa } from 'execa';
|
|
8
|
-
import { Text } from 'ink';
|
|
9
|
-
import open from 'open';
|
|
10
|
-
import { useState, useEffect } from 'react';
|
|
11
|
-
import YAML from 'yaml';
|
|
12
|
-
import { DEFAULT_ADDRESS_ARK_API, DEFAULT_ARK_DASHBOARD_URL, } from '../lib/consts.js';
|
|
13
|
-
const DashboardCLI = () => {
|
|
14
|
-
const [currentStep, setCurrentStep] = useState(0);
|
|
15
|
-
const [status, setStatus] = useState('Running');
|
|
16
|
-
const [dotsIndex, setDotsIndex] = useState(0);
|
|
17
|
-
const dotFrames = ['.', '..', '...'];
|
|
18
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
19
|
-
const __dirname = dirname(__filename);
|
|
20
|
-
const rootDir = path.resolve(__dirname, '../../../');
|
|
21
|
-
const steps = [
|
|
22
|
-
{
|
|
23
|
-
label: 'Building backend',
|
|
24
|
-
path: `${rootDir}/ark-api`,
|
|
25
|
-
checkUrl: `${DEFAULT_ADDRESS_ARK_API}/health`,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
label: 'Starting frontend',
|
|
29
|
-
path: `${rootDir}/ark-dashboard`,
|
|
30
|
-
checkUrl: DEFAULT_ARK_DASHBOARD_URL,
|
|
31
|
-
},
|
|
32
|
-
];
|
|
33
|
-
async function isServiceUp(url) {
|
|
34
|
-
try {
|
|
35
|
-
const res = await axios.get(url);
|
|
36
|
-
return res.status >= 200 && res.status < 400;
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
async function runCommands(commands, cwd) {
|
|
43
|
-
for (const cmd of commands) {
|
|
44
|
-
// Run each command in the specified working directory
|
|
45
|
-
await execa(cmd, {
|
|
46
|
-
cwd: cwd,
|
|
47
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
48
|
-
shell: true,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function loadServiceManifest(servicePath) {
|
|
53
|
-
const manifestPath = path.join(servicePath, 'manifest.yaml');
|
|
54
|
-
const raw = fs.readFileSync(manifestPath, 'utf-8');
|
|
55
|
-
return YAML.parse(raw);
|
|
56
|
-
}
|
|
57
|
-
async function runStep(stepIndex) {
|
|
58
|
-
const step = steps[stepIndex];
|
|
59
|
-
const manifest = loadServiceManifest(step.path);
|
|
60
|
-
// 1. Check if service is already up
|
|
61
|
-
const alreadyUp = await isServiceUp(step.checkUrl);
|
|
62
|
-
if (alreadyUp) {
|
|
63
|
-
setCurrentStep((prev) => prev + 1);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
// 2. Install the dependencies
|
|
67
|
-
if (manifest.commands?.install) {
|
|
68
|
-
try {
|
|
69
|
-
await runCommands(manifest.commands.install, step.path);
|
|
70
|
-
}
|
|
71
|
-
catch (err) {
|
|
72
|
-
setStatus('Failed');
|
|
73
|
-
console.error(`Error running install commands for ${step.label}`, err);
|
|
74
|
-
process.exit(1);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
// 3. Start the service
|
|
78
|
-
const startCommand = manifest.commands?.dev;
|
|
79
|
-
if (startCommand) {
|
|
80
|
-
const devCommandStr = Array.isArray(startCommand)
|
|
81
|
-
? startCommand.join(' && ')
|
|
82
|
-
: startCommand;
|
|
83
|
-
const serviceProcess = execa(devCommandStr, {
|
|
84
|
-
cwd: step.path,
|
|
85
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
86
|
-
shell: true,
|
|
87
|
-
});
|
|
88
|
-
// 4. Poll until service is ready
|
|
89
|
-
return new Promise((resolve, reject) => {
|
|
90
|
-
let attempts = 0;
|
|
91
|
-
const maxAttempts = 30;
|
|
92
|
-
const interval = 3000;
|
|
93
|
-
const poll = async () => {
|
|
94
|
-
attempts++;
|
|
95
|
-
if (await isServiceUp(step.checkUrl)) {
|
|
96
|
-
setCurrentStep((prev) => prev + 1);
|
|
97
|
-
resolve();
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
if (attempts >= maxAttempts) {
|
|
101
|
-
reject(new Error(`${step.label} did not start in time.`));
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
setTimeout(poll, interval);
|
|
105
|
-
};
|
|
106
|
-
poll();
|
|
107
|
-
serviceProcess.catch((err) => reject(err));
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
async function startDashboardServices() {
|
|
112
|
-
try {
|
|
113
|
-
for (let i = 0; i < steps.length; i++) {
|
|
114
|
-
await runStep(i);
|
|
115
|
-
}
|
|
116
|
-
setStatus('Done');
|
|
117
|
-
await open(steps[steps.length - 1].checkUrl);
|
|
118
|
-
}
|
|
119
|
-
catch (err) {
|
|
120
|
-
setStatus('Failed');
|
|
121
|
-
console.error('Error:', err);
|
|
122
|
-
process.exit(1);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
useEffect(() => {
|
|
126
|
-
startDashboardServices();
|
|
127
|
-
}, []);
|
|
128
|
-
useEffect(() => {
|
|
129
|
-
if (status !== 'Running') {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
const interval = setInterval(() => {
|
|
133
|
-
setDotsIndex((prev) => (prev + 1) % dotFrames.length);
|
|
134
|
-
}, 300);
|
|
135
|
-
return () => clearInterval(interval);
|
|
136
|
-
}, [status]);
|
|
137
|
-
return (_jsxs(_Fragment, { children: [_jsx(Text, { color: "yellow", children: "\u23F3 Starting Dashboard" }), steps.map((step, i) => {
|
|
138
|
-
if (i < currentStep) {
|
|
139
|
-
return (_jsxs(Text, { color: "green", children: ["\u2705 Step ", i + 1, ": ", step.label] }, i));
|
|
140
|
-
}
|
|
141
|
-
else if (i === currentStep && status === 'Running') {
|
|
142
|
-
return (_jsxs(Text, { children: ["Step ", i + 1, ": ", step.label, dotFrames[dotsIndex]] }, i));
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
return null;
|
|
146
|
-
}
|
|
147
|
-
}), status === 'Done' && (_jsx(Text, { color: "green", children: "\uD83C\uDF89 Dashboard is up and running!" })), status === 'Failed' && (_jsx(Text, { color: "red", children: "\u274C Failed to start Dashboard" }))] }));
|
|
148
|
-
};
|
|
149
|
-
export default DashboardCLI;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { StatusData } from '../lib/types.js';
|
|
3
|
-
interface StatusViewProps {
|
|
4
|
-
statusData: StatusData | null;
|
|
5
|
-
isLoading: boolean;
|
|
6
|
-
error: string | null;
|
|
7
|
-
onBack: () => void;
|
|
8
|
-
}
|
|
9
|
-
declare const StatusView: React.FC<StatusViewProps>;
|
|
10
|
-
export default StatusView;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Text, useInput } from 'ink';
|
|
3
|
-
const StatusView = ({ statusData, isLoading, error, onBack, }) => {
|
|
4
|
-
useInput((input, key) => {
|
|
5
|
-
if (key.escape || input === 'q' || key.return) {
|
|
6
|
-
onBack();
|
|
7
|
-
}
|
|
8
|
-
});
|
|
9
|
-
const renderServiceStatus = (service) => {
|
|
10
|
-
const statusColor = service.status === 'healthy'
|
|
11
|
-
? 'green'
|
|
12
|
-
: service.status === 'unhealthy'
|
|
13
|
-
? 'red'
|
|
14
|
-
: 'yellow';
|
|
15
|
-
const statusIcon = service.status === 'healthy'
|
|
16
|
-
? '✓'
|
|
17
|
-
: service.status === 'unhealthy'
|
|
18
|
-
? '✗'
|
|
19
|
-
: '?';
|
|
20
|
-
return (_jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [_jsxs(Box, { children: [_jsxs(Text, { color: statusColor, children: [statusIcon, " "] }), _jsxs(Text, { bold: true, children: [service.name, ": "] }), _jsx(Text, { color: statusColor, children: service.status })] }), service.url && (_jsx(Box, { marginLeft: 2, children: _jsxs(Text, { color: "gray", children: ["URL: ", service.url] }) })), service.details && (_jsx(Box, { marginLeft: 2, children: _jsx(Text, { color: "gray", children: service.details }) }))] }, service.name));
|
|
21
|
-
};
|
|
22
|
-
const renderDependencyStatus = (dep) => {
|
|
23
|
-
const statusColor = dep.installed ? 'green' : 'red';
|
|
24
|
-
const statusIcon = dep.installed ? '✓' : '✗';
|
|
25
|
-
const statusText = dep.installed ? 'installed' : 'missing';
|
|
26
|
-
return (_jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [_jsxs(Box, { children: [_jsxs(Text, { color: statusColor, children: [statusIcon, " "] }), _jsxs(Text, { bold: true, children: [dep.name, ": "] }), _jsx(Text, { color: statusColor, children: statusText })] }), dep.version && (_jsx(Box, { marginLeft: 2, children: _jsxs(Text, { color: "gray", children: ["Version: ", dep.version] }) })), dep.details && (_jsx(Box, { marginLeft: 2, children: _jsx(Text, { color: "gray", children: dep.details }) }))] }, dep.name));
|
|
27
|
-
};
|
|
28
|
-
if (isLoading) {
|
|
29
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "yellow", children: "\uD83D\uDD0D Checking ARK system status..." }), _jsx(Text, { color: "gray", children: "Please wait while we verify services and dependencies." })] }));
|
|
30
|
-
}
|
|
31
|
-
if (error) {
|
|
32
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "red", children: "\u274C Error checking status:" }), _jsx(Text, { color: "red", children: error }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "gray", children: "Press ESC, 'q', or Enter to return to menu..." }) })] }));
|
|
33
|
-
}
|
|
34
|
-
if (!statusData) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "cyan", bold: true, children: "\uD83D\uDD0D ARK System Status" }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "cyan", bold: true, children: "\uD83D\uDCE1 ARK Services:" }) }), statusData.services.map(renderServiceStatus), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "cyan", bold: true, children: "\uD83D\uDEE0\uFE0F System Dependencies:" }) }), statusData.dependencies.map(renderDependencyStatus), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "gray", children: "Press ESC, 'q', or Enter to return to menu..." }) })] }));
|
|
38
|
-
};
|
|
39
|
-
export default StatusView;
|
package/dist/config.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ConfigManager handles API URL discovery and cluster access testing.
|
|
3
|
-
* Complex discovery logic can be debugged by setting DEBUG=ark:config
|
|
4
|
-
*
|
|
5
|
-
* Example usage:
|
|
6
|
-
* DEBUG=ark:config ark status
|
|
7
|
-
*/
|
|
8
|
-
export declare class ConfigManager {
|
|
9
|
-
private kubernetesManager;
|
|
10
|
-
private kubeConfig;
|
|
11
|
-
constructor();
|
|
12
|
-
getApiBaseUrl(): Promise<string>;
|
|
13
|
-
/**
|
|
14
|
-
* Check if localhost-gateway is running by testing port 8080
|
|
15
|
-
*/
|
|
16
|
-
private isLocalhostGatewayRunning;
|
|
17
|
-
/**
|
|
18
|
-
* Construct standard localhost-gateway URLs for known ARK services
|
|
19
|
-
*/
|
|
20
|
-
private getLocalhostGatewayUrls;
|
|
21
|
-
private initKubernetesConfig;
|
|
22
|
-
testClusterAccess(): Promise<boolean>;
|
|
23
|
-
}
|
package/dist/config.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import Debug from 'debug';
|
|
3
|
-
import { DEFAULT_ADDRESS_ARK_API } from './lib/consts.js';
|
|
4
|
-
import { KubernetesConfigManager } from './lib/kubernetes.js';
|
|
5
|
-
import { getStatusCheckableServices } from './arkServices.js';
|
|
6
|
-
const debug = Debug('ark:config');
|
|
7
|
-
/**
|
|
8
|
-
* ConfigManager handles API URL discovery and cluster access testing.
|
|
9
|
-
* Complex discovery logic can be debugged by setting DEBUG=ark:config
|
|
10
|
-
*
|
|
11
|
-
* Example usage:
|
|
12
|
-
* DEBUG=ark:config ark status
|
|
13
|
-
*/
|
|
14
|
-
export class ConfigManager {
|
|
15
|
-
constructor() {
|
|
16
|
-
this.kubeConfig = null;
|
|
17
|
-
this.kubernetesManager = new KubernetesConfigManager();
|
|
18
|
-
}
|
|
19
|
-
async getApiBaseUrl() {
|
|
20
|
-
// First try to detect localhost-gateway (works for everyone with standard setup)
|
|
21
|
-
if (await this.isLocalhostGatewayRunning()) {
|
|
22
|
-
const gatewayUrls = this.getLocalhostGatewayUrls();
|
|
23
|
-
const arkApiUrl = gatewayUrls['ark-api'];
|
|
24
|
-
if (arkApiUrl) {
|
|
25
|
-
debug('localhost-gateway detected, using: %s', arkApiUrl);
|
|
26
|
-
return arkApiUrl;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
// Try to discover ark-api service via Kubernetes (requires kubeconfig)
|
|
30
|
-
await this.initKubernetesConfig();
|
|
31
|
-
if (this.kubeConfig) {
|
|
32
|
-
try {
|
|
33
|
-
const namespace = 'default';
|
|
34
|
-
const discoveredUrl = await this.kubernetesManager.getArkApiUrl(namespace);
|
|
35
|
-
debug('kubernetes discovery successful in %s: %s', namespace, discoveredUrl);
|
|
36
|
-
return discoveredUrl;
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
debug('kubernetes discovery failed: %s', error instanceof Error ? error.message : error);
|
|
40
|
-
// Fall back to default if discovery fails
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
debug('falling back to default: %s', DEFAULT_ADDRESS_ARK_API);
|
|
44
|
-
return DEFAULT_ADDRESS_ARK_API;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Check if localhost-gateway is running by testing port 8080
|
|
48
|
-
*/
|
|
49
|
-
async isLocalhostGatewayRunning() {
|
|
50
|
-
try {
|
|
51
|
-
// Try to connect to the localhost gateway port
|
|
52
|
-
const response = await axios.get('http://127.0.0.1:8080', {
|
|
53
|
-
timeout: 2000,
|
|
54
|
-
validateStatus: () => true, // Accept any status code, we just want to know if it's reachable
|
|
55
|
-
});
|
|
56
|
-
debug('localhost-gateway check: available (status %d)', response.status);
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
debug('localhost-gateway check: unavailable (%s)', error instanceof Error ? error.message : error);
|
|
61
|
-
// Gateway not responding - fall back to other discovery methods
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Construct standard localhost-gateway URLs for known ARK services
|
|
67
|
-
*/
|
|
68
|
-
getLocalhostGatewayUrls() {
|
|
69
|
-
// Use centralized service definitions from arkServices
|
|
70
|
-
return getStatusCheckableServices();
|
|
71
|
-
}
|
|
72
|
-
async initKubernetesConfig() {
|
|
73
|
-
if (!this.kubeConfig) {
|
|
74
|
-
try {
|
|
75
|
-
this.kubeConfig = await this.kubernetesManager.initializeConfig();
|
|
76
|
-
debug('kubernetes config loaded: context=%s namespace=%s', this.kubeConfig?.currentContext, this.kubeConfig?.namespace);
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
debug('kubernetes config unavailable: %s', error instanceof Error ? error.message : error);
|
|
80
|
-
// Kubernetes config not available - that's okay for some use cases
|
|
81
|
-
this.kubeConfig = null;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
async testClusterAccess() {
|
|
86
|
-
await this.initKubernetesConfig();
|
|
87
|
-
if (!this.kubeConfig) {
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
return await this.kubernetesManager.testClusterAccess();
|
|
91
|
-
}
|
|
92
|
-
}
|
package/dist/lib/arkClient.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export interface ArkService {
|
|
2
|
-
name: string;
|
|
3
|
-
namespace: string;
|
|
4
|
-
release_name: string;
|
|
5
|
-
chart_name: string;
|
|
6
|
-
chart_version: string;
|
|
7
|
-
description?: string;
|
|
8
|
-
routes?: HTTPRouteInfo[];
|
|
9
|
-
httproutes?: HTTPRouteInfo[];
|
|
10
|
-
}
|
|
11
|
-
export interface HTTPRouteInfo {
|
|
12
|
-
name: string;
|
|
13
|
-
namespace: string;
|
|
14
|
-
url: string;
|
|
15
|
-
rules: number;
|
|
16
|
-
}
|
|
17
|
-
export interface ArkServiceListResponse {
|
|
18
|
-
items: ArkService[];
|
|
19
|
-
}
|
|
20
|
-
export declare class ArkClient {
|
|
21
|
-
private client;
|
|
22
|
-
constructor(baseURL: string);
|
|
23
|
-
getBaseURL(): string;
|
|
24
|
-
/**
|
|
25
|
-
* Get ARK services and their discovered URLs from gateway routes
|
|
26
|
-
*/
|
|
27
|
-
getArkServices(namespace?: string): Promise<ArkService[]>;
|
|
28
|
-
/**
|
|
29
|
-
* Test if the API is reachable
|
|
30
|
-
*/
|
|
31
|
-
testConnection(): Promise<boolean>;
|
|
32
|
-
}
|
package/dist/lib/arkClient.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { DEFAULT_TIMEOUT_MS, DEFAULT_CONNECTION_TEST_TIMEOUT_MS, } from './consts.js';
|
|
3
|
-
export class ArkClient {
|
|
4
|
-
constructor(baseURL) {
|
|
5
|
-
this.client = axios.create({
|
|
6
|
-
baseURL,
|
|
7
|
-
timeout: DEFAULT_TIMEOUT_MS,
|
|
8
|
-
headers: {
|
|
9
|
-
'Content-Type': 'application/json',
|
|
10
|
-
},
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
getBaseURL() {
|
|
14
|
-
return this.client.defaults.baseURL || '';
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Get ARK services and their discovered URLs from gateway routes
|
|
18
|
-
*/
|
|
19
|
-
async getArkServices(namespace = 'default') {
|
|
20
|
-
try {
|
|
21
|
-
const response = await this.client.get(`/v1/namespaces/${namespace}/ark-services`);
|
|
22
|
-
return response.data.items;
|
|
23
|
-
}
|
|
24
|
-
catch (_error) {
|
|
25
|
-
// If service discovery fails, return empty array to fall back to defaults
|
|
26
|
-
return [];
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Test if the API is reachable
|
|
31
|
-
*/
|
|
32
|
-
async testConnection() {
|
|
33
|
-
try {
|
|
34
|
-
await this.client.get('/health', {
|
|
35
|
-
timeout: DEFAULT_CONNECTION_TEST_TIMEOUT_MS,
|
|
36
|
-
});
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
package/dist/lib/commandUtils.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { execa } from 'execa';
|
|
2
|
-
/**
|
|
3
|
-
* Check if a command is available in the system
|
|
4
|
-
*/
|
|
5
|
-
export async function isCommandAvailable(command) {
|
|
6
|
-
try {
|
|
7
|
-
if (process.platform === 'win32') {
|
|
8
|
-
await execa('where', [command]);
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
await execa('sh', ['-c', `command -v ${command}`]);
|
|
12
|
-
}
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
catch (_error) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { exec } from 'child_process';
|
|
2
|
-
import { isCommandAvailable } from './commandUtils';
|
|
3
|
-
jest.mock('child_process');
|
|
4
|
-
describe('commandUtils', () => {
|
|
5
|
-
describe('isCommandAvailable', () => {
|
|
6
|
-
const mockedExec = exec;
|
|
7
|
-
beforeEach(() => {
|
|
8
|
-
jest.clearAllMocks();
|
|
9
|
-
});
|
|
10
|
-
it('should return true when command exists on unix', async () => {
|
|
11
|
-
const originalPlatform = Object.getOwnPropertyDescriptor(process, 'platform');
|
|
12
|
-
Object.defineProperty(process, 'platform', { value: 'darwin' });
|
|
13
|
-
mockedExec.mockImplementation((cmd, callback) => {
|
|
14
|
-
callback(null, '/usr/local/bin/helm', '');
|
|
15
|
-
});
|
|
16
|
-
const result = await isCommandAvailable('helm');
|
|
17
|
-
expect(result).toBe(true);
|
|
18
|
-
expect(mockedExec).toHaveBeenCalledWith('command -v helm', expect.any(Function));
|
|
19
|
-
if (originalPlatform) {
|
|
20
|
-
Object.defineProperty(process, 'platform', originalPlatform);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
it('should return true when command exists on windows', async () => {
|
|
24
|
-
const originalPlatform = Object.getOwnPropertyDescriptor(process, 'platform');
|
|
25
|
-
Object.defineProperty(process, 'platform', { value: 'win32' });
|
|
26
|
-
mockedExec.mockImplementation((cmd, callback) => {
|
|
27
|
-
callback(null, 'C:\\Program Files\\helm\\helm.exe', '');
|
|
28
|
-
});
|
|
29
|
-
const result = await isCommandAvailable('helm');
|
|
30
|
-
expect(result).toBe(true);
|
|
31
|
-
expect(mockedExec).toHaveBeenCalledWith('where helm', expect.any(Function));
|
|
32
|
-
if (originalPlatform) {
|
|
33
|
-
Object.defineProperty(process, 'platform', originalPlatform);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
it('should return false when command does not exist', async () => {
|
|
37
|
-
mockedExec.mockImplementation((cmd, callback) => {
|
|
38
|
-
callback(new Error('command not found'), null, 'command not found');
|
|
39
|
-
});
|
|
40
|
-
const result = await isCommandAvailable('nonexistent');
|
|
41
|
-
expect(result).toBe(false);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/lib/config.test.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach, afterEach } from '@jest/globals';
|
|
2
|
-
import { loadConfig } from './config.js';
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import os from 'os';
|
|
6
|
-
describe('Config', () => {
|
|
7
|
-
const originalEnv = process.env;
|
|
8
|
-
const testProjectConfig = path.join(process.cwd(), '.arkrc.yaml');
|
|
9
|
-
const testUserConfig = path.join(os.homedir(), '.arkrc.yaml');
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
// Reset environment
|
|
12
|
-
process.env = { ...originalEnv };
|
|
13
|
-
// Clean up any existing test configs
|
|
14
|
-
if (fs.existsSync(testProjectConfig)) {
|
|
15
|
-
fs.unlinkSync(testProjectConfig);
|
|
16
|
-
}
|
|
17
|
-
if (fs.existsSync(testUserConfig)) {
|
|
18
|
-
fs.unlinkSync(testUserConfig);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
afterEach(() => {
|
|
22
|
-
// Restore environment
|
|
23
|
-
process.env = originalEnv;
|
|
24
|
-
// Clean up test configs
|
|
25
|
-
if (fs.existsSync(testProjectConfig)) {
|
|
26
|
-
fs.unlinkSync(testProjectConfig);
|
|
27
|
-
}
|
|
28
|
-
if (fs.existsSync(testUserConfig)) {
|
|
29
|
-
fs.unlinkSync(testUserConfig);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
it('should load default config when no files or env vars exist', () => {
|
|
33
|
-
const config = loadConfig();
|
|
34
|
-
expect(config.chat?.streaming).toBe(true);
|
|
35
|
-
expect(config.chat?.outputFormat).toBe('text');
|
|
36
|
-
});
|
|
37
|
-
it('should override defaults with environment variables', () => {
|
|
38
|
-
process.env.ARK_CHAT_STREAMING = '0';
|
|
39
|
-
process.env.ARK_CHAT_OUTPUT_FORMAT = 'markdown';
|
|
40
|
-
const config = loadConfig();
|
|
41
|
-
expect(config.chat?.streaming).toBe(false);
|
|
42
|
-
expect(config.chat?.outputFormat).toBe('markdown');
|
|
43
|
-
});
|
|
44
|
-
it('should accept "1" and "true" for streaming', () => {
|
|
45
|
-
process.env.ARK_CHAT_STREAMING = '1';
|
|
46
|
-
let config = loadConfig();
|
|
47
|
-
expect(config.chat?.streaming).toBe(true);
|
|
48
|
-
process.env.ARK_CHAT_STREAMING = 'true';
|
|
49
|
-
config = loadConfig();
|
|
50
|
-
expect(config.chat?.streaming).toBe(true);
|
|
51
|
-
});
|
|
52
|
-
it('should load project config file', () => {
|
|
53
|
-
const configContent = `
|
|
54
|
-
chat:
|
|
55
|
-
streaming: false
|
|
56
|
-
outputFormat: markdown
|
|
57
|
-
`;
|
|
58
|
-
fs.writeFileSync(testProjectConfig, configContent);
|
|
59
|
-
const config = loadConfig();
|
|
60
|
-
expect(config.chat?.streaming).toBe(false);
|
|
61
|
-
expect(config.chat?.outputFormat).toBe('markdown');
|
|
62
|
-
});
|
|
63
|
-
it('should prioritize env vars over config files', () => {
|
|
64
|
-
const configContent = `
|
|
65
|
-
chat:
|
|
66
|
-
streaming: false
|
|
67
|
-
outputFormat: markdown
|
|
68
|
-
`;
|
|
69
|
-
fs.writeFileSync(testProjectConfig, configContent);
|
|
70
|
-
process.env.ARK_CHAT_STREAMING = '1';
|
|
71
|
-
process.env.ARK_CHAT_OUTPUT_FORMAT = 'text';
|
|
72
|
-
const config = loadConfig();
|
|
73
|
-
expect(config.chat?.streaming).toBe(true);
|
|
74
|
-
expect(config.chat?.outputFormat).toBe('text');
|
|
75
|
-
});
|
|
76
|
-
it('should handle invalid config files gracefully', () => {
|
|
77
|
-
fs.writeFileSync(testProjectConfig, 'invalid: yaml: content: {{{');
|
|
78
|
-
// Should fall back to defaults without throwing
|
|
79
|
-
const config = loadConfig();
|
|
80
|
-
expect(config.chat?.streaming).toBe(true);
|
|
81
|
-
expect(config.chat?.outputFormat).toBe('text');
|
|
82
|
-
});
|
|
83
|
-
it('should handle partial configs', () => {
|
|
84
|
-
const configContent = `
|
|
85
|
-
chat:
|
|
86
|
-
streaming: false
|
|
87
|
-
`;
|
|
88
|
-
fs.writeFileSync(testProjectConfig, configContent);
|
|
89
|
-
const config = loadConfig();
|
|
90
|
-
expect(config.chat?.streaming).toBe(false);
|
|
91
|
-
expect(config.chat?.outputFormat).toBe('text'); // Should use default
|
|
92
|
-
});
|
|
93
|
-
});
|
package/dist/lib/consts.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const DEFAULT_ADDRESS_ARK_API = "http://localhost:8000";
|
|
2
|
-
export declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
3
|
-
export declare const DEFAULT_CONNECTION_TEST_TIMEOUT_MS = 5000;
|
|
4
|
-
export declare const CONFIG_DIR_NAME = "ark";
|
|
5
|
-
export declare const CONFIG_FILE_NAME = "ark-cli.json";
|
|
6
|
-
export declare const DEFAULT_ARK_DASHBOARD_URL = "http://localhost:3000";
|
|
7
|
-
export declare const DEFAULT_ARK_A2A_URL = "http://localhost:8080";
|
|
8
|
-
export declare const DEFAULT_ARK_MEMORY_URL = "http://localhost:8081";
|
|
9
|
-
export declare const DEFAULT_ARK_OTEL_URL = "http://localhost:4318";
|
package/dist/lib/consts.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Default ARK API server address
|
|
2
|
-
export const DEFAULT_ADDRESS_ARK_API = 'http://localhost:8000';
|
|
3
|
-
// Default timeout values
|
|
4
|
-
export const DEFAULT_TIMEOUT_MS = 30000;
|
|
5
|
-
export const DEFAULT_CONNECTION_TEST_TIMEOUT_MS = 5000;
|
|
6
|
-
// Configuration paths
|
|
7
|
-
export const CONFIG_DIR_NAME = 'ark';
|
|
8
|
-
export const CONFIG_FILE_NAME = 'ark-cli.json';
|
|
9
|
-
// Default service URLs
|
|
10
|
-
export const DEFAULT_ARK_DASHBOARD_URL = 'http://localhost:3000';
|
|
11
|
-
export const DEFAULT_ARK_A2A_URL = 'http://localhost:8080';
|
|
12
|
-
export const DEFAULT_ARK_MEMORY_URL = 'http://localhost:8081';
|
|
13
|
-
export const DEFAULT_ARK_OTEL_URL = 'http://localhost:4318';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/lib/consts.spec.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from '@jest/globals';
|
|
2
|
-
import { DEFAULT_ADDRESS_ARK_API, DEFAULT_TIMEOUT_MS, DEFAULT_CONNECTION_TEST_TIMEOUT_MS, CONFIG_DIR_NAME, CONFIG_FILE_NAME, DEFAULT_ARK_DASHBOARD_URL, DEFAULT_ARK_A2A_URL, DEFAULT_ARK_MEMORY_URL, DEFAULT_ARK_OTEL_URL, } from './consts.js';
|
|
3
|
-
describe('Constants', () => {
|
|
4
|
-
it('defines correct default values', () => {
|
|
5
|
-
expect(DEFAULT_ADDRESS_ARK_API).toBe('http://localhost:8000');
|
|
6
|
-
expect(DEFAULT_TIMEOUT_MS).toBe(30000);
|
|
7
|
-
expect(DEFAULT_CONNECTION_TEST_TIMEOUT_MS).toBe(5000);
|
|
8
|
-
expect(CONFIG_DIR_NAME).toBe('ark');
|
|
9
|
-
expect(CONFIG_FILE_NAME).toBe('ark-cli.json');
|
|
10
|
-
expect(DEFAULT_ARK_DASHBOARD_URL).toBe('http://localhost:3000');
|
|
11
|
-
expect(DEFAULT_ARK_A2A_URL).toBe('http://localhost:8080');
|
|
12
|
-
expect(DEFAULT_ARK_MEMORY_URL).toBe('http://localhost:8081');
|
|
13
|
-
expect(DEFAULT_ARK_OTEL_URL).toBe('http://localhost:4318');
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ArkDevToolStatus, DiscoveryResult, ProjectDiscoveryResult } from './types.js';
|
|
2
|
-
export declare class ArkDevToolAnalyzer {
|
|
3
|
-
private discoverToolsScript;
|
|
4
|
-
constructor();
|
|
5
|
-
/**
|
|
6
|
-
* Analyze a tool directory and return its status
|
|
7
|
-
*/
|
|
8
|
-
analyzeToolDirectory(toolPath: string): Promise<ArkDevToolStatus>;
|
|
9
|
-
/**
|
|
10
|
-
* Get project information by checking for Python project files
|
|
11
|
-
*/
|
|
12
|
-
private getProjectInfo;
|
|
13
|
-
/**
|
|
14
|
-
* Discover project configuration
|
|
15
|
-
*/
|
|
16
|
-
discoverProject(targetPath: string): Promise<ProjectDiscoveryResult | undefined>;
|
|
17
|
-
/**
|
|
18
|
-
* Discover tools using the Python script
|
|
19
|
-
*/
|
|
20
|
-
discoverTools(targetPath: string): Promise<DiscoveryResult | undefined>;
|
|
21
|
-
/**
|
|
22
|
-
* Recursively find all MCP tools in a project
|
|
23
|
-
* This is a naive implementation that searches all Python files in the project tree
|
|
24
|
-
*/
|
|
25
|
-
findProjectTools(projectRoot: string): Promise<any>;
|
|
26
|
-
/**
|
|
27
|
-
* Extract all tools from discovery result
|
|
28
|
-
*/
|
|
29
|
-
private extractTools;
|
|
30
|
-
}
|