Архитектура: централизовать selected-item carryover в continuity policy и transition glue
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
applyHistoricalPartyCarryoverFilters,
|
||||
applyOrganizationCarryoverFilters,
|
||||
applyReferencedEntityCarryover,
|
||||
applySelectedItemCarryover,
|
||||
applyTemporalCarryoverFilters,
|
||||
buildRootScopedCarryoverFilters,
|
||||
hydrateInventoryRootFrameState,
|
||||
@@ -324,4 +325,29 @@ describe("assistantContinuityPolicy organization authority", () => {
|
||||
resolvedCounterpartyFromDisplay: true
|
||||
});
|
||||
});
|
||||
|
||||
it("applies selected-item carryover from navigation focus before continuity and explicit labels", () => {
|
||||
const carryover = applySelectedItemCarryover(
|
||||
{
|
||||
organization: "Org Alt"
|
||||
},
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
true,
|
||||
"Workstation Navigation",
|
||||
"Workstation Continuity",
|
||||
"Workstation User",
|
||||
"Workstation Alternate"
|
||||
);
|
||||
|
||||
expect(carryover).toEqual({
|
||||
previousFilters: {
|
||||
organization: "Org Alt",
|
||||
item: "Workstation Navigation"
|
||||
},
|
||||
previousAnchorType: "item",
|
||||
previousAnchorValue: "Workstation Navigation"
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -297,6 +297,48 @@ describe("assistantTransitionPolicy", () => {
|
||||
expect(carryover?.followupContext?.root_context_only).toBeUndefined();
|
||||
});
|
||||
|
||||
it("hydrates selected-item carryover through shared continuity helper for short object follow-up", () => {
|
||||
const policy = buildPolicy({
|
||||
findLastAddressAssistantItem: () => ({
|
||||
text: "Подтвержден складской срез по выбранной позиции.",
|
||||
debug: {
|
||||
detected_intent: "inventory_on_hand_as_of_date",
|
||||
extracted_filters: {
|
||||
organization: 'ООО "Альтернатива Плюс"',
|
||||
as_of_date: "2020-03-31"
|
||||
}
|
||||
}
|
||||
}),
|
||||
hasAddressFollowupContextSignal: () => true,
|
||||
hasShortInventoryObjectFollowupSignal: () => true,
|
||||
findRecentInventoryRootFrame: () => null,
|
||||
resolveAddressIntent: () => ({ intent: "unknown" })
|
||||
});
|
||||
|
||||
const carryover = policy.resolveAddressFollowupCarryoverContext(
|
||||
"по этой позиции покажи документы",
|
||||
[],
|
||||
null,
|
||||
null,
|
||||
{
|
||||
session_context: {
|
||||
active_focus_object: {
|
||||
object_type: "item",
|
||||
label: "Workstation Focus"
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
expect(carryover?.followupContext?.previous_filters).toMatchObject({
|
||||
organization: 'ООО "Альтернатива Плюс"',
|
||||
as_of_date: "2020-03-31",
|
||||
item: "Workstation Focus"
|
||||
});
|
||||
expect(carryover?.followupContext?.previous_anchor_type).toBe("item");
|
||||
expect(carryover?.followupContext?.previous_anchor_value).toBe("Workstation Focus");
|
||||
});
|
||||
|
||||
it("hydrates follow-up organization from shared assistant authority when local history filters are empty", () => {
|
||||
const policy = buildPolicy({
|
||||
findLastAddressAssistantItem: () => ({
|
||||
|
||||
Reference in New Issue
Block a user