yao/yao/models/agent/execution.mod.yao
Max bc4787f857 Update executor to support V2 execution model and enhance event handling
- Implement V2 execution model in the standard executor, simplifying task execution to a single call without validation loops.
- Introduce support for resuming suspended executions, allowing for human input during task processing.
- Enhance event handling by pushing task completion and failure events to the event bus for better tracking and integration.
- Update tests to reflect changes in execution flow and ensure robust handling of task statuses and results.
2026-02-25 18:40:48 +08:00

272 lines
6.5 KiB
Text

{
"name": "Execution",
"label": "Robot Execution",
"description": "Robot execution history for tracking P0-P5 phase outputs and status",
"tags": ["agent", "robot", "system"],
"builtin": true,
"readonly": false,
"sort": 9999,
"table": {
"name": "agent_execution",
"comment": "Robot execution history table",
},
"columns": [
{
"name": "id",
"type": "ID",
"label": "ID",
"comment": "Auto-increment primary key",
},
{
"name": "execution_id",
"type": "string",
"label": "Execution ID",
"comment": "Unique execution identifier",
"length": 64,
"nullable": false,
"unique": true,
"index": true,
},
{
"name": "member_id",
"type": "string",
"label": "Member ID",
"comment": "Robot member ID (user identity from __yao.member)",
"length": 64,
"nullable": false,
"index": true,
},
{
"name": "team_id",
"type": "string",
"label": "Team ID",
"comment": "Team ID the robot belongs to",
"length": 64,
"nullable": false,
"index": true,
},
{
"name": "job_id",
"type": "string",
"label": "Job ID",
"comment": "Linked job.Job ID for monitoring",
"length": 64,
"nullable": true,
"index": true,
},
{
"name": "trigger_type",
"type": "enum",
"label": "Trigger Type",
"comment": "How this execution was triggered",
"option": ["clock", "human", "event"],
"nullable": false,
"index": true,
},
{
"name": "status",
"type": "enum",
"label": "Status",
"comment": "Execution status",
"option": [
"pending",
"running",
"paused",
"completed",
"failed",
"cancelled",
"confirming",
"waiting",
],
"default": "pending",
"nullable": false,
"index": true,
},
{
"name": "phase",
"type": "enum",
"label": "Phase",
"comment": "Current execution phase",
"option": [
"inspiration",
"goals",
"tasks",
"run",
"delivery",
"learning",
"host",
],
"default": "inspiration",
"nullable": false,
"index": true,
},
{
"name": "current",
"type": "json",
"label": "Current State",
"comment": "Current executing state (task_index, progress)",
"nullable": true,
},
{
"name": "error",
"type": "text",
"label": "Error",
"comment": "Error message if execution failed",
"nullable": true,
},
{
"name": "name",
"type": "string",
"label": "Name",
"comment": "Execution title for UI display (updated by executor at goals phase)",
"length": 512,
"nullable": true,
},
{
"name": "current_task_name",
"type": "string",
"label": "Current Task Name",
"comment": "Current task description for UI display (updated by executor at run phase)",
"length": 512,
"nullable": true,
},
{
"name": "input",
"type": "json",
"label": "Input",
"comment": "Original trigger input (TriggerInput)",
"nullable": true,
},
{
"name": "inspiration",
"type": "json",
"label": "Inspiration",
"comment": "P0 output (InspirationReport)",
"nullable": true,
},
{
"name": "goals",
"type": "json",
"label": "Goals",
"comment": "P1 output (Goals)",
"nullable": true,
},
{
"name": "tasks",
"type": "json",
"label": "Tasks",
"comment": "P2 output ([]Task)",
"nullable": true,
},
{
"name": "results",
"type": "json",
"label": "Results",
"comment": "P3 output ([]TaskResult)",
"nullable": true,
},
{
"name": "delivery",
"type": "json",
"label": "Delivery",
"comment": "P4 output (DeliveryResult)",
"nullable": true,
},
{
"name": "learning",
"type": "json",
"label": "Learning",
"comment": "P5 output ([]LearningEntry)",
"nullable": true,
},
{
"name": "chat_id",
"type": "string",
"label": "Chat ID",
"comment": "V2: Unique conversation ID for Host Agent interactions",
"length": 64,
"nullable": true,
"index": true,
},
{
"name": "waiting_task_id",
"type": "string",
"label": "Waiting Task ID",
"comment": "V2: Task ID that is waiting for human input",
"length": 64,
"nullable": true,
},
{
"name": "waiting_question",
"type": "text",
"label": "Waiting Question",
"comment": "V2: Question posed to human while suspended",
"nullable": true,
},
{
"name": "waiting_since",
"type": "timestamp",
"label": "Waiting Since",
"comment": "V2: When execution was suspended",
"nullable": true,
},
{
"name": "resume_context",
"type": "json",
"label": "Resume Context",
"comment": "V2: State for resuming suspended execution (ResumeContext)",
"nullable": true,
},
{
"name": "start_time",
"type": "timestamp",
"label": "Start Time",
"comment": "Execution start timestamp",
"nullable": true,
"index": true,
},
{
"name": "end_time",
"type": "timestamp",
"label": "End Time",
"comment": "Execution end timestamp",
"nullable": true,
"index": true,
},
],
"relations": {
"member": {
"type": "hasOne",
"model": "__yao.member",
"key": "member_id",
"foreign": "member_id",
},
},
"indexes": [
{
"name": "idx_agent_execution_member_status",
"columns": ["member_id", "status"],
"type": "index",
"comment": "Index for member execution queries with status filter",
},
{
"name": "idx_agent_execution_team_status",
"columns": ["team_id", "status"],
"type": "index",
"comment": "Index for team execution queries with status filter",
},
{
"name": "idx_agent_execution_trigger_start",
"columns": ["trigger_type", "start_time"],
"type": "index",
"comment": "Index for trigger type analysis",
},
{
"name": "idx_agent_execution_member_start",
"columns": ["member_id", "start_time"],
"type": "index",
"comment": "Index for robot execution history by member",
},
],
"option": { "timestamps": true, "soft_deletes": false, "permission": true },
}