Planner Autonomy: вынести catalog chain matches в контракт
This commit is contained in:
@@ -70,6 +70,7 @@ export interface AssistantMcpDiscoveryPlannerContract {
|
||||
metadata_surface_ref: AssistantMcpDiscoveryMetadataSurfaceRef | null;
|
||||
selected_chain_id: AssistantMcpDiscoveryChainId;
|
||||
selected_chain_summary: string;
|
||||
catalog_chain_template_matches: AssistantMcpCatalogChainTemplateId[];
|
||||
proposed_primitives: AssistantMcpDiscoveryPrimitive[];
|
||||
required_axes: string[];
|
||||
discovery_plan: AssistantMcpDiscoveryPlanContract;
|
||||
@@ -536,6 +537,24 @@ function budgetOverrideFor(input: AssistantMcpDiscoveryPlannerInput, recipe: Pla
|
||||
return {};
|
||||
}
|
||||
|
||||
function catalogChainTemplateMatchesForContract(
|
||||
input: AssistantMcpDiscoveryPlannerInput,
|
||||
recipe: PlannerRecipe
|
||||
): AssistantMcpCatalogChainTemplateId[] {
|
||||
const dataNeedGraph = input.dataNeedGraph ?? null;
|
||||
if (!dataNeedGraph) {
|
||||
return [];
|
||||
}
|
||||
return searchAssistantMcpCatalogChainTemplatesByFactAxis({
|
||||
business_fact_family: dataNeedGraph.business_fact_family,
|
||||
action_family: toNonEmptyString(input.turnMeaning?.asked_action_family) ?? dataNeedGraph.action_family,
|
||||
required_axes: recipe.axes,
|
||||
comparison_need: dataNeedGraph.comparison_need,
|
||||
ranking_need: dataNeedGraph.ranking_need,
|
||||
aggregation_need: dataNeedGraph.aggregation_need
|
||||
});
|
||||
}
|
||||
|
||||
function routeFamilyFromThinMetadataSurfaceInput(
|
||||
input: AssistantMcpDiscoveryPlannerInput
|
||||
): AssistantMcpDiscoveryMetadataRouteFamily | null {
|
||||
@@ -1193,6 +1212,7 @@ export function planAssistantMcpDiscovery(
|
||||
const semanticDataNeed = toNonEmptyString(input.semanticDataNeed) ?? recipe.semanticDataNeed;
|
||||
const dataNeedGraph = input.dataNeedGraph ?? null;
|
||||
const metadataSurface = input.metadataSurface ?? null;
|
||||
const catalogChainTemplateMatches = catalogChainTemplateMatchesForContract(input, recipe);
|
||||
const reasonCodes: string[] = [];
|
||||
pushReason(reasonCodes, recipe.reason);
|
||||
for (const reason of recipe.extraReasons ?? []) {
|
||||
@@ -1259,6 +1279,7 @@ export function planAssistantMcpDiscovery(
|
||||
metadata_surface_ref: metadataSurface,
|
||||
selected_chain_id: recipe.chainId,
|
||||
selected_chain_summary: recipe.chainSummary,
|
||||
catalog_chain_template_matches: catalogChainTemplateMatches,
|
||||
proposed_primitives: recipe.primitives,
|
||||
required_axes: recipe.axes,
|
||||
discovery_plan: plan,
|
||||
|
||||
Reference in New Issue
Block a user