@agents-at-scale/ark 0.1.42 → 0.1.44

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 (51) hide show
  1. package/dist/arkServices.js +12 -18
  2. package/dist/commands/completion/index.js +38 -3
  3. package/dist/commands/evaluation/index.spec.js +1 -6
  4. package/dist/commands/generate/generators/project.js +3 -3
  5. package/dist/commands/generate/generators/team.js +4 -1
  6. package/dist/commands/generate/index.js +2 -2
  7. package/dist/commands/install/index.js +27 -0
  8. package/dist/commands/marketplace/index.d.ts +4 -0
  9. package/dist/commands/marketplace/index.js +50 -0
  10. package/dist/commands/models/create.js +1 -1
  11. package/dist/commands/models/create.spec.js +6 -2
  12. package/dist/commands/models/providers/azure.spec.js +3 -1
  13. package/dist/commands/queries/delete.d.ts +7 -0
  14. package/dist/commands/queries/delete.js +24 -0
  15. package/dist/commands/queries/delete.spec.d.ts +1 -0
  16. package/dist/commands/queries/delete.spec.js +74 -0
  17. package/dist/commands/queries/index.js +42 -4
  18. package/dist/commands/queries/list.d.ts +6 -0
  19. package/dist/commands/queries/list.js +66 -0
  20. package/dist/commands/queries/list.spec.d.ts +1 -0
  21. package/dist/commands/queries/list.spec.js +170 -0
  22. package/dist/commands/queries/validation.d.ts +2 -0
  23. package/dist/commands/queries/validation.js +10 -0
  24. package/dist/commands/queries/validation.spec.d.ts +1 -0
  25. package/dist/commands/queries/validation.spec.js +27 -0
  26. package/dist/commands/query/index.js +2 -0
  27. package/dist/commands/query/index.spec.js +24 -0
  28. package/dist/commands/uninstall/index.js +27 -0
  29. package/dist/components/ChatUI.js +14 -4
  30. package/dist/index.js +2 -0
  31. package/dist/lib/arkApiClient.js +2 -0
  32. package/dist/lib/chatClient.d.ts +4 -0
  33. package/dist/lib/chatClient.js +23 -7
  34. package/dist/lib/chatClient.spec.d.ts +1 -0
  35. package/dist/lib/chatClient.spec.js +108 -0
  36. package/dist/lib/constants.d.ts +3 -0
  37. package/dist/lib/constants.js +8 -0
  38. package/dist/lib/executeQuery.d.ts +1 -4
  39. package/dist/lib/executeQuery.js +103 -104
  40. package/dist/lib/executeQuery.spec.js +218 -99
  41. package/dist/lib/kubectl.d.ts +7 -0
  42. package/dist/lib/kubectl.js +27 -0
  43. package/dist/lib/kubectl.spec.js +89 -1
  44. package/dist/lib/types.d.ts +22 -7
  45. package/dist/marketplaceServices.d.ts +15 -0
  46. package/dist/marketplaceServices.js +51 -0
  47. package/package.json +1 -1
  48. package/templates/models/azure.yaml +1 -1
  49. package/templates/project/Makefile +1 -1
  50. package/templates/project/README.md +1 -1
  51. package/templates/project/scripts/setup.sh +2 -2
@@ -18,3 +18,30 @@ export async function getResource(resourceType, name) {
18
18
  const result = await execa('kubectl', ['get', resourceType, name, '-o', 'json'], { stdio: 'pipe' });
19
19
  return JSON.parse(result.stdout);
20
20
  }
