feat: add mcp backed workflow server

This commit is contained in:
lda
2026-06-04 23:17:02 +07:00 Unverified
parent 0d34174a84
commit 3b8a1fe6dc
10 changed files with 862 additions and 15 deletions
+15 -3
View File
@@ -1,7 +1,7 @@
from __future__ import annotations
from dataclasses import dataclass
from typing import Any
from typing import Any, cast
from wf_mcp.events import EventBus, McpEvent, make_event
from wf_mcp.models import CatalogSnapshot
@@ -18,8 +18,20 @@ class BrokerEventRecorder:
event_bus: EventBus
def record_event(self, event: McpEvent) -> None:
self.event_bus.publish(event)
def record_event(self, event: object) -> None:
# WorkflowEventRecorder is protocol-neutral and may pass test/local
# sentinel objects. EventBus is typed for McpEvent, but the in-memory
# history sink preserves whatever object is published.
self.event_bus.publish(cast(McpEvent, event))
def record_workflow_event(
self,
event_type: str,
*,
capability_id: str,
payload: dict[str, Any],
) -> None:
self.record_kind(event_type, capability_id=capability_id, payload=payload)
def record_kind(
self,