MCPcopy Create free account
hub / github.com/openai/plugins / evaluate

Function evaluate

plugins/codex-security/scripts/config_preflight.py:732–825  ·  view source on GitHub ↗
(args: argparse.Namespace)

Source from the content-addressed store, hash-verified

730
731
732def evaluate(args: argparse.Namespace) -> dict[str, Any]:
733 registry = read_toml(args.registry, required=True)
734 validate_registry(registry)
735 profile_id = resolve_profile(registry, profile=args.profile, skill=args.skill)
736 try:
737 profile = registry["profiles"][profile_id]
738 except KeyError as error:
739 raise ValueError(f"unknown capability profile: {profile_id!r}") from error
740
741 cli_profile_selected = args.codex_config_profile is not None
742 if args.config:
743 config_paths = args.config
744 config_discovery = None
745 config_resolution = "manual-layers"
746 project_config_paths_set: set[Path] = set()
747 profile_layer_path = None
748 else:
749 profile_layer_path = config_profile_layer_path(args.codex_config_profile)
750 config_paths, config_discovery = discover_config_paths(
751 cwd=args.cwd,
752 profile_layer_path=profile_layer_path,
753 )
754 config_resolution = "cwd-discovery"
755 project_config_paths_set = set(config_paths[3 if profile_layer_path else 2 :])
756 config_layers = []
757 for path in config_paths:
758 config = read_toml(path, required=False)
759 if path in project_config_paths_set:
760 # Codex strips project-local profile selection and definitions before
761 # resolving the merged config. Mirror that denylist here.
762 config = dict(config)
763 config.pop("profile", None)
764 config.pop("profiles", None)
765 config_layers.append((path, config))
766 config_profile, embedded_config_profile = resolve_active_config_profile(
767 config_layers=config_layers,
768 override=args.codex_config_profile,
769 cli_profile_selected=cli_profile_selected,
770 )
771 runtime_checks = parse_runtime_checks(args.runtime_check)
772 available_plugin_skills = parse_available_plugin_skills(args.available_plugin_skill)
773 effective_config = parse_effective_config(args.effective_config)
774 multi_agent_context = resolve_multi_agent_context(
775 config_layers=config_layers,
776 effective_config=effective_config,
777 config_profile=embedded_config_profile,
778 runtime_owner=args.multi_agent_runtime_owner,
779 runtime_version=args.multi_agent_runtime_version,
780 runtime_session_cap=args.multi_agent_session_cap,
781 runtime_provenance=args.multi_agent_runtime_provenance,
782 )
783 results = [
784 evaluate_requirement(
785 requirement,
786 capabilities=registry["capabilities"],
787 config_layers=config_layers,
788 effective_config=effective_config,
789 runtime_checks=runtime_checks,

Callers 1

mainFunction · 0.85

Calls 13

read_tomlFunction · 0.85
validate_registryFunction · 0.85
resolve_profileFunction · 0.85
discover_config_pathsFunction · 0.85
parse_runtime_checksFunction · 0.85
parse_effective_configFunction · 0.85
evaluate_requirementFunction · 0.85
resolve_remediationFunction · 0.85

Tested by

no test coverage detected