119 KiB
1CLLMARCH Fact Check And Stabilization Plan
Updated at: 2026-04-11
Source baseline: docs/TECH/1CLLMARCH.md
1. Purpose
This document fixes the current factual state of the codebase against 1CLLMARCH and records a production-focused stabilization plan that preserves:
- existing MCP routes;
- manual routing and guard logic;
- GUI manual markup + autorun operational loop.
2. Executive Reality Check
Current state is not MVP and also not stable production.
It is an advanced prototype with strong observability and eval tooling, but with architectural coupling and quality bottlenecks.
Approximate readiness against target architecture: 55/100.
3. Verified Facts (Code + Runtime)
- Strong engineering layers already exist:
- requirement extraction, coverage, grounding checks;
- rich debug payload and session trace;
- investigation state/followup continuity;
- manual annotation schema and post-analysis queues;
- async eval run + live history APIs.
- Main production blockers:
- orchestration monolith and coupling in
assistantService.ts; - deterministic/template-heavy final answer construction;
- large lexical heuristic surface for intent routing;
- temporal policy inconsistency (date handling differs by lane/path);
- hidden fallback behavior around historical snapshot assumptions.
- orchestration monolith and coupling in
- Quality metrics from latest Stage1 runs confirm weak user value:
- low retrieval differentiation;
- high generic explanation rate;
- low accountant actionability;
- zero mechanism specificity.
4. Gap Vs 1CLLMARCH
4.1 Already aligned (partially or strongly)
- Structured normalization contracts and validator loops.
- Coverage and grounding artifacts (with different naming than target).
- Conversation state persistence.
- Operational diagnostics and report generation.
4.2 Not aligned enough for stable prod
- Role separation (Interpreter/Planner/Critic/Answer) is incomplete and strongly coupled.
- Final user answer quality is constrained by deterministic template synthesis.
- Unified contract for analysis date/time scope is missing across all lanes.
- Result classes from target (
FULLY_ANSWERED,BLOCKED_BY_*, etc.) are not normalized as one contract. - Reason-code taxonomy exists but is fragmented across modules.
5. Stabilization Plan (No Route Breakage)
Stage 1 (P0): Unified Analysis Context + Temporal Hardening
Goal:
- Introduce unified
analysis_contextcontract. - Propagate it through eval -> assistant -> runtime lanes.
- Remove hidden hardcoded period fallback in live MCP plan generation.
- Keep backward compatibility (
period_hintstill supported).
Acceptance:
- If analysis date is set, runtime uses it explicitly in both deep/address paths.
- If analysis date is absent, runtime no longer silently injects fixed historical date in live-plan fallback.
- Existing APIs and manual workflows remain operational.
Implemented in current pass:
- Added unified
analysis_contextcontract to request context (as_of_date,period_from,period_to,snapshot_mode,source). - Added compatibility bridge: legacy
period_hintis still accepted and normalized intoanalysis_context. - Propagated analysis context through eval flows into assistant runtime.
- Applied analysis context in temporal guard with explicit precedence over implicit snapshot lock.
- Removed hidden hardcoded live-plan fallback period by switching to:
- explicit analysis period/date when provided;
- query-derived period when present;
- generic live probe when period is absent.
Validation:
npm run buildpassed.- Targeted runtime tests passed:
assistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Status: Completed
Stage 2 (P1): Orchestrator Decomposition (Behavior-Preserving Refactor)
Goal:
- Split monolith into explicit modules:
- QueryFrame builder
- Execution planner
- Evidence assembler
- Coverage critic
- Answer package builder
- Preserve current behavior under compatibility adapter.
Acceptance:
- No MCP route regressions.
- Existing tests and autorun loop remain green.
Implemented in current pass (Phase 2.1):
- Added new orchestration contract module:
assistant_query_frame_v1assistant_execution_plan_v1assistant_evidence_bundle_v1assistant_coverage_contract_v1- outcome classifier (
FULLY_ANSWERED,PARTIALLY_ANSWERED,BLOCKED_*,MISROUTED,FAILED_TO_BIND_ENTITIES)
- Integrated contracts into deep-lane runtime without route/answer behavior changes:
- debug payload now includes
assistant_outcome_class_v1; - debug payload and event logs now include
assistant_orchestration_contracts_v1.
- debug payload now includes
- Added unit regression tests:
assistantOrchestrationContracts.test.ts
Validation:
npm run buildpassed.- Targeted tests passed:
assistantOrchestrationContracts.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.2):
- Added runtime orchestration adapter for the deep lane:
assistantOrchestrationRuntimeAdapter.ts- unified pipeline call for
requirements -> coverage -> groundingwith stable interfaces.
- Integrated adapter into
assistantServicemain deep-lane flow (behavior-preserving):- existing extraction/coverage/grounding logic preserved;
- execution now routed through one orchestration boundary.
- Added adapter unit tests:
assistantOrchestrationRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted tests passed:
assistantOrchestrationRuntimeAdapter.test.tsassistantOrchestrationContracts.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.3):
- Extracted answer package builder (
answer_structure_v11) fromassistantServiceinto dedicated module:assistantAnswerPackageBuilder.ts
- Rewired deep-lane answer structure assembly to use the new module without contract changes.
- Added focused unit tests for answer package behavior:
assistantAnswerPackageBuilder.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 test pack passed:
assistantAnswerPackageBuilder.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantOrchestrationContracts.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.4):
- Extracted coverage/grounding pipeline into dedicated module:
assistantCoverageGrounding.ts- moved requirement extraction, coverage resolution, and grounding checks under one reusable boundary.
- Rewired
assistantServiceto use extracted coverage/grounding module via compatibility wrappers (behavior-preserving). - Added focused regression tests:
assistantCoverageGrounding.test.ts
- Stabilized deterministic Stage 2 regression environment for followup continuity checks:
- fixed accidental false-positive token in grounding test fixture;
- fixed env isolation in
assistantWave10SettlementCorrectiveRegression.test.tsby explicitly controllingFEATURE_ASSISTANT_ADDRESS_QUERY_V1.
Validation:
npm run buildpassed.- Targeted Stage 2 + safety regressions passed:
assistantCoverageGrounding.test.tsassistantWave10SettlementCorrectiveRegression.test.tsassistantAnswerPackageBuilder.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantOrchestrationContracts.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.5):
- Extracted query-planning helpers from
assistantServiceinto dedicated module:assistantQueryPlanning.ts- moved
fragmentTextById, execution-plan builder, and debug-routes builder under one reusable boundary.
- Rewired
assistantServiceto use extracted query-planning module (behavior-preserving wrapper integration). - Added focused unit tests for query-planning behavior:
assistantQueryPlanning.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 + safety regressions passed:
assistantQueryPlanning.test.tsassistantCoverageGrounding.test.tsassistantWave10SettlementCorrectiveRegression.test.tsassistantAnswerPackageBuilder.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantOrchestrationContracts.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.6):
- Extracted evidence-bundle assembly from
assistantServiceinto dedicated module:assistantEvidenceBundleAssembler.ts- centralized:
assistant_evidence_bundle_v1contract assembly;- debug
retrieval_statusprojection from normalized retrieval results.
- Rewired
assistantServiceto use assembler output for both:assistant_orchestration_contracts_v1.evidence_bundle;- debug payload
retrieval_status.
- Added focused unit tests:
assistantEvidenceBundleAssembler.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 + safety regressions passed:
assistantEvidenceBundleAssembler.test.tsassistantQueryPlanning.test.tsassistantCoverageGrounding.test.tsassistantWave10SettlementCorrectiveRegression.test.tsassistantAnswerPackageBuilder.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantOrchestrationContracts.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.7):
- Extracted deep-lane debug payload assembly from
assistantServiceinto dedicated module:assistantDebugPayloadAssembler.ts
- Rewired
assistantServiceto builddebugvia assembler (behavior-preserving):- keeps all existing fields, guard audits, orchestration contracts and optional sections.
- Added focused unit tests:
assistantDebugPayloadAssembler.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 + safety regressions passed:
assistantDebugPayloadAssembler.test.tsassistantEvidenceBundleAssembler.test.tsassistantQueryPlanning.test.tsassistantCoverageGrounding.test.tsassistantWave10SettlementCorrectiveRegression.test.tsassistantAnswerPackageBuilder.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantOrchestrationContracts.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.8):
- Extracted deep-lane processed log payload assembly from
assistantServiceinto dedicated module:assistantMessageLogAssembler.ts
- Rewired
assistantServiceto buildassistant_message_processed.detailsvia assembler (behavior-preserving). - Added focused unit tests:
assistantMessageLogAssembler.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 + safety regressions passed:
assistantMessageLogAssembler.test.tsassistantDebugPayloadAssembler.test.tsassistantEvidenceBundleAssembler.test.tsassistantQueryPlanning.test.tsassistantCoverageGrounding.test.tsassistantWave10SettlementCorrectiveRegression.test.tsassistantAnswerPackageBuilder.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantOrchestrationContracts.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.9):
- Extracted orchestration-contract bundle assembly from
assistantServiceinto dedicated module:assistantContractsBundleAssembler.ts
- Rewired
assistantServiceto consume bundled contracts/outcome class from assembler (behavior-preserving):query_frame,execution_plan,evidence_bundle,coverage,outcome_class.
- Added focused unit tests:
assistantContractsBundleAssembler.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 + safety regressions passed:
assistantContractsBundleAssembler.test.tsassistantMessageLogAssembler.test.tsassistantDebugPayloadAssembler.test.tsassistantEvidenceBundleAssembler.test.tsassistantQueryPlanning.test.tsassistantCoverageGrounding.test.tsassistantWave10SettlementCorrectiveRegression.test.tsassistantAnswerPackageBuilder.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantOrchestrationContracts.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.10):
- Extracted deep response envelope assembly from
assistantServiceinto dedicated module:assistantDeepResponseAssembler.ts- centralized:
- safe final assistant text cleanup (debug tail stripping);
answer_structure_v11selection/building policy;- assistant conversation item construction.
- Rewired
assistantServiceto consume deep response assembler (behavior-preserving). - Added focused unit tests:
assistantDeepResponseAssembler.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 + safety regressions passed:
assistantDeepResponseAssembler.test.tsassistantContractsBundleAssembler.test.tsassistantMessageLogAssembler.test.tsassistantDebugPayloadAssembler.test.tsassistantEvidenceBundleAssembler.test.tsassistantQueryPlanning.test.tsassistantCoverageGrounding.test.tsassistantWave10SettlementCorrectiveRegression.test.tsassistantAnswerPackageBuilder.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantOrchestrationContracts.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.11):
- Added top-level deep turn packager to compose extracted Stage 2 modules behind one boundary:
assistantDeepTurnPackaging.ts- centralizes orchestration of:
- evidence bundle assembly;
- contracts/outcome class assembly;
- deep answer artifacts;
- debug payload;
- assistant conversation item;
- processed log details.
- Rewired deep-lane
assistantServiceflow to useassembleAssistantDeepTurnPackaging(...)(behavior-preserving):- replaced duplicated per-artifact assembly block with single orchestrator call;
- preserved investigation-state update and existing response/event contract.
- Added focused unit test:
assistantDeepTurnPackaging.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 assembler/adapter pack passed:
assistantOrchestrationContracts.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantAnswerPackageBuilder.test.tsassistantCoverageGrounding.test.tsassistantQueryPlanning.test.tsassistantEvidenceBundleAssembler.test.tsassistantDebugPayloadAssembler.test.tsassistantMessageLogAssembler.test.tsassistantContractsBundleAssembler.test.tsassistantDeepResponseAssembler.test.tsassistantDeepTurnPackaging.test.ts
- Additional safety regressions passed:
assistantWave10SettlementCorrectiveRegression.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.12):
- Extracted deep-turn input normalization/defaulting from
assistantServiceinto dedicated module:assistantDeepTurnInputBuilder.ts- centralized normalization of:
followupStateUsagedefault (nullwhen absent);- composition defaults (
problem_*fields,answer_structure_v11); problem_unit_ids_usedarray normalization.
- Rewired
assistantServiceto build deep-turn input via:buildAssistantDeepTurnPackagingInput(...)- followed by existing
assembleAssistantDeepTurnPackaging(...)call (behavior-preserving).
- Added focused unit tests:
assistantDeepTurnInputBuilder.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 assembler/adapter pack passed:
assistantOrchestrationContracts.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantAnswerPackageBuilder.test.tsassistantCoverageGrounding.test.tsassistantQueryPlanning.test.tsassistantEvidenceBundleAssembler.test.tsassistantDebugPayloadAssembler.test.tsassistantMessageLogAssembler.test.tsassistantContractsBundleAssembler.test.tsassistantDeepResponseAssembler.test.tsassistantDeepTurnPackaging.test.tsassistantDeepTurnInputBuilder.test.ts
- Additional safety regressions passed:
assistantWave10SettlementCorrectiveRegression.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.13):
- Extracted investigation-state update/persist runtime block from
assistantServiceinto dedicated adapter:assistantInvestigationStateRuntimeAdapter.ts- introduced:
buildAssistantInvestigationStateSnapshot(...)persistAssistantInvestigationStateSnapshot(...)
- Rewired
assistantServiceto consume new adapter (behavior-preserving):- same
investigation_statesnapshot semantics; - same
FEATURE_ASSISTANT_INVESTIGATION_STATE_V1gating; - same session persistence call path.
- same
- Added focused unit tests:
assistantInvestigationStateRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 assembler/adapter pack passed:
assistantOrchestrationContracts.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantAnswerPackageBuilder.test.tsassistantCoverageGrounding.test.tsassistantQueryPlanning.test.tsassistantEvidenceBundleAssembler.test.tsassistantDebugPayloadAssembler.test.tsassistantMessageLogAssembler.test.tsassistantContractsBundleAssembler.test.tsassistantDeepResponseAssembler.test.tsassistantDeepTurnPackaging.test.tsassistantDeepTurnInputBuilder.test.tsassistantInvestigationStateRuntimeAdapter.test.ts
- Additional safety regressions passed:
assistantWave10SettlementCorrectiveRegression.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.14):
- Extracted deep-lane assistant post-turn commit/persist/log block from
assistantServiceinto dedicated adapter:assistantTurnCommitRuntimeAdapter.ts- introduced:
commitAssistantTurnAndLog(...)
- Rewired
assistantServicedeep-lane to use new adapter (behavior-preserving):- same append-to-session semantics;
- same session persistence behavior when session exists;
- same
assistant_message_processedlog envelope and event type.
- Added focused unit tests:
assistantTurnCommitRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 assembler/adapter pack passed:
assistantOrchestrationContracts.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantAnswerPackageBuilder.test.tsassistantCoverageGrounding.test.tsassistantQueryPlanning.test.tsassistantEvidenceBundleAssembler.test.tsassistantDebugPayloadAssembler.test.tsassistantMessageLogAssembler.test.tsassistantContractsBundleAssembler.test.tsassistantDeepResponseAssembler.test.tsassistantDeepTurnPackaging.test.tsassistantDeepTurnInputBuilder.test.tsassistantInvestigationStateRuntimeAdapter.test.tsassistantTurnCommitRuntimeAdapter.test.ts
- Additional safety regressions passed:
assistantWave10SettlementCorrectiveRegression.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.15):
- Extracted deep-lane pre-packaging context assembly from
assistantServiceinto dedicated module:assistantDeepTurnPrePackagingContext.ts- centralized:
- dropped intent segments extraction;
- analysis context projection for contracts;
- debug route projection;
- resolved execution state projection;
- safe assistant reply base sanitization.
- Rewired
assistantServicedeep-lane to consumebuildAssistantDeepTurnPrePackagingContext(...)(behavior-preserving). - Added focused unit tests:
assistantDeepTurnPrePackagingContext.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 assembler/adapter pack passed:
assistantOrchestrationContracts.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantAnswerPackageBuilder.test.tsassistantCoverageGrounding.test.tsassistantQueryPlanning.test.tsassistantEvidenceBundleAssembler.test.tsassistantDebugPayloadAssembler.test.tsassistantMessageLogAssembler.test.tsassistantContractsBundleAssembler.test.tsassistantDeepResponseAssembler.test.tsassistantDeepTurnPackaging.test.tsassistantDeepTurnInputBuilder.test.tsassistantInvestigationStateRuntimeAdapter.test.tsassistantTurnCommitRuntimeAdapter.test.tsassistantDeepTurnPrePackagingContext.test.ts
- Additional safety regressions passed:
assistantWave10SettlementCorrectiveRegression.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.16):
- Extracted deep-lane success response envelope assembly from
assistantServiceinto dedicated builder:assistantDeepTurnResponseBuilder.ts- introduced:
buildAssistantDeepTurnSuccessResponse(...)
- Rewired
assistantServicedeep-lane to return response via new builder (behavior-preserving). - Added focused unit tests:
assistantDeepTurnResponseBuilder.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 assembler/adapter pack passed:
assistantOrchestrationContracts.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantAnswerPackageBuilder.test.tsassistantCoverageGrounding.test.tsassistantQueryPlanning.test.tsassistantEvidenceBundleAssembler.test.tsassistantDebugPayloadAssembler.test.tsassistantMessageLogAssembler.test.tsassistantContractsBundleAssembler.test.tsassistantDeepResponseAssembler.test.tsassistantDeepTurnPackaging.test.tsassistantDeepTurnInputBuilder.test.tsassistantInvestigationStateRuntimeAdapter.test.tsassistantTurnCommitRuntimeAdapter.test.tsassistantDeepTurnPrePackagingContext.test.tsassistantDeepTurnResponseBuilder.test.ts
- Additional safety regressions passed:
assistantWave10SettlementCorrectiveRegression.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.17):
- Extracted deep-lane composition assembly from
assistantServiceinto dedicated runtime adapter:assistantDeepTurnCompositionRuntimeAdapter.ts- introduced:
buildAssistantDeepTurnComposition(...)
- Centralized composition-time derivations (behavior-preserving):
focusDomainHintfrom followup usage + investigation state;questionTypeClassviaresolveQuestionType(...);- period presence signals from company anchors/normalization payload;
- downstream
composeAssistantAnswer(...)call wiring.
- Rewired
assistantServicedeep-lane to consume adapter output (behavior-preserving). - Added focused unit tests:
assistantDeepTurnCompositionRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 assembler/adapter pack passed:
assistantOrchestrationContracts.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantAnswerPackageBuilder.test.tsassistantCoverageGrounding.test.tsassistantQueryPlanning.test.tsassistantEvidenceBundleAssembler.test.tsassistantDebugPayloadAssembler.test.tsassistantMessageLogAssembler.test.tsassistantContractsBundleAssembler.test.tsassistantDeepResponseAssembler.test.tsassistantDeepTurnPackaging.test.tsassistantDeepTurnInputBuilder.test.tsassistantInvestigationStateRuntimeAdapter.test.tsassistantTurnCommitRuntimeAdapter.test.tsassistantDeepTurnPrePackagingContext.test.tsassistantDeepTurnResponseBuilder.test.tsassistantDeepTurnCompositionRuntimeAdapter.test.ts
- Additional safety regressions passed:
assistantWave10SettlementCorrectiveRegression.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.18):
- Extracted deep-lane guard runtime pipeline from
assistantServiceinto dedicated adapter:assistantDeepTurnGuardRuntimeAdapter.ts- introduced:
applyAssistantDeepTurnRetrievalGuards(...)applyAssistantDeepTurnGroundingEligibility(...)
- Centralized and isolated runtime sequence (behavior-preserving):
- polarity guard on retrieval results;
- targeted evidence acquisition;
- evidence admissibility gate;
- grounded-answer eligibility evaluation + grounding status overlay.
- Rewired
assistantServicedeep-lane to consume adapter output (behavior-preserving). - Added focused unit tests:
assistantDeepTurnGuardRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 assembler/adapter pack passed:
assistantOrchestrationContracts.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantAnswerPackageBuilder.test.tsassistantCoverageGrounding.test.tsassistantQueryPlanning.test.tsassistantEvidenceBundleAssembler.test.tsassistantDebugPayloadAssembler.test.tsassistantMessageLogAssembler.test.tsassistantContractsBundleAssembler.test.tsassistantDeepResponseAssembler.test.tsassistantDeepTurnPackaging.test.tsassistantDeepTurnInputBuilder.test.tsassistantInvestigationStateRuntimeAdapter.test.tsassistantTurnCommitRuntimeAdapter.test.tsassistantDeepTurnPrePackagingContext.test.tsassistantDeepTurnResponseBuilder.test.tsassistantDeepTurnCompositionRuntimeAdapter.test.tsassistantDeepTurnGuardRuntimeAdapter.test.ts
- Additional safety regressions passed:
assistantWave10SettlementCorrectiveRegression.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.19):
- Extracted deep-lane retrieval execution loop from
assistantServiceinto dedicated runtime adapter:assistantDeepTurnRetrievalRuntimeAdapter.ts- introduced:
executeAssistantDeepTurnRetrievalPlan(...)
- Centralized retrieval runtime behavior (behavior-preserving):
- skipped/no-route call record generation;
- sequential route execution with temporal hint propagation;
- raw result capture;
- failed-route fallback normalization with stable error envelope.
- Rewired
assistantServicedeep-lane to consume retrieval adapter output (behavior-preserving). - Added focused unit tests:
assistantDeepTurnRetrievalRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 assembler/adapter pack passed:
assistantOrchestrationContracts.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantAnswerPackageBuilder.test.tsassistantCoverageGrounding.test.tsassistantQueryPlanning.test.tsassistantEvidenceBundleAssembler.test.tsassistantDebugPayloadAssembler.test.tsassistantMessageLogAssembler.test.tsassistantContractsBundleAssembler.test.tsassistantDeepResponseAssembler.test.tsassistantDeepTurnPackaging.test.tsassistantDeepTurnInputBuilder.test.tsassistantInvestigationStateRuntimeAdapter.test.tsassistantTurnCommitRuntimeAdapter.test.tsassistantDeepTurnPrePackagingContext.test.tsassistantDeepTurnResponseBuilder.test.tsassistantDeepTurnCompositionRuntimeAdapter.test.tsassistantDeepTurnGuardRuntimeAdapter.test.tsassistantDeepTurnRetrievalRuntimeAdapter.test.ts
- Additional safety regressions passed:
assistantWave10SettlementCorrectiveRegression.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.20):
- Extracted deep-lane execution-plan assembly/enforcement from
assistantServiceinto dedicated runtime adapter:assistantDeepTurnPlanRuntimeAdapter.ts- introduced:
buildAssistantDeepTurnExecutionPlan(...)
- Centralized planning runtime sequence (behavior-preserving):
- requirement extraction by fragment;
- execution plan build from route summary;
- RBP route-plan enforcement;
- FA route-plan enforcement;
- temporal hint overlay;
- polarity hint overlay.
- Rewired
assistantServicedeep-lane to consume adapter output (behavior-preserving). - Added focused unit tests:
assistantDeepTurnPlanRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 assembler/adapter pack passed:
assistantOrchestrationContracts.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantAnswerPackageBuilder.test.tsassistantCoverageGrounding.test.tsassistantQueryPlanning.test.tsassistantEvidenceBundleAssembler.test.tsassistantDebugPayloadAssembler.test.tsassistantMessageLogAssembler.test.tsassistantContractsBundleAssembler.test.tsassistantDeepResponseAssembler.test.tsassistantDeepTurnPackaging.test.tsassistantDeepTurnInputBuilder.test.tsassistantInvestigationStateRuntimeAdapter.test.tsassistantTurnCommitRuntimeAdapter.test.tsassistantDeepTurnPrePackagingContext.test.tsassistantDeepTurnResponseBuilder.test.tsassistantDeepTurnCompositionRuntimeAdapter.test.tsassistantDeepTurnGuardRuntimeAdapter.test.tsassistantDeepTurnRetrievalRuntimeAdapter.test.tsassistantDeepTurnPlanRuntimeAdapter.test.ts
- Additional safety regressions passed:
assistantWave10SettlementCorrectiveRegression.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.21):
- Extracted deep-lane pre-guard runtime context assembly from
assistantServiceinto dedicated adapter:assistantDeepTurnContextRuntimeAdapter.ts- introduced:
buildAssistantDeepTurnRuntimeContext(...)
- Centralized context runtime sequence (behavior-preserving):
- company anchors resolution;
- initial business-scope alignment;
- P0 domain inference + domain whitelist gating for guard focus;
- temporal guard resolution with runtime analysis context;
- domain polarity guard resolution;
- claim-bound anchors resolution;
- live business-scope resolution with followup flag;
- normalized live temporal hint projection.
- Rewired
assistantServicedeep-lane to consume context adapter output (behavior-preserving). - Added focused unit tests:
assistantDeepTurnContextRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 assembler/adapter pack passed:
assistantOrchestrationContracts.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantAnswerPackageBuilder.test.tsassistantCoverageGrounding.test.tsassistantQueryPlanning.test.tsassistantEvidenceBundleAssembler.test.tsassistantDebugPayloadAssembler.test.tsassistantMessageLogAssembler.test.tsassistantContractsBundleAssembler.test.tsassistantDeepResponseAssembler.test.tsassistantDeepTurnPackaging.test.tsassistantDeepTurnInputBuilder.test.tsassistantInvestigationStateRuntimeAdapter.test.tsassistantTurnCommitRuntimeAdapter.test.tsassistantDeepTurnPrePackagingContext.test.tsassistantDeepTurnResponseBuilder.test.tsassistantDeepTurnCompositionRuntimeAdapter.test.tsassistantDeepTurnGuardRuntimeAdapter.test.tsassistantDeepTurnRetrievalRuntimeAdapter.test.tsassistantDeepTurnPlanRuntimeAdapter.test.tsassistantDeepTurnContextRuntimeAdapter.test.ts
- Additional safety regressions passed:
assistantWave10SettlementCorrectiveRegression.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.22):
- Extracted deep-lane post-retrieval grounding runtime orchestration from
assistantServiceinto dedicated adapter:assistantDeepTurnGroundingRuntimeAdapter.ts- introduced:
runAssistantDeepTurnGroundingRuntime(...)
- Centralized grounding/runtime sequence (behavior-preserving):
- RBP live-route audit projection;
- FA live-route audit projection;
- coverage+grounding pipeline execution;
- grounded-answer eligibility overlay on base grounding check.
- Rewired
assistantServicedeep-lane to consume adapter output (behavior-preserving). - Added focused unit tests:
assistantDeepTurnGroundingRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 assembler/adapter pack passed:
assistantOrchestrationContracts.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantAnswerPackageBuilder.test.tsassistantCoverageGrounding.test.tsassistantQueryPlanning.test.tsassistantEvidenceBundleAssembler.test.tsassistantDebugPayloadAssembler.test.tsassistantMessageLogAssembler.test.tsassistantContractsBundleAssembler.test.tsassistantDeepResponseAssembler.test.tsassistantDeepTurnPackaging.test.tsassistantDeepTurnInputBuilder.test.tsassistantInvestigationStateRuntimeAdapter.test.tsassistantTurnCommitRuntimeAdapter.test.tsassistantDeepTurnPrePackagingContext.test.tsassistantDeepTurnResponseBuilder.test.tsassistantDeepTurnCompositionRuntimeAdapter.test.tsassistantDeepTurnGuardRuntimeAdapter.test.tsassistantDeepTurnRetrievalRuntimeAdapter.test.tsassistantDeepTurnPlanRuntimeAdapter.test.tsassistantDeepTurnContextRuntimeAdapter.test.tsassistantDeepTurnGroundingRuntimeAdapter.test.ts
- Additional safety regressions passed:
assistantWave10SettlementCorrectiveRegression.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.23):
- Extracted deep-lane packaging orchestration block from
assistantServiceinto dedicated runtime adapter:assistantDeepTurnPackagingRuntimeAdapter.ts- introduced:
runAssistantDeepTurnPackagingRuntime(...)
- Centralized packaging/runtime sequence (behavior-preserving):
- pre-packaging context assembly;
- investigation-state snapshot build/persist;
- deep-turn packaging input assembly;
- deep-turn packaging output projection (
safeAssistantReply, debug payload, assistant item, processed log details).
- Rewired
assistantServicedeep-lane to consume packaging runtime adapter output (behavior-preserving). - Added focused unit tests:
assistantDeepTurnPackagingRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 assembler/adapter pack passed:
assistantOrchestrationContracts.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantAnswerPackageBuilder.test.tsassistantCoverageGrounding.test.tsassistantQueryPlanning.test.tsassistantEvidenceBundleAssembler.test.tsassistantDebugPayloadAssembler.test.tsassistantMessageLogAssembler.test.tsassistantContractsBundleAssembler.test.tsassistantDeepResponseAssembler.test.tsassistantDeepTurnPackaging.test.tsassistantDeepTurnInputBuilder.test.tsassistantInvestigationStateRuntimeAdapter.test.tsassistantTurnCommitRuntimeAdapter.test.tsassistantDeepTurnPrePackagingContext.test.tsassistantDeepTurnResponseBuilder.test.tsassistantDeepTurnCompositionRuntimeAdapter.test.tsassistantDeepTurnGuardRuntimeAdapter.test.tsassistantDeepTurnRetrievalRuntimeAdapter.test.tsassistantDeepTurnPlanRuntimeAdapter.test.tsassistantDeepTurnContextRuntimeAdapter.test.tsassistantDeepTurnGroundingRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.ts
- Additional safety regressions passed:
assistantWave10SettlementCorrectiveRegression.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.24):
- Extracted deep-lane finalization/response tail from
assistantServiceinto dedicated runtime adapter:assistantDeepTurnFinalizeRuntimeAdapter.ts- introduced:
finalizeAssistantDeepTurn(...)
- Centralized finalization runtime sequence (behavior-preserving):
- assistant turn commit + processed-event logging;
- deep-turn API success response assembly from committed conversation state.
- Rewired
assistantServicedeep-lane to consume finalization adapter output (behavior-preserving). - Added focused unit tests:
assistantDeepTurnFinalizeRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 assembler/adapter pack passed:
assistantOrchestrationContracts.test.tsassistantOrchestrationRuntimeAdapter.test.tsassistantAnswerPackageBuilder.test.tsassistantCoverageGrounding.test.tsassistantQueryPlanning.test.tsassistantEvidenceBundleAssembler.test.tsassistantDebugPayloadAssembler.test.tsassistantMessageLogAssembler.test.tsassistantContractsBundleAssembler.test.tsassistantDeepResponseAssembler.test.tsassistantDeepTurnPackaging.test.tsassistantDeepTurnInputBuilder.test.tsassistantInvestigationStateRuntimeAdapter.test.tsassistantTurnCommitRuntimeAdapter.test.tsassistantDeepTurnPrePackagingContext.test.tsassistantDeepTurnResponseBuilder.test.tsassistantDeepTurnCompositionRuntimeAdapter.test.tsassistantDeepTurnGuardRuntimeAdapter.test.tsassistantDeepTurnRetrievalRuntimeAdapter.test.tsassistantDeepTurnPlanRuntimeAdapter.test.tsassistantDeepTurnContextRuntimeAdapter.test.tsassistantDeepTurnGroundingRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantDeepTurnFinalizeRuntimeAdapter.test.ts
- Additional safety regressions passed:
assistantWave10SettlementCorrectiveRegression.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.25):
- Extracted address-lane finalization/response tail from
assistantServiceinto dedicated runtime adapter:assistantAddressTurnFinalizeRuntimeAdapter.ts- introduced:
finalizeAssistantAddressTurn(...)
- Centralized address finalization runtime sequence (behavior-preserving):
- assistant item creation for address lane;
- structured
assistant_message_addressprocessed-event payload build; - turn commit/persist/log via shared commit runtime adapter;
- API success response assembly from committed conversation state.
- Rewired
assistantServiceaddress-lane finalize path to consume adapter output (behavior-preserving). - Added focused unit tests:
assistantAddressTurnFinalizeRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted Stage 2 adapter/finalization pack passed:
assistantAddressTurnFinalizeRuntimeAdapter.test.tsassistantDeepTurnFinalizeRuntimeAdapter.test.tsassistantTurnCommitRuntimeAdapter.test.ts
- Additional safety regressions passed:
assistantWave10SettlementCorrectiveRegression.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.26):
- Extracted living-chat finalization/response tail from
assistantServiceinto dedicated runtime adapter:assistantLivingChatTurnFinalizeRuntimeAdapter.ts- introduced:
finalizeAssistantLivingChatTurn(...)
- Centralized living-chat finalization runtime sequence (behavior-preserving):
- assistant item creation for chat lane;
- structured
assistant_message_chatprocessed-event payload build; - turn commit/persist/log via shared commit runtime adapter;
- API success response assembly from committed conversation state.
- Rewired
assistantServicetryHandleLivingChat(...)finalize path to consume adapter output (behavior-preserving). - Added focused unit tests:
assistantLivingChatTurnFinalizeRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep finalize pack passed:
assistantLivingChatTurnFinalizeRuntimeAdapter.test.tsassistantAddressTurnFinalizeRuntimeAdapter.test.tsassistantDeepTurnFinalizeRuntimeAdapter.test.tsassistantLivingChatMode.test.tsassistantLivingRouter.test.ts
- Additional safety regressions passed:
assistantWave10SettlementCorrectiveRegression.test.tsassistantMcpRuntimeBridge.test.tsassistantAddressFollowupContext.test.ts
Implemented in current pass (Phase 2.27):
- Extracted living-chat runtime orchestration branch from
assistantServiceinto dedicated runtime adapter:assistantLivingChatRuntimeAdapter.ts- introduced:
runAssistantLivingChatRuntime(...)
- Centralized living-chat runtime branch sequence (behavior-preserving):
- deterministic capability + safety refusal branch;
- deterministic data-scope contract branch (with live probe projection);
- deterministic organization-boundary and scope-selection branches;
- deterministic operational-boundary and capability-contract branches;
- LLM chat branch with script-guard + grounding-guard post-processing.
- Rewired
assistantServicetryHandleLivingChat(...)to consume runtime adapter output and keep existing chat finalization adapter path unchanged. - Added focused unit tests:
assistantLivingChatRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/chat followup pack passed:
assistantLivingChatRuntimeAdapter.test.tsassistantLivingChatMode.test.tsassistantLivingRouter.test.tsassistantAddressFollowupContext.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.28):
- Extracted address-lane retry orchestration branch from
assistantServiceinto dedicated runtime adapter:assistantAddressLaneRuntimeAdapter.ts- introduced:
runAssistantAddressLaneRuntime(...)
- Centralized address retry/runtime branch sequence (behavior-preserving):
- contextual-first execution when followup context is preferred;
- primary execution without followup context;
- optional contextual fallback when context exists but is not preferred;
- retry with raw user message for retryable limited results;
- deterministic fallback to pending limited result when retry does not improve outcome.
- Rewired
assistantServiceaddress lane execution path to consume retry adapter output and preserve existing address finalization contract. - Added focused unit tests:
assistantAddressLaneRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address followup pack passed:
assistantAddressLaneRuntimeAdapter.test.tsassistantAddressFollowupContext.test.tsassistantLivingChatMode.test.tsassistantLivingRouter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.29):
- Extracted address orchestration bootstrap block from
assistantServiceinto dedicated runtime adapter:assistantAddressOrchestrationRuntimeAdapter.ts- introduced:
buildAssistantAddressOrchestrationRuntime(...)
- Centralized address orchestration bootstrap sequence (behavior-preserving):
- LLM predecompose stage or deterministic fallback contract when feature is disabled;
- effective address input message resolution;
- followup carryover context resolution;
- orchestration/tool-gate decision resolution;
- dialog continuation contract projection into runtime meta;
- living mode decision projection for chat fallback.
- Rewired
assistantServiceaddress pre-lane bootstrap path to consume orchestration runtime adapter output. - Added focused unit tests:
assistantAddressOrchestrationRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address followup pack passed:
assistantAddressOrchestrationRuntimeAdapter.test.tsassistantAddressLaneRuntimeAdapter.test.tsassistantAddressFollowupContext.test.tsassistantLivingChatMode.test.tsassistantLivingRouter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.30):
- Extracted address tool-gate skip branch from
assistantServiceinto dedicated runtime adapter:assistantAddressToolGateRuntimeAdapter.ts- introduced:
runAssistantAddressToolGateRuntime(...)
- Centralized tool-gate skip/runtime sequence (behavior-preserving):
- deterministic early noop when
runAddressLane=true; - structured
assistant_address_tool_gate_skiplogging payload projection; - conditional living-chat fallback invocation when mode is
chat.
- deterministic early noop when
- Rewired
assistantServiceto consume tool-gate runtime adapter output and preserve existing early-return contract for handled chat fallback. - Added focused unit tests:
assistantAddressToolGateRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address followup pack passed:
assistantAddressToolGateRuntimeAdapter.test.tsassistantAddressOrchestrationRuntimeAdapter.test.tsassistantAddressLaneRuntimeAdapter.test.tsassistantAddressFollowupContext.test.tsassistantLivingChatMode.test.tsassistantLivingRouter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.31):
- Extracted deep-lane followup binding + normalize bootstrap block from
assistantServiceinto dedicated runtime adapter:assistantDeepTurnNormalizationRuntimeAdapter.ts- introduced:
buildAssistantDeepTurnNormalizationRuntime(...)
- Centralized deep normalization bootstrap sequence (behavior-preserving):
- followup state binding projection when feature flags are enabled;
- deterministic fallback to raw user question when followup binding is disabled/unavailable;
- normalize request payload assembly and normalizer invocation.
- Rewired
assistantServicedeep-lane bootstrap to consume normalization runtime adapter output. - Added focused unit tests:
assistantDeepTurnNormalizationRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantDeepTurnNormalizationRuntimeAdapter.test.tsassistantAddressToolGateRuntimeAdapter.test.tsassistantAddressOrchestrationRuntimeAdapter.test.tsassistantAddressLaneRuntimeAdapter.test.tsassistantAddressFollowupContext.test.tsassistantLivingChatMode.test.tsassistantLivingRouter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.32):
- Extracted deep-lane context/plan/retrieval/guard/grounding/composition orchestration block from
assistantServiceinto dedicated runtime adapter:assistantDeepTurnAnalysisRuntimeAdapter.ts- introduced:
runAssistantDeepTurnAnalysisRuntime(...)
- Centralized deep analysis sequence wiring (behavior-preserving):
- runtime context stage output propagation;
- execution-plan, retrieval, guard and grounding stage chaining;
- composition stage input projection from grounded retrieval output.
- Rewired
assistantServicedeep-lane middle pipeline to consume analysis runtime adapter output while preserving existing packaging/finalization contracts. - Added focused unit tests:
assistantDeepTurnAnalysisRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantDeepTurnNormalizationRuntimeAdapter.test.tsassistantAddressToolGateRuntimeAdapter.test.tsassistantAddressOrchestrationRuntimeAdapter.test.tsassistantAddressLaneRuntimeAdapter.test.tsassistantAddressFollowupContext.test.tsassistantLivingChatMode.test.tsassistantLivingRouter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.33):
- Extracted deep-lane response tail (packaging + finalize) from
assistantServiceinto dedicated runtime adapter:assistantDeepTurnResponseRuntimeAdapter.ts- introduced:
runAssistantDeepTurnResponseRuntime(...)
- Centralized deep response-tail sequence (behavior-preserving):
- packaging runtime invocation with full debug/contract payload projection;
- deep finalization invocation with packaged reply/debug artifacts;
- single response projection back to caller.
- Rewired
assistantServicedeep-lane tail to consume response runtime adapter output. - Added focused unit tests:
assistantDeepTurnResponseRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantDeepTurnNormalizationRuntimeAdapter.test.tsassistantAddressToolGateRuntimeAdapter.test.tsassistantAddressOrchestrationRuntimeAdapter.test.tsassistantAddressLaneRuntimeAdapter.test.tsassistantAddressFollowupContext.test.tsassistantLivingChatMode.test.tsassistantLivingRouter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.34):
- Extracted top-level address branch orchestration from
assistantServiceinto dedicated runtime adapter:assistantAddressRuntimeAdapter.ts- introduced:
runAssistantAddressRuntime(...)
- 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.
- Rewired
assistantServiceaddress branch to a single runtime adapter invocation and preservedaddressRuntimeMetaForDeeppropagation contract. - Added focused unit tests:
assistantAddressRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantAddressRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantDeepTurnNormalizationRuntimeAdapter.test.tsassistantAddressToolGateRuntimeAdapter.test.tsassistantAddressOrchestrationRuntimeAdapter.test.tsassistantAddressLaneRuntimeAdapter.test.tsassistantAddressFollowupContext.test.tsassistantLivingChatMode.test.tsassistantLivingRouter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.35):
- Extracted address-lane response-tail (debug enrichment + finalize projection) from
assistantServiceinto dedicated runtime adapter:assistantAddressLaneResponseRuntimeAdapter.ts- introduced:
runAssistantAddressLaneResponseRuntime(...)
- 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.
- Rewired
assistantServicefinalizeAddressLaneResponse(...)closure to consume response runtime adapter output. - Added focused unit tests:
assistantAddressLaneResponseRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantAddressLaneResponseRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantDeepTurnNormalizationRuntimeAdapter.test.tsassistantAddressToolGateRuntimeAdapter.test.tsassistantAddressOrchestrationRuntimeAdapter.test.tsassistantAddressLaneRuntimeAdapter.test.tsassistantAddressFollowupContext.test.tsassistantLivingChatMode.test.tsassistantLivingRouter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.36):
- Extracted living-chat handler branch (
tryHandleLivingChat) fromassistantServiceinto dedicated runtime adapter:assistantLivingChatHandlerRuntimeAdapter.ts- introduced:
tryHandleAssistantLivingChatRuntime(...)
- Centralized living-chat handler sequence (behavior-preserving):
- living-chat runtime invocation (deterministic/LLM guard chain);
- chat finalization invocation for
assistant_message_chatresponse path; - warn-log fallback path for runtime failures.
- Rewired
assistantServicetryHandleLivingChat(...)closure to consume handler runtime adapter output. - Added focused unit tests:
assistantLivingChatHandlerRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantLivingChatHandlerRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantDeepTurnNormalizationRuntimeAdapter.test.tsassistantAddressToolGateRuntimeAdapter.test.tsassistantAddressOrchestrationRuntimeAdapter.test.tsassistantAddressLaneRuntimeAdapter.test.tsassistantAddressFollowupContext.test.tsassistantLivingChatMode.test.tsassistantLivingRouter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.37):
- Extracted living-chat LLM call/build block from
assistantServiceinto dedicated runtime adapter:assistantLivingChatLlmRuntimeAdapter.ts- introduced:
runAssistantLivingChatLlmRuntime(...)
- Centralized living LLM execution sequence (behavior-preserving):
- context window assembly from session history;
- canon excerpt loading and prompt composition;
- model/token selection with guard clamp;
- output sanitization with stable fallback.
- Rewired
assistantServicetryHandleLivingChat(...)closure to consume the new LLM runtime adapter. - Added focused unit tests:
assistantLivingChatLlmRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantLivingChatLlmRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantLivingChatRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.38):
- Internalized living-chat prompt/context builders into
assistantLivingChatLlmRuntimeAdapter:- removed external builder dependencies from runtime input contract;
- centralized compacting + clipping + context/prompt projection directly in adapter.
- Simplified
assistantServiceliving LLM call wiring:- removed
buildLivingChatContextWindow/buildLivingChatPromptinjection fromexecuteLlmChat.
- removed
- Updated focused tests for adapter-owned prompt assembly:
assistantLivingChatLlmRuntimeAdapter.test.tsnow verifies context carryover and user-message prompt shape.
- Applied cleanup inside
assistantServiceafter the wiring simplification:- removed dead local living prompt/context helper functions.
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantLivingChatLlmRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantLivingChatRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.39):
- Extracted user-turn bootstrap sequence from
assistantServiceinto dedicated runtime adapter:assistantUserTurnBootstrapRuntimeAdapter.ts- introduced:
runAssistantUserTurnBootstrapRuntime(...)
- Centralized user-turn bootstrap flow (behavior-preserving):
- session ensure + user message normalization/repair;
- user item append + session persistence;
- runtime analysis context projection.
- Rewired
assistantService.handleMessage(...)to consume bootstrap runtime output and preserve downstreamquestionIdcontract usage. - Added focused unit tests:
assistantUserTurnBootstrapRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantUserTurnBootstrapRuntimeAdapter.test.tsassistantLivingChatLlmRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantLivingChatRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.40):
- Extracted address-lane attempt bridge (
runAddressLaneAttempt) fromassistantServiceinto dedicated runtime adapter:assistantAddressLaneAttemptRuntimeAdapter.ts- introduced:
runAssistantAddressLaneAttemptRuntime(...)
- Centralized address-lane attempt handoff logic (behavior-preserving):
- organization-scoped followup context merge;
- fallback to plain lane attempt when scoped context is unavailable;
- strict propagation of analysis-date hint into
addressQueryService.tryHandle(...).
- Rewired
assistantServiceto consume lane-attempt runtime adapter. - Added focused unit tests:
assistantAddressLaneAttemptRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantAddressLaneAttemptRuntimeAdapter.test.tsassistantUserTurnBootstrapRuntimeAdapter.test.tsassistantLivingChatLlmRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantLivingChatRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.41):
- Extracted living-chat attempt bridge (
tryHandleLivingChat) fromassistantServiceinto dedicated runtime adapter:assistantLivingChatAttemptRuntimeAdapter.ts- introduced:
runAssistantLivingChatAttemptRuntime(...)
- Centralized living-chat attempt handoff logic (behavior-preserving):
- delegated handler invocation (
tryHandleAssistantLivingChatRuntime(...)); - delegated LLM call bridge (
runAssistantLivingChatLlmRuntime(...)) behind unifiedexecuteLlmChatcontract; - preserved all guard, scope and session finalization hooks.
- delegated handler invocation (
- Rewired
assistantServiceto consume living-chat attempt runtime adapter. - Added focused unit tests:
assistantLivingChatAttemptRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantLivingChatAttemptRuntimeAdapter.test.tsassistantAddressLaneAttemptRuntimeAdapter.test.tsassistantUserTurnBootstrapRuntimeAdapter.test.tsassistantLivingChatLlmRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantLivingChatRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.42):
- Extracted address-lane response attempt bridge (
finalizeAddressLaneResponse) fromassistantServiceinto dedicated runtime adapter:assistantAddressLaneResponseAttemptRuntimeAdapter.ts- introduced:
runAssistantAddressLaneResponseAttemptRuntime(...)
- Centralized address-lane response handoff logic (behavior-preserving):
- delegated response runtime invocation (
runAssistantAddressLaneResponseRuntime(...)); - preserved followup-offer/debug payload and session finalization contract wiring.
- delegated response runtime invocation (
- Rewired
assistantServiceto consume address-lane response attempt runtime adapter. - Added focused unit tests:
assistantAddressLaneResponseAttemptRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantAddressLaneResponseAttemptRuntimeAdapter.test.tsassistantLivingChatAttemptRuntimeAdapter.test.tsassistantAddressLaneAttemptRuntimeAdapter.test.tsassistantUserTurnBootstrapRuntimeAdapter.test.tsassistantLivingChatLlmRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantLivingChatRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.43):
- Extracted deep-analysis bridge (
deepTurnAnalysisRuntimewiring) fromassistantServiceinto dedicated runtime adapter:assistantDeepTurnAnalysisAttemptRuntimeAdapter.ts- introduced:
runAssistantDeepTurnAnalysisAttemptRuntime(...)
- Centralized deep-analysis handoff logic (behavior-preserving):
- context/plan/retrieval/guard/grounding/composition chain wiring moved behind a single runtime boundary;
- preserved feature flags and all existing local helper hooks (
extractRequirements, route enforcement, coverage/grounding evaluators, audits).
- Rewired
assistantServiceto consume deep-analysis attempt runtime adapter. - Added focused unit tests:
assistantDeepTurnAnalysisAttemptRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantDeepTurnAnalysisAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantAddressLaneResponseAttemptRuntimeAdapter.test.tsassistantLivingChatAttemptRuntimeAdapter.test.tsassistantAddressLaneAttemptRuntimeAdapter.test.tsassistantUserTurnBootstrapRuntimeAdapter.test.tsassistantLivingChatLlmRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantLivingChatRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.44):
- Extracted deep-response bridge (
deepTurnResponseRuntimewiring) fromassistantServiceinto dedicated runtime adapter:assistantDeepTurnResponseAttemptRuntimeAdapter.ts- introduced:
runAssistantDeepTurnResponseAttemptRuntime(...)
- Centralized deep-response handoff logic (behavior-preserving):
- mapping from deep-analysis runtime output into response/packaging/finalization runtime contract moved behind a single runtime boundary;
- preserved existing debug/state persistence hooks and session finalization callbacks.
- Rewired
assistantServiceto consume deep-response attempt runtime adapter. - Added focused unit tests:
assistantDeepTurnResponseAttemptRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantDeepTurnResponseAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantAddressLaneResponseAttemptRuntimeAdapter.test.tsassistantLivingChatAttemptRuntimeAdapter.test.tsassistantAddressLaneAttemptRuntimeAdapter.test.tsassistantUserTurnBootstrapRuntimeAdapter.test.tsassistantLivingChatLlmRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantLivingChatRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.45):
- Extracted full deep-turn chain (
normalization -> analysis -> response) fromassistantServiceinto dedicated runtime adapter:assistantDeepTurnAttemptRuntimeAdapter.ts- introduced:
runAssistantDeepTurnAttemptRuntime(...)
- Centralized deep-turn orchestration handoff (behavior-preserving):
- unified composition over existing attempt adapters (
Normalization,Analysis,Response); - preserved followup binding, runtime context propagation, response finalization hooks and investigation-state persistence callbacks.
- unified composition over existing attempt adapters (
- Rewired
assistantServiceto consume a single deep-turn runtime adapter call. - Added focused unit tests:
assistantDeepTurnAttemptRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantDeepTurnAttemptRuntimeAdapter.test.tsassistantDeepTurnResponseAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantAddressLaneResponseAttemptRuntimeAdapter.test.tsassistantLivingChatAttemptRuntimeAdapter.test.tsassistantAddressLaneAttemptRuntimeAdapter.test.tsassistantUserTurnBootstrapRuntimeAdapter.test.tsassistantLivingChatLlmRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantLivingChatRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.46):
- Activated full address-turn attempt runtime boundary inside
assistantService:- rewired address handling call-site to
runAssistantAddressAttemptRuntime(...); - removed local inline closures for lane-attempt, lane-response, and living-chat handoff wiring from
handleMessage.
- rewired address handling call-site to
- Finalized and type-hardened address attempt adapter contract:
assistantAddressAttemptRuntimeAdapter.ts- aligned
logEventandmessageIdFactorycontract typing to runtime expectations.
- Added focused unit tests:
assistantAddressAttemptRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantAddressAttemptRuntimeAdapter.test.tsassistantDeepTurnAttemptRuntimeAdapter.test.tsassistantDeepTurnResponseAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantAddressLaneResponseAttemptRuntimeAdapter.test.tsassistantLivingChatAttemptRuntimeAdapter.test.tsassistantAddressLaneAttemptRuntimeAdapter.test.tsassistantUserTurnBootstrapRuntimeAdapter.test.tsassistantLivingChatLlmRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantLivingChatRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.47):
- Extracted top-level assistant turn orchestration (
bootstrap -> address attempt -> deep attempt) into dedicated runtime adapter:assistantTurnAttemptRuntimeAdapter.ts- introduced:
runAssistantTurnAttemptRuntime(...)
- Rewired
assistantService.handleMessageto use single top-level turn runtime boundary (behavior-preserving):- user-turn bootstrap remains delegated to
assistantUserTurnBootstrapRuntime; - address and deep attempt runtimes remain unchanged, but orchestration/early-return logic moved out of service body.
- user-turn bootstrap remains delegated to
- Added focused unit tests:
assistantTurnAttemptRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantTurnAttemptRuntimeAdapter.test.tsassistantAddressAttemptRuntimeAdapter.test.tsassistantDeepTurnAttemptRuntimeAdapter.test.tsassistantDeepTurnResponseAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantAddressLaneResponseAttemptRuntimeAdapter.test.tsassistantLivingChatAttemptRuntimeAdapter.test.tsassistantAddressLaneAttemptRuntimeAdapter.test.tsassistantUserTurnBootstrapRuntimeAdapter.test.tsassistantLivingChatLlmRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantLivingChatRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.48):
- Extracted turn-level runtime input assembly from
assistantServiceinto dedicated builder module:assistantTurnRuntimeInputBuilder.ts- introduced:
buildAssistantUserTurnBootstrapRuntimeInput(...)buildAssistantAddressAttemptRuntimeInput(...)buildAssistantDeepTurnAttemptRuntimeInput(...)
- Rewired
assistantService.handleMessageto consume builder outputs (behavior-preserving):- moved bulky dependency mapping for bootstrap/address/deep attempts out of service body;
- preserved existing runtime adapters and route behavior.
- Added focused unit tests:
assistantTurnRuntimeInputBuilder.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantTurnRuntimeInputBuilder.test.tsassistantTurnAttemptRuntimeAdapter.test.tsassistantAddressAttemptRuntimeAdapter.test.tsassistantDeepTurnAttemptRuntimeAdapter.test.tsassistantDeepTurnResponseAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantAddressLaneResponseAttemptRuntimeAdapter.test.tsassistantLivingChatAttemptRuntimeAdapter.test.tsassistantAddressLaneAttemptRuntimeAdapter.test.tsassistantUserTurnBootstrapRuntimeAdapter.test.tsassistantLivingChatLlmRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantLivingChatRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.49):
- Extracted turn runtime dependency factory from
assistantServiceinto dedicated adapter:assistantTurnRuntimeDepsAdapter.ts- introduced:
buildAssistantTurnRuntimeDeps(...)
- Rewired
assistantService.handleMessageto construct runtime deps via adapter (behavior-preserving):- service-level wrappers for
sessions,sessionLogger,normalizerService,dataLayer,addressQueryServicemoved under deps-adapter boundary; - flags/defaults/helpers remain unchanged semantically and are passed as structured groups (
flags,defaults,helpers).
- service-level wrappers for
- Added focused unit tests:
assistantTurnRuntimeDepsAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantTurnRuntimeDepsAdapter.test.tsassistantTurnRuntimeInputBuilder.test.tsassistantTurnAttemptRuntimeAdapter.test.tsassistantAddressAttemptRuntimeAdapter.test.tsassistantDeepTurnAttemptRuntimeAdapter.test.tsassistantDeepTurnResponseAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantAddressLaneResponseAttemptRuntimeAdapter.test.tsassistantLivingChatAttemptRuntimeAdapter.test.tsassistantAddressLaneAttemptRuntimeAdapter.test.tsassistantUserTurnBootstrapRuntimeAdapter.test.tsassistantLivingChatLlmRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantLivingChatRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantWave10SettlementCorrectiveRegression.test.ts
Implemented in current pass (Phase 2.50):
- Extracted organization-scope runtime logic from
assistantServiceinto dedicated adapter:assistantOrganizationScopeRuntimeAdapter.ts- introduced:
resolveSessionOrganizationScopeContextRuntime(...)mergeFollowupContextWithOrganizationScopeRuntime(...)
- Rewired
assistantServicescope helpers to delegate through the adapter (behavior-preserving):resolveSessionOrganizationScopeContext(...)now uses runtime adapter with existing extraction/scoring/sanitization helpers;mergeFollowupContextWithOrganizationScope(...)now uses runtime adapter while preserving existing normalization/toNonEmpty semantics.
- Added focused unit tests:
assistantOrganizationScopeRuntimeAdapter.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantOrganizationScopeRuntimeAdapter.test.tsassistantTurnRuntimeDepsAdapter.test.tsassistantTurnRuntimeInputBuilder.test.tsassistantTurnAttemptRuntimeAdapter.test.tsassistantAddressAttemptRuntimeAdapter.test.tsassistantDeepTurnAttemptRuntimeAdapter.test.tsassistantDeepTurnResponseAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantAddressLaneResponseAttemptRuntimeAdapter.test.tsassistantLivingChatAttemptRuntimeAdapter.test.tsassistantAddressLaneAttemptRuntimeAdapter.test.tsassistantUserTurnBootstrapRuntimeAdapter.test.tsassistantLivingChatLlmRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantLivingChatRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantWave10SettlementCorrectiveRegression.test.tsassistantLivingChatMode.test.ts
Implemented in current pass (Phase 2.51):
- Extracted living-chat attempt input assembly from
assistantAddressAttemptRuntimeAdapterinto dedicated builder:assistantLivingChatAttemptInputBuilder.ts- introduced:
buildAssistantLivingChatAttemptRuntimeInput(...)
- Rewired
assistantAddressAttemptRuntimeAdapterto consume the new builder (behavior-preserving):- moved inline living-chat payload mapping (including
traceIdFactoryderivation and scope/meta wiring) behind a single input-builder boundary.
- moved inline living-chat payload mapping (including
- Added focused unit tests:
assistantLivingChatAttemptInputBuilder.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantLivingChatAttemptInputBuilder.test.tsassistantAddressAttemptRuntimeAdapter.test.tsassistantLivingChatAttemptRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantLivingChatRuntimeAdapter.test.tsassistantTurnRuntimeDepsAdapter.test.tsassistantTurnRuntimeInputBuilder.test.tsassistantTurnAttemptRuntimeAdapter.test.tsassistantOrganizationScopeRuntimeAdapter.test.tsassistantAddressLaneAttemptRuntimeAdapter.test.tsassistantAddressLaneResponseAttemptRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantDeepTurnAttemptRuntimeAdapter.test.tsassistantDeepTurnResponseAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantWave10SettlementCorrectiveRegression.test.tsassistantLivingChatMode.test.ts
Implemented in current pass (Phase 2.52 + 2.53 + 2.54 + 2.55):
- Removed remaining inline address-lane response input assembly from
assistantAddressAttemptRuntimeAdapter:- rewired
finalizeAddressLaneResponsetobuildAssistantAddressLaneResponseAttemptRuntimeInput(...).
- rewired
- Added dedicated lane-attempt input builder and rewired adapter call-site:
assistantAddressLaneAttemptInputBuilder.ts- introduced:
buildAssistantAddressLaneAttemptRuntimeInput(...)
- Added dedicated address-runtime input builder and rewired final runtime invocation:
assistantAddressRuntimeInputBuilder.ts- introduced:
buildAssistantAddressRuntimeInput(...)
- Added focused builder tests:
assistantAddressLaneResponseAttemptInputBuilder.test.tsassistantAddressLaneAttemptInputBuilder.test.tsassistantAddressRuntimeInputBuilder.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantAddressLaneResponseAttemptInputBuilder.test.tsassistantAddressLaneAttemptInputBuilder.test.tsassistantAddressRuntimeInputBuilder.test.tsassistantLivingChatAttemptInputBuilder.test.tsassistantAddressAttemptRuntimeAdapter.test.tsassistantLivingChatAttemptRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantLivingChatRuntimeAdapter.test.tsassistantTurnRuntimeDepsAdapter.test.tsassistantTurnRuntimeInputBuilder.test.tsassistantTurnAttemptRuntimeAdapter.test.tsassistantOrganizationScopeRuntimeAdapter.test.tsassistantAddressLaneAttemptRuntimeAdapter.test.tsassistantAddressLaneResponseAttemptRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantDeepTurnAttemptRuntimeAdapter.test.tsassistantDeepTurnResponseAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantWave10SettlementCorrectiveRegression.test.tsassistantLivingChatMode.test.ts
Implemented in current pass (Phase 2.56 + 2.57 + 2.58 + 2.59 + 2.60):
- Extracted deep-turn attempt input assembly into dedicated builder:
assistantDeepTurnAttemptInputBuilder.ts- introduced:
buildAssistantDeepTurnNormalizationRuntimeInput(...)buildAssistantDeepTurnAnalysisAttemptRuntimeInput(...)buildAssistantDeepTurnResponseAttemptRuntimeInput(...)
- Rewired
assistantDeepTurnAttemptRuntimeAdapterto consume deep-turn attempt builder outputs (behavior-preserving):- removed inline normalization/analysis/response attempt payload mapping from adapter body.
- Extracted deep-turn response runtime input mapping into dedicated builder:
assistantDeepTurnResponseRuntimeInputBuilder.ts- introduced:
buildAssistantDeepTurnResponseRuntimeInput(...)
- Rewired
assistantDeepTurnResponseAttemptRuntimeAdapterto consume response runtime input builder (behavior-preserving):- moved deep-analysis -> response-runtime field projection behind a single builder boundary.
- Extracted deep-turn analysis-attempt stage input wiring into dedicated builder:
assistantDeepTurnAnalysisAttemptInputBuilder.ts- introduced:
buildAssistantDeepTurnAnalysisRuntimeInput(...)buildAssistantDeepTurnContextRuntimeInput(...)buildAssistantDeepTurnExecutionPlanRuntimeInput(...)buildAssistantDeepTurnRetrievalRuntimeInput(...)buildAssistantDeepTurnGuardRuntimeInput(...)buildAssistantDeepTurnGroundingRuntimeInput(...)buildAssistantDeepTurnCompositionRuntimeInput(...)
- Rewired
assistantDeepTurnAnalysisAttemptRuntimeAdapterto buildrunAssistantDeepTurnAnalysisRuntime(...)contract via builder (behavior-preserving). - Added focused builder tests:
assistantDeepTurnAttemptInputBuilder.test.tsassistantDeepTurnResponseRuntimeInputBuilder.test.tsassistantDeepTurnAnalysisAttemptInputBuilder.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantDeepTurnAttemptInputBuilder.test.tsassistantDeepTurnResponseRuntimeInputBuilder.test.tsassistantDeepTurnAnalysisAttemptInputBuilder.test.tsassistantDeepTurnAttemptRuntimeAdapter.test.tsassistantDeepTurnResponseAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantAddressAttemptRuntimeAdapter.test.tsassistantLivingChatAttemptInputBuilder.test.tsassistantAddressLaneAttemptInputBuilder.test.tsassistantAddressLaneResponseAttemptInputBuilder.test.tsassistantAddressRuntimeInputBuilder.test.tsassistantTurnRuntimeInputBuilder.test.tsassistantTurnAttemptRuntimeAdapter.test.tsassistantTurnRuntimeDepsAdapter.test.tsassistantOrganizationScopeRuntimeAdapter.test.tsassistantAddressLaneAttemptRuntimeAdapter.test.tsassistantAddressLaneResponseAttemptRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantLivingChatAttemptRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantLivingChatRuntimeAdapter.test.tsassistantWave10SettlementCorrectiveRegression.test.tsassistantLivingChatMode.test.ts
Implemented in current pass (Phase 2.61 + 2.62 + 2.63 + 2.64):
- Added dedicated runtime input builder for address lane response runtime:
assistantAddressLaneResponseRuntimeInputBuilder.ts- introduced:
buildAssistantAddressLaneResponseRuntimeInput(...)
- Rewired
assistantAddressLaneResponseAttemptRuntimeAdapterto consume the new builder (behavior-preserving):- removed inline mapping from attempt input to response runtime input.
- Added dedicated runtime input builders for living-chat attempt orchestration:
assistantLivingChatAttemptRuntimeInputBuilder.ts- introduced:
buildAssistantLivingChatLlmRuntimeInput(...)buildAssistantLivingChatHandlerRuntimeInput(...)
- Rewired
assistantLivingChatAttemptRuntimeAdapterto consume living-chat runtime input builders (behavior-preserving):buildExecuteLlmChat(...)now delegates llm payload assembly via builder;- top-level living-chat handler invocation now uses builder payload.
- Added focused builder tests:
assistantAddressLaneResponseRuntimeInputBuilder.test.tsassistantLivingChatAttemptRuntimeInputBuilder.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantAddressLaneResponseRuntimeInputBuilder.test.tsassistantLivingChatAttemptRuntimeInputBuilder.test.tsassistantAddressLaneResponseAttemptRuntimeAdapter.test.tsassistantLivingChatAttemptRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantLivingChatRuntimeAdapter.test.tsassistantAddressAttemptRuntimeAdapter.test.tsassistantAddressLaneAttemptRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantDeepTurnAttemptInputBuilder.test.tsassistantDeepTurnAnalysisAttemptInputBuilder.test.tsassistantDeepTurnResponseRuntimeInputBuilder.test.tsassistantDeepTurnAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisAttemptRuntimeAdapter.test.tsassistantDeepTurnResponseAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantTurnRuntimeInputBuilder.test.tsassistantTurnAttemptRuntimeAdapter.test.tsassistantTurnRuntimeDepsAdapter.test.tsassistantOrganizationScopeRuntimeAdapter.test.tsassistantWave10SettlementCorrectiveRegression.test.tsassistantLivingChatMode.test.ts
Implemented in current pass (Phase 2.65 + 2.66 + 2.67 + 2.68):
- Added dedicated turn-attempt input builder:
assistantTurnAttemptInputBuilder.ts- introduced:
buildAssistantTurnAttemptAddressRuntimeInput(...)buildAssistantTurnAttemptDeepRuntimeInput(...)
- Rewired
assistantTurnAttemptRuntimeAdapterto consume turn-attempt builder outputs (behavior-preserving):- removed inline payload assembly for
runAddressAttemptRuntime(...)andrunDeepTurnAttemptRuntime(...).
- removed inline payload assembly for
- Added dedicated query-options builder for address lane attempt:
assistantAddressLaneAttemptQueryOptionsBuilder.ts- introduced:
resolveAssistantAddressLaneAttemptFollowupContext(...)buildAssistantAddressLaneAttemptQueryOptions(...)
- Rewired
assistantAddressLaneAttemptRuntimeAdapterto consume query-options builder (behavior-preserving):- moved followup-context extraction and options branching behind builder helpers.
- Added focused builder tests:
assistantTurnAttemptInputBuilder.test.tsassistantAddressLaneAttemptQueryOptionsBuilder.test.ts
Validation:
npm run buildpassed.- Targeted living/address/deep followup pack passed:
assistantTurnAttemptInputBuilder.test.tsassistantAddressLaneAttemptQueryOptionsBuilder.test.tsassistantTurnAttemptRuntimeAdapter.test.tsassistantAddressLaneAttemptRuntimeAdapter.test.tsassistantAddressLaneAttemptInputBuilder.test.tsassistantAddressLaneResponseRuntimeInputBuilder.test.tsassistantLivingChatAttemptRuntimeInputBuilder.test.tsassistantAddressLaneResponseAttemptRuntimeAdapter.test.tsassistantLivingChatAttemptRuntimeAdapter.test.tsassistantAddressAttemptRuntimeAdapter.test.tsassistantAddressRuntimeAdapter.test.tsassistantAddressLaneResponseRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantLivingChatRuntimeAdapter.test.tsassistantDeepTurnAttemptInputBuilder.test.tsassistantDeepTurnAnalysisAttemptInputBuilder.test.tsassistantDeepTurnResponseRuntimeInputBuilder.test.tsassistantDeepTurnAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisAttemptRuntimeAdapter.test.tsassistantDeepTurnResponseAttemptRuntimeAdapter.test.tsassistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantTurnRuntimeInputBuilder.test.tsassistantTurnRuntimeDepsAdapter.test.tsassistantOrganizationScopeRuntimeAdapter.test.tsassistantWave10SettlementCorrectiveRegression.test.tsassistantLivingChatMode.test.ts
Implemented in current pass (Phase 2.69 + 2.70 + 2.71 + 2.72):
- Finalized strict deps typing in turn runtime input builder:
assistantTurnRuntimeInputBuilder.ts- completed generic
AssistantTurnRuntimeBuilderDeps<ResponseType>wiring through address/deep runtime input contracts; - removed residual weak casts from builder field projection.
- Hardened turn runtime deps adapter contracts:
assistantTurnRuntimeDepsAdapter.ts- typed sessions/normalizer/data-layer/address-query/chat/log inputs directly from
AssistantTurnRuntimeBuilderDepscontract slices; - removed
unknown/anywrappers from adapter mapping while preserving compatible handler signatures for optional args.
- Preserved behavior of turn orchestration chain under stricter typing:
- bootstrap -> address attempt -> deep attempt flow remains unchanged at runtime.
Validation:
npm run buildpassed.- Targeted turn/deps regression pack passed:
assistantTurnRuntimeInputBuilder.test.tsassistantTurnRuntimeDepsAdapter.test.tsassistantTurnAttemptRuntimeAdapter.test.tsassistantAddressAttemptRuntimeAdapter.test.ts
Implemented in current pass (Phase 2.73 + 2.74 + 2.75 + 2.76):
- Removed remaining unsafe casts in address->living-chat bridge:
assistantAddressAttemptRuntimeAdapter.ts- replaced
mergeKnownOrganizationsdependency type with living-chat compatible contract; - removed
as anycast formergeKnownOrganizationsand removed final object cast toRunAssistantLivingChatAttemptRuntimeInput.
- Added explicit mode-decision normalization before living-chat runtime handoff:
- mapped untyped
modeDecisionto typed{ mode: string | null; reason: string | null }contract.
- mapped untyped
- Preserved behavior of address lane + living-chat fallback under stricter typing:
- runtime flow unchanged, only contract hardening.
Validation:
npm run buildpassed.- Targeted address/living/turn regression pack passed:
assistantAddressAttemptRuntimeAdapter.test.tsassistantLivingChatAttemptRuntimeAdapter.test.tsassistantLivingChatHandlerRuntimeAdapter.test.tsassistantTurnRuntimeInputBuilder.test.tsassistantTurnRuntimeDepsAdapter.test.tsassistantTurnAttemptRuntimeAdapter.test.ts
Implemented in current pass (Phase 2.77 + 2.78 + 2.79 + 2.80):
- Removed unsafe casts from address lane response runtime finalization path:
assistantAddressLaneResponseRuntimeAdapter.ts- introduced explicit normalization for:
replyType(fallback-safe);carryoverMetaextraction from followup context;llmPreDecomposeMetasparse contract mapping;- address debug payload handoff into finalize stage.
- Hardened deep response runtime bridge to packaging stage:
assistantDeepTurnResponseRuntimeAdapter.ts- replaced
as anypayload handoff with typed normalizers for:- execution plan;
- runtime analysis context;
- business scope resolution;
- record/audit buckets;
- address-runtime meta.
- Updated deep response runtime input builder to pass typed composition contract directly:
assistantDeepTurnResponseRuntimeInputBuilder.ts- removed composition cast in analysis->response mapping.
Validation:
npm run buildpassed.- Targeted response/address/deep pack passed:
assistantAddressLaneResponseRuntimeAdapter.test.tsassistantAddressLaneResponseAttemptRuntimeAdapter.test.tsassistantDeepTurnResponseRuntimeInputBuilder.test.tsassistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnResponseAttemptRuntimeAdapter.test.tsassistantDeepTurnAttemptRuntimeAdapter.test.ts
Implemented in current pass (Phase 2.81 + 2.82 + 2.83 + 2.84):
- Removed remaining unsafe casts from deep analysis-attempt input builder:
assistantDeepTurnAnalysisAttemptInputBuilder.ts- added typed adapters/normalizers for:
- temporal/polarity/claim-bound resolver bridges;
- focus-domain narrowing for guard pipeline;
- company-anchor and primary-period normalization;
- runtime callback mapping (
context -> plan -> retrieval -> guard -> grounding -> composition) withoutas any.
- Hardened deep analysis runtime contracts:
assistantDeepTurnAnalysisRuntimeAdapter.ts- replaced broad unknown execution-plan/guard/grounding signatures with concrete typed contracts (
AssistantExecutionPlanItem, guard and grounding slices).
- Hardened deep context contracts for guard chain compatibility:
assistantDeepTurnContextRuntimeAdapter.ts- aligned temporal/polarity/claim-bound outputs with concrete audits;
- aligned
liveTemporalHintwith retrieval runtime contract.
- Removed remaining unsafe casts from grounding and composition runtime adapters:
assistantDeepTurnGroundingRuntimeAdapter.tsassistantDeepTurnCompositionRuntimeAdapter.ts- replaced generic cast-based defaults with typed defaults and normalized company-anchor handoff into answer composer.
Validation:
npm run buildpassed.- Targeted deep analysis/grounding/composition pack passed:
assistantDeepTurnAnalysisAttemptInputBuilder.test.tsassistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantDeepTurnAnalysisAttemptRuntimeAdapter.test.tsassistantDeepTurnGroundingRuntimeAdapter.test.tsassistantDeepTurnCompositionRuntimeAdapter.test.tsassistantDeepTurnAttemptRuntimeAdapter.test.ts
Implemented in current pass (Phase 2.85 + 2.86 + 2.87 + 2.88):
- Removed the final
as anyfrom backend source deep-turn packaging path:assistantDeepTurnPackaging.ts- switched assistant-item debug handoff to strongly typed payload contract.
- Hardened debug payload contract at assembly boundary:
assistantDebugPayloadAssembler.tsbuildDeepAnalysisDebugPayload(...)now returnsAssistantDebugPayloadcontract.
- Propagated typed debug payload through deep-turn runtime chain:
assistantDeepTurnPackagingRuntimeAdapter.tsassistantDeepTurnResponseRuntimeAdapter.tsassistantDeepTurnResponseAttemptRuntimeAdapter.tsassistantDeepTurnAttemptRuntimeAdapter.ts- aligned
debugfield contracts toAssistantDebugPayloadand fixed generic runtime callback typing soResponseTyperemains preserved end-to-end.
- Preserved behavior:
- no runtime logic change; only contract tightening for debug payload propagation and generic signature alignment.
Validation:
npm run buildpassed.- Targeted deep packaging/response chain pack passed:
assistantDeepTurnPackaging.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantDeepTurnResponseAttemptRuntimeAdapter.test.tsassistantDeepTurnAttemptRuntimeAdapter.test.ts
Implemented in current pass (Phase 2.89 + 2.90 + 2.91 + 2.92):
- Hardened deep-turn response envelope contract:
assistantDeepTurnResponseBuilder.ts- removed weak
debugunion (AssistantDebugPayload | Record<string, unknown>); - response builder now accepts and propagates
AssistantDebugPayloadstrictly.
- Hardened deep-turn finalize runtime contract:
assistantDeepTurnFinalizeRuntimeAdapter.ts- aligned finalize input to strict
AssistantDebugPayloadfordebug.
- Preserved behavior:
- no runtime logic changes; only stricter contract enforcement for debug payload type at finalize/response boundary.
Validation:
npm run buildpassed.- Targeted deep finalize/response pack passed:
assistantDeepTurnResponseBuilder.test.tsassistantDeepTurnFinalizeRuntimeAdapter.test.tsassistantDeepTurnResponseAttemptRuntimeAdapter.test.tsassistantDeepTurnAttemptRuntimeAdapter.test.ts
Implemented in current pass (Phase 2.93 + 2.94 + 2.95 + 2.96):
- Introduced shared followup-usage contract and helper:
assistantFollowupUsage.ts- added:
AssistantFollowupUsageisAssistantFollowupApplied(...)
- Replaced weak
unknownfollowup usage contracts across deep-turn chain:assistantDeepTurnNormalizationRuntimeAdapter.tsassistantDeepTurnAnalysisAttemptRuntimeAdapter.tsassistantDeepTurnContextRuntimeAdapter.tsassistantDeepTurnCompositionRuntimeAdapter.tsassistantDeepTurnAttemptInputBuilder.tsassistantDeepTurnResponseAttemptRuntimeAdapter.tsassistantDeepTurnInputBuilder.tsassistantDeepTurnPackagingRuntimeAdapter.tsassistantDeepTurnPackaging.ts
- Removed inline followup casts:
- switched
Boolean((... as { applied?: unknown })?.applied)style checks to shared helper usage.
- switched
- Preserved behavior:
- no logic changes, only contract normalization and reuse of a single applied-check helper.
Validation:
npm run buildpassed.- Targeted deep followup chain pack passed:
assistantDeepTurnNormalizationRuntimeAdapter.test.tsassistantDeepTurnContextRuntimeAdapter.test.tsassistantDeepTurnCompositionRuntimeAdapter.test.tsassistantDeepTurnAttemptInputBuilder.test.tsassistantDeepTurnResponseAttemptRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantDeepTurnPackaging.test.ts
Implemented in current pass (Phase 2.97 + 2.98 + 2.99 + 2.100):
- Tightened deep-turn response runtime input contracts for analysis context and address meta:
assistantDeepTurnResponseRuntimeAdapter.tsruntimeAnalysisContextnow typed with explicit fields and optionalsnapshot_mode;addressRuntimeMetaForDeepnow typed via packaging contract.
- Propagated the tightened types through deep response attempt chain:
assistantDeepTurnResponseAttemptRuntimeAdapter.tsassistantDeepTurnAttemptRuntimeAdapter.ts
- Preserved behavior:
- no runtime logic changes; only type alignment for response attempt inputs.
Validation:
npm run buildpassed.- Targeted deep response attempt pack passed:
assistantDeepTurnResponseAttemptRuntimeAdapter.test.tsassistantDeepTurnAttemptRuntimeAdapter.test.tsassistantDeepTurnAttemptInputBuilder.test.ts
Implemented in current pass (Phase 2.101 + 2.102 + 2.103 + 2.104):
- Tightened company-anchors and business-scope contracts in deep analysis runtime:
assistantDeepTurnContextRuntimeAdapter.tsassistantDeepTurnAnalysisRuntimeAdapter.tscompanyAnchorsnow typed asCompanyAnchorSet | null;businessScopeResolutionnow typed asAssistantBusinessScopeResolution.
- Aligned composition runtime input to accept typed anchors:
assistantDeepTurnAnalysisRuntimeAdapter.tsrunCompositionRuntimenow expectsCompanyAnchorSet | null.
- Preserved behavior:
- no runtime logic changes; type alignment only.
Validation:
npm run buildpassed.- Targeted deep analysis pack passed:
assistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantDeepTurnAnalysisAttemptRuntimeAdapter.test.tsassistantDeepTurnCompositionRuntimeAdapter.test.ts
Implemented in current pass (Phase 2.105 + 2.106 + 2.107 + 2.108):
- Hardened raw retrieval normalization without changing output:
retrievalResultNormalizer.ts- added
normalizeRawRetrievalResult(...)to avoid unsafe raw casting; - added
normalizeNumberRecord(...)to replaceRecord<string, number>casts for lifecycle distributions.
- Preserved behavior:
- no logic changes; only safer normalization of raw payload shapes.
Validation:
npm run buildpassed.- Targeted retrieval normalization pack passed:
retrievalResultEvidenceEnrichment.test.tsretrievalProblemUnitDualPayload.test.tsretrievalLifecycleRuntimeRollout.test.tsretrievalGraphRuntimeDualPayload.test.ts
Implemented in current pass (Phase 2.109 + 2.110 + 2.111 + 2.112):
- Tightened plan-audit and live-route audit typing for deep grounding:
assistantDeepTurnPlanRuntimeAdapter.tsassistantDeepTurnGroundingRuntimeAdapter.tsassistantDeepTurnAnalysisRuntimeAdapter.tsrbpPlanAudit/faPlanAuditnow useRecord<string, unknown> | nullcontract;- live route audits now typed to
RbpLiveRouteAuditDebug | null/FaLiveRouteAuditDebug | null; - grounded eligibility guard now typed to
GroundedAnswerEligibilityGuardDebug.
- Preserved behavior:
- no runtime logic changes; type alignment only.
Validation:
npm run buildpassed.- Targeted deep grounding pack passed:
assistantDeepTurnGroundingRuntimeAdapter.test.tsassistantDeepTurnAnalysisRuntimeAdapter.test.tsassistantDeepTurnAnalysisAttemptRuntimeAdapter.test.ts
Implemented in current pass (Phase 2.113 + 2.114 + 2.115 + 2.116):
- Tightened temporal/polarity guard typing in deep plan runtime:
assistantDeepTurnPlanRuntimeAdapter.tstemporalGuardnow typed toTemporalGuardAudit;domainPolarityGuardInitialnow typed toDomainPolarityGuardAudit.
- Preserved behavior:
- no runtime logic changes; type alignment only.
Validation:
npm run buildpassed.- Targeted deep plan pack passed:
assistantDeepTurnPlanRuntimeAdapter.test.tsassistantDeepTurnAnalysisAttemptRuntimeAdapter.test.ts
Implemented in current pass (Phase 2.117 + 2.118 + 2.119 + 2.120):
- Tightened audit typing along deep response/packaging chain:
assistantDebugPayloadAssembler.tsassistantMessageLogAssembler.tsassistantDeepTurnPackaging.tsassistantDeepTurnPackagingRuntimeAdapter.tsassistantDeepTurnInputBuilder.tsassistantDeepTurnResponseRuntimeAdapter.ts- audit contracts now use concrete types:
TemporalGuardAudit,DomainPolarityGuardAudit,ClaimBoundAnchorAudit,TargetedEvidenceAcquisitionAudit,EvidenceAdmissibilityAudit,GroundedAnswerEligibilityAudit,RbpLiveRouteAuditDebug | null,FaLiveRouteAuditDebug | null.
- Preserved behavior:
- no runtime logic changes; type alignment only.
Validation:
npm run buildpassed.- Targeted deep response/packaging pack passed:
assistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnResponseAttemptRuntimeAdapter.test.tsassistantDeepTurnPackagingRuntimeAdapter.test.tsassistantDeepTurnPackaging.test.ts
Implemented in current pass (Phase 2.121 + 2.122 + 2.123 + 2.124):
- Tightened retrieval call/raw types across deep response chain:
assistantDeepTurnRetrievalRuntimeAdapter.tsassistantDeepTurnResponseRuntimeAdapter.tsassistantDeepTurnPackaging.tsassistantDeepTurnPackagingRuntimeAdapter.tsassistantDeepTurnInputBuilder.tsassistantMessageLogAssembler.tsassistantEvidenceBundleAssembler.tsassistantOrchestrationContracts.ts- introduced
AssistantRetrievalRawResultand typedAssistantRetrievalRawResultRecord; - retrieval calls now use
AssistantRetrievalCallRecord[]end-to-end.
- Preserved behavior:
- no runtime logic changes; only stronger typing and safe raw normalization.
Validation:
npm run buildpassed.- Targeted deep retrieval/response pack passed:
assistantDeepTurnResponseRuntimeAdapter.test.tsassistantDeepTurnRetrievalRuntimeAdapter.test.tsassistantDeepTurnPackaging.test.ts
Implemented in current pass (Phase 2.125 + 2.126 + 2.127 + 2.128):
- Tightened deep turn execution state + fallback metadata typing:
assistantDeepTurnPrePackagingContext.tsassistantDeepTurnPackaging.tsassistantDeepTurnPackagingRuntimeAdapter.tsassistantDeepTurnInputBuilder.tsassistantDeepTurnResponseRuntimeAdapter.tsassistantDeepTurnNormalizationRuntimeAdapter.ts- added
AssistantExecutionStateRecord+AssistantAddressRuntimeMetaForDeep; fallback_typenowAssistantFallbackType;problem_answer_modenowAssistantProblemAnswerMode;problem_unit_ids_usednowstring[];investigationStateSnapshotnowInvestigationStateWithProblemUnits | null.
- Aligned debug/log payload typing with contracts:
assistantDebugPayloadAssembler.tsassistantMessageLogAssembler.tsassistantOrchestrationContractsV1andoutcomeClassV1now typed;answerStructureV11now typed.
- Preserved behavior:
- no runtime logic changes; type alignment only.
Validation:
- Not run in this pass (type-only changes).
Implemented in current pass (Phase 2.129 + 2.130 + 2.131 + 2.132):
- Typified debug route structures end-to-end:
assistantQueryPlanning.tsassistantDeepTurnPrePackagingContext.tsassistantDeepTurnPackaging.tsassistantDeepTurnPackagingRuntimeAdapter.tsassistantDeepTurnInputBuilder.tsassistantDeepTurnResponseRuntimeAdapter.tsassistantDebugPayloadAssembler.tsassistantMessageLogAssembler.ts- introduced
AssistantDebugRouteRecordunion (legacy vs deterministic debug routes); routesnow typed inAssistantDebugPayload.
- Preserved behavior:
- no runtime logic changes; type alignment only.
Validation:
- Not run in this pass (type-only changes).
Implemented in current pass (Phase 2.133):
- Tightened deep retrieval runtime input:
assistantDeepTurnRetrievalRuntimeAdapter.tsexecuteRouteRuntimenow returnsAssistantRetrievalRawResult(explicit union).
- Preserved behavior:
- no runtime logic changes; type alignment only.
Validation:
- Not run in this pass (type-only changes).
Implemented in current pass (Phase 2.134 + 2.135):
- Typed live-route plan audit contract:
assistantDeepTurnPlanRuntimeAdapter.ts- introduced
AssistantLiveRoutePlanAuditfor plan enforcement audits.
- Typed deep analysis log payload plumbing:
assistantMessageLogAssembler.tsassistantDeepTurnPackaging.tsassistantDeepTurnPackagingRuntimeAdapter.tsassistantDeepTurnFinalizeRuntimeAdapter.ts- introduced
DeepAnalysisLogDetailsalias and used it end-to-end.
- Preserved behavior:
- no runtime logic changes; type alignment only.
Validation:
- Not run in this pass (type-only changes).
Implemented in current pass (Phase 2.136):
- Tightened business-scope resolution contract shape:
assistantDeepTurnContextRuntimeAdapter.ts- removed index-signature
unknownon business scope resolution; resolveBusinessScopeFromLiveContextnow usesAssistantBusinessScopeResolutionexplicitly.
- Preserved behavior:
- no runtime logic changes; type alignment only.
Validation:
- Not run in this pass (type-only changes).
Implemented in current pass (Phase 2.137 + 2.138):
- Tightened company anchor normalization input types:
assistantDeepTurnCompositionRuntimeAdapter.tstoStringArraynow acceptsstring[] | null | undefined;- company anchor normalization now consumes
Partial<CompanyAnchorSet>.
- Narrowed response runtime normalizers:
assistantDeepTurnResponseRuntimeAdapter.ts- runtime analysis context and business scope normalizers now take typed inputs.
- Preserved behavior:
- no runtime logic changes; type alignment only.
Validation:
- Not run in this pass (type-only changes).
Implemented in current pass (Phase 2.139 + 2.140):
- Tightened analysis attempt builder normalizers:
assistantDeepTurnAnalysisAttemptInputBuilder.ts- removed
unknownfrom anchor/period helpers; nowPartial<CompanyAnchorSet>+ typed primary period.
- Narrowed response runtime normalization helpers:
assistantDeepTurnResponseRuntimeAdapter.ts- execution plan normalization now consumes typed
AssistantExecutionPlanItem[]; - helper signatures no longer accept
unknownwhere input is already typed.
- Preserved behavior:
- no runtime logic changes; type alignment only.
Validation:
- Not run in this pass (type-only changes).
Implemented in current pass (Phase 2.141 + 2.142 + 2.143 + 2.144):
- Tightened attempt input defaults:
assistantDeepTurnAttemptInputBuilder.ts- response attempt default type is now
AssistantMessageResponsePayload.
- Tightened retrieval raw result typing:
assistantDeepTurnRetrievalRuntimeAdapter.ts- introduced
AssistantRetrievalRawResultLike+ list item union.
- Tightened deep packaging normalization:
assistantDeepTurnPackaging.ts- normalized fragments extracted without
Record<string, unknown>cast.
- Simplified response runtime normalizers:
assistantDeepTurnResponseRuntimeAdapter.ts- removed
toRecordObjectcasts and normalized from typed inputs.
- Preserved behavior:
- no runtime logic changes; type alignment only.
Validation:
- Not run in this pass (type-only changes).
Implemented in current pass (Phase 2.145 + 2.146):
- Tightened retrieval raw result field shapes:
assistantDeepTurnRetrievalRuntimeAdapter.ts- introduced
AssistantRetrievalFieldValue/AssistantRetrievalRecord; - removed
unknownfrom raw result record types.
- Tightened normalized fragment extraction:
assistantDeepTurnPackaging.ts- normalized fragments now typed to
NormalizedQueryV2*fragments.
- Preserved behavior:
- no runtime logic changes; type alignment only.
Validation:
- Not run in this pass (type-only changes).
Status: Completed (Phase 2.1–2.146)
Stage 2 Completion Report (Summary)
- Orchestration monolith decomposed into explicit modules:
- QueryFrame, ExecutionPlan, EvidenceBundle, Coverage/Grounding, Answer package, Debug payload, Log details.
- Deep lane now uses stable contracts end-to-end:
assistant_orchestration_contracts_v1,assistant_evidence_bundle_v1,assistant_coverage_contract_v1.
- Audit & trace coverage standardized:
- temporal/polarity/claim/evidence guards, live-route audits, followup usage, outcome class.
- Type hardening complete across deep chain:
- normalized payloads, execution plan, retrieval calls/raw, debug routes, runtime meta, investigation state.
- Behavior preserved throughout refactor (no route/answer regressions by design).
Stage 2 Closure Audit (2026-04-11)
- Fixed runtime-critical context loss in
assistantTurnRuntimeDepsAdapter.ts:- unbound session store/logger/normalizer methods caused
TypeErroratassistantSessionStore.ensureSession(...)and mass500responses in API tests.
- unbound session store/logger/normalizer methods caused
- Added safe method wrappers in deps adapter:
ensureSession,appendItem,getSession,persistSession,setInvestigationState,normalize.
- Added regression guard:
assistantTurnRuntimeDepsAdapter.test.tsnow includes a stateful instance-context test to preventthisloss regressions.
- Validation gates (fact):
npm run buildpassed.- Combined Stage 2 regression validation passed:
37files /95tests (deep-turn adapters/builders/packaging, orchestration contracts/runtime, MCP bridge, followup continuity, wave10 corrective regression).
- Scope note:
- Full backend suite still has red tests in Stage 3/4 probes and long-running acceptance packs; this is tracked under Stage 3 backlog and is not a Stage 2 blocker.
Stage 2 Remaining Risks (Known)
- Final answer quality still template-heavy and brittle.
- Lexical routing pressure remains high (dictionary overfitting risk).
- Deterministic guards still compensate for weak semantic parsing.
Stage 3 (P2): Hybrid Semantic Layer (LLM + Deterministic Guards)
Goal:
- Use LLM for semantic extraction/decomposition in strict schema.
- Keep deterministic guardrails as verifier, not primary “brain”.
- Reduce dictionary overfitting and false route drifts.
Plan (Stage 3):
- Schema-first semantic extraction
- Strict JSON schema for: entities, time scope, intent, ambiguity, success criteria.
- Hard validation + retry/repair loop.
- LLM decomposition with guardrails
- Decomposition produces executable plan candidates.
- Deterministic guards validate: domain polarity, temporal window, claim-bound anchors.
- Evidence-first reasoning
- LLM only summarizes from evidence bundle, never invents facts.
- Context binding
- Carryover only via typed followup state, not free-text memory.
- Quality gates
- Coverage critic threshold before final answer.
- Reason-code taxonomy normalized.
Implemented in current pass (Stage 3.1 kick-off):
- Added strict semantic extraction contract for address predecompose:
address_semantic_extraction_contract_v1built fromsource_message + canonical_message + predecompose contract.- Captures: extraction snapshot, guard hints, quality, validity, apply-canonical recommendation, reason codes.
- Added semantic guard integration in predecompose runtime:
- New rejection path for low-value/unsafe canonical rewrites (
normalized_fragment_rejected_semantic_guard). - Fallback preference updated: deterministic fallback can win over LLM canonical when semantic contract rejects rewrite.
- New rejection path for low-value/unsafe canonical rewrites (
- Added semantic arbitration integration in tool-gate:
resolveAddressToolGateDecision(...)now honorsapply_canonical_recommended.- New skip reason:
llm_predecompose_semantic_guard_rejected.
- Extended runtime/debug observability:
- semantic contract propagated through address tool-gate, deep debug payload, and living chat debug payload.
- orchestration contract now includes semantic guard fields (
semantic_contract_valid,semantic_apply_canonical_recommended,semantic_reason_codes).
- Added focused regression tests:
assistantSemanticExtractionContract.test.ts(new)- Existing router/chat regressions revalidated (
assistantLivingRouter.test.ts,assistantLivingChatMode.test.ts).
Implemented in current pass (Stage 3.2 semantic route arbitration):
- Extended orchestration fallback arbitration with semantic hints:
resolveAssistantOrchestrationDecision(...)now evaluates semantic extraction hints (guard_hints,extraction) in addition to lexical flags.- Added followup-aware override path so unsupported aggregate carryover queries can still be redirected to deep-analysis lane.
- Reduced false route stickiness in followup turns:
- Aggregate/unsupported questions with stale followup context no longer remain in address lane by default.
- Supported intents (for example
list_open_contracts) remain protected from accidental deep fallback unless strict deep-investigation cue is detected.
- Extended orchestration debug contract:
- Added
semantic_route_arbitrationblock (supported_address_intent_detected,semantic_deep_investigation_hint_detected,semantic_aggregate_shape_detected,followup_semantic_override_to_deep_allowed).
- Added
- Added/updated regression coverage for real failures:
assistantLivingRouter.test.tsnow includes followup-carryover aggregate scenario (какие обороты ... за 2020 год) and validates deep fallback.- Existing list-open-contracts guard scenario remains green (
Покажи незакрытые договоры ...stays in address lane).
- Validation snapshot:
- Stage 3 focused suite:
10files /76tests passed. - Type build:
npm --prefix llm_normalizer/backend run buildpassed.
- Stage 3 focused suite:
Implemented in current pass (Stage 3.3 soft-refusal + anti-template limited replies):
- Reworked address-lane limited reply composer from fixed template to contextual soft-refusal:
- Added deterministic phrasing variants (stable, non-random) to reduce repeated boilerplate.
- Kept concise "Коротко" structure while replacing hard repeated wording.
- Added context-aware explanation and recovery offers for limited responses:
- Response now injects request scope hints when available (organization, as-of date, period window).
- Added "Что могу сделать сейчас" with nearest supported scenarios (documents/payments by anchor, open contracts/tails, account-balance drilldown).
- Added weak-anchor suppression for user-facing hints to avoid low-value auto-substitutions in suggestions.
- Improved unsupported aggregate handling UX:
- For aggregate/ranking style queries, reply now proposes evidence-first path (collect factual base -> continue in extended analysis) instead of hard static fallback phrase.
- Improved missing-anchor UX:
- Missing anchor tokens are normalized to user-facing terms (e.g.,
counterparty_or_contract-> "контрагент или договор"). - Added concrete reformulation hint for underspecified anchor cases.
- Missing anchor tokens are normalized to user-facing terms (e.g.,
- Regression updates:
- Updated
addressQueryRuntimeM23.test.tssoft out-of-scope assertion to validate contextual soft-refusal structure.
- Updated
- Validation snapshot:
- Extended regression pack:
11files /344tests passed. - Type build:
npm --prefix llm_normalizer/backend run buildpassed.
- Extended regression pack:
Implemented in current pass (Stage 3.4 deep/living soft-refusal boundary widening):
- Extended boundary fallback trigger in policy composer:
shouldUseBoundaryFallbackReply(...)now supportsbroad_partialmode when domain coverage is weak/unconfirmed.- Added domain-aware gate (
focus_domain == nullorfocusDomainGroundingBlocked) + weak-evidence envelope checks.
- Reduced template leakage for off-domain partial replies:
- Cases with weak partial support but no confirmed domain grounding now return soft-refusal boundary reply instead of rigid
Коротко/Что сломано/...template blocks.
- Cases with weak partial support but no confirmed domain grounding now return soft-refusal boundary reply instead of rigid
- Improved boundary fallback UX:
- Added deterministic heading variants to reduce repetitive wording.
- Added quick actionable line (
Что могу сделать сейчас) sourced from nearest supported capability set.
- Added targeted regression coverage:
- Rewrote/normalized
assistantBoundaryFallbackReply.test.tsin UTF-8 and added case forbroad_partial + weak evidence + uncovered domain.
- Rewrote/normalized
- Validation snapshot:
- Stage 3 focused suite (+boundary):
12files /348tests passed. - Type build:
npm --prefix llm_normalizer/backend run buildpassed.
- Stage 3 focused suite (+boundary):
Acceptance (Stage 3):
- LLM outputs strictly validated schema for extraction/decomposition (no free-form).
- Deterministic guards can block or downgrade answers when evidence insufficient.
- False route drifts and generic responses reduced in regression packs.
- Manual markup shows increase in “correct/grounded” labels.
Status: Planned
Stage 4 (P2): Human-Centric Answer Layer
Goal:
- Move final user response to contract-driven answer package with:
- direct answer;
- what was checked;
- what was found;
- what remains unproven;
- best next step.
- Keep claim-to-evidence binding strict.
Status: Planned
Stage 5 (P3): Quality Loop Driven By GUI Markup
Goal:
- Drive backlog from
manual_case_decisionqueues. - Build targeted regression packs from real failed comments.
- Track trend by reason-code clusters.
Status: Planned
6. Non-Negotiable Constraints
- Do not break MCP route interfaces.
- Do not remove manual logic without compatible replacement.
- Preserve UTF-8 (without BOM) for all source/doc files.
- Keep manual markup and autorun API contract stable.