Multi-turn

Session.Turn twice on one session on the one SDK, pkg/abox.

Two Turns on the same VM. Guest context persists for the process lifetime (and on root.raw after Close, for Resume).

CLI

The TUI is multi-turn on one VM. Guest context persists on root.raw after quit, for --resume <id>.

abox
# Remember the codeword: cedar. Reply ok.
# What was the codeword?

abox --resume <id>

abox exec is a single prompt. Two turns in one process is SDK (or two TUI messages).

SDK

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/AdminTurnedDevOps/ABox/pkg/abox"
)

func main() {
	ctx := context.Background()
	sess, err := abox.Open(ctx, abox.Options{})
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
	defer sess.Close()
	print := func(ev abox.Event) {
		if ev.Kind == "text" {
			fmt.Print(ev.Text)
		}
	}
	if _, err := sess.Turn(ctx, "Remember the codeword: cedar. Reply ok.", print); err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
	fmt.Println()
	if _, err := sess.Turn(ctx, "What was the codeword?", print); err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
	fmt.Println()
}