ARCH: замкнуть grounded entity follow-up на документы и денежный поток
This commit is contained in:
@@ -1694,26 +1694,38 @@ function buildLifecycleConfirmedFacts(result: AddressMcpQueryExecutorResult, cou
|
||||
];
|
||||
}
|
||||
|
||||
function buildDocumentConfirmedFacts(result: AddressMcpQueryExecutorResult, counterparty: string | null): string[] {
|
||||
if (result.error || result.matched_rows <= 0) {
|
||||
return [];
|
||||
}
|
||||
return [
|
||||
counterparty
|
||||
? `1C document rows were found for counterparty ${counterparty}`
|
||||
: "1C document rows were found for the requested scope"
|
||||
];
|
||||
function checkedCounterpartySuffixRu(counterparty: string | null): string {
|
||||
return counterparty ? ` по контрагенту ${counterparty}` : "";
|
||||
}
|
||||
|
||||
function buildMovementConfirmedFacts(result: AddressMcpQueryExecutorResult, counterparty: string | null): string[] {
|
||||
function checkedPeriodSuffixRu(periodScope: string | null): string {
|
||||
return periodScope ? ` за ${periodScope}` : " в проверенном окне";
|
||||
}
|
||||
|
||||
function uncheckedPeriodBoundaryRu(periodScope: string | null): string {
|
||||
return periodScope ? ` вне периода ${periodScope}` : " без явно проверенного периода";
|
||||
}
|
||||
|
||||
function buildDocumentConfirmedFacts(
|
||||
result: AddressMcpQueryExecutorResult,
|
||||
counterparty: string | null,
|
||||
periodScope: string | null
|
||||
): string[] {
|
||||
if (result.error || result.matched_rows <= 0) {
|
||||
return [];
|
||||
}
|
||||
return [
|
||||
counterparty
|
||||
? `1C movement rows were found for counterparty ${counterparty}`
|
||||
: "1C movement rows were found for the requested scope"
|
||||
];
|
||||
return [`В 1С найдены строки документов${checkedCounterpartySuffixRu(counterparty)}${checkedPeriodSuffixRu(periodScope)}.`];
|
||||
}
|
||||
|
||||
function buildMovementConfirmedFacts(
|
||||
result: AddressMcpQueryExecutorResult,
|
||||
counterparty: string | null,
|
||||
periodScope: string | null
|
||||
): string[] {
|
||||
if (result.error || result.matched_rows <= 0) {
|
||||
return [];
|
||||
}
|
||||
return [`В 1С найдены строки движений${checkedCounterpartySuffixRu(counterparty)}${checkedPeriodSuffixRu(periodScope)}.`];
|
||||
}
|
||||
|
||||
function buildValueFlowConfirmedFacts(
|
||||
@@ -1763,18 +1775,40 @@ function buildLifecycleInferredFacts(result: AddressMcpQueryExecutorResult): str
|
||||
return ["Business activity duration may be inferred from first and latest confirmed 1C activity rows"];
|
||||
}
|
||||
|
||||
function buildDocumentInferredFacts(result: AddressMcpQueryExecutorResult): string[] {
|
||||
function buildDocumentInferredFacts(
|
||||
result: AddressMcpQueryExecutorResult,
|
||||
counterparty: string | null,
|
||||
periodScope: string | null
|
||||
): string[] {
|
||||
if (result.error || result.fetched_rows <= 0) {
|
||||
return [];
|
||||
}
|
||||
return ["Counterparty document evidence is limited to confirmed 1C document rows in the checked scope"];
|
||||
if (result.matched_rows <= 0) {
|
||||
return [
|
||||
`По документам${checkedCounterpartySuffixRu(counterparty)}${checkedPeriodSuffixRu(periodScope)} удалось проверить только ограниченный срез 1С; подтвержденных строк документов этим поиском не найдено.`
|
||||
];
|
||||
}
|
||||
return [
|
||||
`Срез документов${checkedCounterpartySuffixRu(counterparty)}${checkedPeriodSuffixRu(periodScope)} ограничен только подтвержденными строками документов, найденными этим поиском.`
|
||||
];
|
||||
}
|
||||
|
||||
function buildMovementInferredFacts(result: AddressMcpQueryExecutorResult): string[] {
|
||||
function buildMovementInferredFacts(
|
||||
result: AddressMcpQueryExecutorResult,
|
||||
counterparty: string | null,
|
||||
periodScope: string | null
|
||||
): string[] {
|
||||
if (result.error || result.fetched_rows <= 0) {
|
||||
return [];
|
||||
}
|
||||
return ["Counterparty movement evidence is limited to confirmed 1C movement rows in the checked scope"];
|
||||
if (result.matched_rows <= 0) {
|
||||
return [
|
||||
`По движениям${checkedCounterpartySuffixRu(counterparty)}${checkedPeriodSuffixRu(periodScope)} удалось проверить только ограниченный срез 1С; подтвержденных строк движений этим поиском не найдено.`
|
||||
];
|
||||
}
|
||||
return [
|
||||
`Срез движений${checkedCounterpartySuffixRu(counterparty)}${checkedPeriodSuffixRu(periodScope)} ограничен только подтвержденными строками движений, найденными этим поиском.`
|
||||
];
|
||||
}
|
||||
|
||||
function buildValueFlowInferredFacts(derived: AssistantMcpDiscoveryDerivedValueFlow | null): string[] {
|
||||
@@ -1820,19 +1854,15 @@ function buildLifecycleUnknownFacts(): string[] {
|
||||
return ["Legal registration date is not proven by this MCP discovery pilot"];
|
||||
}
|
||||
|
||||
function buildDocumentUnknownFacts(periodScope: string | null): string[] {
|
||||
function buildDocumentUnknownFacts(periodScope: string | null, counterparty: string | null): string[] {
|
||||
return [
|
||||
periodScope
|
||||
? "Full document history outside the checked period is not proven by this MCP discovery pilot"
|
||||
: "Full document history is not proven without an explicit checked period"
|
||||
`Полный исторический срез документов${checkedCounterpartySuffixRu(counterparty)}${uncheckedPeriodBoundaryRu(periodScope)} этим поиском не подтвержден.`
|
||||
];
|
||||
}
|
||||
|
||||
function buildMovementUnknownFacts(periodScope: string | null): string[] {
|
||||
function buildMovementUnknownFacts(periodScope: string | null, counterparty: string | null): string[] {
|
||||
return [
|
||||
periodScope
|
||||
? "Full movement history outside the checked period is not proven by this MCP discovery pilot"
|
||||
: "Full movement history is not proven without an explicit checked period"
|
||||
`Полный исторический срез движений${checkedCounterpartySuffixRu(counterparty)}${uncheckedPeriodBoundaryRu(periodScope)} этим поиском не подтвержден.`
|
||||
];
|
||||
}
|
||||
|
||||
@@ -2245,9 +2275,9 @@ export async function executeAssistantMcpDiscoveryPilot(
|
||||
const evidence = resolveAssistantMcpDiscoveryEvidence({
|
||||
plan: planner.discovery_plan,
|
||||
probeResults,
|
||||
confirmedFacts: queryResult ? buildDocumentConfirmedFacts(queryResult, counterparty) : [],
|
||||
inferredFacts: queryResult ? buildDocumentInferredFacts(queryResult) : [],
|
||||
unknownFacts: buildDocumentUnknownFacts(dateScope),
|
||||
confirmedFacts: queryResult ? buildDocumentConfirmedFacts(queryResult, counterparty, dateScope) : [],
|
||||
inferredFacts: queryResult ? buildDocumentInferredFacts(queryResult, counterparty, dateScope) : [],
|
||||
unknownFacts: buildDocumentUnknownFacts(dateScope, counterparty),
|
||||
sourceRowsSummary,
|
||||
queryLimitations,
|
||||
recommendedNextProbe: "explain_evidence_basis"
|
||||
@@ -2330,9 +2360,9 @@ export async function executeAssistantMcpDiscoveryPilot(
|
||||
const evidence = resolveAssistantMcpDiscoveryEvidence({
|
||||
plan: planner.discovery_plan,
|
||||
probeResults,
|
||||
confirmedFacts: queryResult ? buildMovementConfirmedFacts(queryResult, counterparty) : [],
|
||||
inferredFacts: queryResult ? buildMovementInferredFacts(queryResult) : [],
|
||||
unknownFacts: buildMovementUnknownFacts(dateScope),
|
||||
confirmedFacts: queryResult ? buildMovementConfirmedFacts(queryResult, counterparty, dateScope) : [],
|
||||
inferredFacts: queryResult ? buildMovementInferredFacts(queryResult, counterparty, dateScope) : [],
|
||||
unknownFacts: buildMovementUnknownFacts(dateScope, counterparty),
|
||||
sourceRowsSummary,
|
||||
queryLimitations,
|
||||
recommendedNextProbe: "explain_evidence_basis"
|
||||
|
||||
Reference in New Issue
Block a user