21
+ export async function listResources(resourceType, options) {
22
+ const args = ['get', resourceType];
23
+ if (options?.sortBy) {
24
+ args.push(`--sort-by=${options.sortBy}`);
25
+ }
26
+ args.push('-o', 'json');
27
+ const result = await execa('kubectl', args, { stdio: 'pipe' });
28
+ const data = JSON.parse(result.stdout);
29
+ return data.items || [];
30
+ }
31
+ export async function deleteResource(resourceType, name, options) {
32
+ const args = ['delete', resourceType];
33
+ if (options?.all) {
34
+ args.push('--all');
35
+ }
36
+ else if (name) {
37
+ args.push(name);
38
+ }
39
+ await execa('kubectl', args, { stdio: 'pipe' });
40
+ }
41
+ export async function replaceResource(resource) {
42
+ const result = await execa('kubectl', ['replace', '-f', '-', '-o', 'json'], {
43
+ input: JSON.stringify(resource),
44
+ stdio: ['pipe', 'pipe', 'pipe'],
45
+ });
46
+ return JSON.parse(result.stdout);
47
+ }
@@ -3,7 +3,7 @@ const mockExeca = jest.fn();
3
3
  jest.unstable_mockModule('execa', () => ({
4
4
  execa: mockExeca,
5
5
  }));
6
- const { getResource } = await import('./kubectl.js');
6
+ const { getResource, listResources, deleteResource } = await import('./kubectl.js');
7
7
  describe('kubectl', () => {
8
8
  beforeEach(() => {
9
9
  jest.clearAllMocks();
@@ -85,4 +85,92 @@ describe('kubectl', () => {
85
85
  expect(mockExeca).toHaveBeenCalledWith('kubectl', ['get', 'agents', 'test-agent', '-o', 'json'], { stdio: 'pipe' });
86
86
  });
87
87
  });
88
+ describe('listResources', () => {
89
+ it('should list all resources of a given type', async () => {
90
+ const mockResources = [
91
+ {
92
+ metadata: {
93
+ name: 'query-1',
94
+ creationTimestamp: '2024-01-01T00:00:00Z',
95
+ },
96
+ spec: {
97
+ value: 'test1',
98
+ },
99
+ },
100
+ {
101
+ metadata: {
102
+ name: 'query-2',
103
+ creationTimestamp: '2024-01-02T00:00:00Z',
104
+ },
105
+ spec: {
106
+ value: 'test2',
107
+ },
108
+ },
109
+ ];
110
+ mockExeca.mockResolvedValue({
111
+ stdout: JSON.stringify({ items: mockResources }),
112
+ });
113
+ const result = await listResources('queries');
114
+ expect(result).toEqual(mockResources);
115
+ expect(mockExeca).toHaveBeenCalledWith('kubectl', ['get', 'queries', '-o', 'json'], { stdio: 'pipe' });
116
+ });
117
+ it('should return an empty array when no resources exist', async () => {
118
+ mockExeca.mockResolvedValue({
119
+ stdout: JSON.stringify({ items: [] }),
120
+ });
121
+ const result = await listResources('queries');
122
+ expect(result).toEqual([]);
123
+ expect(mockExeca).toHaveBeenCalledWith('kubectl', ['get', 'queries', '-o', 'json'], { stdio: 'pipe' });
124
+ });
125
+ it('should list resources with custom sort option', async () => {
126
+ const mockResources = [
127
+ {
128
+ metadata: {
129
+ name: 'query-1',
130
+ creationTimestamp: '2024-01-01T00:00:00Z',
131
+ },
132
+ },
133
+ {
134
+ metadata: {
135
+ name: 'query-2',
136
+ creationTimestamp: '2024-01-02T00:00:00Z',
137
+ },
138
+ },
139
+ ];
140
+ mockExeca.mockResolvedValue({
141
+ stdout: JSON.stringify({ items: mockResources }),
142
+ });
143
+ const result = await listResources('queries', {
144
+ sortBy: '.metadata.creationTimestamp',
145
+ });
146
+ expect(result).toEqual(mockResources);
147
+ expect(mockExeca).toHaveBeenCalledWith('kubectl', [
148
+ 'get',
149
+ 'queries',
150
+ '--sort-by=.metadata.creationTimestamp',
151
+ '-o',
152
+ 'json',
153
+ ], { stdio: 'pipe' });
154
+ });
155
+ it('should handle kubectl errors when listing resources', async () => {
156
+ mockExeca.mockRejectedValue(new Error('kubectl connection error'));
157
+ await expect(listResources('queries')).rejects.toThrow('kubectl connection error');
158
+ });
159
+ });
160
+ describe('deleteResource', () => {
161
+ it('should delete a resource by name', async () => {
162
+ mockExeca.mockResolvedValue({
163
+ stdout: '',
164
+ });
165
+ await deleteResource('queries', 'test-query');
166
+ expect(mockExeca).toHaveBeenCalledWith('kubectl', ['delete', 'queries', 'test-query'], { stdio: 'pipe' });
167
+ });
168
+ it('should delete all resources of a type when all option is true', async () => {
169
+ mockExeca.mockResolvedValue({
170
+ stdout: '',
171
+ });
172
+ await deleteResource('queries', undefined, { all: true });
173
+ expect(mockExeca).toHaveBeenCalledWith('kubectl', ['delete', 'queries', '--all'], { stdio: 'pipe' });
174
+ });
175
+ });
88
176
  });
