feat: compose python sources in workflow server

This commit is contained in:
lda
2026-06-11 18:49:58 +07:00 Verified
parent c114cde2da
commit 94b5eb6ba2
3 changed files with 60 additions and 4 deletions
+21 -2
View File
@@ -2,7 +2,8 @@ from __future__ import annotations
from pathlib import Path
from wf_config import FilesystemStoreConfig, WorkflowConfigFile
from wf_config import FilesystemStoreConfig, PythonSourceConfig, WorkflowConfigFile
from wf_platform import CapabilitySource
from .context import WorkflowServer, build_local_static_workflow_server
@@ -13,6 +14,21 @@ def _has_mcp_sources(config: WorkflowConfigFile) -> bool:
)
def _python_sources(config: WorkflowConfigFile) -> dict[str, CapabilitySource]:
from wf_sources_python import load_python_source
return {
source.id: load_python_source(
source_id=source.id,
module=source.module,
registry=source.registry,
enabled=source.enabled,
)
for source in config.server.sources
if isinstance(source, PythonSourceConfig)
}
def _build_mcp_workflow_server_from_workflow_config(
config: WorkflowConfigFile,
) -> WorkflowServer:
@@ -49,7 +65,10 @@ def build_workflow_server_from_workflow_config(
# Roadmap: SQL/transactional stores are deferred until the remote server
# storage boundary is proven with file-backed stores.
raise ValueError("wf-rpc-server currently requires filesystem store")
return build_local_static_workflow_server(store.root)
return build_local_static_workflow_server(
store.root,
extra_sources=_python_sources(config),
)
def build_workflow_server_from_legacy_mcp_config(path: str | Path) -> WorkflowServer: