Архитектура: протянуть shared organization authority в data-scope history recovery и session bootstrap

This commit is contained in:
2026-04-18 21:25:18 +03:00
parent cf17404925
commit 59656a44a0
4 changed files with 57 additions and 51 deletions
@@ -11,6 +11,43 @@ function createPolicy() {
}
describe("assistantDataScopePolicy", () => {
it("extracts known organizations from shared assistant organization authority and assistant text fallback", () => {
const policy = createPolicy();
const organizations = policy.extractKnownOrganizationsFromHistory([
{
role: "assistant",
text: "Доступны организации: Org Text, Org Extra.",
debug: {
execution_lane: "living_chat",
living_chat_selected_organization: "Org Selected",
assistant_active_organization: "Org Selected",
assistant_known_organizations: ["Org Selected", "Org Backup"],
organization_candidates: ["Org Candidate"]
}
},
{
role: "assistant",
debug: {
execution_lane: "address_query",
answer_grounding_check: { status: "grounded" },
extracted_filters: {
organization: "Org Grounded"
}
}
}
]);
expect(organizations).toEqual([
"Org Grounded",
"Org Selected",
"Org Backup",
"Org Candidate",
"Org Text",
"Org Extra"
]);
});
it("recovers active organization from assistant-side living chat authority when grounded answer is absent", () => {
const policy = createPolicy();