Resume
abox.Resume on the one SDK, pkg/abox.
Boots an existing root.raw. Empty id = latest session for this repo (go run . with no args). Pass a session id as os.Args[1]. The guest binary on that disk is whatever was cloned when the session was created. Protocol 2 features need a session opened after make image-update.
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()
id := ""
if len(os.Args) > 1 {
id = os.Args[1]
}
sess, err := abox.Resume(ctx, id, 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()
}