vendor: update cargo-cxcloud-proto-0.1.0
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"git": {
|
||||
"sha1": "927a31cbf65f78c3ef6b729631b2fc35335afe06",
|
||||
"dirty": true
|
||||
},
|
||||
"path_in_vcs": "services/cxcloud-rs/crates/proto"
|
||||
}
|
||||
Generated
+1299
File diff suppressed because it is too large
Load Diff
+46
@@ -0,0 +1,46 @@
|
||||
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||
#
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g., crates.io) dependencies.
|
||||
#
|
||||
# If you are reading this file be aware that the original Cargo.toml
|
||||
# will likely look very different (and much more reasonable).
|
||||
# See Cargo.toml.orig for the original contents.
|
||||
|
||||
[package]
|
||||
edition = "2021"
|
||||
name = "cxcloud-proto"
|
||||
version = "0.1.0"
|
||||
build = "build.rs"
|
||||
publish = ["cxai"]
|
||||
autolib = false
|
||||
autobins = false
|
||||
autoexamples = false
|
||||
autotests = false
|
||||
autobenches = false
|
||||
readme = false
|
||||
|
||||
[lib]
|
||||
name = "cxcloud_proto"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies.prost]
|
||||
version = "0.13"
|
||||
|
||||
[dependencies.prost-types]
|
||||
version = "0.13"
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1"
|
||||
features = ["derive"]
|
||||
|
||||
[dependencies.serde_json]
|
||||
version = "1"
|
||||
|
||||
[dependencies.tonic]
|
||||
version = "0.12"
|
||||
|
||||
[build-dependencies.tonic-build]
|
||||
version = "0.12"
|
||||
Generated
+15
@@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "cxcloud-proto"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
publish.workspace = true
|
||||
|
||||
[dependencies]
|
||||
prost = { workspace = true }
|
||||
prost-types = { workspace = true }
|
||||
tonic = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
|
||||
[build-dependencies]
|
||||
tonic-build = { workspace = true }
|
||||
@@ -0,0 +1,40 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Use local proto/ dir (included in crate package).
|
||||
// Falls back to the monorepo contracts/ dir for workspace dev builds.
|
||||
let local_dir = PathBuf::from("proto");
|
||||
let monorepo_dir: PathBuf = [".", "..", "..", "..", "..", "contracts", "proto"]
|
||||
.iter()
|
||||
.collect();
|
||||
|
||||
let proto_dir = if local_dir.exists() {
|
||||
local_dir
|
||||
} else {
|
||||
monorepo_dir
|
||||
};
|
||||
|
||||
let protos = [
|
||||
"common.proto",
|
||||
"agent.proto",
|
||||
"bot.proto",
|
||||
"human_simulator.proto",
|
||||
"output.proto",
|
||||
"events.proto",
|
||||
];
|
||||
|
||||
let proto_files: Vec<PathBuf> = protos.iter().map(|p| proto_dir.join(p)).collect();
|
||||
|
||||
tonic_build::configure()
|
||||
.build_server(true)
|
||||
.build_client(true)
|
||||
.compile_protos(&proto_files, &[&proto_dir])?;
|
||||
|
||||
// Re-run if any proto file changes
|
||||
println!("cargo:rerun-if-changed={}", proto_dir.display());
|
||||
for f in &proto_files {
|
||||
println!("cargo:rerun-if-changed={}", f.display());
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package cxcloud.agent;
|
||||
|
||||
option go_package = "github.com/cxcloud/contracts/agent";
|
||||
|
||||
import "common.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
// The Agent service — reasoning and planning.
|
||||
service AgentService {
|
||||
// Submit an event for autonomous processing.
|
||||
rpc ProcessEvent(ProcessEventRequest) returns (ProcessEventResponse);
|
||||
|
||||
// Check the status of a previously submitted event.
|
||||
rpc GetEventStatus(GetEventStatusRequest) returns (GetEventStatusResponse);
|
||||
}
|
||||
|
||||
message ProcessEventRequest {
|
||||
cxcloud.common.Event event = 1;
|
||||
}
|
||||
|
||||
message ProcessEventResponse {
|
||||
string plan_id = 1;
|
||||
AgentPlan plan = 2;
|
||||
}
|
||||
|
||||
message GetEventStatusRequest {
|
||||
string event_id = 1;
|
||||
}
|
||||
|
||||
message GetEventStatusResponse {
|
||||
string event_id = 1;
|
||||
string plan_id = 2;
|
||||
PlanStatus status = 3;
|
||||
string summary = 4;
|
||||
int32 retry_count = 5;
|
||||
}
|
||||
|
||||
// A plan produced by the Agent's reasoning.
|
||||
message AgentPlan {
|
||||
string id = 1;
|
||||
string event_id = 2;
|
||||
string goal = 3; // High-level description of intent
|
||||
repeated ReasoningStep reasoning = 4; // Chain-of-thought steps
|
||||
repeated ToolCall tool_calls = 5; // Ordered list of tool invocations
|
||||
map<string, string> context = 6; // Retrieved RAG context snippets
|
||||
google.protobuf.Timestamp created_at = 7;
|
||||
int32 attempt = 8; // Which retry attempt (1 = first)
|
||||
}
|
||||
|
||||
enum PlanStatus {
|
||||
PLAN_STATUS_UNSPECIFIED = 0;
|
||||
PLAN_STATUS_CREATED = 1;
|
||||
PLAN_STATUS_AWAITING_APPROVAL = 2;
|
||||
PLAN_STATUS_APPROVED = 3;
|
||||
PLAN_STATUS_EXECUTING = 4;
|
||||
PLAN_STATUS_VERIFYING = 5;
|
||||
PLAN_STATUS_COMPLETED = 6;
|
||||
PLAN_STATUS_FAILED = 7;
|
||||
PLAN_STATUS_REJECTED = 8;
|
||||
}
|
||||
|
||||
// A single step in the Agent's chain-of-thought reasoning.
|
||||
message ReasoningStep {
|
||||
int32 step_number = 1;
|
||||
string thought = 2; // What the agent is thinking
|
||||
string observation = 3; // What it observes from context
|
||||
string decision = 4; // What it decides to do next
|
||||
}
|
||||
|
||||
// A single tool invocation within a plan.
|
||||
message ToolCall {
|
||||
string id = 1;
|
||||
string tool_name = 2; // e.g. "http_request", "file_write", "db_query"
|
||||
google.protobuf.Struct parameters = 3; // Tool-specific parameters
|
||||
repeated string depends_on = 4; // IDs of ToolCalls that must complete first
|
||||
int32 priority = 5; // Execution priority (lower = earlier)
|
||||
int32 max_retries = 6;
|
||||
int32 timeout_seconds = 7;
|
||||
}
|
||||
|
||||
// Result of the Agent verifying an execution outcome.
|
||||
message VerifyResult {
|
||||
string plan_id = 1;
|
||||
bool passed = 2;
|
||||
string reason = 3; // Why it passed/failed
|
||||
string corrective_action = 4; // What the agent will do differently on retry
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package cxcloud.bot;
|
||||
|
||||
option go_package = "github.com/cxcloud/contracts/bot";
|
||||
|
||||
import "agent.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
// The Bot service — tool execution engine.
|
||||
service BotService {
|
||||
// Execute a plan produced by the Agent.
|
||||
rpc Execute(ExecutionRequest) returns (ExecutionResponse);
|
||||
|
||||
// List available tools.
|
||||
rpc ListTools(ListToolsRequest) returns (ListToolsResponse);
|
||||
}
|
||||
|
||||
message ExecutionRequest {
|
||||
string plan_id = 1;
|
||||
repeated cxcloud.agent.ToolCall tool_calls = 2;
|
||||
map<string, string> metadata = 3; // trace_id, correlation_id
|
||||
}
|
||||
|
||||
message ExecutionResponse {
|
||||
string execution_id = 1;
|
||||
repeated ToolResult results = 2;
|
||||
ExecutionStatus status = 3;
|
||||
google.protobuf.Timestamp started_at = 4;
|
||||
google.protobuf.Timestamp completed_at = 5;
|
||||
int64 duration_ms = 6;
|
||||
}
|
||||
|
||||
enum ExecutionStatus {
|
||||
EXECUTION_STATUS_UNSPECIFIED = 0;
|
||||
EXECUTION_STATUS_SUCCESS = 1;
|
||||
EXECUTION_STATUS_PARTIAL_FAILURE = 2; // Some tools succeeded, some failed
|
||||
EXECUTION_STATUS_FAILURE = 3;
|
||||
}
|
||||
|
||||
// Result of a single tool invocation.
|
||||
message ToolResult {
|
||||
string tool_call_id = 1;
|
||||
string tool_name = 2;
|
||||
bool success = 3;
|
||||
google.protobuf.Struct output = 4; // Tool-specific output
|
||||
string error_message = 5;
|
||||
string error_code = 6;
|
||||
int32 retries_used = 7;
|
||||
int64 duration_ms = 8;
|
||||
}
|
||||
|
||||
message ListToolsRequest {}
|
||||
|
||||
message ListToolsResponse {
|
||||
repeated ToolInfo tools = 1;
|
||||
}
|
||||
|
||||
message ToolInfo {
|
||||
string name = 1;
|
||||
string description = 2;
|
||||
string category = 3; // "http", "file", "database", "notification"
|
||||
bool available = 4;
|
||||
google.protobuf.Struct schema = 5; // JSON Schema for parameters
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package cxcloud.common;
|
||||
|
||||
option go_package = "github.com/cxcloud/contracts/common";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
// Unique identifier for any entity in the system.
|
||||
message EntityId {
|
||||
string value = 1; // UUID v7 (time-sortable)
|
||||
}
|
||||
|
||||
// Unified event envelope used across all layers.
|
||||
message Event {
|
||||
string id = 1; // UUID v7
|
||||
string source = 2; // "webhook", "filesystem", "api_poll", "feedback"
|
||||
string type = 3; // "customer_inquiry", "file_changed", etc.
|
||||
google.protobuf.Timestamp timestamp = 4;
|
||||
google.protobuf.Struct payload = 5; // Arbitrary JSON payload
|
||||
map<string, string> metadata = 6; // trace_id, correlation_id, auth context
|
||||
}
|
||||
|
||||
// Severity levels for logging and alerting.
|
||||
enum Severity {
|
||||
SEVERITY_UNSPECIFIED = 0;
|
||||
SEVERITY_DEBUG = 1;
|
||||
SEVERITY_INFO = 2;
|
||||
SEVERITY_WARNING = 3;
|
||||
SEVERITY_ERROR = 4;
|
||||
SEVERITY_CRITICAL = 5;
|
||||
}
|
||||
|
||||
// Health check response.
|
||||
message HealthResponse {
|
||||
string service = 1;
|
||||
string status = 2; // "healthy", "degraded", "unhealthy"
|
||||
string version = 3;
|
||||
google.protobuf.Timestamp checked_at = 4;
|
||||
map<string, string> dependencies = 5; // dependency -> status
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package cxcloud.events;
|
||||
|
||||
option go_package = "github.com/cxcloud/contracts/events";
|
||||
|
||||
import "common.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
// A raw event as received from any input source.
|
||||
message RawEvent {
|
||||
cxcloud.common.Event event = 1;
|
||||
string raw_body = 2; // Original unparsed body for audit
|
||||
string content_type = 3; // MIME type of original payload
|
||||
}
|
||||
|
||||
// A processed event after reasoning and execution.
|
||||
message ProcessedEvent {
|
||||
cxcloud.common.Event original_event = 1;
|
||||
string plan_id = 2; // ID of the AgentPlan that handled this
|
||||
string execution_id = 3; // ID of the ExecutionResult
|
||||
ProcessingStatus status = 4;
|
||||
string summary = 5; // Human-readable summary of what was done
|
||||
google.protobuf.Timestamp completed_at = 6;
|
||||
int32 retry_count = 7;
|
||||
}
|
||||
|
||||
enum ProcessingStatus {
|
||||
PROCESSING_STATUS_UNSPECIFIED = 0;
|
||||
PROCESSING_STATUS_SUCCESS = 1;
|
||||
PROCESSING_STATUS_FAILED = 2;
|
||||
PROCESSING_STATUS_REJECTED = 3; // Rejected by Human Simulator
|
||||
PROCESSING_STATUS_RETRYING = 4;
|
||||
PROCESSING_STATUS_DEAD_LETTER = 5; // Exhausted retries
|
||||
}
|
||||
|
||||
// A feedback event published after output delivery.
|
||||
message FeedbackEvent {
|
||||
cxcloud.common.Event original_event = 1;
|
||||
string delivery_id = 2;
|
||||
bool delivery_success = 3;
|
||||
string feedback_type = 4; // "delivery_confirmed", "delivery_failed", "downstream_response"
|
||||
string details = 5;
|
||||
google.protobuf.Timestamp feedback_at = 6;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package cxcloud.human_simulator;
|
||||
|
||||
option go_package = "github.com/cxcloud/contracts/human_simulator";
|
||||
|
||||
import "agent.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
// The Human Simulator service — policy-based approval proxy.
|
||||
service HumanSimulatorService {
|
||||
// Request approval for an agent plan.
|
||||
rpc RequestApproval(ApprovalRequest) returns (ApprovalResponse);
|
||||
|
||||
// List active policies.
|
||||
rpc ListPolicies(ListPoliciesRequest) returns (ListPoliciesResponse);
|
||||
}
|
||||
|
||||
message ApprovalRequest {
|
||||
string request_id = 1;
|
||||
cxcloud.agent.AgentPlan plan = 2;
|
||||
map<string, string> metadata = 3; // trace_id, event context
|
||||
}
|
||||
|
||||
message ApprovalResponse {
|
||||
string request_id = 1;
|
||||
ApprovalDecision decision = 2;
|
||||
string reason = 3; // Explanation of the decision
|
||||
cxcloud.agent.AgentPlan modified_plan = 4; // Only set if decision = MODIFIED
|
||||
repeated PolicyViolation violations = 5; // Violations found (if any)
|
||||
google.protobuf.Timestamp decided_at = 6;
|
||||
int64 evaluation_ms = 7; // Time taken to evaluate
|
||||
}
|
||||
|
||||
enum ApprovalDecision {
|
||||
APPROVAL_DECISION_UNSPECIFIED = 0;
|
||||
APPROVAL_DECISION_APPROVED = 1;
|
||||
APPROVAL_DECISION_MODIFIED = 2; // Approved with modifications
|
||||
APPROVAL_DECISION_REJECTED = 3;
|
||||
APPROVAL_DECISION_ESCALATED = 4; // Cannot decide — needs real human
|
||||
}
|
||||
|
||||
// A single policy violation detected during evaluation.
|
||||
message PolicyViolation {
|
||||
string policy_id = 1;
|
||||
string policy_name = 2;
|
||||
string description = 3;
|
||||
ViolationSeverity severity = 4;
|
||||
string tool_call_id = 5; // Which tool call triggered this (if applicable)
|
||||
}
|
||||
|
||||
enum ViolationSeverity {
|
||||
VIOLATION_SEVERITY_UNSPECIFIED = 0;
|
||||
VIOLATION_SEVERITY_INFO = 1;
|
||||
VIOLATION_SEVERITY_WARNING = 2;
|
||||
VIOLATION_SEVERITY_CRITICAL = 3;
|
||||
VIOLATION_SEVERITY_BLOCKING = 4;
|
||||
}
|
||||
|
||||
message ListPoliciesRequest {}
|
||||
|
||||
message ListPoliciesResponse {
|
||||
repeated PolicyInfo policies = 1;
|
||||
}
|
||||
|
||||
message PolicyInfo {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string description = 3;
|
||||
bool enabled = 4;
|
||||
ViolationSeverity max_severity = 5;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package cxcloud.output;
|
||||
|
||||
option go_package = "github.com/cxcloud/contracts/output";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
// The Output service — delivery and feedback.
|
||||
service OutputService {
|
||||
// Request delivery of results to downstream systems.
|
||||
rpc Deliver(DeliveryRequest) returns (DeliveryResponse);
|
||||
}
|
||||
|
||||
message DeliveryRequest {
|
||||
string delivery_id = 1;
|
||||
string plan_id = 2;
|
||||
string event_id = 3;
|
||||
repeated DeliveryTarget targets = 4;
|
||||
map<string, string> metadata = 5;
|
||||
}
|
||||
|
||||
message DeliveryTarget {
|
||||
string id = 1;
|
||||
DeliveryType type = 2;
|
||||
string destination = 3; // URL, email, Slack channel, table name, etc.
|
||||
google.protobuf.Struct payload = 4; // Data to deliver
|
||||
map<string, string> headers = 5; // HTTP headers or equivalent
|
||||
int32 timeout_seconds = 6;
|
||||
int32 max_retries = 7;
|
||||
}
|
||||
|
||||
enum DeliveryType {
|
||||
DELIVERY_TYPE_UNSPECIFIED = 0;
|
||||
DELIVERY_TYPE_HTTP = 1;
|
||||
DELIVERY_TYPE_DATABASE = 2;
|
||||
DELIVERY_TYPE_EMAIL = 3;
|
||||
DELIVERY_TYPE_SLACK = 4;
|
||||
DELIVERY_TYPE_SMS = 5;
|
||||
DELIVERY_TYPE_FILE = 6;
|
||||
}
|
||||
|
||||
message DeliveryResponse {
|
||||
string delivery_id = 1;
|
||||
repeated DeliveryResult results = 2;
|
||||
google.protobuf.Timestamp completed_at = 3;
|
||||
int64 duration_ms = 4;
|
||||
}
|
||||
|
||||
message DeliveryResult {
|
||||
string target_id = 1;
|
||||
bool success = 2;
|
||||
int32 status_code = 3; // HTTP status or equivalent
|
||||
string error_message = 4;
|
||||
google.protobuf.Struct response = 5; // Response body if any
|
||||
int32 retries_used = 6;
|
||||
int64 duration_ms = 7;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
//! Generated protobuf and gRPC types for CxCloud services.
|
||||
|
||||
pub mod common {
|
||||
tonic::include_proto!("cxcloud.common");
|
||||
}
|
||||
|
||||
pub mod agent {
|
||||
tonic::include_proto!("cxcloud.agent");
|
||||
}
|
||||
|
||||
pub mod bot {
|
||||
tonic::include_proto!("cxcloud.bot");
|
||||
}
|
||||
|
||||
pub mod human_simulator {
|
||||
tonic::include_proto!("cxcloud.human_simulator");
|
||||
}
|
||||
|
||||
pub mod output {
|
||||
tonic::include_proto!("cxcloud.output");
|
||||
}
|
||||
|
||||
pub mod events {
|
||||
tonic::include_proto!("cxcloud.events");
|
||||
}
|
||||
Reference in New Issue
Block a user