@agents-at-scale/ark 0.1.41 → 0.1.43

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 (79) hide show
  1. package/dist/arkServices.js +0 -9
  2. package/dist/commands/completion/index.js +46 -1
  3. package/dist/commands/evaluation/index.d.ts +3 -0
  4. package/dist/commands/evaluation/index.js +60 -0
  5. package/dist/commands/evaluation/index.spec.d.ts +1 -0
  6. package/dist/commands/evaluation/index.spec.js +161 -0
  7. package/dist/commands/generate/generators/team.js +4 -1
  8. package/dist/commands/install/index.js +27 -0
  9. package/dist/commands/marketplace/index.d.ts +4 -0
  10. package/dist/commands/marketplace/index.js +50 -0
  11. package/dist/commands/memory/index.d.ts +15 -0
  12. package/dist/commands/memory/index.js +130 -0
  13. package/dist/commands/memory/index.spec.d.ts +1 -0
  14. package/dist/commands/memory/index.spec.js +124 -0
  15. package/dist/commands/models/create.d.ts +5 -6
  16. package/dist/commands/models/create.js +14 -119
  17. package/dist/commands/models/create.spec.js +51 -0
  18. package/dist/commands/models/kubernetes/manifest-builder.d.ts +11 -0
  19. package/dist/commands/models/kubernetes/manifest-builder.js +109 -0
  20. package/dist/commands/models/kubernetes/secret-manager.d.ts +7 -0
  21. package/dist/commands/models/kubernetes/secret-manager.js +20 -0
  22. package/dist/commands/models/providers/azure.d.ts +31 -0
  23. package/dist/commands/models/providers/azure.js +82 -0
  24. package/dist/commands/models/providers/azure.spec.d.ts +1 -0
  25. package/dist/commands/models/providers/azure.spec.js +232 -0
  26. package/dist/commands/models/providers/bedrock.d.ts +37 -0
  27. package/dist/commands/models/providers/bedrock.js +105 -0
  28. package/dist/commands/models/providers/bedrock.spec.d.ts +1 -0
  29. package/dist/commands/models/providers/bedrock.spec.js +241 -0
  30. package/dist/commands/models/providers/factory.d.ts +18 -0
  31. package/dist/commands/models/providers/factory.js +31 -0
  32. package/dist/commands/models/providers/index.d.ts +17 -0
  33. package/dist/commands/models/providers/index.js +9 -0
  34. package/dist/commands/models/providers/openai.d.ts +28 -0
  35. package/dist/commands/models/providers/openai.js +68 -0
  36. package/dist/commands/models/providers/openai.spec.d.ts +1 -0
  37. package/dist/commands/models/providers/openai.spec.js +180 -0
  38. package/dist/commands/models/providers/types.d.ts +51 -0
  39. package/dist/commands/models/providers/types.js +1 -0
  40. package/dist/commands/queries/delete.d.ts +7 -0
  41. package/dist/commands/queries/delete.js +24 -0
  42. package/dist/commands/queries/delete.spec.d.ts +1 -0
  43. package/dist/commands/queries/delete.spec.js +74 -0
  44. package/dist/commands/queries/index.d.ts +3 -0
  45. package/dist/commands/queries/index.js +108 -0
  46. package/dist/commands/queries/list.d.ts +6 -0
  47. package/dist/commands/queries/list.js +66 -0
  48. package/dist/commands/queries/list.spec.d.ts +1 -0
  49. package/dist/commands/queries/list.spec.js +170 -0
  50. package/dist/commands/queries/validation.d.ts +2 -0
  51. package/dist/commands/queries/validation.js +10 -0
  52. package/dist/commands/queries/validation.spec.d.ts +1 -0
  53. package/dist/commands/queries/validation.spec.js +27 -0
  54. package/dist/commands/query/index.js +3 -1
  55. package/dist/commands/query/index.spec.js +24 -0
  56. package/dist/commands/uninstall/index.js +27 -0
  57. package/dist/components/ChatUI.js +2 -0
  58. package/dist/index.js +8 -0
  59. package/dist/lib/arkApiClient.d.ts +4 -0
  60. package/dist/lib/arkApiClient.js +57 -0
  61. package/dist/lib/errors.d.ts +1 -0
  62. package/dist/lib/errors.js +1 -0
  63. package/dist/lib/executeEvaluation.d.ts +16 -0
  64. package/dist/lib/executeEvaluation.js +155 -0
  65. package/dist/lib/executeQuery.d.ts +1 -4
  66. package/dist/lib/executeQuery.js +98 -68
  67. package/dist/lib/executeQuery.spec.js +176 -99
  68. package/dist/lib/kubectl.d.ts +15 -0
  69. package/dist/lib/kubectl.js +47 -0
  70. package/dist/lib/kubectl.spec.d.ts +1 -0
  71. package/dist/lib/kubectl.spec.js +176 -0
  72. package/dist/lib/stdin.d.ts +1 -0
  73. package/dist/lib/stdin.js +16 -0
  74. package/dist/lib/stdin.spec.d.ts +1 -0
  75. package/dist/lib/stdin.spec.js +82 -0
  76. package/dist/lib/types.d.ts +39 -0
  77. package/dist/marketplaceServices.d.ts +15 -0
  78. package/dist/marketplaceServices.js +51 -0
  79. package/package.json +2 -1
