syntax = "proto3";

package telos;

option go_package = "github.com/nevinshine/telos-runtime/shared/pb";

service TelosControl {
    rpc ReportTaint (TaintReport) returns (Ack);
    rpc DeclareIntent (IntentRequest) returns (IntentVerdict);
    rpc GetPolicy (PolicyQuery) returns (PolicyRules);
}

message Ack {
    bool success = 1;
    string message = 2;
}

message TaintReport {
    string source_id = 1;      
    int32 pid = 2;
    string url = 3;
    TaintLevel level = 4;
    string payload_preview = 5;
    string session_id = 6;
}

message IntentRequest {
    int32 agent_pid = 1;
    string natural_language_goal = 2;
    repeated string planned_actions = 3;       // Network actions
    string session_id = 4;               
    repeated string planned_exec_actions = 5;  // [NEW] Execution actions
}

message IntentVerdict {
    bool allowed = 1;
    string reason = 2;
    int64 policy_ttl_ms = 3;   
    repeated string allowed_binaries = 4;      // [NEW] Binaries pushed to BPF
}

message PolicyQuery {
    int32 pid = 1;
}

message PolicyRules {
    TaintLevel max_allowed_taint = 1;
    repeated string allowed_ips = 2;
    repeated string allowed_paths = 3;
}

enum TaintLevel {
    CLEAN = 0;
    LOW = 1;
    MEDIUM = 2;    
    HIGH = 3;
    CRITICAL = 4;  
}
