ARCH: подключить MCP discovery к runtime meta
This commit is contained in:
+27
-2
@@ -2,7 +2,14 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.buildAssistantAddressOrchestrationRuntime = buildAssistantAddressOrchestrationRuntime;
|
||||
const assistantRoutePolicyRuntimeAdapter_1 = require("./assistantRoutePolicyRuntimeAdapter");
|
||||
const assistantMcpDiscoveryRuntimeEntryPoint_1 = require("./assistantMcpDiscoveryRuntimeEntryPoint");
|
||||
const inventoryLifecycleCueHelpers_1 = require("./inventoryLifecycleCueHelpers");
|
||||
function toRecordObject(value) {
|
||||
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
||||
return null;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function hasSelectedObjectInventorySignal(text) {
|
||||
return /(?:по\s+выбранному\s+объекту|по\s+выбранной\s+позиции|по\s+этой\s+позиции|по\s+этому\s+товару|по\s+ним|selected\s+object)/iu.test(String(text ?? ""));
|
||||
}
|
||||
@@ -141,14 +148,32 @@ async function buildAssistantAddressOrchestrationRuntime(input) {
|
||||
resolveAssistantOrchestrationDecision: input.resolveAssistantOrchestrationDecision
|
||||
});
|
||||
const orchestrationDecision = routePolicyRuntime.orchestrationDecision;
|
||||
const orchestrationContract = toRecordObject(orchestrationDecision.orchestrationContract);
|
||||
const predecomposeContract = toRecordObject(addressPreDecompose.predecomposeContract);
|
||||
const dialogContinuationContract = input.buildAddressDialogContinuationContractV2(input.userMessage, addressInputMessage, carryover, addressPreDecompose);
|
||||
const runDiscoveryEntryPoint = input.runMcpDiscoveryRuntimeEntryPoint ?? assistantMcpDiscoveryRuntimeEntryPoint_1.runAssistantMcpDiscoveryRuntimeEntryPoint;
|
||||
let mcpDiscoveryRuntimeEntryPoint = null;
|
||||
let mcpDiscoveryRuntimeEntryPointError = null;
|
||||
try {
|
||||
mcpDiscoveryRuntimeEntryPoint = (await runDiscoveryEntryPoint({
|
||||
userMessage: input.userMessage,
|
||||
effectiveMessage: addressInputMessage,
|
||||
assistantTurnMeaning: toRecordObject(orchestrationContract?.assistant_turn_meaning),
|
||||
predecomposeContract
|
||||
}));
|
||||
}
|
||||
catch (error) {
|
||||
mcpDiscoveryRuntimeEntryPointError = String(error instanceof Error ? error.message : error ?? "unknown_error").slice(0, 280);
|
||||
}
|
||||
const addressRuntimeMeta = {
|
||||
...addressPreDecompose,
|
||||
toolGateDecision: orchestrationDecision.toolGateDecision ?? null,
|
||||
toolGateReason: orchestrationDecision.toolGateReason ?? null,
|
||||
dialogContinuationContract,
|
||||
orchestrationContract: orchestrationDecision.orchestrationContract ?? null,
|
||||
routePolicyContract: routePolicyRuntime.routePolicyContract
|
||||
orchestrationContract: orchestrationContract ?? null,
|
||||
routePolicyContract: routePolicyRuntime.routePolicyContract,
|
||||
mcpDiscoveryRuntimeEntryPoint,
|
||||
mcpDiscoveryRuntimeEntryPointError
|
||||
};
|
||||
return {
|
||||
addressPreDecompose,
|
||||
|
||||
Reference in New Issue
Block a user