feat(automations): implement model eligibility checks for automation creation

- Added model eligibility checks to ensure automations can only use billable models (premium or BYOK).
- Introduced new API endpoint to report model eligibility status for search spaces.
- Updated frontend components to display eligibility alerts and disable creation options when models are not billable.
- Enhanced automation creation forms to reflect model eligibility, preventing users from submitting invalid configurations.
- Implemented server-side logic to capture and preserve model preferences across automation edits, ensuring consistent behavior during execution.
This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-05-29 03:13:46 -07:00
parent 5d90fbe99f
commit 409fec94c3
32 changed files with 1451 additions and 67 deletions

View file

@ -2,7 +2,7 @@
from __future__ import annotations
from .envelope import AutomationDefinition
from .envelope import AutomationDefinition, AutomationModels
from .execution import Execution
from .inputs import Inputs
from .metadata import Metadata
@ -11,6 +11,7 @@ from .trigger_spec import TriggerSpec
__all__ = [
"AutomationDefinition",
"AutomationModels",
"Execution",
"Inputs",
"Metadata",

View file

@ -11,6 +11,21 @@ from .plan_step import PlanStep
from .trigger_spec import TriggerSpec
class AutomationModels(BaseModel):
"""Captured model profile for an automation.
Snapshotted from the search space's preferences at create time so runs are
insulated from later chat/search-space model changes. Config-id conventions
match the shared scheme (``0`` Auto, ``< 0`` global, ``> 0`` BYOK).
"""
model_config = ConfigDict(extra="forbid")
agent_llm_id: int = 0
image_generation_config_id: int = 0
vision_llm_config_id: int = 0
class AutomationDefinition(BaseModel):
"""Top-level shape of an automation."""
@ -24,3 +39,7 @@ class AutomationDefinition(BaseModel):
plan: list[PlanStep] = Field(..., min_length=1)
execution: Execution = Field(default_factory=Execution)
metadata: Metadata = Field(default_factory=Metadata)
# Captured server-side at create() and preserved across update(); resolved
# at runtime instead of the live search space. Optional so drafts/builder
# payloads validate without it.
models: AutomationModels | None = None