@agents-at-scale/ark 0.1.36-rc1 → 0.1.36
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/package.json +1 -1
- 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/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.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.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/commands/install.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { execa } from 'execa';
|
|
4
|
-
import inquirer from 'inquirer';
|
|
5
|
-
import { isCommandAvailable } from '../lib/commandUtils.js';
|
|
6
|
-
import { getClusterInfo } from '../lib/cluster.js';
|
|
7
|
-
import output from '../lib/output.js';
|
|
8
|
-
import { getInstallableServices, arkDependencies } from '../arkServices.js';
|
|
9
|
-
import { createModel } from './models/create.js';
|
|
10
|
-
export async function installArk() {
|
|
11
|
-
// Check if helm is installed
|
|
12
|
-
const helmInstalled = await isCommandAvailable('helm');
|
|
13
|
-
if (!helmInstalled) {
|
|
14
|
-
output.error('helm is not installed. please install helm first:');
|
|
15
|
-
output.info('https://helm.sh/docs/intro/install/');
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
18
|
-
// Check if kubectl is installed (needed for some dependencies)
|
|
19
|
-
const kubectlInstalled = await isCommandAvailable('kubectl');
|
|
20
|
-
if (!kubectlInstalled) {
|
|
21
|
-
output.error('kubectl is not installed. please install kubectl first:');
|
|
22
|
-
output.info('https://kubernetes.io/docs/tasks/tools/');
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
// Check cluster connectivity
|
|
26
|
-
const clusterInfo = await getClusterInfo();
|
|
27
|
-
if (clusterInfo.error) {
|
|
28
|
-
output.error('no kubernetes cluster detected');
|
|
29
|
-
output.info('please ensure you have a running cluster and kubectl is configured.');
|
|
30
|
-
output.info('');
|
|
31
|
-
output.info('for local development, we recommend minikube:');
|
|
32
|
-
output.info('• install: https://minikube.sigs.k8s.io/docs/start');
|
|
33
|
-
output.info('• start cluster: minikube start');
|
|
34
|
-
output.info('');
|
|
35
|
-
output.info('alternatively, you can use kind or docker desktop.');
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
// Show cluster info
|
|
39
|
-
output.success(`connected to cluster: ${chalk.bold(clusterInfo.context)}`);
|
|
40
|
-
output.info(`type: ${clusterInfo.type}`);
|
|
41
|
-
output.info(`namespace: ${clusterInfo.namespace}`);
|
|
42
|
-
if (clusterInfo.ip) {
|
|
43
|
-
output.info(`ip: ${clusterInfo.ip}`);
|
|
44
|
-
}
|
|
45
|
-
console.log(); // Add blank line after cluster info
|
|
46
|
-
// Ask about installing dependencies
|
|
47
|
-
const { shouldInstallDeps } = await inquirer.prompt([
|
|
48
|
-
{
|
|
49
|
-
type: 'confirm',
|
|
50
|
-
name: 'shouldInstallDeps',
|
|
51
|
-
message: 'install required dependencies (cert-manager, gateway api)?',
|
|
52
|
-
default: true,
|
|
53
|
-
},
|
|
54
|
-
]);
|
|
55
|
-
if (shouldInstallDeps) {
|
|
56
|
-
for (const dep of Object.values(arkDependencies)) {
|
|
57
|
-
output.info(`installing ${dep.description || dep.name}...`);
|
|
58
|
-
try {
|
|
59
|
-
await execa(dep.command, dep.args, {
|
|
60
|
-
stdio: 'inherit',
|
|
61
|
-
});
|
|
62
|
-
output.success(`${dep.name} completed`);
|
|
63
|
-
console.log(); // Add blank line after dependency
|
|
64
|
-
}
|
|
65
|
-
catch {
|
|
66
|
-
console.log(); // Add blank line after error
|
|
67
|
-
process.exit(1);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
// Get installable services and iterate through them
|
|
72
|
-
const services = getInstallableServices();
|
|
73
|
-
for (const service of Object.values(services)) {
|
|
74
|
-
// Ask for confirmation
|
|
75
|
-
const { shouldInstall } = await inquirer.prompt([
|
|
76
|
-
{
|
|
77
|
-
type: 'confirm',
|
|
78
|
-
name: 'shouldInstall',
|
|
79
|
-
message: `install ${chalk.bold(service.name)}? ${service.description ? chalk.gray(`(${service.description.toLowerCase()})`) : ''}`,
|
|
80
|
-
default: true,
|
|
81
|
-
},
|
|
82
|
-
]);
|
|
83
|
-
if (!shouldInstall) {
|
|
84
|
-
output.warning(`skipping ${service.name}`);
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
try {
|
|
88
|
-
// Build helm arguments
|
|
89
|
-
const helmArgs = [
|
|
90
|
-
'upgrade',
|
|
91
|
-
'--install',
|
|
92
|
-
service.helmReleaseName,
|
|
93
|
-
service.chartPath,
|
|
94
|
-
'--namespace',
|
|
95
|
-
service.namespace,
|
|
96
|
-
];
|
|
97
|
-
// Add any additional args from the service definition
|
|
98
|
-
if (service.installArgs) {
|
|
99
|
-
helmArgs.push(...service.installArgs);
|
|
100
|
-
}
|
|
101
|
-
// Run helm upgrade --install with streaming output
|
|
102
|
-
await execa('helm', helmArgs, {
|
|
103
|
-
stdio: 'inherit',
|
|
104
|
-
});
|
|
105
|
-
console.log(); // Add blank line after command output
|
|
106
|
-
}
|
|
107
|
-
catch {
|
|
108
|
-
// Continue with remaining services on error
|
|
109
|
-
console.log(); // Add blank line after error output
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
// Check for default model after installing services
|
|
113
|
-
output.info('checking for default model...');
|
|
114
|
-
let modelExists = false;
|
|
115
|
-
try {
|
|
116
|
-
await execa('kubectl', ['get', 'model', 'default'], { stdio: 'pipe' });
|
|
117
|
-
modelExists = true;
|
|
118
|
-
output.success('default model already configured');
|
|
119
|
-
}
|
|
120
|
-
catch {
|
|
121
|
-
output.warning('no default model found');
|
|
122
|
-
}
|
|
123
|
-
if (!modelExists) {
|
|
124
|
-
const { shouldCreateModel } = await inquirer.prompt([
|
|
125
|
-
{
|
|
126
|
-
type: 'confirm',
|
|
127
|
-
name: 'shouldCreateModel',
|
|
128
|
-
message: 'would you like to create a default model?',
|
|
129
|
-
default: true,
|
|
130
|
-
},
|
|
131
|
-
]);
|
|
132
|
-
if (shouldCreateModel) {
|
|
133
|
-
await createModel('default');
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
output.warning('skipping model creation');
|
|
137
|
-
output.info('you can create a model later using ark models create or the dashboard');
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
export function createInstallCommand() {
|
|
142
|
-
const command = new Command('install');
|
|
143
|
-
command.description('Install ARK components using Helm').action(async () => {
|
|
144
|
-
await installArk();
|
|
145
|
-
});
|
|
146
|
-
return command;
|
|
147
|
-
}
|
|
@@ -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 {};
|
|
@@ -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
|
-
}
|
package/dist/commands/routes.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { execa } from 'execa';
|
|
4
|
-
import output from '../lib/output.js';
|
|
5
|
-
import { isCommandAvailable } from '../lib/commandUtils.js';
|
|
6
|
-
async function listRoutes() {
|
|
7
|
-
// Check if kubectl is installed
|
|
8
|
-
const kubectlInstalled = await isCommandAvailable('kubectl');
|
|
9
|
-
if (!kubectlInstalled) {
|
|
10
|
-
output.error('kubectl is not installed. please install kubectl first:');
|
|
11
|
-
output.info('https://kubernetes.io/docs/tasks/tools/');
|
|
12
|
-
process.exit(1);
|
|
13
|
-
}
|
|
14
|
-
const namespace = 'ark-system';
|
|
15
|
-
const port = 8080;
|
|
16
|
-
const portSuffix = `:${port}`;
|
|
17
|
-
try {
|
|
18
|
-
// Check if localhost-gateway is installed
|
|
19
|
-
const { stdout: gatewayCheck } = await execa('kubectl', ['get', 'gateway', 'localhost-gateway', '-n', namespace], { reject: false });
|
|
20
|
-
if (!gatewayCheck) {
|
|
21
|
-
output.error("localhost-gateway not installed in namespace 'ark-system'");
|
|
22
|
-
output.info("run 'ark install' first");
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
// Get HTTPRoutes
|
|
26
|
-
const { stdout: routeOutput } = await execa('kubectl', [
|
|
27
|
-
'get',
|
|
28
|
-
'httproutes',
|
|
29
|
-
'-A',
|
|
30
|
-
'-o',
|
|
31
|
-
'custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name,HOSTNAMES:.spec.hostnames',
|
|
32
|
-
'--no-headers',
|
|
33
|
-
], { reject: false });
|
|
34
|
-
if (!routeOutput || routeOutput.trim() === '') {
|
|
35
|
-
console.log(chalk.white('available localhost gateway routes: 0'));
|
|
36
|
-
output.info('no httproutes found. install services to see routes here.');
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
// Parse routes
|
|
40
|
-
const lines = routeOutput.trim().split('\n');
|
|
41
|
-
const routes = [];
|
|
42
|
-
lines.forEach((line) => {
|
|
43
|
-
const parts = line.split(/\s+/);
|
|
44
|
-
if (parts.length >= 3) {
|
|
45
|
-
const name = parts[1];
|
|
46
|
-
// Remove brackets and split hostnames
|
|
47
|
-
const hostnamesStr = parts.slice(2).join(' ').replace(/\[|\]/g, '');
|
|
48
|
-
const hostnames = hostnamesStr
|
|
49
|
-
.split(',')
|
|
50
|
-
.map((h) => h.trim())
|
|
51
|
-
.filter((h) => h && h !== '<none>');
|
|
52
|
-
if (hostnames.length > 0) {
|
|
53
|
-
routes.push({ name, hostnames });
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
// Count total routes (each hostname counts as a route)
|
|
58
|
-
const routeCount = routes.reduce((count, r) => count + r.hostnames.length, 0);
|
|
59
|
-
console.log(chalk.white(`available localhost gateway routes: ${routeCount}`));
|
|
60
|
-
// Check port-forward status
|
|
61
|
-
const { stdout: psOutput } = await execa('pgrep', ['-f', `kubectl.*port-forward.*${port}:80`], { reject: false });
|
|
62
|
-
const portForwardActive = !!psOutput;
|
|
63
|
-
if (portForwardActive) {
|
|
64
|
-
output.info(`port-forward active on localhost${portSuffix}`);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
output.error(`port-forward not running on localhost${portSuffix} - routes are not exposed`);
|
|
68
|
-
console.log(chalk.blue('run:'), `kubectl port-forward -n ${namespace} service/localhost-gateway-nginx ${port}:80 > /dev/null 2>&1 &`);
|
|
69
|
-
}
|
|
70
|
-
console.log();
|
|
71
|
-
// Display routes
|
|
72
|
-
if (routes.length > 0) {
|
|
73
|
-
const maxLength = Math.max(...routes.map((r) => r.name.length));
|
|
74
|
-
routes.forEach((route) => {
|
|
75
|
-
route.hostnames.forEach((hostname) => {
|
|
76
|
-
const url = `http://${hostname}${portSuffix}/`;
|
|
77
|
-
const padding = ' '.repeat(maxLength - route.name.length);
|
|
78
|
-
if (portForwardActive) {
|
|
79
|
-
console.log(` ${route.name}${padding}: ${chalk.blue(url)}`);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
console.log(` ${route.name}${padding}: ${chalk.blue(url)} ${chalk.red('(unavailable)')}`);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
output.error('failed to fetch routes:', error instanceof Error ? error.message : 'Unknown error');
|
|
90
|
-
process.exit(1);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
export function createRoutesCommand() {
|
|
94
|
-
const command = new Command('routes');
|
|
95
|
-
command
|
|
96
|
-
.description('show available gateway routes and their urls')
|
|
97
|
-
.action(async () => {
|
|
98
|
-
await listRoutes();
|
|
99
|
-
});
|
|
100
|
-
return command;
|
|
101
|
-
}
|
package/dist/commands/status.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import ora from 'ora';
|
|
4
|
-
import { StatusChecker } from '../components/statusChecker.js';
|
|
5
|
-
import { ConfigManager } from '../config.js';
|
|
6
|
-
import { ArkClient } from '../lib/arkClient.js';
|
|
7
|
-
import { StatusFormatter } from '../ui/statusFormatter.js';
|
|
8
|
-
export async function checkStatus() {
|
|
9
|
-
const spinner = ora('Checking system status').start();
|
|
10
|
-
try {
|
|
11
|
-
const configManager = new ConfigManager();
|
|
12
|
-
spinner.text = 'Checking system dependencies';
|
|
13
|
-
const apiBaseUrl = await configManager.getApiBaseUrl();
|
|
14
|
-
const arkClient = new ArkClient(apiBaseUrl);
|
|
15
|
-
const statusChecker = new StatusChecker(arkClient);
|
|
16
|
-
spinner.text = 'Testing cluster access';
|
|
17
|
-
spinner.text = 'Checking ARK services';
|
|
18
|
-
const statusData = await statusChecker.checkAll();
|
|
19
|
-
spinner.stop();
|
|
20
|
-
StatusFormatter.printStatus(statusData);
|
|
21
|
-
process.exit(0);
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
spinner.fail('Failed to check status');
|
|
25
|
-
console.error(chalk.red('Error:'), error);
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export function createStatusCommand() {
|
|
30
|
-
const statusCommand = new Command('status');
|
|
31
|
-
statusCommand.description('Check ARK system status').action(checkStatus);
|
|
32
|
-
return statusCommand;
|
|
33
|
-
}
|
package/dist/commands/targets.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import output from '../lib/output.js';
|
|
3
|
-
import { ArkApiProxy } from '../lib/arkApiProxy.js';
|
|
4
|
-
async function listTargets(options) {
|
|
5
|
-
let proxy;
|
|
6
|
-
try {
|
|
7
|
-
proxy = new ArkApiProxy();
|
|
8
|
-
const arkApiClient = await proxy.start();
|
|
9
|
-
const allTargets = await arkApiClient.getQueryTargets();
|
|
10
|
-
// Filter by type if specified
|
|
11
|
-
let filteredTargets = allTargets;
|
|
12
|
-
if (options.type) {
|
|
13
|
-
filteredTargets = allTargets.filter((t) => t.type === options.type);
|
|
14
|
-
}
|
|
15
|
-
// Sort targets by type and name
|
|
16
|
-
filteredTargets.sort((a, b) => {
|
|
17
|
-
if (a.type !== b.type) {
|
|
18
|
-
return a.type.localeCompare(b.type);
|
|
19
|
-
}
|
|
20
|
-
return a.name.localeCompare(b.name);
|
|
21
|
-
});
|
|
22
|
-
if (options.output === 'json') {
|
|
23
|
-
console.log(JSON.stringify(filteredTargets, null, 2));
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
if (filteredTargets.length === 0) {
|
|
27
|
-
output.warning('no targets available');
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
// Simple list output with type/name format
|
|
31
|
-
for (const target of filteredTargets) {
|
|
32
|
-
console.log(target.id);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
output.error('fetching targets:', error instanceof Error ? error.message : error);
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
finally {
|
|
41
|
-
if (proxy) {
|
|
42
|
-
proxy.stop();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
export function createTargetsCommand() {
|
|
47
|
-
const targets = new Command('targets');
|
|
48
|
-
targets
|
|
49
|
-
.description('list available query targets (agents, teams, models, tools)')
|
|
50
|
-
.option('-o, --output <format>', 'output format (json or text)', 'text')
|
|
51
|
-
.option('-t, --type <type>', 'filter by type (agent, team, model, tool)')
|
|
52
|
-
.action(async (options) => {
|
|
53
|
-
await listTargets(options);
|
|
54
|
-
});
|
|
55
|
-
targets
|
|
56
|
-
.command('list')
|
|
57
|
-
.alias('ls')
|
|
58
|
-
.description('list all available query targets')
|
|
59
|
-
.option('-o, --output <format>', 'output format (json or text)', 'text')
|
|
60
|
-
.option('-t, --type <type>', 'filter by type (agent, team, model, tool)')
|
|
61
|
-
.action(async (options) => {
|
|
62
|
-
await listTargets(options);
|
|
63
|
-
});
|
|
64
|
-
return targets;
|
|
65
|
-
}
|
|
@@ -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 {};
|
|
@@ -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 {};
|
|
@@ -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,83 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { execa } from 'execa';
|
|
4
|
-
import inquirer from 'inquirer';
|
|
5
|
-
import { isCommandAvailable } from '../lib/commandUtils.js';
|
|
6
|
-
import { getClusterInfo } from '../lib/cluster.js';
|
|
7
|
-
import output from '../lib/output.js';
|
|
8
|
-
import { getInstallableServices } from '../arkServices.js';
|
|
9
|
-
async function uninstallArk() {
|
|
10
|
-
// Check if helm is installed
|
|
11
|
-
const helmInstalled = await isCommandAvailable('helm');
|
|
12
|
-
if (!helmInstalled) {
|
|
13
|
-
output.error('helm is not installed. please install helm first:');
|
|
14
|
-
output.info('https://helm.sh/docs/intro/install/');
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
// Check if kubectl is installed
|
|
18
|
-
const kubectlInstalled = await isCommandAvailable('kubectl');
|
|
19
|
-
if (!kubectlInstalled) {
|
|
20
|
-
output.error('kubectl is not installed. please install kubectl first:');
|
|
21
|
-
output.info('https://kubernetes.io/docs/tasks/tools/');
|
|
22
|
-
process.exit(1);
|
|
23
|
-
}
|
|
24
|
-
// Check cluster connectivity
|
|
25
|
-
const clusterInfo = await getClusterInfo();
|
|
26
|
-
if (clusterInfo.error) {
|
|
27
|
-
output.error('no kubernetes cluster detected');
|
|
28
|
-
output.info('please ensure you have a running cluster and kubectl is configured.');
|
|
29
|
-
process.exit(1);
|
|
30
|
-
}
|
|
31
|
-
// Show cluster info
|
|
32
|
-
output.success(`connected to cluster: ${chalk.bold(clusterInfo.context)}`);
|
|
33
|
-
output.info(`type: ${clusterInfo.type}`);
|
|
34
|
-
output.info(`namespace: ${clusterInfo.namespace}`);
|
|
35
|
-
if (clusterInfo.ip) {
|
|
36
|
-
output.info(`ip: ${clusterInfo.ip}`);
|
|
37
|
-
}
|
|
38
|
-
console.log(); // Add blank line after cluster info
|
|
39
|
-
// Get installable services and iterate through them in reverse order for clean uninstall
|
|
40
|
-
const services = getInstallableServices();
|
|
41
|
-
const serviceEntries = Object.entries(services).reverse();
|
|
42
|
-
for (const [, service] of serviceEntries) {
|
|
43
|
-
// Ask for confirmation
|
|
44
|
-
const { shouldUninstall } = await inquirer.prompt([
|
|
45
|
-
{
|
|
46
|
-
type: 'confirm',
|
|
47
|
-
name: 'shouldUninstall',
|
|
48
|
-
message: `uninstall ${chalk.bold(service.name)}? ${service.description ? chalk.gray(`(${service.description.toLowerCase()})`) : ''}`,
|
|
49
|
-
default: true,
|
|
50
|
-
},
|
|
51
|
-
]);
|
|
52
|
-
if (!shouldUninstall) {
|
|
53
|
-
output.warning(`skipping ${service.name}`);
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
try {
|
|
57
|
-
// Uninstall the release
|
|
58
|
-
await execa('helm', [
|
|
59
|
-
'uninstall',
|
|
60
|
-
service.helmReleaseName,
|
|
61
|
-
'--namespace',
|
|
62
|
-
service.namespace,
|
|
63
|
-
'--ignore-not-found',
|
|
64
|
-
], {
|
|
65
|
-
stdio: 'inherit',
|
|
66
|
-
});
|
|
67
|
-
console.log(); // Add blank line after command output
|
|
68
|
-
}
|
|
69
|
-
catch {
|
|
70
|
-
// Continue with remaining charts on error
|
|
71
|
-
console.log(); // Add blank line after error output
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
export function createUninstallCommand() {
|
|
76
|
-
const command = new Command('uninstall');
|
|
77
|
-
command
|
|
78
|
-
.description('Uninstall ARK components using Helm')
|
|
79
|
-
.action(async () => {
|
|
80
|
-
await uninstallArk();
|
|
81
|
-
});
|
|
82
|
-
return command;
|
|
83
|
-
}
|