ГЛОБАЛЬНЫЙ РЕФАКТОРИНГ АРХИТЕКТУРЫ - Рефакторинг этапов 2.2 - Усилена оркестрацию в deep/address гейте и follow-up binding в assistantService.ts. Починен кейс UTF-8 follow-up refinement (теперь followup_state_usage.applied=true в нужном сценарии). Убраны регрессии по assistantLivingRouter и stage3 lifecycle probe. Корректное поведение для llm canonical candidate (чтобы не уезжало в clarification_required там, где должен быть address factual).

This commit is contained in:
2026-04-11 14:56:14 +03:00
parent 19f5f19d8e
commit b5bd4fd737
46 changed files with 2471 additions and 370 deletions
@@ -16,7 +16,7 @@ export interface BuildAssistantDeepTurnCompositionInput {
groundingCheck: AnswerGroundingCheck;
followupUsage: AssistantFollowupUsage | null | undefined;
investigationState: InvestigationStateWithProblemUnits | null | undefined;
companyAnchors: unknown;
companyAnchors: CompanyAnchorSet | null;
normalizedPayload: NormalizeResponsePayload["normalized"];
featureAnswerPolicyV11: boolean;
featureProblemCentricAnswerV1: boolean;
@@ -34,7 +34,7 @@ export interface AssistantDeepTurnCompositionOutput {
composition: ReturnType<typeof composeAssistantAnswer>;
}
function toStringArray(value: unknown): string[] {
function toStringArray(value: string[] | null | undefined): string[] {
if (!Array.isArray(value)) {
return [];
}
@@ -43,11 +43,11 @@ function toStringArray(value: unknown): string[] {
.filter((item) => item.length > 0);
}
function normalizeCompanyAnchorSet(value: unknown): CompanyAnchorSet | null {
function normalizeCompanyAnchorSet(value: Partial<CompanyAnchorSet> | null | undefined): CompanyAnchorSet | null {
if (!value || typeof value !== "object" || Array.isArray(value)) {
return null;
}
const source = value as Record<string, unknown>;
const source: Partial<CompanyAnchorSet> = value;
return {
contract_numbers: toStringArray(source.contract_numbers),
document_numbers: toStringArray(source.document_numbers),