cmdContinue feeds a block and its output back to the LLM for continuation. Returns true when the action consumed the plan and the caller must exit.
(ctx context.Context, renderer *agent.UIRenderer, blocks []CommandBlock, outputs []*CommandOutput, answer string)
| 607 | // cmdContinue feeds a block and its output back to the LLM for continuation. |
| 608 | // Returns true when the action consumed the plan and the caller must exit. |
| 609 | func (a *AgentMode) cmdContinue(ctx context.Context, renderer *agent.UIRenderer, blocks []CommandBlock, outputs []*CommandOutput, answer string) bool { |
| 610 | cmdNumStr := strings.TrimPrefix(answer, "c") |
| 611 | cmdNum, err := strconv.Atoi(cmdNumStr) |
| 612 | if err != nil || cmdNum < 1 || cmdNum > len(blocks) { |
| 613 | fmt.Println(i18n.T("agent.error.invalid_command_number_continue")) |
| 614 | _ = a.getInput(renderer.Colorize(i18n.T("agent.status.press_enter"), agent.ColorGray)) |
| 615 | return false |
| 616 | } |
| 617 | if outputs[cmdNum-1] == nil { |
| 618 | fmt.Println(i18n.T("agent.status.command_not_executed")) |
| 619 | _ = a.getInput(renderer.Colorize(i18n.T("agent.status.press_enter"), agent.ColorGray)) |
| 620 | return false |
| 621 | } |
| 622 | |
| 623 | // Monta o prompt para a IA |
| 624 | toolContext := a.getToolContextString() |
| 625 | prompt := i18n.T("agent.llm_prompt.continuation", |
| 626 | strings.Join(blocks[cmdNum-1].Commands, "\n"), |
| 627 | strings.Join(blocks[cmdNum-1].Commands, "\n"), |
| 628 | outputs[cmdNum-1].Output, |
| 629 | outputs[cmdNum-1].ErrorMsg, |
| 630 | ) + toolContext |
| 631 | |
| 632 | a.cli.history = append(a.cli.history, models.Message{Role: "user", Content: prompt}) |
| 633 | |
| 634 | // Chama o loop de processamento unificado |
| 635 | a.continueWithNewAIResponse(ctx) |
| 636 | |
| 637 | // Sai do loop do plano de ação atual |
| 638 | return true |
| 639 | } |
| 640 | |
| 641 | // cmdPreContext sends extra context before executing a block. Returns true |
| 642 | // when the action consumed the plan and the caller must exit. |
no test coverage detected