Open-World: удержать бизнес-обзор от мусорных anchors

This commit is contained in:
2026-05-05 15:43:47 +03:00
parent ee69c7bc8d
commit d797b3fa99
13 changed files with 424 additions and 19 deletions
@@ -56,7 +56,17 @@ function hasUnicodeLikelyCounterpartyAfterBy(text) {
"\u0431\u0430\u043d\u043a\u0435",
"\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u043c",
"\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b",
"\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443"
"\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443",
"\u0434\u0430\u043d\u043d\u044b\u043c",
"\u044d\u0442\u0438\u043c",
"\u044d\u0442\u0438\u043c\u0438",
"\u0438\u0442\u043e\u0433\u0443",
"\u0438\u0442\u043e\u0433\u0430\u043c",
"\u0432\u0441\u0435\u043c\u0443",
"\u0432\u0441\u0435\u0439",
"\u0432\u0441\u0435\u043c",
"\u0432\u044b\u0432\u043e\u0434\u0443",
"\u0432\u044b\u0432\u043e\u0434\u0430\u043c"
]);
return !stopWords.has(token);
}
@@ -1152,6 +1152,30 @@ function isLikelyCounterpartyToken(rawToken) {
"этомуже",
"томуже"
]);
for (const semanticStopWord of [
"данным",
"этим",
"этими",
"итогу",
"итогам",
"всему",
"всей",
"всем",
"выводу",
"выводам",
"аудиту",
"прокси",
"покажи",
"показать",
"выведи",
"вывести",
"дай",
"дать",
"какие",
"список"
]) {
stopWords.add(semanticStopWord);
}
return !stopWords.has(token);
}
function hasPartyAnchorMention(text) {
@@ -1658,6 +1682,18 @@ function resolveUnicodeAddressIntentBridge(text) {
"сальдо",
"дате",
"периоду",
"данным",
"этим",
"этими",
"итогу",
"итогам",
"всему",
"всей",
"всем",
"выводу",
"выводам",
"аудиту",
"прокси",
"складу",
"товару",
"этому",
@@ -95,11 +95,48 @@ function isActionVerbEntityCandidate(value) {
}
return new Set(["провести", "показать", "посмотреть", "смотреть", "найти", "искать", "анализ"]).has((0, addressTextRepair_1.normalizeRussianComparableText)(value));
}
function isGarbageSemanticAnchorCandidate(value) {
if (!value) {
return false;
}
const text = compactLower((0, addressTextRepair_1.repairAddressMojibakeText)(value));
if (!text || text.length < 2) {
return true;
}
const compact = (0, addressTextRepair_1.normalizeRussianComparableText)(text);
if (new Set([
"данным",
"этим",
"этими",
"итогу",
"итогам",
"всему",
"всей",
"всем",
"выводу",
"выводам",
"аудиту",
"прокси",
"proxy",
"summary",
"overall"
]).has(compact)) {
return true;
}
if (/^(?:по\s+)?(?:этим|этими)\s+данн\p{L}*$/iu.test(text) ||
/^(?:и\s+)?кто\s+(?:главн\p{L}*|основн\p{L}*|крупн\p{L}*)\s+(?:клиент|покупател|поставщик|контрагент)(?:\s+в)?$/iu.test(text) ||
/^(?:что|чего)\s+(?:подтвержден\p{L}*|не\s+хватает)/iu.test(text) ||
/^(?:можно\s+ли|если\s+нет|дай\s+proxy|дай\s+прокси)/iu.test(text)) {
return true;
}
return false;
}
function isInvalidEntityCandidate(value) {
return Boolean(value &&
(isReferentialEntityPlaceholder(value) ||
isValueFlowPredicateEntityCandidate(value) ||
isActionVerbEntityCandidate(value)));
isActionVerbEntityCandidate(value) ||
isGarbageSemanticAnchorCandidate(value)));
}
function normalizeFollowupCounterpartyCandidate(value) {
const text = candidateValue(value);
@@ -288,6 +325,13 @@ function mapPilotScopeToFollowupMeaning(pilotScope) {
unsupported: "1c_metadata_surface"
};
}
if (pilotScope === "business_overview_route_template_v1") {
return {
domain: "business_overview",
action: "broad_evaluation",
unsupported: "broad_business_evaluation"
};
}
return {
domain: null,
action: null,
@@ -568,6 +612,23 @@ function hasBusinessOverviewSignal(text) {
}
return /(?:\u0431\u0438\u0437\u043d\u0435\u0441[-\s]?\u043e\u0431\u0437\u043e\u0440|\u0431\u0438\u0437\u043d\u0435\u0441[-\s]?\u0430\u0443\u0434\u0438\u0442|\u043f\u043e\u043b\u043d\w*\s+\u0430\u043d\u0430\u043b\u0438\u0437\s+(?:\u043a\u043e\u043c\u043f\u0430\u043d|\u0431\u0438\u0437\u043d\u0435\u0441|\u0434\u0435\u044f\u0442\u0435\u043b)|\u0441\u0432\u043e\u0434\u043d\w*\s+\u0430\u043d\u0430\u043b\u0438\u0437\s+(?:\u043a\u043e\u043c\u043f\u0430\u043d|\u0431\u0438\u0437\u043d\u0435\u0441|\u0434\u0435\u044f\u0442\u0435\u043b)|\u043a\u0430\u043a\s+\u0442\u044b\s+\u043e\u0446\u0435\u043d(?:\u0438\u0448\u044c|\u0438)\s+\u0434\u0435\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442|\u043a\u043e\u043c\u043f\u0430\u043d(?:\u0438\u0438|\u0438\u044e|\u0438\u044f)\s+\u0432\s+\u0446\u0435\u043b\u043e\u043c|company\s+(?:analysis|overview)|business\s+(?:overview|audit)|llm[-\s]?audit|бизнес[-\s]?обзор|бизнес[-\s]?аудит)/iu.test(text);
}
function hasBusinessOverviewContinuationSignal(text) {
if (!text) {
return false;
}
const normalized = compactLower(text);
const hasEvidenceContinuationCue = /(?:по\s+этим\s+данн|на\s+базе\s+этих\s+данн|из\s+этого|по\s+итогам|что\s+подтвержден|чего\s+не\s+хватает|что\s+пока\s+нельзя|что\s+можно\s+сказать|какой\s+вывод|итогов|резюм|вывод)/iu.test(normalized);
const hasAnalystContinuationCue = /(?:можно\s+ли|если\s+нет|proxy|прокси|аудит|оцен|что\s+думаешь|нормальн\p{L}*\s+прибыл|прибыл|марж|рентаб|ликвидн|просроч|качество\s+долг|риск|налогов\p{L}*\s+вывод)/iu.test(normalized);
const hasTaxContinuationCue = /(?:ндс|vat)[\s\S]{0,120}(?:позици|период|основан|не\s+хватает|налогов\p{L}*\s+вывод)|(?:позици|налогов\p{L}*\s+вывод)[\s\S]{0,80}(?:ндс|vat)/iu.test(normalized);
return hasEvidenceContinuationCue || hasAnalystContinuationCue || hasTaxContinuationCue;
}
function hasBusinessOverviewFollowupSeed(followupSeed) {
return (followupSeed.pilotScope === "business_overview_route_template_v1" ||
followupSeed.domain === "business_overview" ||
followupSeed.action === "broad_evaluation" ||
followupSeed.unsupported === "broad_business_evaluation" ||
followupSeed.loopSelectedChainId === "business_overview");
}
function hasValueFlowSignal(text) {
return /(?:оборот|выручк|оплат|плат[её]ж|заплат|перечисл|списан|расход|исходящ|входящ|получ(?:ил|ено|ен)|поступил|поступлен|денежн[а-яёa-z0-9_-]*\s+поток|(?<!\p{L})заработ(?:ал|али|ало|аем|ает|ать|ано|ок)(?!\p{L})|supplier|value[-\s]?flow|turnover|revenue|payment|payout|outflow|cash\s+flow|\bearn(?:ed|ing|ings)?\b)/iu.test(text);
}
@@ -912,7 +973,8 @@ function buildAssistantMcpDiscoveryTurnInput(input) {
const rawEntitySourceText = repairedUserText ?? rawUserText ?? repairedEffectiveText ?? rawEffectiveText ?? rawSignalSourceText;
const rawText = compactLower(rawSignalSourceText);
const rawReferentialDocumentExclusionSignal = hasReferentialDocumentExclusionFollowupSignal(repairedUserText ?? rawUserText ?? "");
const rawBusinessOverviewSignal = hasBusinessOverviewSignal(rawText);
const businessOverviewContinuationSignal = hasBusinessOverviewFollowupSeed(followupSeed) && hasBusinessOverviewContinuationSignal(rawText);
const rawBusinessOverviewSignal = hasBusinessOverviewSignal(rawText) || businessOverviewContinuationSignal;
const rawLifecycleSignal = !rawBusinessOverviewSignal && hasLifecycleSignal(rawText);
const rawBidirectionalValueFlowSignal = !rawBusinessOverviewSignal && !rawLifecycleSignal && hasBidirectionalValueFlowSignal(rawText);
const rawValueFlowSignal = !rawBusinessOverviewSignal &&
@@ -1744,6 +1806,9 @@ function buildAssistantMcpDiscoveryTurnInput(input) {
if (businessOverviewSignal) {
pushReason(reasonCodes, "mcp_discovery_broad_business_evaluation_route_candidate");
}
if (businessOverviewContinuationSignal) {
pushReason(reasonCodes, "mcp_discovery_business_overview_continuation_from_followup_context");
}
if (!(valueFlowOrganizationStaysScope && normalizedPredecomposeCounterparty === explicitOrganizationScope) &&
normalizedPredecomposeCounterparty) {
pushReason(reasonCodes, "mcp_discovery_counterparty_from_predecompose");
@@ -103,7 +103,17 @@ function hasUnicodeLikelyCounterpartyAfterBy(text: string): boolean {
"\u0431\u0430\u043d\u043a\u0435",
"\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u043c",
"\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b",
"\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443"
"\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443",
"\u0434\u0430\u043d\u043d\u044b\u043c",
"\u044d\u0442\u0438\u043c",
"\u044d\u0442\u0438\u043c\u0438",
"\u0438\u0442\u043e\u0433\u0443",
"\u0438\u0442\u043e\u0433\u0430\u043c",
"\u0432\u0441\u0435\u043c\u0443",
"\u0432\u0441\u0435\u0439",
"\u0432\u0441\u0435\u043c",
"\u0432\u044b\u0432\u043e\u0434\u0443",
"\u0432\u044b\u0432\u043e\u0434\u0430\u043c"
]);
return !stopWords.has(token);
}
@@ -1379,6 +1379,30 @@ function isLikelyCounterpartyToken(rawToken: string): boolean {
"этомуже",
"томуже"
]);
for (const semanticStopWord of [
"данным",
"этим",
"этими",
"итогу",
"итогам",
"всему",
"всей",
"всем",
"выводу",
"выводам",
"аудиту",
"прокси",
"покажи",
"показать",
"выведи",
"вывести",
"дай",
"дать",
"какие",
"список"
]) {
stopWords.add(semanticStopWord);
}
return !stopWords.has(token);
}
@@ -2145,6 +2169,18 @@ function resolveUnicodeAddressIntentBridge(text: string): AddressIntentResolutio
"сальдо",
"дате",
"периоду",
"данным",
"этим",
"этими",
"итогу",
"итогам",
"всему",
"всей",
"всем",
"выводу",
"выводам",
"аудиту",
"прокси",
"складу",
"товару",
"этому",
@@ -144,12 +144,56 @@ function isActionVerbEntityCandidate(value: string | null): boolean {
);
}
function isGarbageSemanticAnchorCandidate(value: string | null): boolean {
if (!value) {
return false;
}
const text = compactLower(repairAddressMojibakeText(value));
if (!text || text.length < 2) {
return true;
}
const compact = normalizeRussianComparableText(text);
if (
new Set([
"данным",
"этим",
"этими",
"итогу",
"итогам",
"всему",
"всей",
"всем",
"выводу",
"выводам",
"аудиту",
"прокси",
"proxy",
"summary",
"overall"
]).has(compact)
) {
return true;
}
if (
/^(?:по\s+)?(?:этим|этими)\s+данн\p{L}*$/iu.test(text) ||
/^(?:и\s+)?кто\s+(?:главн\p{L}*|основн\p{L}*|крупн\p{L}*)\s+(?:клиент|покупател|поставщик|контрагент)(?:\s+в)?$/iu.test(
text
) ||
/^(?:что|чего)\s+(?:подтвержден\p{L}*|не\s+хватает)/iu.test(text) ||
/^(?:можно\s+ли|если\s+нет|дай\s+proxy|дай\s+прокси)/iu.test(text)
) {
return true;
}
return false;
}
function isInvalidEntityCandidate(value: string | null): boolean {
return Boolean(
value &&
(isReferentialEntityPlaceholder(value) ||
isValueFlowPredicateEntityCandidate(value) ||
isActionVerbEntityCandidate(value))
isActionVerbEntityCandidate(value) ||
isGarbageSemanticAnchorCandidate(value))
);
}
@@ -373,6 +417,13 @@ function mapPilotScopeToFollowupMeaning(
unsupported: "1c_metadata_surface"
};
}
if (pilotScope === "business_overview_route_template_v1") {
return {
domain: "business_overview",
action: "broad_evaluation",
unsupported: "broad_business_evaluation"
};
}
return {
domain: null,
action: null,
@@ -798,6 +849,36 @@ function hasBusinessOverviewSignal(text: string): boolean {
);
}
function hasBusinessOverviewContinuationSignal(text: string): boolean {
if (!text) {
return false;
}
const normalized = compactLower(text);
const hasEvidenceContinuationCue =
/(?:по\s+этим\s+данн|на\s+базе\s+этих\s+данн|из\s+этого|по\s+итогам|что\s+подтвержден|чего\s+не\s+хватает|что\s+пока\s+нельзя|что\s+можно\s+сказать|какой\s+вывод|итогов|резюм|вывод)/iu.test(
normalized
);
const hasAnalystContinuationCue =
/(?:можно\s+ли|если\s+нет|proxy|прокси|аудит|оцен|что\s+думаешь|нормальн\p{L}*\s+прибыл|прибыл|марж|рентаб|ликвидн|просроч|качество\s+долг|риск|налогов\p{L}*\s+вывод)/iu.test(
normalized
);
const hasTaxContinuationCue =
/(?:ндс|vat)[\s\S]{0,120}(?:позици|период|основан|не\s+хватает|налогов\p{L}*\s+вывод)|(?:позици|налогов\p{L}*\s+вывод)[\s\S]{0,80}(?:ндс|vat)/iu.test(
normalized
);
return hasEvidenceContinuationCue || hasAnalystContinuationCue || hasTaxContinuationCue;
}
function hasBusinessOverviewFollowupSeed(followupSeed: ReturnType<typeof collectFollowupDiscoverySeed>): boolean {
return (
followupSeed.pilotScope === "business_overview_route_template_v1" ||
followupSeed.domain === "business_overview" ||
followupSeed.action === "broad_evaluation" ||
followupSeed.unsupported === "broad_business_evaluation" ||
followupSeed.loopSelectedChainId === "business_overview"
);
}
function hasValueFlowSignal(text: string): boolean {
return /(?:оборот|выручк|оплат|плат[её]ж|заплат|перечисл|списан|расход|исходящ|входящ|получ(?:ил|ено|ен)|поступил|поступлен|денежн[а-яёa-z0-9_-]*\s+поток|(?<!\p{L})заработ(?:ал|али|ало|аем|ает|ать|ано|ок)(?!\p{L})|supplier|value[-\s]?flow|turnover|revenue|payment|payout|outflow|cash\s+flow|\bearn(?:ed|ing|ings)?\b)/iu.test(
text
@@ -1275,7 +1356,9 @@ export function buildAssistantMcpDiscoveryTurnInput(
const rawReferentialDocumentExclusionSignal = hasReferentialDocumentExclusionFollowupSignal(
repairedUserText ?? rawUserText ?? ""
);
const rawBusinessOverviewSignal = hasBusinessOverviewSignal(rawText);
const businessOverviewContinuationSignal =
hasBusinessOverviewFollowupSeed(followupSeed) && hasBusinessOverviewContinuationSignal(rawText);
const rawBusinessOverviewSignal = hasBusinessOverviewSignal(rawText) || businessOverviewContinuationSignal;
const rawLifecycleSignal = !rawBusinessOverviewSignal && hasLifecycleSignal(rawText);
const rawBidirectionalValueFlowSignal =
!rawBusinessOverviewSignal && !rawLifecycleSignal && hasBidirectionalValueFlowSignal(rawText);
@@ -2244,6 +2327,9 @@ export function buildAssistantMcpDiscoveryTurnInput(
if (businessOverviewSignal) {
pushReason(reasonCodes, "mcp_discovery_broad_business_evaluation_route_candidate");
}
if (businessOverviewContinuationSignal) {
pushReason(reasonCodes, "mcp_discovery_business_overview_continuation_from_followup_context");
}
if (
!(valueFlowOrganizationStaysScope && normalizedPredecomposeCounterparty === explicitOrganizationScope) &&
normalizedPredecomposeCounterparty
@@ -29,10 +29,11 @@ describe("addressIntentResolver regression bridges", () => {
expect(result.intent).toBe("customer_revenue_and_payments");
});
it("detects top-year company revenue wording", () => {
it("defers top-year company revenue wording to business overview discovery", () => {
const result = resolveAddressIntent("какой у нас самый доходный год");
expect(result.intent).toBe("customer_revenue_and_payments");
expect(result.intent).toBe("unknown");
expect(result.reasons).toContain("unicode_business_overview_earnings_deferred_to_discovery");
});
it("detects specific counterparty turnover wording as revenue profile", () => {
@@ -52,6 +53,16 @@ describe("addressIntentResolver regression bridges", () => {
expect(result.intent).toBe("list_documents_by_counterparty");
});
it("does not treat by-these-data wording as a loose counterparty anchor", () => {
const result = resolveAddressIntent(
"\u043f\u043e\u043a\u0430\u0436\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u043e \u044d\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c"
);
expect(result.intent).not.toBe("list_documents_by_counterparty");
expect(result.reasons).not.toContain("generic_lookup_with_loose_anchor_fallback");
expect(result.reasons).not.toContain("unicode_documents_by_counterparty_bridge_signal_detected");
});
it("does not collapse very old stock request into generic inventory snapshot", () => {
const result = resolveAddressIntent("Есть ли остатки товара, которые закупались очень давно");
@@ -2647,4 +2647,123 @@ describe("assistant MCP discovery turn input adapter", () => {
expect(result.reason_codes).toContain("mcp_discovery_metadata_scoped_lane_without_subject");
expect(result.reason_codes).not.toContain("mcp_discovery_counterparty_from_followup_context");
});
it("continues business overview on by-these-data profit wording without grounding pseudo anchors", () => {
const orgName =
"\u041e\u041e\u041e \u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u041f\u043b\u044e\u0441";
const result = buildAssistantMcpDiscoveryTurnInput({
userMessage:
"\u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u043f\u043e \u044d\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u0438\u0431\u044b\u043b\u044c \u0438 \u043c\u0430\u0440\u0436\u0443? \u0415\u0441\u043b\u0438 \u043d\u0435\u0442, \u0434\u0430\u0439 proxy-\u0430\u043d\u0430\u043b\u0438\u0437.",
assistantTurnMeaning: {
asked_domain_family: "counterparty",
asked_action_family: "turnover",
explicit_intent_candidate: "customer_revenue_and_payments",
explicit_entity_candidates: [
"\u043f\u043e \u044d\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c",
"\u0438 \u043a\u0442\u043e \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a \u0432"
]
},
followupContext: {
previous_discovery_pilot_scope: "business_overview_route_template_v1",
previous_filters: {
organization: orgName,
period_from: "2020-01-01",
period_to: "2020-12-31"
}
}
});
expect(result.adapter_status).toBe("ready");
expect(result.should_run_discovery).toBe(true);
expect(result.semantic_data_need).toBe("business overview evidence with bounded analyst interpretation");
expect(result.data_need_graph?.business_fact_family).toBe("business_overview");
expect(result.data_need_graph?.subject_candidates).toEqual([]);
expect(result.turn_meaning_ref).toMatchObject({
asked_domain_family: "business_overview",
asked_action_family: "broad_evaluation",
explicit_organization_scope: orgName,
explicit_date_scope: "2020",
unsupported_but_understood_family: "broad_business_evaluation",
stale_replay_forbidden: true
});
expect(result.turn_meaning_ref?.explicit_entity_candidates).toBeUndefined();
expect(result.reason_codes).toContain("mcp_discovery_business_overview_continuation_from_followup_context");
expect(result.reason_codes).not.toContain("mcp_discovery_counterparty_from_followup_context");
});
it("keeps VAT-position follow-up inside business overview instead of stale inventory position", () => {
const orgName =
"\u041e\u041e\u041e \u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u041f\u043b\u044e\u0441";
const result = buildAssistantMcpDiscoveryTurnInput({
userMessage:
"\u0427\u0442\u043e \u0441 \u041d\u0414\u0421 \u0437\u0430 2020 \u0433\u043e\u0434: \u043a\u0430\u043a\u0430\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0432\u0438\u0434\u043d\u0430 \u0438 \u0447\u0435\u0433\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u043d\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430?",
assistantTurnMeaning: {
asked_domain_family: "inventory",
asked_action_family: "stock_snapshot",
explicit_intent_candidate: "inventory_on_hand_as_of_date",
explicit_entity_candidates: ["\u043f\u043e\u0437\u0438\u0446\u0438\u044f"]
},
followupContext: {
previous_discovery_pilot_scope: "business_overview_route_template_v1",
previous_filters: {
organization: orgName
}
}
});
expect(result.adapter_status).toBe("ready");
expect(result.should_run_discovery).toBe(true);
expect(result.semantic_data_need).toBe("business overview evidence with bounded analyst interpretation");
expect(result.data_need_graph?.business_fact_family).toBe("business_overview");
expect(result.data_need_graph?.subject_candidates).toEqual([]);
expect(result.turn_meaning_ref).toMatchObject({
asked_domain_family: "business_overview",
asked_action_family: "broad_evaluation",
explicit_organization_scope: orgName,
explicit_date_scope: "2020",
unsupported_but_understood_family: "broad_business_evaluation",
stale_replay_forbidden: true
});
expect(result.turn_meaning_ref?.explicit_entity_candidates).toBeUndefined();
expect(result.reason_codes).toContain("mcp_discovery_business_overview_continuation_from_followup_context");
});
it("routes business overview final-summary wording to the overview lane without document pseudo subject", () => {
const orgName =
"\u041e\u041e\u041e \u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u041f\u043b\u044e\u0441";
const result = buildAssistantMcpDiscoveryTurnInput({
userMessage:
"\u0427\u0442\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u043e \u043f\u043e \u044d\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u0438 \u0447\u0435\u0433\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430?",
assistantTurnMeaning: {
asked_domain_family: "counterparty",
asked_action_family: "list_documents",
explicit_intent_candidate: "list_documents_by_counterparty",
explicit_entity_candidates: ["\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u043c"]
},
followupContext: {
previous_discovery_pilot_scope: "business_overview_route_template_v1",
previous_filters: {
organization: orgName,
period_from: "2020-01-01",
period_to: "2020-12-31"
}
}
});
expect(result.adapter_status).toBe("ready");
expect(result.should_run_discovery).toBe(true);
expect(result.semantic_data_need).toBe("business overview evidence with bounded analyst interpretation");
expect(result.data_need_graph?.business_fact_family).toBe("business_overview");
expect(result.data_need_graph?.subject_candidates).toEqual([]);
expect(result.turn_meaning_ref).toMatchObject({
asked_domain_family: "business_overview",
asked_action_family: "broad_evaluation",
explicit_organization_scope: orgName,
explicit_date_scope: "2020",
unsupported_but_understood_family: "broad_business_evaluation",
stale_replay_forbidden: true
});
expect(result.turn_meaning_ref?.explicit_entity_candidates).toBeUndefined();
expect(result.reason_codes).toContain("mcp_discovery_business_overview_continuation_from_followup_context");
});
});