From 8360812e1db73fa6f081a6a5e40421998b1f329f Mon Sep 17 00:00:00 2001 From: Eyejoker Date: Tue, 31 Mar 2026 05:01:21 +0900 Subject: [PATCH] fix: align ContentBlock media_type with SDK 0.2.87 literal union type --- runners/agent-runner/src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runners/agent-runner/src/index.ts b/runners/agent-runner/src/index.ts index 09906e9..8a0bb44 100644 --- a/runners/agent-runner/src/index.ts +++ b/runners/agent-runner/src/index.ts @@ -73,7 +73,7 @@ interface SessionsIndex { type ContentBlock = | { type: 'text'; text: string } - | { type: 'image'; source: { type: 'base64'; media_type: string; data: string } }; + | { type: 'image'; source: { type: 'base64'; media_type: 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp'; data: string } }; interface SDKUserMessage { type: 'user'; @@ -140,7 +140,7 @@ function buildMultimodalContent(text: string): string | ContentBlock[] { } const data = fs.readFileSync(imgPath).toString('base64'); const ext = path.extname(imgPath).toLowerCase(); - const mediaType = MIME_TYPES[ext] || 'image/png'; + const mediaType = (MIME_TYPES[ext] || 'image/png') as 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp'; blocks.push({ type: 'image', source: { type: 'base64', media_type: mediaType, data } }); log(`Added image block: ${imgPath} (${mediaType})`); } catch (err) {