0abf51e837
- Add consumer_registry and pipeline_registry for runtime orchestration - Add Visibility schema for message filtering - Add PipelineSpec for agent pipeline configuration - Add automation job models and configuration - Remove memory_prompt.py (consolidated into memory system) - Update runtime components: context_loader, context_service, orchestrator, runner, tasks - Update toolkit: tool_config, tool_middleware, custom tools (calendar, user_lookup) - Add auth_helpers and calendar_domain utilities - Add system_agents.yaml configuration
74 lines
1.9 KiB
Python
74 lines
1.9 KiB
Python
from __future__ import annotations
|
|
|
|
import uuid
|
|
from datetime import datetime
|
|
from enum import Enum
|
|
|
|
from sqlalchemy import DateTime, JSON, String
|
|
from sqlalchemy.dialects.postgresql import JSONB, UUID
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from core.db.base import Base, SoftDeleteMixin, TimestampMixin
|
|
|
|
|
|
class AutomationJobStatus(str, Enum):
|
|
ACTIVE = "active"
|
|
DISABLED = "disabled"
|
|
|
|
|
|
class ScheduleType(str, Enum):
|
|
DAILY = "daily"
|
|
WEEKLY = "weekly"
|
|
|
|
|
|
class AutomationJob(TimestampMixin, SoftDeleteMixin, Base):
|
|
__tablename__: str = "automation_jobs"
|
|
__table_args__ = {"extend_existing": True}
|
|
|
|
id: Mapped[uuid.UUID] = mapped_column(
|
|
UUID(as_uuid=True), primary_key=True, default=uuid.uuid4
|
|
)
|
|
owner_id: Mapped[uuid.UUID] = mapped_column(
|
|
UUID(as_uuid=True),
|
|
nullable=False,
|
|
)
|
|
title: Mapped[str] = mapped_column(
|
|
String(255),
|
|
nullable=False,
|
|
)
|
|
config: Mapped[dict[str, object]] = mapped_column(
|
|
JSON().with_variant(JSONB, "postgresql"),
|
|
nullable=False,
|
|
default=dict,
|
|
)
|
|
schedule_type: Mapped[ScheduleType] = mapped_column(
|
|
String(20),
|
|
nullable=False,
|
|
)
|
|
run_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True),
|
|
nullable=False,
|
|
)
|
|
next_run_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True),
|
|
nullable=False,
|
|
)
|
|
timezone: Mapped[str] = mapped_column(
|
|
String(50),
|
|
nullable=False,
|
|
default="UTC",
|
|
)
|
|
last_run_at: Mapped[datetime | None] = mapped_column(
|
|
DateTime(timezone=True),
|
|
nullable=True,
|
|
)
|
|
status: Mapped[AutomationJobStatus] = mapped_column(
|
|
String(20),
|
|
nullable=False,
|
|
default=AutomationJobStatus.ACTIVE,
|
|
)
|
|
created_by: Mapped[uuid.UUID | None] = mapped_column(
|
|
UUID(as_uuid=True),
|
|
nullable=True,
|
|
)
|