From f10ab35312c5eb1c680b0b2f1231cfec5f3f078a Mon Sep 17 00:00:00 2001 From: "Steven T. Cramer" Date: Mon, 16 Jun 2025 14:12:05 +0700 Subject: [PATCH] Add test case for directives inside triple backticks --- .../__tests__/directive-streaming-parser.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/core/message-parsing/__tests__/directive-streaming-parser.spec.ts b/src/core/message-parsing/__tests__/directive-streaming-parser.spec.ts index 1d6957a827..66012c24a0 100644 --- a/src/core/message-parsing/__tests__/directive-streaming-parser.spec.ts +++ b/src/core/message-parsing/__tests__/directive-streaming-parser.spec.ts @@ -64,4 +64,18 @@ suite("DirectiveStreamingParser", () => { } as ToolDirective, ]) }) + + test("should not parse directives inside triple backticks as directives", () => { + const input = + "Some text with\n```\n\nThis is a warning message\nwarn\n\n```\nMore text" + const result = DirectiveStreamingParser.parse(input) + expect(result).toEqual([ + { + type: "text", + content: + "Some text with\n```\n\nThis is a warning message\nwarn\n\n```\nMore text", + partial: true, + } as TextDirective, + ]) + }) })