ARCH: детерминировать ответ на неподдержанный текущий смысл

This commit is contained in:
2026-04-19 21:16:22 +03:00
parent d9a85c1619
commit b339a8f8ca
3 changed files with 131 additions and 6 deletions
@@ -133,6 +133,42 @@ describe("assistant living chat runtime adapter", () => {
expect(executeLlmChat).toHaveBeenCalledTimes(1);
});
it("builds deterministic boundary for unsupported current-turn business meaning", async () => {
const executeLlmChat = vi.fn(async () => "raw-llm");
const input = buildRuntimeInput({
userMessage:
"\u043a\u0430\u043a\u043e\u0439 \u043e\u0431\u043e\u0440\u043e\u0442 \u0431\u044b\u043b \u0441\u0432\u043a",
modeDecision: { mode: "chat", reason: "unsupported_current_turn_meaning_boundary" },
addressRuntimeMeta: {
toolGateReason: "unsupported_current_turn_meaning_boundary",
orchestrationContract: {
unsupported_current_turn_meaning_boundary: true,
assistant_turn_meaning: {
unsupported_but_understood_family: "counterparty_value_or_turnover",
explicit_entity_candidates: [
{
type: "counterparty",
value: "\u0441\u0432\u043a"
}
]
}
}
},
executeLlmChat
});
const output = await runAssistantLivingChatRuntime(input);
expect(output.handled).toBe(true);
expect(output.chatText).toContain("\u043d\u0443\u0436\u0435\u043d \u043e\u0431\u043e\u0440\u043e\u0442");
expect(output.chatText).toContain("\u00ab\u0441\u0432\u043a\u00bb");
expect(output.chatText).toContain("\u043d\u0435 \u0431\u0443\u0434\u0443 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c");
expect(output.debug?.living_chat_response_source).toBe(
"deterministic_unsupported_current_turn_boundary"
);
expect(executeLlmChat).not.toHaveBeenCalled();
});
it("adds proactive organization offer on first smalltalk turn when multiple organizations are available", async () => {
const resolveDataScopeProbe = vi.fn(async () => ({
status: "resolved",