@@ -94,6 +94,25 @@ export interface QueryTarget {
94
94
  }
95
95
  export interface QueryResponse {
96
96
  content?: string;
97
+ a2a?: {
98
+ contextId?: string;
99
+ };
100
+ }
101
+ export interface QueryStatus {
102
+ phase?: 'initializing' | 'running' | 'done' | 'error' | 'canceled';
103
+ conditions?: K8sCondition[];
104
+ responses?: QueryResponse[];
105
+ message?: string;
106
+ error?: string;
107
+ tokenUsage?: {
108
+ promptTokens?: number;
109
+ completionTokens?: number;
110
+ totalTokens?: number;
111
+ };
112
+ a2a?: {
113
+ contextId?: string;
114
+ taskId?: string;
115
+ };
97
116
  }
98
117
  export interface Query {
99
118
  apiVersion: string;
@@ -102,14 +121,10 @@ export interface Query {
102
121
  spec?: {
103
122
  input: string;
104
123
  targets: QueryTarget[];
124
+ sessionId?: string;
125
+ timeout?: string;
105
126
  };
106
- status?: {
107
- phase?: 'initializing' | 'running' | 'done' | 'error' | 'canceled';
108
- conditions?: K8sCondition[];
109
- responses?: QueryResponse[];
110
- message?: string;
111
- error?: string;
112
- };
127
+ status?: QueryStatus;
113
128
  }
114
129
  export interface Tool {
115
130
  metadata: K8sMetadata;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Marketplace service definitions for external ARK marketplace resources
3
+ * Repository: https://github.com/mckinsey/agents-at-scale-marketplace
4
+ * Charts are installed from the public OCI registry
5
+ */
6
+ import type { ArkService, ServiceCollection } from './types/arkService.js';
7
+ /**
8
+ * Available marketplace services
9
+ * Charts are published to: oci://ghcr.io/mckinsey/agents-at-scale-marketplace/charts
10
+ */
11
+ export declare const marketplaceServices: ServiceCollection;
12
+ export declare function getMarketplaceService(name: string): ArkService | undefined;
13
+ export declare function getAllMarketplaceServices(): ServiceCollection;
14
+ export declare function isMarketplaceService(name: string): boolean;
15
+ export declare function extractMarketplaceServiceName(path: string): string;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Marketplace service definitions for external ARK marketplace resources
3
+ * Repository: https://github.com/mckinsey/agents-at-scale-marketplace
4
+ * Charts are installed from the public OCI registry
5
+ */
6
+ const MARKETPLACE_REGISTRY = 'oci://ghcr.io/mckinsey/agents-at-scale-marketplace/charts';
7
+ /**
8
+ * Available marketplace services
9
+ * Charts are published to: oci://ghcr.io/mckinsey/agents-at-scale-marketplace/charts
10
+ */
11
+ export const marketplaceServices = {
12
+ phoenix: {
13
+ name: 'phoenix',
14
+ helmReleaseName: 'phoenix',
15
+ description: 'AI/ML observability and evaluation platform with OpenTelemetry integration',
16
+ enabled: true,
17
+ category: 'marketplace',
18
+ namespace: 'phoenix',
19
+ chartPath: `${MARKETPLACE_REGISTRY}/phoenix`,
20
+ installArgs: ['--create-namespace'],
21
+ k8sServiceName: 'phoenix',
22
+ k8sServicePort: 6006,
23
+ k8sDeploymentName: 'phoenix',
24
+ },
25
+ langfuse: {
26
+ name: 'langfuse',
27
+ helmReleaseName: 'langfuse',
28
+ description: 'Open-source LLM observability and analytics platform with session tracking',
29
+ enabled: true,
30
+ category: 'marketplace',
31
+ namespace: 'telemetry',
32
+ chartPath: `${MARKETPLACE_REGISTRY}/langfuse`,
33
+ installArgs: ['--create-namespace'],
34
+ k8sServiceName: 'langfuse',
35
+ k8sServicePort: 3000,
36
+ k8sDeploymentName: 'langfuse-web',
37
+ },
38
+ };
39
+ export function getMarketplaceService(name) {
40
+ return marketplaceServices[name];
41
+ }
42
+ export function getAllMarketplaceServices() {
43
+ return marketplaceServices;
44
+ }
45
+ export function isMarketplaceService(name) {
46
+ return name.startsWith('marketplace/services/');
47
+ }
48
+ export function extractMarketplaceServiceName(path) {
49
+ // Extract service name from marketplace/services/phoenix
50
+ return path.replace(/^marketplace\/services\//, '');
51
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agents-at-scale/ark",
3
- "version": "0.1.42",
3
+ "version": "0.1.44",
4
4
  "description": "Ark CLI - Interactive terminal interface for ARK agents",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -7,7 +7,7 @@ stringData:
7
7
  # IMPORTANT: Environment variables must be substituted before applying
8
8
  # Use one of these methods:
9
9
  # 1. make models-apply (recommended)
10
- # 2. make quickstart (full deployment)
10
+ # 2. devspace dev (full deployment)
11
11
  # 3. make fix-models (if you have broken queries)
12
12
  # Manual: export AZURE_API_KEY="key" && envsubst < models/{{ .Values.modelName }}.yaml | kubectl apply -f -
13
13
  token: ${AZURE_API_KEY}
@@ -29,7 +29,7 @@ DOCKER_BUILD_DIR := $(OUT_DIR)/docker
29
29
  .PHONY: help
30
30
  help: ## Show this help message
31
31
  @echo "🚀 Quick Commands:"
32
- @echo " make quickstart # 5-minute setup with proper resource dependency handling"
32
+ @echo " devspace dev # Deploy ARK to cluster"
33
33
  @echo " make resources-apply # Apply all custom resources in correct order"
34
34
  @echo " make fix-models # Fix broken models (if you have query errors)"
35
35
  @echo ""
@@ -12,7 +12,7 @@ cd {{ .Values.projectName }}
12
12
  source .env # Edit this file first with your API keys
13
13
 
14
14
  # 3. Deploy to your ARK cluster
15
- make quickstart
15
+ devspace dev
16
16
 
17
17
  # 4. Check your deployment
18
18
  kubectl get agents,teams,queries --namespace {{ .Values.namespace }}
@@ -104,5 +104,5 @@ echo -e "${BLUE}Next steps:${NC}"
104
104
  echo " make install # Deploy to Kubernetes"
105
105
  echo " make status # Check deployment"
106
106
  echo ""
107
- echo "Or use the quick start:"
108
- echo " make quickstart # One-command deploy"
107
+ echo "Or use ARK CLI for deployment:"
108
+ echo " devspace dev # Local development"