Server: chat:<id>-scoped find-in-chat search returning every occurrence, paged

A kind=chat search with scope chat:<id> returns one hit per text-part
occurrence (message id, part, UTF-16 offset/length), newest message first,
paged by cursor (a reply's next_cursor or a chat_messages next_cursor), with
optional case-sensitive matching. Scoped and global chat searches no longer
cancel each other on one connection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 00:25:09 +00:00
parent accb9970b6
commit 32c9c6b1df
5 changed files with 399 additions and 3 deletions
+7
View File
@@ -40,6 +40,13 @@ func isChatSearch(request protocol.Message) bool {
// chatSearchReply answers one kind=chat search request.
func chatSearchReply(ctx context.Context, request protocol.Message, broker chatBroker, registry operatorRegistry) protocol.Message {
if scopedChatSession(*request.Search) != "" {
response, err := searchChatScoped(ctx, *request.Search, broker)
if err != nil {
return protocol.Message{Type: protocol.Error, ID: request.ID, Error: err.Error()}
}
return protocol.Message{Type: protocol.SearchResults, ID: request.ID, SearchResults: response}
}
if registry == nil {
return protocol.Message{Type: protocol.Error, ID: request.ID, Error: "chat search unavailable: operator session registry is not configured on this server"}
}