@@ -107,15 +107,6 @@ const defaultArkServices = {
107
107
  k8sDevDeploymentName: 'ark-dashboard-devspace',
108
108
  k8sPortForwardLocalPort: 3274,
109
109
  },
110
- 'ark-api-a2a': {
111
- name: 'ark-api-a2a',
112
- helmReleaseName: 'ark-api-a2a',
113
- description: 'Ark API agent-to-agent communication service',
114
- enabled: false, // Disabled - not currently used
115
- category: 'service',
116
- // namespace: undefined - uses current context namespace
117
- // Note: This service might be installed as part of ark-api or separately
118
- },
119
110
  'ark-mcp': {
120
111
  name: 'ark-mcp',
121
112
  helmReleaseName: 'ark-mcp',
@@ -28,7 +28,7 @@ _ark_completion() {
28
28
 
29
29
  case \${COMP_CWORD} in
30
30
  1)
31
- opts="agents chat cluster completion config dashboard docs generate install models query routes status targets teams tools uninstall help"
31
+ opts="agents chat cluster completion config dashboard docs generate install marketplace models queries query routes status targets teams tools uninstall help"
32
32
  COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
33
33
  return 0
34
34
  ;;
@@ -79,6 +79,23 @@ _ark_completion() {
79
79
  COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
80
80
  return 0
81
81
  ;;
82
+ marketplace)
83
+ opts="list ls"
84
+ COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
85
+ return 0
86
+ ;;
87
+ install)
88
+ # Suggest marketplace services with marketplace/services/ prefix
89
+ opts="marketplace/services/phoenix marketplace/services/langfuse"
90
+ COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
91
+ return 0
92
+ ;;
93
+ uninstall)
94
+ # Suggest marketplace services with marketplace/services/ prefix
95
+ opts="marketplace/services/phoenix marketplace/services/langfuse"
96
+ COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
97
+ return 0
98
+ ;;
82
99
  chat)
83
100
  # Dynamically fetch available targets using ark targets list
84
101
  local targets
@@ -101,6 +118,11 @@ _ark_completion() {
101
118
  COMPREPLY=( $(compgen -W "\${targets}" -- \${cur}) )
102
119
  return 0
103
120
  ;;
121
+ queries)
122
+ opts="get delete resubmit"
123
+ COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
124
+ return 0
125
+ ;;
104
126
  esac
105
127
  ;;
106
128
  esac
@@ -137,7 +159,9 @@ _ark() {
137
159
  'docs[Open ARK documentation]' \\
138
160
  'generate[Generate ARK resources]' \\
139
161
  'install[Install ARK services]' \\
162
+ 'marketplace[Manage marketplace services]' \\
140
163
  'models[List available models]' \\
164
+ 'queries[Manage query resources]' \\
141
165
  'query[Execute a single query]' \\
142
166
  'routes[List available routes]' \\
143
167
  'status[Check system status]' \\
@@ -198,6 +222,21 @@ _ark() {
198
222
  'query[Generate a query]' \\
199
223
  'team[Generate a team]'
200
224
  ;;
225
+ marketplace)
226
+ _values 'marketplace commands' \\
227
+ 'list[List available marketplace services]' \\
228
+ 'ls[List available marketplace services]'
229
+ ;;
230
+ install)
231
+ _values 'services to install' \\
232
+ 'marketplace/services/phoenix[Phoenix observability platform]' \\
233
+ 'marketplace/services/langfuse[Langfuse LLM analytics]'
234
+ ;;
235
+ uninstall)
236
+ _values 'services to uninstall' \\
237
+ 'marketplace/services/phoenix[Phoenix observability platform]' \\
238
+ 'marketplace/services/langfuse[Langfuse LLM analytics]'
239
+ ;;
201
240
  chat)
