Unify the voice and text turn pipelines into runTurn

HandlePushToTalk and handleText hand-wrote the same eight-step turn
sequence twice, comments in the latter saying "same as HandlePushToTalk"
four times. Extract it into runTurn(ctx, text) string: the voice path
wraps it in stt/tts, the text path returns it directly.

The two had drifted. The text path was missing the quiet-hours toggle
check entirely, so "тихий режим" over IPC/telegram fell through to the
classifier; unifying gives it the check. It also logged the route result
and applyAction return where the voice path did not — both logs are kept
for both paths.
This commit is contained in:
kami
2026-08-01 00:48:50 +04:00
parent c00e3003bf
commit 88d07b5175
2 changed files with 43 additions and 77 deletions
+1 -1
View File
@@ -26,7 +26,7 @@
// authority") — a handler must never special-case a clarify-completed
// decision to skip the confirm gate or the allowlist.
// - detectPattern and dialogue-session bookkeeping (rememberTurn,
// followUpMerge) run in the callers (handleText, HandlePushToTalk,
// followUpMerge) run in the callers (runTurn,
// finishClarified), not per-intent, and are untouched by this slice.
//
// Adding an intent: write its handler here, add one line to actionHandlers.