Fix 422 on agent trigger: accept plural data type names

AgentTriggerRequest.what_to_extract now accepts list[str] instead of
strict Literal values. _to_data_types normalises all FE variants
(tasks/task, notes/note, timelines/timeline/timelineEvents,
projects/project) to the canonical plural form the runner expects,
with deduplication.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Roberto Musso
2026-03-18 00:04:29 +01:00
parent 5a03bd1cfb
commit 297e20ce8d
2 changed files with 14 additions and 10 deletions

View File

@@ -295,11 +295,8 @@ class AgentCreationCheckResponse(BaseModel):
class AgentTriggerRequest(BaseModel):
directory: str = Field(min_length=1)
device_id: str = Field(default="")
what_to_extract: list[Literal["task", "note", "timeline", "project"]] = Field(min_length=1)
actions_by_type: dict[
Literal["task", "note", "timeline", "project"],
list[Literal["add", "update"]],
] | None = None
what_to_extract: list[str] = Field(min_length=1)
actions_by_type: dict[str, list[str]] | None = None
batch_interval: str = Field(min_length=1)
custom_agent_prompt: str = Field(min_length=1)
active_agents: int = Field(ge=0, default=0)