test(native-chat): cover marker boundary spacing

This commit is contained in:
Brennan Benson
2026-08-12 19:43:57 -07:00
parent ddbec7b9b0
commit 3e55fa254d
2 changed files with 4 additions and 2 deletions
@@ -44,8 +44,10 @@ describe('normalizeImageTranscriptMessages', () => {
it.each([
['[Image #1] describe this', 'describe this'],
['[Image #1]\t describe this', 'describe this'],
[' \t[Image #1] describe this', 'describe this'],
['describe this [Image #1]', 'describe this'],
['describe this \t[Image #1]', 'describe this'],
['describe this [Image #1]\t ', 'describe this'],
['describe [Image #1] this', 'describe this'],
['describe [Image #1]\t this', 'describe \t this'],
['describe[Image #1]\t this', 'describe\t this'],
@@ -3,8 +3,8 @@ import { isTextBlock, type NativeChatBlock, type NativeChatMessage } from './nat
const IMAGE_SOURCE_MARKER = /^\[Image:\s*source:\s*(.+?)\]\s*$/
const IMAGE_PROMPT_MARKER = /\[Image #\d+\]/
const IMAGE_PROMPT_MARKERS = /\[Image #\d+\]/g
const IMAGE_PROMPT_MARKER_AT_START = /^\[Image #\d+\]/
const IMAGE_PROMPT_MARKER_AT_END = /\[Image #\d+\]$/
const IMAGE_PROMPT_MARKER_AT_START = /^[^\S\r\n]*\[Image #\d+\]/
const IMAGE_PROMPT_MARKER_AT_END = /\[Image #\d+\][^\S\r\n]*$/
const HORIZONTAL_WHITESPACE_START = /^[^\S\r\n]+/
const HORIZONTAL_WHITESPACE_END = /[^\S\r\n]+$/