| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- syntax = "proto3";
- package smartbotic.proto;
- import "common.proto";
- option cc_enable_arenas = true;
- // Node position in editor
- message Position {
- double x = 1;
- double y = 2;
- }
- // Workflow node definition
- message WorkflowNode {
- string id = 1;
- string type = 2;
- string name = 3;
- string config = 4; // JSON string
- Position position = 5;
- bool disabled = 6;
- map<string, string> metadata = 7;
- }
- // Connection between nodes
- message Connection {
- string source_node_id = 1;
- string source_output = 2;
- string target_node_id = 3;
- string target_input = 4;
- }
- // Workflow settings
- message WorkflowSettings {
- int32 timeout_ms = 1;
- bool retry_on_fail = 2;
- int32 max_retries = 3;
- int32 retry_delay_ms = 4;
- string error_policy = 5; // "stop", "continue", "retry"
- }
- // Workflow definition
- message Workflow {
- string id = 1;
- string name = 2;
- string description = 3;
- string group_id = 4;
- string owner_id = 5;
- bool active = 6;
- repeated WorkflowNode nodes = 7;
- repeated Connection connections = 8;
- WorkflowSettings settings = 9;
- int64 version = 10;
- int64 created_at = 11;
- int64 updated_at = 12;
- map<string, string> tags = 13;
- }
- // Workflow group
- message WorkflowGroup {
- string id = 1;
- string name = 2;
- string description = 3;
- string parent_id = 4;
- string owner_id = 5;
- int64 created_at = 6;
- int64 updated_at = 7;
- }
- // Execution status
- enum ExecutionStatus {
- EXECUTION_STATUS_UNSPECIFIED = 0;
- EXECUTION_STATUS_PENDING = 1;
- EXECUTION_STATUS_RUNNING = 2;
- EXECUTION_STATUS_COMPLETED = 3;
- EXECUTION_STATUS_FAILED = 4;
- EXECUTION_STATUS_CANCELLED = 5;
- EXECUTION_STATUS_WAITING = 6; // Waiting for external trigger
- }
- // Node execution result
- message NodeExecution {
- string node_id = 1;
- ExecutionStatus status = 2;
- int64 started_at = 3;
- int64 finished_at = 4;
- string input = 5; // JSON string
- string output = 6; // JSON string
- string error = 7;
- int32 retry_count = 8;
- }
- // Workflow execution
- message Execution {
- string id = 1;
- string workflow_id = 2;
- string workflow_name = 3;
- string runner_id = 4;
- ExecutionStatus status = 5;
- string trigger_type = 6; // "manual", "webhook", "schedule", "node"
- string trigger_data = 7; // JSON string
- int64 started_at = 8;
- int64 finished_at = 9;
- repeated NodeExecution node_executions = 10;
- string error = 11;
- map<string, string> context = 12;
- string workflow_snapshot = 13; // JSON string: {nodes, connections} at execution time
- }
- // Execute workflow request
- message ExecuteWorkflowRequest {
- string workflow_id = 1;
- string trigger_type = 2;
- string trigger_data = 3; // JSON string
- bool wait_for_completion = 4;
- int32 timeout_ms = 5;
- }
- // Execute workflow response
- message ExecuteWorkflowResponse {
- string execution_id = 1;
- ExecutionStatus status = 2;
- string result = 3; // JSON string (if wait_for_completion)
- Error error = 4;
- }
- // Cancel execution request
- message CancelExecutionRequest {
- string execution_id = 1;
- string reason = 2;
- }
- // Retry execution request
- message RetryExecutionRequest {
- string execution_id = 1;
- string from_node_id = 2; // Optional: retry from specific node
- }
- // Get execution request
- message GetExecutionRequest {
- string execution_id = 1;
- }
- // List executions request
- message ListExecutionsRequest {
- string workflow_id = 1; // Optional filter
- repeated ExecutionStatus statuses = 2; // Optional filter
- PaginationRequest pagination = 3;
- }
- // List executions response
- message ListExecutionsResponse {
- repeated Execution executions = 1;
- PaginationResponse pagination = 2;
- }
|