+// warm sends the warm-up request, when the builds are done and no message
+// waits.
+func (l *loop) warm(ctx context.Context) error {
+ err := l.memory.Wait(ctx)
+ if err != nil || l.waiting() {
+ return err
+ }
+
+ instructions, err := l.agent.Prompt()
+ if err != nil {
+ return err
+ }
+
+ view, err := l.layout.Split(l.memory.ViewLines(nil))
+ if err != nil {
+ return err
+ }
+
+ _, err = l.client.Create(ctx, Request{
+ Model: l.agent.config.Model,
+ Effort: l.agent.config.Effort,
+ Instructions: instructions,
+ Tools: agentTools(),
+ Input: warmUpInput(view),
+ Turn: "warmup",
+ StopAtOutput: true,
+ })
+
+ return err
+}
+
+// state returns the per-turn state: the end of the view, and the date and time
+// of the turn.