Оформить 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
@@ -51,6 +51,7 @@ const PRIMITIVE_CONTRACTS = [
"document_evidence",
"movement_evidence",
"activity_lifecycle",
"business_overview",
"inventory_purchase_provenance",
"inventory_sale_trace",
"inventory_supplier_overlap"
@@ -63,6 +64,7 @@ const PRIMITIVE_CONTRACTS = [
"list_documents",
"list_movements",
"activity_duration",
"broad_evaluation",
"purchase_provenance",
"sale_trace",
"supplier_overlap"
@@ -84,8 +86,22 @@ const PRIMITIVE_CONTRACTS = [
"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"],
@@ -110,11 +126,19 @@ const PRIMITIVE_CONTRACTS = [
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"],
@@ -136,8 +160,8 @@ const PRIMITIVE_CONTRACTS = [
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"],
@@ -178,6 +202,7 @@ const PRIMITIVE_CONTRACTS = [
"document_evidence",
"movement_evidence",
"activity_lifecycle",
"business_overview",
"inventory_stock_snapshot",
"inventory_purchase_provenance",
"inventory_sale_trace",
@@ -196,6 +221,7 @@ const PRIMITIVE_CONTRACTS = [
"list_documents",
"list_movements",
"activity_duration",
"broad_evaluation",
"stock_snapshot",
"purchase_provenance",
"sale_trace",
@@ -216,6 +242,7 @@ const PRIMITIVE_CONTRACTS = [
decomposition_hints: ["explain_evidence_basis"],
supported_fact_families: [
"activity_lifecycle",
"business_overview",
"inventory_stock_snapshot",
"inventory_purchase_provenance",
"inventory_sale_trace",
@@ -223,13 +250,14 @@ const PRIMITIVE_CONTRACTS = [
],
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"],
@@ -414,6 +442,24 @@ const CHAIN_TEMPLATES = [
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
}
];
const CHAIN_TEMPLATE_MAP = new Map(CHAIN_TEMPLATES.map((template) => [template.chain_id, template]));
@@ -477,6 +523,15 @@ function tagSetFromFactAxisInput(input) {
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");
}
@@ -44,6 +44,14 @@ 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") ||
combined.includes("warehouse") ||
@@ -113,6 +121,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";
}
@@ -193,6 +204,9 @@ function proofExpectationFor(input) {
if (input.family === "activity_lifecycle") {
return "bounded_inference";
}
if (input.family === "business_overview") {
return "bounded_inference";
}
return "coverage_checked_fact";
}
function decompositionCandidatesFor(input) {
@@ -264,6 +278,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");
@@ -300,6 +323,11 @@ function forbiddenOverclaimFlagsFor(family) {
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");
}
@@ -372,8 +400,14 @@ function buildAssistantMcpDiscoveryDataNeedGraph(input) {
!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) {
@@ -425,6 +459,9 @@ function buildAssistantMcpDiscoveryDataNeedGraph(input) {
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");
}
@@ -2065,6 +2065,8 @@ function pilotScopeForPlanner(planner) {
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":
@@ -676,6 +676,31 @@ function recipeFor(input) {
extraReasons: primitiveSelection.reasonCodes
});
}
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 = (0, assistantMcpCatalogIndex_1.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");