From 56a9a61cece315fafbe0ebe96ab844ab4b06fbba Mon Sep 17 00:00:00 2001 From: Casey Brooks Date: Sat, 25 Apr 2026 10:50:04 +0000 Subject: [PATCH 1/3] feat(api): extend chat and threads --- proto/agynio/api/chat/v1/chat.proto | 14 ++++++++++++++ proto/agynio/api/gateway/v1/threads.proto | 1 + proto/agynio/api/threads/v1/threads.proto | 16 ++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/proto/agynio/api/chat/v1/chat.proto b/proto/agynio/api/chat/v1/chat.proto index 39918b6..b3ff269 100644 --- a/proto/agynio/api/chat/v1/chat.proto +++ b/proto/agynio/api/chat/v1/chat.proto @@ -52,6 +52,13 @@ enum ChatStatus { CHAT_STATUS_CLOSED = 2; } +enum ChatActivityStatus { + CHAT_ACTIVITY_STATUS_UNSPECIFIED = 0; + CHAT_ACTIVITY_STATUS_RUNNING = 1; + CHAT_ACTIVITY_STATUS_PENDING = 2; + CHAT_ACTIVITY_STATUS_FINISHED = 3; +} + // A chat thread between participants. message Chat { string id = 1; // UUID — maps to Threads thread_id @@ -61,6 +68,13 @@ message Chat { string organization_id = 5; // UUID — owning organization ChatStatus status = 6; optional string summary = 7; + // Workload activity state for the chat. + ChatActivityStatus activity_status = 8; + // Unacknowledged message count for the authenticated user. + // Derived from Threads.GetUnackedMessageCounts. + int32 unread_count = 9; + // Active workload IDs associated with the chat. + repeated string active_workload_ids = 10; } // A participant in a chat. diff --git a/proto/agynio/api/gateway/v1/threads.proto b/proto/agynio/api/gateway/v1/threads.proto index e9c6558..d1f15ff 100644 --- a/proto/agynio/api/gateway/v1/threads.proto +++ b/proto/agynio/api/gateway/v1/threads.proto @@ -17,5 +17,6 @@ service ThreadsGateway { rpc GetThread(agynio.api.threads.v1.GetThreadRequest) returns (agynio.api.threads.v1.GetThreadResponse); rpc GetMessages(agynio.api.threads.v1.GetMessagesRequest) returns (agynio.api.threads.v1.GetMessagesResponse); rpc GetUnackedMessages(agynio.api.threads.v1.GetUnackedMessagesRequest) returns (agynio.api.threads.v1.GetUnackedMessagesResponse); + rpc GetUnackedMessageCounts(agynio.api.threads.v1.GetUnackedMessageCountsRequest) returns (agynio.api.threads.v1.GetUnackedMessageCountsResponse); rpc AckMessages(agynio.api.threads.v1.AckMessagesRequest) returns (agynio.api.threads.v1.AckMessagesResponse); } diff --git a/proto/agynio/api/threads/v1/threads.proto b/proto/agynio/api/threads/v1/threads.proto index c209140..5f9aa8b 100644 --- a/proto/agynio/api/threads/v1/threads.proto +++ b/proto/agynio/api/threads/v1/threads.proto @@ -47,6 +47,9 @@ service ThreadsService { // List unacknowledged messages for a participant across all threads. rpc GetUnackedMessages(GetUnackedMessagesRequest) returns (GetUnackedMessagesResponse); + // Get unacknowledged message counts per thread for a participant. + rpc GetUnackedMessageCounts(GetUnackedMessageCountsRequest) returns (GetUnackedMessageCountsResponse); + // Acknowledge messages as processed by a participant. rpc AckMessages(AckMessagesRequest) returns (AckMessagesResponse); } @@ -337,6 +340,19 @@ message GetUnackedMessagesResponse { string next_page_token = 2; } +// =========================================================================== +// GetUnackedMessageCounts +// =========================================================================== + +message GetUnackedMessageCountsRequest { + string participant_id = 1; // UUID +} + +message GetUnackedMessageCountsResponse { + // key = thread_id, value = unacknowledged message count + map counts_by_thread_id = 1; +} + // =========================================================================== // AckMessages // =========================================================================== From 2d83274f422cc7c52d251651bb1b55342fa111fc Mon Sep 17 00:00:00 2001 From: Casey Brooks Date: Sat, 25 Apr 2026 11:07:25 +0000 Subject: [PATCH 2/3] docs(api): clarify chat workload docs --- proto/agynio/api/chat/v1/chat.proto | 20 ++++++++++++++------ proto/agynio/api/threads/v1/threads.proto | 3 ++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/proto/agynio/api/chat/v1/chat.proto b/proto/agynio/api/chat/v1/chat.proto index b3ff269..12f35db 100644 --- a/proto/agynio/api/chat/v1/chat.proto +++ b/proto/agynio/api/chat/v1/chat.proto @@ -28,7 +28,7 @@ service ChatService { rpc UpdateChat(UpdateChatRequest) returns (UpdateChatResponse); // List messages in a chat with pagination. - // Returns an unread_count derived from Threads.GetUnackedMessages. + // Returns an unread_count derived from Threads.GetUnackedMessageCounts. // Read-only — does not change acknowledgment state. rpc GetMessages(GetMessagesRequest) returns (GetMessagesResponse); @@ -53,9 +53,13 @@ enum ChatStatus { } enum ChatActivityStatus { + // No workload activity data available. CHAT_ACTIVITY_STATUS_UNSPECIFIED = 0; + // At least one active workload is running. CHAT_ACTIVITY_STATUS_RUNNING = 1; + // At least one active workload is pending and none running. CHAT_ACTIVITY_STATUS_PENDING = 2; + // No active workloads (active_workload_ids is empty). CHAT_ACTIVITY_STATUS_FINISHED = 3; } @@ -68,12 +72,16 @@ message Chat { string organization_id = 5; // UUID — owning organization ChatStatus status = 6; optional string summary = 7; - // Workload activity state for the chat. + // Workload activity summary for the chat. + // RUNNING if any active workload is running; PENDING if none running + // and at least one pending; FINISHED if no active workloads. UNSPECIFIED + // when workload activity is not tracked for this chat. ChatActivityStatus activity_status = 8; - // Unacknowledged message count for the authenticated user. - // Derived from Threads.GetUnackedMessageCounts. + // Unacknowledged message count for the authenticated user in this chat. + // Derived from Threads.GetUnackedMessageCounts (missing entry => 0). int32 unread_count = 9; - // Active workload IDs associated with the chat. + // Workload IDs in pending or running state for this chat. + // Empty when activity_status is FINISHED or UNSPECIFIED. repeated string active_workload_ids = 10; } @@ -152,7 +160,7 @@ message GetMessagesResponse { repeated ChatMessage messages = 1; string next_page_token = 2; // Number of unacknowledged messages for the authenticated user in this - // chat. Derived from Threads.GetUnackedMessages. + // chat. Derived from Threads.GetUnackedMessageCounts (missing entry => 0). int32 unread_count = 3; } diff --git a/proto/agynio/api/threads/v1/threads.proto b/proto/agynio/api/threads/v1/threads.proto index 5f9aa8b..18a7bd0 100644 --- a/proto/agynio/api/threads/v1/threads.proto +++ b/proto/agynio/api/threads/v1/threads.proto @@ -349,7 +349,8 @@ message GetUnackedMessageCountsRequest { } message GetUnackedMessageCountsResponse { - // key = thread_id, value = unacknowledged message count + // key = thread_id, value = unacknowledged message count. + // Only threads with unacknowledged messages are included (missing key => 0). map counts_by_thread_id = 1; } From 6712a9afbf0a62eea07828d340b20ebda7b192de Mon Sep 17 00:00:00 2001 From: Casey Brooks Date: Sat, 25 Apr 2026 11:21:30 +0000 Subject: [PATCH 3/3] docs(api): align chat workload docs --- proto/agynio/api/chat/v1/chat.proto | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/proto/agynio/api/chat/v1/chat.proto b/proto/agynio/api/chat/v1/chat.proto index 12f35db..88f5c64 100644 --- a/proto/agynio/api/chat/v1/chat.proto +++ b/proto/agynio/api/chat/v1/chat.proto @@ -53,13 +53,15 @@ enum ChatStatus { } enum ChatActivityStatus { - // No workload activity data available. + // No workload activity data available (no non-passive agent participants + // or the thread is degraded). CHAT_ACTIVITY_STATUS_UNSPECIFIED = 0; - // At least one active workload is running. + // At least one most recent workload is running. CHAT_ACTIVITY_STATUS_RUNNING = 1; - // At least one active workload is pending and none running. + // At least one most recent workload is starting, stopping, or failed + // (non-degraded), and none are running. CHAT_ACTIVITY_STATUS_PENDING = 2; - // No active workloads (active_workload_ids is empty). + // All most recent workloads are stopped or absent. CHAT_ACTIVITY_STATUS_FINISHED = 3; } @@ -72,16 +74,17 @@ message Chat { string organization_id = 5; // UUID — owning organization ChatStatus status = 6; optional string summary = 7; - // Workload activity summary for the chat. - // RUNNING if any active workload is running; PENDING if none running - // and at least one pending; FINISHED if no active workloads. UNSPECIFIED - // when workload activity is not tracked for this chat. + // Workload activity summary for the chat. Derived from the most recent + // workload per (thread, agent) with aggregation RUNNING > PENDING > FINISHED. + // PENDING includes starting, stopping, and (non-degraded) failed workloads, + // so it may be set even when active_workload_ids is empty. UNSPECIFIED when + // workload activity is not tracked for this chat. ChatActivityStatus activity_status = 8; // Unacknowledged message count for the authenticated user in this chat. // Derived from Threads.GetUnackedMessageCounts (missing entry => 0). int32 unread_count = 9; - // Workload IDs in pending or running state for this chat. - // Empty when activity_status is FINISHED or UNSPECIFIED. + // Workload IDs in starting, running, or stopping state for this chat. + // Failed and stopped workloads are excluded. repeated string active_workload_ids = 10; }