A webhook set SenderID to its configured route path. The turn path reads that field through a per-channel resolver which refuses webhook, but the session curator derives its participant from the raw field with no channel filter, so a webhook session with exactly one distinct sender and one extracted fact wrote agent-user memory addressed to User: "/hooks/...". Nothing reads it, and every pass added more, because the facts are identical strings with no dedup. docs/prds/memory-engine-unification.md criterion 7 requires that a route path never become a user identity. Clear it at the producer rather than teaching every consumer which channels are lying: a route path is a source, not a person, so it no longer enters SenderID. It still keys the inbound rate limit, where it is the documented per-source budget for webhooks (config.RateLimitConfig), so it travels in the new transport-only Inbound.BudgetKey -- carried on the wire beside Page, never persisted, and never read as an identity. pb.Message gains budget_key (field 9) for the same reason page (field 7) exists: transport context that rides with an inbound message and is deliberately absent from storedProto's rendering of a canonical record. The curator needs no change. An empty SenderID already fails closed as an unidentified user message, which is the path a dashboard session takes, and sessionParticipant's existing skip covers it; the test name now says so.
161 lines
6.7 KiB
Protocol Buffer
161 lines
6.7 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package gateway.v1;
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
service ChatService {
|
|
rpc Snapshot(SnapshotRequest) returns (SnapshotResponse);
|
|
rpc GetSession(GetSessionRequest) returns (GetSessionResponse);
|
|
rpc RecentMessages(RecentMessagesRequest) returns (RecentMessagesResponse);
|
|
rpc RecentTurns(RecentTurnsRequest) returns (RecentTurnsResponse);
|
|
rpc Route(RouteRequest) returns (RouteResponse);
|
|
rpc Stream(StreamRequest) returns (stream StreamResponse);
|
|
rpc Cancel(CancelRequest) returns (CancelResponse);
|
|
rpc SetPersona(SetPersonaRequest) returns (SetPersonaResponse);
|
|
rpc ApplyTaskAction(ApplyTaskActionRequest) returns (ApplyTaskActionResponse);
|
|
rpc ApplyOperatorTaskAction(ApplyOperatorTaskActionRequest) returns (ApplyOperatorTaskActionResponse);
|
|
rpc SaveSession(SaveSessionRequest) returns (SaveSessionResponse);
|
|
rpc GetSessionsByChannel(GetSessionsByChannelRequest) returns (GetSessionsByChannelResponse);
|
|
rpc DeleteSession(DeleteSessionRequest) returns (DeleteSessionResponse);
|
|
rpc TouchSession(TouchSessionRequest) returns (TouchSessionResponse);
|
|
rpc ListSessions(ListSessionsRequest) returns (ListSessionsResponse);
|
|
rpc SaveMessage(SaveMessageRequest) returns (SaveMessageResponse);
|
|
rpc DeleteRecentMessages(DeleteRecentMessagesRequest) returns (DeleteRecentMessagesResponse);
|
|
rpc MessageCount(MessageCountRequest) returns (MessageCountResponse);
|
|
rpc SaveMessages(SaveMessagesRequest) returns (SaveMessagesResponse);
|
|
rpc ReplaceMessages(ReplaceMessagesRequest) returns (ReplaceMessagesResponse);
|
|
rpc SearchMessages(SearchMessagesRequest) returns (SearchMessagesResponse);
|
|
}
|
|
|
|
message Session {
|
|
string session_id = 1;
|
|
string platform = 2;
|
|
string bot_user = 3;
|
|
string channel_id = 4;
|
|
string thread_id = 5;
|
|
string title = 6;
|
|
string parent_session_id = 7;
|
|
string branch_name = 8;
|
|
google.protobuf.Timestamp created_at = 9;
|
|
google.protobuf.Timestamp last_active_at = 10;
|
|
}
|
|
message Message {
|
|
string message_id = 1;
|
|
string source_id = 2;
|
|
string channel_id = 3;
|
|
string thread_id = 4;
|
|
string from = 5;
|
|
string text = 6;
|
|
string page = 7;
|
|
google.protobuf.Timestamp at = 8;
|
|
// budget_key is the source an inbound message is charged against by the
|
|
// Gateway's inbound rate limiter, for a channel that has no per-person
|
|
// sender id but does have a stable, operator-controlled source of its own
|
|
// -- a webhook's configured route path. Transport-only: a channel frontend
|
|
// sets it on inbound and it is never persisted, exactly like page. Empty
|
|
// means the message is not rate limited.
|
|
string budget_key = 9;
|
|
}
|
|
message ToolCall {
|
|
string id = 1;
|
|
string name = 2;
|
|
string parameters = 3;
|
|
string output = 4;
|
|
string error = 5;
|
|
}
|
|
message Media {
|
|
string tool_name = 1;
|
|
string type = 2;
|
|
string file_id = 3;
|
|
string url = 4;
|
|
string path = 5;
|
|
string mime_type = 6;
|
|
string file_name = 7;
|
|
optional int64 file_size = 8;
|
|
optional int64 width = 9;
|
|
optional int64 height = 10;
|
|
optional int64 duration = 11;
|
|
}
|
|
message Turn {
|
|
string turn_id = 1;
|
|
string session_id = 2;
|
|
string source_id = 3;
|
|
string status = 4;
|
|
int64 attempt = 5;
|
|
string owner_id = 6;
|
|
string input_message_id = 7;
|
|
string assistant_message_id = 8;
|
|
string partial_text = 9;
|
|
string response_text = 10;
|
|
repeated ToolCall tool_calls = 11;
|
|
string error = 12;
|
|
google.protobuf.Timestamp created_at = 13;
|
|
google.protobuf.Timestamp updated_at = 14;
|
|
}
|
|
message StringList { repeated string values = 1; }
|
|
message SnapshotRequest {}
|
|
message SnapshotResponse {
|
|
repeated Session sessions = 1;
|
|
repeated string models = 2;
|
|
map<string, StringList> models_by_provider = 3;
|
|
repeated string providers = 4;
|
|
string active_model = 5;
|
|
string active_provider = 6;
|
|
repeated string personas = 7;
|
|
map<string, string> active_personas = 8;
|
|
bool restart_available = 9;
|
|
bool cancellation_available = 10;
|
|
bool personas_available = 11;
|
|
string version = 12;
|
|
}
|
|
message GetSessionRequest { string session_id = 1; }
|
|
message GetSessionResponse { Session session = 1; bool found = 2; }
|
|
message RecentMessagesRequest { string session_id = 1; int64 limit = 2; }
|
|
message RecentMessagesResponse { repeated Message messages = 1; }
|
|
message RecentTurnsRequest { string session_id = 1; int64 limit = 2; }
|
|
message RecentTurnsResponse { repeated Turn turns = 1; }
|
|
message RouteRequest { Message message = 1; }
|
|
message RouteResponse { string text = 1; string session_id = 2; }
|
|
message StreamRequest { Message message = 1; }
|
|
message StreamResponse {
|
|
string kind = 1;
|
|
string text = 2;
|
|
string session_id = 3;
|
|
ToolCall tool = 4;
|
|
Media media = 5;
|
|
}
|
|
message CancelRequest { string session_id = 1; }
|
|
message CancelResponse { bool cancelled = 1; int64 dropped = 2; }
|
|
message SetPersonaRequest { string session_id = 1; string name = 2; }
|
|
message SetPersonaResponse { bool found = 1; }
|
|
message ApplyTaskActionRequest { string identity = 1; int64 task_id = 2; string action = 3; }
|
|
message ApplyTaskActionResponse { int64 task_id = 1; string action = 2; string message = 3; }
|
|
// An authenticated dashboard operator acts across identities, so this request
|
|
// carries no identity to scope against -- the distinction the daemon's task
|
|
// action service draws with a nil identity (internal/domain/taskactions).
|
|
message ApplyOperatorTaskActionRequest { int64 task_id = 1; string action = 2; }
|
|
message ApplyOperatorTaskActionResponse { int64 task_id = 1; string action = 2; string message = 3; }
|
|
message SaveSessionResponse {}
|
|
message SaveSessionRequest { Session session = 1; }
|
|
message GetSessionsByChannelRequest { string platform = 1; string channel_id = 2; }
|
|
message GetSessionsByChannelResponse { repeated Session sessions = 1; }
|
|
message ListSessionsResponse { repeated Session sessions = 1; }
|
|
message DeleteSessionResponse {}
|
|
message TouchSessionResponse {}
|
|
message SaveMessageResponse {}
|
|
message SaveMessagesResponse {}
|
|
message ReplaceMessagesResponse {}
|
|
message DeleteSessionRequest { string session_id = 1; }
|
|
message TouchSessionRequest { string session_id = 1; }
|
|
message ListSessionsRequest {}
|
|
message SaveMessageRequest { string session_id = 1; Message message = 2; }
|
|
message DeleteRecentMessagesRequest { string session_id = 1; int64 limit = 2; }
|
|
message DeleteRecentMessagesResponse { int64 deleted = 1; }
|
|
message MessageCountRequest { string session_id = 1; }
|
|
message MessageCountResponse { int64 count = 1; }
|
|
message SaveMessagesRequest { string session_id = 1; repeated Message messages = 2; }
|
|
message ReplaceMessagesRequest { string session_id = 1; repeated Message messages = 2; repeated string superseded = 3; }
|
|
message SearchMessagesRequest { string session_id = 1; string query = 2; int64 limit = 3; int64 offset = 4; }
|
|
message SearchMessagesResponse { repeated Message messages = 1; int64 next_offset = 2; bool has_more = 3; bool truncated = 4; }
|