rayhpeng 376c272f52 refactor(schedule): drop the UNSET sentinel for plain None defaults
Every top-level update field is non-nullable as a business value, so
None can safely double as "not supplied" -- the one field whose None is
meaningful, thread_id, already travels inside ContextChange where it is
unambiguous. The UnsetType singleton solved a three-state problem this
command does not currently have; plain `| None = None` reads better.

The constraint is documented on UpdateScheduledTask: a future field
whose None is meaningful must ride inside a small change object the way
thread_id does, rather than reintroducing a second convention.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-31 17:16:42 +08:00

84 lines
2.0 KiB
Python

"""Schedule bounded context: standing instructions to run a prompt on time.
Public API of the context. Import domain objects, commands, errors, and the
service from here; import ports from `deerflow.domain.schedule.ports` -- they
are contracts consumed by adapters and tests, not everyday call-site symbols.
"""
from deerflow.domain.schedule.commands import (
ContextChange,
CreateScheduledTask,
DeleteTask,
PauseTask,
ResumeTask,
TriggerTask,
UpdateScheduledTask,
)
from deerflow.domain.schedule.exceptions import (
ActiveRunConflictError,
ConcurrentUpdateError,
CorruptStoredScheduleError,
InvalidContextModeError,
InvalidScheduleError,
LaunchFailedError,
LaunchIndeterminateError,
ScheduleError,
TaskNotFoundError,
TaskNotMutableError,
ThreadBusyError,
ThreadNotFoundError,
)
from deerflow.domain.schedule.model import (
ACTIVE_RUN_STATUSES,
TERMINAL_RUN_STATUSES,
TERMINAL_TASK_STATUSES,
ContextMode,
DispatchOutcome,
RunStatus,
ScheduledRun,
ScheduledTask,
SchedulePolicy,
ScheduleSpec,
ScheduleType,
TaskStatus,
TriggerKind,
)
from deerflow.domain.schedule.service import DispatchResult, ScheduleService
__all__ = [
"ACTIVE_RUN_STATUSES",
"TERMINAL_RUN_STATUSES",
"TERMINAL_TASK_STATUSES",
"ActiveRunConflictError",
"ConcurrentUpdateError",
"ContextChange",
"ContextMode",
"CorruptStoredScheduleError",
"CreateScheduledTask",
"DeleteTask",
"DispatchOutcome",
"DispatchResult",
"InvalidContextModeError",
"InvalidScheduleError",
"LaunchFailedError",
"LaunchIndeterminateError",
"PauseTask",
"ResumeTask",
"RunStatus",
"ScheduleError",
"SchedulePolicy",
"ScheduleService",
"ScheduleSpec",
"ScheduleType",
"ScheduledRun",
"ScheduledTask",
"TaskNotFoundError",
"TaskNotMutableError",
"TaskStatus",
"ThreadBusyError",
"ThreadNotFoundError",
"TriggerKind",
"TriggerTask",
"UpdateScheduledTask",
]