fix: opt draft storage into real callers

This commit is contained in:
lda
2026-08-31 14:07:53 +07:00 Verified
parent ce7e3ed761
commit b377311a6e
21 changed files with 194 additions and 50 deletions
+3 -1
View File
@@ -163,7 +163,9 @@ def build_service_from_config(config: BrokerConfig) -> WfMcpService:
"""Create a broker service with SDK adapters for configured connections."""
runtime_factory = PersistentSessionFactory()
store_roots = config.store_roots
workflow_stores = file_workflow_stores(store_roots.workflow_root)
# The broker's documented workflow/draft tools are a draft-bearing
# composition, so opt into the otherwise disabled draft store explicitly.
workflow_stores = file_workflow_stores(store_roots.workflow_root, drafts=True)
# Keep FileStore as the compatibility facade on WfMcpService.store while
# focused services receive role-specific stores.
auth_store = FileAuthStore(store_roots.auth_root)
+2 -1
View File
@@ -64,7 +64,8 @@ def workflow_server_from_service(
raise ValueError("MCP-backed WorkflowServer requires workflow stores")
context = context_from_service(service)
api: WorkflowApi = durable_workflow_api(context)
# MCP's documented workflow server includes mutable draft operations.
api: WorkflowApi = durable_workflow_api(context, drafts=True)
source_diagnostics = SourceDiagnosticsProvider(
connection_lookup=service.connections.get,
auth_store=service.auth_store or service.store,
+4 -2
View File
@@ -13,14 +13,16 @@ if TYPE_CHECKING:
class WorkflowSurfaceHandlers(WorkflowApi):
"""Compatibility wrapper for old wf_mcp.workflow_surface imports.
New code should construct `WorkflowApi(context_from_service(service))`
New code should construct `WorkflowApi(context_from_service(service), drafts=True)`
directly. This shim keeps tests and legacy broker artifact tools working
for legacy callers.
"""
def __init__(self, service: WfMcpService) -> None:
self.service = service
super().__init__(context_from_service(service))
# This compatibility surface exposes the draft methods used by the
# workflow-surface tests and legacy broker artifact tools.
super().__init__(context_from_service(service), drafts=True)
__all__ = ["WorkflowSurfaceHandlers"]
+3 -1
View File
@@ -71,7 +71,9 @@ from .models import (
def register_workflow_tools(server: FastMCP[Any], service: WfMcpService) -> None:
"""Register stable workflow tools on the public MCP server surface."""
handlers = WorkflowApi(context_from_service(service))
# This MCP surface registers the draft authoring tools below, so its API
# composition must explicitly opt into the draft services.
handlers = WorkflowApi(context_from_service(service), drafts=True)
@server.tool(
name="wf.workflow.list_artifacts",