@agents-at-scale/ark 0.1.35-rc2 → 0.1.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/dist/commands/cluster/index.d.ts +1 -2
  2. package/dist/commands/cluster/index.js +5 -3
  3. package/dist/commands/completion.js +2 -159
  4. package/dist/commands/config.d.ts +3 -0
  5. package/dist/commands/config.js +321 -38
  6. package/dist/commands/generate/config.js +24 -5
  7. package/dist/commands/generate/generators/agent.js +2 -2
  8. package/dist/commands/generate/generators/mcpserver.d.ts +1 -2
  9. package/dist/commands/generate/generators/mcpserver.js +5 -26
  10. package/dist/commands/generate/generators/project.js +41 -22
  11. package/dist/commands/generate/generators/team.js +2 -2
  12. package/dist/commands/generate/index.d.ts +1 -2
  13. package/dist/commands/generate/index.js +1 -1
  14. package/dist/components/statusChecker.d.ts +23 -13
  15. package/dist/components/statusChecker.js +129 -295
  16. package/dist/config.d.ts +22 -3
  17. package/dist/config.js +161 -10
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.js +42 -44
  20. package/dist/lib/cluster.d.ts +1 -2
  21. package/dist/lib/cluster.js +16 -37
  22. package/dist/lib/config.d.ts +80 -28
  23. package/dist/lib/config.js +205 -70
  24. package/dist/lib/consts.d.ts +1 -0
  25. package/dist/lib/consts.js +2 -0
  26. package/dist/lib/errors.js +1 -1
  27. package/dist/lib/exec.d.ts +4 -0
  28. package/dist/lib/exec.js +11 -0
  29. package/dist/lib/types.d.ts +3 -17
  30. package/dist/ui/MainMenu.d.ts +1 -5
  31. package/dist/ui/MainMenu.js +91 -222
  32. package/dist/ui/statusFormatter.d.ts +7 -22
  33. package/dist/ui/statusFormatter.js +39 -39
  34. package/package.json +5 -17
  35. package/dist/arkServices.d.ts +0 -42
  36. package/dist/arkServices.js +0 -138
  37. package/dist/arkServices.spec.d.ts +0 -1
  38. package/dist/arkServices.spec.js +0 -24
  39. package/dist/charts/charts.d.ts +0 -5
  40. package/dist/charts/charts.js +0 -6
  41. package/dist/charts/dependencies.d.ts +0 -6
  42. package/dist/charts/dependencies.js +0 -50
  43. package/dist/charts/types.d.ts +0 -40
  44. package/dist/charts/types.js +0 -1
  45. package/dist/commands/agents/index.d.ts +0 -3
  46. package/dist/commands/agents/index.js +0 -51
  47. package/dist/commands/agents/index.spec.d.ts +0 -1
  48. package/dist/commands/agents/index.spec.js +0 -67
  49. package/dist/commands/agents/selector.d.ts +0 -8
  50. package/dist/commands/agents/selector.js +0 -53
  51. package/dist/commands/agents.d.ts +0 -2
  52. package/dist/commands/agents.js +0 -53
  53. package/dist/commands/chat/index.d.ts +0 -3
  54. package/dist/commands/chat/index.js +0 -29
  55. package/dist/commands/chat.d.ts +0 -2
  56. package/dist/commands/chat.js +0 -45
  57. package/dist/commands/cluster/get.d.ts +0 -2
  58. package/dist/commands/cluster/get.js +0 -39
  59. package/dist/commands/cluster/get.spec.d.ts +0 -1
  60. package/dist/commands/cluster/get.spec.js +0 -92
  61. package/dist/commands/cluster/index.spec.d.ts +0 -1
  62. package/dist/commands/cluster/index.spec.js +0 -24
  63. package/dist/commands/completion/index.d.ts +0 -3
  64. package/dist/commands/completion/index.js +0 -290
  65. package/dist/commands/completion/index.spec.d.ts +0 -1
  66. package/dist/commands/completion/index.spec.js +0 -34
  67. package/dist/commands/config/index.d.ts +0 -3
  68. package/dist/commands/config/index.js +0 -42
  69. package/dist/commands/config/index.spec.d.ts +0 -1
  70. package/dist/commands/config/index.spec.js +0 -78
  71. package/dist/commands/dashboard/index.d.ts +0 -4
  72. package/dist/commands/dashboard/index.js +0 -39
  73. package/dist/commands/dashboard.d.ts +0 -3
  74. package/dist/commands/dashboard.js +0 -39
  75. package/dist/commands/dev/index.d.ts +0 -3
  76. package/dist/commands/dev/index.js +0 -9
  77. package/dist/commands/dev/tool/check.d.ts +0 -2
  78. package/dist/commands/dev/tool/check.js +0 -142
  79. package/dist/commands/dev/tool/clean.d.ts +0 -2
  80. package/dist/commands/dev/tool/clean.js +0 -153
  81. package/dist/commands/dev/tool/generate.d.ts +0 -2
  82. package/dist/commands/dev/tool/generate.js +0 -28
  83. package/dist/commands/dev/tool/index.d.ts +0 -2
  84. package/dist/commands/dev/tool/index.js +0 -14
  85. package/dist/commands/dev/tool/init.d.ts +0 -2
  86. package/dist/commands/dev/tool/init.js +0 -320
  87. package/dist/commands/dev/tool/shared.d.ts +0 -5
  88. package/dist/commands/dev/tool/shared.js +0 -256
  89. package/dist/commands/dev/tool/status.d.ts +0 -2
  90. package/dist/commands/dev/tool/status.js +0 -136
  91. package/dist/commands/dev/tool-generate.spec.d.ts +0 -1
  92. package/dist/commands/dev/tool-generate.spec.js +0 -163
  93. package/dist/commands/dev/tool.d.ts +0 -2
  94. package/dist/commands/dev/tool.js +0 -559
  95. package/dist/commands/dev/tool.spec.d.ts +0 -1
  96. package/dist/commands/dev/tool.spec.js +0 -48
  97. package/dist/commands/docs/index.d.ts +0 -4
  98. package/dist/commands/docs/index.js +0 -18
  99. package/dist/commands/install/index.d.ts +0 -8
  100. package/dist/commands/install/index.js +0 -300
  101. package/dist/commands/install/index.spec.d.ts +0 -1
  102. package/dist/commands/install/index.spec.js +0 -143
  103. package/dist/commands/install.d.ts +0 -3
  104. package/dist/commands/install.js +0 -147
  105. package/dist/commands/models/create.d.ts +0 -1
  106. package/dist/commands/models/create.js +0 -213
  107. package/dist/commands/models/create.spec.d.ts +0 -1
  108. package/dist/commands/models/create.spec.js +0 -125
  109. package/dist/commands/models/index.d.ts +0 -3
  110. package/dist/commands/models/index.js +0 -60
  111. package/dist/commands/models/index.spec.d.ts +0 -1
  112. package/dist/commands/models/index.spec.js +0 -76
  113. package/dist/commands/models/selector.d.ts +0 -8
  114. package/dist/commands/models/selector.js +0 -53
  115. package/dist/commands/query/index.d.ts +0 -3
  116. package/dist/commands/query/index.js +0 -131
  117. package/dist/commands/routes/index.d.ts +0 -3
  118. package/dist/commands/routes/index.js +0 -93
  119. package/dist/commands/routes.d.ts +0 -2
  120. package/dist/commands/routes.js +0 -101
  121. package/dist/commands/status/index.d.ts +0 -4
  122. package/dist/commands/status/index.js +0 -262
  123. package/dist/commands/status.d.ts +0 -3
  124. package/dist/commands/status.js +0 -33
  125. package/dist/commands/targets/index.d.ts +0 -3
  126. package/dist/commands/targets/index.js +0 -65
  127. package/dist/commands/targets/index.spec.d.ts +0 -1
  128. package/dist/commands/targets/index.spec.js +0 -105
  129. package/dist/commands/targets.d.ts +0 -2
  130. package/dist/commands/targets.js +0 -65
  131. package/dist/commands/teams/index.d.ts +0 -3
  132. package/dist/commands/teams/index.js +0 -49
  133. package/dist/commands/teams/index.spec.d.ts +0 -1
  134. package/dist/commands/teams/index.spec.js +0 -70
  135. package/dist/commands/teams/selector.d.ts +0 -8
  136. package/dist/commands/teams/selector.js +0 -55
  137. package/dist/commands/tools/index.d.ts +0 -3
  138. package/dist/commands/tools/index.js +0 -49
  139. package/dist/commands/tools/index.spec.d.ts +0 -1
  140. package/dist/commands/tools/index.spec.js +0 -70
  141. package/dist/commands/tools/selector.d.ts +0 -8
  142. package/dist/commands/tools/selector.js +0 -53
  143. package/dist/commands/uninstall/index.d.ts +0 -3
  144. package/dist/commands/uninstall/index.js +0 -106
  145. package/dist/commands/uninstall/index.spec.d.ts +0 -1
  146. package/dist/commands/uninstall/index.spec.js +0 -125
  147. package/dist/commands/uninstall.d.ts +0 -2
  148. package/dist/commands/uninstall.js +0 -83
  149. package/dist/components/ChatUI.d.ts +0 -16
  150. package/dist/components/ChatUI.js +0 -801
  151. package/dist/components/StatusView.d.ts +0 -10
  152. package/dist/components/StatusView.js +0 -39
  153. package/dist/lib/arkApiClient.d.ts +0 -53
  154. package/dist/lib/arkApiClient.js +0 -102
  155. package/dist/lib/arkApiProxy.d.ts +0 -9
  156. package/dist/lib/arkApiProxy.js +0 -22
  157. package/dist/lib/arkServiceProxy.d.ts +0 -14
  158. package/dist/lib/arkServiceProxy.js +0 -95
  159. package/dist/lib/arkStatus.d.ts +0 -10
  160. package/dist/lib/arkStatus.js +0 -79
  161. package/dist/lib/arkStatus.spec.d.ts +0 -1
  162. package/dist/lib/arkStatus.spec.js +0 -49
  163. package/dist/lib/chatClient.d.ts +0 -33
  164. package/dist/lib/chatClient.js +0 -99
  165. package/dist/lib/cluster.spec.d.ts +0 -1
  166. package/dist/lib/cluster.spec.js +0 -338
  167. package/dist/lib/commandUtils.d.ts +0 -4
  168. package/dist/lib/commandUtils.js +0 -18
  169. package/dist/lib/commandUtils.test.d.ts +0 -1
  170. package/dist/lib/commandUtils.test.js +0 -44
  171. package/dist/lib/commands.d.ts +0 -16
  172. package/dist/lib/commands.js +0 -29
  173. package/dist/lib/commands.spec.d.ts +0 -1
  174. package/dist/lib/commands.spec.js +0 -146
  175. package/dist/lib/config.spec.d.ts +0 -1
  176. package/dist/lib/config.spec.js +0 -99
  177. package/dist/lib/config.test.d.ts +0 -1
  178. package/dist/lib/config.test.js +0 -93
  179. package/dist/lib/consts.spec.d.ts +0 -1
  180. package/dist/lib/consts.spec.js +0 -15
  181. package/dist/lib/dev/tools/analyzer.d.ts +0 -30
  182. package/dist/lib/dev/tools/analyzer.js +0 -190
  183. package/dist/lib/dev/tools/discover_tools.py +0 -392
  184. package/dist/lib/dev/tools/mcp-types.d.ts +0 -28
  185. package/dist/lib/dev/tools/mcp-types.js +0 -86
  186. package/dist/lib/dev/tools/types.d.ts +0 -50
  187. package/dist/lib/dev/tools/types.js +0 -1
  188. package/dist/lib/errors.spec.d.ts +0 -1
  189. package/dist/lib/errors.spec.js +0 -221
  190. package/dist/lib/nextSteps.d.ts +0 -4
  191. package/dist/lib/nextSteps.js +0 -20
  192. package/dist/lib/nextSteps.spec.d.ts +0 -1
  193. package/dist/lib/nextSteps.spec.js +0 -59
  194. package/dist/lib/output.d.ts +0 -36
  195. package/dist/lib/output.js +0 -89
  196. package/dist/lib/output.spec.d.ts +0 -1
  197. package/dist/lib/output.spec.js +0 -123
  198. package/dist/lib/portUtils.d.ts +0 -8
  199. package/dist/lib/portUtils.js +0 -39
  200. package/dist/lib/startup.d.ts +0 -9
  201. package/dist/lib/startup.js +0 -93
  202. package/dist/lib/startup.spec.d.ts +0 -1
  203. package/dist/lib/startup.spec.js +0 -168
  204. package/dist/types/types.d.ts +0 -40
  205. package/dist/types/types.js +0 -1
  206. package/dist/ui/AgentSelector.d.ts +0 -8
  207. package/dist/ui/AgentSelector.js +0 -53
  208. package/dist/ui/ModelSelector.d.ts +0 -8
  209. package/dist/ui/ModelSelector.js +0 -53
  210. package/dist/ui/TeamSelector.d.ts +0 -8
  211. package/dist/ui/TeamSelector.js +0 -55
  212. package/dist/ui/ToolSelector.d.ts +0 -8
  213. package/dist/ui/ToolSelector.js +0 -53
  214. package/dist/ui/statusFormatter.spec.d.ts +0 -1
  215. package/dist/ui/statusFormatter.spec.js +0 -58
