File size: 1,340 Bytes
38c9982
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from __future__ import annotations

from typing import Literal

from pydantic import BaseModel, Field


class EmailSummary(BaseModel):
    id: int
    sender: str
    subject: str
    snippet: str


class EmailDetail(BaseModel):
    id: int
    sender: str
    recipient: str
    subject: str
    body: str
    timestamp: str


class FileSearchResult(BaseModel):
    id: int
    filename: str
    snippet: str


class WorkspaceObservation(BaseModel):
    current_time: str
    unread_emails: list[EmailSummary]
    active_todos: list[str]
    last_action_status: str
    current_email: EmailDetail | None = None
    search_results: list[FileSearchResult] = Field(default_factory=list)
    action_history: list[str] = Field(default_factory=list)


class AssistantAction(BaseModel):
    action_type: Literal[
        "read_email",
        "reply",
        "forward",
        "add_todo",
        "archive",
        "search_files",
    ]
    target_id: int | None = None
    payload: str | None = None
    secondary_payload: str | None = None


class TaskReward(BaseModel):
    step_reward: float = Field(default=0.0)
    total_score: float = Field(default=0.0)
    is_done: bool = Field(default=False)
    reasoning: str = Field(default="")


class PolicyDecision(BaseModel):
    reasoning: str = Field(default="")
    action: AssistantAction