202
241
  # Get available targets dynamically
203
242
  local -a targets
@@ -216,6 +255,12 @@ _ark() {
216
255
  fi
217
256
  _values 'available targets' \${targets[@]}
218
257
  ;;
258
+ queries)
259
+ _values 'queries commands' \\
260
+ 'get[Get a specific query]' \\
261
+ 'delete[Delete a query]' \\
262
+ 'resubmit[Resubmit a query by clearing its status]'
263
+ ;;
219
264
  esac
220
265
  ;;
221
266
  esac
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ import type { ArkConfig } from '../../lib/config.js';
3
+ export declare function createEvaluationCommand(_: ArkConfig): Command;
@@ -0,0 +1,60 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import { executeDirectEvaluation, executeQueryEvaluation, } from '../../lib/executeEvaluation.js';
4
+ import { readStdin } from '../../lib/stdin.js';
5
+ export function createEvaluationCommand(_) {
6
+ const evaluationCommand = new Command('evaluation');
7
+ evaluationCommand
8
+ .description('Execute evaluations against evaluators')
9
+ .argument('<evaluator-name>', 'Name of the evaluator to use')
10
+ .argument('[query-name]', 'Name of the query to evaluate (for query-based evaluation)')
11
+ .option('--input <input>', 'Input text for direct evaluation')
12
+ .option('--output <output>', 'Output text for direct evaluation')
13
+ .option('--response-target <target>', 'Response target for query evaluation (e.g., agent:my-agent)')
14
+ .option('--timeout <timeout>', 'Evaluation timeout (e.g., "30s", "5m")')
15
+ .option('--watch-timeout <timeout>', 'CLI watch timeout')
16
+ .action(async (evaluatorName, queryName, options) => {
17
+ if (options.input && options.output) {
18
+ await executeDirectEvaluation({
19
+ evaluatorName,
20
+ input: options.input,
21
+ output: options.output,
22
+ timeout: options.timeout,
23
+ watchTimeout: options.watchTimeout,
24
+ });
25
+ }
26
+ else if (queryName) {
27
+ await executeQueryEvaluation({
28
+ evaluatorName,
29
+ queryName,
30
+ responseTarget: options.responseTarget,
31
+ timeout: options.timeout,
32
+ watchTimeout: options.watchTimeout,
33
+ });
34
+ }
35
+ else {
36
+ const stdinQueryName = await readStdin();
37
+ if (stdinQueryName) {
38
+ await executeQueryEvaluation({
39
+ evaluatorName,
40
+ queryName: stdinQueryName,
41
+ responseTarget: options.responseTarget,
42
+ timeout: options.timeout,
43
+ watchTimeout: options.watchTimeout,
44
+ });
45
+ }
46
+ else {
47
+ console.error(chalk.red('Error: Must provide either:'));
48
+ console.error(' - --input and --output for direct evaluation');
49
+ console.error(' - <query-name> for query-based evaluation');
50
+ console.error(' - Pipe query name from stdin');
51
+ console.error('\nExamples:');
52
+ console.error(' ark evaluation my-evaluator --input "test" --output "result"');
53
+ console.error(' ark evaluation my-evaluator my-query');
54
+ console.error(' echo "my-query" | ark evaluation my-evaluator');
55
+ process.exit(1);
56
+ }
57
+ }
58
+ });
59
+ return evaluationCommand;
60
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,161 @@
1
+ import { jest } from '@jest/globals';
2
+ import { Command } from 'commander';
3
+ const mockExecuteDirectEvaluation = jest.fn();
4
+ const mockExecuteQueryEvaluation = jest.fn();
5
+ jest.unstable_mockModule('../../lib/executeEvaluation.js', () => ({
6
+ executeDirectEvaluation: mockExecuteDirectEvaluation,
7
+ executeQueryEvaluation: mockExecuteQueryEvaluation,
8
+ }));
9
+ const { createEvaluationCommand } = await import('./index.js');
10
+ describe('createEvaluationCommand', () => {
11
+ beforeEach(() => {
12
+ jest.clearAllMocks();
13
+ });
14
+ it('should create an evaluation command', () => {
15
+ const command = createEvaluationCommand({});
16
+ expect(command).toBeInstanceOf(Command);
17
+ expect(command.name()).toBe('evaluation');
18
+ expect(command.description()).toBe('Execute evaluations against evaluators');
19
+ });
20
+ describe('direct evaluation', () => {
21
+ it('should execute direct evaluation with required options', async () => {
22
+ mockExecuteDirectEvaluation.mockResolvedValue(undefined);
23
+ const command = createEvaluationCommand({});
24
+ await command.parseAsync([
25
+ 'node',
26
+ 'test',
27
+ 'my-evaluator',
28
+ '--input',
29
+ 'test-input',
30
+ '--output',
31
+ 'test-output',
32
+ ]);
33
+ expect(mockExecuteDirectEvaluation).toHaveBeenCalledWith({
34
+ evaluatorName: 'my-evaluator',
35
+ input: 'test-input',
36
+ output: 'test-output',
37
+ timeout: undefined,
38
+ watchTimeout: undefined,
39
+ });
40
+ });
41
+ it('should execute direct evaluation with timeout options', async () => {
42
+ mockExecuteDirectEvaluation.mockResolvedValue(undefined);
43
+ const command = createEvaluationCommand({});
44
+ await command.parseAsync([
45
+ 'node',
46
+ 'test',
47
+ 'my-evaluator',
48
+ '--input',
49
+ 'test-input',
50
+ '--output',
51
+ 'test-output',
52
+ '--timeout',
53
+ '10m',
54
+ '--watch-timeout',
55
+ '11m',
56
+ ]);
57
+ expect(mockExecuteDirectEvaluation).toHaveBeenCalledWith({
58
+ evaluatorName: 'my-evaluator',
59
+ input: 'test-input',
60
+ output: 'test-output',
61
+ timeout: '10m',
62
+ watchTimeout: '11m',
63
+ });
64
+ });
65
+ });
66
+ describe('query evaluation', () => {
67
+ it('should execute query evaluation with required arguments', async () => {
68
+ mockExecuteQueryEvaluation.mockResolvedValue(undefined);
69
+ const command = createEvaluationCommand({});
70
+ await command.parseAsync(['node', 'test', 'my-evaluator', 'test-query']);
71
+ expect(mockExecuteQueryEvaluation).toHaveBeenCalledWith({
72
+ evaluatorName: 'my-evaluator',
73
+ queryName: 'test-query',
74
+ responseTarget: undefined,
75
+ timeout: undefined,
76
+ watchTimeout: undefined,
77
+ });
78
+ });
79
+ it('should execute query evaluation from stdin', async () => {
80
+ mockExecuteQueryEvaluation.mockResolvedValue(undefined);
81
+ const command = createEvaluationCommand({});
82
+ const mockStdin = {
83
+ isTTY: false,
84
+ setEncoding: jest.fn(),
85
+ on: jest.fn((event, callback) => {
86
+ if (event === 'data') {
87
+ callback('piped-query-name');
88
+ }
89
+ else if (event === 'end') {
90
+ callback();
91
+ }
92
+ }),
93
+ };
94
+ const originalStdin = process.stdin;
95
+ Object.defineProperty(process, 'stdin', {
96
+ value: mockStdin,
97
+ writable: true,
98
+ configurable: true,
99
+ });
100
+ try {
101
+ await command.parseAsync(['node', 'test', 'my-evaluator']);
102
+ expect(mockExecuteQueryEvaluation).toHaveBeenCalledWith({
103
+ evaluatorName: 'my-evaluator',
104
+ queryName: 'piped-query-name',
105
+ responseTarget: undefined,
106
+ timeout: undefined,
107
+ watchTimeout: undefined,
108
+ });
109
+ }
110
+ finally {
111
+ Object.defineProperty(process, 'stdin', {
112
+ value: originalStdin,
113
+ writable: true,
114
+ configurable: true,
115
+ });
116
+ }
117
+ });
118
+ it('should execute query evaluation with response-target option', async () => {
119
+ mockExecuteQueryEvaluation.mockResolvedValue(undefined);
120
+ const command = createEvaluationCommand({});
121
+ await command.parseAsync([
122
+ 'node',
123
+ 'test',
124
+ 'my-evaluator',
125
+ 'test-query',
126
+ '--response-target',
127
+ 'agent:my-agent',
128
+ ]);
129
+ expect(mockExecuteQueryEvaluation).toHaveBeenCalledWith({
130
+ evaluatorName: 'my-evaluator',
131
+ queryName: 'test-query',
132
+ responseTarget: 'agent:my-agent',
133
+ timeout: undefined,
134
+ watchTimeout: undefined,
135
+ });
136
+ });
137
+ it('should execute query evaluation with all options', async () => {
138
+ mockExecuteQueryEvaluation.mockResolvedValue(undefined);
139
+ const command = createEvaluationCommand({});
140
+ await command.parseAsync([
141
+ 'node',
142
+ 'test',
143
+ 'my-evaluator',
144
+ 'test-query',
145
+ '--response-target',
146
+ 'agent:my-agent',
147
+ '--timeout',
148
+ '10m',
149
+ '--watch-timeout',
150
+ '11m',
151
+ ]);
152
+ expect(mockExecuteQueryEvaluation).toHaveBeenCalledWith({
153
+ evaluatorName: 'my-evaluator',
154
+ queryName: 'test-query',
155
+ responseTarget: 'agent:my-agent',
156
+ timeout: '10m',
157
+ watchTimeout: '11m',
158
+ });
159
+ });
160
+ });
161
+ });
@@ -90,7 +90,10 @@ class TeamGenerator {
90
90
  { name: 'Sequential - Agents execute in order', value: 'sequential' },
91
91
  { name: 'Round Robin - Agents take turns', value: 'round-robin' },
92
92
  { name: 'Graph - Custom workflow with dependencies', value: 'graph' },
93
- { name: 'Selector - AI chooses the next agent', value: 'selector' },
93
+ {
94
+ name: 'Selector - AI chooses the next agent (can add graph constraints)',
95
+ value: 'selector',
96
+ },
94
97
  ],
95
98
  default: 'sequential',
96
99
  },
