I'd love to be able to add images inline in a post
I'd love to be able to add images inline in a post
Where things stand: images already upload (chip or ⌘V) but land in posts.meta.attachments and render as a gallery under the post. Markdown  in a body already renders an <img> (the agent is even told it can do that), but then the same image shows twice: inline and in the gallery.
Plan
- Composers (
components/composer.tsx,components/thread-composer.tsx): an upload (chip, paste, and drag-drop onto the textarea) insertsat the cursor on its own line, so you place the picture where you're writing. Removing the thumbnail chip also removes that markdown. Shared logic goes into one hook incomponents/attach-images.tsxso both composers stay identical. - Rendering (
components/post.tsx,components/markdown.tsx): the gallery under the post only shows attachments the body doesn't already reference; inline images getloading="lazy"and open full-size on tap, like the gallery does. - Agent context (
lib/context.ts): relative/uploads/…image URLs in bodies become absolute so Osebot can download them from the sandbox; the instruction also tells it that inlining a screenshot stops it repeating under the post. - Keep
meta.attachmentsas is: old posts, the API shape, theattached_imagesline in the prompt, and the 8-image cap are untouched.
Will verify with tsc + a static mockup screenshot of a post with an inline image.
threadide@6dc4cd2Done, pushed to thread/0042ff59 (6dc4cd2).
What changed
- Composers (reply + start-a-thread): adding an image via the Image chip, pasting a screenshot, or dropping a file onto the text box now writes
into the body at the cursor, on its own line, and moves the caret below it so you keep typing. Removing the thumbnail chip removes that markdown too. Shared hookuseInlineImagesincomponents/attach-images.tsx, so both composers behave the same. - Rendering: inline images render lazily and open full-size on tap. The gallery under a post now only shows attachments the text doesn't already embed, so Osebot's screenshots placed inline stop showing twice (it was already told it could embed them, and they duplicated).
- Osebot context:
/uploads/…image links in bodies are made absolute so it can fetch them from the sandbox; the prompt says inline placement isn't repeated under the post. - Untouched on purpose:
meta.attachments, the upload API, the 8-image cap, old posts.
Verified: tsc clean; helper edge cases (empty body, mid-line cursor, replacing a selection, two images at once, chip removal, captions with []) run with tsx; the screenshot attached is the real Markdown component + globals.css in post markup at 390px, before vs after.
Not verified in a browser (no DB/OAuth in the sandbox): caret placement after an upload and drag-drop. Worst case the caret stays put; the body is still right.
One known limitation worth saying: the textarea shows the raw  markdown, not a picture. The chip row is the visual confirmation. If you'd rather see a rendered preview while writing, that's a separate (bigger) step.
Merged threadide #167 by @osebo (merge, 980a701).
