Update Task and Execution Structures for Enhanced Traceability
- Revised the Task struct in DESIGN.md to include an Input field for natural language descriptions and a Source field to indicate task origin (auto, human, event). - Updated the Execution struct in TECHNICAL.md to add an Input field for storing original trigger input, improving traceability of task execution. - Enhanced documentation for both structs to clarify their roles and improve overall understanding of the agent's task management and execution processes.
This commit is contained in:
parent
0cf0671503
commit
27bb499fbc
2 changed files with 34 additions and 12 deletions
|
|
@ -299,8 +299,9 @@ P2 Agent reads Goals markdown and breaks into executable tasks:
|
||||||
```go
|
```go
|
||||||
type Task struct {
|
type Task struct {
|
||||||
ID string // unique task ID
|
ID string // unique task ID
|
||||||
GoalRef string // reference to goal in markdown (e.g., "Goal 1")
|
Input string // natural language description
|
||||||
Description string // what to do
|
GoalRef string // reference to goal (e.g., "Goal 1")
|
||||||
|
Source TaskSource // auto | human | event
|
||||||
ExecutorType ExecutorType // assistant | mcp | process
|
ExecutorType ExecutorType // assistant | mcp | process
|
||||||
ExecutorID string // agent ID or mcp tool name
|
ExecutorID string // agent ID or mcp tool name
|
||||||
Args []any // arguments for executor
|
Args []any // arguments for executor
|
||||||
|
|
|
||||||
|
|
@ -1181,7 +1181,6 @@ type Execution struct {
|
||||||
MemberID string `json:"member_id"` // robot member ID
|
MemberID string `json:"member_id"` // robot member ID
|
||||||
TeamID string `json:"team_id"`
|
TeamID string `json:"team_id"`
|
||||||
TriggerType TriggerType `json:"trigger_type"` // clock | human | event
|
TriggerType TriggerType `json:"trigger_type"` // clock | human | event
|
||||||
TriggerData interface{} `json:"trigger_data,omitempty"`
|
|
||||||
StartTime time.Time `json:"start_time"`
|
StartTime time.Time `json:"start_time"`
|
||||||
EndTime *time.Time `json:"end_time,omitempty"`
|
EndTime *time.Time `json:"end_time,omitempty"`
|
||||||
Status ExecStatus `json:"status"`
|
Status ExecStatus `json:"status"`
|
||||||
|
|
@ -1191,6 +1190,9 @@ type Execution struct {
|
||||||
// Job integration (each Execution = 1 job.Job)
|
// Job integration (each Execution = 1 job.Job)
|
||||||
JobID string `json:"job_id"` // corresponding job.Job ID
|
JobID string `json:"job_id"` // corresponding job.Job ID
|
||||||
|
|
||||||
|
// Trigger input (stored for traceability)
|
||||||
|
Input *TriggerInput `json:"input,omitempty"` // original trigger input
|
||||||
|
|
||||||
// Phase outputs
|
// Phase outputs
|
||||||
Inspiration *InspirationReport `json:"inspiration,omitempty"` // P0: markdown
|
Inspiration *InspirationReport `json:"inspiration,omitempty"` // P0: markdown
|
||||||
Goals *Goals `json:"goals,omitempty"` // P1: markdown
|
Goals *Goals `json:"goals,omitempty"` // P1: markdown
|
||||||
|
|
@ -1206,6 +1208,22 @@ type Execution struct {
|
||||||
robot *Robot `json:"-"`
|
robot *Robot `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TriggerInput - stored trigger input for traceability
|
||||||
|
type TriggerInput struct {
|
||||||
|
// For human intervention
|
||||||
|
Action InterventionAction `json:"action,omitempty"` // task.add, goal.adjust, etc.
|
||||||
|
Description string `json:"description,omitempty"` // user's original input
|
||||||
|
UserID string `json:"user_id,omitempty"` // who triggered
|
||||||
|
|
||||||
|
// For event trigger
|
||||||
|
Source EventSource `json:"source,omitempty"` // webhook | database
|
||||||
|
EventType string `json:"event_type,omitempty"` // lead.created, etc.
|
||||||
|
Data map[string]interface{} `json:"data,omitempty"` // event payload
|
||||||
|
|
||||||
|
// For clock trigger
|
||||||
|
Clock *ClockContext `json:"clock,omitempty"` // time context when triggered
|
||||||
|
}
|
||||||
|
|
||||||
// CurrentState - current executing goal and task
|
// CurrentState - current executing goal and task
|
||||||
type CurrentState struct {
|
type CurrentState struct {
|
||||||
Task *Task `json:"task,omitempty"` // current task being executed
|
Task *Task `json:"task,omitempty"` // current task being executed
|
||||||
|
|
@ -1228,19 +1246,22 @@ type Goals struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Task - planned task (structured, for execution)
|
// Task - planned task (structured, for execution)
|
||||||
// P2 Agent parses Goals markdown and generates these
|
|
||||||
type Task struct {
|
type Task struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
GoalRef string `json:"goal_ref"` // reference to goal in markdown (e.g., "Goal 1")
|
Input string `json:"input"` // natural language description
|
||||||
Description string `json:"description"`
|
GoalRef string `json:"goal_ref,omitempty"`// reference to goal (e.g., "Goal 1")
|
||||||
|
Source TaskSource `json:"source"` // auto | human | event
|
||||||
|
|
||||||
|
// Executor
|
||||||
ExecutorType ExecutorType `json:"executor_type"`
|
ExecutorType ExecutorType `json:"executor_type"`
|
||||||
ExecutorID string `json:"executor_id"`
|
ExecutorID string `json:"executor_id"`
|
||||||
Args []any `json:"args,omitempty"`
|
Args []any `json:"args,omitempty"`
|
||||||
Status TaskStatus `json:"status"`
|
|
||||||
Order int `json:"order"` // execution order (0-based, lower = first)
|
// Runtime
|
||||||
Source TaskSource `json:"source"` // how task was created
|
Status TaskStatus `json:"status"`
|
||||||
StartTime *time.Time `json:"start_time,omitempty"`
|
Order int `json:"order"` // execution order (0-based)
|
||||||
EndTime *time.Time `json:"end_time,omitempty"`
|
StartTime *time.Time `json:"start_time,omitempty"`
|
||||||
|
EndTime *time.Time `json:"end_time,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// TaskSource - how task was created
|
// TaskSource - how task was created
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue