forked from aws/agentcore-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.ts
More file actions
33 lines (30 loc) · 1.17 KB
/
Copy pathutils.ts
File metadata and controls
33 lines (30 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import type { AgentCoreProjectSpec } from '../../../schema';
export type DeployMode = 'deploy' | 'dry-run' | 'diff';
export const DEFAULT_DEPLOY_ATTRS = {
runtime_count: 0,
memory_count: 0,
credential_count: 0,
evaluator_count: 0,
online_eval_count: 0,
gateway_count: 0,
gateway_target_count: 0,
policy_engine_count: 0,
policy_count: 0,
mode: 'deploy' as DeployMode,
};
export function computeDeployAttrs(projectSpec: Partial<AgentCoreProjectSpec>, mode: DeployMode) {
const gateways = projectSpec.agentCoreGateways ?? [];
const policyEngines = projectSpec.policyEngines ?? [];
return {
runtime_count: (projectSpec.runtimes ?? []).length,
memory_count: (projectSpec.memories ?? []).length,
credential_count: (projectSpec.credentials ?? []).length,
evaluator_count: (projectSpec.evaluators ?? []).length,
online_eval_count: (projectSpec.onlineEvalConfigs ?? []).length,
gateway_count: gateways.length,
gateway_target_count: gateways.reduce((sum, g) => sum + (g.targets ?? []).length, 0),
policy_engine_count: policyEngines.length,
policy_count: policyEngines.reduce((sum, pe) => sum + (pe.policies ?? []).length, 0),
mode,
};
}