wf-core reorg 3 remove old paths
This commit is contained in:
@@ -12,7 +12,6 @@ and user-facing control belong in `wf_mcp`.
|
|||||||
| Package / module | Responsibility |
|
| Package / module | Responsibility |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `wf_core.models` | Pydantic workflow schema package: schemas, condition expressions, executable steps, workflow graph, and node results. |
|
| `wf_core.models` | Pydantic workflow schema package: schemas, condition expressions, executable steps, workflow graph, and node results. |
|
||||||
| `wf_core.model` | Compatibility facade for older imports of core model objects. |
|
|
||||||
| `wf_core.run_state` | Serializable execution state: run status, frames, trace entries, interrupt requests, and runtime context. |
|
| `wf_core.run_state` | Serializable execution state: run status, frames, trace entries, interrupt requests, and runtime context. |
|
||||||
| `wf_core.runtime` | Public execution interface: execute, resume, and step in sync or async mode. |
|
| `wf_core.runtime` | Public execution interface: execute, resume, and step in sync or async mode. |
|
||||||
| `wf_core.runtime.ops` | Executor-only operations used behind `wf_core.runtime`: node execution, state writes, frame movement, foreach, interrupts, indexes, and schema checks. |
|
| `wf_core.runtime.ops` | Executor-only operations used behind `wf_core.runtime`: node execution, state writes, frame movement, foreach, interrupts, indexes, and schema checks. |
|
||||||
@@ -21,9 +20,9 @@ and user-facing control belong in `wf_mcp`.
|
|||||||
| `wf_core.paths` | Graph path parsing, reading, existence checks, and nested state writes. |
|
| `wf_core.paths` | Graph path parsing, reading, existence checks, and nested state writes. |
|
||||||
| `wf_core.tokens` | Importable graph boundary tokens: `START` and `END`. |
|
| `wf_core.tokens` | Importable graph boundary tokens: `START` and `END`. |
|
||||||
|
|
||||||
Root modules such as `wf_core.model`, `wf_core.node_exec`, `wf_core.state_ops`,
|
The root `wf_core` package is the public facade for common callers. Internal
|
||||||
and `wf_core.validate` are compatibility shims. New internal imports should
|
code should import from the concern package directly instead of relying on old
|
||||||
prefer the concern package directly.
|
flat modules.
|
||||||
|
|
||||||
## Runtime Flow
|
## Runtime Flow
|
||||||
|
|
||||||
@@ -56,12 +55,12 @@ raising at the first failure.
|
|||||||
|
|
||||||
- `wf_core` must not import `wf_authoring` or `wf_mcp`.
|
- `wf_core` must not import `wf_authoring` or `wf_mcp`.
|
||||||
- `wf_core.models` and `wf_core.run_state` should stay mostly data-only.
|
- `wf_core.models` and `wf_core.run_state` should stay mostly data-only.
|
||||||
- `wf_core.model` should stay a thin import facade.
|
|
||||||
- `wf_core.runtime` may import `runtime.ops`, but callers should not need to.
|
- `wf_core.runtime` may import `runtime.ops`, but callers should not need to.
|
||||||
- `wf_core.runtime.ops` may use model, run state, paths, conditions, and errors.
|
- `wf_core.runtime.ops` may use model, run state, paths, conditions, and errors.
|
||||||
- `wf_core.validation` may inspect model and path rules, but should not execute
|
- `wf_core.validation` may inspect model and path rules, but should not execute
|
||||||
workflow behavior.
|
workflow behavior.
|
||||||
- Compatibility shims should stay thin: import and re-export only.
|
- `wf_core.__init__` should stay a curated public facade, not a dump of runtime
|
||||||
|
internals.
|
||||||
|
|
||||||
## What This Cleanup Does Not Solve Yet
|
## What This Cleanup Does Not Solve Yet
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ from wf_core import (
|
|||||||
execute_workflow,
|
execute_workflow,
|
||||||
)
|
)
|
||||||
from wf_core.errors import WorkflowExecutionError
|
from wf_core.errors import WorkflowExecutionError
|
||||||
from wf_core.model import Condition as CoreCondition
|
from wf_core.models import Condition as CoreCondition
|
||||||
|
|
||||||
from ..dsl import Expr, PathArg, compile_condition
|
from ..dsl import Expr, PathArg, compile_condition
|
||||||
from ..nodes.callables import SyncRegistryHandler
|
from ..nodes.callables import SyncRegistryHandler
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
|
|
||||||
from wf_core.model import (
|
from wf_core.models import (
|
||||||
BinaryCondition,
|
BinaryCondition,
|
||||||
Condition,
|
Condition,
|
||||||
ExistsCondition,
|
ExistsCondition,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from .model import (
|
from .models import (
|
||||||
ConditionNode,
|
ConditionNode,
|
||||||
Edge,
|
Edge,
|
||||||
ForeachNode,
|
ForeachNode,
|
||||||
@@ -35,7 +35,7 @@ from .run_state import (
|
|||||||
TraceEntry,
|
TraceEntry,
|
||||||
)
|
)
|
||||||
from .tokens import END, START
|
from .tokens import END, START
|
||||||
from .validate import (
|
from .validation import (
|
||||||
ValidationIssue,
|
ValidationIssue,
|
||||||
ValidationIssueCode,
|
ValidationIssueCode,
|
||||||
ValidationReport,
|
ValidationReport,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from collections.abc import Mapping
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from .errors import WorkflowExecutionError
|
from .errors import WorkflowExecutionError
|
||||||
from .model import (
|
from .models import (
|
||||||
BinaryCondition,
|
BinaryCondition,
|
||||||
Condition,
|
Condition,
|
||||||
ExistsCondition,
|
ExistsCondition,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
from typing import cast
|
from typing import cast
|
||||||
|
|
||||||
from .model import Workflow
|
from .models import Workflow
|
||||||
from .run_state import RuntimeContext
|
from .run_state import RuntimeContext
|
||||||
from .tokens import END
|
from .tokens import END
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
"""Compatibility shim for runtime flow operations."""
|
|
||||||
|
|
||||||
from wf_core.runtime.ops.flow import * # noqa: F403
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
"""Compatibility shim for foreach runtime operations."""
|
|
||||||
|
|
||||||
from wf_core.runtime.ops.foreach import * # noqa: F403
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
"""Compatibility shim for frame runtime operations."""
|
|
||||||
|
|
||||||
from wf_core.runtime.ops.frames import * # noqa: F403
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
"""Compatibility shim for interrupt runtime operations."""
|
|
||||||
|
|
||||||
from wf_core.runtime.ops.interrupts import * # noqa: F403
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
"""Compatibility facade for core workflow model objects."""
|
|
||||||
|
|
||||||
from wf_core.models import (
|
|
||||||
BinaryCondition,
|
|
||||||
Condition,
|
|
||||||
ConditionNode,
|
|
||||||
Edge,
|
|
||||||
ExistsCondition,
|
|
||||||
ForeachNode,
|
|
||||||
InterruptNode,
|
|
||||||
JoinNode,
|
|
||||||
LiteralOperand,
|
|
||||||
NodeDef,
|
|
||||||
NodeResult,
|
|
||||||
NodeUse,
|
|
||||||
NotCondition,
|
|
||||||
Operand,
|
|
||||||
PathOperand,
|
|
||||||
SchemaRef,
|
|
||||||
StateField,
|
|
||||||
StateSchema,
|
|
||||||
Step,
|
|
||||||
VariadicCondition,
|
|
||||||
Workflow,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
"BinaryCondition",
|
|
||||||
"Condition",
|
|
||||||
"ConditionNode",
|
|
||||||
"Edge",
|
|
||||||
"ExistsCondition",
|
|
||||||
"ForeachNode",
|
|
||||||
"InterruptNode",
|
|
||||||
"JoinNode",
|
|
||||||
"LiteralOperand",
|
|
||||||
"NodeDef",
|
|
||||||
"NodeResult",
|
|
||||||
"NodeUse",
|
|
||||||
"NotCondition",
|
|
||||||
"Operand",
|
|
||||||
"PathOperand",
|
|
||||||
"SchemaRef",
|
|
||||||
"StateField",
|
|
||||||
"StateSchema",
|
|
||||||
"Step",
|
|
||||||
"VariadicCondition",
|
|
||||||
"Workflow",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
import json
|
|
||||||
|
|
||||||
print(json.dumps(Workflow.model_json_schema(), indent=2))
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
"""Compatibility shim for node execution operations."""
|
|
||||||
|
|
||||||
from wf_core.runtime.ops.nodes import * # noqa: F403
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
"""Compatibility shim for run-state construction."""
|
|
||||||
|
|
||||||
from wf_core.runtime.ops.runs import * # noqa: F403
|
|
||||||
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from wf_core.model import Workflow
|
from wf_core.models import Workflow
|
||||||
from wf_core.runtime.ops.flow import finalize_run
|
from wf_core.runtime.ops.flow import finalize_run
|
||||||
from wf_core.runtime.ops.frames import collapse_completed_frames
|
from wf_core.runtime.ops.frames import collapse_completed_frames
|
||||||
from wf_core.runtime.ops.nodes import AsyncNodeHandler, NodeHandler
|
from wf_core.runtime.ops.nodes import AsyncNodeHandler, NodeHandler
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"""Executor-only operations used by `wf_core.runtime`.
|
"""Executor-only operations used by `wf_core.runtime`.
|
||||||
|
|
||||||
Root modules such as `wf_core.node_exec` remain as compatibility shims. New
|
This package owns the runtime implementation helpers: node execution, state
|
||||||
runtime internals should import from this package so the execution seam stays
|
writes, frame movement, foreach, interrupts, indexes, and schema checks.
|
||||||
easy to navigate.
|
Callers should use `wf_core.runtime` unless they are extending the executor.
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from wf_core.model import Workflow
|
from wf_core.models import Workflow
|
||||||
from wf_core.run_state import (
|
from wf_core.run_state import (
|
||||||
ExecutionFrame,
|
ExecutionFrame,
|
||||||
FrameStatus,
|
FrameStatus,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from wf_core.conditions import safe_resolve_path
|
from wf_core.conditions import safe_resolve_path
|
||||||
from wf_core.errors import WorkflowExecutionError
|
from wf_core.errors import WorkflowExecutionError
|
||||||
from wf_core.model import ForeachNode, Workflow
|
from wf_core.models import ForeachNode, Workflow
|
||||||
from wf_core.run_state import ExecutionFrame, FrameStatus, RunState, StepExecutionResult
|
from wf_core.run_state import ExecutionFrame, FrameStatus, RunState, StepExecutionResult
|
||||||
from wf_core.runtime.ops.flow import advance_frame, append_step_result_trace
|
from wf_core.runtime.ops.flow import advance_frame, append_step_result_trace
|
||||||
from wf_core.runtime.ops.frames import frame_context_values
|
from wf_core.runtime.ops.frames import frame_context_values
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from wf_core.conditions import eval_condition
|
from wf_core.conditions import eval_condition
|
||||||
from wf_core.model import ConditionNode, InterruptNode
|
from wf_core.models import ConditionNode, InterruptNode
|
||||||
from wf_core.run_state import FrameStatus, RunState, RunStatus, StepExecutionResult
|
from wf_core.run_state import FrameStatus, RunState, RunStatus, StepExecutionResult
|
||||||
from wf_core.runtime.ops.flow import append_trace
|
from wf_core.runtime.ops.flow import append_trace
|
||||||
from wf_core.runtime.ops.frames import frame_context_values
|
from wf_core.runtime.ops.frames import frame_context_values
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from dataclasses import dataclass
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from wf_core.errors import WorkflowExecutionError
|
from wf_core.errors import WorkflowExecutionError
|
||||||
from wf_core.model import NodeDef, Workflow
|
from wf_core.models import NodeDef, Workflow
|
||||||
|
|
||||||
|
|
||||||
@dataclass(slots=True)
|
@dataclass(slots=True)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from typing import Any
|
|||||||
|
|
||||||
from wf_core.conditions import safe_resolve_path
|
from wf_core.conditions import safe_resolve_path
|
||||||
from wf_core.errors import WorkflowExecutionError
|
from wf_core.errors import WorkflowExecutionError
|
||||||
from wf_core.model import InterruptNode, Workflow
|
from wf_core.models import InterruptNode, Workflow
|
||||||
from wf_core.run_state import InterruptRequest, RunState, StepExecutionResult
|
from wf_core.run_state import InterruptRequest, RunState, StepExecutionResult
|
||||||
from wf_core.runtime.ops.flow import advance_frame, append_step_result_trace
|
from wf_core.runtime.ops.flow import advance_frame, append_step_result_trace
|
||||||
from wf_core.runtime.ops.index import WorkflowIndex
|
from wf_core.runtime.ops.index import WorkflowIndex
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from typing import Any, cast
|
|||||||
|
|
||||||
from wf_core.conditions import safe_resolve_path
|
from wf_core.conditions import safe_resolve_path
|
||||||
from wf_core.errors import WorkflowExecutionError
|
from wf_core.errors import WorkflowExecutionError
|
||||||
from wf_core.model import NodeDef, NodeResult, NodeUse, Workflow
|
from wf_core.models import NodeDef, NodeResult, NodeUse, Workflow
|
||||||
from wf_core.run_state import RunState, RuntimeContext, StepExecutionResult
|
from wf_core.run_state import RunState, RuntimeContext, StepExecutionResult
|
||||||
from wf_core.runtime.ops.frames import frame_context_values
|
from wf_core.runtime.ops.frames import frame_context_values
|
||||||
from wf_core.runtime.ops.schemas import validate_payload_against_schema
|
from wf_core.runtime.ops.schemas import validate_payload_against_schema
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
from wf_core.model import Workflow
|
from wf_core.models import Workflow
|
||||||
from wf_core.run_state import ExecutionFrame, FrameStatus, RunState, RunStatus
|
from wf_core.run_state import ExecutionFrame, FrameStatus, RunState, RunStatus
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from wf_core.errors import WorkflowExecutionError
|
from wf_core.errors import WorkflowExecutionError
|
||||||
from wf_core.model import NodeUse, Workflow
|
from wf_core.models import NodeUse, Workflow
|
||||||
from wf_core.paths import (
|
from wf_core.paths import (
|
||||||
PathResolutionError,
|
PathResolutionError,
|
||||||
get_nested_value,
|
get_nested_value,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from wf_core.errors import WorkflowExecutionError
|
from wf_core.errors import WorkflowExecutionError
|
||||||
from wf_core.model import Workflow
|
from wf_core.models import Workflow
|
||||||
from wf_core.runtime.ops.frames import collapse_completed_frames
|
from wf_core.runtime.ops.frames import collapse_completed_frames
|
||||||
from wf_core.runtime.ops.index import WorkflowIndex, build_workflow_index
|
from wf_core.runtime.ops.index import WorkflowIndex, build_workflow_index
|
||||||
from wf_core.runtime.ops.interrupts import resume_interrupt
|
from wf_core.runtime.ops.interrupts import resume_interrupt
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from collections.abc import Mapping
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from wf_core.errors import WorkflowExecutionError
|
from wf_core.errors import WorkflowExecutionError
|
||||||
from wf_core.model import (
|
from wf_core.models import (
|
||||||
ConditionNode,
|
ConditionNode,
|
||||||
ForeachNode,
|
ForeachNode,
|
||||||
InterruptNode,
|
InterruptNode,
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
"""Compatibility shim for runtime schema validation helpers."""
|
|
||||||
|
|
||||||
from wf_core.runtime.ops.schemas import * # noqa: F403
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
"""Compatibility shim for state mutation operations."""
|
|
||||||
|
|
||||||
from wf_core.runtime.ops.state import * # noqa: F403
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
"""Compatibility shim for non-node step handlers."""
|
|
||||||
|
|
||||||
from wf_core.runtime.ops.handlers import * # noqa: F403
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
"""Compatibility facade for workflow validation."""
|
|
||||||
|
|
||||||
from wf_core.validation import (
|
|
||||||
ValidationIssue,
|
|
||||||
ValidationIssueCode,
|
|
||||||
ValidationReport,
|
|
||||||
validate_workflow,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
"ValidationIssue",
|
|
||||||
"ValidationIssueCode",
|
|
||||||
"ValidationReport",
|
|
||||||
"validate_workflow",
|
|
||||||
]
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from wf_core.model import (
|
from wf_core.models import (
|
||||||
ConditionNode,
|
ConditionNode,
|
||||||
Edge,
|
Edge,
|
||||||
ForeachNode,
|
ForeachNode,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from wf_core.model import Edge, InterruptNode, NodeDef, NodeUse, Step
|
from wf_core.models import Edge, InterruptNode, NodeDef, NodeUse, Step
|
||||||
from wf_core.tokens import END
|
from wf_core.tokens import END
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from wf_core.model import (
|
from wf_core.models import (
|
||||||
BinaryCondition,
|
BinaryCondition,
|
||||||
Condition,
|
Condition,
|
||||||
ConditionNode,
|
ConditionNode,
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
"""Compatibility shim for workflow index helpers."""
|
|
||||||
|
|
||||||
from wf_core.runtime.ops.index import * # noqa: F403
|
|
||||||
@@ -12,7 +12,7 @@ from wf_core import (
|
|||||||
step_workflow,
|
step_workflow,
|
||||||
)
|
)
|
||||||
from wf_core.demo_workflow import build_demo_registry, build_demo_workflow
|
from wf_core.demo_workflow import build_demo_registry, build_demo_workflow
|
||||||
from wf_core.run_factory import create_run_state
|
from wf_core.runtime.ops.runs import create_run_state
|
||||||
from wf_authoring import (
|
from wf_authoring import (
|
||||||
NodeReturn,
|
NodeReturn,
|
||||||
WorkflowBuilder,
|
WorkflowBuilder,
|
||||||
|
|||||||
Reference in New Issue
Block a user