Files
next-tjwater-server/app/domain/schemas/workbench_events.py
T
jiang be6317eb48 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.
2026-10-19 18:46:58 +08:00

52 lines
1.5 KiB
Python

"""Stable workbench event-stream and synchronization contracts."""
from __future__ import annotations
from typing import Literal
from uuid import UUID
from pydantic import Field, JsonValue
from app.domain.schemas.operational_task import (
OperationalTaskNotification,
OperationalTaskSummary,
)
from app.domain.schemas.shared import NonEmptyStr, PositiveInt, StrictModel
from app.domain.schemas.workbench_runtime import WorkbenchDateTime, WorkbenchRuntimeSnapshot
WorkbenchEventTopic = Literal[
"operational.task.changed",
"operational.run.queued",
"operational.run.changed",
"operational.report.published",
"operational.progress.changed",
"operational.presentation.requested",
"operational.action.changed",
"operational.notification.changed",
"workbench.alert.changed",
"workbench.work_order.changed",
"analysis.run.changed",
]
class WorkbenchEvent(StrictModel):
schema_name: Literal["workbench-event@1"] = Field(alias="schema")
event_seq: PositiveInt
event_id: UUID
project_id: UUID
topic: WorkbenchEventTopic
aggregate_type: NonEmptyStr
aggregate_id: NonEmptyStr
aggregate_revision: PositiveInt
occurred_at: WorkbenchDateTime
metadata: dict[str, JsonValue]
class WorkbenchSyncSnapshot(StrictModel):
schema_name: Literal["workbench-sync-snapshot@1"] = Field(alias="schema")
event_cursor: int = Field(ge=0)
runtime: WorkbenchRuntimeSnapshot
tasks: list[OperationalTaskSummary]
notifications: list[OperationalTaskNotification]
generated_at: WorkbenchDateTime