@@ -1,138 +0,0 @@
1
- /**
2
- * Centralized ARK service definitions used by both install and status commands
3
- */
4
- const REGISTRY_BASE = 'oci://ghcr.io/mckinsey/agents-at-scale-ark/charts';
5
- /**
6
- * Dependencies that should be installed before ARK services
7
- * Note: Dependencies will be installed in the order they are defined here
8
- */
9
- export const arkDependencies = {
10
- 'cert-manager-repo': {
11
- name: 'cert-manager-repo',
12
- command: 'helm',
13
- args: [
14
- 'repo',
15
- 'add',
16
- 'jetstack',
17
- 'https://charts.jetstack.io',
18
- '--force-update',
19
- ],
20
- description: 'Add Jetstack Helm repository',
21
- },
22
- 'helm-repo-update': {
23
- name: 'helm-repo-update',
24
- command: 'helm',
25
- args: ['repo', 'update'],
26
- description: 'Update Helm repositories',
27
- },
28
- 'cert-manager': {
29
- name: 'cert-manager',
30
- command: 'helm',
31
- args: [
32
- 'upgrade',
33
- '--install',
34
- 'cert-manager',
35
- 'jetstack/cert-manager',
36
- '--namespace',
37
- 'cert-manager',
38
- '--create-namespace',
39
- '--set',
40
- 'crds.enabled=true',
41
- ],
42
- description: 'Certificate management for Kubernetes',
43
- },
44
- 'gateway-api-crds': {
45
- name: 'gateway-api-crds',
46
- command: 'kubectl',
47
- args: [
48
- 'apply',
49
- '-f',
50
- 'https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.3.0/standard-install.yaml',
51
- ],
52
- description: 'Gateway API CRDs',
53
- },
54
- };
55
- /**
56
- * Core ARK services with their installation and status check configurations
57
- */
58
- export const arkServices = {
59
- 'ark-controller': {
60
- name: 'ark-controller',
61
- helmReleaseName: 'ark-controller',
62
- description: 'Core ARK controller for managing AI resources',
63
- enabled: true,
64
- namespace: 'ark-system',
65
- chartPath: `${REGISTRY_BASE}/ark-controller`,
66
- installArgs: ['--create-namespace', '--set', 'rbac.enable=true'],
67
- k8sDeploymentName: 'ark-controller',
68
- k8sDevDeploymentName: 'ark-controller-devspace',
69
- },
70
- 'ark-api': {
71
- name: 'ark-api',
72
- helmReleaseName: 'ark-api',
73
- description: 'ARK API service for interacting with ARK resources',
74
- enabled: true,
75
- // namespace: undefined - uses current context namespace
76
- chartPath: `${REGISTRY_BASE}/ark-api`,
77
- installArgs: [],
78
- k8sServiceName: 'ark-api',
79
- k8sServicePort: 80,
80
- k8sDeploymentName: 'ark-api',
81
- k8sDevDeploymentName: 'ark-api-devspace',
82
- k8sPortForwardLocalPort: 34780,
83
- },
84
- 'ark-dashboard': {
85
- name: 'ark-dashboard',
86
- helmReleaseName: 'ark-dashboard',
87
- description: 'Web-based dashboard for ARK',
88
- enabled: true,
89
- // namespace: undefined - uses current context namespace
90
- chartPath: `${REGISTRY_BASE}/ark-dashboard`,
91
- installArgs: [],
92
- k8sServiceName: 'ark-dashboard',
93
- k8sServicePort: 3000,
94
- k8sDeploymentName: 'ark-dashboard',
95
- k8sDevDeploymentName: 'ark-dashboard-devspace',
96
- k8sPortForwardLocalPort: 3274,
97
- },
98
- 'ark-api-a2a': {
99
- name: 'ark-api-a2a',
100
- helmReleaseName: 'ark-api-a2a',
101
- description: 'ARK API agent-to-agent communication service',
102
- enabled: false, // Disabled - not currently used
103
- // namespace: undefined - uses current context namespace
104
- // Note: This service might be installed as part of ark-api or separately
105
- },
106
- 'ark-mcp': {
107
- name: 'ark-mcp',
108
- helmReleaseName: 'ark-mcp',
109
- description: 'MCP (Model Context Protocol) services for ARK',
110
- enabled: true,
111
- // namespace: undefined - uses current context namespace
112
- chartPath: `${REGISTRY_BASE}/ark-mcp`,
113
- installArgs: [],
114
- k8sDeploymentName: 'ark-mcp',
115
- k8sDevDeploymentName: 'ark-mcp-devspace',
116
- },
117
- 'localhost-gateway': {
118
- name: 'localhost-gateway',
119
- helmReleaseName: 'localhost-gateway',
120
- description: 'Gateway for local cluster access',
121
- enabled: true,
122
- namespace: 'ark-system',
123
- chartPath: `${REGISTRY_BASE}/localhost-gateway`,
124
- installArgs: [],
125
- },
126
- };
127
- /**
128
- * Get services that can be installed via Helm charts (only enabled services)
129
- */
130
- export function getInstallableServices() {
131
- const installable = {};
132
- for (const [key, service] of Object.entries(arkServices)) {
133
- if (service.enabled && service.chartPath) {
134
- installable[key] = service;
135
- }
136
- }
137
- return installable;
138
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,24 +0,0 @@
1
- import { arkDependencies, arkServices, getInstallableServices, } from './arkServices.js';
2
- describe('arkServices', () => {
3
- it('exports arkDependencies with expected structure', () => {
4
- expect(arkDependencies).toBeDefined();
5
- expect(arkDependencies['cert-manager']).toBeDefined();
6
- expect(arkDependencies['cert-manager'].command).toBe('helm');
7
- });
8
- it('exports arkServices with expected structure', () => {
9
- expect(arkServices).toBeDefined();
10
- expect(arkServices['ark-controller']).toBeDefined();
11
- expect(arkServices['ark-controller'].namespace).toBe('ark-system');
12
- // User services should have undefined namespace (use current context)
13
- expect(arkServices['ark-api'].namespace).toBeUndefined();
14
- expect(arkServices['ark-dashboard'].namespace).toBeUndefined();
15
- // System services should have explicit namespace
16
- expect(arkServices['localhost-gateway'].namespace).toBe('ark-system');
17
- });
18
- it('getInstallableServices returns services with chartPath', () => {
19
- const installable = getInstallableServices();
20
- expect(installable['ark-controller']).toBeDefined();
21
- expect(installable['ark-api']).toBeDefined();
22
- expect(installable['ark-api-a2a']).toBeUndefined(); // no chartPath
23
- });
24
- });
@@ -1,5 +0,0 @@
1
- /**
2
- * @deprecated Use arkServices.ts instead. This file is kept for backward compatibility.
3
- * Charts are now defined in arkServices.ts with comprehensive service definitions.
4
- */
5
- export declare const charts: import("../arkServices.js").ServiceCollection;
@@ -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,6 +0,0 @@
1
- import { DependencyCollection } from './types.js';
2
- /**
3
- * Dependencies that should be installed before ARK charts
4
- * Note: Dependencies will be installed in the order they are defined here
5
- */
6
- export declare const dependencies: DependencyCollection;
@@ -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
- };
@@ -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 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- import type { ArkConfig } from '../../lib/config.js';
3
- export declare function createAgentsCommand(_: ArkConfig): Command;
@@ -1,51 +0,0 @@
1
- import { Command } from 'commander';
2
- import { execa } from 'execa';
3
- import output from '../../lib/output.js';
4
- async function listAgents(options) {
5
- try {
6
- // Use kubectl to get agents
7
- const result = await execa('kubectl', ['get', 'agents', '-o', 'json'], {
8
- stdio: 'pipe',
9
- });
10
- const data = JSON.parse(result.stdout);
11
- const agents = data.items || [];
12
- if (options.output === 'json') {
13
- // Output the raw items for JSON format
14
- console.log(JSON.stringify(agents, null, 2));
15
- }
16
- else {
17
- if (agents.length === 0) {
18
- output.warning('no agents available');
19
- return;
20
- }
21
- // Simple list output - just agent names
22
- agents.forEach((agent) => {
23
- console.log(agent.metadata.name);
24
- });
25
- }
26
- }
27
- catch (error) {
28
- output.error('fetching agents:', error instanceof Error ? error.message : error);
29
- process.exit(1);
30
- }
31
- }
32
- export function createAgentsCommand(_) {
33
- const agentsCommand = new Command('agents');
34
- agentsCommand
35
- .description('list available agents')
36
- .alias('agent')
37
- .option('-o, --output <format>', 'output format (json or text)', 'text')
38
- .action(async (options) => {
39
- await listAgents(options);
40
- });
41
- // Add list subcommand (same as default action)
42
- agentsCommand
43
- .command('list')
44
- .alias('ls')
45
- .description('list all available agents')
46
- .option('-o, --output <format>', 'output format (json or text)', 'text')
47
- .action(async (options) => {
48
- await listAgents(options);
49
- });
50
- return agentsCommand;
51
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,67 +0,0 @@
1
- import { jest } from '@jest/globals';
2
- import { Command } from 'commander';
3
- const mockExeca = jest.fn();
4
- jest.unstable_mockModule('execa', () => ({
5
- execa: mockExeca,
6
- }));
7
- const mockOutput = {
8
- warning: jest.fn(),
9
- error: jest.fn(),
10
- };
11
- jest.unstable_mockModule('../../lib/output.js', () => ({
12
- default: mockOutput,
13
- }));
14
- const mockExit = jest.spyOn(process, 'exit').mockImplementation((() => {
15
- throw new Error('process.exit called');
16
- }));
17
- const mockConsoleLog = jest.spyOn(console, 'log').mockImplementation(() => { });
18
- const { createAgentsCommand } = await import('./index.js');
19
- describe('agents command', () => {
20
- beforeEach(() => {
21
- jest.clearAllMocks();
22
- });
23
- it('creates command with correct structure', () => {
24
- const command = createAgentsCommand({});
25
- expect(command).toBeInstanceOf(Command);
26
- expect(command.name()).toBe('agents');
27
- });
28
- it('lists agents in text format', async () => {
29
- const mockAgents = {
30
- items: [{ metadata: { name: 'agent1' } }, { metadata: { name: 'agent2' } }],
31
- };
32
- mockExeca.mockResolvedValue({ stdout: JSON.stringify(mockAgents) });
33
- const command = createAgentsCommand({});
34
- await command.parseAsync(['node', 'test']);
35
- expect(mockExeca).toHaveBeenCalledWith('kubectl', ['get', 'agents', '-o', 'json'], { stdio: 'pipe' });
36
- expect(mockConsoleLog).toHaveBeenCalledWith('agent1');
37
- expect(mockConsoleLog).toHaveBeenCalledWith('agent2');
38
- });
39
- it('lists agents in json format', async () => {
40
- const mockAgents = {
41
- items: [{ metadata: { name: 'agent1' } }],
42
- };
43
- mockExeca.mockResolvedValue({ stdout: JSON.stringify(mockAgents) });
44
- const command = createAgentsCommand({});
45
- await command.parseAsync(['node', 'test', '-o', 'json']);
46
- expect(mockConsoleLog).toHaveBeenCalledWith(JSON.stringify(mockAgents.items, null, 2));
47
- });
48
- it('shows warning when no agents', async () => {
49
- mockExeca.mockResolvedValue({ stdout: JSON.stringify({ items: [] }) });
50
- const command = createAgentsCommand({});
51
- await command.parseAsync(['node', 'test']);
52
- expect(mockOutput.warning).toHaveBeenCalledWith('no agents available');
53
- });
54
- it('handles errors', async () => {
55
- mockExeca.mockRejectedValue(new Error('kubectl failed'));
56
- const command = createAgentsCommand({});
57
- await expect(command.parseAsync(['node', 'test'])).rejects.toThrow('process.exit called');
58
- expect(mockOutput.error).toHaveBeenCalledWith('fetching agents:', 'kubectl failed');
59
- expect(mockExit).toHaveBeenCalledWith(1);
60
- });
61
- it('list subcommand works', async () => {
62
- mockExeca.mockResolvedValue({ stdout: JSON.stringify({ items: [] }) });
63
- const command = createAgentsCommand({});
64
- await command.parseAsync(['node', 'test', 'list']);
65
- expect(mockExeca).toHaveBeenCalled();
66
- });
67
- });
@@ -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
- }
@@ -1,2 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function createAgentsCommand(): Command;
@@ -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
- }
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- import type { ArkConfig } from '../../lib/config.js';
3
- export declare function createChatCommand(config: ArkConfig): Command;
@@ -1,29 +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 output from '../../lib/output.js';
7
- export function createChatCommand(config) {
8
- const chatCommand = new Command('chat');
9
- chatCommand
10
- .description('Start an interactive chat session with ARK agents or models')
11
- .argument('[target]', 'Target to connect to (e.g., agent/sample-agent, model/default)')
12
- .action(async (targetArg) => {
13
- // Direct target argument (e.g., "agent/sample-agent")
14
- const initialTargetId = targetArg;
15
- // Config is passed from main
16
- // Initialize proxy first - no spinner, just let ChatUI handle loading state
17
- try {
18
- const proxy = new ArkApiProxy();
19
- const arkApiClient = await proxy.start();
20
- // Pass the initialized client and config to ChatUI
21
- render(_jsx(ChatUI, { initialTargetId: initialTargetId, arkApiClient: arkApiClient, arkApiProxy: proxy, config: config }));
22
- }
23
- catch (error) {
24
- output.error(error instanceof Error ? error.message : 'ARK API connection failed');
25
- process.exit(1);
26
- }
27
- });
28
- return chatCommand;
29
- }
@@ -1,2 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function createChatCommand(): Command;
@@ -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,2 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function createGetCommand(): Command;
@@ -1,39 +0,0 @@
1
- import { Command } from 'commander';
2
- import output from '../../lib/output.js';
3
- import { getClusterInfo } from '../../lib/cluster.js';
4
- export function createGetCommand() {
5
- const get = new Command('get');
6
- get
7
- .description('get current kubernetes cluster information')
8
- .option('-c, --context <context>', 'kubernetes context to use')
9
- .option('-o, --output <format>', 'output format (text|json)', 'text')
10
- .action(async (options) => {
11
- try {
12
- const clusterInfo = await getClusterInfo(options.context);
13
- if (clusterInfo.error) {
14
- output.error('getting cluster info:', clusterInfo.error);
15
- process.exit(1);
16
- }
17
- if (options.output === 'json') {
18
- console.log(JSON.stringify({
19
- context: clusterInfo.context,
20
- namespace: clusterInfo.namespace,
21
- type: clusterInfo.type,
22
- ip: clusterInfo.ip,
23
- }, null, 2));
24
- }
25
- else {
26
- // Text format (default)
27
- console.log(`context: ${clusterInfo.context}`);
28
- console.log(`namespace: ${clusterInfo.namespace}`);
29
- console.log(`type: ${clusterInfo.type}`);
30
- console.log(`ip: ${clusterInfo.ip || 'unknown'}`);
31
- }
32
- }
33
- catch (error) {
34
- output.error('failed to get cluster info:', error instanceof Error ? error.message : 'Unknown error');
35
- process.exit(1);
36
- }
37
- });
38
- return get;
39
- }
@@ -1 +0,0 @@
1
- export {};