Усилить семантический 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
@@ -381,6 +381,9 @@ function hasValueFlowActionConflictWithDiscoveryTurnMeaning(input, entryPoint) {
if (askedDomain !== "counterparty_value") {
return false;
}
if (askedAction === "net_value_flow") {
return true;
}
if (hasExactBankOperationsAddressReply(input, entryPoint)) {
return false;
}
@@ -388,9 +391,6 @@ function hasValueFlowActionConflictWithDiscoveryTurnMeaning(input, entryPoint) {
if (askedAction === "payout") {
return detectedIntent !== "supplier_payouts_profile";
}
if (askedAction === "net_value_flow") {
return true;
}
return false;
}
function hasEvidenceLaneConflictWithDiscoveryTurnMeaning(input, entryPoint) {
@@ -534,6 +534,10 @@ function hasSemanticConflictWithDiscoveryTurnMeaning(input, entryPoint) {
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);
@@ -644,6 +648,9 @@ function applyAssistantMcpDiscoveryResponsePolicy(input) {
const metadataDiscoveryPriority = hasMetadataDiscoveryPriority(input, entryPoint);
const valueFlowActionConflictWithDiscoveryTurnMeaning = hasValueFlowActionConflictWithDiscoveryTurnMeaning(input, entryPoint);
const evidenceLaneConflictWithDiscoveryTurnMeaning = hasEvidenceLaneConflictWithDiscoveryTurnMeaning(input, entryPoint);
const exactBankOperationsProtectsCurrent = exactBankOperationsAddressReply &&
!semanticConflictWithDiscoveryTurnMeaning &&
!valueFlowActionConflictWithDiscoveryTurnMeaning;
if (!entryPoint) {
pushReason(reasonCodes, "mcp_discovery_response_policy_no_entry_point");
}
@@ -701,7 +708,7 @@ function applyAssistantMcpDiscoveryResponsePolicy(input) {
if (exactValueFlowReplyForBusinessOverviewDirectMoneyNeed) {
pushReason(reasonCodes, "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) {
@@ -736,7 +743,7 @@ function applyAssistantMcpDiscoveryResponsePolicy(input) {
!runtimeMatchedExactReply &&
!staleMetadataDiscoveryFallbackAgainstExactAddressReply &&
!exactValueFlowReplyForBusinessOverviewDirectMoneyNeed &&
!exactBankOperationsAddressReply &&
!exactBankOperationsProtectsCurrent &&
!inventoryMarginRankingAddressReply &&
!(deterministicBroadBusinessEvaluationReply && candidate.candidate_status === "clarification_candidate") &&
ALLOWED_CANDIDATE_STATUSES.has(candidate.candidate_status) &&