@agents-at-scale/ark 0.1.53 → 0.1.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arkServices.js +14 -0
- package/dist/commands/completion/index.js +9 -6
- package/dist/commands/export/index.js +6 -5
- package/dist/commands/generate/generators/agent.js +2 -0
- package/dist/commands/generate/generators/marketplace.js +2 -0
- package/dist/commands/generate/generators/mcpserver.js +2 -0
- package/dist/commands/generate/generators/project.js +9 -2
- package/dist/commands/generate/generators/query.js +2 -0
- package/dist/commands/generate/generators/team.js +2 -1
- package/dist/commands/generate/templateDiscovery.js +1 -0
- package/dist/commands/generate/templateEngine.js +1 -3
- package/dist/commands/import/index.js +1 -1
- package/dist/commands/install/index.js +35 -31
- package/dist/commands/marketplace/index.js +18 -3
- package/dist/commands/models/create.js +1 -0
- package/dist/commands/models/kubernetes/manifest-builder.js +49 -10
- package/dist/commands/models/providers/anthropic.d.ts +15 -0
- package/dist/commands/models/providers/anthropic.js +72 -0
- package/dist/commands/models/providers/azure.d.ts +10 -7
- package/dist/commands/models/providers/azure.js +83 -21
- package/dist/commands/models/providers/factory.js +3 -0
- package/dist/commands/models/providers/index.d.ts +3 -4
- package/dist/commands/models/providers/index.js +1 -0
- package/dist/commands/uninstall/index.js +9 -3
- package/dist/components/ChatUI.js +21 -33
- package/dist/components/statusChecker.js +3 -3
- package/dist/index.js +0 -2
- package/dist/lib/arkApiClient.d.ts +14 -4
- package/dist/lib/arkApiClient.js +61 -42
- package/dist/lib/arkApiProxy.js +1 -0
- package/dist/lib/arkServiceProxy.js +5 -1
- package/dist/lib/chatClient.d.ts +4 -6
- package/dist/lib/chatClient.js +138 -95
- package/dist/lib/config.js +8 -3
- package/dist/lib/errors.d.ts +0 -1
- package/dist/lib/errors.js +3 -1
- package/dist/lib/marketplaceFetcher.d.ts +1 -0
- package/dist/lib/marketplaceFetcher.js +17 -0
- package/dist/lib/types.d.ts +0 -38
- package/dist/marketplaceServices.d.ts +6 -1
- package/dist/marketplaceServices.js +19 -3
- package/dist/types/arkService.d.ts +1 -0
- package/dist/types/marketplace.d.ts +1 -1
- package/dist/ui/asyncOperations/connectingToArk.js +2 -2
- package/package.json +19 -13
- package/templates/marketplace/marketplace.json.example +2 -2
- package/templates/tool/uv.lock +794 -95
- package/dist/arkServices.spec.d.ts +0 -1
- package/dist/arkServices.spec.js +0 -138
- package/dist/commands/agents/index.spec.d.ts +0 -1
- package/dist/commands/agents/index.spec.js +0 -67
- package/dist/commands/cluster/get.spec.d.ts +0 -1
- package/dist/commands/cluster/get.spec.js +0 -92
- package/dist/commands/cluster/index.spec.d.ts +0 -1
- package/dist/commands/cluster/index.spec.js +0 -24
- package/dist/commands/completion/index.spec.d.ts +0 -1
- package/dist/commands/completion/index.spec.js +0 -34
- package/dist/commands/config/index.spec.d.ts +0 -1
- package/dist/commands/config/index.spec.js +0 -78
- package/dist/commands/evaluation/index.d.ts +0 -3
- package/dist/commands/evaluation/index.js +0 -60
- package/dist/commands/evaluation/index.spec.d.ts +0 -1
- package/dist/commands/evaluation/index.spec.js +0 -161
- package/dist/commands/export/index.spec.d.ts +0 -1
- package/dist/commands/export/index.spec.js +0 -145
- package/dist/commands/import/index.spec.d.ts +0 -1
- package/dist/commands/import/index.spec.js +0 -46
- package/dist/commands/install/index.spec.d.ts +0 -1
- package/dist/commands/install/index.spec.js +0 -286
- package/dist/commands/marketplace/index.spec.d.ts +0 -1
- package/dist/commands/marketplace/index.spec.js +0 -88
- package/dist/commands/memory/index.spec.d.ts +0 -1
- package/dist/commands/memory/index.spec.js +0 -124
- package/dist/commands/models/create.spec.d.ts +0 -1
- package/dist/commands/models/create.spec.js +0 -167
- package/dist/commands/models/index.spec.d.ts +0 -1
- package/dist/commands/models/index.spec.js +0 -96
- package/dist/commands/models/providers/azure.spec.d.ts +0 -1
- package/dist/commands/models/providers/azure.spec.js +0 -232
- package/dist/commands/models/providers/bedrock.spec.d.ts +0 -1
- package/dist/commands/models/providers/bedrock.spec.js +0 -241
- package/dist/commands/models/providers/openai.spec.d.ts +0 -1
- package/dist/commands/models/providers/openai.spec.js +0 -180
- package/dist/commands/queries/delete.spec.d.ts +0 -1
- package/dist/commands/queries/delete.spec.js +0 -74
- package/dist/commands/queries/index.spec.d.ts +0 -1
- package/dist/commands/queries/index.spec.js +0 -167
- package/dist/commands/queries/list.spec.d.ts +0 -1
- package/dist/commands/queries/list.spec.js +0 -170
- package/dist/commands/queries/validation.spec.d.ts +0 -1
- package/dist/commands/queries/validation.spec.js +0 -27
- package/dist/commands/query/index.spec.d.ts +0 -1
- package/dist/commands/query/index.spec.js +0 -104
- package/dist/commands/targets/index.spec.d.ts +0 -1
- package/dist/commands/targets/index.spec.js +0 -154
- package/dist/commands/teams/index.spec.d.ts +0 -1
- package/dist/commands/teams/index.spec.js +0 -70
- package/dist/commands/tools/index.spec.d.ts +0 -1
- package/dist/commands/tools/index.spec.js +0 -70
- package/dist/commands/uninstall/index.spec.d.ts +0 -1
- package/dist/commands/uninstall/index.spec.js +0 -125
- package/dist/lib/arkServiceProxy.spec.d.ts +0 -1
- package/dist/lib/arkServiceProxy.spec.js +0 -100
- package/dist/lib/arkStatus.spec.d.ts +0 -1
- package/dist/lib/arkStatus.spec.js +0 -49
- package/dist/lib/chatClient.spec.d.ts +0 -1
- package/dist/lib/chatClient.spec.js +0 -108
- package/dist/lib/cluster.spec.d.ts +0 -1
- package/dist/lib/cluster.spec.js +0 -338
- package/dist/lib/commands.spec.d.ts +0 -1
- package/dist/lib/commands.spec.js +0 -146
- package/dist/lib/config.spec.d.ts +0 -1
- package/dist/lib/config.spec.js +0 -202
- package/dist/lib/duration.spec.d.ts +0 -1
- package/dist/lib/duration.spec.js +0 -13
- package/dist/lib/errors.spec.d.ts +0 -1
- package/dist/lib/errors.spec.js +0 -221
- package/dist/lib/executeEvaluation.d.ts +0 -16
- package/dist/lib/executeEvaluation.js +0 -155
- package/dist/lib/executeQuery.spec.d.ts +0 -1
- package/dist/lib/executeQuery.spec.js +0 -325
- package/dist/lib/kubectl.spec.d.ts +0 -1
- package/dist/lib/kubectl.spec.js +0 -192
- package/dist/lib/marketplaceFetcher.spec.d.ts +0 -1
- package/dist/lib/marketplaceFetcher.spec.js +0 -225
- package/dist/lib/nextSteps.spec.d.ts +0 -1
- package/dist/lib/nextSteps.spec.js +0 -59
- package/dist/lib/output.spec.d.ts +0 -1
- package/dist/lib/output.spec.js +0 -123
- package/dist/lib/startup.spec.d.ts +0 -1
- package/dist/lib/startup.spec.js +0 -152
- package/dist/lib/stdin.spec.d.ts +0 -1
- package/dist/lib/stdin.spec.js +0 -82
- package/dist/lib/timeout.spec.d.ts +0 -1
- package/dist/lib/timeout.spec.js +0 -14
- package/dist/lib/waitForReady.spec.d.ts +0 -1
- package/dist/lib/waitForReady.spec.js +0 -104
- package/dist/marketplaceServices.spec.d.ts +0 -1
- package/dist/marketplaceServices.spec.js +0 -74
- package/dist/ui/statusFormatter.spec.d.ts +0 -1
- package/dist/ui/statusFormatter.spec.js +0 -58
|
@@ -2,12 +2,8 @@ import inquirer from 'inquirer';
|
|
|
2
2
|
/**
|
|
3
3
|
* Configuration collector for Azure OpenAI models.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* - apiVersion: The API version to use (defaults to 2024-12-01-preview)
|
|
8
|
-
* - apiKey: The authentication key for the Azure OpenAI resource
|
|
9
|
-
*
|
|
10
|
-
* Values can be provided via command-line options or will be prompted interactively.
|
|
5
|
+
* Supports API Key, Managed Identity (AKS), and Workload Identity auth.
|
|
6
|
+
* Values can be provided via command-line options or prompted interactively.
|
|
11
7
|
*/
|
|
12
8
|
export class AzureConfigCollector {
|
|
13
9
|
async collectConfig(options) {
|
|
@@ -50,33 +46,99 @@ export class AzureConfigCollector {
|
|
|
50
46
|
]);
|
|
51
47
|
apiVersion = answer.apiVersion;
|
|
52
48
|
}
|
|
53
|
-
let
|
|
54
|
-
if (!apiKey) {
|
|
49
|
+
let authMethod = azureOptions.authMethod;
|
|
50
|
+
if (!authMethod && azureOptions.apiKey) {
|
|
51
|
+
authMethod = 'apiKey';
|
|
52
|
+
}
|
|
53
|
+
if (!authMethod) {
|
|
55
54
|
const answer = await inquirer.prompt([
|
|
56
55
|
{
|
|
57
|
-
type: '
|
|
58
|
-
name: '
|
|
59
|
-
message: '
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
},
|
|
56
|
+
type: 'list',
|
|
57
|
+
name: 'authMethod',
|
|
58
|
+
message: 'Authentication:',
|
|
59
|
+
choices: [
|
|
60
|
+
{ name: 'API Key', value: 'apiKey' },
|
|
61
|
+
{ name: 'Managed Identity (AKS)', value: 'managedIdentity' },
|
|
62
|
+
{ name: 'Workload Identity', value: 'workloadIdentity' },
|
|
63
|
+
],
|
|
66
64
|
},
|
|
67
65
|
]);
|
|
68
|
-
|
|
66
|
+
authMethod = answer.authMethod;
|
|
67
|
+
}
|
|
68
|
+
let apiKey;
|
|
69
|
+
let clientId;
|
|
70
|
+
let tenantId;
|
|
71
|
+
if (authMethod === 'apiKey') {
|
|
72
|
+
apiKey = azureOptions.apiKey;
|
|
73
|
+
if (!apiKey) {
|
|
74
|
+
const answer = await inquirer.prompt([
|
|
75
|
+
{
|
|
76
|
+
type: 'password',
|
|
77
|
+
name: 'apiKey',
|
|
78
|
+
message: 'API key:',
|
|
79
|
+
mask: '*',
|
|
80
|
+
validate: (input) => {
|
|
81
|
+
if (!input)
|
|
82
|
+
return 'API key is required';
|
|
83
|
+
return true;
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
]);
|
|
87
|
+
apiKey = answer.apiKey;
|
|
88
|
+
}
|
|
89
|
+
if (!apiKey) {
|
|
90
|
+
throw new Error('API key is required');
|
|
91
|
+
}
|
|
69
92
|
}
|
|
70
|
-
if (
|
|
71
|
-
|
|
93
|
+
else if (authMethod === 'managedIdentity') {
|
|
94
|
+
clientId = azureOptions.clientId;
|
|
95
|
+
if (!clientId) {
|
|
96
|
+
const answer = await inquirer.prompt([
|
|
97
|
+
{
|
|
98
|
+
type: 'input',
|
|
99
|
+
name: 'clientId',
|
|
100
|
+
message: 'Managed Identity Client ID (optional for system-assigned):',
|
|
101
|
+
},
|
|
102
|
+
]);
|
|
103
|
+
clientId = answer.clientId || undefined;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else if (authMethod === 'workloadIdentity') {
|
|
107
|
+
clientId = azureOptions.clientId;
|
|
108
|
+
tenantId = azureOptions.tenantId;
|
|
109
|
+
if (!clientId) {
|
|
110
|
+
const answer = await inquirer.prompt([
|
|
111
|
+
{
|
|
112
|
+
type: 'input',
|
|
113
|
+
name: 'clientId',
|
|
114
|
+
message: 'Workload Identity Client ID:',
|
|
115
|
+
validate: (input) => input ? true : 'Client ID is required for Workload Identity',
|
|
116
|
+
},
|
|
117
|
+
]);
|
|
118
|
+
clientId = answer.clientId;
|
|
119
|
+
}
|
|
120
|
+
if (!tenantId) {
|
|
121
|
+
const answer = await inquirer.prompt([
|
|
122
|
+
{
|
|
123
|
+
type: 'input',
|
|
124
|
+
name: 'tenantId',
|
|
125
|
+
message: 'Azure Tenant ID:',
|
|
126
|
+
validate: (input) => input ? true : 'Tenant ID is required for Workload Identity',
|
|
127
|
+
},
|
|
128
|
+
]);
|
|
129
|
+
tenantId = answer.tenantId;
|
|
130
|
+
}
|
|
72
131
|
}
|
|
73
132
|
return {
|
|
74
133
|
type: 'azure',
|
|
75
134
|
modelValue: options.model,
|
|
76
135
|
secretName: '',
|
|
77
136
|
baseUrl,
|
|
78
|
-
apiKey,
|
|
79
137
|
apiVersion,
|
|
138
|
+
authMethod,
|
|
139
|
+
apiKey,
|
|
140
|
+
clientId,
|
|
141
|
+
tenantId,
|
|
80
142
|
};
|
|
81
143
|
}
|
|
82
144
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { OpenAIConfigCollector } from './openai.js';
|
|
2
2
|
import { AzureConfigCollector } from './azure.js';
|
|
3
3
|
import { BedrockConfigCollector } from './bedrock.js';
|
|
4
|
+
import { AnthropicConfigCollector } from './anthropic.js';
|
|
4
5
|
/**
|
|
5
6
|
* Factory for creating provider-specific configuration collectors.
|
|
6
7
|
*
|
|
@@ -24,6 +25,8 @@ export class ProviderConfigCollectorFactory {
|
|
|
24
25
|
return new AzureConfigCollector();
|
|
25
26
|
case 'bedrock':
|
|
26
27
|
return new BedrockConfigCollector();
|
|
28
|
+
case 'anthropic':
|
|
29
|
+
return new AnthropicConfigCollector();
|
|
27
30
|
default:
|
|
28
31
|
throw new Error(`Unknown provider type: ${type}`);
|
|
29
32
|
}
|
|
@@ -7,11 +7,10 @@ export { BaseProviderConfig, BaseCollectorOptions, ProviderConfigCollector, } fr
|
|
|
7
7
|
export { OpenAIConfig, OpenAICollectorOptions, OpenAIConfigCollector, } from './openai.js';
|
|
8
8
|
export { AzureConfig, AzureCollectorOptions, AzureConfigCollector, } from './azure.js';
|
|
9
9
|
export { BedrockConfig, BedrockCollectorOptions, BedrockConfigCollector, } from './bedrock.js';
|
|
10
|
+
export { AnthropicConfig, AnthropicCollectorOptions, AnthropicConfigCollector, } from './anthropic.js';
|
|
10
11
|
export { ProviderConfigCollectorFactory } from './factory.js';
|
|
11
12
|
import { OpenAIConfig } from './openai.js';
|
|
12
13
|
import { AzureConfig } from './azure.js';
|
|
13
14
|
import { BedrockConfig } from './bedrock.js';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*/
|
|
17
|
-
export type ProviderConfig = OpenAIConfig | AzureConfig | BedrockConfig;
|
|
15
|
+
import { AnthropicConfig } from './anthropic.js';
|
|
16
|
+
export type ProviderConfig = OpenAIConfig | AzureConfig | BedrockConfig | AnthropicConfig;
|
|
@@ -6,4 +6,5 @@
|
|
|
6
6
|
export { OpenAIConfigCollector, } from './openai.js';
|
|
7
7
|
export { AzureConfigCollector, } from './azure.js';
|
|
8
8
|
export { BedrockConfigCollector, } from './bedrock.js';
|
|
9
|
+
export { AnthropicConfigCollector, } from './anthropic.js';
|
|
9
10
|
export { ProviderConfigCollectorFactory } from './factory.js';
|
|
@@ -5,7 +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 } from '../../arkServices.js';
|
|
8
|
-
import { isMarketplaceService, getMarketplaceItem, getAllMarketplaceServices, getAllMarketplaceAgents, } from '../../marketplaceServices.js';
|
|
8
|
+
import { isMarketplaceService, getMarketplaceItem, getAllMarketplaceServices, getAllMarketplaceAgents, getAllMarketplaceExecutors, } from '../../marketplaceServices.js';
|
|
9
9
|
async function uninstallService(service, verbose = false) {
|
|
10
10
|
const helmArgs = ['uninstall', service.helmReleaseName, '--ignore-not-found'];
|
|
11
11
|
// Only add namespace flag if service has explicit namespace
|
|
@@ -44,7 +44,13 @@ async function uninstallArk(config, serviceName, options = {}) {
|
|
|
44
44
|
output.info(` marketplace/agents/${name}`);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
const marketplaceExecutors = await getAllMarketplaceExecutors();
|
|
48
|
+
if (marketplaceExecutors) {
|
|
49
|
+
for (const name of Object.keys(marketplaceExecutors)) {
|
|
50
|
+
output.info(` marketplace/executors/${name}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (!marketplaceServices && !marketplaceAgents && !marketplaceExecutors) {
|
|
48
54
|
output.warning('Marketplace unavailable');
|
|
49
55
|
}
|
|
50
56
|
process.exit(1);
|
|
@@ -88,7 +94,7 @@ async function uninstallArk(config, serviceName, options = {}) {
|
|
|
88
94
|
const services = getInstallableServices();
|
|
89
95
|
const serviceEntries = Object.entries(services).reverse();
|
|
90
96
|
for (const [, service] of serviceEntries) {
|
|
91
|
-
let shouldUninstall
|
|
97
|
+
let shouldUninstall;
|
|
92
98
|
try {
|
|
93
99
|
// Ask for confirmation
|
|
94
100
|
shouldUninstall =
|
|
@@ -6,7 +6,6 @@ import * as React from 'react';
|
|
|
6
6
|
import { marked } from 'marked';
|
|
7
7
|
// @ts-ignore - no types available
|
|
8
8
|
import TerminalRenderer from 'marked-terminal';
|
|
9
|
-
import { APIError } from 'openai';
|
|
10
9
|
import { TargetSelector } from '../ui/TargetSelector.js';
|
|
11
10
|
import { useAsyncOperation, AsyncOperationStatus } from './AsyncOperation.js';
|
|
12
11
|
import { createConnectingToArkOperation } from '../ui/asyncOperations/connectingToArk.js';
|
|
@@ -410,31 +409,32 @@ const ChatUI = ({ initialTargetId, arkApiClient, arkApiProxy, config, }) => {
|
|
|
410
409
|
// Create abort controller for this request
|
|
411
410
|
const controller = new AbortController();
|
|
412
411
|
setAbortController(controller);
|
|
413
|
-
// Convert messages to format expected by OpenAI API - only include user and agent messages
|
|
414
412
|
const apiMessages = messages
|
|
415
413
|
.filter((msg) => msg.type === 'user' || msg.type === 'agent' || msg.type === 'team')
|
|
416
|
-
.
|
|
414
|
+
.flatMap((msg) => {
|
|
417
415
|
if (msg.type === 'user') {
|
|
418
|
-
return
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
416
|
+
return [
|
|
417
|
+
{
|
|
418
|
+
role: 'user',
|
|
419
|
+
content: msg.content,
|
|
420
|
+
},
|
|
421
|
+
];
|
|
422
422
|
}
|
|
423
423
|
else if (msg.type === 'agent') {
|
|
424
|
-
return
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
424
|
+
return [
|
|
425
|
+
{
|
|
426
|
+
role: 'assistant',
|
|
427
|
+
content: msg.content,
|
|
428
|
+
},
|
|
429
|
+
];
|
|
428
430
|
}
|
|
429
431
|
else if (msg.type === 'team') {
|
|
430
|
-
|
|
431
|
-
const content = msg.members.map((m) => m.content).join(' ');
|
|
432
|
-
return {
|
|
432
|
+
return msg.members.map((m) => ({
|
|
433
433
|
role: 'assistant',
|
|
434
|
-
content: content || '',
|
|
435
|
-
};
|
|
434
|
+
content: m.content || '',
|
|
435
|
+
}));
|
|
436
436
|
}
|
|
437
|
-
return
|
|
437
|
+
return [];
|
|
438
438
|
});
|
|
439
439
|
// Add the new user message
|
|
440
440
|
apiMessages.push({
|
|
@@ -469,9 +469,9 @@ const ChatUI = ({ initialTargetId, arkApiClient, arkApiProxy, config, }) => {
|
|
|
469
469
|
const fullResponse = await chatClientRef.current.sendMessage(target.id, apiMessages, { ...chatConfig, a2aContextId: a2aContextIdRef.current }, (chunk, toolCalls, arkMetadata) => {
|
|
470
470
|
// Extract A2A context ID from response
|
|
471
471
|
// Chat TUI always queries a single target, so contextId is in response
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
472
|
+
const completed = arkMetadata?.completedQuery;
|
|
473
|
+
if (completed?.status?.response?.a2a?.contextId) {
|
|
474
|
+
a2aContextIdRef.current = completed.status.response.a2a.contextId;
|
|
475
475
|
}
|
|
476
476
|
// Update message progressively as chunks arrive
|
|
477
477
|
setMessages((prev) => {
|
|
@@ -557,21 +557,9 @@ const ChatUI = ({ initialTargetId, arkApiClient, arkApiProxy, config, }) => {
|
|
|
557
557
|
return;
|
|
558
558
|
}
|
|
559
559
|
let errorMessage = 'Failed to send message';
|
|
560
|
-
|
|
561
|
-
if (err instanceof APIError) {
|
|
562
|
-
if (err.error && typeof err.error === 'object') {
|
|
563
|
-
const errorObj = err.error;
|
|
564
|
-
errorMessage = errorObj.message || JSON.stringify(err.error, null, 2);
|
|
565
|
-
}
|
|
566
|
-
else {
|
|
567
|
-
errorMessage = err.message;
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
// Standard JavaScript errors
|
|
571
|
-
else if (err instanceof Error) {
|
|
560
|
+
if (err instanceof Error) {
|
|
572
561
|
errorMessage = err.message;
|
|
573
562
|
}
|
|
574
|
-
// String errors from throw statements
|
|
575
563
|
else if (typeof err === 'string') {
|
|
576
564
|
errorMessage = err;
|
|
577
565
|
}
|
|
@@ -24,7 +24,7 @@ export const getKubectlVersion = () => ({
|
|
|
24
24
|
throw new Error('kubectl version output missing clientVersion field');
|
|
25
25
|
}
|
|
26
26
|
catch (e) {
|
|
27
|
-
throw new Error(`Failed to parse kubectl version JSON: ${e instanceof Error ? e.message : 'Unknown error'}
|
|
27
|
+
throw new Error(`Failed to parse kubectl version JSON: ${e instanceof Error ? e.message : 'Unknown error'}`, { cause: e });
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
});
|
|
@@ -72,7 +72,7 @@ export class StatusChecker {
|
|
|
72
72
|
return config.versionExtract(stdout);
|
|
73
73
|
}
|
|
74
74
|
catch (error) {
|
|
75
|
-
throw new Error(`Failed to get ${config.command} version: ${error instanceof Error ? error.message : 'Unknown error'}
|
|
75
|
+
throw new Error(`Failed to get ${config.command} version: ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error });
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
@@ -341,7 +341,7 @@ export class StatusChecker {
|
|
|
341
341
|
clusterAccess = true;
|
|
342
342
|
}
|
|
343
343
|
catch {
|
|
344
|
-
clusterAccess
|
|
344
|
+
// clusterAccess remains false
|
|
345
345
|
}
|
|
346
346
|
// Get cluster info if accessible
|
|
347
347
|
let clusterInfo;
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,6 @@ import { createClusterCommand } from './commands/cluster/index.js';
|
|
|
13
13
|
import { createCompletionCommand } from './commands/completion/index.js';
|
|
14
14
|
import { createDashboardCommand } from './commands/dashboard/index.js';
|
|
15
15
|
import { createDocsCommand } from './commands/docs/index.js';
|
|
16
|
-
import { createEvaluationCommand } from './commands/evaluation/index.js';
|
|
17
16
|
import { createExportCommand } from './commands/export/index.js';
|
|
18
17
|
import { createGenerateCommand } from './commands/generate/index.js';
|
|
19
18
|
import { createImportCommand } from './commands/import/index.js';
|
|
@@ -49,7 +48,6 @@ async function main() {
|
|
|
49
48
|
program.addCommand(createCompletionCommand(config));
|
|
50
49
|
program.addCommand(createDashboardCommand(config));
|
|
51
50
|
program.addCommand(createDocsCommand(config));
|
|
52
|
-
program.addCommand(createEvaluationCommand(config));
|
|
53
51
|
program.addCommand(createExportCommand(config));
|
|
54
52
|
program.addCommand(createGenerateCommand(config));
|
|
55
53
|
program.addCommand(createImportCommand(config));
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import OpenAI from 'openai';
|
|
2
1
|
export interface QueryTarget {
|
|
3
2
|
id: string;
|
|
4
3
|
name: string;
|
|
@@ -38,7 +37,6 @@ export interface Team {
|
|
|
38
37
|
status?: string;
|
|
39
38
|
}
|
|
40
39
|
export declare class ArkApiClient {
|
|
41
|
-
private openai;
|
|
42
40
|
private baseUrl;
|
|
43
41
|
constructor(arkApiUrl: string);
|
|
44
42
|
getBaseUrl(): string;
|
|
@@ -51,6 +49,18 @@ export declare class ArkApiClient {
|
|
|
51
49
|
deleteSession(sessionId: string): Promise<any>;
|
|
52
50
|
deleteQueryMessages(sessionId: string, queryId: string): Promise<any>;
|
|
53
51
|
deleteAllSessions(): Promise<any>;
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
createQuery(params: {
|
|
53
|
+
input: string;
|
|
54
|
+
target: {
|
|
55
|
+
type: string;
|
|
56
|
+
name: string;
|
|
57
|
+
};
|
|
58
|
+
sessionId?: string;
|
|
59
|
+
conversationId?: string;
|
|
60
|
+
timeout?: string;
|
|
61
|
+
metadata?: {
|
|
62
|
+
annotations?: Record<string, string>;
|
|
63
|
+
};
|
|
64
|
+
}): Promise<Record<string, unknown>>;
|
|
65
|
+
getQuery(queryName: string): Promise<Record<string, unknown>>;
|
|
56
66
|
}
|
package/dist/lib/arkApiClient.js
CHANGED
|
@@ -1,35 +1,43 @@
|
|
|
1
|
-
import OpenAI from 'openai';
|
|
2
1
|
export class ArkApiClient {
|
|
2
|
+
baseUrl;
|
|
3
3
|
constructor(arkApiUrl) {
|
|
4
4
|
this.baseUrl = arkApiUrl;
|
|
5
|
-
this.openai = new OpenAI({
|
|
6
|
-
baseURL: `${arkApiUrl}/openai/v1`,
|
|
7
|
-
apiKey: 'dummy', // ark-api doesn't require an API key
|
|
8
|
-
dangerouslyAllowBrowser: false,
|
|
9
|
-
maxRetries: 0, // Disable automatic retries for query errors
|
|
10
|
-
});
|
|
11
5
|
}
|
|
12
6
|
getBaseUrl() {
|
|
13
7
|
return this.baseUrl;
|
|
14
8
|
}
|
|
15
9
|
async getQueryTargets() {
|
|
16
10
|
try {
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
11
|
+
const targets = [];
|
|
12
|
+
const endpoints = [
|
|
13
|
+
{ type: 'agent', path: '/v1/agents' },
|
|
14
|
+
{ type: 'model', path: '/v1/models' },
|
|
15
|
+
{ type: 'team', path: '/v1/teams' },
|
|
16
|
+
{ type: 'tool', path: '/v1/tools' },
|
|
17
|
+
];
|
|
18
|
+
for (const ep of endpoints) {
|
|
19
|
+
try {
|
|
20
|
+
const response = await fetch(`${this.baseUrl}${ep.path}`);
|
|
21
|
+
if (response.ok) {
|
|
22
|
+
const data = (await response.json());
|
|
23
|
+
for (const item of data.items || []) {
|
|
24
|
+
targets.push({
|
|
25
|
+
id: `${ep.type}/${item.name}`,
|
|
26
|
+
name: item.name,
|
|
27
|
+
type: ep.type,
|
|
28
|
+
description: item.description || item.name,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// Skip unavailable resource types
|
|
35
|
+
}
|
|
36
|
+
}
|
|
29
37
|
return targets;
|
|
30
38
|
}
|
|
31
39
|
catch (error) {
|
|
32
|
-
throw new Error(`Failed to get query targets: ${error instanceof Error ? error.message : 'Unknown error'}
|
|
40
|
+
throw new Error(`Failed to get query targets: ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error });
|
|
33
41
|
}
|
|
34
42
|
}
|
|
35
43
|
async getAgents() {
|
|
@@ -42,7 +50,7 @@ export class ArkApiClient {
|
|
|
42
50
|
return data.items || [];
|
|
43
51
|
}
|
|
44
52
|
catch (error) {
|
|
45
|
-
throw new Error(`Failed to get agents: ${error instanceof Error ? error.message : 'Unknown error'}
|
|
53
|
+
throw new Error(`Failed to get agents: ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error });
|
|
46
54
|
}
|
|
47
55
|
}
|
|
48
56
|
async getModels() {
|
|
@@ -55,7 +63,7 @@ export class ArkApiClient {
|
|
|
55
63
|
return data.items || [];
|
|
56
64
|
}
|
|
57
65
|
catch (error) {
|
|
58
|
-
throw new Error(`Failed to get models: ${error instanceof Error ? error.message : 'Unknown error'}
|
|
66
|
+
throw new Error(`Failed to get models: ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error });
|
|
59
67
|
}
|
|
60
68
|
}
|
|
61
69
|
async getTools() {
|
|
@@ -68,7 +76,7 @@ export class ArkApiClient {
|
|
|
68
76
|
return data.items || [];
|
|
69
77
|
}
|
|
70
78
|
catch (error) {
|
|
71
|
-
throw new Error(`Failed to get tools: ${error instanceof Error ? error.message : 'Unknown error'}
|
|
79
|
+
throw new Error(`Failed to get tools: ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error });
|
|
72
80
|
}
|
|
73
81
|
}
|
|
74
82
|
async getTeams() {
|
|
@@ -81,7 +89,7 @@ export class ArkApiClient {
|
|
|
81
89
|
return data.items || [];
|
|
82
90
|
}
|
|
83
91
|
catch (error) {
|
|
84
|
-
throw new Error(`Failed to get teams: ${error instanceof Error ? error.message : 'Unknown error'}
|
|
92
|
+
throw new Error(`Failed to get teams: ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error });
|
|
85
93
|
}
|
|
86
94
|
}
|
|
87
95
|
async getSessions() {
|
|
@@ -94,7 +102,7 @@ export class ArkApiClient {
|
|
|
94
102
|
return data.items || [];
|
|
95
103
|
}
|
|
96
104
|
catch (error) {
|
|
97
|
-
throw new Error(`Failed to get sessions: ${error instanceof Error ? error.message : 'Unknown error'}
|
|
105
|
+
throw new Error(`Failed to get sessions: ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error });
|
|
98
106
|
}
|
|
99
107
|
}
|
|
100
108
|
async deleteSession(sessionId) {
|
|
@@ -108,7 +116,7 @@ export class ArkApiClient {
|
|
|
108
116
|
return await response.json();
|
|
109
117
|
}
|
|
110
118
|
catch (error) {
|
|
111
|
-
throw new Error(`Failed to delete session: ${error instanceof Error ? error.message : 'Unknown error'}
|
|
119
|
+
throw new Error(`Failed to delete session: ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error });
|
|
112
120
|
}
|
|
113
121
|
}
|
|
114
122
|
async deleteQueryMessages(sessionId, queryId) {
|
|
@@ -122,7 +130,7 @@ export class ArkApiClient {
|
|
|
122
130
|
return await response.json();
|
|
123
131
|
}
|
|
124
132
|
catch (error) {
|
|
125
|
-
throw new Error(`Failed to delete query messages: ${error instanceof Error ? error.message : 'Unknown error'}
|
|
133
|
+
throw new Error(`Failed to delete query messages: ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error });
|
|
126
134
|
}
|
|
127
135
|
}
|
|
128
136
|
async deleteAllSessions() {
|
|
@@ -136,24 +144,35 @@ export class ArkApiClient {
|
|
|
136
144
|
return await response.json();
|
|
137
145
|
}
|
|
138
146
|
catch (error) {
|
|
139
|
-
throw new Error(`Failed to delete all sessions: ${error instanceof Error ? error.message : 'Unknown error'}
|
|
147
|
+
throw new Error(`Failed to delete all sessions: ${error instanceof Error ? error.message : 'Unknown error'}`, { cause: error });
|
|
140
148
|
}
|
|
141
149
|
}
|
|
142
|
-
async
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
150
|
+
async createQuery(params) {
|
|
151
|
+
const response = await fetch(`${this.baseUrl}/v1/queries/`, {
|
|
152
|
+
method: 'POST',
|
|
153
|
+
headers: { 'Content-Type': 'application/json' },
|
|
154
|
+
body: JSON.stringify({
|
|
155
|
+
name: `cli-query-${Date.now()}`,
|
|
156
|
+
type: 'user',
|
|
157
|
+
input: params.input,
|
|
158
|
+
target: params.target,
|
|
159
|
+
sessionId: params.sessionId,
|
|
160
|
+
conversationId: params.conversationId,
|
|
161
|
+
timeout: params.timeout,
|
|
162
|
+
...(params.metadata ? { metadata: params.metadata } : {}),
|
|
163
|
+
}),
|
|
154
164
|
});
|
|
155
|
-
|
|
156
|
-
|
|
165
|
+
if (!response.ok) {
|
|
166
|
+
const text = await response.text();
|
|
167
|
+
throw new Error(`Query creation failed (${response.status}): ${text}`);
|
|
168
|
+
}
|
|
169
|
+
return (await response.json());
|
|
170
|
+
}
|
|
171
|
+
async getQuery(queryName) {
|
|
172
|
+
const response = await fetch(`${this.baseUrl}/v1/queries/${queryName}`);
|
|
173
|
+
if (!response.ok) {
|
|
174
|
+
throw new Error(`Failed to get query: ${response.status}`);
|
|
157
175
|
}
|
|
176
|
+
return (await response.json());
|
|
158
177
|
}
|
|
159
178
|
}
|
package/dist/lib/arkApiProxy.js
CHANGED
|
@@ -2,6 +2,7 @@ import { ArkApiClient } from './arkApiClient.js';
|
|
|
2
2
|
import { ArkServiceProxy } from './arkServiceProxy.js';
|
|
3
3
|
import { arkServices } from '../arkServices.js';
|
|
4
4
|
export class ArkApiProxy {
|
|
5
|
+
serviceProxy;
|
|
5
6
|
constructor(localPort, reusePortForwards = false) {
|
|
6
7
|
const arkApiService = arkServices['ark-api'];
|
|
7
8
|
this.serviceProxy = new ArkServiceProxy(arkApiService, localPort, reusePortForwards);
|
|
@@ -3,9 +3,13 @@ import find from 'find-process';
|
|
|
3
3
|
import Debug from 'debug';
|
|
4
4
|
const debug = Debug('ark:service-proxy');
|
|
5
5
|
export class ArkServiceProxy {
|
|
6
|
+
reusePortForwards;
|
|
7
|
+
kubectlProcess;
|
|
8
|
+
localPort;
|
|
9
|
+
isReady = false;
|
|
10
|
+
service;
|
|
6
11
|
constructor(service, localPort, reusePortForwards = false) {
|
|
7
12
|
this.reusePortForwards = reusePortForwards;
|
|
8
|
-
this.isReady = false;
|
|
9
13
|
this.service = service;
|
|
10
14
|
this.localPort =
|
|
11
15
|
localPort || service.k8sPortForwardLocalPort || this.getRandomPort();
|
package/dist/lib/chatClient.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { ArkApiClient, QueryTarget } from './arkApiClient.js';
|
|
2
|
-
import type { Query } from './types.js';
|
|
3
2
|
export { QueryTarget };
|
|
4
3
|
export interface ChatConfig {
|
|
5
4
|
streamingEnabled: boolean;
|
|
6
5
|
currentTarget?: QueryTarget;
|
|
7
|
-
a2aContextId?: string;
|
|
8
6
|
sessionId?: string;
|
|
9
7
|
conversationId?: string;
|
|
10
8
|
queryTimeout?: string;
|
|
9
|
+
a2aContextId?: string;
|
|
11
10
|
}
|
|
12
11
|
export interface ToolCall {
|
|
13
12
|
id: string;
|
|
@@ -23,17 +22,16 @@ export interface ArkMetadata {
|
|
|
23
22
|
model?: string;
|
|
24
23
|
query?: string;
|
|
25
24
|
target?: string;
|
|
26
|
-
completedQuery?:
|
|
25
|
+
completedQuery?: Record<string, unknown>;
|
|
27
26
|
}
|
|
28
27
|
export declare class ChatClient {
|
|
29
28
|
private arkApiClient;
|
|
30
29
|
constructor(arkApiClient: ArkApiClient);
|
|
31
30
|
getQueryTargets(): Promise<QueryTarget[]>;
|
|
32
|
-
/**
|
|
33
|
-
* Send a chat completion request
|
|
34
|
-
*/
|
|
35
31
|
sendMessage(targetId: string, messages: Array<{
|
|
36
32
|
role: 'user' | 'assistant' | 'system';
|
|
37
33
|
content: string;
|
|
38
34
|
}>, config: ChatConfig, onChunk?: (chunk: string, toolCalls?: ToolCall[], arkMetadata?: ArkMetadata) => void, signal?: AbortSignal): Promise<string>;
|
|
35
|
+
private pollResponse;
|
|
36
|
+
private pollStreamResponse;
|
|
39
37
|
}
|