add: some proto stuff

This commit is contained in:
2026-03-24 21:11:45 -07:00
parent 3df04e4cb6
commit 622eca78cb
10 changed files with 1752 additions and 0 deletions
+138
View File
@@ -0,0 +1,138 @@
syntax = "proto3";
package webstory.v1;
import "google/protobuf/timestamp.proto";
option go_package = "git.tipsy.codes/charles/webstory/pkg/api";
// Story represents the current state of an interactive fiction session
message Story {
string session_id = 1; // Unique identifier for this story session
string current_scene = 2; // Current scene/location identifier
string status = 3; // Current story status (playing, paused, completed)
}
// Visualization represents an image or visual element to display
message Visualization {
string type = 1; // Type of visualization: portrait, scene, map, etc.
string url = 2; // URL or path to the visualization
string description = 3; // Description of what should be shown
}
// Choice represents an option the user can select
message Choice {
string label = 1; // Text displayed on the button
string action = 2; // Action to trigger when selected
map<string, string> metadata = 3; // Additional metadata (optional)
}
// Message represents a communication between client and server
message Message {
string id = 1; // Unique message identifier
string type = 2; // Message type: user_input, story_text, system, etc.
string content = 3; // Message content
repeated Choice choices = 4; // Available choices (if any)
Visualization visualization = 5; // Associated visualization (if any)
google.protobuf.Timestamp created_at = 6; // Timestamp when message was created
google.protobuf.Timestamp updated_at = 7; // Timestamp when message was last updated
}
// ChatHistory represents the conversation history
message ChatHistory {
string session_id = 1;
repeated Message messages = 2;
google.protobuf.Timestamp created_at = 3; // Timestamp when chat history was created
google.protobuf.Timestamp updated_at = 4; // Timestamp when chat history was last updated
}
// Request for starting a new story
message StartStoryRequest {
string session_id = 1; // Optional: client-provided session ID
string initial_scene = 2; // Starting scene or scenario prompt
string story_genre = 3; // Genre preferences (fantasy, sci-fi, etc.)
map<string, string> options = 4; // Additional configuration options
google.protobuf.Timestamp created_at = 5; // Timestamp when request was created
}
// Response for starting a story
message StartStoryResponse {
string session_id = 1;
string status = 2;
Message initial_message = 3;
map<string, string> metadata = 4;
google.protobuf.Timestamp created_at = 5; // Timestamp when response was created
}
// Request for continuing the story
message ContinueStoryRequest {
string session_id = 1;
string action = 2; // User's choice or input
string choice_id = 3; // If selecting a specific choice
map<string, string> options = 4; // Optional parameters
google.protobuf.Timestamp created_at = 5; // Timestamp when request was created
}
// Response for continuing the story
message ContinueStoryResponse {
string session_id = 1;
string status = 2;
Message response_message = 3;
map<string, string> metadata = 4;
}
// Request to get story state
message GetStoryRequest {
string session_id = 1;
}
// Response with current story state
message GetStoryResponse {
string session_id = 1;
Story story = 2;
repeated Message recent_messages = 3;
}
// Request to reset/stop a story
message ResetStoryRequest {
string session_id = 1;
}
message ResetStoryResponse {
string session_id = 1;
string status = 2;
}
// WebstoryService defines the RPC methods for the interactive fiction service
service WebstoryService {
// Start a new story session
rpc StartStory(StartStoryRequest) returns (StartStoryResponse);
// Continue the story with user input or choice
rpc ContinueStory(ContinueStoryRequest) returns (ContinueStoryResponse);
// Get the current state of a story
rpc GetStory(GetStoryRequest) returns (GetStoryResponse);
// Reset or terminate a story session
rpc ResetStory(ResetStoryRequest) returns (ResetStoryResponse);
// Stream story responses in real-time
rpc StreamStory(StreamStoryRequest) returns (stream StreamStoryResponse);
}
// Request for streaming story responses
message StreamStoryRequest {
string session_id = 1;
string action = 2;
string choice_id = 3;
map<string, string> options = 4;
}
// Response for streaming story responses
message StreamStoryResponse {
string session_id = 1;
Message partial_message = 2; // Partial message being built
Message complete_message = 3; // Complete message when finalized
bool is_final = 4; // Indicates if this is the final chunk
}