Укрепить business overview и память по СВК

This commit is contained in:
2026-06-01 22:47:45 +03:00
parent ede15c6080
commit 987419fade
13 changed files with 172 additions and 29 deletions
@@ -2139,8 +2139,11 @@ describe("address compose stage utf8 headers", () => {
expect(reply.responseType).toBe("FACTUAL_SUMMARY");
expect(reply.text).toContain("Коротко: подтвержденный НДС к уплате за налоговый период по организации ООО Альтернатива Плюс");
expect(reply.text).toContain("Расчет сделан по подтвержденным строкам книг продаж и покупок.");
expect(reply.text).toContain("- Организация: ООО Альтернатива Плюс.");
expect(reply.text).toContain("50.000,00 ₽");
expect(reply.text).toContain("не полный налоговый вердикт");
expect(reply.text).toContain("корректировки");
expect(reply.semantics?.result_mode).toBe("confirmed_balance");
expect(reply.semantics?.balance_confirmed).toBe(true);
});
@@ -484,6 +484,77 @@ describe("assistant address orchestration runtime adapter", () => {
);
});
it("recovers business overview proof bundles for a plain organization clarification", async () => {
const runMcpDiscoveryRuntimeEntryPoint = vi.fn(async () => ({
schema_version: "assistant_mcp_discovery_runtime_entry_point_v1",
policy_owner: "assistantMcpDiscoveryRuntimeEntryPoint",
entry_status: "bridge_executed",
hot_runtime_wired: false,
discovery_attempted: true
}));
const input = buildInput({
userMessage: "Alt Plus",
sessionItems: [
{
role: "assistant",
text:
"Отдельно по контрагенту Group SVK: " +
"подтверждено получили 20 653 490 руб., " +
"заплатили 2 129 651 руб., " +
"расчетное нетто в нашу сторону 18 523 839 руб. " +
"Основа: проверенные входящие платежи и исходящие платежи и документы по цепочке: найдено 19."
}
],
runAddressLlmPreDecompose: vi.fn(async () => ({
attempted: true,
applied: false,
effectiveMessage: "Alt Plus",
reason: "raw_kept",
predecomposeContract: {
mode: "unsupported",
intent: "unknown",
entities: { organization: "Alt Plus" }
}
})),
resolveAddressFollowupCarryoverContext: vi.fn(() => ({ followupContext: null })),
resolveAssistantOrchestrationDecision: vi.fn(() => ({
runAddressLane: true,
livingMode: "address_data",
livingReason: "address_lane_triggered",
toolGateDecision: "run_address_lane",
toolGateReason: "followup_context_detected",
orchestrationContract: {
schema_version: "assistant_orchestration_contract_v1",
assistant_turn_meaning: {
schema_version: "assistant_turn_meaning_v1",
asked_domain_family: "business_overview",
asked_action_family: "broad_evaluation"
}
}
})),
runMcpDiscoveryRuntimeEntryPoint
});
await buildAssistantAddressOrchestrationRuntime(input);
expect(runMcpDiscoveryRuntimeEntryPoint).toHaveBeenCalledWith(
expect.objectContaining({
followupContext: expect.objectContaining({
previous_discovery_loop_selected_chain_id: "business_overview",
previous_discovery_loop_metadata_scope_hint: "Group SVK",
previous_discovery_bidirectional_value_flow: expect.objectContaining({
counterparty: "Group SVK",
net_amount_human_ru: "18 523 839 руб."
}),
previous_discovery_document_summary: expect.objectContaining({
counterparty: "Group SVK",
document_count: 19
})
})
})
);
});
it("recovers business overview proof bundles from navigation comparison state", async () => {
const valueFlowBundle = {
counterparty: "Group SVK",
@@ -1546,9 +1546,12 @@ describe("assistant MCP discovery response candidate", () => {
);
const firstLine = candidate.reply_text?.split("\n")[0] ?? "";
expect(firstLine).toContain("по ограниченному проверенному 1С-срезу");
expect(firstLine).toContain("По подтвержденным строкам 1С");
expect(firstLine).toContain("входящие 157 192 981,43 руб.");
expect(firstLine).toContain("исходящие 35 439 044,74 руб.");
expect(firstLine).toContain("не аудиторское заключение");
expect(firstLine).toContain("не подтвержденная чистая прибыль");
expect(candidate.reply_text).toContain("Интерпретация:");
expect(candidate.reply_text).toContain("Что видно в ограниченном денежном срезе");
expect(candidate.reply_text).toContain("Что не подтверждено в этом срезе");
expect(candidate.reply_text).toContain("НДС");