Files
orca/src/main
Brennan BensonandMerge Sim 210ac1f77c fix(native-chat): expand Claude slash commands sent with an attachment (#19654)
* fix(native-chat): keep the text block last in Claude dispatch content

Claude reads a streamed user message as a slash-command invocation only when
the last content block is text. The composer builds the send body as
text-then-images, and the Claude dispatch mapper preserved that order, so any
slash command sent with an attachment arrived as literal prose instead of
running -- /review, /init and the rest, not just one command.

Emit images ahead of text in the mapper. Images-before-text is also the order
Claude prefers for vision, so this is unconditional rather than slash-only.

Fixed in the Claude mapper rather than the shared send body: that body also
defines rendered journal block order for every provider.

* fix(native-chat): derive Claude slash-command recognition from the sent prompt

Claude encodes a user turn as attachment blocks followed by the typed text and
recovers the prompt by reading only the trailing text block, so a body ending in
an image has no recoverable prompt and its `/command` reaches the model as prose.
The composer builds text-then-images, so that was every send with an attachment.

Emit one trailing text block rather than appending each block: a partitioned
`[...images, ...texts]` still strands a command ahead of trailing prose, because
only the last block is read. Derive `acceptsResult` from that same sent content
so the mapper and the dispatch waiter cannot disagree about whether a command
ran; the previous `blocks.some(trimStart)` was strictly more permissive than
Claude, which does not trim before matching `/`.

* test(native-chat): pin the sent Claude content order and the joined prompt verdict

The attachment scenario passed unchanged against main: it only exercised
acceptsResult, which was already true there. Assert the send payload, and
pin that joining narrows a command hiding behind leading prose.

Reuse claudeRecord for the content-key narrowing the same file now imports.

---------

Co-authored-by: Merge Sim <sim@local>
2026-09-08 21:52:25 -07:00
..
…
2026-09-03 17:32:59 -07:00
…
…