Spaces:
Sleeping
Sleeping
File size: 1,667 Bytes
b9f4b13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | """
Common domain enumerations and execution event models.
"""
from __future__ import annotations
from datetime import datetime, timezone
from enum import Enum
from typing import Literal
from uuid import UUID
from pydantic import BaseModel, Field
class DataSource(str, Enum):
"""Origin of a pain point or research evidence."""
REDDIT = "reddit"
HACKERNEWS = "hackernews"
PRODUCTHUNT = "producthunt"
WEB = "web"
YOUTUBE = "youtube"
class Verdict(str, Enum):
"""Scorer recommendation for an idea."""
PURSUE = "pursue"
EXPLORE = "explore"
PARK = "park"
class TargetAgent(str, Enum):
"""Target agent for a reflection revision cycle."""
PAIN_POINT_MINER = "pain_point_miner"
IDEA_GENERATOR = "idea_generator"
PITCH_WRITER = "pitch_writer"
class PipelineStage(str, Enum):
"""Execution lifecycle stage of the discovery pipeline."""
IDLE = "idle"
MINING = "mining"
GENERATING = "generating"
SCORING = "scoring"
WRITING = "writing"
CRITIQUING = "critiquing"
REVISING = "revising"
COMPLETED = "completed"
FAILED = "failed"
CANCELLED = "cancelled"
class RunEvent(BaseModel):
"""High-level event emitted during a pipeline run for UI/logging."""
timestamp: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
agent: str
stage: PipelineStage
kind: Literal["info", "warning", "error"] = "info"
message: str
idea_id: UUID | None = None
class ErrorEntry(BaseModel):
"""Structured error log entry."""
timestamp: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
agent: str
error: str
|