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>
This commit is contained in:
rayhpeng
2026-04-22 11:28:01 +08:00
parent 39a575617b
commit 9d0a42c1fb
43 changed files with 3928 additions and 1192 deletions
@@ -1,16 +1,48 @@
"""Run lifecycle management for LangGraph Platform API compatibility."""
"""Public runs API."""
from .manager import ConflictError, RunManager, RunRecord, UnsupportedStrategyError
from .schemas import DisconnectMode, RunStatus
from .worker import RunContext, run_agent
from .facade import RunsFacade
from .internal.manager import RunManager
from .observer import (
CallbackObserver,
CompositeObserver,
LifecycleEventType,
NullObserver,
ObserverBinding,
ObserverLike,
RunEventCallback,
RunLifecycleEvent,
RunObserver,
RunResult,
ensure_observer,
)
from .store import RunCreateStore, RunDeleteStore, RunEventStore, RunQueryStore
from .types import CancelAction, RunRecord, RunScope, RunSpec, RunStatus, WaitResult
__all__ = [
"ConflictError",
"DisconnectMode",
"RunContext",
# facade
"RunsFacade",
"RunManager",
"RunCreateStore",
"RunDeleteStore",
"RunEventStore",
"RunQueryStore",
# hooks
"CallbackObserver",
"CompositeObserver",
"LifecycleEventType",
"NullObserver",
"ObserverBinding",
"ObserverLike",
"RunEventCallback",
"RunLifecycleEvent",
"RunObserver",
"RunResult",
"ensure_observer",
# types
"CancelAction",
"RunRecord",
"RunScope",
"RunSpec",
"WaitResult",
"RunStatus",
"UnsupportedStrategyError",
"run_agent",
]