ARCH: добавить runtime authority смысла текущей реплики

This commit is contained in:
2026-04-19 21:02:10 +03:00
parent 4e7974acc7
commit 153de1af7f
14 changed files with 643 additions and 18 deletions
@@ -222,7 +222,8 @@ export function createAssistantRoutePolicy(deps) {
compactWhitespace,
hasDeepSessionContinuationSignal,
resolveLivingAssistantModeDecision,
resolveProviderExecutionState
resolveProviderExecutionState,
resolveAssistantTurnMeaning
} = deps;
function resolveBaseAddressToolGateDecision(addressInputMessage, followupContext, llmPreDecomposeMeta = null, rawUserMessage = null) {
const repairedInputMessage = repairAddressMojibake(String(addressInputMessage ?? ""));
@@ -455,8 +456,32 @@ export function createAssistantRoutePolicy(deps) {
const resolvedModeDetection = modeDetection.mode === "address_query" ? modeDetection : modeDetectionRaw;
const intentResolution = resolveAddressIntent(modeSample);
const intentResolutionRaw = resolveAddressIntent(repairedRawUserMessage || rawUserMessage);
const resolvedIntentResolution = intentResolution.intent !== "unknown" ? intentResolution : intentResolutionRaw;
const llmContractIntent = toNonEmptyString(llmPreDecomposeMeta?.predecomposeContract?.intent);
const assistantTurnMeaning =
typeof resolveAssistantTurnMeaning === "function"
? resolveAssistantTurnMeaning({
rawUserMessage,
effectiveAddressUserMessage,
repairedRawUserMessage,
repairedEffectiveAddressUserMessage,
llmPreDecomposeMeta
})
: null;
const turnMeaningIntentCandidate = toNonEmptyString(assistantTurnMeaning?.explicit_intent_candidate);
const baseResolvedIntentResolution = intentResolution.intent !== "unknown" ? intentResolution : intentResolutionRaw;
const resolvedIntentResolution =
turnMeaningIntentCandidate &&
baseResolvedIntentResolution.intent === "unknown" &&
ADDRESS_INTENTS_KEEP_ADDRESS_LANE.has(turnMeaningIntentCandidate)
? {
intent: turnMeaningIntentCandidate,
confidence: assistantTurnMeaning?.meaning_confidence === "high" ? "high" : "medium",
reasons: [
"assistant_turn_meaning_intent_recovery",
...(Array.isArray(assistantTurnMeaning?.reason_codes) ? assistantTurnMeaning.reason_codes : [])
]
}
: baseResolvedIntentResolution;
const llmPreDecomposeReason = toNonEmptyString(llmPreDecomposeMeta?.reason);
const providerExecution = resolveProviderExecutionState({
useMock,
@@ -1178,6 +1203,7 @@ export function createAssistantRoutePolicy(deps) {
schema_version: "assistant_orchestration_contract_v1",
hard_meta_mode: null,
provider_execution: providerExecution,
assistant_turn_meaning: assistantTurnMeaning,
address_mode: resolvedModeDetection.mode,
address_mode_confidence: resolvedModeDetection.confidence,
address_intent: resolvedIntentResolution.intent,