ARCH: довести catalog drilldown от metadata surface до planner chain

This commit is contained in:
2026-04-23 10:48:01 +03:00
parent c2392f6420
commit 8fc90ae65f
12 changed files with 322 additions and 15 deletions
@@ -613,7 +613,8 @@ function isValueFlowPilotEligible(planner: AssistantMcpDiscoveryPlannerContract)
function isMetadataPilotEligible(planner: AssistantMcpDiscoveryPlannerContract): boolean {
if (
planner.selected_chain_id === "metadata_inspection" ||
planner.selected_chain_id === "metadata_lane_clarification"
planner.selected_chain_id === "metadata_lane_clarification" ||
planner.selected_chain_id === "catalog_drilldown"
) {
return true;
}
@@ -658,6 +659,23 @@ function metadataScopeForPlanner(planner: AssistantMcpDiscoveryPlannerContract):
if (entityCandidate) {
return entityCandidate;
}
if (planner.selected_chain_id === "catalog_drilldown") {
const surface = planner.metadata_surface_ref;
const scopeCandidate = [
...(surface?.selected_surface_objects ?? []),
surface?.selected_entity_set ?? ""
]
.map((value) => toNonEmptyString(value))
.filter((value): value is string => Boolean(value))
.map((value) => {
const parts = value.split(".").map((item) => item.trim()).filter((item) => item.length > 0);
return parts.length > 0 ? parts[parts.length - 1] ?? value : value;
})
.find((value) => value.length > 0);
if (scopeCandidate) {
return scopeCandidate;
}
}
const meaning = planner.discovery_plan.turn_meaning_ref;
const combined = `${meaning?.asked_domain_family ?? ""} ${meaning?.asked_action_family ?? ""} ${meaning?.unsupported_but_understood_family ?? ""}`
.toLowerCase()
@@ -675,6 +693,12 @@ function metadataScopeForPlanner(planner: AssistantMcpDiscoveryPlannerContract):
}
function metadataTypesForPlanner(planner: AssistantMcpDiscoveryPlannerContract): string[] {
if (planner.selected_chain_id === "catalog_drilldown") {
const selectedEntitySet = toNonEmptyString(planner.metadata_surface_ref?.selected_entity_set);
if (selectedEntitySet) {
return [selectedEntitySet];
}
}
const meaning = planner.discovery_plan.turn_meaning_ref;
const action = String(meaning?.asked_action_family ?? "").toLowerCase();
if (action === "inspect_registers") {
@@ -2381,6 +2405,7 @@ function buildEmptyEvidence(
function pilotScopeForPlanner(planner: AssistantMcpDiscoveryPlannerContract): AssistantMcpDiscoveryPilotScope {
switch (planner.selected_chain_id) {
case "catalog_drilldown":
case "metadata_lane_clarification":
case "metadata_inspection":
return "metadata_inspection_v1";
@@ -2524,6 +2549,9 @@ export async function executeAssistantMcpDiscoveryPilot(
let metadataResult: AddressMcpMetadataRowsResult | null = null;
const metadataScope = metadataScopeForPlanner(planner);
const requestedMetaTypes = metadataTypesForPlanner(planner);
if (planner.selected_chain_id === "catalog_drilldown" && metadataScope) {
pushReason(reasonCodes, "pilot_catalog_drilldown_metadata_scope_seeded_from_surface_ref");
}
for (const step of dryRun.execution_steps) {
if (step.primitive_id !== "inspect_1c_metadata") {