ARCH: добавить двусторонний MCP discovery для нетто-потока

This commit is contained in:
2026-04-20 19:11:22 +03:00
parent 52da709671
commit 99a568241d
39 changed files with 7979 additions and 67 deletions
@@ -1,6 +1,7 @@
// @ts-nocheck
import {
resolveAssistantOrganizationAuthority
resolveAssistantOrganizationAuthority,
resolveOrganizationClarificationContinuation
} from "./assistantContinuityPolicy";
const ADDRESS_INTENTS_KEEP_ADDRESS_LANE = new Set([
@@ -409,17 +410,22 @@ export function createAssistantRoutePolicy(deps) {
continuitySnapshot.lastGroundedAddressDebug;
const lastOrganizationClarificationDebug = findLastOrganizationClarificationAddressDebug(sessionItems);
const organizationClarificationCandidates = organizationAuthority.organizationClarificationCandidates;
const organizationClarificationSelectionFromScope = organizationAuthority.organizationClarificationSelectionFromScope;
const explicitOrganizationClarificationSelection = resolveOrganizationSelectionFromMessage(rawUserMessage, organizationClarificationCandidates) ??
resolveOrganizationSelectionFromMessage(repairedRawUserMessage, organizationClarificationCandidates) ??
resolveOrganizationSelectionFromMessage(effectiveAddressUserMessage, organizationClarificationCandidates) ??
resolveOrganizationSelectionFromMessage(repairedEffectiveAddressUserMessage, organizationClarificationCandidates) ??
null;
const organizationClarificationSelection = explicitOrganizationClarificationSelection ??
(organizationClarificationSelectionFromScope &&
organizationClarificationCandidates.some((candidate) => normalizeOrganizationScopeValue(candidate) === organizationClarificationSelectionFromScope)
? organizationClarificationSelectionFromScope
: null);
const organizationClarificationContinuation = resolveOrganizationClarificationContinuation({
rawMessages: [
rawUserMessage,
repairedRawUserMessage,
effectiveAddressUserMessage,
repairedEffectiveAddressUserMessage
],
organizationClarificationCandidates,
organizationClarificationSelectionFromScope: organizationAuthority.organizationClarificationSelectionFromScope,
lastOrganizationClarificationDebug,
resolveOrganizationSelectionFromMessage,
toNonEmptyString,
normalizeOrganizationScopeValue
});
const explicitOrganizationClarificationSelection = organizationClarificationContinuation.explicitSelection;
const organizationClarificationSelection = organizationClarificationContinuation.selection;
const metaSignals = resolveMetaSignalSet({
rawUserMessage,
repairedRawUserMessage,