Протянуть hot handoff в discovery response

This commit is contained in:
2026-05-22 19:33:02 +03:00
parent 5125c747d8
commit e7603a9d29
10 changed files with 111 additions and 16 deletions
@@ -29,6 +29,45 @@ function entryPoint(overrides: Record<string, unknown> = {}) {
} as any;
}
function hotValueFlowEntryPoint(overrides: Record<string, unknown> = {}) {
const base = entryPoint({
hot_runtime_wired: true,
bridge: {
bridge_status: "answer_draft_ready",
hot_runtime_wired: true,
user_facing_response_allowed: true,
business_fact_answer_allowed: true,
requires_user_clarification: false,
execution_handoff: {
schema_version: "assistant_mcp_discovery_execution_handoff_v1",
policy_owner: "assistantMcpDiscoveryExecutionHandoff",
handoff_status: "ready_for_guarded_response",
selected_chain_id: "value_flow",
route_candidate_status: "ready_for_reviewed_execution",
evidence_answer_mode: "confirmed_business_answer",
evidence_expected_coverage: "confirmed_coverage",
pilot_status: "executed",
answer_mode: "confirmed_with_bounded_inference",
mcp_execution_performed: true,
allowed_hot_chain: true,
can_use_guarded_response: true,
must_keep_internal_mechanics_hidden: true,
reason_codes: ["execution_handoff_guarded_response_ready"]
},
answer_draft: {
answer_mode: "confirmed_with_bounded_inference",
headline: "Confirmed value flow.",
confirmed_lines: ["1C value-flow rows were found for counterparty SVK", "Confirmed scoped amount: 3 750 руб."],
inference_lines: ["Counterparty value-flow total was calculated from confirmed 1C movement rows"],
unknown_lines: [],
limitation_lines: [],
next_step_line: null
}
}
});
return { ...base, ...overrides } as any;
}
describe("assistant MCP discovery response candidate", () => {
it("builds a Russian guarded candidate from a confirmed discovery draft", () => {
const candidate = buildAssistantMcpDiscoveryResponseCandidate(entryPoint());
@@ -44,6 +83,16 @@ describe("assistant MCP discovery response candidate", () => {
expect(candidate.reply_text).not.toContain("primitive");
});
it("marks an allowlisted value-flow handoff as hot-wired for guarded runtime use", () => {
const candidate = buildAssistantMcpDiscoveryResponseCandidate(hotValueFlowEntryPoint());
expect(candidate.candidate_status).toBe("ready_for_guarded_use");
expect(candidate.hot_runtime_wired).toBe(true);
expect(candidate.eligible_for_future_hot_runtime).toBe(true);
expect(candidate.reason_codes).toContain("mcp_discovery_response_candidate_guarded_hot_wired");
expect(candidate.reply_text).toContain("3 750");
});
it("keeps inventory reserve boundary answers direct instead of compacting into a money overview", () => {
const candidate = buildAssistantMcpDiscoveryResponseCandidate(
entryPoint({
@@ -126,7 +126,10 @@ describe("assistant MCP discovery runtime entry point", () => {
expect(result.bridge?.bridge_status).toBe("answer_draft_ready");
expect(result.bridge?.pilot.pilot_scope).toBe("counterparty_value_flow_query_movements_v1");
expect(result.bridge?.pilot.derived_value_flow?.total_amount).toBe(3750);
expect(result.bridge?.hot_runtime_wired).toBe(false);
expect(result.bridge?.hot_runtime_wired).toBe(true);
expect(result.bridge?.execution_handoff.can_use_guarded_response).toBe(true);
expect(result.hot_runtime_wired).toBe(true);
expect(result.reason_codes).toContain("runtime_entry_point_wired_to_guarded_hot_assistant_answer");
expect(result.reason_codes).toContain("mcp_discovery_unsupported_but_understood_turn");
});