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 32f17e12ab..51aa245d9d 100644 --- a/src/core/message-parsing/__tests__/directive-streaming-parser.spec.ts +++ b/src/core/message-parsing/__tests__/directive-streaming-parser.spec.ts @@ -123,4 +123,18 @@ suite("DirectiveStreamingParser", () => { expect(result[0].type).toBe("text") expect(result[1].type).toBe("log_message") }) + + test("should not parse directives inside ```xml code blocks", () => { + const input = + "Here's the basic format:\n\n```xml\n\nThis is a debug message for detailed troubleshooting information\ndebug\n\n```\n\nThat should be treated as code." + const result = DirectiveStreamingParser.parse(input) + expect(result).toEqual([ + { + type: "text", + content: + "Here's the basic format:\n\n```xml\n\nThis is a debug message for detailed troubleshooting information\ndebug\n\n```\n\nThat should be treated as code.", + partial: true, + } as TextDirective, + ]) + }) })