getInput obtém entrada do usuário de forma segura. Uses the centralized stdin reader when active, falls back to direct read.
(promptStr string)
| 597 | // getInput obtém entrada do usuário de forma segura. |
| 598 | // Uses the centralized stdin reader when active, falls back to direct read. |
| 599 | func (a *AgentMode) getInput(promptStr string) string { |
| 600 | if runtime.GOOS != "windows" { |
| 601 | cmd := exec.Command(sttyPath, "sane") |
| 602 | cmd.Stdin = os.Stdin |
| 603 | _ = cmd.Run() |
| 604 | } |
| 605 | |
| 606 | // Enable bracketed paste mode for paste detection |
| 607 | if runtime.GOOS != "windows" || os.Getenv("WT_SESSION") != "" { |
| 608 | _, _ = os.Stdout.WriteString("\x1b[?2004h") |
| 609 | defer func() { _, _ = os.Stdout.WriteString("\x1b[?2004l") }() |
| 610 | } |
| 611 | |
| 612 | fmt.Print(promptStr) |
| 613 | |
| 614 | // Use centralized stdin reader (paste detection already handled there) |
| 615 | return a.readLine() |
| 616 | } |
| 617 | |
| 618 | // clientAndCtxForTurn resolves the LLM client and context for a single ReAct |
| 619 | // turn, honoring any skill model/effort hints captured at Run() start. |
no test coverage detected