Ariver
2026-07-12 33f00a1136c9f7e501b989d432b709d632905304
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package services
 
import (
    "voicesnap/internal/axinput"
    "voicesnap/internal/logger"
    "voicesnap/internal/textoutput"
)
 
// TextOutputService exposes the latest production output result and explicit
// clipboard fallback actions. It never auto-pastes fallback text.
type TextOutputService struct {
    router *textoutput.Router
}
 
func NewTextOutputService(router *textoutput.Router) *TextOutputService {
    return &TextOutputService{router: router}
}
 
func (s *TextOutputService) GetLastResult() textoutput.Result {
    if s.router == nil {
        return textoutput.Result{OK: false, Method: "text_output_router", Message: "text output router is unavailable"}
    }
    return s.router.LastResult()
}
 
func (s *TextOutputService) PrepareLastClipboardFallback() axinput.ClipboardResult {
    if s.router == nil {
        return axinput.ClipboardResult{OK: false, Message: "text output router is unavailable"}
    }
    logger.Info("Text output fallback prepare service called")
    result := s.router.PrepareLastClipboardFallback()
    logger.Info(
        "Text output fallback prepare service returned ok=%t prepared=%t token_present=%t",
        result.OK,
        result.Prepared,
        result.Token != "",
    )
    return result
}
 
func (s *TextOutputService) RestoreClipboardFallback(token string) axinput.ClipboardResult {
    if s.router == nil {
        return axinput.ClipboardResult{OK: false, Message: "text output router is unavailable"}
    }
    logger.Info("Text output fallback restore service called token_present=%t", token != "")
    result := s.router.RestoreClipboardFallback(token)
    logger.Info(
        "Text output fallback restore service returned ok=%t restored=%t token_present=%t",
        result.OK,
        result.Restored,
        token != "",
    )
    return result
}