ruff check fix
This commit is contained in:
@@ -9,7 +9,7 @@ ROOT = THESIS_DIR.parents[1]
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
from examples.agent_challenges.evaluation import ( # noqa: E402
|
||||
from examples.agent_challenges.evaluation import (
|
||||
load_evaluation_cohort,
|
||||
render_evaluation_figures,
|
||||
render_evaluation_markdown,
|
||||
|
||||
@@ -30,29 +30,29 @@ def _utf8_subprocess_env() -> dict[str, str]:
|
||||
return env
|
||||
|
||||
|
||||
from examples.agent_challenges.names import ( # noqa: E402
|
||||
from examples.agent_challenges.names import (
|
||||
short_challenge_name,
|
||||
short_model_name,
|
||||
)
|
||||
from examples.agent_challenges.opencode_io import ( # noqa: E402
|
||||
from examples.agent_challenges.opencode_io import (
|
||||
build_opencode_command,
|
||||
opencode_text_results,
|
||||
parse_opencode_output,
|
||||
result_text,
|
||||
)
|
||||
from examples.agent_challenges.opencode_resume import ( # noqa: E402
|
||||
from examples.agent_challenges.opencode_resume import (
|
||||
build_resume_command,
|
||||
extract_session_id,
|
||||
resume_prompt_for_result,
|
||||
)
|
||||
from examples.agent_challenges.report_models import ( # noqa: E402
|
||||
from examples.agent_challenges.report_models import (
|
||||
build_trial_report,
|
||||
)
|
||||
from examples.agent_challenges.reports import ( # noqa: E402
|
||||
from examples.agent_challenges.reports import (
|
||||
save_report_from_result_payload,
|
||||
write_trial_report_projections,
|
||||
)
|
||||
from examples.agent_challenges.workspace import ( # noqa: E402
|
||||
from examples.agent_challenges.workspace import (
|
||||
ChallengeDef,
|
||||
TrialConfig,
|
||||
_display_path,
|
||||
|
||||
+16
-16
@@ -71,17 +71,13 @@ from .wrapper_hints import (
|
||||
__all__ = [
|
||||
"AUTH_ID_PATTERN",
|
||||
"DEFAULT_CALL_STEP_ID",
|
||||
"AuthRecord",
|
||||
"AuthStore",
|
||||
"CapabilityStepUpdate",
|
||||
"builtin_sources",
|
||||
"get_qualified_spec",
|
||||
"matches_query",
|
||||
"paged_list_payload",
|
||||
"qualify_spec",
|
||||
"DEFAULT_ERROR_OUTCOME",
|
||||
"DEFAULT_ERROR_STEP_ID",
|
||||
"DEFAULT_OK_OUTCOME",
|
||||
"RUNTIME_ERROR_CAPABILITY",
|
||||
"AuthRecord",
|
||||
"AuthStore",
|
||||
"CapabilityStepUpdate",
|
||||
"MissingDecision",
|
||||
"MissingDecisionKind",
|
||||
"NextActionPatchExample",
|
||||
@@ -89,10 +85,10 @@ __all__ = [
|
||||
"NextActions",
|
||||
"OutcomeCandidate",
|
||||
"OutcomeCandidateKind",
|
||||
"RUNTIME_ERROR_CAPABILITY",
|
||||
"RawWorkflowPlan",
|
||||
"RouteSource",
|
||||
"RuntimeDependencies",
|
||||
"SourceResourceRef",
|
||||
"TraceRange",
|
||||
"WorkflowAdminApi",
|
||||
"WorkflowAdminAuthProvider",
|
||||
@@ -112,10 +108,9 @@ __all__ = [
|
||||
"WorkflowEventRecorder",
|
||||
"WorkflowLiveSourceChecker",
|
||||
"WorkflowOperationContext",
|
||||
"WorkflowRuntimeRunner",
|
||||
"WorkflowRunApi",
|
||||
"WorkflowRunSurface",
|
||||
"SourceResourceRef",
|
||||
"WorkflowRuntimeRunner",
|
||||
"WorkflowSourceAdminApi",
|
||||
"WorkflowSourceAdminSurface",
|
||||
"WorkflowSourceRegistryApi",
|
||||
@@ -124,17 +119,22 @@ __all__ = [
|
||||
"WorkflowSourceRegistryProvider",
|
||||
"WorkflowSourceRegistrySurface",
|
||||
"WorkflowSpecProvider",
|
||||
"WorkflowStores",
|
||||
"WorkflowSurfaceCapabilityId",
|
||||
"WrapperAuthoringHints",
|
||||
"WrapperHintConfidence",
|
||||
"WrapperOutcomePolicy",
|
||||
"builtin_sources",
|
||||
"durable_workflow_api",
|
||||
"file_workflow_stores",
|
||||
"get_qualified_spec",
|
||||
"matches_query",
|
||||
"paged_list_payload",
|
||||
"parse_workflow_surface_capability_id",
|
||||
"qualify_spec",
|
||||
"require_workflow_stores",
|
||||
"resolve_runtime_dependencies",
|
||||
"validate_auth_id",
|
||||
"workflow_output_schema_for_authoring",
|
||||
"wrapper_hints_for_capability",
|
||||
"resolve_runtime_dependencies",
|
||||
"WorkflowStores",
|
||||
"file_workflow_stores",
|
||||
"durable_workflow_api",
|
||||
"require_workflow_stores",
|
||||
]
|
||||
|
||||
@@ -291,9 +291,7 @@ def _resolve_local_reference(
|
||||
raise ValueError(f"cyclic reference {reference!r} at schema path {label!r}")
|
||||
seen.add(reference)
|
||||
|
||||
if reference.startswith("#/$defs/"):
|
||||
pointer = reference.removeprefix("#/")
|
||||
elif reference.startswith("#/definitions/"):
|
||||
if reference.startswith("#/$defs/") or reference.startswith("#/definitions/"):
|
||||
pointer = reference.removeprefix("#/")
|
||||
else:
|
||||
raise ValueError(
|
||||
|
||||
@@ -102,10 +102,10 @@ class AtomicJsonRegistryStore(Generic[RegistryT]):
|
||||
|
||||
|
||||
__all__ = [
|
||||
"SOURCE_REGISTRY_ID_PATTERN",
|
||||
"AtomicJsonRegistryStore",
|
||||
"SourceRegistryBaseModel",
|
||||
"SourceRegistryStore",
|
||||
"SOURCE_REGISTRY_ID_PATTERN",
|
||||
"validate_source_registry_id",
|
||||
"validate_unique_source_ids",
|
||||
]
|
||||
|
||||
@@ -56,46 +56,46 @@ from .store import FileWorkflowArtifactStore, WorkflowArtifactStore
|
||||
from .validation import validate_deployment_dependencies
|
||||
|
||||
__all__ = [
|
||||
"AvailableCapability",
|
||||
"ArtifactKind",
|
||||
"AvailableCapability",
|
||||
"AvailableSource",
|
||||
"CheckpointReason",
|
||||
"DependencyDiagnostic",
|
||||
"DiagnosticSeverity",
|
||||
"DriftPolicy",
|
||||
"DraftWorkspaceConflictError",
|
||||
"DraftWorkspaceStore",
|
||||
"DriftPolicy",
|
||||
"FileDraftWorkspaceStore",
|
||||
"FileWorkflowArtifactStore",
|
||||
"FileRunStore",
|
||||
"FileWorkflowArtifactStore",
|
||||
"PinnedRunEnvironment",
|
||||
"RequiredCapability",
|
||||
"ResumeReadiness",
|
||||
"RunCheckpoint",
|
||||
"RunStore",
|
||||
"SourceBinding",
|
||||
"StoredRunStatus",
|
||||
"WorkflowArtifact",
|
||||
"WorkflowArtifactCatalogEntry",
|
||||
"WorkflowCapabilityRef",
|
||||
"WorkflowDraftWorkspace",
|
||||
"WorkflowArtifactStore",
|
||||
"WorkflowRunRecord",
|
||||
"WorkflowCapabilityRef",
|
||||
"WorkflowDeployment",
|
||||
"RunStore",
|
||||
"RunCheckpoint",
|
||||
"CheckpointReason",
|
||||
"PinnedRunEnvironment",
|
||||
"ResumeReadiness",
|
||||
"StoredRunStatus",
|
||||
"ensure_run_id",
|
||||
"WorkflowDraftWorkspace",
|
||||
"WorkflowRunRecord",
|
||||
"artifact_catalog_entry",
|
||||
"artifact_node_name",
|
||||
"compile_workflow_draft",
|
||||
"create_draft_workspace",
|
||||
"create_workflow_artifact_from_plan",
|
||||
"compile_workflow_draft",
|
||||
"ensure_run_id",
|
||||
"ensure_workspace_id",
|
||||
"get_draft_workspace",
|
||||
"logical_ref_for_concrete_ref",
|
||||
"normalize_plan_node_refs",
|
||||
"patch_draft_workspace",
|
||||
"patch_workflow_draft",
|
||||
"replace_draft_workspace_document",
|
||||
"replace_validated_draft_document",
|
||||
"patch_workflow_draft",
|
||||
"summarize_draft_workspace",
|
||||
"validate_deployment_dependencies",
|
||||
"validate_workflow_draft",
|
||||
|
||||
@@ -21,9 +21,9 @@ from .models import (
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"DraftDiagnostic",
|
||||
"DraftChooseClause",
|
||||
"DraftChooseStep",
|
||||
"DraftDiagnostic",
|
||||
"DraftEndStep",
|
||||
"DraftForeachStep",
|
||||
"DraftInterruptStep",
|
||||
@@ -31,8 +31,8 @@ __all__ = [
|
||||
"DraftMatchCase",
|
||||
"DraftMatchStep",
|
||||
"DraftSubgraphStep",
|
||||
"DraftWhenStep",
|
||||
"DraftUseStep",
|
||||
"DraftWhenStep",
|
||||
"WorkflowDraft",
|
||||
"build_workflow_from_draft",
|
||||
"compile_workflow_draft",
|
||||
|
||||
@@ -88,10 +88,8 @@ from .schemas import StateFieldMetadata, state_field
|
||||
from .subgraph import async_subgraph_node, subgraph_node, subgraph_ref
|
||||
|
||||
__all__ = [
|
||||
"NodeCatalog",
|
||||
"NodeCatalogEntry",
|
||||
"AsyncRegistryHandler",
|
||||
"AuthoredReducer",
|
||||
"async_subgraph_node",
|
||||
"BoolOutput",
|
||||
"CoalesceInput",
|
||||
"ConcatInput",
|
||||
@@ -105,47 +103,48 @@ __all__ = [
|
||||
"FilterItemsPresentInput",
|
||||
"GraphPath",
|
||||
"ItemOutput",
|
||||
"MappingOutput",
|
||||
"MappingItemsOutput",
|
||||
"MappingOutput",
|
||||
"MaybeItemOutput",
|
||||
"NoOutput",
|
||||
"NodeCatalog",
|
||||
"NodeCatalogEntry",
|
||||
"NodeReturn",
|
||||
"NodeSpec",
|
||||
"Nothing",
|
||||
"PickKeyInput",
|
||||
"PickPathInput",
|
||||
"ProjectFieldsInput",
|
||||
"ReducerCatalog",
|
||||
"RenameFieldsInput",
|
||||
"RuntimeErrorInput",
|
||||
"NoOutput",
|
||||
"NodeReturn",
|
||||
"NodeSpec",
|
||||
"Nothing",
|
||||
"AsyncRegistryHandler",
|
||||
"SyncRegistryHandler",
|
||||
"SequenceInput",
|
||||
"StateFieldMetadata",
|
||||
"SyncRegistryHandler",
|
||||
"TextOutput",
|
||||
"TruthyInput",
|
||||
"ValueOutput",
|
||||
"ValuesOutput",
|
||||
"WorkflowBuilder",
|
||||
"async_subgraph_node",
|
||||
"bind_fields",
|
||||
"bind_state",
|
||||
"build_async_registry",
|
||||
"build_registry",
|
||||
"build_extract_text_content_spec",
|
||||
"build_extract_text_content_workflow",
|
||||
"bind_state",
|
||||
"build_registry",
|
||||
"coalesce",
|
||||
"concat",
|
||||
"constant",
|
||||
"context",
|
||||
"context_path",
|
||||
"default_if_none",
|
||||
"exists",
|
||||
"expr",
|
||||
"extract_field",
|
||||
"extract_text_content",
|
||||
"filter_items",
|
||||
"filter_items_present",
|
||||
"merge_maps",
|
||||
"context",
|
||||
"context_path",
|
||||
"expr",
|
||||
"exists",
|
||||
"first_item",
|
||||
"first_item_maybe",
|
||||
"first_item_or_none",
|
||||
@@ -158,16 +157,17 @@ __all__ = [
|
||||
"last_item",
|
||||
"last_item_or_none",
|
||||
"length",
|
||||
"pick_key",
|
||||
"pick_path",
|
||||
"project_fields",
|
||||
"rename_fields",
|
||||
"runtime_error",
|
||||
"merge_maps",
|
||||
"node",
|
||||
"not_",
|
||||
"outcome",
|
||||
"output_to",
|
||||
"pick_key",
|
||||
"pick_path",
|
||||
"project_fields",
|
||||
"reducer",
|
||||
"rename_fields",
|
||||
"runtime_error",
|
||||
"state",
|
||||
"state_field",
|
||||
"state_path",
|
||||
|
||||
@@ -16,7 +16,7 @@ class NodeCatalogEntry:
|
||||
output_schema: dict[str, Any]
|
||||
|
||||
@classmethod
|
||||
def from_spec(cls, spec: NodeSpec[Any, Any]) -> "NodeCatalogEntry":
|
||||
def from_spec(cls, spec: NodeSpec[Any, Any]) -> NodeCatalogEntry:
|
||||
input_schema = (
|
||||
spec.input_schema_contract or spec.input_model.model_json_schema()
|
||||
)
|
||||
@@ -38,7 +38,7 @@ class NodeCatalog:
|
||||
specs: dict[str, NodeSpec[Any, Any]]
|
||||
|
||||
@classmethod
|
||||
def from_specs(cls, *specs: NodeSpec[Any, Any]) -> "NodeCatalog":
|
||||
def from_specs(cls, *specs: NodeSpec[Any, Any]) -> NodeCatalog:
|
||||
return cls(specs={spec.name: spec for spec in specs})
|
||||
|
||||
def entries(self) -> list[NodeCatalogEntry]:
|
||||
|
||||
@@ -24,8 +24,8 @@ __all__ = [
|
||||
"AsyncRegistryHandler",
|
||||
"ContextNodeCallable",
|
||||
"InputT",
|
||||
"NodeCallable",
|
||||
"NoOutput",
|
||||
"NodeCallable",
|
||||
"NodeReturn",
|
||||
"NodeSpec",
|
||||
"Nothing",
|
||||
|
||||
@@ -22,7 +22,7 @@ from .result import NodeReturn, Nothing
|
||||
from .schema import schema_ref_for
|
||||
|
||||
|
||||
def _default_outcome(spec: "NodeSpec[Any, Any]") -> str:
|
||||
def _default_outcome(spec: NodeSpec[Any, Any]) -> str:
|
||||
return spec.outcomes[0]
|
||||
|
||||
|
||||
|
||||
@@ -55,17 +55,17 @@ __all__ = [
|
||||
"FilterItemsInput",
|
||||
"FilterItemsPresentInput",
|
||||
"ItemOutput",
|
||||
"MappingOutput",
|
||||
"MappingItemsOutput",
|
||||
"MappingOutput",
|
||||
"MaybeItemOutput",
|
||||
"PickPathInput",
|
||||
"PickKeyInput",
|
||||
"PickPathInput",
|
||||
"ProjectFieldsInput",
|
||||
"RenameFieldsInput",
|
||||
"RuntimeErrorInput",
|
||||
"SequenceInput",
|
||||
"TruthyInput",
|
||||
"TextOutput",
|
||||
"TruthyInput",
|
||||
"ValueOutput",
|
||||
"ValuesOutput",
|
||||
"coalesce",
|
||||
@@ -82,8 +82,8 @@ __all__ = [
|
||||
"last_item",
|
||||
"last_item_or_none",
|
||||
"length",
|
||||
"pick_path",
|
||||
"pick_key",
|
||||
"pick_path",
|
||||
"project_fields",
|
||||
"rename_fields",
|
||||
"runtime_error",
|
||||
|
||||
@@ -15,7 +15,7 @@ class ReducerCatalog:
|
||||
definitions: dict[str, ReducerDefinition]
|
||||
|
||||
@classmethod
|
||||
def from_reducers(cls, *reducers: AuthoredReducer) -> "ReducerCatalog":
|
||||
def from_reducers(cls, *reducers: AuthoredReducer) -> ReducerCatalog:
|
||||
return cls(
|
||||
definitions={
|
||||
reducer.definition.spec.name: reducer.definition for reducer in reducers
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from collections.abc import Iterator, Mapping
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any, Iterator
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel, TypeAdapter
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ from .models import (
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"load_workflow_config",
|
||||
"AuthConfig",
|
||||
"ClientConfig",
|
||||
"FilesystemStoreConfig",
|
||||
@@ -40,4 +39,5 @@ __all__ = [
|
||||
"StdioSourceTransportConfig",
|
||||
"StdlibSourceConfig",
|
||||
"WorkflowConfigFile",
|
||||
"load_workflow_config",
|
||||
]
|
||||
|
||||
+20
-20
@@ -57,56 +57,56 @@ from .validation import (
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"END",
|
||||
"START",
|
||||
"AsyncNodeHandler",
|
||||
"ConditionNode",
|
||||
"Edge",
|
||||
"EndNode",
|
||||
"ExecutionFrame",
|
||||
"ForeachConcurrentPolicy",
|
||||
"ForeachItemErrorPolicy",
|
||||
"ForeachNode",
|
||||
"FrameStatus",
|
||||
"InterruptNode",
|
||||
"InterruptRequest",
|
||||
"InterruptRoute",
|
||||
"JoinNode",
|
||||
"NodeDef",
|
||||
"NodeHandler",
|
||||
"NodeResult",
|
||||
"NodeUse",
|
||||
"PersistedRunState",
|
||||
"PreparedSubgraph",
|
||||
"ReducerRef",
|
||||
"ReducerSpec",
|
||||
"RunState",
|
||||
"RunStatus",
|
||||
"RuntimeContext",
|
||||
"SchemaRef",
|
||||
"SiblingWritePolicy",
|
||||
"StateField",
|
||||
"StateSchema",
|
||||
"SubgraphNode",
|
||||
"AsyncNodeHandler",
|
||||
"NodeHandler",
|
||||
"PreparedSubgraph",
|
||||
"ExecutionFrame",
|
||||
"FrameStatus",
|
||||
"RunState",
|
||||
"RunStatus",
|
||||
"RuntimeContext",
|
||||
"StepExecutionResult",
|
||||
"SubgraphNode",
|
||||
"TraceEntry",
|
||||
"InterruptRoute",
|
||||
"InterruptRequest",
|
||||
"PersistedRunState",
|
||||
"dump_run_state",
|
||||
"load_run_state",
|
||||
"START",
|
||||
"END",
|
||||
"ValidationIssue",
|
||||
"ValidationIssueCode",
|
||||
"ValidationReport",
|
||||
"Workflow",
|
||||
"WorkflowRef",
|
||||
"WorkflowExecutionError",
|
||||
"WorkflowRef",
|
||||
"coerce_node_result",
|
||||
"dump_run_state",
|
||||
"execute_workflow",
|
||||
"execute_workflow_async",
|
||||
"execute_workflow_result_async",
|
||||
"execute_workflow",
|
||||
"load_run_state",
|
||||
"resume_workflow",
|
||||
"resume_workflow_async",
|
||||
"resume_workflow_result_async",
|
||||
"resume_workflow",
|
||||
"step_workflow_async",
|
||||
"step_workflow",
|
||||
"step_workflow_async",
|
||||
"validate_workflow",
|
||||
"workflow_ref_from",
|
||||
]
|
||||
|
||||
@@ -41,12 +41,12 @@ __all__ = [
|
||||
"LiteralOperand",
|
||||
"NodeDef",
|
||||
"NodeResult",
|
||||
"ReducerRef",
|
||||
"ReducerSpec",
|
||||
"NodeUse",
|
||||
"NotCondition",
|
||||
"Operand",
|
||||
"PathOperand",
|
||||
"ReducerRef",
|
||||
"ReducerSpec",
|
||||
"SchemaRef",
|
||||
"SiblingWritePolicy",
|
||||
"StateField",
|
||||
|
||||
@@ -34,14 +34,14 @@ class NotCondition(BaseModel):
|
||||
"""Condition that negates another condition expression."""
|
||||
|
||||
op: Literal["not"]
|
||||
arg: "Condition"
|
||||
arg: Condition
|
||||
|
||||
|
||||
class VariadicCondition(BaseModel):
|
||||
"""Condition that combines one or more child conditions."""
|
||||
|
||||
op: Literal["and", "or"]
|
||||
args: list["Condition"] = Field(min_length=1)
|
||||
args: list[Condition] = Field(min_length=1)
|
||||
|
||||
|
||||
class BinaryCondition(BaseModel):
|
||||
|
||||
@@ -43,7 +43,7 @@ class Workflow(BaseModel):
|
||||
nodes: list[Step]
|
||||
edges: list[Edge]
|
||||
|
||||
def validate_structure(self) -> "ValidationReport":
|
||||
def validate_structure(self) -> ValidationReport:
|
||||
"""Return all structural validation issues for this workflow."""
|
||||
validation = import_module("wf_core.validation.core")
|
||||
return cast("ValidationReport", validation.validate_workflow(self))
|
||||
|
||||
@@ -21,6 +21,7 @@ from .subgraphs import PreparedSubgraph
|
||||
__all__ = [
|
||||
"AsyncNodeHandler",
|
||||
"NodeHandler",
|
||||
"PreparedSubgraph",
|
||||
"WorkflowExecutionError",
|
||||
"coerce_node_result",
|
||||
"complete_step",
|
||||
@@ -34,5 +35,4 @@ __all__ = [
|
||||
"resume_workflow_result_async",
|
||||
"step_workflow",
|
||||
"step_workflow_async",
|
||||
"PreparedSubgraph",
|
||||
]
|
||||
|
||||
@@ -15,7 +15,7 @@ class BlockedOnChildren:
|
||||
child_frame_ids: tuple[str, ...]
|
||||
|
||||
@classmethod
|
||||
def from_frame(cls, frame: ExecutionFrame) -> "BlockedOnChildren | None":
|
||||
def from_frame(cls, frame: ExecutionFrame) -> BlockedOnChildren | None:
|
||||
raw = frame.metadata.get("blocked_on")
|
||||
if raw is None:
|
||||
return None
|
||||
@@ -46,7 +46,7 @@ class ForeachIterationMetadata:
|
||||
loop_alias: str
|
||||
|
||||
@classmethod
|
||||
def from_frame(cls, frame: ExecutionFrame) -> "ForeachIterationMetadata | None":
|
||||
def from_frame(cls, frame: ExecutionFrame) -> ForeachIterationMetadata | None:
|
||||
if frame.kind != "foreach_iteration":
|
||||
return None
|
||||
metadata = frame.metadata
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
START = "__start__"
|
||||
END = "__end__"
|
||||
|
||||
__all__ = ["START", "END"]
|
||||
__all__ = ["END", "START"]
|
||||
|
||||
@@ -31,8 +31,8 @@ __all__ = [
|
||||
"discover_connection_capabilities",
|
||||
"load_broker_config",
|
||||
"make_event",
|
||||
"normalize_transport",
|
||||
"snapshot_from_specs",
|
||||
"specs_from_discovered_tools",
|
||||
"normalize_transport",
|
||||
"workflow_server_from_service",
|
||||
]
|
||||
|
||||
@@ -7,7 +7,7 @@ from .runtime import (
|
||||
|
||||
__all__ = [
|
||||
"ProxyRuntime",
|
||||
"register_proxy_admin_tools",
|
||||
"create_proxy_client",
|
||||
"create_proxy_server",
|
||||
"register_proxy_admin_tools",
|
||||
]
|
||||
|
||||
@@ -17,8 +17,8 @@ __all__ = [
|
||||
"LdaNamespace",
|
||||
"ProxyNamespace",
|
||||
"ProxyToolName",
|
||||
"connection_id_to_resource_path",
|
||||
"clamp_limit",
|
||||
"connection_id_to_resource_path",
|
||||
"error_payload",
|
||||
"is_admin_tool_name",
|
||||
"make_cursor",
|
||||
|
||||
@@ -53,7 +53,7 @@ def workflow_mcp_source_to_connection_config(source: object) -> ConnectionConfig
|
||||
for field in ("id", "provider", "account", "enabled", "ownership", "transport"):
|
||||
if getattr(source, field, None) is None:
|
||||
raise ValueError(f"wf_config MCP source missing required field: {field}")
|
||||
transport = getattr(source, "transport")
|
||||
transport = source.transport
|
||||
metadata = dict(getattr(source, "metadata", {}))
|
||||
if transport.kind == "stdio":
|
||||
metadata.update(
|
||||
@@ -83,12 +83,12 @@ def workflow_mcp_source_to_connection_config(source: object) -> ConnectionConfig
|
||||
if auth_ref is not None:
|
||||
metadata["auth_ref"] = auth_ref
|
||||
return ConnectionConfig(
|
||||
id=getattr(source, "id"),
|
||||
server=getattr(source, "provider"),
|
||||
account=getattr(source, "account"),
|
||||
enabled=getattr(source, "enabled"),
|
||||
id=source.id,
|
||||
server=source.provider,
|
||||
account=source.account,
|
||||
enabled=source.enabled,
|
||||
metadata=metadata,
|
||||
source_config_ownership=getattr(source, "ownership"),
|
||||
source_config_ownership=source.ownership,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ older MCP workflow-surface imports keep working until callers migrate.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from wf_api.runtime_dependencies import ( # noqa: F401
|
||||
from wf_api.runtime_dependencies import (
|
||||
RuntimeDependencies,
|
||||
resolve_runtime_dependencies,
|
||||
)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Annotated, Any, Mapping
|
||||
from collections.abc import Mapping
|
||||
from typing import Annotated, Any
|
||||
|
||||
from fastmcp import FastMCP
|
||||
from pydantic import Field
|
||||
|
||||
@@ -10,8 +10,8 @@ from .spec import load_openapi_document, load_openapi_operations
|
||||
__all__ = [
|
||||
"OPENAPI_OUTCOMES",
|
||||
"OpenApiExecutionConfig",
|
||||
"OpenApiOperationOutput",
|
||||
"OpenApiOperation",
|
||||
"OpenApiOperationOutput",
|
||||
"build_openapi_capability_source",
|
||||
"call_openapi_operation",
|
||||
"load_openapi_document",
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any, Mapping
|
||||
from typing import Any
|
||||
from urllib.parse import quote
|
||||
|
||||
from .models import OpenApiOperation
|
||||
|
||||
@@ -49,8 +49,8 @@ _LAZY_EXPORTS = {
|
||||
|
||||
__all__ = [
|
||||
"CapabilityBuckets",
|
||||
"CapabilitySource",
|
||||
"CapabilityRef",
|
||||
"CapabilitySource",
|
||||
"DocumentationPrompt",
|
||||
"DocumentationResource",
|
||||
"NodeSpecInventory",
|
||||
@@ -63,10 +63,10 @@ __all__ = [
|
||||
"SourcePermissionsSnapshot",
|
||||
"SourcePolicy",
|
||||
"SourcePolicySnapshot",
|
||||
"SourceRef",
|
||||
"SourceStatus",
|
||||
"SourceVisibility",
|
||||
"SourceVisibilitySnapshot",
|
||||
"SourceRef",
|
||||
"build_documentation_source",
|
||||
"hash_json_schema",
|
||||
"page_items",
|
||||
|
||||
@@ -65,17 +65,19 @@ __all__ = [
|
||||
"AdapterLookupRef",
|
||||
"AuthRecord",
|
||||
"DiscoveredConnectionCapabilities",
|
||||
"LegacyAdapterRef",
|
||||
"LegacyConnectionConfigLike",
|
||||
"SourceAdapterRef",
|
||||
"FileSourceRegistryStore",
|
||||
"HttpSourceTransport",
|
||||
"LegacyAdapterRef",
|
||||
"LegacyConnectionConfigLike",
|
||||
"McpSourceConnection",
|
||||
"McpSourceRegistryEntry",
|
||||
"SourceAdapterRef",
|
||||
"SourceRegistryFile",
|
||||
"SourceRegistryStore",
|
||||
"SourceTransport",
|
||||
"StdioSourceTransport",
|
||||
"ToolWrapperEvent",
|
||||
"ToolWrapperEventSink",
|
||||
"auth_missing_diagnostic",
|
||||
"auth_ref_for_connection",
|
||||
"connection_auth_diagnostic",
|
||||
@@ -92,8 +94,6 @@ __all__ = [
|
||||
"specs_from_discovered_tools",
|
||||
"tool_call_completed_event",
|
||||
"tool_call_started_event",
|
||||
"ToolWrapperEvent",
|
||||
"ToolWrapperEventSink",
|
||||
"wrap_discovered_tool",
|
||||
]
|
||||
|
||||
|
||||
@@ -77,14 +77,16 @@ async def open_mcp_session(
|
||||
headers=bound.headers or None,
|
||||
auth=bound.auth,
|
||||
)
|
||||
async with http_client:
|
||||
async with streamable_http_client(
|
||||
async with (
|
||||
http_client,
|
||||
streamable_http_client(
|
||||
str(transport.url),
|
||||
http_client=http_client,
|
||||
) as (read_stream, write_stream, _get_session_id):
|
||||
async with ClientSession(read_stream, write_stream) as session:
|
||||
await session.initialize()
|
||||
yield session
|
||||
) as (read_stream, write_stream, _get_session_id),
|
||||
):
|
||||
async with ClientSession(read_stream, write_stream) as session:
|
||||
await session.initialize()
|
||||
yield session
|
||||
return
|
||||
|
||||
raise ValueError(f"unsupported MCP transport {transport.kind!r}")
|
||||
|
||||
@@ -180,7 +180,7 @@ def _module_file_under_root(root: Path, module: str) -> Path | None:
|
||||
|
||||
|
||||
def _synthetic_module_root(*, source_id: str, root: Path) -> str:
|
||||
digest = sha256(f"{source_id}\0{root}".encode("utf-8")).hexdigest()[:16]
|
||||
digest = sha256(f"{source_id}\0{root}".encode()).hexdigest()[:16]
|
||||
safe_source = source_id.replace(".", "_").replace("-", "_")
|
||||
return f"_wf_source_{safe_source}_{digest}"
|
||||
|
||||
|
||||
@@ -91,12 +91,13 @@ __all__ = [
|
||||
"PatchDraftParams",
|
||||
"PatchDraftWorkspaceParams",
|
||||
"ReadRunTraceParams",
|
||||
"ReplaceDraftWorkspaceDocumentParams",
|
||||
"RemoveDraftBindingParams",
|
||||
"RemoveDraftRouteParams",
|
||||
"RemoveDraftStepParams",
|
||||
"RouteSourceParams",
|
||||
"ReplaceDraftWorkspaceDocumentParams",
|
||||
"ResumeRunParams",
|
||||
"RouteSourceParams",
|
||||
"RpcWorkflowApiClient",
|
||||
"SaveArtifactParams",
|
||||
"SaveDeploymentParams",
|
||||
"SetDraftContractParams",
|
||||
@@ -117,5 +118,4 @@ __all__ = [
|
||||
"ValidateDraftWorkspaceParams",
|
||||
"WorkflowRpcError",
|
||||
"create_rpc_app",
|
||||
"RpcWorkflowApiClient",
|
||||
]
|
||||
|
||||
@@ -112,4 +112,4 @@ def test_context_runtime_runner_uses_workflow_runtime_service(tmp_path: Path) ->
|
||||
service = WfMcpService(store=FileStore(tmp_path / "context_runtime"))
|
||||
context = context_from_service(service)
|
||||
|
||||
assert getattr(context.runtime, "runtime") is service.workflow_runtime
|
||||
assert context.runtime.runtime is service.workflow_runtime
|
||||
|
||||
@@ -6,8 +6,8 @@ from typing import Any
|
||||
import pytest
|
||||
from typer.testing import CliRunner
|
||||
|
||||
import wf_cli.commands.caps as caps
|
||||
from wf_cli.app import app
|
||||
from wf_cli.commands import caps
|
||||
from wf_cli.commands.caps import (
|
||||
CapCallOutputFormat,
|
||||
render_cap_call_output,
|
||||
|
||||
@@ -320,8 +320,8 @@ def test_source_catalog_service_registers_and_lists_sources_directly(
|
||||
server="demo",
|
||||
account="personal",
|
||||
),
|
||||
connection_list_enabled=lambda: [],
|
||||
connection_list_all=lambda: [],
|
||||
connection_list_enabled=list,
|
||||
connection_list_all=list,
|
||||
tool_executor_for=unused_tool_executor,
|
||||
load_auth=lambda connection_id: None,
|
||||
emit_event=lambda event: None,
|
||||
@@ -362,8 +362,8 @@ def test_source_catalog_service_excludes_hidden_sources_from_planner_catalog(
|
||||
server="demo",
|
||||
account="personal",
|
||||
),
|
||||
connection_list_enabled=lambda: [],
|
||||
connection_list_all=lambda: [],
|
||||
connection_list_enabled=list,
|
||||
connection_list_all=list,
|
||||
tool_executor_for=unused_tool_executor,
|
||||
load_auth=lambda connection_id: None,
|
||||
emit_event=lambda event: None,
|
||||
@@ -538,8 +538,8 @@ def test_source_catalog_uses_catalog_store_only(tmp_path: Path) -> None:
|
||||
server="demo",
|
||||
account="personal",
|
||||
),
|
||||
connection_list_enabled=lambda: [],
|
||||
connection_list_all=lambda: [],
|
||||
connection_list_enabled=list,
|
||||
connection_list_all=list,
|
||||
tool_executor_for=lambda connection: (_ for _ in ()).throw(
|
||||
AssertionError("unexpected executor")
|
||||
),
|
||||
|
||||
@@ -106,7 +106,7 @@ def test_wfmcpservice_uses_broker_event_recorder() -> None:
|
||||
event_bus=bus,
|
||||
)
|
||||
|
||||
service._record_event( # noqa: SLF001
|
||||
service._record_event(
|
||||
make_event("connection_registered", connection_id="demo.personal")
|
||||
)
|
||||
|
||||
|
||||
@@ -240,8 +240,8 @@ async def test_upstream_transport_live_diagnostics_report_missing_connection() -
|
||||
source_catalog = SourceCatalogService(
|
||||
store=transport.catalog_store,
|
||||
connection_lookup=_raise_missing_connection,
|
||||
connection_list_enabled=lambda: [],
|
||||
connection_list_all=lambda: [],
|
||||
connection_list_enabled=list,
|
||||
connection_list_all=list,
|
||||
tool_executor_for=transport.tool_executor_for,
|
||||
load_auth=transport.load_connection_auth,
|
||||
emit_event=lambda event: None,
|
||||
|
||||
@@ -100,7 +100,7 @@ async def test_httpx_oauth_refresher_posts_refresh_token_grant(
|
||||
def __init__(self, **kwargs: object) -> None:
|
||||
assert kwargs["timeout"] == 10.0
|
||||
|
||||
async def __aenter__(self) -> "_Client":
|
||||
async def __aenter__(self) -> _Client:
|
||||
return self
|
||||
|
||||
async def __aexit__(self, *args: object) -> None:
|
||||
|
||||
@@ -274,10 +274,10 @@ async def test_open_mcp_session_uses_binder_for_http_headers(
|
||||
def __init__(self, **kwargs: Any) -> None:
|
||||
captured_clients.append(kwargs)
|
||||
|
||||
async def __aenter__(self) -> "_CapturingClient":
|
||||
async def __aenter__(self) -> _CapturingClient:
|
||||
return self
|
||||
|
||||
async def __aexit__(self, *args: Any) -> None:
|
||||
async def __aexit__(self, *args: object) -> None:
|
||||
return None
|
||||
|
||||
import wf_sources_mcp.client.transport as mod
|
||||
@@ -319,7 +319,7 @@ async def test_open_mcp_session_refreshes_oauth_record_for_http(
|
||||
def __init__(self, **kwargs: Any) -> None:
|
||||
captured_clients.append(kwargs)
|
||||
|
||||
async def __aenter__(self) -> "_CapturingClient":
|
||||
async def __aenter__(self) -> _CapturingClient:
|
||||
return self
|
||||
|
||||
async def __aexit__(self, *args: object) -> None:
|
||||
@@ -365,7 +365,7 @@ async def test_open_mcp_session_refreshes_oauth_record_for_http(
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_open_mcp_session_uses_binder_for_stdio_env() -> None:
|
||||
import wf_sources_mcp.client.transport as mod # noqa: I001
|
||||
import wf_sources_mcp.client.transport as mod
|
||||
from wf_api.auth import EnvAuth, StoredAuthRecord
|
||||
|
||||
captured_params: list[Any] = []
|
||||
|
||||
Reference in New Issue
Block a user