feat(code): add sunbeam-proto crate with gRPC service definition
shared protobuf definitions for the sunbeam code agent: - CodeAgent service with bidirectional Session streaming - ClientMessage: StartSession, UserInput, ToolResult, ToolApproval - ServerMessage: TextDelta, ToolCall, ApprovalNeeded, Status - ToolDef for client-side tool registration this is the transport layer between `sunbeam code` (TUI client) and Sol (server-side agent loop). next: JWT middleware for OIDC auth, Sol gRPC server stub, CLI subcommand stub.
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
[workspace]
|
||||
members = ["sunbeam-sdk", "sunbeam"]
|
||||
members = ["sunbeam-sdk", "sunbeam", "sunbeam-proto"]
|
||||
resolver = "3"
|
||||
|
||||
12
sunbeam-proto/Cargo.toml
Normal file
12
sunbeam-proto/Cargo.toml
Normal file
@@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "sunbeam-proto"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
description = "Shared protobuf definitions for Sunbeam gRPC services"
|
||||
|
||||
[dependencies]
|
||||
tonic = "0.13"
|
||||
prost = "0.13"
|
||||
|
||||
[build-dependencies]
|
||||
tonic-build = "0.13"
|
||||
4
sunbeam-proto/build.rs
Normal file
4
sunbeam-proto/build.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
tonic_build::compile_protos("proto/code.proto")?;
|
||||
Ok(())
|
||||
}
|
||||
121
sunbeam-proto/proto/code.proto
Normal file
121
sunbeam-proto/proto/code.proto
Normal file
@@ -0,0 +1,121 @@
|
||||
syntax = "proto3";
|
||||
package sunbeam.code.v1;
|
||||
|
||||
// Sol's coding agent service. Bidirectional streaming between
|
||||
// the `sunbeam code` TUI client and Sol's server-side agent loop.
|
||||
service CodeAgent {
|
||||
rpc Session(stream ClientMessage) returns (stream ServerMessage);
|
||||
}
|
||||
|
||||
// ── Client → Sol ───────────────────────────────────────────────
|
||||
|
||||
message ClientMessage {
|
||||
oneof payload {
|
||||
StartSession start = 1;
|
||||
UserInput input = 2;
|
||||
ToolResult tool_result = 3;
|
||||
ToolApproval approval = 4;
|
||||
EndSession end = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message StartSession {
|
||||
string project_path = 1;
|
||||
string prompt_md = 2;
|
||||
string config_toml = 3;
|
||||
string git_branch = 4;
|
||||
string git_status = 5;
|
||||
repeated string file_tree = 6;
|
||||
string model = 7;
|
||||
repeated ToolDef client_tools = 8;
|
||||
}
|
||||
|
||||
message UserInput {
|
||||
string text = 1;
|
||||
}
|
||||
|
||||
message ToolResult {
|
||||
string call_id = 1;
|
||||
string result = 2;
|
||||
bool is_error = 3;
|
||||
}
|
||||
|
||||
message ToolApproval {
|
||||
string call_id = 1;
|
||||
bool approved = 2;
|
||||
}
|
||||
|
||||
message EndSession {}
|
||||
|
||||
// ── Sol → Client ───────────────────────────────────────────────
|
||||
|
||||
message ServerMessage {
|
||||
oneof payload {
|
||||
SessionReady ready = 1;
|
||||
TextDelta delta = 2;
|
||||
TextDone done = 3;
|
||||
ToolCall tool_call = 4;
|
||||
ApprovalNeeded approval = 5;
|
||||
Status status = 6;
|
||||
SessionEnd end = 7;
|
||||
Error error = 8;
|
||||
}
|
||||
}
|
||||
|
||||
message SessionReady {
|
||||
string session_id = 1;
|
||||
string room_id = 2;
|
||||
string model = 3;
|
||||
}
|
||||
|
||||
message TextDelta {
|
||||
string text = 1;
|
||||
}
|
||||
|
||||
message TextDone {
|
||||
string full_text = 1;
|
||||
uint32 input_tokens = 2;
|
||||
uint32 output_tokens = 3;
|
||||
}
|
||||
|
||||
message ToolCall {
|
||||
string call_id = 1;
|
||||
string name = 2;
|
||||
string args_json = 3;
|
||||
bool is_local = 4;
|
||||
bool needs_approval = 5;
|
||||
}
|
||||
|
||||
message ApprovalNeeded {
|
||||
string call_id = 1;
|
||||
string name = 2;
|
||||
string args_json = 3;
|
||||
string summary = 4;
|
||||
}
|
||||
|
||||
message Status {
|
||||
string message = 1;
|
||||
StatusKind kind = 2;
|
||||
}
|
||||
|
||||
enum StatusKind {
|
||||
INFO = 0;
|
||||
TOOL_RUNNING = 1;
|
||||
TOOL_DONE = 2;
|
||||
THINKING = 3;
|
||||
}
|
||||
|
||||
message SessionEnd {
|
||||
string summary = 1;
|
||||
}
|
||||
|
||||
message Error {
|
||||
string message = 1;
|
||||
bool fatal = 2;
|
||||
}
|
||||
|
||||
message ToolDef {
|
||||
string name = 1;
|
||||
string description = 2;
|
||||
string schema_json = 3;
|
||||
}
|
||||
3
sunbeam-proto/src/lib.rs
Normal file
3
sunbeam-proto/src/lib.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
pub mod sunbeam_code_v1 {
|
||||
tonic::include_proto!("sunbeam.code.v1");
|
||||
}
|
||||
Reference in New Issue
Block a user