feat(server): integrate MCP queries and investigation messaging

Add project-bound OAuth MCP queries and controlled analysis with scoped evidence,
limits, timeouts and a nearby-model spatial query using EPSG:4326 inputs.
Default nearby searches to 200 meters and five results.

Integrate investigation messaging/presentation, health/readiness and typed history;
remove duplicate web search and fix online simulation and compressed baseline writes.
Include project migrations 023-025; keep local credentials and demo seeding excluded.

Validation: 319 focused pytest checks; real PostGIS temporary-table regression;
read-only Jinqian bridge radius comparison; cross-language MCP discovery/calls.
This commit is contained in:
2026-10-19 18:46:58 +08:00
parent 2b6fc5aa52
commit be6317eb48
117 changed files with 12703 additions and 638 deletions
@@ -1,5 +1,7 @@
from uuid import uuid4
import pytest
from samples.peripheral.auth import Identity
from samples.peripheral.config import SampleSettings
from samples.peripheral.schemas import CreateWorkOrder, UpdateWorkOrder, WorkOrder
@@ -41,6 +43,25 @@ def test_create_and_update_record_flat_order_activity(monkeypatch):
assert "progress_note" not in updated
@pytest.mark.parametrize(("work_order_type", "detail"), [
("general", "预约工单已创建。"),
("water_quality_complaint", "投诉工单已创建。"),
("burst_report", "爆管上报工单已创建。"),
])
def test_created_activity_distinguishes_work_order_type(monkeypatch, work_order_type, detail):
store = PostgresStore(SampleSettings())
actor = Identity(str(uuid4()), str(uuid4()), True)
monkeypatch.setattr(store, "_mutate", lambda who, key, command, operation: operation(None, "normal"))
monkeypatch.setattr(store, "_save_work_order", lambda _conn, _who, document: document)
created = store.create_work_order(actor, CreateWorkOrder(
request_id=uuid4(), title="测试工单", summary="验证创建活动语义",
work_order_type=work_order_type,
))
assert created["activity"][0]["detail"] == detail
def test_legacy_order_reads_flat_without_claiming_unrecorded_progress():
legacy = {"work_order_id": str(uuid4()), "subtasks": [{"stages": [{"status": "done"}]}]}
projected = PostgresStore._active_managed_document(legacy)