@@ -5,6 +5,7 @@ import inquirer from 'inquirer';
5
5
  import { showNoClusterError } from '../../lib/startup.js';
6
6
  import output from '../../lib/output.js';
7
7
  import { getInstallableServices, arkDependencies, arkServices, } from '../../arkServices.js';
8
+ import { isMarketplaceService, extractMarketplaceServiceName, getMarketplaceService, getAllMarketplaceServices, } from '../../marketplaceServices.js';
8
9
  import { printNextSteps } from '../../lib/nextSteps.js';
9
10
  import ora from 'ora';
10
11
  import { waitForServicesReady, } from '../../lib/waitForReady.js';
@@ -41,6 +42,32 @@ export async function installArk(config, serviceName, options = {}) {
41
42
  console.log(); // Add blank line after cluster info
42
43
  // If a specific service is requested, install only that service
43
44
  if (serviceName) {
45
+ // Check if it's a marketplace service
46
+ if (isMarketplaceService(serviceName)) {
47
+ const marketplaceServiceName = extractMarketplaceServiceName(serviceName);
48
+ const service = getMarketplaceService(marketplaceServiceName);
49
+ if (!service) {
50
+ output.error(`marketplace service '${marketplaceServiceName}' not found`);
51
+ output.info('available marketplace services:');
52
+ const marketplaceServices = getAllMarketplaceServices();
53
+ for (const serviceName of Object.keys(marketplaceServices)) {
54
+ output.info(` marketplace/services/${serviceName}`);
55
+ }
56
+ process.exit(1);
57
+ }
58
+ output.info(`installing marketplace service ${service.name}...`);
59
+ try {
60
+ await installService(service, options.verbose);
61
+ output.success(`${service.name} installed successfully`);
62
+ }
63
+ catch (error) {
64
+ output.error(`failed to install ${service.name}`);
65
+ console.error(error);
66
+ process.exit(1);
67
+ }
68
+ return;
69
+ }
70
+ // Core ARK service
44
71
  const services = getInstallableServices();
45
72
  const service = Object.values(services).find((s) => s.name === serviceName);
46
73
  if (!service) {
@@ -0,0 +1,4 @@
1
+ import { Command } from 'commander';
2
+ import type { ArkConfig } from '../../lib/config.js';
3
+ declare function createMarketplaceCommand(_config: ArkConfig): Command;
4
+ export { createMarketplaceCommand };
@@ -0,0 +1,50 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import { getAllMarketplaceServices } from '../../marketplaceServices.js';
4
+ function createMarketplaceCommand(_config) {
5
+ const marketplace = new Command('marketplace');
6
+ marketplace
7
+ .description('Manage marketplace services')
8
+ .addHelpText('before', `
9
+ ${chalk.blue('🏪 ARK Marketplace')}
10
+ Install community-contributed services from the ARK Marketplace.
11
+
12
+ Repository: ${chalk.cyan('https://github.com/mckinsey/agents-at-scale-marketplace')}
13
+ Registry: ${chalk.cyan('ghcr.io/mckinsey/agents-at-scale-marketplace/charts')}
14
+ `)
15
+ .addHelpText('after', `
16
+ ${chalk.cyan('Examples:')}
17
+ ${chalk.yellow('ark marketplace list')} # List available services
18
+ ${chalk.yellow('ark install marketplace/services/phoenix')} # Install Phoenix
19
+ ${chalk.yellow('ark uninstall marketplace/services/phoenix')} # Uninstall Phoenix
20
+
21
+ ${chalk.cyan('Available Services:')}
22
+ • phoenix - AI/ML observability and evaluation platform
23
+ • langfuse - Open-source LLM observability and analytics
24
+ `);
25
+ // List command
26
+ const list = new Command('list');
27
+ list
28
+ .alias('ls')
29
+ .description('List available marketplace services')
30
+ .action(() => {
31
+ const services = getAllMarketplaceServices();
32
+ console.log(chalk.blue('\n🏪 ARK Marketplace Services\n'));
33
+ console.log(chalk.gray('Install with: ark install marketplace/services/<service-name>\n'));
34
+ for (const [key, service] of Object.entries(services)) {
35
+ const icon = '📦';
36
+ const serviceName = `marketplace/services/${key.padEnd(12)}`;
37
+ const serviceDesc = service.description;
38
+ console.log(`${icon} ${chalk.green(serviceName)} ${chalk.gray(serviceDesc)}`);
39
+ const namespaceInfo = `namespace: ${service.namespace || 'default'}`;
40
+ console.log(` ${chalk.dim(namespaceInfo)}`);
41
+ console.log();
42
+ }
43
+ console.log(chalk.cyan('Repository: https://github.com/mckinsey/agents-at-scale-marketplace'));
44
+ console.log(chalk.cyan('Registry: oci://ghcr.io/mckinsey/agents-at-scale-marketplace/charts'));
45
+ console.log();
46
+ });
47
+ marketplace.addCommand(list);
48
+ return marketplace;
49
+ }
50
+ export { createMarketplaceCommand };
@@ -0,0 +1,15 @@
1
+ import { Command } from 'commander';
2
+ import type { ArkConfig } from '../../lib/config.js';
3
+ export declare function listSessions(options: {
4
+ output?: string;
5
+ }): Promise<void>;
6
+ export declare function deleteSession(sessionId: string, options: {
7
+ output?: string;
8
+ }): Promise<void>;
9
+ export declare function deleteQuery(sessionId: string, queryId: string, options: {
10
+ output?: string;
11
+ }): Promise<void>;
12
+ export declare function deleteAll(options: {
13
+ output?: string;
14
+ }): Promise<void>;
15
+ export declare function createMemoryCommand(_: ArkConfig): Command;
@@ -0,0 +1,130 @@
1
+ import { Command } from 'commander';
2
+ import output from '../../lib/output.js';
3
+ import { ArkApiProxy } from '../../lib/arkApiProxy.js';
4
+ export async function listSessions(options) {
5
+ try {
6
+ const proxy = new ArkApiProxy();
7
+ const arkApiClient = await proxy.start();
8
+ const sessions = await arkApiClient.getSessions();
9
+ if (options.output === 'json') {
10
+ output.info(JSON.stringify(sessions, null, 2));
11
+ return;
12
+ }
13
+ if (sessions.length === 0) {
14
+ output.info('No sessions found');
15
+ return;
16
+ }
17
+ output.info('Sessions:');
18
+ sessions.forEach((session) => {
19
+ output.info(` ${session.sessionId} (memory: ${session.memoryName})`);
20
+ });
21
+ proxy.stop();
22
+ }
23
+ catch (error) {
24
+ output.error('Failed to list sessions:', error);
25
+ process.exit(1);
26
+ }
27
+ }
28
+ export async function deleteSession(sessionId, options) {
29
+ try {
30
+ const proxy = new ArkApiProxy();
31
+ const arkApiClient = await proxy.start();
32
+ const response = await arkApiClient.deleteSession(sessionId);
33
+ if (options.output === 'json') {
34
+ output.info(JSON.stringify(response, null, 2));
35
+ return;
36
+ }
37
+ output.success(`Session ${sessionId} deleted successfully`);
38
+ proxy.stop();
39
+ }
40
+ catch (error) {
41
+ output.error(`Failed to delete session ${sessionId}:`, error);
42
+ process.exit(1);
43
+ }
44
+ }
45
+ export async function deleteQuery(sessionId, queryId, options) {
46
+ try {
47
+ const proxy = new ArkApiProxy();
48
+ const arkApiClient = await proxy.start();
49
+ const response = await arkApiClient.deleteQueryMessages(sessionId, queryId);
50
+ if (options.output === 'json') {
51
+ output.info(JSON.stringify(response, null, 2));
52
+ return;
53
+ }
54
+ output.success(`Query ${queryId} messages deleted successfully from session ${sessionId}`);
55
+ proxy.stop();
56
+ }
57
+ catch (error) {
58
+ output.error(`Failed to delete query ${queryId} messages:`, error);
59
+ process.exit(1);
60
+ }
61
+ }
62
+ export async function deleteAll(options) {
63
+ try {
64
+ const proxy = new ArkApiProxy();
65
+ const arkApiClient = await proxy.start();
66
+ const response = await arkApiClient.deleteAllSessions();
67
+ if (options.output === 'json') {
68
+ output.info(JSON.stringify(response, null, 2));
69
+ return;
70
+ }
71
+ output.success('All sessions deleted successfully');
72
+ proxy.stop();
73
+ }
74
+ catch (error) {
75
+ output.error('Failed to delete all sessions:', error);
76
+ process.exit(1);
77
+ }
78
+ }
79
+ export function createMemoryCommand(_) {
80
+ const memoryCommand = new Command('memory');
81
+ memoryCommand.description('Manage memory sessions and queries').alias('mem');
82
+ // List sessions command
83
+ memoryCommand
84
+ .command('list')
85
+ .alias('ls')
86
+ .description('List all sessions')
87
+ .option('-o, --output <format>', 'output format (json or text)', 'text')
88
+ .action(async (options) => {
89
+ await listSessions(options);
90
+ });
91
+ // Delete command with subcommands (alias: reset for backward compatibility)
92
+ const deleteCommand = memoryCommand
93
+ .command('delete')
94
+ .alias('reset')
95
+ .description('Delete memory data')
96
+ .option('--all', 'Delete all sessions and their messages');
97
+ // Delete specific session
98
+ deleteCommand
99
+ .command('session')
100
+ .description('Delete a specific session')
101
+ .argument('<sessionId>', 'Session ID to delete')
102
+ .option('-o, --output <format>', 'output format (json or text)', 'text')
103
+ .action(async (sessionId, options) => {
104
+ await deleteSession(sessionId, options);
105
+ });
106
+ // Delete specific query
107
+ deleteCommand
108
+ .command('query')
109
+ .description('Delete messages for a specific query')
110
+ .argument('<sessionId>', 'Session ID')
111
+ .argument('<queryId>', 'Query ID to delete messages for')
112
+ .option('-o, --output <format>', 'output format (json or text)', 'text')
113
+ .action(async (sessionId, queryId, options) => {
114
+ await deleteQuery(sessionId, queryId, options);
115
+ });
116
+ // Handle --all on delete root
117
+ deleteCommand.action(async (options) => {
118
+ if (options.all) {
119
+ await deleteAll(options);
120
+ return;
121
+ }
122
+ // If no subcommand and no --all, show help
123
+ deleteCommand.help();
124
+ });
125
+ // Default action - list sessions
126
+ memoryCommand.action(async (options) => {
127
+ await listSessions(options);
128
+ });
129
+ return memoryCommand;
130
+ }
@@ -0,0 +1 @@
1
+ export {};