Оформить business_overview как маршрутный контракт Open-World Breadth

This commit is contained in:
2026-05-03 21:30:45 +03:00
parent 284b201912
commit e65b7fdaed
16 changed files with 513 additions and 20 deletions
@@ -20,6 +20,7 @@ export type AssistantMcpCatalogChainTemplateId =
| "value_flow_comparison"
| "value_flow_ranking"
| "lifecycle"
| "business_overview"
| "movement_evidence"
| "document_evidence"
| "entity_resolution";
@@ -110,6 +111,7 @@ const PRIMITIVE_CONTRACTS: AssistantMcpCatalogPrimitiveContract[] = [
"document_evidence",
"movement_evidence",
"activity_lifecycle",
"business_overview",
"inventory_purchase_provenance",
"inventory_sale_trace",
"inventory_supplier_overlap"
@@ -122,6 +124,7 @@ const PRIMITIVE_CONTRACTS: AssistantMcpCatalogPrimitiveContract[] = [
"list_documents",
"list_movements",
"activity_duration",
"broad_evaluation",
"purchase_provenance",
"sale_trace",
"supplier_overlap"
@@ -143,8 +146,22 @@ const PRIMITIVE_CONTRACTS: AssistantMcpCatalogPrimitiveContract[] = [
"collect_outgoing_movements",
"fetch_scoped_movements"
],
supported_fact_families: ["value_flow", "movement_evidence", "inventory_stock_snapshot", "inventory_supplier_overlap"],
supported_action_families: ["turnover", "payout", "net_value_flow", "list_movements", "stock_snapshot", "supplier_overlap"],
supported_fact_families: [
"value_flow",
"movement_evidence",
"business_overview",
"inventory_stock_snapshot",
"inventory_supplier_overlap"
],
supported_action_families: [
"turnover",
"payout",
"net_value_flow",
"list_movements",
"broad_evaluation",
"stock_snapshot",
"supplier_overlap"
],
planning_tags: ["movement", "comparison", "ranking", "aggregation", "monthly_aggregation"],
required_axes_any_of: [
["period", "account"],
@@ -169,11 +186,19 @@ const PRIMITIVE_CONTRACTS: AssistantMcpCatalogPrimitiveContract[] = [
supported_fact_families: [
"document_evidence",
"activity_lifecycle",
"business_overview",
"inventory_purchase_provenance",
"inventory_sale_trace",
"inventory_supplier_overlap"
],
supported_action_families: ["list_documents", "activity_duration", "purchase_provenance", "sale_trace", "supplier_overlap"],
supported_action_families: [
"list_documents",
"activity_duration",
"broad_evaluation",
"purchase_provenance",
"sale_trace",
"supplier_overlap"
],
planning_tags: ["document"],
required_axes_any_of: [
["document"],
@@ -195,8 +220,8 @@ const PRIMITIVE_CONTRACTS: AssistantMcpCatalogPrimitiveContract[] = [
primitive_id: "aggregate_by_axis",
purpose: "Aggregate already-scoped 1C evidence by a business axis such as counterparty, contract, or period.",
decomposition_hints: ["aggregate_checked_amounts", "aggregate_ranked_axis_values", "aggregate_by_month"],
supported_fact_families: ["value_flow", "inventory_stock_snapshot", "inventory_supplier_overlap"],
supported_action_families: ["turnover", "payout", "net_value_flow", "stock_snapshot", "supplier_overlap"],
supported_fact_families: ["value_flow", "business_overview", "inventory_stock_snapshot", "inventory_supplier_overlap"],
supported_action_families: ["turnover", "payout", "net_value_flow", "broad_evaluation", "stock_snapshot", "supplier_overlap"],
planning_tags: ["aggregation", "ranking", "monthly_aggregation"],
required_axes_any_of: [
["aggregate_axis", "period"],
@@ -237,6 +262,7 @@ const PRIMITIVE_CONTRACTS: AssistantMcpCatalogPrimitiveContract[] = [
"document_evidence",
"movement_evidence",
"activity_lifecycle",
"business_overview",
"inventory_stock_snapshot",
"inventory_purchase_provenance",
"inventory_sale_trace",
@@ -255,6 +281,7 @@ const PRIMITIVE_CONTRACTS: AssistantMcpCatalogPrimitiveContract[] = [
"list_documents",
"list_movements",
"activity_duration",
"broad_evaluation",
"stock_snapshot",
"purchase_provenance",
"sale_trace",
@@ -275,6 +302,7 @@ const PRIMITIVE_CONTRACTS: AssistantMcpCatalogPrimitiveContract[] = [
decomposition_hints: ["explain_evidence_basis"],
supported_fact_families: [
"activity_lifecycle",
"business_overview",
"inventory_stock_snapshot",
"inventory_purchase_provenance",
"inventory_sale_trace",
@@ -282,13 +310,14 @@ const PRIMITIVE_CONTRACTS: AssistantMcpCatalogPrimitiveContract[] = [
],
supported_action_families: [
"activity_duration",
"broad_evaluation",
"stock_snapshot",
"purchase_provenance",
"sale_trace",
"supplier_overlap",
"purchase_to_sale_chain"
],
planning_tags: ["explanation", "inventory"],
planning_tags: ["explanation", "inventory", "business_overview", "bounded_inference"],
required_axes_any_of: [["evidence_basis"], ["primitive_id"], ["source_rows_summary"]],
optional_axes: ["coverage_target", "domain_family", "item", "warehouse", "as_of_date", "supplier", "buyer"],
output_fact_kinds: ["confirmed_facts", "inferred_facts", "unknown_facts"],
@@ -487,6 +516,25 @@ const CHAIN_TEMPLATES: AssistantMcpCatalogChainTemplateContract[] = [
planning_tags: ["document", "explanation", "coverage", "bounded_inference", "activity_window", "legal_fact_boundary"],
safe_for_model_planning: true,
requires_evidence_gate: true
},
{
chain_id: "business_overview",
semantic_data_need: "business overview evidence with bounded analyst interpretation",
chain_summary:
"Collect organization-scoped movement and document evidence, aggregate checked business signals, probe coverage, and explain profit/margin limits before giving a bounded analyst overview.",
fallback_primitives: [
"query_movements",
"aggregate_by_axis",
"query_documents",
"probe_coverage",
"explain_evidence_basis"
],
base_required_axes: ["organization", "aggregate_axis", "amount", "coverage_target", "evidence_basis", "profit_margin_boundary"],
supported_fact_families: ["business_overview"],
supported_action_families: ["broad_evaluation"],
planning_tags: ["business_overview", "movement", "document", "aggregation", "coverage", "explanation", "bounded_inference"],
safe_for_model_planning: true,
requires_evidence_gate: true
}
];
@@ -564,6 +612,15 @@ function tagSetFromFactAxisInput(input: AssistantMcpCatalogFactAxisSearchInput):
if (input.business_fact_family === "value_flow") {
tags.add("movement");
}
if (input.business_fact_family === "business_overview") {
tags.add("business_overview");
tags.add("movement");
tags.add("document");
tags.add("aggregation");
tags.add("coverage");
tags.add("explanation");
tags.add("bounded_inference");
}
if (input.business_fact_family?.startsWith("inventory_")) {
tags.add("inventory");
}
@@ -86,6 +86,16 @@ function businessFactFamilyFor(input: {
if (combined.includes("entity discovery") || combined.includes("entity_resolution")) {
return "entity_grounding";
}
if (
combined.includes("broad_business_evaluation") ||
combined.includes("broad_evaluation") ||
combined.includes("business overview") ||
combined.includes("business_overview") ||
combined.includes("company analysis") ||
combined.includes("business audit")
) {
return "business_overview";
}
if (
combined.includes("inventory") ||
combined.includes("stock") ||
@@ -174,6 +184,9 @@ function timeScopeNeedFor(input: {
if (input.family === "activity_lifecycle") {
return "open_activity_window";
}
if (input.family === "business_overview") {
return input.explicitDateScope ? "explicit_period" : "all_time_scope";
}
if (input.family === "inventory_stock_snapshot" || input.family === "inventory_supplier_overlap") {
return input.explicitDateScope ? "explicit_period" : "as_of_date_required";
}
@@ -291,6 +304,9 @@ function proofExpectationFor(input: {
if (input.family === "activity_lifecycle") {
return "bounded_inference";
}
if (input.family === "business_overview") {
return "bounded_inference";
}
return "coverage_checked_fact";
}
@@ -370,6 +386,15 @@ function decompositionCandidatesFor(input: {
pushUnique(result, "explain_evidence_basis");
return result;
}
if (input.family === "business_overview") {
pushUnique(result, "collect_scoped_movements");
pushUnique(result, "aggregate_checked_amounts");
pushUnique(result, "aggregate_ranked_axis_values");
pushUnique(result, "fetch_supporting_documents");
pushUnique(result, "probe_coverage");
pushUnique(result, "explain_evidence_basis");
return result;
}
if (input.family === "inventory_stock_snapshot") {
pushUnique(result, "fetch_scoped_movements");
pushUnique(result, "aggregate_checked_amounts");
@@ -407,6 +432,11 @@ function forbiddenOverclaimFlagsFor(family: string | null): string[] {
if (family === "activity_lifecycle") {
pushUnique(result, "no_legal_age_claim_without_evidence");
}
if (family === "business_overview") {
pushUnique(result, "no_unchecked_fact_totals");
pushUnique(result, "no_unchecked_business_health_claim");
pushUnique(result, "no_profit_or_margin_claim_without_evidence");
}
if (family === "value_flow" || family === "movement_evidence" || family === "document_evidence") {
pushUnique(result, "no_unchecked_fact_totals");
}
@@ -487,9 +517,16 @@ export function buildAssistantMcpDiscoveryDataNeedGraph(
!explicitOrganizationScope
) {
pushUnique(clarificationGaps, "organization");
} else if (
subjectCandidates.length === 0 &&
businessFactFamily === "business_overview" &&
!explicitOrganizationScope
) {
pushUnique(clarificationGaps, "organization");
} else if (
subjectCandidates.length === 0 &&
businessFactFamily !== "schema_surface" &&
businessFactFamily !== "business_overview" &&
!openScopeWithoutSubject &&
!metadataScopedOpenLaneWithoutSubject &&
!inventoryStockSnapshotWithoutSubject
@@ -541,6 +578,9 @@ export function buildAssistantMcpDiscoveryDataNeedGraph(
if (allTimeScopeHint) {
pushReason(reasonCodes, "data_need_graph_all_time_scope_hint");
}
if (businessFactFamily === "business_overview" && !explicitDateScope) {
pushReason(reasonCodes, "data_need_graph_business_overview_defaults_to_all_time_scope");
}
if (clarificationGaps.includes("organization")) {
pushReason(reasonCodes, "data_need_graph_open_scope_total_needs_organization");
}
@@ -200,6 +200,7 @@ export type AssistantMcpDiscoveryPilotScope =
| "counterparty_value_flow_query_movements_v1"
| "counterparty_supplier_payout_query_movements_v1"
| "counterparty_bidirectional_value_flow_query_movements_v1"
| "business_overview_route_template_v1"
| "inventory_route_template_v1";
export interface AssistantMcpDiscoveryPilotExecutionContract {
@@ -2713,6 +2714,8 @@ function pilotScopeForPlanner(planner: AssistantMcpDiscoveryPlannerContract): As
case "value_flow_ranking":
case "value_flow":
return valueFlowPilotProfile(planner).scope;
case "business_overview":
return "business_overview_route_template_v1";
case "document_evidence":
return "counterparty_document_evidence_query_documents_v1";
case "lifecycle":
@@ -66,6 +66,7 @@ export type AssistantMcpDiscoveryChainId =
| "value_flow_comparison"
| "value_flow_ranking"
| "lifecycle"
| "business_overview"
| "movement_evidence"
| "document_evidence"
| "entity_resolution";
@@ -922,6 +923,32 @@ function recipeFor(input: AssistantMcpDiscoveryPlannerInput): PlannerRecipe {
});
}
if (graphFactFamily === "business_overview") {
pushUnique(axes, "organization");
pushUnique(axes, "aggregate_axis");
pushUnique(axes, "amount");
pushUnique(axes, "coverage_target");
pushUnique(axes, "evidence_basis");
pushUnique(axes, "profit_margin_boundary");
const template = getAssistantMcpCatalogChainTemplate("business_overview");
const primitiveSelection = selectPrimitivesFromGraphAndCatalog({
dataNeedGraph,
fallbackPrimitives: template.fallback_primitives,
requiredAxes: axes,
metadataSurface: input.metadataSurface,
actionFamily: action || graphAction,
allowAggregateByAxis: true,
selectedChainId: "business_overview"
});
return recipeFromCatalogChainTemplate({
chainId: "business_overview",
axes,
primitives: primitiveSelection.primitives,
reason: "planner_selected_business_overview_from_data_need_graph",
extraReasons: primitiveSelection.reasonCodes
});
}
if (graphFactFamily === "activity_lifecycle") {
pushUnique(axes, "document_date");
pushUnique(axes, "coverage_target");