Planner Autonomy: добавить статус catalog-alignment

This commit is contained in:
2026-05-01 15:33:30 +03:00
parent 755e2521e8
commit 8b5104a2c6
9 changed files with 76 additions and 23 deletions
@@ -18,6 +18,7 @@ function entryPointContract(overrides: Record<string, unknown> = {}) {
selected_chain_id: "value_flow_ranking",
catalog_chain_template_matches: ["value_flow_ranking", "value_flow"],
catalog_chain_template_alignment: {
alignment_status: "selected_matches_top",
top_chain_template_match: "value_flow_ranking",
selected_chain_template_rank: 1,
selected_chain_is_catalog_template: true,
@@ -50,6 +51,7 @@ describe("assistant MCP discovery debug attachment", () => {
expect(debug.mcp_discovery_bridge_status).toBe("answer_draft_ready");
expect(debug.mcp_discovery_selected_chain_id).toBe("value_flow_ranking");
expect(debug.mcp_discovery_catalog_chain_template_matches).toEqual(["value_flow_ranking", "value_flow"]);
expect(debug.mcp_discovery_catalog_chain_alignment_status).toBe("selected_matches_top");
expect(debug.mcp_discovery_catalog_chain_top_match).toBe("value_flow_ranking");
expect(debug.mcp_discovery_catalog_chain_selected_matches_top).toBe(true);
expect(debug.mcp_discovery_answer_mode).toBe("confirmed_with_bounded_inference");
@@ -71,6 +73,7 @@ describe("assistant MCP discovery debug attachment", () => {
expect(debug.mcp_discovery_bridge_status).toBeNull();
expect(debug.mcp_discovery_selected_chain_id).toBeNull();
expect(debug.mcp_discovery_catalog_chain_template_matches).toEqual([]);
expect(debug.mcp_discovery_catalog_chain_alignment_status).toBeNull();
expect(debug.mcp_discovery_catalog_chain_top_match).toBeNull();
expect(debug.mcp_discovery_catalog_chain_selected_matches_top).toBe(false);
expect(debug.mcp_discovery_answer_mode).toBeNull();
@@ -49,6 +49,7 @@ describe("assistant MCP discovery planner", () => {
expect(result.data_need_graph?.business_fact_family).toBe("value_flow");
expect(result.catalog_chain_template_matches[0]).toBe("value_flow");
expect(result.catalog_chain_template_alignment).toMatchObject({
alignment_status: "selected_matches_top",
top_chain_template_match: "value_flow",
selected_chain_template_rank: 1,
selected_chain_is_catalog_template: true,
@@ -200,6 +201,7 @@ describe("assistant MCP discovery planner", () => {
for (const item of cases) {
const result = planAssistantMcpDiscovery(item.input);
expect(result.selected_chain_id, item.name).toBe(item.expected);
expect(result.catalog_chain_template_alignment.alignment_status, item.name).toBe("selected_matches_top");
expect(result.catalog_chain_template_alignment.top_chain_template_match, item.name).toBe(item.expected);
expect(result.catalog_chain_template_alignment.selected_chain_template_rank, item.name).toBe(1);
expect(result.catalog_chain_template_alignment.selected_chain_matches_top, item.name).toBe(true);
@@ -1098,6 +1100,7 @@ describe("assistant MCP discovery planner", () => {
expect(result.discovery_plan.plan_status).toBe("needs_clarification");
expect(result.catalog_chain_template_matches).toEqual([]);
expect(result.catalog_chain_template_alignment).toMatchObject({
alignment_status: "selected_unscored",
top_chain_template_match: null,
selected_chain_template_rank: null,
selected_chain_in_catalog_matches: false,
@@ -148,6 +148,7 @@ describe("assistant MCP discovery runtime bridge", () => {
expect(result.loop_state.pending_axes).toContain("organization");
expect(result.loop_state.provided_axes).toContain("aggregate_axis");
expect(result.loop_state.catalog_chain_template_matches[0]).toBe("value_flow_ranking");
expect(result.loop_state.catalog_chain_template_alignment.alignment_status).toBe("selected_matches_top");
expect(result.loop_state.catalog_chain_template_alignment.selected_chain_matches_top).toBe(true);
expect(result.reason_codes).toContain("planner_selected_chain_matches_catalog_top");
expect(result.reason_codes).toContain("runtime_bridge_loop_state_awaiting_clarification");