Open-World: добавить контрагентский и договорной профиль в бизнес-обзор
This commit is contained in:
+45
-4
@@ -402,6 +402,12 @@ function headlineFor(mode, pilot) {
|
||||
if (overview.document_activity_profile) {
|
||||
families.push("профиль типов документов и разделов учета");
|
||||
}
|
||||
if (overview.counterparty_profile) {
|
||||
families.push("профиль контрагентской базы");
|
||||
}
|
||||
if (overview.contract_usage_profile) {
|
||||
families.push("договорной профиль");
|
||||
}
|
||||
if (overview.tax_position) {
|
||||
families.push("НДС-позиция");
|
||||
}
|
||||
@@ -625,6 +631,7 @@ function buildMustNotClaim(pilot) {
|
||||
claims.push("Do not present business overview trading-margin proxy as clean profit, accounting financial result, or exact cost-of-sales margin.");
|
||||
claims.push("Do not present business overview supplier concentration as vendor-risk audit, procurement quality, or full expense structure.");
|
||||
claims.push("Do not present business overview document/account-section activity profile as process quality, accounting correctness, or completeness of all 1C activity.");
|
||||
claims.push("Do not present business overview counterparty or contract profile as CRM quality, counterparty due diligence, contract-risk audit, or legal completeness.");
|
||||
claims.push("Do not claim debt quality, VAT position, inventory health, or company health unless those contours were separately checked.");
|
||||
claims.push("Do not present a debt-position snapshot as debt aging, overdue debt, or credit-quality analysis.");
|
||||
claims.push("Do not present open-settlement concentration as contractual due-date aging or confirmed overdue debt.");
|
||||
@@ -998,6 +1005,21 @@ function derivedBusinessOverviewConfirmedLines(pilot) {
|
||||
lines.push(`Профиль операционной активности${organization}${period}: ${parts.join("; ")}. Это activity mix по найденным строкам 1С, а не аудит качества учета или полноты процессов.`);
|
||||
}
|
||||
}
|
||||
if (overview.counterparty_profile) {
|
||||
const profile = overview.counterparty_profile;
|
||||
const totalText = profile.total_counterparties === null
|
||||
? `${profile.active_counterparties} активных контрагентов`
|
||||
: `${profile.total_counterparties} контрагентов в базе, ${profile.active_counterparties} активных по документальной активности`;
|
||||
lines.push(`Профиль контрагентской базы${organization}${period}: ${totalText}; заказчики ${profile.customer_only_count}, поставщики ${profile.supplier_only_count}, смешанная роль ${profile.mixed_role_count}. Это не CRM-аудит, не юридическая проверка контрагентов и не оценка качества клиентской базы.`);
|
||||
}
|
||||
if (overview.contract_usage_profile) {
|
||||
const profile = overview.contract_usage_profile;
|
||||
const totalText = profile.total_contracts === null
|
||||
? `${profile.used_contracts} договоров с подтвержденной связью с операциями`
|
||||
: `${profile.used_contracts} из ${profile.total_contracts} договоров используются${profile.used_contract_share_pct === null ? "" : ` (${profile.used_contract_share_pct}%)`}`;
|
||||
const unusedText = profile.unused_contracts === null ? "" : `, неиспользуемых ${profile.unused_contracts}`;
|
||||
lines.push(`Договорной профиль${organization}${period}: ${totalText}${unusedText}. Это не contract-risk аудит, не проверка актуальности условий и не доказательство качества договорной базы.`);
|
||||
}
|
||||
if (overview.tax_position) {
|
||||
const taxDirection = overview.tax_position.net_vat_direction === "vat_to_pay"
|
||||
? "к уплате"
|
||||
@@ -1170,6 +1192,19 @@ function businessOverviewRiskSynthesisLine(overview) {
|
||||
signals.push(`операционный activity mix: ${parts.join(", ")}`);
|
||||
}
|
||||
}
|
||||
if (overview.counterparty_profile) {
|
||||
const totalText = overview.counterparty_profile.total_counterparties === null
|
||||
? `${overview.counterparty_profile.active_counterparties} активных контрагентов`
|
||||
: `${overview.counterparty_profile.total_counterparties} контрагентов, активных ${overview.counterparty_profile.active_counterparties}`;
|
||||
signals.push(`контрагентская база: ${totalText}`);
|
||||
}
|
||||
if (overview.contract_usage_profile) {
|
||||
const profile = overview.contract_usage_profile;
|
||||
const totalText = profile.total_contracts === null
|
||||
? `${profile.used_contracts} используемых договоров`
|
||||
: `${profile.used_contracts}/${profile.total_contracts} договоров используются${profile.used_contract_share_pct === null ? "" : ` (${profile.used_contract_share_pct}%)`}`;
|
||||
signals.push(`договорной профиль: ${totalText}`);
|
||||
}
|
||||
if (overview.inventory_position) {
|
||||
signals.push(`складской остаток на дату ${overview.inventory_position.total_amount_human_ru}`);
|
||||
if (overview.inventory_position.aging_signal?.max_age_days !== null && overview.inventory_position.aging_signal?.max_age_days !== undefined) {
|
||||
@@ -1199,8 +1234,8 @@ function businessOverviewExecutiveVerdictLine(overview) {
|
||||
overview.inventory_position ||
|
||||
overview.inventory_turnover_proxy ||
|
||||
overview.inventory_staleness_risk_proxy);
|
||||
const hasDocumentActivitySignal = Boolean(overview.document_activity_profile);
|
||||
const hasExtraSignals = hasTaxDebtInventorySignals || hasDocumentActivitySignal;
|
||||
const hasOperationalProfileSignal = Boolean(overview.document_activity_profile || overview.counterparty_profile || overview.contract_usage_profile);
|
||||
const hasExtraSignals = hasTaxDebtInventorySignals || hasOperationalProfileSignal;
|
||||
if (!hasCash && !hasExtraSignals) {
|
||||
return null;
|
||||
}
|
||||
@@ -1211,8 +1246,8 @@ function businessOverviewExecutiveVerdictLine(overview) {
|
||||
: "операционный поток выглядит сбалансированным";
|
||||
const evidenceTone = hasTaxDebtInventorySignals
|
||||
? "часть налоговых, долговых или складских контуров уже отдельно проверена"
|
||||
: hasDocumentActivitySignal
|
||||
? "операционный activity mix по типам документов и разделам учета уже отдельно проверен"
|
||||
: hasOperationalProfileSignal
|
||||
? "операционные профили по документам, контрагентам или договорам уже отдельно проверены"
|
||||
: "налоги, долги и склад еще не дают проверенного управленческого контекста";
|
||||
return `Сводный LLM-аудит по подтвержденному: ${cashTone}; ${evidenceTone}. Это полезный управленческий срез по найденным строкам 1С, но не финальный вывод о прибыльности, марже или здоровье компании.`;
|
||||
}
|
||||
@@ -1290,6 +1325,12 @@ function buildAssistantMcpDiscoveryAnswerDraft(pilot) {
|
||||
if (pilot.derived_business_overview?.document_activity_profile) {
|
||||
pushReason(reasonCodes, "answer_contains_business_overview_document_activity_profile");
|
||||
}
|
||||
if (pilot.derived_business_overview?.counterparty_profile) {
|
||||
pushReason(reasonCodes, "answer_contains_business_overview_counterparty_profile");
|
||||
}
|
||||
if (pilot.derived_business_overview?.contract_usage_profile) {
|
||||
pushReason(reasonCodes, "answer_contains_business_overview_contract_usage_profile");
|
||||
}
|
||||
if (pilot.derived_business_overview?.debt_position) {
|
||||
pushReason(reasonCodes, "answer_contains_business_overview_debt_position");
|
||||
}
|
||||
|
||||
+159
-15
@@ -160,7 +160,7 @@ function buildValueFlowFilters(planner) {
|
||||
sort: "period_asc"
|
||||
};
|
||||
}
|
||||
function buildBusinessOverviewDocumentActivityFilters(planner) {
|
||||
function buildBusinessOverviewProfileFilters(planner) {
|
||||
const meaning = planner.discovery_plan.turn_meaning_ref;
|
||||
const organization = toNonEmptyString(meaning?.explicit_organization_scope);
|
||||
const dateScope = toNonEmptyString(meaning?.explicit_date_scope);
|
||||
@@ -1916,6 +1916,64 @@ function deriveBusinessOverviewDocumentActivityProfile(result, periodScope) {
|
||||
inference_basis: "document_type_and_account_section_profile_confirmed_1c_rows"
|
||||
};
|
||||
}
|
||||
function sumBusinessOverviewMarker(result, marker) {
|
||||
return result.rows.reduce((sum, row) => {
|
||||
const currentMarker = normalizeBusinessOverviewActivityMarker(row);
|
||||
if (currentMarker !== marker) {
|
||||
return sum;
|
||||
}
|
||||
const amount = rowAmountValue(row);
|
||||
return amount === null ? sum : sum + amount;
|
||||
}, 0);
|
||||
}
|
||||
function deriveBusinessOverviewCounterpartyProfile(result, periodScope) {
|
||||
if (!result || result.error || result.matched_rows <= 0) {
|
||||
return null;
|
||||
}
|
||||
const totalCounterparties = sumBusinessOverviewMarker(result, "CP_TOTAL");
|
||||
const customerActive = sumBusinessOverviewMarker(result, "CP_CUSTOMER_ACTIVE");
|
||||
const supplierActive = sumBusinessOverviewMarker(result, "CP_SUPPLIER_ACTIVE");
|
||||
const mixedActive = sumBusinessOverviewMarker(result, "CP_MIXED_ACTIVE");
|
||||
const activeUnion = sumBusinessOverviewMarker(result, "CP_ACTIVE_UNION");
|
||||
const customerOnly = Math.max(0, customerActive - mixedActive);
|
||||
const supplierOnly = Math.max(0, supplierActive - mixedActive);
|
||||
const resolvedActive = customerOnly + supplierOnly + mixedActive;
|
||||
const activeCounterparties = Math.max(activeUnion, resolvedActive);
|
||||
if (totalCounterparties <= 0 && activeCounterparties <= 0) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
period_scope: periodScope,
|
||||
rows_matched: result.matched_rows,
|
||||
total_counterparties: totalCounterparties > 0 ? totalCounterparties : null,
|
||||
active_counterparties: activeCounterparties,
|
||||
customer_only_count: customerOnly,
|
||||
supplier_only_count: supplierOnly,
|
||||
mixed_role_count: mixedActive,
|
||||
other_or_inactive_count: totalCounterparties > 0 ? Math.max(0, totalCounterparties - resolvedActive) : null,
|
||||
inference_basis: "counterparty_population_roles_confirmed_1c_rows"
|
||||
};
|
||||
}
|
||||
function deriveBusinessOverviewContractUsageProfile(result, periodScope) {
|
||||
if (!result || result.error || result.matched_rows <= 0) {
|
||||
return null;
|
||||
}
|
||||
const totalContracts = sumBusinessOverviewMarker(result, "CT_TOTAL");
|
||||
const usedContracts = sumBusinessOverviewMarker(result, "CT_USED");
|
||||
if (totalContracts <= 0 && usedContracts <= 0) {
|
||||
return null;
|
||||
}
|
||||
const cappedUsedContracts = totalContracts > 0 ? Math.min(usedContracts, totalContracts) : usedContracts;
|
||||
return {
|
||||
period_scope: periodScope,
|
||||
rows_matched: result.matched_rows,
|
||||
total_contracts: totalContracts > 0 ? totalContracts : null,
|
||||
used_contracts: usedContracts,
|
||||
unused_contracts: totalContracts > 0 ? Math.max(0, totalContracts - cappedUsedContracts) : null,
|
||||
used_contract_share_pct: totalContracts > 0 ? percentageOfTotal(cappedUsedContracts, totalContracts) : null,
|
||||
inference_basis: "contract_usage_overview_confirmed_1c_rows"
|
||||
};
|
||||
}
|
||||
function deriveValueFlow(result, counterparty, periodScope, direction, aggregationAxis) {
|
||||
if (!result || result.error || result.matched_rows <= 0) {
|
||||
return null;
|
||||
@@ -2714,6 +2772,8 @@ function deriveBusinessOverview(input) {
|
||||
debtAsOfDate: input.debtAsOfDate
|
||||
});
|
||||
const documentActivityProfile = deriveBusinessOverviewDocumentActivityProfile(input.documentActivityProfileResult, input.periodScope);
|
||||
const counterpartyProfile = deriveBusinessOverviewCounterpartyProfile(input.counterpartyProfileResult, input.periodScope);
|
||||
const contractUsageProfile = deriveBusinessOverviewContractUsageProfile(input.contractUsageProfileResult, input.periodScope);
|
||||
const debtStalenessRiskProxy = deriveBusinessOverviewDebtStalenessRiskProxy(debtOpenSettlementQuality);
|
||||
const inventoryPosition = deriveBusinessOverviewInventoryPosition({
|
||||
inventoryOnHandResult: input.inventoryOnHandResult,
|
||||
@@ -2738,6 +2798,8 @@ function deriveBusinessOverview(input) {
|
||||
Boolean(debtOpenSettlementQuality),
|
||||
Boolean(debtStalenessRiskProxy),
|
||||
Boolean(documentActivityProfile),
|
||||
Boolean(counterpartyProfile),
|
||||
Boolean(contractUsageProfile),
|
||||
Boolean(inventoryPosition),
|
||||
Boolean(inventoryTurnoverProxy),
|
||||
Boolean(inventoryStalenessRiskProxy)
|
||||
@@ -2746,6 +2808,7 @@ function deriveBusinessOverview(input) {
|
||||
return null;
|
||||
}
|
||||
const netAmount = incoming.total_amount - outgoing.total_amount;
|
||||
const hasBusinessOverviewProfileSignal = Boolean(documentActivityProfile || counterpartyProfile || contractUsageProfile);
|
||||
return {
|
||||
organization_scope: input.organizationScope,
|
||||
period_scope: input.periodScope,
|
||||
@@ -2767,6 +2830,8 @@ function deriveBusinessOverview(input) {
|
||||
inventory_turnover_proxy: inventoryTurnoverProxy,
|
||||
inventory_staleness_risk_proxy: inventoryStalenessRiskProxy,
|
||||
document_activity_profile: documentActivityProfile,
|
||||
counterparty_profile: counterpartyProfile,
|
||||
contract_usage_profile: contractUsageProfile,
|
||||
coverage_limited_by_probe_limit: incoming.coverage_limited_by_probe_limit || outgoing.coverage_limited_by_probe_limit,
|
||||
checked_signal_count: checkedSignalCount,
|
||||
missing_signal_families: [
|
||||
@@ -2783,19 +2848,17 @@ function deriveBusinessOverview(input) {
|
||||
: "inventory_position",
|
||||
inventoryPosition?.aging_signal ? null : "inventory_aging_quality"
|
||||
].filter((item) => Boolean(item)),
|
||||
inference_basis: documentActivityProfile
|
||||
inference_basis: hasBusinessOverviewProfileSignal || inventoryPosition
|
||||
? "business_overview_from_confirmed_1c_multi_family_rows"
|
||||
: inventoryPosition
|
||||
: debtOpenSettlementQuality
|
||||
? "business_overview_from_confirmed_1c_multi_family_rows"
|
||||
: debtOpenSettlementQuality
|
||||
? "business_overview_from_confirmed_1c_multi_family_rows"
|
||||
: taxPosition && debtPosition
|
||||
? "business_overview_from_confirmed_1c_money_activity_tax_and_debt_rows"
|
||||
: taxPosition
|
||||
? "business_overview_from_confirmed_1c_money_activity_and_tax_rows"
|
||||
: debtPosition
|
||||
? "business_overview_from_confirmed_1c_money_activity_and_debt_rows"
|
||||
: "business_overview_from_confirmed_1c_money_and_activity_rows"
|
||||
: taxPosition && debtPosition
|
||||
? "business_overview_from_confirmed_1c_money_activity_tax_and_debt_rows"
|
||||
: taxPosition
|
||||
? "business_overview_from_confirmed_1c_money_activity_and_tax_rows"
|
||||
: debtPosition
|
||||
? "business_overview_from_confirmed_1c_money_activity_and_debt_rows"
|
||||
: "business_overview_from_confirmed_1c_money_and_activity_rows"
|
||||
};
|
||||
}
|
||||
function summarizeBusinessOverviewRows(input) {
|
||||
@@ -2827,6 +2890,12 @@ function summarizeBusinessOverviewRows(input) {
|
||||
if (input.documentActivityProfileResult && !input.documentActivityProfileResult.error) {
|
||||
parts.push(`${input.documentActivityProfileResult.fetched_rows} document/account-section profile rows fetched, ${input.documentActivityProfileResult.matched_rows} matched`);
|
||||
}
|
||||
if (input.counterpartyProfileResult && !input.counterpartyProfileResult.error) {
|
||||
parts.push(`${input.counterpartyProfileResult.fetched_rows} counterparty role-profile rows fetched, ${input.counterpartyProfileResult.matched_rows} matched`);
|
||||
}
|
||||
if (input.contractUsageProfileResult && !input.contractUsageProfileResult.error) {
|
||||
parts.push(`${input.contractUsageProfileResult.fetched_rows} contract-usage profile rows fetched, ${input.contractUsageProfileResult.matched_rows} matched`);
|
||||
}
|
||||
if (input.inventoryOnHandResult && !input.inventoryOnHandResult.error) {
|
||||
parts.push(`${input.inventoryOnHandResult.fetched_rows} inventory on-hand rows fetched, ${input.inventoryOnHandResult.matched_rows} matched`);
|
||||
}
|
||||
@@ -2879,6 +2948,21 @@ function buildBusinessOverviewConfirmedFacts(derived) {
|
||||
facts.push(`Профиль операционной активности${organization}${period} подтвержден по типам документов и разделам учета 1С: ${parts.join("; ")}. Это activity mix, а не аудит качества учета или полноты бизнес-процессов.`);
|
||||
}
|
||||
}
|
||||
if (derived.counterparty_profile) {
|
||||
const profile = derived.counterparty_profile;
|
||||
const totalText = profile.total_counterparties === null
|
||||
? `${profile.active_counterparties} активных контрагентов`
|
||||
: `${profile.total_counterparties} контрагентов в базе, ${profile.active_counterparties} активных по документальной активности`;
|
||||
facts.push(`Профиль контрагентской базы${organization}${period} подтвержден по 1С: ${totalText}; заказчики ${profile.customer_only_count}, поставщики ${profile.supplier_only_count}, смешанная роль ${profile.mixed_role_count}. Это не CRM-аудит, не юридическая проверка контрагентов и не оценка качества клиентской базы.`);
|
||||
}
|
||||
if (derived.contract_usage_profile) {
|
||||
const profile = derived.contract_usage_profile;
|
||||
const totalText = profile.total_contracts === null
|
||||
? `${profile.used_contracts} договоров с подтвержденной связью с операциями`
|
||||
: `${profile.used_contracts} из ${profile.total_contracts} договоров используются${profile.used_contract_share_pct === null ? "" : ` (${profile.used_contract_share_pct}%)`}`;
|
||||
const unusedText = profile.unused_contracts === null ? "" : `, неиспользуемых ${profile.unused_contracts}`;
|
||||
facts.push(`Договорной профиль${organization}${period} подтвержден по 1С: ${totalText}${unusedText}. Это не contract-risk аудит, не проверка актуальности условий и не доказательство качества договорной базы.`);
|
||||
}
|
||||
if (derived.tax_position) {
|
||||
const taxDirection = derived.tax_position.net_vat_direction === "vat_to_pay"
|
||||
? "к уплате"
|
||||
@@ -3643,11 +3727,13 @@ async function executeAssistantMcpDiscoveryPilot(planner, deps = DEFAULT_DEPS) {
|
||||
let payablesResult = null;
|
||||
let openContractsResult = null;
|
||||
let documentActivityProfileResult = null;
|
||||
let counterpartyProfileResult = null;
|
||||
let contractUsageProfileResult = null;
|
||||
let inventoryOnHandResult = null;
|
||||
let inventoryAgingResult = null;
|
||||
const valueFilters = buildValueFlowFilters(planner);
|
||||
const lifecycleFilters = buildLifecycleFilters(planner);
|
||||
const documentActivityFilters = buildBusinessOverviewDocumentActivityFilters(planner);
|
||||
const profileFilters = buildBusinessOverviewProfileFilters(planner);
|
||||
const taxFilters = buildBusinessOverviewTaxFilters(planner);
|
||||
const tradingMarginFilters = buildBusinessOverviewTradingMarginFilters(planner);
|
||||
const debtFilters = buildBusinessOverviewDebtFilters(planner);
|
||||
@@ -3657,7 +3743,9 @@ async function executeAssistantMcpDiscoveryPilot(planner, deps = DEFAULT_DEPS) {
|
||||
const incomingSelection = (0, addressRecipeCatalog_1.selectAddressRecipe)("customer_revenue_and_payments", valueFilters);
|
||||
const outgoingSelection = (0, addressRecipeCatalog_1.selectAddressRecipe)("supplier_payouts_profile", valueFilters);
|
||||
const lifecycleSelection = (0, addressRecipeCatalog_1.selectAddressRecipe)("counterparty_activity_lifecycle", lifecycleFilters);
|
||||
const documentActivitySelection = (0, addressRecipeCatalog_1.selectAddressRecipe)("document_type_and_account_section_profile", documentActivityFilters);
|
||||
const documentActivitySelection = (0, addressRecipeCatalog_1.selectAddressRecipe)("document_type_and_account_section_profile", profileFilters);
|
||||
const counterpartyProfileSelection = (0, addressRecipeCatalog_1.selectAddressRecipe)("counterparty_population_and_roles", profileFilters);
|
||||
const contractUsageSelection = (0, addressRecipeCatalog_1.selectAddressRecipe)("contract_usage_overview", profileFilters);
|
||||
const taxSelection = taxFilters
|
||||
? (0, addressRecipeCatalog_1.selectAddressRecipe)("vat_liability_confirmed_for_tax_period", taxFilters)
|
||||
: null;
|
||||
@@ -3716,6 +3804,20 @@ async function executeAssistantMcpDiscoveryPilot(planner, deps = DEFAULT_DEPS) {
|
||||
pushReason(reasonCodes, "pilot_business_overview_document_activity_profile_recipe_not_available");
|
||||
pushUnique(queryLimitations, "Business overview document/account-section profile requires an executable document-section profile recipe");
|
||||
}
|
||||
if (counterpartyProfileSelection.selected_recipe) {
|
||||
pushReason(reasonCodes, "pilot_business_overview_counterparty_profile_recipe_selected");
|
||||
}
|
||||
else {
|
||||
pushReason(reasonCodes, "pilot_business_overview_counterparty_profile_recipe_not_available");
|
||||
pushUnique(queryLimitations, "Business overview counterparty profile requires an executable counterparty population/roles recipe");
|
||||
}
|
||||
if (contractUsageSelection.selected_recipe) {
|
||||
pushReason(reasonCodes, "pilot_business_overview_contract_usage_profile_recipe_selected");
|
||||
}
|
||||
else {
|
||||
pushReason(reasonCodes, "pilot_business_overview_contract_usage_profile_recipe_not_available");
|
||||
pushUnique(queryLimitations, "Business overview contract usage profile requires an executable contract usage recipe");
|
||||
}
|
||||
if (taxSelection?.selected_recipe) {
|
||||
pushReason(reasonCodes, "pilot_business_overview_tax_recipe_selected");
|
||||
}
|
||||
@@ -3940,7 +4042,7 @@ async function executeAssistantMcpDiscoveryPilot(planner, deps = DEFAULT_DEPS) {
|
||||
probeResults.push(queryResultToProbeResult(step.primitive_id, tradingMarginResult));
|
||||
}
|
||||
if (documentActivitySelection.selected_recipe) {
|
||||
const documentActivityPlan = (0, addressRecipeCatalog_1.buildAddressRecipePlan)(documentActivitySelection.selected_recipe, documentActivityFilters);
|
||||
const documentActivityPlan = (0, addressRecipeCatalog_1.buildAddressRecipePlan)(documentActivitySelection.selected_recipe, profileFilters);
|
||||
documentActivityProfileResult = await runtimeDeps.executeAddressMcpQuery({
|
||||
query: documentActivityPlan.query,
|
||||
limit: documentActivityPlan.limit,
|
||||
@@ -3948,6 +4050,24 @@ async function executeAssistantMcpDiscoveryPilot(planner, deps = DEFAULT_DEPS) {
|
||||
});
|
||||
probeResults.push(queryResultToProbeResult(step.primitive_id, documentActivityProfileResult));
|
||||
}
|
||||
if (counterpartyProfileSelection.selected_recipe) {
|
||||
const counterpartyProfilePlan = (0, addressRecipeCatalog_1.buildAddressRecipePlan)(counterpartyProfileSelection.selected_recipe, profileFilters);
|
||||
counterpartyProfileResult = await runtimeDeps.executeAddressMcpQuery({
|
||||
query: counterpartyProfilePlan.query,
|
||||
limit: counterpartyProfilePlan.limit,
|
||||
account_scope: counterpartyProfilePlan.account_scope
|
||||
});
|
||||
probeResults.push(queryResultToProbeResult(step.primitive_id, counterpartyProfileResult));
|
||||
}
|
||||
if (contractUsageSelection.selected_recipe) {
|
||||
const contractUsagePlan = (0, addressRecipeCatalog_1.buildAddressRecipePlan)(contractUsageSelection.selected_recipe, profileFilters);
|
||||
contractUsageProfileResult = await runtimeDeps.executeAddressMcpQuery({
|
||||
query: contractUsagePlan.query,
|
||||
limit: contractUsagePlan.limit,
|
||||
account_scope: contractUsagePlan.account_scope
|
||||
});
|
||||
probeResults.push(queryResultToProbeResult(step.primitive_id, contractUsageProfileResult));
|
||||
}
|
||||
if (lifecycleResult.error) {
|
||||
pushUnique(queryLimitations, lifecycleResult.error);
|
||||
pushReason(reasonCodes, "pilot_business_overview_query_documents_mcp_error");
|
||||
@@ -3969,6 +4089,20 @@ async function executeAssistantMcpDiscoveryPilot(planner, deps = DEFAULT_DEPS) {
|
||||
else if (documentActivityProfileResult) {
|
||||
pushReason(reasonCodes, "pilot_business_overview_document_activity_profile_query_mcp_executed");
|
||||
}
|
||||
if (counterpartyProfileResult?.error) {
|
||||
pushUnique(queryLimitations, counterpartyProfileResult.error);
|
||||
pushReason(reasonCodes, "pilot_business_overview_counterparty_profile_query_mcp_error");
|
||||
}
|
||||
else if (counterpartyProfileResult) {
|
||||
pushReason(reasonCodes, "pilot_business_overview_counterparty_profile_query_mcp_executed");
|
||||
}
|
||||
if (contractUsageProfileResult?.error) {
|
||||
pushUnique(queryLimitations, contractUsageProfileResult.error);
|
||||
pushReason(reasonCodes, "pilot_business_overview_contract_usage_profile_query_mcp_error");
|
||||
}
|
||||
else if (contractUsageProfileResult) {
|
||||
pushReason(reasonCodes, "pilot_business_overview_contract_usage_profile_query_mcp_executed");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
skippedPrimitives.push(step.primitive_id);
|
||||
@@ -3984,6 +4118,8 @@ async function executeAssistantMcpDiscoveryPilot(planner, deps = DEFAULT_DEPS) {
|
||||
payablesResult,
|
||||
openContractsResult,
|
||||
documentActivityProfileResult,
|
||||
counterpartyProfileResult,
|
||||
contractUsageProfileResult,
|
||||
debtAsOfDate,
|
||||
inventoryOnHandResult,
|
||||
inventoryAgingResult,
|
||||
@@ -4008,6 +4144,12 @@ async function executeAssistantMcpDiscoveryPilot(planner, deps = DEFAULT_DEPS) {
|
||||
if (derivedBusinessOverview.document_activity_profile) {
|
||||
pushReason(reasonCodes, "pilot_derived_business_overview_document_activity_profile_from_confirmed_rows");
|
||||
}
|
||||
if (derivedBusinessOverview.counterparty_profile) {
|
||||
pushReason(reasonCodes, "pilot_derived_business_overview_counterparty_profile_from_confirmed_rows");
|
||||
}
|
||||
if (derivedBusinessOverview.contract_usage_profile) {
|
||||
pushReason(reasonCodes, "pilot_derived_business_overview_contract_usage_profile_from_confirmed_rows");
|
||||
}
|
||||
if (derivedBusinessOverview.tax_position) {
|
||||
pushReason(reasonCodes, "pilot_derived_business_overview_tax_position_from_confirmed_rows");
|
||||
}
|
||||
@@ -4046,6 +4188,8 @@ async function executeAssistantMcpDiscoveryPilot(planner, deps = DEFAULT_DEPS) {
|
||||
payablesResult,
|
||||
openContractsResult,
|
||||
documentActivityProfileResult,
|
||||
counterpartyProfileResult,
|
||||
contractUsageProfileResult,
|
||||
inventoryOnHandResult,
|
||||
inventoryAgingResult
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user