unofficially add wf.std as source
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from wf_authoring import NodeSpec, node, runtime_error
|
||||
|
||||
from .specs import qualify_spec
|
||||
|
||||
BUILTIN_CONNECTION_ID = "wf.std"
|
||||
"""Internal source id for workflow standard-library node specs."""
|
||||
|
||||
|
||||
def builtin_specs() -> dict[str, NodeSpec[Any, Any]]:
|
||||
"""Return built-in NodeSpecs available to raw broker workflow plans."""
|
||||
specs = [
|
||||
node(
|
||||
runtime_error,
|
||||
name="runtime_error",
|
||||
description="Fail the current workflow branch with a runtime error.",
|
||||
)
|
||||
]
|
||||
qualified_specs = [qualify_spec(BUILTIN_CONNECTION_ID, spec) for spec in specs]
|
||||
return {spec.name: spec for spec in qualified_specs}
|
||||
@@ -23,6 +23,7 @@ from ..catalog import CombinedCatalog, snapshot_from_specs
|
||||
from ..discovery import discover_connection_capabilities, specs_from_discovered_tools
|
||||
from ..events import McpEvent, make_event
|
||||
from .adapters import require_adapter
|
||||
from .builtins import BUILTIN_CONNECTION_ID, builtin_specs
|
||||
from .specs import get_qualified_spec, qualify_spec
|
||||
|
||||
|
||||
@@ -36,6 +37,12 @@ class WfMcpService:
|
||||
default_factory=dict
|
||||
)
|
||||
events: list[McpEvent] = field(default_factory=list)
|
||||
include_builtin_specs: bool = True
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
"""Install broker-local standard-library specs when enabled."""
|
||||
if self.include_builtin_specs:
|
||||
self.specs_by_connection.setdefault(BUILTIN_CONNECTION_ID, builtin_specs())
|
||||
|
||||
def register_connection(self, connection: ConnectionConfig) -> None:
|
||||
parse_connection_id(connection.id)
|
||||
|
||||
Reference in New Issue
Block a user