Update DESIGN.md, TECHNICAL.md, and TODO.md for Delivery Context Enhancements
- Revised DESIGN.md to update the DeliveryRequest structure, replacing exec_id with member_id and adding context for execution_id and trigger. - Expanded TECHNICAL.md to clarify the DeliveryContext structure, including detailed comments on RobotID and MemberID for better understanding of their roles. - Updated TODO.md to reflect changes in the execution record model, ensuring accurate tracking of the new fields and their implications for delivery processes. - Enhanced documentation to improve clarity on the updated context and execution tracking, facilitating better developer understanding and implementation.
This commit is contained in:
parent
b64f4c8930
commit
e0c7a51a2b
3 changed files with 57 additions and 35 deletions
|
|
@ -504,7 +504,7 @@ P4 generates delivery content and pushes to Delivery Center. **Agent only genera
|
|||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ DeliveryRequest │
|
||||
│ - Content: Summary, Body, Attachments │
|
||||
│ - Context: robot_id, exec_id, trigger_type, team_id │
|
||||
│ - Context: robot_id, member_id, execution_id, trigger, team│
|
||||
│ (No Channels - Delivery Center decides) │
|
||||
└─────────────────────┬───────────────────────────────────────┘
|
||||
│
|
||||
|
|
@ -554,7 +554,8 @@ type DeliveryAttachment struct {
|
|||
|
||||
// DeliveryContext - tracking and audit info
|
||||
type DeliveryContext struct {
|
||||
RobotID string `json:"robot_id"`
|
||||
RobotID string `json:"robot_id"` // Robot config ID
|
||||
MemberID string `json:"member_id"` // Robot member ID (user identity)
|
||||
ExecutionID string `json:"execution_id"`
|
||||
TriggerType TriggerType `json:"trigger_type"`
|
||||
TeamID string `json:"team_id"`
|
||||
|
|
@ -759,6 +760,7 @@ const (
|
|||
ExecRunning ExecStatus = "running"
|
||||
ExecCompleted ExecStatus = "completed"
|
||||
ExecFailed ExecStatus = "failed"
|
||||
ExecCancelled ExecStatus = "cancelled"
|
||||
)
|
||||
|
||||
// RobotStatus - matches __yao.member.robot_status enum
|
||||
|
|
|
|||
|
|
@ -1237,7 +1237,8 @@ func (r *Robot) GetExecutions() []*Execution {
|
|||
// Relationship: 1 Execution = 1 job.Job
|
||||
type Execution struct {
|
||||
ID string `json:"id"` // unique execution ID
|
||||
MemberID string `json:"member_id"` // robot member ID
|
||||
RobotID string `json:"robot_id"` // robot config ID
|
||||
MemberID string `json:"member_id"` // robot member ID (user identity)
|
||||
TeamID string `json:"team_id"`
|
||||
TriggerType TriggerType `json:"trigger_type"` // clock | human | event
|
||||
StartTime time.Time `json:"start_time"`
|
||||
|
|
@ -1425,7 +1426,8 @@ type DeliveryAttachment struct {
|
|||
|
||||
// DeliveryContext - tracking and audit info
|
||||
type DeliveryContext struct {
|
||||
RobotID string `json:"robot_id"`
|
||||
RobotID string `json:"robot_id"` // Robot config ID
|
||||
MemberID string `json:"member_id"` // Robot member ID (user identity)
|
||||
ExecutionID string `json:"execution_id"`
|
||||
TriggerType TriggerType `json:"trigger_type"`
|
||||
TeamID string `json:"team_id"`
|
||||
|
|
@ -1997,12 +1999,11 @@ P4 Delivery summarizes P3 execution results and delivers to configured channels.
|
|||
┌────────────┴────────────┐
|
||||
▼ ▼
|
||||
┌─────────────────┐ ┌─────────────────┐
|
||||
│ Delivery Agent │ │ Channel Handlers │
|
||||
│ - Summarize │ │ - Email │
|
||||
│ - Format body │ │ - Webhook │
|
||||
│ - List files │ │ - Notify │
|
||||
└─────────────────┘ │ - File │
|
||||
└─────────────────┘
|
||||
│ Delivery Agent │ │ Delivery Center │
|
||||
│ - Summarize │ │ - sendEmail() │
|
||||
│ - Format body │ │ - postWebhook() │
|
||||
│ - List files │ │ - callProcess() │
|
||||
└─────────────────┘ └─────────────────┘
|
||||
```
|
||||
|
||||
### 6.2 Delivery Request Structure
|
||||
|
|
@ -2035,7 +2036,8 @@ type DeliveryAttachment struct {
|
|||
|
||||
// DeliveryContext - tracking and audit info
|
||||
type DeliveryContext struct {
|
||||
RobotID string `json:"robot_id"`
|
||||
RobotID string `json:"robot_id"` // Robot config ID
|
||||
MemberID string `json:"member_id"` // Robot member ID (user identity)
|
||||
ExecutionID string `json:"execution_id"`
|
||||
TriggerType TriggerType `json:"trigger_type"`
|
||||
TeamID string `json:"team_id"`
|
||||
|
|
@ -2052,7 +2054,8 @@ type DeliveryContext struct {
|
|||
"attachments": [{"title": "Report.pdf", "file": "__yao.attachment://abc123"}]
|
||||
},
|
||||
"context": {
|
||||
"robot_id": "mem_abc123",
|
||||
"robot_id": "robot_sales_001",
|
||||
"member_id": "mem_abc123",
|
||||
"execution_id": "exec_xyz789",
|
||||
"trigger_type": "clock",
|
||||
"team_id": "team_123"
|
||||
|
|
@ -2351,20 +2354,30 @@ Robot execution history is stored in `__yao.agent_execution` table for UI displa
|
|||
|
||||
type ExecutionRecord struct {
|
||||
ID string `json:"id"` // Execution ID
|
||||
MemberID string `json:"member_id"` // Robot member ID
|
||||
RobotID string `json:"robot_id"` // Robot config ID
|
||||
MemberID string `json:"member_id"` // Robot member ID (user identity)
|
||||
TeamID string `json:"team_id"` // Team ID
|
||||
JobID string `json:"job_id"` // Linked job.Job ID
|
||||
TriggerType TriggerType `json:"trigger_type"` // clock | human | event
|
||||
|
||||
// Status tracking (synced with runtime Execution)
|
||||
Status ExecStatus `json:"status"` // pending | running | completed | failed
|
||||
Phase Phase `json:"phase"` // Current phase
|
||||
Current *CurrentState `json:"current"` // Current executing state (task index, progress)
|
||||
Error string `json:"error"` // Error message if failed
|
||||
|
||||
// Trigger input
|
||||
Input *TriggerInput `json:"input"` // Original trigger input
|
||||
|
||||
// Phase outputs (P0-P5)
|
||||
Inspiration *InspirationReport `json:"inspiration"` // P0 result
|
||||
Goals *Goals `json:"goals"` // P1 result
|
||||
Tasks []Task `json:"tasks"` // P2 result
|
||||
Results []TaskResult `json:"results"` // P3 results
|
||||
Delivery *DeliveryResult `json:"delivery"` // P4 result
|
||||
Learning []LearningEntry `json:"learning"` // P5 entries
|
||||
Error string `json:"error"` // Error message if failed
|
||||
|
||||
// Timestamps
|
||||
StartTime time.Time `json:"start_time"`
|
||||
EndTime *time.Time `json:"end_time"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
|
|
@ -2391,9 +2404,10 @@ type ExecutionStore interface {
|
|||
}
|
||||
|
||||
type ListOptions struct {
|
||||
MemberID string // Filter by robot
|
||||
TeamID string // Filter by team
|
||||
Status ExecStatus // Filter by status
|
||||
RobotID string // Filter by robot config ID
|
||||
MemberID string // Filter by robot member ID
|
||||
TeamID string // Filter by team
|
||||
Status ExecStatus // Filter by status
|
||||
TriggerType TriggerType // Filter by trigger
|
||||
Page int
|
||||
PageSize int
|
||||
|
|
|
|||
|
|
@ -875,24 +875,29 @@ Created new `yao/assert` package for universal assertion/validation:
|
|||
|
||||
- [ ] `yao/models/agent/execution.mod.yao` - Execution record model (`agent_execution` table)
|
||||
- [ ] id, execution_id (unique)
|
||||
- [ ] member_id, team_id, job_id
|
||||
- [ ] robot_id, member_id, team_id, job_id
|
||||
- [ ] trigger_type (enum: clock, human, event)
|
||||
- [ ] status (enum: pending, running, completed, failed, cancelled)
|
||||
- [ ] phase (enum: inspiration, goals, tasks, run, delivery, learning)
|
||||
- [ ] start_time, end_time, error
|
||||
- [ ] **Status tracking** (synced with runtime Execution):
|
||||
- [ ] status (enum: pending, running, completed, failed, cancelled)
|
||||
- [ ] phase (enum: inspiration, goals, tasks, run, delivery, learning)
|
||||
- [ ] current (JSON) - current executing state (task_index, progress)
|
||||
- [ ] error - error message if failed
|
||||
- [ ] input (JSON) - trigger input
|
||||
- [ ] inspiration (JSON) - P0 output
|
||||
- [ ] goals (JSON) - P1 output
|
||||
- [ ] tasks (JSON) - P2 output
|
||||
- [ ] results (JSON) - P3 output
|
||||
- [ ] delivery (JSON) - P4 output
|
||||
- [ ] learning (JSON) - P5 output
|
||||
- [ ] **Phase outputs** (P0-P5):
|
||||
- [ ] inspiration (JSON) - P0 output
|
||||
- [ ] goals (JSON) - P1 output
|
||||
- [ ] tasks (JSON) - P2 output
|
||||
- [ ] results (JSON) - P3 output
|
||||
- [ ] delivery (JSON) - P4 output
|
||||
- [ ] learning (JSON) - P5 output
|
||||
- [ ] **Timestamps**: start_time, end_time, created_at, updated_at
|
||||
- [ ] Relations: member (hasOne __yao.member)
|
||||
- [ ] `agent/robot/store/execution.go` - Execution record storage
|
||||
- [ ] `SaveExecution()` - save/update execution record
|
||||
- [ ] `GetExecution()` - get execution by ID
|
||||
- [ ] `ListExecutions()` - query execution history by member_id
|
||||
- [ ] Integrate into Executor - update record after each phase
|
||||
- [ ] `Save(ctx, record)` - create or update execution record
|
||||
- [ ] `Get(ctx, execID)` - get execution by ID
|
||||
- [ ] `List(ctx, opts)` - query execution history with filters
|
||||
- [ ] `UpdatePhase(ctx, execID, phase, data)` - update current phase and data
|
||||
- [ ] Integrate into Executor - call `UpdatePhase()` after each phase completes
|
||||
|
||||
### 10.2 Messenger Attachment Support ✅
|
||||
|
||||
|
|
@ -968,10 +973,11 @@ type DeliveryAttachment struct {
|
|||
|
||||
// DeliveryContext - tracking info
|
||||
type DeliveryContext struct {
|
||||
RobotID string `json:"robot_id"`
|
||||
ExecutionID string `json:"execution_id"`
|
||||
TriggerType string `json:"trigger_type"`
|
||||
TeamID string `json:"team_id"`
|
||||
RobotID string `json:"robot_id"` // Robot config ID
|
||||
MemberID string `json:"member_id"` // Robot member ID (user identity)
|
||||
ExecutionID string `json:"execution_id"`
|
||||
TriggerType TriggerType `json:"trigger_type"` // clock | human | event
|
||||
TeamID string `json:"team_id"`
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue