Закрепить широкий phase12 agent replay

This commit is contained in:
2026-06-02 10:02:12 +03:00
parent b52279d19e
commit 7995980215
8 changed files with 435 additions and 10 deletions
@@ -407,6 +407,17 @@ exports.ROOT_EXACT_CAPABILITY_CONTRACTS = [
resultShape: "open_contracts_snapshot",
answerObjectShape: "open_contracts_snapshot"
}),
rootExactCapability({
capability_id: "address_open_items_by_counterparty_or_contract",
domainId: "contracts",
intent_ids: ["open_items_by_counterparty_or_contract"],
transitions: ["T1", "T2", "T6", "T7"],
requiredAnchors: [],
optionalAnchors: ["organization", "date_scope", "account", "counterparty", "contract"],
resultShape: "open_items_by_account_counterparty_or_contract",
answerObjectShape: "open_items_snapshot",
scenarioFamilies: ["canonical", "colloquial", "account_scope", "exact_negative_answer"]
}),
rootExactCapability({
capability_id: "confirmed_vat_payable_as_of_date",
domainId: "vat",
@@ -33,6 +33,28 @@ function createAssistantTransitionPolicy(deps) {
.some((normalized) => normalized &&
/(?:\b(?:same|this|that)\s+period\b|(?:за|на)\s+(?:этот|тот|такой\s+же|тот\s+же)\s+период|(?:Р·Р°|РЅР°)\s+(?:этот|тот|такой\s+Р¶Рµ|тот\s+Р¶Рµ)\s+период)/iu.test(normalized));
}
function hasExplicitDateScopeSignal(...values) {
return values
.map((value) => normalizeFollowupText(value))
.some((normalized) => {
if (!normalized) {
return false;
}
return /(?:\b(?:19|20)\d{2}\b|\b\d{1,2}[./-]\d{1,2}[./-]\d{2,4}\b|\b\d{4}[./-]\d{1,2}[./-]\d{1,2}\b|за\s+(?:период|месяц|год|квартал)|на\s+(?:дат|конец|сегодня)|январ|феврал|март|апрел|ма(?:й|я|е)|июн|июл|август|сентябр|октябр|ноябр|декабр|same\s+period|this\s+period|that\s+period)/iu.test(normalized);
});
}
function shouldClearStaleDateScopeForCounterpartyDocsRoot(targetIntent, sourceIntentHint, userMessage, alternateMessage) {
if (targetIntent !== "list_documents_by_counterparty") {
return false;
}
if (sourceIntentHint === "list_documents_by_counterparty" || sourceIntentHint === "list_documents_by_contract") {
return false;
}
if (hasSamePeriodReferenceCue(userMessage, alternateMessage) || hasExplicitDateScopeSignal(userMessage, alternateMessage)) {
return false;
}
return true;
}
function hasBankOperationsPivotCue(text) {
const normalized = normalizeFollowupText(text);
if (!normalized) {
@@ -1224,6 +1246,18 @@ function createAssistantTransitionPolicy(deps) {
if (!previousIntent && !previousAnchor && Object.keys(previousFilters).length === 0) {
return null;
}
const predecomposeIntent = deps.toNonEmptyString(llmPreDecomposeMeta?.predecomposeContract?.intent);
const carryoverTargetIntentPreview = explicitIntent ?? predecomposeIntent ?? previousIntent;
if (shouldClearStaleDateScopeForCounterpartyDocsRoot(carryoverTargetIntentPreview, sourceIntentHint, userMessage, alternateMessage)) {
delete previousFilters.as_of_date;
delete previousFilters.period_from;
delete previousFilters.period_to;
delete previousFilters.purchase_date_bridge_selected;
delete previousFilters.purchase_date_bridge_first;
delete previousFilters.purchase_date_bridge_last;
delete previousFilters.purchase_date_bridge_basis;
delete previousFilters.purchase_date_bridge_has_multiple;
}
const shouldAttachInventoryRootFrame = Boolean(inventoryRootFrame &&
(rootScopedPivot ||
deps.isInventoryRootFrameIntent(sourceIntentHint) ||
@@ -1238,7 +1272,6 @@ function createAssistantTransitionPolicy(deps) {
hasSelectedObjectInventorySignalPrimary ||
hasSelectedObjectInventorySignalAlternate));
const previousHasPeriodWindow = Boolean(deps.toNonEmptyString(previousFilters.period_from) || deps.toNonEmptyString(previousFilters.period_to));
const predecomposeIntent = deps.toNonEmptyString(llmPreDecomposeMeta?.predecomposeContract?.intent);
const shouldRetargetVatSamePeriod = previousHasPeriodWindow &&
hasSamePeriodReferenceCue(userMessage, alternateMessage) &&
(explicitIntent === "vat_payable_confirmed_as_of_date" ||