p43K
This commit is contained in:
@@ -281,7 +281,10 @@ final class AgentRunnerConfig
|
||||
*/
|
||||
public function getInputNormalizationFuzzyRoutingTerms(): array
|
||||
{
|
||||
return $this->getRequiredStringList('input_normalization.fuzzy_routing.terms');
|
||||
return $this->getConfiguredStringListOrVocabularyView(
|
||||
'input_normalization.fuzzy_routing.terms',
|
||||
'input_normalization.fuzzy_routing.vocabulary_views.terms'
|
||||
);
|
||||
}
|
||||
|
||||
private function getRequiredInt(string $key): int
|
||||
|
||||
@@ -129,7 +129,10 @@ final class GovernanceConfig
|
||||
/** @return string[] */
|
||||
public function getVocabularyProtectedShortModelTokens(): array
|
||||
{
|
||||
return $this->requiredStringList('vocabulary.protected_short_model_tokens');
|
||||
return $this->optionalStringList(
|
||||
'vocabulary.protected_short_model_tokens',
|
||||
$this->getRegressionProtectedShortModelTokens()
|
||||
);
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
@@ -152,6 +155,8 @@ final class GovernanceConfig
|
||||
throw $this->invalid('language.required_profile_terms', 'must be a map of cleanup profile term lists');
|
||||
}
|
||||
|
||||
$defaults = $this->languageRequiredProfileTermDefaults();
|
||||
|
||||
$out = [];
|
||||
foreach ($value as $profileName => $profileTerms) {
|
||||
if (!is_string($profileName) || trim($profileName) === '' || !is_array($profileTerms)) {
|
||||
@@ -160,9 +165,9 @@ final class GovernanceConfig
|
||||
|
||||
$normalizedProfileName = trim($profileName);
|
||||
$out[$normalizedProfileName] = [
|
||||
'stopwords' => $this->normalizeStringList($profileTerms['stopwords'] ?? []),
|
||||
'phrases' => $this->normalizeStringList($profileTerms['phrases'] ?? []),
|
||||
'meta_terms' => $this->normalizeStringList($profileTerms['meta_terms'] ?? []),
|
||||
'stopwords' => $this->normalizeStringList($profileTerms['stopwords'] ?? $defaults['stopwords']),
|
||||
'phrases' => $this->normalizeStringList($profileTerms['phrases'] ?? $defaults['phrases']),
|
||||
'meta_terms' => $this->normalizeStringList($profileTerms['meta_terms'] ?? $defaults['meta_terms']),
|
||||
];
|
||||
|
||||
if ($out[$normalizedProfileName]['stopwords'] === []
|
||||
@@ -180,6 +185,29 @@ final class GovernanceConfig
|
||||
return $out;
|
||||
}
|
||||
|
||||
/** @return array{stopwords:string[], phrases:string[], meta_terms:string[]} */
|
||||
private function languageRequiredProfileTermDefaults(): array
|
||||
{
|
||||
$value = $this->optionalValue('language.required_profile_term_defaults');
|
||||
if ($value === null) {
|
||||
return [
|
||||
'stopwords' => [],
|
||||
'phrases' => [],
|
||||
'meta_terms' => [],
|
||||
];
|
||||
}
|
||||
|
||||
if (!is_array($value)) {
|
||||
throw $this->invalid('language.required_profile_term_defaults', 'must be a map of cleanup profile term lists');
|
||||
}
|
||||
|
||||
return [
|
||||
'stopwords' => $this->normalizeStringList($value['stopwords'] ?? []),
|
||||
'phrases' => $this->normalizeStringList($value['phrases'] ?? []),
|
||||
'meta_terms' => $this->normalizeStringList($value['meta_terms'] ?? []),
|
||||
];
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
public function getCorePatternAuditSourceRoots(): array
|
||||
{
|
||||
@@ -299,6 +327,18 @@ final class GovernanceConfig
|
||||
return $this->nonEmptyStringList($path, $this->requiredValue($path));
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
private function optionalStringList(string $path, array $fallback = []): array
|
||||
{
|
||||
$value = $this->optionalValue($path);
|
||||
if ($value === null) {
|
||||
return $this->normalizeStringList($fallback);
|
||||
}
|
||||
|
||||
$out = $this->normalizeStringList($value);
|
||||
return $out !== [] ? $out : $this->normalizeStringList($fallback);
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
private function nonEmptyStringList(string $path, mixed $value): array
|
||||
{
|
||||
@@ -337,11 +377,21 @@ final class GovernanceConfig
|
||||
}
|
||||
|
||||
private function requiredValue(string $path): mixed
|
||||
{
|
||||
$value = $this->optionalValue($path);
|
||||
if ($value === null) {
|
||||
throw $this->missing($path);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
private function optionalValue(string $path): mixed
|
||||
{
|
||||
$value = $this->config;
|
||||
foreach (explode('.', $path) as $segment) {
|
||||
if (!is_array($value) || !array_key_exists($segment, $value)) {
|
||||
throw $this->missing($path);
|
||||
return null;
|
||||
}
|
||||
|
||||
$value = $value[$segment];
|
||||
|
||||
Reference in New Issue
Block a user