rayhpeng 9d0a42c1fb refactor(runtime): restructure runs module with new execution architecture
Major refactoring of deerflow/runtime/:
- runs/callbacks/ - new callback system (builder, events, title, tokens)
- runs/internal/ - execution internals (executor, supervisor, stream_logic, registry)
- runs/internal/execution/ - execution artifacts and events handling
- runs/facade.py - high-level run facade
- runs/observer.py - run observation protocol
- runs/types.py - type definitions
- runs/store/ - simplified store interfaces (create, delete, query, event)

Refactor stream_bridge/:
- Replace old providers with contract.py and exceptions.py
- Remove async_provider.py, base.py, memory.py

Add documentation:
- README.md and README_zh.md for runtime module

Remove deprecated:
- manager.py moved to internal/
- worker.py, schemas.py
- user_context.py

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-22 11:28:01 +08:00

103 lines
2.2 KiB
Python

"""LangGraph-compatible runtime — runs, streaming, and lifecycle management.
Re-exports the public API of :mod:`~deerflow.runtime.runs` and
:mod:`~deerflow.runtime.stream_bridge` so that consumers can import
directly from ``deerflow.runtime``.
"""
from .runs import (
CallbackObserver,
CompositeObserver,
CancelAction,
LifecycleEventType,
NullObserver,
ObserverBinding,
ObserverLike,
RunEventCallback,
RunCreateStore,
RunDeleteStore,
RunEventStore,
RunManager,
RunRecord,
RunQueryStore,
RunScope,
RunSpec,
RunLifecycleEvent,
RunObserver,
RunResult,
RunsFacade,
RunStatus,
WaitResult,
ensure_observer,
)
from .actor_context import (
AUTO,
ActorContext,
DEFAULT_USER_ID,
bind_actor_context,
get_actor_context,
get_effective_user_id,
require_actor_context,
reset_actor_context,
resolve_user_id,
)
from .serialization import serialize, serialize_channel_values, serialize_lc_object, serialize_messages_tuple
from .stream_bridge import (
CANCELLED_SENTINEL,
END_SENTINEL,
HEARTBEAT_SENTINEL,
StreamBridge,
StreamEvent,
StreamStatus,
)
__all__ = [
# runs - hooks
"RunsFacade",
"RunCreateStore",
"RunDeleteStore",
"RunEventStore",
"RunManager",
"RunQueryStore",
"CallbackObserver",
"CompositeObserver",
"ensure_observer",
"LifecycleEventType",
"NullObserver",
"ObserverBinding",
"ObserverLike",
"RunEventCallback",
"RunLifecycleEvent",
"RunObserver",
"RunResult",
# runs - types
"CancelAction",
"RunScope",
"RunSpec",
"WaitResult",
"RunRecord",
"RunStatus",
# actor context
"AUTO",
"ActorContext",
"DEFAULT_USER_ID",
"bind_actor_context",
"get_actor_context",
"get_effective_user_id",
"require_actor_context",
"reset_actor_context",
"resolve_user_id",
# serialization
"serialize",
"serialize_channel_values",
"serialize_lc_object",
"serialize_messages_tuple",
# stream_bridge
"CANCELLED_SENTINEL",
"END_SENTINEL",
"HEARTBEAT_SENTINEL",
"StreamBridge",
"StreamEvent",
"StreamStatus",
]