ARCH: добавить двусторонний MCP discovery для нетто-потока

This commit is contained in:
2026-04-20 19:11:22 +03:00
parent 52da709671
commit 99a568241d
39 changed files with 7979 additions and 67 deletions
@@ -1212,6 +1212,55 @@ Module progress:
- Big Block 5 MCP Semantic Data Agent: `98%`.
## Progress Update - 2026-04-20 MCP Discovery Bidirectional Net Value-Flow Composition
The eighteenth implementation slice of Big Block 5 adds the first composed MCP discovery value-flow answer.
Before this slice the assistant could recover two separate guarded paths:
- incoming customer revenue/value-flow through `customer_revenue_and_payments`;
- outgoing supplier payments/write-offs through `supplier_payouts_profile`.
The new slice lets one current user question ask for both sides and the net result without adding a one-off hardcoded route.
New behavior:
- net/bidirectional wording such as `нетто`, `сальдо`, `взаиморасчет`, `получили и заплатили`, `incoming and outgoing`, and `received and paid` is recognized as `asked_action_family=net_value_flow`;
- the pilot scope `counterparty_bidirectional_value_flow_query_movements_v1` executes both reviewed movement profiles through the same guarded `query_movements` primitive family;
- runtime derives `derived_bidirectional_value_flow` with incoming amount, outgoing amount, net amount, side-specific row counts, first/latest dates, and side-specific probe-limit coverage;
- the user-facing answer says what was received, what was paid, and what net value can be inferred from found rows;
- if either side reaches the probe row limit, the answer explicitly says the full requested period is not proven and the net value is only a found-row calculation;
- the final response candidate still filters internal primitive/query/runtime/planner/catalog/pilot mechanics.
Replay result:
- `address_truth_harness_phase19_mcp_discovery_response_gate_live_rerun10` passed 7/7 after adding the new net-flow step;
- `address_truth_harness_phase19_mcp_discovery_response_gate_live_rerun11` passed 7/7 after answer punctuation cleanup;
- final status: `accepted`;
- the net-flow step answered through `mcp_discovery_response_candidate_guarded`;
- the bidirectional pilot scope was `counterparty_bidirectional_value_flow_query_movements_v1`;
- confirmed incoming found-row amount for `Группа СВК` in `2020`: `47 628 853,03 руб.`;
- confirmed outgoing found-row amount for `Группа СВК` in `2020`: `19 568 878,06 руб.`;
- found-row net in our favor: `28 059 974,97 руб.`;
- incoming coverage: `44 из 44` rows, first date `2020-01-09`, latest `2020-12-30`;
- outgoing coverage: `100 из 100` rows, first date `2020-01-09`, latest `2020-03-16`;
- because the outgoing side reached the row limit, the answer marks full-period coverage as unproven;
- user-facing text has no `query_documents`, `query_movements`, `runtime_`, `planner_`, `catalog_`, `primitive`, or `pilot_` leak.
Validation:
- `npm test -- assistantMcpDiscoveryTurnInputAdapter.test.ts assistantMcpDiscoveryPlanner.test.ts assistantMcpDiscoveryPilotExecutor.test.ts assistantMcpDiscoveryAnswerAdapter.test.ts assistantMcpDiscoveryResponseCandidate.test.ts assistantMcpDiscoveryResponsePolicy.test.ts assistantMcpDiscoveryRuntimeEntryPoint.test.ts assistantMcpDiscoveryRuntimeBridge.test.ts assistantAddressLaneResponseRuntimeAdapter.test.ts assistantDeepTurnResponseRuntimeAdapter.test.ts assistantLivingChatRuntimeAdapter.test.ts assistantAddressOrchestrationRuntimeAdapter.test.ts assistantDebugPayloadAssembler.test.ts` passed 85/85;
- `npm run build` passed;
- `python scripts/domain_truth_harness.py run-live --spec docs/orchestration/address_truth_harness_phase19_mcp_discovery_response_gate.json --output-dir artifacts/domain_runs/address_truth_harness_phase19_mcp_discovery_response_gate_live_rerun11 --timeout-seconds 180` passed 7/7, final status `accepted`.
Known remaining boundary:
- this is still profile-composed discovery, not arbitrary self-navigation through every 1C register. Richer coverage proofs, follow-up drilldown over discovered rows, and Qwen-planned multi-axis exploration remain future work.
Module progress:
- Big Block 5 MCP Semantic Data Agent: `99%`.
## Execution Rule
Do not implement this plan as:
@@ -141,7 +141,39 @@
]
},
{
"step_id": "step_06_off_domain_living_chat_not_hijacked",
"step_id": "step_06_counterparty_bidirectional_net_flow_uses_guarded_discovery",
"title": "Unsupported-but-understood counterparty net cash-flow question composes incoming and outgoing discovery",
"question": "какое нетто по деньгам с Группа СВК за 2020 год: сколько получили и сколько заплатили?",
"required_answer_patterns_all": [
"(?i)свк",
"(?i)1с|найден|строк|проверен",
"(?i)получил|входящ|поступ",
"(?i)заплат|исходящ|списан|плат[её]ж",
"(?i)нетто|сальдо|разниц",
"(?i)сумм|руб",
"(?i)2020|период",
"(?i)не подтвержд|проверенн|найденн"
],
"forbidden_answer_patterns": [
"(?i)точный маршрут.*не подключ",
"(?i)не буду подставлять",
"(?i)query_documents",
"(?i)query_movements",
"(?i)runtime_",
"(?i)planner_",
"(?i)catalog_",
"(?i)primitive",
"(?i)pilot_"
],
"criticality": "critical",
"semantic_tags": [
"mcp_discovery_bidirectional_value_flow",
"counterparty_net_cash_flow",
"unsupported_current_turn_meaning_boundary"
]
},
{
"step_id": "step_07_off_domain_living_chat_not_hijacked",
"title": "Off-domain living chat remains human and is not hijacked by discovery carryover",
"question": "а чем капибара отличается от утки?",
"required_answer_patterns_any": [