Search: find operator chats by title, directory and message text

A search with kind chat matches the operator-session registry's titles and
directories and the newest messages of recent transcripts through the chat
broker (bounded count, concurrency and one-second budget), answered off the
connection's read loop. The all-kind search is unchanged for older clients.

The app sends the chat search after its run search and shows a Chats group
with title, harness, directory and snippet; a chat hit opens that chat in the
Chat tab. The probe fixture answers chat searches over ?chats=N.
This commit is contained in:
2026-11-03 13:01:53 +00:00
parent d34185b56c
commit bff7115e4e
31 changed files with 1659 additions and 118 deletions
+15
View File
@@ -217,6 +217,11 @@ func HandlerWithOptions(ctx context.Context, options Options, stores ...*pipelin
if notes != nil {
defer notes.detach(clientID)
}
// A chat search runs beside the read loop so its transcript readback
// never delays the run search sent with it; a newer one cancels the
// previous, whose reply the client would discard as stale anyway.
cancelChatSearch := func() {}
defer func() { cancelChatSearch() }()
for {
var request protocol.Message
if err := wsjson.Read(connCtx, conn, &request); err != nil {
@@ -227,6 +232,16 @@ func HandlerWithOptions(ctx context.Context, options Options, stores ...*pipelin
_ = write(protocol.Message{Type: protocol.Error, ID: request.ID, Error: "pipeline authoring is disabled on this execution server; ask the operator to publish through an explicitly enabled authoring server"})
continue
}
if isChatSearch(request) {
cancelChatSearch()
searchCtx, cancel := context.WithCancel(connCtx)
cancelChatSearch = cancel
go func(request protocol.Message) {
defer cancel()
_ = write(chatSearchReply(searchCtx, request, options.Chat, registry))
}(request)
continue
}
if handleChat(connCtx, request, options.Chat, hub, registry, clientID, write) {
continue
}