Problem
Claude CLI runtime (src/middleware/runtimes/claude.ts) currently only handles text prompts. It needs to support inbound image attachments via the --input-format stream-json stdin protocol.
Current state
- Uses
--print flag for prompt delivery — no media support
buildEnv() returns {}
- Output parsing via
--output-format stream-json --verbose --include-partial-messages
Implementation
Inbound (images only)
- Switch from
--print to --input-format stream-json stdin mode when params.media is present
- Construct
tool_result image content blocks:
{ "type": "image", "source": { "type": "base64", "media_type": "image/jpeg", "data": "..." } }
- Only images are supported — audio/video must be handled by middleware STT/fallback
- Declare capability:
acceptsInbound: ["image/"]
Outbound
- No native media emission capability
emitsOutbound: false
Capability declaration
readonly mediaCapabilities = {
acceptsInbound: ["image/"],
emitsOutbound: false,
};
Tests
Unit tests (src/middleware/runtimes/claude.test.ts)
Live smoke tests (src/middleware/__smoke__/claude.live.test.ts)
Depends on
Related
Problem
Claude CLI runtime (
src/middleware/runtimes/claude.ts) currently only handles text prompts. It needs to support inbound image attachments via the--input-format stream-jsonstdin protocol.Current state
--printflag for prompt delivery — no media supportbuildEnv()returns{}--output-format stream-json --verbose --include-partial-messagesImplementation
Inbound (images only)
--printto--input-format stream-jsonstdin mode whenparams.mediais presenttool_resultimage content blocks:{ "type": "image", "source": { "type": "base64", "media_type": "image/jpeg", "data": "..." } }acceptsInbound: ["image/"]Outbound
emitsOutbound: falseCapability declaration
Tests
Unit tests (
src/middleware/runtimes/claude.test.ts)execute()withmedia: [{ mimeType: "image/jpeg", base64: "..." }]constructs correct stdin JSONexecute()with unsupported media type (audio/video) ignores attachmentexecute()without media uses existing--printpath (backwards compat)mediaCapabilitiesreports correct valuesLive smoke tests (
src/middleware/__smoke__/claude.live.test.ts)Depends on
Related