feat: add fork_session option for resuming sessions (#179)
Some checks failed
Lint / lint (push) Has been cancelled
Test / test (3.10) (push) Has been cancelled
Test / test (3.11) (push) Has been cancelled
Test / test (3.12) (push) Has been cancelled
Test / test (3.13) (push) Has been cancelled
Test / test-e2e (3.11) (push) Has been cancelled
Test / test-e2e (3.13) (push) Has been cancelled
Test / test-examples (3.10) (push) Has been cancelled
Test / test-examples (3.11) (push) Has been cancelled
Test / test-examples (3.12) (push) Has been cancelled
Test / test-e2e (3.12) (push) Has been cancelled
Test / test-e2e (3.10) (push) Has been cancelled
Test / test-examples (3.13) (push) Has been cancelled

Add support for fork_session parameter which allows resumed sessions to
fork to a new session ID rather than continuing the previous session.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
blois 2025-09-23 21:34:22 -07:00 committed by GitHub
parent 12fdca9b1b
commit cfdd28a254
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View file

@ -153,6 +153,9 @@ class SubprocessCLITransport(Transport):
if self._options.include_partial_messages:
cmd.append("--include-partial-messages")
if self._options.fork_session:
cmd.append("--fork-session")
# Add extra args for future CLI flags
for flag, value in self._options.extra_args.items():
if value is None:

View file

@ -314,6 +314,9 @@ class ClaudeCodeOptions:
# Partial message streaming support
include_partial_messages: bool = False
# When true resumed sessions will fork to a new session ID rather than
# continuing the previous session.
fork_session: bool = False
# SDK Control Protocol