From cefa7ccc581cc782d36c1cb17ff50b800616c0cf Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Feb 2026 08:27:15 +0000 Subject: [PATCH] fix: throw error when input streams are used without v2 realtime streams Instead of silently hanging, on() and once() now throw immediately with a clear error message telling the developer to enable v2RealtimeStreams. https://claude.ai/code/session_01SJHJts7r2yAxmoKLLz8vpc --- packages/core/src/v3/inputStreams/manager.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/core/src/v3/inputStreams/manager.ts b/packages/core/src/v3/inputStreams/manager.ts index b051d0761..25ad90b96 100644 --- a/packages/core/src/v3/inputStreams/manager.ts +++ b/packages/core/src/v3/inputStreams/manager.ts @@ -41,6 +41,8 @@ export class StandardInputStreamManager implements InputStreamManager { } on(streamId: string, handler: InputStreamHandler): { off: () => void } { + this.#requireV2Streams(); + let handlerSet = this.handlers.get(streamId); if (!handlerSet) { handlerSet = new Set(); @@ -71,6 +73,8 @@ export class StandardInputStreamManager implements InputStreamManager { } once(streamId: string, options?: InputStreamOnceOptions): Promise { + this.#requireV2Streams(); + // Lazily connect the tail on first listener registration this.#ensureTailConnected(); @@ -170,8 +174,16 @@ export class StandardInputStreamManager implements InputStreamManager { this.buffer.clear(); } + #requireV2Streams(): void { + if (this.currentRunId && this.streamsVersion !== "v2") { + throw new Error( + "Input streams require v2 realtime streams. Enable them with: { future: { v2RealtimeStreams: true } }" + ); + } + } + #ensureTailConnected(): void { - if (!this.tailAbortController && this.currentRunId && this.streamsVersion === "v2") { + if (!this.tailAbortController && this.currentRunId) { this.connectTail(this.currentRunId); } }