ГЛОБАЛЬНЫЙ РЕФАКТОРИНГ АРХИТЕКТУРЫ - Рефакторинг этапов 2.522.55 - Перевод finalizeAddressLaneResponse на builder вместо inline-сборки в assistantAddressAttemptRuntimeAdapter.ts \ Добавлен builder для lane-attempt input: assistantAddressLaneAttemptInputBuilder.ts. \ Добавлен builder для финального address-runtime input: assistantAddressRuntimeInputBuilder.ts.

This commit is contained in:
2026-04-11 01:09:53 +03:00
parent b612615219
commit c849eb5f5b
12 changed files with 504 additions and 67 deletions
@@ -4,14 +4,17 @@ exports.runAssistantAddressAttemptRuntime = runAssistantAddressAttemptRuntime;
const assistantAddressRuntimeAdapter_1 = require("./assistantAddressRuntimeAdapter");
const assistantAddressLaneAttemptRuntimeAdapter_1 = require("./assistantAddressLaneAttemptRuntimeAdapter");
const assistantAddressLaneResponseAttemptRuntimeAdapter_1 = require("./assistantAddressLaneResponseAttemptRuntimeAdapter");
const assistantAddressLaneResponseAttemptInputBuilder_1 = require("./assistantAddressLaneResponseAttemptInputBuilder");
const assistantLivingChatAttemptRuntimeAdapter_1 = require("./assistantLivingChatAttemptRuntimeAdapter");
const assistantLivingChatAttemptInputBuilder_1 = require("./assistantLivingChatAttemptInputBuilder");
const assistantAddressLaneAttemptInputBuilder_1 = require("./assistantAddressLaneAttemptInputBuilder");
const assistantAddressRuntimeInputBuilder_1 = require("./assistantAddressRuntimeInputBuilder");
async function runAssistantAddressAttemptRuntime(input) {
const runAddressRuntimeSafe = input.runAddressRuntime ?? assistantAddressRuntimeAdapter_1.runAssistantAddressRuntime;
const runAddressLaneAttemptRuntimeSafe = input.runAddressLaneAttemptRuntime ?? assistantAddressLaneAttemptRuntimeAdapter_1.runAssistantAddressLaneAttemptRuntime;
const runAddressLaneResponseAttemptRuntimeSafe = input.runAddressLaneResponseAttemptRuntime ?? assistantAddressLaneResponseAttemptRuntimeAdapter_1.runAssistantAddressLaneResponseAttemptRuntime;
const runLivingChatAttemptRuntimeSafe = input.runLivingChatAttemptRuntime ?? assistantLivingChatAttemptRuntimeAdapter_1.runAssistantLivingChatAttemptRuntime;
const finalizeAddressLaneResponse = (addressLane, effectiveAddressUserMessage, carryoverMeta = null, llmPreDecomposeMeta = null) => runAddressLaneResponseAttemptRuntimeSafe({
const finalizeAddressLaneResponse = (addressLane, effectiveAddressUserMessage, carryoverMeta = null, llmPreDecomposeMeta = null) => runAddressLaneResponseAttemptRuntimeSafe((0, assistantAddressLaneResponseAttemptInputBuilder_1.buildAssistantAddressLaneResponseAttemptRuntimeInput)({
sessionId: input.sessionId,
userMessage: input.userMessage,
effectiveAddressUserMessage,
@@ -31,7 +34,7 @@ async function runAssistantAddressAttemptRuntime(input) {
cloneConversation: input.cloneConversation,
logEvent: input.logEvent,
messageIdFactory: input.messageIdFactory
});
}));
const tryHandleLivingChat = async (modeDecision, addressRuntimeMeta = null) => runLivingChatAttemptRuntimeSafe((0, assistantLivingChatAttemptInputBuilder_1.buildAssistantLivingChatAttemptRuntimeInput)({
sessionId: input.sessionId,
userMessage: input.userMessage,
@@ -78,21 +81,20 @@ async function runAssistantAddressAttemptRuntime(input) {
defaultBaseUrl: input.defaultBaseUrl,
defaultApiKey: input.defaultApiKey
}));
const runAddressLaneAttempt = async (messageUsed, carryMeta, analysisDateHint) => runAddressLaneAttemptRuntimeSafe({
const runAddressLaneAttempt = async (messageUsed, carryMeta, analysisDateHint) => runAddressLaneAttemptRuntimeSafe((0, assistantAddressLaneAttemptInputBuilder_1.buildAssistantAddressLaneAttemptRuntimeInput)({
messageUsed,
carryMeta,
analysisDateHint,
activeOrganization: input.sessionScope.activeOrganization,
mergeFollowupContextWithOrganizationScope: input.mergeFollowupContextWithOrganizationScope,
runAddressQueryTryHandle: input.runAddressQueryTryHandle
});
return runAddressRuntimeSafe({
}));
return runAddressRuntimeSafe((0, assistantAddressRuntimeInputBuilder_1.buildAssistantAddressRuntimeInput)({
featureAssistantAddressQueryV1: input.featureAssistantAddressQueryV1,
sessionId: input.sessionId,
userMessage: input.userMessage,
sessionItems: input.sessionItems,
llmProvider: input.payload.llmProvider,
useMock: Boolean(input.payload.useMock),
payload: input.payload,
featureAddressLlmPredecomposeV1: input.featureAddressLlmPredecomposeV1,
runAddressLlmPreDecompose: input.runAddressLlmPreDecompose,
buildAddressLlmPredecomposeContractV1: input.buildAddressLlmPredecomposeContractV1,
@@ -102,7 +104,6 @@ async function runAssistantAddressAttemptRuntime(input) {
resolveAssistantOrchestrationDecision: input.resolveAssistantOrchestrationDecision,
buildAddressDialogContinuationContractV2: input.buildAddressDialogContinuationContractV2,
runtimeAnalysisContextAsOfDate: input.runtimeAnalysisContextAsOfDate,
payloadContextPeriodHint: input.payload?.context?.period_hint,
compactWhitespace: input.compactWhitespace,
runAddressLaneAttempt,
isRetryableAddressLimitedResult: input.isRetryableAddressLimitedResult,
@@ -113,5 +114,5 @@ async function runAssistantAddressAttemptRuntime(input) {
runAddressOrchestrationRuntime: input.runAddressOrchestrationRuntime,
runAddressToolGateRuntime: input.runAddressToolGateRuntime,
runAddressLaneRuntime: input.runAddressLaneRuntime
});
}));
}
@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildAssistantAddressLaneAttemptRuntimeInput = buildAssistantAddressLaneAttemptRuntimeInput;
function buildAssistantAddressLaneAttemptRuntimeInput(input) {
return {
messageUsed: input.messageUsed,
carryMeta: input.carryMeta,
analysisDateHint: input.analysisDateHint,
activeOrganization: input.activeOrganization,
mergeFollowupContextWithOrganizationScope: input.mergeFollowupContextWithOrganizationScope,
runAddressQueryTryHandle: input.runAddressQueryTryHandle
};
}
@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildAssistantAddressLaneResponseAttemptRuntimeInput = buildAssistantAddressLaneResponseAttemptRuntimeInput;
function buildAssistantAddressLaneResponseAttemptRuntimeInput(input) {
return {
sessionId: input.sessionId,
userMessage: input.userMessage,
effectiveAddressUserMessage: input.effectiveAddressUserMessage,
addressLane: input.addressLane,
carryoverMeta: input.carryoverMeta ?? null,
llmPreDecomposeMeta: input.llmPreDecomposeMeta ?? null,
knownOrganizations: input.knownOrganizations,
activeOrganization: input.activeOrganization,
sanitizeOutgoingAssistantText: input.sanitizeOutgoingAssistantText,
buildAddressDebugPayload: input.buildAddressDebugPayload,
buildAddressFollowupOffer: input.buildAddressFollowupOffer,
mergeKnownOrganizations: input.mergeKnownOrganizations,
toNonEmptyString: input.toNonEmptyString,
appendItem: input.appendItem,
getSession: input.getSession,
persistSession: input.persistSession,
cloneConversation: input.cloneConversation,
logEvent: input.logEvent,
messageIdFactory: input.messageIdFactory
};
}
@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildAssistantAddressRuntimeInput = buildAssistantAddressRuntimeInput;
function buildAssistantAddressRuntimeInput(input) {
return {
featureAssistantAddressQueryV1: input.featureAssistantAddressQueryV1,
sessionId: input.sessionId,
userMessage: input.userMessage,
sessionItems: input.sessionItems,
llmProvider: input.payload.llmProvider,
useMock: Boolean(input.payload.useMock),
featureAddressLlmPredecomposeV1: input.featureAddressLlmPredecomposeV1,
runAddressLlmPreDecompose: input.runAddressLlmPreDecompose,
buildAddressLlmPredecomposeContractV1: input.buildAddressLlmPredecomposeContractV1,
sanitizeAddressMessageForFallback: input.sanitizeAddressMessageForFallback,
toNonEmptyString: input.toNonEmptyString,
resolveAddressFollowupCarryoverContext: input.resolveAddressFollowupCarryoverContext,
resolveAssistantOrchestrationDecision: input.resolveAssistantOrchestrationDecision,
buildAddressDialogContinuationContractV2: input.buildAddressDialogContinuationContractV2,
runtimeAnalysisContextAsOfDate: input.runtimeAnalysisContextAsOfDate,
payloadContextPeriodHint: input.payload?.context?.period_hint,
compactWhitespace: input.compactWhitespace,
runAddressLaneAttempt: input.runAddressLaneAttempt,
isRetryableAddressLimitedResult: input.isRetryableAddressLimitedResult,
finalizeAddressLaneResponse: input.finalizeAddressLaneResponse,
tryHandleLivingChat: input.tryHandleLivingChat,
logEvent: input.logEvent,
nowIso: input.nowIso,
runAddressOrchestrationRuntime: input.runAddressOrchestrationRuntime,
runAddressToolGateRuntime: input.runAddressToolGateRuntime,
runAddressLaneRuntime: input.runAddressLaneRuntime
};
}