aboutsummaryrefslogtreecommitdiffstats
path: root/crates/turtle/proto
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--crates/turtle/proto/control.proto71
-rw-r--r--crates/turtle/proto/history.proto76
-rw-r--r--crates/turtle/proto/search.proto35
-rw-r--r--crates/turtle/proto/semantic.proto47
4 files changed, 63 insertions, 166 deletions
diff --git a/crates/turtle/proto/control.proto b/crates/turtle/proto/control.proto
index 06347902..f1656d73 100644
--- a/crates/turtle/proto/control.proto
+++ b/crates/turtle/proto/control.proto
@@ -1,62 +1,35 @@
syntax = "proto3";
package control;
-// The Control service allows external processes (CLI commands, etc.)
-// to inject events into the running daemon.
service Control {
- // Send an event to the daemon's event bus
- rpc SendEvent(SendEventRequest) returns (SendEventResponse);
-}
-
-message SendEventRequest {
- oneof event {
- // History was pruned - search index needs full rebuild
- HistoryPrunedEvent history_pruned = 1;
-
- // Specific history items were deleted
- HistoryDeletedEvent history_deleted = 2;
-
- // Request immediate sync
- ForceSyncEvent force_sync = 3;
-
- // Settings have changed, reload if needed
- SettingsReloadedEvent settings_reloaded = 4;
-
- // Request graceful shutdown
- ShutdownEvent shutdown = 5;
-
- // History was rebuilt - search index needs full rebuild
- HistoryRebuiltEvent history_rebuilt = 6;
- }
-}
-
-message SendEventResponse {
- // Empty on success; errors come through gRPC status
-}
-
-// Individual event message types
+ // Tell the daemon to perform a sync operation.
+ rpc ForceSync(ForceSyncRequest) returns (ForceSyncReply);
-message HistoryPrunedEvent {
- // No fields needed - just signals that pruning happened
-}
-
-message HistoryRebuiltEvent {
- // No fields needed - just signals that rebuilding happened
-}
+ // Query the daemon for it's status.
+ rpc Status(StatusRequest) returns (StatusReply);
-message HistoryDeletedEvent {
- // IDs of deleted history items (UUIDs as strings)
- repeated string ids = 1;
+ // Query the daemon about used paths.
+ rpc Paths(PathsRequest) returns (PathsReply);
}
-message ForceSyncEvent {
- // No fields needed - just triggers sync
+message ForceSyncRequest {}
+message ForceSyncReply {
+ optional string error = 1;
+ uint32 uploaded = 2;
+ uint32 downloaded = 3;
}
-message SettingsReloadedEvent {
- // No fields needed - components should re-read settings
+message StatusRequest {}
+message StatusReply {
+ bool healthy = 1;
+ string version = 2;
+ uint32 pid = 3;
+ uint32 protocol = 4;
}
-message ShutdownEvent {
- // No fields needed - triggers graceful shutdown
+message PathsRequest {}
+message PathsReply {
+ string config = 1;
+ string db = 2;
+ string socket = 3;
}
diff --git a/crates/turtle/proto/history.proto b/crates/turtle/proto/history.proto
index 59c12471..c6bdd99b 100644
--- a/crates/turtle/proto/history.proto
+++ b/crates/turtle/proto/history.proto
@@ -1,29 +1,37 @@
syntax = "proto3";
package history;
+service History {
+ rpc StartHistory(StartHistoryRequest) returns (StartHistoryReply);
+ rpc EndHistory(EndHistoryRequest) returns (EndHistoryReply);
+
+ rpc TailHistory(TailHistoryRequest) returns (stream TailHistoryReply);
+
+ // Request history from the daemon
+ rpc History(HistoryRequest) returns (HistoryReply);
+}
+
message StartHistoryRequest {
- // If people are still using my software in ~530 years, they can figure out a u128 migration
- uint64 timestamp = 1; // nanosecond unix epoch
+ Timestamp timestamp = 1;
string command = 2;
string cwd = 3;
string session = 4;
string hostname = 5;
string author = 6;
- string intent = 7;
+ optional string intent = 7;
}
-
-message EndHistoryRequest {
- string id = 1;
- int64 exit = 2;
- uint64 duration = 3;
-}
-
message StartHistoryReply {
string id = 1;
string version = 2;
uint32 protocol = 3;
}
+message EndHistoryRequest {
+ string id = 1;
+
+ int64 exit = 2;
+ Duration duration = 3;
+}
message EndHistoryReply {
string id = 1;
uint64 idx = 2;
@@ -31,22 +39,12 @@ message EndHistoryReply {
uint32 protocol = 4;
}
-message StatusRequest {}
-
-message StatusReply {
- bool healthy = 1;
- string version = 2;
- uint32 pid = 3;
- uint32 protocol = 4;
-}
-
-message ShutdownRequest {}
-
-message ShutdownReply {
- bool accepted = 1;
-}
message TailHistoryRequest {}
+message TailHistoryReply {
+ HistoryEventKind kind = 1;
+ HistoryEntry history = 2;
+}
enum HistoryEventKind {
HISTORY_EVENT_KIND_UNSPECIFIED = 0;
@@ -55,7 +53,7 @@ enum HistoryEventKind {
}
message HistoryEntry {
- uint64 timestamp = 1; // nanosecond unix epoch
+ Timestamp timestamp = 1;
string id = 2;
string command = 3;
string cwd = 4;
@@ -64,18 +62,26 @@ message HistoryEntry {
string author = 7;
string intent = 8;
int64 exit = 9;
- int64 duration = 10;
+ Duration duration = 10;
}
-message TailHistoryReply {
- HistoryEventKind kind = 1;
- HistoryEntry history = 2;
+message Range {
+ Timestamp start = 1;
+ Timestamp end = 2;
}
-service History {
- rpc StartHistory(StartHistoryRequest) returns (StartHistoryReply);
- rpc EndHistory(EndHistoryRequest) returns (EndHistoryReply);
- rpc TailHistory(TailHistoryRequest) returns (stream TailHistoryReply);
- rpc Status(StatusRequest) returns (StatusReply);
- rpc Shutdown(ShutdownRequest) returns (ShutdownReply);
+message Timestamp {
+ // Encoded as nanoseconds since the UNIX epoch.
+ uint64 value = 1;
+}
+message Duration {
+ // Encoded as nanoseconds.
+ uint64 value = 1;
+}
+
+message HistoryRequest {
+ Range range = 2;
+}
+message HistoryReply {
+ repeated HistoryEntry entries = 1;
}
diff --git a/crates/turtle/proto/search.proto b/crates/turtle/proto/search.proto
deleted file mode 100644
index 6b84acbd..00000000
--- a/crates/turtle/proto/search.proto
+++ /dev/null
@@ -1,35 +0,0 @@
-syntax = "proto3";
-package search;
-
-enum FilterMode {
- GLOBAL = 0;
- HOST = 1;
- SESSION = 2;
- DIRECTORY = 3;
- WORKSPACE = 4;
- SESSION_PRELOAD = 5;
-}
-
-message SearchContext {
- string session_id = 1;
- string cwd = 2;
- string hostname = 3;
- string host_id = 4;
- optional string git_root = 5;
-}
-
-message SearchRequest {
- string query = 1;
- uint64 query_id = 2; // Incrementing ID to match responses to queries
- FilterMode filter_mode = 3;
- SearchContext context = 4;
-}
-
-message SearchResponse {
- uint64 query_id = 1; // Echo back the query ID
- repeated bytes ids = 2;
-}
-
-service Search {
- rpc Search(stream SearchRequest) returns (stream SearchResponse);
-}
diff --git a/crates/turtle/proto/semantic.proto b/crates/turtle/proto/semantic.proto
deleted file mode 100644
index 07e550c8..00000000
--- a/crates/turtle/proto/semantic.proto
+++ /dev/null
@@ -1,47 +0,0 @@
-syntax = "proto3";
-package semantic;
-
-service Semantic {
- rpc RecordCommands(stream CommandCapture) returns (RecordCommandsReply);
- rpc CommandOutput(CommandOutputRequest) returns (CommandOutputReply);
-}
-
-message CommandCapture {
- string prompt = 1;
- string command = 2;
- string output = 3;
- optional int32 exit_code = 4;
- optional string history_id = 5;
- optional string session_id = 6;
- bool output_truncated = 7;
- uint64 output_observed_bytes = 8;
-}
-
-message RecordCommandsReply {
- uint64 accepted = 1;
-}
-
-message CommandOutputRequest {
- string history_id = 1;
- repeated OutputRange ranges = 2;
-}
-
-message OutputRange {
- int64 start = 1;
- int64 end = 2;
-}
-
-message OutputLine {
- uint64 line_number = 1;
- string content = 2;
-}
-
-message CommandOutputReply {
- bool found = 1;
- string output = 2;
- uint64 total_bytes = 3;
- uint64 total_lines = 4;
- repeated OutputLine lines = 5;
- bool output_truncated = 6;
- uint64 output_observed_bytes = 7;
-}