@agents-at-scale/ark 0.1.35-rc2 → 0.1.36-rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arkServices.js +7 -7
- package/dist/commands/agents/index.js +14 -0
- package/dist/commands/completion/index.js +1 -61
- package/dist/commands/dev/tool/shared.js +3 -1
- package/dist/commands/generate/generators/agent.js +2 -2
- package/dist/commands/generate/generators/team.js +2 -2
- package/dist/commands/install/index.js +1 -6
- package/dist/commands/models/index.js +15 -0
- package/dist/commands/models/index.spec.js +20 -0
- package/dist/commands/query/index.js +9 -116
- package/dist/commands/query/index.spec.d.ts +1 -0
- package/dist/commands/query/index.spec.js +53 -0
- package/dist/commands/status/index.d.ts +2 -3
- package/dist/commands/status/index.js +36 -17
- package/dist/commands/targets/index.js +26 -19
- package/dist/commands/targets/index.spec.js +95 -46
- package/dist/commands/teams/index.js +15 -0
- package/dist/commands/uninstall/index.js +0 -5
- package/dist/components/statusChecker.d.ts +2 -2
- package/dist/index.js +1 -3
- package/dist/lib/chatClient.js +70 -76
- package/dist/lib/config.d.ts +0 -2
- package/dist/lib/executeQuery.d.ts +20 -0
- package/dist/lib/executeQuery.js +135 -0
- package/dist/lib/executeQuery.spec.d.ts +1 -0
- package/dist/lib/executeQuery.spec.js +170 -0
- package/dist/lib/nextSteps.js +1 -1
- package/dist/lib/queryRunner.d.ts +22 -0
- package/dist/lib/queryRunner.js +142 -0
- package/dist/lib/startup.d.ts +1 -1
- package/dist/lib/startup.js +25 -31
- package/dist/lib/startup.spec.js +29 -45
- package/dist/lib/types.d.ts +70 -0
- package/dist/lib/versions.d.ts +23 -0
- package/dist/lib/versions.js +51 -0
- package/dist/ui/MainMenu.js +15 -11
- package/package.json +1 -2
package/dist/lib/types.d.ts
CHANGED
|
@@ -49,3 +49,73 @@ export interface CommandVersionConfig {
|
|
|
49
49
|
versionArgs: string;
|
|
50
50
|
versionExtract: (_output: string) => string;
|
|
51
51
|
}
|
|
52
|
+
export interface K8sMetadata {
|
|
53
|
+
name: string;
|
|
54
|
+
namespace?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface K8sCondition {
|
|
57
|
+
type: string;
|
|
58
|
+
status: string;
|
|
59
|
+
message?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface K8sListResource<T> {
|
|
62
|
+
items: T[];
|
|
63
|
+
}
|
|
64
|
+
export interface HelmRelease {
|
|
65
|
+
name: string;
|
|
66
|
+
app_version?: string;
|
|
67
|
+
revision?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface K8sDeployment {
|
|
70
|
+
metadata: K8sMetadata;
|
|
71
|
+
spec?: {
|
|
72
|
+
replicas?: number;
|
|
73
|
+
};
|
|
74
|
+
status?: {
|
|
75
|
+
readyReplicas?: number;
|
|
76
|
+
availableReplicas?: number;
|
|
77
|
+
conditions?: K8sCondition[];
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export interface Model {
|
|
81
|
+
metadata: K8sMetadata;
|
|
82
|
+
status?: ModelStatus;
|
|
83
|
+
}
|
|
84
|
+
export interface Agent {
|
|
85
|
+
metadata: K8sMetadata;
|
|
86
|
+
}
|
|
87
|
+
export interface Team {
|
|
88
|
+
metadata: K8sMetadata;
|
|
89
|
+
}
|
|
90
|
+
export interface QueryTarget {
|
|
91
|
+
type: string;
|
|
92
|
+
name: string;
|
|
93
|
+
}
|
|
94
|
+
export interface QueryResponse {
|
|
95
|
+
content?: string;
|
|
96
|
+
}
|
|
97
|
+
export interface Query {
|
|
98
|
+
apiVersion: string;
|
|
99
|
+
kind: 'Query';
|
|
100
|
+
metadata: K8sMetadata;
|
|
101
|
+
spec?: {
|
|
102
|
+
input: string;
|
|
103
|
+
targets: QueryTarget[];
|
|
104
|
+
};
|
|
105
|
+
status?: {
|
|
106
|
+
phase?: 'initializing' | 'running' | 'done' | 'error' | 'canceled';
|
|
107
|
+
conditions?: K8sCondition[];
|
|
108
|
+
responses?: QueryResponse[];
|
|
109
|
+
message?: string;
|
|
110
|
+
error?: string;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export interface Tool {
|
|
114
|
+
metadata: K8sMetadata;
|
|
115
|
+
}
|
|
116
|
+
export interface ClusterInfo {
|
|
117
|
+
context?: string;
|
|
118
|
+
cluster?: string;
|
|
119
|
+
user?: string;
|
|
120
|
+
namespace?: string;
|
|
121
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version information for ARK
|
|
3
|
+
*/
|
|
4
|
+
export interface ArkVersionInfo {
|
|
5
|
+
current?: string;
|
|
6
|
+
latest?: string;
|
|
7
|
+
updateAvailable?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Fetch the latest ARK version from GitHub releases
|
|
11
|
+
* @returns Latest version string or undefined if fetch fails
|
|
12
|
+
*/
|
|
13
|
+
export declare function fetchLatestVersion(): Promise<string | undefined>;
|
|
14
|
+
/**
|
|
15
|
+
* Get current installed ARK version from Helm
|
|
16
|
+
* @returns Current version string or undefined if not found
|
|
17
|
+
*/
|
|
18
|
+
export declare function fetchCurrentVersion(): Promise<string | undefined>;
|
|
19
|
+
/**
|
|
20
|
+
* Fetch both current and latest versions in parallel
|
|
21
|
+
* @returns Version information
|
|
22
|
+
*/
|
|
23
|
+
export declare function fetchVersionInfo(): Promise<ArkVersionInfo>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { execa } from 'execa';
|
|
2
|
+
import { arkServices } from '../arkServices.js';
|
|
3
|
+
/**
|
|
4
|
+
* Fetch the latest ARK version from GitHub releases
|
|
5
|
+
* @returns Latest version string or undefined if fetch fails
|
|
6
|
+
*/
|
|
7
|
+
export async function fetchLatestVersion() {
|
|
8
|
+
try {
|
|
9
|
+
const response = await fetch('https://api.github.com/repos/mckinsey/agents-at-scale-ark/releases/latest');
|
|
10
|
+
if (response.ok) {
|
|
11
|
+
const data = (await response.json());
|
|
12
|
+
// Remove 'v' prefix if present for consistent comparison
|
|
13
|
+
return data.tag_name.replace(/^v/, '');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
// Silently fail
|
|
18
|
+
}
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get current installed ARK version from Helm
|
|
23
|
+
* @returns Current version string or undefined if not found
|
|
24
|
+
*/
|
|
25
|
+
export async function fetchCurrentVersion() {
|
|
26
|
+
try {
|
|
27
|
+
const controller = arkServices['ark-controller'];
|
|
28
|
+
const { stdout } = await execa('helm', ['list', '-n', controller.namespace, '-o', 'json'], { stdio: 'pipe' });
|
|
29
|
+
const releases = JSON.parse(stdout);
|
|
30
|
+
const arkController = releases.find((r) => r.name === controller.helmReleaseName);
|
|
31
|
+
return arkController?.app_version;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Fetch both current and latest versions in parallel
|
|
39
|
+
* @returns Version information
|
|
40
|
+
*/
|
|
41
|
+
export async function fetchVersionInfo() {
|
|
42
|
+
const [current, latest] = await Promise.all([
|
|
43
|
+
fetchCurrentVersion(),
|
|
44
|
+
fetchLatestVersion(),
|
|
45
|
+
]);
|
|
46
|
+
return {
|
|
47
|
+
current,
|
|
48
|
+
latest,
|
|
49
|
+
updateAvailable: current && latest ? current !== latest : undefined,
|
|
50
|
+
};
|
|
51
|
+
}
|
package/dist/ui/MainMenu.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Text, Box, render, useInput } from 'ink';
|
|
|
3
3
|
import Spinner from 'ink-spinner';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { isArkReady } from '../lib/arkStatus.js';
|
|
6
|
+
import { fetchVersionInfo } from '../lib/versions.js';
|
|
6
7
|
// Helper function to unmount the main ink app - used when we move from a
|
|
7
8
|
// React TUI app to basic input/output.
|
|
8
9
|
async function unmountInkApp() {
|
|
@@ -27,16 +28,22 @@ const MainMenu = ({ config }) => {
|
|
|
27
28
|
const [selectedIndex, setSelectedIndex] = React.useState(0);
|
|
28
29
|
const [arkReady, setArkReady] = React.useState(null);
|
|
29
30
|
const [isChecking, setIsChecking] = React.useState(true);
|
|
31
|
+
const [versionInfo, setVersionInfo] = React.useState({});
|
|
30
32
|
React.useEffect(() => {
|
|
31
|
-
const
|
|
33
|
+
const checkStatus = async () => {
|
|
32
34
|
setIsChecking(true);
|
|
33
|
-
|
|
35
|
+
// Run ark ready check and version fetch in parallel
|
|
36
|
+
const [ready, versions] = await Promise.all([
|
|
37
|
+
isArkReady(),
|
|
38
|
+
fetchVersionInfo(),
|
|
39
|
+
]);
|
|
34
40
|
setArkReady(ready);
|
|
41
|
+
setVersionInfo(versions);
|
|
35
42
|
setIsChecking(false);
|
|
36
43
|
// Reset selected index to 0 after status check
|
|
37
44
|
setSelectedIndex(0);
|
|
38
45
|
};
|
|
39
|
-
|
|
46
|
+
checkStatus();
|
|
40
47
|
}, []);
|
|
41
48
|
// Handle Ctrl+C to properly unmount Ink and restore terminal
|
|
42
49
|
React.useEffect(() => {
|
|
@@ -54,11 +61,8 @@ const MainMenu = ({ config }) => {
|
|
|
54
61
|
}, []);
|
|
55
62
|
// Check if upgrade is available
|
|
56
63
|
const hasUpgrade = React.useMemo(() => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
// Simple version comparison
|
|
60
|
-
return config.currentVersion !== config.latestVersion;
|
|
61
|
-
}, [config.currentVersion, config.latestVersion]);
|
|
64
|
+
return versionInfo.updateAvailable === true;
|
|
65
|
+
}, [versionInfo.updateAvailable]);
|
|
62
66
|
const allChoices = [
|
|
63
67
|
{
|
|
64
68
|
label: 'Chat',
|
|
@@ -74,7 +78,7 @@ const MainMenu = ({ config }) => {
|
|
|
74
78
|
},
|
|
75
79
|
{
|
|
76
80
|
label: 'Upgrade',
|
|
77
|
-
description: `Upgrade Ark from ${
|
|
81
|
+
description: `Upgrade Ark from ${versionInfo.current || 'unknown'} to ${versionInfo.latest || 'unknown'}`,
|
|
78
82
|
value: 'upgrade',
|
|
79
83
|
command: 'ark install -y',
|
|
80
84
|
},
|
|
@@ -214,7 +218,7 @@ const MainMenu = ({ config }) => {
|
|
|
214
218
|
// Unmount fullscreen app and clear screen.
|
|
215
219
|
await unmountInkApp();
|
|
216
220
|
const { checkStatus } = await import('../commands/status/index.js');
|
|
217
|
-
await checkStatus(
|
|
221
|
+
await checkStatus();
|
|
218
222
|
process.exit(0);
|
|
219
223
|
break; // Add break even though process.exit prevents reaching here
|
|
220
224
|
}
|
|
@@ -239,7 +243,7 @@ const MainMenu = ({ config }) => {
|
|
|
239
243
|
║ Agents at Scale Platform ║
|
|
240
244
|
║ ║
|
|
241
245
|
╚═══════════════════════════════════════╝
|
|
242
|
-
` }), isChecking ? (_jsxs(Text, { color: "gray", children: [_jsx(Spinner, { type: "dots" }), " Checking Ark status..."] })) : arkReady ? (_jsxs(Box, { children: [_jsx(Text, { color: "green", bold: true, children: "\u25CF Ark is ready" }),
|
|
246
|
+
` }), isChecking ? (_jsxs(Text, { color: "gray", children: [_jsx(Spinner, { type: "dots" }), " Checking Ark status..."] })) : arkReady ? (_jsxs(Box, { children: [_jsx(Text, { color: "green", bold: true, children: "\u25CF Ark is ready" }), _jsxs(Text, { color: "gray", children: [' ', "(", versionInfo.current || 'version unknown', ")"] })] })) : (_jsx(Text, { color: "yellow", bold: true, children: "\u25CF Ark is not installed" })), config.clusterInfo?.context ? (_jsxs(Text, { children: [_jsx(Text, { color: "gray", children: "Current context: " }), _jsx(Text, { color: "white", bold: true, children: config.clusterInfo.context })] })) : (_jsx(Text, { color: "gray", children: "No Kubernetes context configured" }))] }), !isChecking && (_jsx(Box, { flexDirection: "column", paddingX: 4, marginTop: 1, children: choices.map((choice, index) => {
|
|
243
247
|
const isSelected = index === selectedIndex;
|
|
244
248
|
return (_jsxs(Box, { flexDirection: "row", paddingY: 0, children: [_jsx(Text, { color: "gray", dimColor: true, children: isSelected ? '❯ ' : ' ' }), _jsxs(Text, { color: "gray", dimColor: true, children: [index + 1, "."] }), _jsx(Box, { marginLeft: 1, width: 20, children: _jsx(Text, { color: isSelected ? 'green' : 'white', bold: isSelected, children: choice.label }) }), _jsx(Text, { color: "gray", children: choice.description })] }, choice.value));
|
|
245
249
|
}) }))] }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agents-at-scale/ark",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.36-rc1",
|
|
4
4
|
"description": "ARK CLI - Interactive terminal interface for ARK agents",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
14
|
"build": "tsc && chmod +x dist/index.js",
|
|
15
|
-
"postbuild": "mkdir -p dist/lib/dev/tools && cp src/lib/dev/tools/*.py dist/lib/dev/tools/ 2>/dev/null || true",
|
|
16
15
|
"dev": "tsc --watch",
|
|
17
16
|
"start": "NODE_NO_WARNINGS=1 node dist/index.js",
|
|
18
17
|
"clean": "rm -rf dist",
|