anthropics / anthropics/claude-agent-sdk-typescript
Feature Request: Add resumeSessionAt and forkSession support to V2 session API
- Lenguaje dominante
- Shell
- Estrellas
- 1.8k
- Forks
- 226
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
## Summary
The V2 session API (`unstable_v2_createSession` / `unstable_v2_resumeSession`) currently lacks
support for session forking and resuming from a specific message point. These capabilities exist
in the V1 SDK via `resumeSessionAt`, `forkSession` option on `query()`, and the standalone
`forkSession()` function (added in v0.2.76), but are listed as unavailable in V2 per the docs.
## Requested V2 API surface
### Option A: Extend `unstable_v2_resumeSession`
```ts
const session = unstable_v2_resumeSession(sessionId, {
model: "claude-sonnet-4-6",
resumeAt: messageUuid, // resume up to this message (inclusive)
fork: true, // create a new branch instead of mutating original
});
```
### Option B: Add a dedicated `unstable_v2_forkSession`
```ts
const forkedSession = unstable_v2_forkSession(sessionId, {
model: "claude-sonnet-4-6",
upToMessageId: messageUuid,
title: "Alternative approach",
});
// forkedSession has .send() / .stream() like a normal session
```
## Use Cases
- **Checkpoint/branch workflows** — Users exploring multiple approaches from a conversation
midpoint (analogous to Claude Code's checkpointing feature)
- **Edit/retry from history** — Letting users "go back" to message N and try a different prompt
- **A/B exploration** — Forking a planning session to compare two strategies without replaying
the full conversation
## Current workaround
Use the V1 `forkSession()` function or `query()` with `resumeSessionAt` + `forkSession: true`,
then pass the resulting session ID to `unstable_v2_resumeSession()`.
## Related
- #88 — Feature Request: Forking From Historical Messages (closed, resolved for V1)
- V2 docs note: "Session forking (forkSession option) — only available in V1 SDK"
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.