From 69513ff9668d101ba4a54608d0b00cde3ab80f78 Mon Sep 17 00:00:00 2001 From: christinatong01 Date: Tue, 27 Jan 2026 14:23:16 -0800 Subject: [PATCH] allow new convo creation on createSession --- README.md | 3 +++ src/transport.ts | 12 ++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3ea853a..1c70c31 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,9 @@ await using session4 = resumeSession(agentId, { defaultConversation: true }); // Resume last used session (agent + conversation) await using session5 = createSession({ continue: true }); + +// Create new agent with a new (non-default) conversation +await using session6 = createSession({ newConversation: true }); ``` **Key concepts:** diff --git a/src/transport.ts b/src/transport.ts index 503e4c0..6836193 100644 --- a/src/transport.ts +++ b/src/transport.ts @@ -182,14 +182,6 @@ export class SubprocessTransport { ); } - // newConversation requires agentId - if (this.options.newConversation && !this.options.agentId) { - throw new Error( - "'newConversation' requires agentId. " + - "Use resumeSession(agentId, { newConversation: true })." - ); - } - // Conversation and agent handling if (this.options.continue) { // Resume last session (agent + conversation) @@ -210,6 +202,10 @@ export class SubprocessTransport { } else { // Create new agent args.push("--new-agent"); + if (this.options.newConversation) { + // Also create new conversation (not default) + args.push("--new"); + } } // Model