Resume

abox.Resume on the one SDK, pkg/abox.

Boots an existing root.raw by session id (go run . <id>). The guest binary on that disk is whatever was cloned when the session was created. Protocol 4 is required; resume of a pre-rebuild disk returns ErrGuestTooOld.

CLI

abox --resume <id>            # that session's root.raw
abox exec --resume <id> --prompt "Summarize what we already did in this session."

Ids are directory names under ~/.abox/sessions/. Resume boots the existing root.raw; it does not re-copy the host source directory. Same protocol-4 rule as the SDK: an old disk fails at start (Errors).

SDK

package main

import (
	"context"
	"fmt"
	"os"
	"os/signal"

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

func main() {
	ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
	defer stop()
	if len(os.Args) != 2 {
		fmt.Fprintln(os.Stderr, "usage: sdk-resume <session-id>")
		os.Exit(2)
	}
	sess, err := abox.Resume(ctx, os.Args[1], abox.Options{})
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
	defer sess.Close()
	fmt.Println("resumed", sess.ID(), "protocol", sess.Capabilities().Protocol)
	_, err = sess.Turn(ctx, "Summarize what we already did in this session.", func(ev abox.Event) {
		if ev.Kind == "text" {
			fmt.Print(ev.Text)
		}
	})
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
	fmt.Println()
}