Архитектура: вернуть company activity assessment в address lane и убрать ложный organization anchor из root-scoped carryover
This commit is contained in:
@@ -114,11 +114,19 @@ function hasUnicodeCounterpartyActivityLifecycleSignal(text: string): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
const hasActivityAssessmentCue =
|
||||
/(?:\u043a\u0430\u043a\s+[\p{L}\d_-]+\s+\u043e\u0446\u0435\u043d(?:\u0438\u0448\u044c|\u0438\u0442\u044c|\u0438\u0432\u0430\u0435\u0448\u044c)|\u043e\u0446\u0435\u043d(?:\u0438\u0442\u044c|\u043a\u0430)|\u043e\u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437(?:\u0443\u0435\u0448\u044c|\u043e\u0432\u0430\u0442\u044c)|\u0447\u0442\u043e\s+\u043c\u043e\u0436\u043d\u043e\s+\u0441\u043a\u0430\u0437\u0430\u0442\u044c\s+\u043e)/iu.test(
|
||||
normalized
|
||||
) &&
|
||||
/(?:\u0434\u0435\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442|\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442|\u0440\u0430\u0431\u043e\u0442)/iu.test(
|
||||
normalized
|
||||
);
|
||||
|
||||
const hasActivityAgeCue =
|
||||
/(?:\u0441\u043a\u043e\u043b\u044c\u043a\u043e\s+\u043b\u0435\u0442\s+\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438|\u0441\u043a\u043e\u043b\u044c\u043a\u043e\s+\u043b\u0435\u0442\s+\u0432\s+\u0431\u0430\u0437\u0435|\u0432\u043e\u0437\u0440\u0430\u0441\u0442\s+\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438|\u043f\u0435\u0440\u0432(?:\u0430\u044f|\u044b\u0439|\u043e\u0435)\s+(?:\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c|\u043f\u043b\u0430\u0442\u0435\u0436|\u043f\u043e\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435|\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442)|\u043f\u043e\u0441\u043b\u0435\u0434\u043d(?:\u044f\u044f|\u0438\u0439|\u0435\u0435)\s+\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c|\u0441\s+\u043a\u0430\u043a\u043e\u0433\u043e\s+\u0433\u043e\u0434\u0430\s+\u0430\u043a\u0442\u0438\u0432)/iu.test(
|
||||
normalized
|
||||
);
|
||||
if (!hasActivityAgeCue) {
|
||||
if (!hasActivityAgeCue && !hasActivityAssessmentCue) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -760,6 +760,20 @@ export function createAssistantRoutePolicy(deps) {
|
||||
let runAddressLane = Boolean(baseToolGate?.runAddressLane);
|
||||
let toolGateDecision = String(baseToolGate?.decision ?? "skip_address_lane");
|
||||
let toolGateReason = String(baseToolGate?.reason ?? "no_address_signal_after_l0");
|
||||
const semanticAddressLaneRecovery = Boolean(!runAddressLane &&
|
||||
supportedAddressRouteCandidateDetected &&
|
||||
!deepAnalysisPreferenceDetected &&
|
||||
!unsupportedAddressIntentFallbackToDeep &&
|
||||
!deepAnalysisSignalFallbackToDeep &&
|
||||
!aggregateAnalyticsFallbackToDeep &&
|
||||
!deepSessionContinuationFallbackToDeep);
|
||||
if (semanticAddressLaneRecovery) {
|
||||
runAddressLane = true;
|
||||
toolGateDecision = "run_address_lane";
|
||||
toolGateReason = resolvedIntentResolution.intent !== "unknown" || llmContractIntent
|
||||
? "address_intent_resolver_detected"
|
||||
: "address_signal_detected";
|
||||
}
|
||||
if (unsupportedAddressIntentFallbackToDeep) {
|
||||
runAddressLane = false;
|
||||
toolGateDecision = "skip_address_lane";
|
||||
|
||||
@@ -26,6 +26,7 @@ import * as assistantBoundaryPolicy_1 from "./assistantBoundaryPolicy";
|
||||
import * as assistantLivingModePolicy_1 from "./assistantLivingModePolicy";
|
||||
import * as assistantMetaFollowupPolicy_1 from "./assistantMetaFollowupPolicy";
|
||||
import * as assistantMemoryRecapPolicy_1 from "./assistantMemoryRecapPolicy";
|
||||
import * as assistantContinuityPolicy_1 from "./assistantContinuityPolicy";
|
||||
import * as assistantProviderExecutionPolicy_1 from "./assistantProviderExecutionPolicy";
|
||||
import * as assistantRoutePolicy_1 from "./assistantRoutePolicy";
|
||||
import * as assistantTransitionPolicy_1 from "./assistantTransitionPolicy";
|
||||
@@ -2467,18 +2468,12 @@ function buildAddressFollowupOffer(addressDebug) {
|
||||
if (!Array.isArray(suggestedIntents) || suggestedIntents.length === 0) {
|
||||
return null;
|
||||
}
|
||||
const anchorType = toNonEmptyString(addressDebug.anchor_type);
|
||||
const anchorValue = toNonEmptyString(addressDebug.anchor_value_resolved) ??
|
||||
toNonEmptyString(addressDebug.anchor_value_raw) ??
|
||||
readAddressInventoryItemFilter(addressDebug) ??
|
||||
readAddressFilterString(addressDebug, "counterparty") ??
|
||||
readAddressFilterString(addressDebug, "contract") ??
|
||||
readAddressFilterString(addressDebug, "account");
|
||||
const anchorContext = (0, assistantContinuityPolicy_1.resolveAddressDebugAnchorContext)(addressDebug, toNonEmptyString);
|
||||
return {
|
||||
enabled: true,
|
||||
source_intent: intent,
|
||||
anchor_type: anchorType ?? "unknown",
|
||||
anchor_value: anchorValue,
|
||||
anchor_type: anchorContext.anchorType ?? "unknown",
|
||||
anchor_value: anchorContext.anchorValue,
|
||||
suggested_intents: suggestedIntents
|
||||
};
|
||||
}
|
||||
|
||||
@@ -431,11 +431,13 @@ export function createAssistantTransitionPolicy(deps) {
|
||||
const organizationClarificationCandidates = Array.isArray(organizationAuthority.organizationClarificationCandidates)
|
||||
? organizationAuthority.organizationClarificationCandidates
|
||||
: [];
|
||||
const organizationClarificationSelection =
|
||||
const explicitOrganizationClarificationSelection =
|
||||
deps.resolveOrganizationSelectionFromMessage(userMessage, organizationClarificationCandidates) ??
|
||||
(deps.toNonEmptyString(alternateMessage)
|
||||
? deps.resolveOrganizationSelectionFromMessage(String(alternateMessage ?? ""), organizationClarificationCandidates)
|
||||
: null) ??
|
||||
: null);
|
||||
const organizationClarificationSelection =
|
||||
explicitOrganizationClarificationSelection ??
|
||||
deps.normalizeOrganizationScopeValue(organizationAuthority.organizationClarificationSelectionFromScope);
|
||||
const hasOrganizationClarificationContinuation = Boolean(
|
||||
lastOrganizationClarificationDebug && organizationClarificationSelection
|
||||
@@ -979,9 +981,9 @@ export function createAssistantTransitionPolicy(deps) {
|
||||
previousAnchor = selectedObjectLabel;
|
||||
}
|
||||
}
|
||||
if (organizationClarificationSelection && !previousAnchor) {
|
||||
if (explicitOrganizationClarificationSelection && !previousAnchor) {
|
||||
previousAnchorType = "organization";
|
||||
previousAnchor = organizationClarificationSelection;
|
||||
previousAnchor = explicitOrganizationClarificationSelection;
|
||||
}
|
||||
if (
|
||||
inventoryRootFrame &&
|
||||
|
||||
Reference in New Issue
Block a user