@agents-at-scale/ark 0.1.34 → 0.1.35-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.
Files changed (205) hide show
  1. package/dist/arkServices.d.ts +42 -0
  2. package/dist/arkServices.js +138 -0
  3. package/dist/arkServices.spec.d.ts +1 -0
  4. package/dist/arkServices.spec.js +24 -0
  5. package/dist/charts/charts.d.ts +5 -0
  6. package/dist/charts/charts.js +6 -0
  7. package/dist/charts/dependencies.d.ts +6 -0
  8. package/dist/charts/dependencies.js +50 -0
  9. package/dist/charts/types.d.ts +40 -0
  10. package/dist/charts/types.js +1 -0
  11. package/dist/commands/agents/index.d.ts +3 -0
  12. package/dist/commands/agents/index.js +51 -0
  13. package/dist/commands/agents/index.spec.d.ts +1 -0
  14. package/dist/commands/agents/index.spec.js +67 -0
  15. package/dist/commands/agents/selector.d.ts +8 -0
  16. package/dist/commands/agents/selector.js +53 -0
  17. package/dist/commands/agents.d.ts +2 -0
  18. package/dist/commands/agents.js +53 -0
  19. package/dist/commands/chat/index.d.ts +3 -0
  20. package/dist/commands/chat/index.js +29 -0
  21. package/dist/commands/chat.d.ts +2 -0
  22. package/dist/commands/chat.js +45 -0
  23. package/dist/commands/cluster/get.d.ts +2 -0
  24. package/dist/commands/cluster/get.js +39 -0
  25. package/dist/commands/cluster/get.spec.d.ts +1 -0
  26. package/dist/commands/cluster/get.spec.js +92 -0
  27. package/dist/commands/cluster/index.d.ts +2 -1
  28. package/dist/commands/cluster/index.js +3 -5
  29. package/dist/commands/cluster/index.spec.d.ts +1 -0
  30. package/dist/commands/cluster/index.spec.js +24 -0
  31. package/dist/commands/completion/index.d.ts +3 -0
  32. package/dist/commands/completion/index.js +268 -0
  33. package/dist/commands/completion/index.spec.d.ts +1 -0
  34. package/dist/commands/completion/index.spec.js +34 -0
  35. package/dist/commands/completion.js +159 -2
  36. package/dist/commands/config/index.d.ts +3 -0
  37. package/dist/commands/config/index.js +42 -0
  38. package/dist/commands/config/index.spec.d.ts +1 -0
  39. package/dist/commands/config/index.spec.js +78 -0
  40. package/dist/commands/config.d.ts +0 -3
  41. package/dist/commands/config.js +38 -321
  42. package/dist/commands/dashboard/index.d.ts +4 -0
  43. package/dist/commands/dashboard/index.js +39 -0
  44. package/dist/commands/dashboard.d.ts +3 -0
  45. package/dist/commands/dashboard.js +39 -0
  46. package/dist/commands/dev/index.d.ts +3 -0
  47. package/dist/commands/dev/index.js +9 -0
  48. package/dist/commands/dev/tool/check.d.ts +2 -0
  49. package/dist/commands/dev/tool/check.js +142 -0
  50. package/dist/commands/dev/tool/clean.d.ts +2 -0
  51. package/dist/commands/dev/tool/clean.js +153 -0
  52. package/dist/commands/dev/tool/generate.d.ts +2 -0
  53. package/dist/commands/dev/tool/generate.js +28 -0
  54. package/dist/commands/dev/tool/index.d.ts +2 -0
  55. package/dist/commands/dev/tool/index.js +14 -0
  56. package/dist/commands/dev/tool/init.d.ts +2 -0
  57. package/dist/commands/dev/tool/init.js +320 -0
  58. package/dist/commands/dev/tool/shared.d.ts +5 -0
  59. package/dist/commands/dev/tool/shared.js +256 -0
  60. package/dist/commands/dev/tool/status.d.ts +2 -0
  61. package/dist/commands/dev/tool/status.js +136 -0
  62. package/dist/commands/dev/tool-generate.spec.d.ts +1 -0
  63. package/dist/commands/dev/tool-generate.spec.js +163 -0
  64. package/dist/commands/dev/tool.d.ts +2 -0
  65. package/dist/commands/dev/tool.js +559 -0
  66. package/dist/commands/dev/tool.spec.d.ts +1 -0
  67. package/dist/commands/dev/tool.spec.js +48 -0
  68. package/dist/commands/generate/config.js +5 -24
  69. package/dist/commands/generate/generators/mcpserver.d.ts +2 -1
  70. package/dist/commands/generate/generators/mcpserver.js +26 -5
  71. package/dist/commands/generate/generators/project.js +22 -41
  72. package/dist/commands/generate/index.d.ts +2 -1
  73. package/dist/commands/generate/index.js +1 -1
  74. package/dist/commands/install/index.d.ts +8 -0
  75. package/dist/commands/install/index.js +302 -0
  76. package/dist/commands/install/index.spec.d.ts +1 -0
  77. package/dist/commands/install/index.spec.js +135 -0
  78. package/dist/commands/install.d.ts +3 -0
  79. package/dist/commands/install.js +147 -0
  80. package/dist/commands/models/create.d.ts +1 -0
  81. package/dist/commands/models/create.js +213 -0
  82. package/dist/commands/models/create.spec.d.ts +1 -0
  83. package/dist/commands/models/create.spec.js +125 -0
  84. package/dist/commands/models/index.d.ts +3 -0
  85. package/dist/commands/models/index.js +60 -0
  86. package/dist/commands/models/index.spec.d.ts +1 -0
  87. package/dist/commands/models/index.spec.js +76 -0
  88. package/dist/commands/models/selector.d.ts +8 -0
  89. package/dist/commands/models/selector.js +53 -0
  90. package/dist/commands/routes/index.d.ts +3 -0
  91. package/dist/commands/routes/index.js +93 -0
  92. package/dist/commands/routes.d.ts +2 -0
  93. package/dist/commands/routes.js +101 -0
  94. package/dist/commands/status/index.d.ts +4 -0
  95. package/dist/commands/status/index.js +232 -0
  96. package/dist/commands/status.d.ts +3 -0
  97. package/dist/commands/status.js +33 -0
  98. package/dist/commands/targets/index.d.ts +3 -0
  99. package/dist/commands/targets/index.js +65 -0
  100. package/dist/commands/targets/index.spec.d.ts +1 -0
  101. package/dist/commands/targets/index.spec.js +105 -0
  102. package/dist/commands/targets.d.ts +2 -0
  103. package/dist/commands/targets.js +65 -0
  104. package/dist/commands/teams/index.d.ts +3 -0
  105. package/dist/commands/teams/index.js +49 -0
  106. package/dist/commands/teams/index.spec.d.ts +1 -0
  107. package/dist/commands/teams/index.spec.js +70 -0
  108. package/dist/commands/teams/selector.d.ts +8 -0
  109. package/dist/commands/teams/selector.js +55 -0
  110. package/dist/commands/tools/index.d.ts +3 -0
  111. package/dist/commands/tools/index.js +49 -0
  112. package/dist/commands/tools/index.spec.d.ts +1 -0
  113. package/dist/commands/tools/index.spec.js +70 -0
  114. package/dist/commands/tools/selector.d.ts +8 -0
  115. package/dist/commands/tools/selector.js +53 -0
  116. package/dist/commands/uninstall/index.d.ts +3 -0
  117. package/dist/commands/uninstall/index.js +107 -0
  118. package/dist/commands/uninstall/index.spec.d.ts +1 -0
  119. package/dist/commands/uninstall/index.spec.js +117 -0
  120. package/dist/commands/uninstall.d.ts +2 -0
  121. package/dist/commands/uninstall.js +83 -0
  122. package/dist/components/ChatUI.d.ts +16 -0
  123. package/dist/components/ChatUI.js +801 -0
  124. package/dist/components/StatusView.d.ts +10 -0
  125. package/dist/components/StatusView.js +39 -0
  126. package/dist/components/statusChecker.d.ts +13 -23
  127. package/dist/components/statusChecker.js +275 -129
  128. package/dist/config.d.ts +3 -22
  129. package/dist/config.js +10 -161
  130. package/dist/index.d.ts +1 -1
  131. package/dist/index.js +40 -42
  132. package/dist/lib/arkApiClient.d.ts +53 -0
  133. package/dist/lib/arkApiClient.js +102 -0
  134. package/dist/lib/arkApiProxy.d.ts +9 -0
  135. package/dist/lib/arkApiProxy.js +22 -0
  136. package/dist/lib/arkServiceProxy.d.ts +14 -0
  137. package/dist/lib/arkServiceProxy.js +95 -0
  138. package/dist/lib/arkStatus.d.ts +10 -0
  139. package/dist/lib/arkStatus.js +79 -0
  140. package/dist/lib/arkStatus.spec.d.ts +1 -0
  141. package/dist/lib/arkStatus.spec.js +49 -0
  142. package/dist/lib/chatClient.d.ts +33 -0
  143. package/dist/lib/chatClient.js +99 -0
  144. package/dist/lib/cluster.d.ts +2 -1
  145. package/dist/lib/cluster.js +37 -16
  146. package/dist/lib/cluster.spec.d.ts +1 -0
  147. package/dist/lib/cluster.spec.js +338 -0
  148. package/dist/lib/commandUtils.d.ts +4 -0
  149. package/dist/lib/commandUtils.js +18 -0
  150. package/dist/lib/commandUtils.test.d.ts +1 -0
  151. package/dist/lib/commandUtils.test.js +44 -0
  152. package/dist/lib/commands.d.ts +16 -0
  153. package/dist/lib/commands.js +29 -0
  154. package/dist/lib/commands.spec.d.ts +1 -0
  155. package/dist/lib/commands.spec.js +146 -0
  156. package/dist/lib/config.d.ts +26 -80
  157. package/dist/lib/config.js +70 -205
  158. package/dist/lib/config.spec.d.ts +1 -0
  159. package/dist/lib/config.spec.js +99 -0
  160. package/dist/lib/config.test.d.ts +1 -0
  161. package/dist/lib/config.test.js +93 -0
  162. package/dist/lib/consts.d.ts +0 -1
  163. package/dist/lib/consts.js +0 -2
  164. package/dist/lib/consts.spec.d.ts +1 -0
  165. package/dist/lib/consts.spec.js +15 -0
  166. package/dist/lib/dev/tools/analyzer.d.ts +30 -0
  167. package/dist/lib/dev/tools/analyzer.js +190 -0
  168. package/dist/lib/dev/tools/discover_tools.py +392 -0
  169. package/dist/lib/dev/tools/mcp-types.d.ts +28 -0
  170. package/dist/lib/dev/tools/mcp-types.js +86 -0
  171. package/dist/lib/dev/tools/types.d.ts +50 -0
  172. package/dist/lib/dev/tools/types.js +1 -0
  173. package/dist/lib/errors.js +1 -1
  174. package/dist/lib/errors.spec.d.ts +1 -0
  175. package/dist/lib/errors.spec.js +221 -0
  176. package/dist/lib/exec.d.ts +0 -4
  177. package/dist/lib/exec.js +0 -11
  178. package/dist/lib/output.d.ts +36 -0
  179. package/dist/lib/output.js +89 -0
  180. package/dist/lib/output.spec.d.ts +1 -0
  181. package/dist/lib/output.spec.js +123 -0
  182. package/dist/lib/portUtils.d.ts +8 -0
  183. package/dist/lib/portUtils.js +39 -0
  184. package/dist/lib/startup.d.ts +5 -0
  185. package/dist/lib/startup.js +73 -0
  186. package/dist/lib/startup.spec.d.ts +1 -0
  187. package/dist/lib/startup.spec.js +168 -0
  188. package/dist/lib/types.d.ts +10 -3
  189. package/dist/types/types.d.ts +40 -0
  190. package/dist/types/types.js +1 -0
  191. package/dist/ui/AgentSelector.d.ts +8 -0
  192. package/dist/ui/AgentSelector.js +53 -0
  193. package/dist/ui/MainMenu.d.ts +5 -1
  194. package/dist/ui/MainMenu.js +222 -91
  195. package/dist/ui/ModelSelector.d.ts +8 -0
  196. package/dist/ui/ModelSelector.js +53 -0
  197. package/dist/ui/TeamSelector.d.ts +8 -0
  198. package/dist/ui/TeamSelector.js +55 -0
  199. package/dist/ui/ToolSelector.d.ts +8 -0
  200. package/dist/ui/ToolSelector.js +53 -0
  201. package/dist/ui/statusFormatter.d.ts +22 -7
  202. package/dist/ui/statusFormatter.js +39 -39
  203. package/dist/ui/statusFormatter.spec.d.ts +1 -0
  204. package/dist/ui/statusFormatter.spec.js +58 -0
  205. package/package.json +17 -5
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Centralized ARK service definitions used by both install and status commands
3
+ */
4
+ export interface ArkService {
5
+ name: string;
6
+ helmReleaseName: string;
7
+ description: string;
8
+ enabled: boolean;
9
+ namespace?: string;
10
+ chartPath?: string;
11
+ installArgs?: string[];
12
+ k8sServiceName?: string;
13
+ k8sServicePort?: number;
14
+ k8sPortForwardLocalPort?: number;
15
+ k8sDeploymentName?: string;
16
+ k8sDevDeploymentName?: string;
17
+ }
18
+ export interface ServiceCollection {
19
+ [key: string]: ArkService;
20
+ }
21
+ export interface ArkDependency {
22
+ name: string;
23
+ command: string;
24
+ args: string[];
25
+ description: string;
26
+ }
27
+ export interface DependencyCollection {
28
+ [key: string]: ArkDependency;
29
+ }
30
+ /**
31
+ * Dependencies that should be installed before ARK services
32
+ * Note: Dependencies will be installed in the order they are defined here
33
+ */
34
+ export declare const arkDependencies: DependencyCollection;
35
+ /**
36
+ * Core ARK services with their installation and status check configurations
37
+ */
38
+ export declare const arkServices: ServiceCollection;
39
+ /**
40
+ * Get services that can be installed via Helm charts (only enabled services)
41
+ */
42
+ export declare function getInstallableServices(): ServiceCollection;
@@ -0,0 +1,138 @@
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
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
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
+ });
@@ -0,0 +1,5 @@
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;
@@ -0,0 +1,6 @@
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();
@@ -0,0 +1,6 @@
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;
@@ -0,0 +1,50 @@
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
+ };
@@ -0,0 +1,40 @@
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
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ import type { ArkConfig } from '../../lib/config.js';
3
+ export declare function createAgentsCommand(_: ArkConfig): Command;
@@ -0,0 +1,51 @@
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
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,67 @@
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
+ });
@@ -0,0 +1,8 @@
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 {};
@@ -0,0 +1,53 @@
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
+ }
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function createAgentsCommand(): Command;
@@ -0,0 +1,53 @@
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
+ }
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ import type { ArkConfig } from '../../lib/config.js';
3
+ export declare function createChatCommand(config: ArkConfig): Command;
@@ -0,0 +1,29 @@
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
+ }
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function createChatCommand(): Command;
@@ -0,0 +1,45 @@
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
+ }
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function createGetCommand(): Command;