Creates a new idle session whose transcript is the source path up to a cut, with the same entry
ids. Nothing live is shared (listeners, queue, run, lock, usage); the fork's file is written
lazily at its first own message, with parentSession and gptr.forkOf in its header. The
fork's workspace is an overlay of the source's kept home: it reads every object of the source
at zero cost, and its writes stay in the overlay.
Usage
gptr_fork(s, at = NULL, envir = c("overlay", "shared"))Examples
fake = gptr_fake_provider(list("A", "B"))
session = peter("first", model = fake)
#> gptr: thinking
#> gptr: done · 1 turn · 1.6k tokens · $0.0000
branch = gptr_fork(session)
branch |> peter("branch")
#> gptr: thinking
#> gptr: done · 2 turns · 1.6k tokens · $0.0000
#> B
#> idle · fake/fake-1 · 2 turns · 1.6k tokens · $0.0000 · sc83c4ca36b
c(session$turns, branch$turns)
#> [1] 1 2