fix: surface remaining paired evidence loss (#203)
This commit is contained in:
@@ -5,7 +5,7 @@ export const IMAGE_TAG_RE =
|
||||
/\[Image:\s*(?:(?:[^\]\n]*?)\s*→\s*)?(\/[^\]\n]+)\]/g;
|
||||
const IMAGE_TAG_SEGMENT_RE = /\[Image:\s*(?:(.*?)\s*→\s*)?(\/[^\]\n]+)\]/g;
|
||||
const IMAGE_EXT_RE = /\.(png|jpe?g|gif|webp|bmp)$/i;
|
||||
const MARKDOWN_ABSOLUTE_LINK_RE = /!?\[[^\]\n]*\]\((\/[^)\n]+)\)/g;
|
||||
const MARKDOWN_IMAGE_ABSOLUTE_LINK_RE = /!\[[^\]\n]*\]\((\/[^)\n]+)\)/g;
|
||||
const MEDIA_TAG_RE =
|
||||
/^[ \t]*MEDIA:\s*(?:"([^"\n]+)"|'([^'\n]+)'|`([^`\n]+)`|(\/\S+))[ \t]*$/gm;
|
||||
|
||||
@@ -158,7 +158,7 @@ export function extractMarkdownImageAttachments(text: string): {
|
||||
} {
|
||||
const attachments: RunnerOutputAttachment[] = [];
|
||||
const cleanText = text.replace(
|
||||
MARKDOWN_ABSOLUTE_LINK_RE,
|
||||
MARKDOWN_IMAGE_ABSOLUTE_LINK_RE,
|
||||
(full: string, rawPath: string) => {
|
||||
const trimmed = rawPath.trim();
|
||||
if (!IMAGE_EXT_RE.test(trimmed)) return full;
|
||||
|
||||
@@ -10,10 +10,11 @@ describe('normalizeAgentOutput', () => {
|
||||
it('extracts markdown image attachments without rewriting normal links', () => {
|
||||
expect(
|
||||
extractMarkdownImageAttachments(
|
||||
'결과입니다.\n\n[code](/tmp/source.ts#L10)',
|
||||
'결과입니다.\n\n[render link](/tmp/render.png)\n[code](/tmp/source.ts#L10)',
|
||||
),
|
||||
).toEqual({
|
||||
cleanText: '결과입니다.\n\n[code](/tmp/source.ts#L10)',
|
||||
cleanText:
|
||||
'결과입니다.\n\n[render link](/tmp/render.png)\n[code](/tmp/source.ts#L10)',
|
||||
attachments: [
|
||||
{
|
||||
path: '/tmp/result.png',
|
||||
|
||||
Reference in New Issue
Block a user