|
| 1 | +""" |
| 2 | +Canonical `event_type` strings accepted by the platform runtime ingest API and |
| 3 | +emitted by the runtime forwarder. |
| 4 | +
|
| 5 | +**Single source of truth for Python.** Mirror: |
| 6 | +`platform/services/api/internal/contracts/runtime_events.go` |
| 7 | +""" |
| 8 | + |
| 9 | +from __future__ import annotations |
| 10 | + |
| 11 | + |
| 12 | +class PlatformEventType: |
| 13 | + """Platform SSE / run_events.event_type values (string constants only).""" |
| 14 | + |
| 15 | + RUN_STARTED = "run_started" |
| 16 | + STEP_STARTED = "step_started" |
| 17 | + STEP_COMPLETED = "step_completed" |
| 18 | + AGENT_STARTED = "agent_started" |
| 19 | + AGENT_FINISHED = "agent_finished" |
| 20 | + RUN_PROGRESS = "run_progress" |
| 21 | + TOOL_CALLED = "tool_called" |
| 22 | + RUN_COMPLETED = "run_completed" |
| 23 | + RUN_FAILED = "run_failed" |
| 24 | + CLARIFICATION_REQUESTED = "clarification_requested" |
| 25 | + CLARIFICATION_ANSWERED = "clarification_answered" |
| 26 | + RUN_PAUSED = "run_paused" |
| 27 | + RUN_RESUMED = "run_resumed" |
| 28 | + LOG = "log" |
| 29 | + EXECUTION_GRAPH_UPDATED = "EXECUTION_GRAPH_UPDATED" |
| 30 | + SPECULATIVE_TASK_STARTED = "SPECULATIVE_TASK_STARTED" |
| 31 | + SPECULATIVE_TASK_CANCELLED = "SPECULATIVE_TASK_CANCELLED" |
| 32 | + HITL_REQUESTED = "HITL_REQUESTED" |
| 33 | + HITL_RESOLVED = "HITL_RESOLVED" |
| 34 | + WORKER_ASSIGNED = "WORKER_ASSIGNED" |
| 35 | + AGENT_POOL_USED = "AGENT_POOL_USED" |
| 36 | + EXECUTOR_FINISHED = "executor_finished" |
| 37 | + |
| 38 | + |
| 39 | +# DevSper `events` enum value (as string) -> platform ingest type |
| 40 | +DEVSPER_TO_PLATFORM: dict[str, str] = { |
| 41 | + "swarm_started": PlatformEventType.RUN_STARTED, |
| 42 | + "executor_started": PlatformEventType.RUN_STARTED, |
| 43 | + "task_started": PlatformEventType.STEP_STARTED, |
| 44 | + "task_completed": PlatformEventType.STEP_COMPLETED, |
| 45 | + "agent_started": PlatformEventType.AGENT_STARTED, |
| 46 | + "agent_finished": PlatformEventType.AGENT_FINISHED, |
| 47 | + "run_completed": PlatformEventType.RUN_COMPLETED, |
| 48 | + "task_failed": PlatformEventType.RUN_FAILED, |
| 49 | + "run_failed": PlatformEventType.RUN_FAILED, |
| 50 | + "tool_called": PlatformEventType.TOOL_CALLED, |
| 51 | + "clarification_requested": PlatformEventType.CLARIFICATION_REQUESTED, |
| 52 | + "clarification_needed": PlatformEventType.CLARIFICATION_REQUESTED, |
| 53 | + "clarification_received": PlatformEventType.CLARIFICATION_ANSWERED, |
| 54 | + "planner_started": PlatformEventType.RUN_PROGRESS, |
| 55 | + "planner_finished": PlatformEventType.RUN_PROGRESS, |
| 56 | + "reasoning_node_added": PlatformEventType.RUN_PROGRESS, |
| 57 | + "budget_warning": PlatformEventType.RUN_PROGRESS, |
| 58 | + "task_created": PlatformEventType.RUN_PROGRESS, |
| 59 | + "task_model_selected": PlatformEventType.RUN_PROGRESS, |
| 60 | + "agent_broadcast": PlatformEventType.RUN_PROGRESS, |
| 61 | + "run_manifest_emitted": PlatformEventType.RUN_PROGRESS, |
| 62 | + "worker_assigned": PlatformEventType.WORKER_ASSIGNED, |
| 63 | + "speculative_started": PlatformEventType.SPECULATIVE_TASK_STARTED, |
| 64 | + "speculative_cancelled": PlatformEventType.SPECULATIVE_TASK_CANCELLED, |
| 65 | + "hitl_requested": PlatformEventType.HITL_REQUESTED, |
| 66 | + "hitl_resolved": PlatformEventType.HITL_RESOLVED, |
| 67 | + "executor_finished": PlatformEventType.EXECUTOR_FINISHED, |
| 68 | +} |
0 commit comments