ГЛОБАЛЬНЫЙ РЕФАКТОРИНГ АРХИТЕКТУРЫ - Рефакторинг этапов 2.34 вынос address-ветку (orchestration + lane + finalize) в единый runtime-оркестратор, чтобы handleMessage стал почти плоским.

This commit is contained in:
2026-04-10 22:26:05 +03:00
parent 353cbc1763
commit 9c22460e8b
9 changed files with 869 additions and 185 deletions
+59 -1
View File
@@ -1098,7 +1098,65 @@ Validation:
- `assistantLivingRouter.test.ts`
- `assistantWave10SettlementCorrectiveRegression.test.ts`
Status: **In progress (Phase 2.1 + 2.2 + 2.3 + 2.4 + 2.5 + 2.6 + 2.7 + 2.8 + 2.9 + 2.10 + 2.11 + 2.12 + 2.13 + 2.14 + 2.15 + 2.16 + 2.17 + 2.18 + 2.19 + 2.20 + 2.21 + 2.22 + 2.23 + 2.24 + 2.25 + 2.26 + 2.27 + 2.28 + 2.29 + 2.30 + 2.31 + 2.32 + 2.33 completed)**
Implemented in current pass (Phase 2.34):
1. Extracted top-level address branch orchestration from `assistantService` into dedicated runtime adapter:
- `assistantAddressRuntimeAdapter.ts`
- introduced:
- `runAssistantAddressRuntime(...)`
2. Centralized full address-branch control flow (behavior-preserving):
- address bootstrap orchestration stage;
- tool-gate skip/chat fallback stage;
- lane execution/retry stage with analysis-date hint propagation;
- address finalize stage projection with retry audit merge.
3. Rewired `assistantService` address branch to a single runtime adapter invocation and preserved `addressRuntimeMetaForDeep` propagation contract.
4. Added focused unit tests:
- `assistantAddressRuntimeAdapter.test.ts`
Validation:
1. `npm run build` passed.
2. Targeted living/address/deep followup pack passed:
- `assistantAddressRuntimeAdapter.test.ts`
- `assistantDeepTurnResponseRuntimeAdapter.test.ts`
- `assistantDeepTurnAnalysisRuntimeAdapter.test.ts`
- `assistantDeepTurnNormalizationRuntimeAdapter.test.ts`
- `assistantAddressToolGateRuntimeAdapter.test.ts`
- `assistantAddressOrchestrationRuntimeAdapter.test.ts`
- `assistantAddressLaneRuntimeAdapter.test.ts`
- `assistantAddressFollowupContext.test.ts`
- `assistantLivingChatMode.test.ts`
- `assistantLivingRouter.test.ts`
- `assistantWave10SettlementCorrectiveRegression.test.ts`
Implemented in current pass (Phase 2.35):
1. Extracted address-lane response-tail (debug enrichment + finalize projection) from `assistantService` into dedicated runtime adapter:
- `assistantAddressLaneResponseRuntimeAdapter.ts`
- introduced:
- `runAssistantAddressLaneResponseRuntime(...)`
2. Centralized address response-tail sequence (behavior-preserving):
- reply sanitization and structured address debug payload assembly;
- followup-offer projection + known/active organization debug enrichment;
- address turn finalization through existing finalize adapter contract.
3. Rewired `assistantService` `finalizeAddressLaneResponse(...)` closure to consume response runtime adapter output.
4. Added focused unit tests:
- `assistantAddressLaneResponseRuntimeAdapter.test.ts`
Validation:
1. `npm run build` passed.
2. Targeted living/address/deep followup pack passed:
- `assistantAddressLaneResponseRuntimeAdapter.test.ts`
- `assistantAddressRuntimeAdapter.test.ts`
- `assistantDeepTurnResponseRuntimeAdapter.test.ts`
- `assistantDeepTurnAnalysisRuntimeAdapter.test.ts`
- `assistantDeepTurnNormalizationRuntimeAdapter.test.ts`
- `assistantAddressToolGateRuntimeAdapter.test.ts`
- `assistantAddressOrchestrationRuntimeAdapter.test.ts`
- `assistantAddressLaneRuntimeAdapter.test.ts`
- `assistantAddressFollowupContext.test.ts`
- `assistantLivingChatMode.test.ts`
- `assistantLivingRouter.test.ts`
- `assistantWave10SettlementCorrectiveRegression.test.ts`
Status: **In progress (Phase 2.1 + 2.2 + 2.3 + 2.4 + 2.5 + 2.6 + 2.7 + 2.8 + 2.9 + 2.10 + 2.11 + 2.12 + 2.13 + 2.14 + 2.15 + 2.16 + 2.17 + 2.18 + 2.19 + 2.20 + 2.21 + 2.22 + 2.23 + 2.24 + 2.25 + 2.26 + 2.27 + 2.28 + 2.29 + 2.30 + 2.31 + 2.32 + 2.33 + 2.34 + 2.35 completed)**
## Stage 3 (P2): Hybrid Semantic Layer (LLM + Deterministic Guards)