Усилить семантический AGENT gate для 1С

This commit is contained in:
2026-05-23 22:01:29 +03:00
parent 75e0e2c66e
commit a4dd9c7c66
9 changed files with 634 additions and 13 deletions
@@ -537,6 +537,9 @@ function hasValueFlowActionConflictWithDiscoveryTurnMeaning(
if (askedDomain !== "counterparty_value") {
return false;
}
if (askedAction === "net_value_flow") {
return true;
}
if (hasExactBankOperationsAddressReply(input, entryPoint)) {
return false;
}
@@ -544,9 +547,6 @@ function hasValueFlowActionConflictWithDiscoveryTurnMeaning(
if (askedAction === "payout") {
return detectedIntent !== "supplier_payouts_profile";
}
if (askedAction === "net_value_flow") {
return true;
}
return false;
}
@@ -726,6 +726,10 @@ function hasSemanticConflictWithDiscoveryTurnMeaning(
return false;
}
if (hasExactBankOperationsAddressReply(input, entryPoint)) {
const askedAction = toNonEmptyString(readDiscoveryTurnMeaning(entryPoint)?.asked_action_family);
if (askedAction === "net_value_flow") {
return true;
}
return false;
}
const detectedIntent = toNonEmptyString(input.addressRuntimeMeta?.detected_intent);
@@ -870,6 +874,10 @@ export function applyAssistantMcpDiscoveryResponsePolicy(
input,
entryPoint
);
const exactBankOperationsProtectsCurrent =
exactBankOperationsAddressReply &&
!semanticConflictWithDiscoveryTurnMeaning &&
!valueFlowActionConflictWithDiscoveryTurnMeaning;
if (!entryPoint) {
pushReason(reasonCodes, "mcp_discovery_response_policy_no_entry_point");
@@ -940,7 +948,7 @@ export function applyAssistantMcpDiscoveryResponsePolicy(
"mcp_discovery_response_policy_keep_exact_value_flow_reply_over_business_overview_direct_money_clarification"
);
}
if (exactBankOperationsAddressReply) {
if (exactBankOperationsProtectsCurrent) {
pushReason(reasonCodes, "mcp_discovery_response_policy_keep_exact_bank_operations_address_reply");
}
if (inventoryMarginRankingAddressReply) {
@@ -980,7 +988,7 @@ export function applyAssistantMcpDiscoveryResponsePolicy(
!runtimeMatchedExactReply &&
!staleMetadataDiscoveryFallbackAgainstExactAddressReply &&
!exactValueFlowReplyForBusinessOverviewDirectMoneyNeed &&
!exactBankOperationsAddressReply &&
!exactBankOperationsProtectsCurrent &&
!inventoryMarginRankingAddressReply &&
!(deterministicBroadBusinessEvaluationReply && candidate.candidate_status === "clarification_candidate") &&
ALLOWED_CANDIDATE_STATUSES.has(candidate.candidate_status) &&