File size: 2,595 Bytes
1dd3485
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.

"""

Data models for the Smart Personal Task Manager OpenEnv Environment.



Supports three difficulty levels:

  Easy   - add tasks & list them

  Medium - priorities + deadlines; complete High-priority tasks before deadline

  Hard   - priorities + deadlines + dependencies; complete in valid topological order

"""

from typing import Optional, List, Dict, Any
from openenv.core.env_server.types import Action, Observation
from pydantic import Field


class TaskManagerAction(Action):
    """Action for the Smart Personal Task Manager."""

    command: str = Field(
        ...,
        description=(
            "Command to execute. One of: 'add', 'complete', 'list'. "
            "'add' - create a new task. "
            "'complete' - mark an existing task as done. "
            "'list' - display all current tasks."
        ),
    )
    title: Optional[str] = Field(
        default=None,
        description="Human-readable task title. Required for 'add' and 'complete'.",
    )
    priority: Optional[str] = Field(
        default="Normal",
        description="Task priority. One of: 'Low', 'Normal', 'High'. Used for 'add'.",
    )
    deadline: Optional[str] = Field(
        default=None,
        description=(
            "Optional ISO-8601 date string (YYYY-MM-DD) indicating when the task "
            "must be completed. Used for 'add'. Relevant in Medium and Hard modes."
        ),
    )
    depends_on: Optional[List[str]] = Field(
        default=None,
        description=(
            "List of task titles that must be completed BEFORE this task can be "
            "completed. Used for 'add'. Relevant in Hard mode only."
        ),
    )


class TaskManagerObservation(Observation):
    """Observation returned after each step in the Task Manager."""

    success: bool = Field(default=True, description="Whether the last action succeeded.")
    message: str = Field(default="", description="System status message or error description.")
    tasks: List[Dict[str, Any]] = Field(
        default_factory=list,
        description=(
            "Snapshot of all tasks. Each entry contains: "
            "title, priority, deadline, depends_on, completed, "
            "deadline_missed (bool), dependency_violation (bool)."
        ),
    )
    violations: List[str] = Field(
        default_factory=list,
        description="List of rule violations encountered this episode (deadline misses, dependency order errors).",
    )