74 lines
2.9 KiB
JavaScript
74 lines
2.9 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.buildAssistantDeepTurnRuntimeContext = buildAssistantDeepTurnRuntimeContext;
|
|
const assistantFollowupUsage_1 = require("./assistantFollowupUsage");
|
|
const KNOWN_P0_DOMAINS = new Set([
|
|
"settlements_60_62",
|
|
"vat_document_register_book",
|
|
"month_close_costs_20_44",
|
|
"fixed_asset_amortization"
|
|
]);
|
|
function toAnalysisContext(runtimeAnalysisContext) {
|
|
if (!runtimeAnalysisContext.active) {
|
|
return null;
|
|
}
|
|
return {
|
|
as_of_date: runtimeAnalysisContext.as_of_date,
|
|
period_from: runtimeAnalysisContext.period_from,
|
|
period_to: runtimeAnalysisContext.period_to,
|
|
source: runtimeAnalysisContext.source
|
|
};
|
|
}
|
|
function buildAssistantDeepTurnRuntimeContext(input) {
|
|
const companyAnchors = input.resolveCompanyAnchors(input.userMessage);
|
|
const initialBusinessScopeResolution = input.resolveBusinessScopeAlignment({
|
|
userMessage: input.userMessage,
|
|
companyAnchors,
|
|
normalized: input.normalizedPayload,
|
|
routeSummary: input.routeSummary
|
|
});
|
|
const inferredDomainByMessage = input.inferP0DomainFromMessage(input.userMessage);
|
|
const focusDomainForGuards = inferredDomainByMessage && KNOWN_P0_DOMAINS.has(inferredDomainByMessage) ? inferredDomainByMessage : null;
|
|
const analysisContext = toAnalysisContext(input.runtimeAnalysisContext);
|
|
const temporalGuard = input.resolveTemporalGuard({
|
|
userMessage: input.userMessage,
|
|
normalized: input.normalizedPayload,
|
|
companyAnchors,
|
|
analysisContext
|
|
});
|
|
const domainPolarityGuardInitial = input.resolveDomainPolarityGuard({
|
|
userMessage: input.userMessage,
|
|
companyAnchors,
|
|
focusDomainHint: focusDomainForGuards
|
|
});
|
|
const claimAnchorAudit = input.resolveClaimBoundAnchors({
|
|
userMessage: input.userMessage,
|
|
companyAnchors,
|
|
focusDomainHint: focusDomainForGuards,
|
|
primaryPeriod: temporalGuard.effective_primary_period ?? temporalGuard.primary_period_window
|
|
});
|
|
const businessScopeResolution = input.resolveBusinessScopeFromLiveContext({
|
|
current: initialBusinessScopeResolution,
|
|
temporalGuard,
|
|
claimType: claimAnchorAudit.claim_type,
|
|
focusDomainHint: focusDomainForGuards,
|
|
userMessage: input.userMessage,
|
|
companyAnchors,
|
|
followupApplied: (0, assistantFollowupUsage_1.isAssistantFollowupApplied)(input.followupUsage)
|
|
});
|
|
const resolvedRouteSummary = businessScopeResolution.route_summary_resolved;
|
|
const liveTemporalHint = toAnalysisContext(input.runtimeAnalysisContext);
|
|
return {
|
|
companyAnchors,
|
|
initialBusinessScopeResolution,
|
|
inferredDomainByMessage,
|
|
focusDomainForGuards,
|
|
temporalGuard,
|
|
domainPolarityGuardInitial,
|
|
claimAnchorAudit,
|
|
businessScopeResolution,
|
|
resolvedRouteSummary,
|
|
liveTemporalHint
|
|
};
|
|
}
|