Adopt session.redirect (issue #710) (#714)

* Add session.redirect affordance (issue #710)

Route send through session.redirect while a turn is streaming and the prompt
is plain text (no attachments, not a /command); otherwise prompt.submit.
Adds WsMethods.SESSION_REDIRECT + HermesWsClient.sendRedirect. No separate
button — the composer already sends mid-turn, so send just does the redirect.

* fix(chat): capture typing state before sendMessage for redirect

Capture wasStreaming state before updating uiState.isAgentTyping so normal sends call prompt.submit.

---------

Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
M57andM57 authored and GitHub committed 2026-07-25 18:15:39 +03:00
1 parent 4e2fb05077
commit c181d1d593
4 files changed
+55 -5

No files matched your search

@@ -1117,6 +1117,23 @@ class ChatViewModelTest {
verify { HermesWsClient.sendMessage(sessionId, "Hello Hermes", any()) }
}
@Test
fun testSendMessageRedirectWhenStreaming() =
runTest {
val (viewModel, sessionId) = createViewModelWithSession()
// First send starts streaming
viewModel.sendMessage("Hello Hermes")
advanceUntilIdle()
assertTrue(viewModel.uiState.value.isAgentTyping)
// Second send while streaming triggers redirect
viewModel.sendMessage("Wait, correction")
advanceUntilIdle()
verify { HermesWsClient.sendRedirect(sessionId, "Wait, correction", any()) }
}
// ── Session switch ───────────────────────────────────────────────────────
@Test