АРЧ АП11 - Архитектура после регресса: Архитектура: протянуть shared organization authority в transition carryover и удержать phase12 replay зелёным

This commit is contained in:
2026-04-18 20:03:11 +03:00
parent 0ecee2b360
commit 4e1830282b
4 changed files with 94 additions and 19 deletions
@@ -256,6 +256,54 @@ describe("assistantTransitionPolicy", () => {
expect(carryover?.followupContext?.root_context_only).toBeUndefined();
});
it("hydrates follow-up organization from shared assistant authority when local history filters are empty", () => {
const policy = buildPolicy({
findLastAddressAssistantItem: () => ({
text: "Подтвержденная дебиторская задолженность на 31.03.2020 собрана.",
debug: {
detected_intent: "receivables_confirmed_as_of_date",
extracted_filters: {
as_of_date: "2020-03-31",
period_from: "2020-03-01",
period_to: "2020-03-31"
},
anchor_type: "organization",
anchor_value_resolved: null
}
}),
hasAddressFollowupContextSignal: () => true,
hasReferentialPointer: () => true,
findRecentInventoryRootFrame: () => null,
findRecentAddressFilterValue: () => null,
resolveAddressIntent: () => ({ intent: "unknown" })
});
const carryover = policy.resolveAddressFollowupCarryoverContext(
"остатки по складу на эту же дату",
[
{
role: "assistant",
text: "Компания уже выбрана в живом чате.",
debug: {
assistant_active_organization: 'ООО "Альтернатива Плюс"',
assistant_known_organizations: ['ООО "Альтернатива Плюс"', 'ООО "Лайт"']
}
}
],
null,
null,
null
);
expect(carryover?.followupContext?.previous_filters).toMatchObject({
organization: 'ООО "Альтернатива Плюс"',
as_of_date: "2020-03-31",
period_from: "2020-03-01",
period_to: "2020-03-31"
});
expect(carryover?.followupContext?.target_intent).toBe("inventory_on_hand_as_of_date");
});
it("bridges selected-item purchase provenance into a VAT period follow-up", () => {
const item = "Рабочая станция универсального специалиста";
const policy = buildPolicy({