Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(agentic-ide): a pane's chat shows what the person said and draws their screenshot, not the "## Task" brief
rubenluetke10-beep3f8a80839011
diff --git a/docs/BUGS.md b/docs/BUGS.mdindex 317ab46ba2..bb107b2a98 100644--- a/docs/BUGS.md+++ b/docs/BUGS.md@@ -13522,3 +13522,61 @@ backend). OS parity: `docs/os-parity.md` P-39.way" is a claim about the other layers, and here every other way had thesame blind spot. And a lane that can only be stopped by an EDGE has nobottom: when the thing being waited for is a physical key, ask the keyboard.++## BUG-192: a pane's chat drew the person's turn as "## Task … ## Dropped files ### shot.png - '.jarvis/drops/…' Could not be described" — the brief Jarvis typed, not what the person said, and the screenshot reduced to a path (MEDIUM, FIXED 2026-08-27)++**Symptom.** On the Agentic IDE's chat stage, the user's own bubble read+`## Task` followed by a paraphrase of what they had said, then `## Dropped+files`, `### pythonw_….png - ".jarvis/drops/20260827-…png"` and `Could not+be described (ClientError); it is attached as a file.` The person had spoken+one sentence and dropped one screenshot. The maintainer: "why is there a+markdown Task and then Python, bla bla, where the images were thrown in? …+the images should be rendered live … and the prompt the user said should be+shown."++**Cause.** The stage reads the coding CLI's own transcript+(`GET /terminals/{name}/timeline`), and that transcript holds what was TYPED+into the CLI: the brief `prompt_blueprint` wrote around the sentence — here+its deterministic `render_fallback`, because the vision provider had failed+(`ClientError`) and the writer with it. The front page's chat had solved the+same problem at the event: a `user_message` carries `text` (the composed+prompt), `typed` (the person's sentence) and `attachments` (receipts), and+`reduce.ts` shows `typed` when it is there. A pane's transcript cannot carry+that — it is the CLI's file — and the pane's own prompt history+(`prompt_history.py`) recorded only the text that went in. So the stage had+nothing but the brief to draw, and its attachment receipts were name-only+chips even where the picture sat in the workspace.++**Fix.** The receipt is recorded beside the prompt at send time and folded+back into the transcript's events when the stage reads them.++1. `PromptHistoryEntry` gains `typed` and `attachments` (name, kind,+ described_by, note, workspace-relative `path`); old rows load unchanged.+ `Registry.send_prompt(typed=…, attachments=…)` records them — on the+ typed path from the REST route's `req.prompt` and analysed attachments,+ on the spoken path from the fan-out's utterance and the pending drops+ (`fanout._default_send`; injected senders keep their two-argument shape).+2. `prompt_receipts.annotate` joins each `user_message` to its entry by+ text — whitespace-insensitive, and tolerant of the reader's middle cut+ (`agent_transcript._clip`) — and adds `typed` plus receipts; an image+ inside the workspace gets a `url` on the existing workspace file route.+ `drops.dereference` is the inverse of `drops.reference` for that path.+ The timeline route applies it (`_with_prompt_receipts`).+3. `reduce.ts` carries `url`; `AgentTimeline` draws an `<img>` for an image+ receipt that has one, and the chip as before for a file that does not+ (documents; the front page's chat, whose drops are read, not stored).++Tests: `tests/unit/agentic_ide/test_prompt_receipts.py` (dereference is the+inverse of reference, the history row round-trips and an old row still+loads, the join survives whitespace and the middle cut, identical briefs take+their own receipts, the route serves the sentence and a PNG that loads),+`reduce.test.ts` and `AgentTimeline.test.tsx` ("draws an image that can be+fetched as the picture itself" / "keeps the chip for a file with nothing to+draw").++**Lesson.** A conversation view must show the person what THEY said, and+the prompt the machine wrote FOR them is a different thing — when the record+being read is somebody else's file, the fact has to be written down at the+moment it is known and joined back later, not reconstructed from the file.+And a picture the app stored itself is a picture it can show: a receipt that+names an image the viewer could fetch is a chip nobody asked for.diff --git a/jarvis/agentic_ide/drops.py b/jarvis/agentic_ide/drops.pyindex e1bb4a86ed..f9eef9dbfb 100644--- a/jarvis/agentic_ide/drops.py+++ b/jarvis/agentic_ide/drops.py@@ -234,6 +234,22 @@ def reference(path: str, *, agent: str) -> str:return f'"{posix}"'+def dereference(reference: str) -> str:+ """The workspace-relative path behind a :func:`reference`, or "".++ The inverse of :func:`reference`, and deliberately nothing more: it undoes+ the two shapes that function writes (``@path`` and a quoted path) so a+ receipt about a drop can point a viewer at the file, without a second+ place that knows how agents like their paths.+ """+ value = (reference or "").strip()+ if value.startswith("@"):+ value = value[1:]+ elif len(value) >= 2 and value[0] == value[-1] and value[0] in {'"', "'"}:+ value = value[1:-1]+ return value.strip().replace("\\", "/")++def within_workspace(path: str, workspace: str | Path) -> str | None:"""``path`` as a workspace-relative posix path, or ``None`` if it is outside.@@ -260,6 +276,7 @@ __all__ = ["MAX_TOTAL_BYTES","DropError","StoredDrop",+ "dereference","drop_dir","reference","safe_name",diff --git a/jarvis/agentic_ide/fanout.py b/jarvis/agentic_ide/fanout.pyindex 8c583c6ec6..521945494e 100644--- a/jarvis/agentic_ide/fanout.py+++ b/jarvis/agentic_ide/fanout.py@@ -433,10 +433,17 @@ async def _default_compose(utterance: str, **kwargs: Any) -> Any:return await compose_prompt(utterance, **kwargs)-async def _default_send(name: str, text: str) -> Any:+async def _default_send(name: str, text: str, **receipt: Any) -> Any:+ """Type ``text`` into the pane; ``receipt`` is what the person said and dropped.++ The receipt is recorded beside the prompt so the pane's chat can show the+ sentence and the pictures rather than the brief (``prompt_receipts``). An+ injected sender is a test double or a CLI caller and is never handed one:+ its two-argument shape is the contract it was written against.+ """from .session import get_registry- return await get_registry().send_prompt(name, text)+ return await get_registry().send_prompt(name, text, **receipt)async def deliver(@@ -642,8 +649,14 @@ async def deliver(reason="its prompt came back empty",)+ # The person's own words go with the prompt, for the chat stage: the+ # utterance itself, because the assignment a split fan-out hands a pane+ # is the writer's sentence, not theirs.+ receipt = (+ {"typed": utterance, "attachments": pending_attachments} if send is None else {}+ )try:- sent = await send_fn(term.name, text)+ sent = await send_fn(term.name, text, **receipt)except asyncio.CancelledError:await _finish_prompt_attachments_shielded(term, pending_batches, consume=False)raisediff --git a/jarvis/agentic_ide/prompt_history.py b/jarvis/agentic_ide/prompt_history.pyindex 8d407a9c8f..4d26af90fe 100644--- a/jarvis/agentic_ide/prompt_history.py+++ b/jarvis/agentic_ide/prompt_history.py@@ -33,6 +33,14 @@ class PromptHistoryEntry:text: strat: floatsubmitted: bool | None+ #: What the person actually said or typed, when ``text`` is a brief Jarvis+ #: wrote around it. Empty on a prompt sent verbatim. The chat stage shows+ #: this instead of the brief — the brief is the agent's reading matter.+ typed: str = ""+ #: Receipts for the files that went in with the prompt, in the shape+ #: :mod:`jarvis.agentic_ide.prompt_receipts` writes (name, kind, path, …).+ #: Empty on an ordinary prompt, so nothing changes there.+ attachments: tuple[dict[str, Any], ...] = ()@staticmethoddef from_dict(value: Any) -> PromptHistoryEntry | None:@@ -52,12 +60,22 @@ class PromptHistoryEntry:submitted = value.get("submitted")if submitted not in (True, False, None):submitted = None+ typed = value.get("typed")+ raw_attachments = value.get("attachments")return PromptHistoryEntry(id=entry_id,sequence=max(0, sequence),text=text,at=max(0.0, at),submitted=submitted,+ typed=typed if isinstance(typed, str) else "",+ # A receipt without a name says nothing a viewer could show; the+ # rest of the row is still the prompt it always was.+ attachments=tuple(+ {k: v for k, v in item.items() if isinstance(k, str)}+ for item in (raw_attachments if isinstance(raw_attachments, list) else ())+ if isinstance(item, dict) and isinstance(item.get("name"), str) and item["name"]+ ),)diff --git a/jarvis/agentic_ide/prompt_receipts.py b/jarvis/agentic_ide/prompt_receipts.pynew file mode 100644index 0000000000..7fa58c3eef--- /dev/null+++ b/jarvis/agentic_ide/prompt_receipts.py@@ -0,0 +1,163 @@+"""What the person said and dropped, kept beside the brief a pane received.++A pane's chat stage reads the coding CLI's own transcript, and that transcript+holds what was TYPED into the CLI: the brief Jarvis wrote — ``## Task``, a+``## Dropped files`` section quoting a vision description or "could not be+described" — never the sentence the person spoke and never the picture. Drawn+as the person's turn, that brief reads as noise they did not write (reported+2026-08-27: "why is there a markdown Task and then Python, bla bla, where the+images were thrown in?").++The front page's chat solved the same problem at the event: a ``user_message``+carries ``text`` (the composed prompt), ``typed`` (the person's own sentence)+and ``attachments`` (receipts), and the reducer shows ``typed`` when it is+there (``jarvis/agent_chat/service.py``, ``reduce.ts``). A pane cannot write+its CLI's transcript, so the receipt is recorded in the pane's own prompt+history at send time (:mod:`prompt_history`) and folded back into the+transcript's events when the chat stage reads them (:func:`annotate`). Same+event shape, same renderer — the two chats cannot drift.++Images get a ``url`` on top: the drop lives inside the workspace, so the+workspace file route can serve it, and the stage draws the picture itself+rather than a chip with its name.+"""++from __future__ import annotations++import re+from collections.abc import Iterable, Sequence+from typing import Any+from urllib.parse import quote++from jarvis.agentic_ide import drops+from jarvis.agentic_ide.prompt_history import PromptHistoryEntry++#: The mark the transcript reader leaves where it cut a long block out of the+#: middle (``agent_transcript._clip``). A brief longer than that ceiling is+#: matched on what is left on either side of it.+CLIP_MARK = "[…]"++_WS = re.compile(r"\s+")+++def receipts_for(attachments: Sequence[Any]) -> tuple[dict[str, str], ...]:+ """The receipt rows for the drops that went in with one prompt.++ ``attachments`` are ``DropAnalysis``-shaped objects (name, reference, kind,+ described_by, note). ``path`` is the workspace-relative location behind+ the agent-facing reference — what a viewer needs, where the agent needed+ the reference. The description itself is not kept: it is in the brief,+ and the point of the receipt is to show the person their own picture+ instead of a paragraph about it.+ """+ out: list[dict[str, str]] = []+ for item in attachments or ():+ name = str(getattr(item, "name", "") or "").strip()+ if not name:+ continue+ out.append(+ {+ "name": name,+ "kind": str(getattr(item, "kind", "") or "other"),+ "described_by": str(getattr(item, "described_by", "") or "none"),+ "note": str(getattr(item, "note", "") or ""),+ "path": drops.dereference(str(getattr(item, "reference", "") or "")),+ }+ )+ return tuple(out)+++def file_url(workspace_id: str, path: str) -> str:+ """The same-origin URL the workspace file route serves ``path`` at.++ The twin of ``workspaceFileUrl`` in ``src/lib/agenticIdeApi.ts``: one+ route, two writers of its address, and a test on each side pins the shape.+ """+ return (+ f"/api/agentic-ide/workspaces/{quote(workspace_id, safe='')}/file"+ f"?path={quote(path, safe='')}"+ )+++def _key(text: str) -> str:+ """Whitespace-insensitive identity of a prompt.++ What the CLI wrote down and what Jarvis typed differ in whitespace only —+ a trailing space closes a completion popup, a paste the pane refused was+ re-sent as one line — so the comparison ignores all of it.+ """+ return _WS.sub(" ", str(text or "")).strip()+++def _matches(entry_key: str, shown: str) -> bool:+ key = _key(shown)+ if not key or not entry_key:+ return False+ if key == entry_key:+ return True+ if CLIP_MARK in key:+ head, _mark, tail = key.partition(CLIP_MARK)+ head, tail = head.strip(), tail.strip()+ return bool(head) and entry_key.startswith(head) and entry_key.endswith(tail)+ return False+++def _wire_row(receipt: dict[str, Any], workspace_id: str) -> dict[str, str]:+ row = {+ "name": str(receipt.get("name") or ""),+ "kind": str(receipt.get("kind") or ""),+ "described_by": str(receipt.get("described_by") or ""),+ "note": str(receipt.get("note") or ""),+ }+ path = str(receipt.get("path") or "")+ if path and row["kind"] == "image" and workspace_id:+ row["url"] = file_url(workspace_id, path)+ return row+++def annotate(+ events: Iterable[dict[str, Any]],+ entries: Sequence[PromptHistoryEntry],+ *,+ workspace_id: str,+) -> list[dict[str, Any]]:+ """``events`` with each ``user_message`` carrying its receipt, where one exists.++ A prompt's receipt is found by its text: the entry whose prompt the+ transcript's message is (whitespace aside, and allowing for the reader's+ middle cut). Entries are claimed oldest-first so two identical briefs map+ to their own receipts; a message that matches only already-claimed entries+ still takes one, because a repeated prompt is the same prompt. A message+ with no receipt — a prompt typed straight into the CLI, or one sent before+ receipts existed — is returned untouched and draws as it always did.++ Never mutates what it was given; the transcript reader's list is its own.+ """+ pool = [(_key(entry.text), entry) for entry in entries if entry.typed or entry.attachments]+ if not pool:+ return list(events)+ claimed: set[int] = set()+ out: list[dict[str, Any]] = []+ for event in events:+ payload = event.get("payload") if isinstance(event, dict) else None+ if event.get("kind") != "user_message" or not isinstance(payload, dict):+ out.append(event)+ continue+ shown = str(payload.get("text") or "")+ hits = [i for i, (key, _entry) in enumerate(pool) if _matches(key, shown)]+ hit = next((i for i in hits if i not in claimed), hits[0] if hits else None)+ if hit is None:+ out.append(event)+ continue+ claimed.add(hit)+ entry = pool[hit][1]+ enriched = dict(payload)+ if entry.typed:+ enriched["typed"] = entry.typed+ if entry.attachments:+ enriched["attachments"] = [_wire_row(r, workspace_id) for r in entry.attachments]+ out.append({**event, "payload": enriched})+ return out+++__all__ = ["CLIP_MARK", "annotate", "file_url", "receipts_for"]diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.pyindex a4467fb172..f2e71eb573 100644--- a/jarvis/agentic_ide/session.py+++ b/jarvis/agentic_ide/session.py@@ -67,7 +67,7 @@ import reimport shutilimport sysimport time-from collections.abc import AsyncIterator, Awaitable, Callable+from collections.abc import AsyncIterator, Awaitable, Callable, Sequencefrom contextlib import asynccontextmanagerfrom dataclasses import dataclass, fieldfrom pathlib import Path@@ -4496,7 +4496,13 @@ class Registry:# --------------------------------------------------------------- promptasync def send_prompt(- self, wanted: str, text: str, *, workspace_id: str | None = None+ self,+ wanted: str,+ text: str,+ *,+ workspace_id: str | None = None,+ typed: str = "",+ attachments: Sequence[Any] = (),) -> Terminal:"""Type ``text`` into a terminal, press Enter, and CONFIRM it was sent.@@ -4527,6 +4533,12 @@ class Registry:pane it came from; without it, the front workspace keeps the establishedcall-sign resolution rules.+ ``typed`` and ``attachments`` are the receipt: what the person actually+ said and the files that went with it, when ``text`` is a brief written+ around them. They are recorded beside the prompt so the chat stage can+ show the person their own sentence and their pictures, where the+ CLI's transcript holds only the brief (``prompt_receipts``).+Raises ``SessionError`` when the terminal is unknown, not running, stillbooting after the readiness window, or the prompt sanitizes down tonothing. A prompt that was typed but refused to submit is NOT an error —@@ -4622,12 +4634,17 @@ class Registry:term.manual_submit_token += 1term.submitted = submittedterm.sent_multiline = multiline and submitted is True+ from .prompt_receipts import receipts_for+history_entry = prompt_history.PromptHistoryEntry(id=uuid4().hex,sequence=term.prompts_sent,text=payload,at=term.last_prompt_at,submitted=submitted,+ # Only when it differs: a verbatim prompt IS what the person typed.+ typed=typed.strip() if typed.strip() != payload.strip() else "",+ attachments=receipts_for(attachments),)# Memory first: even a read-only or temporarily unavailable data folder# must not make a prompt disappear from the history while the pane isdiff --git a/jarvis/ui/web/agentic_ide_routes.py b/jarvis/ui/web/agentic_ide_routes.pyindex f263f0cc17..4e3176cd52 100644--- a/jarvis/ui/web/agentic_ide_routes.py+++ b/jarvis/ui/web/agentic_ide_routes.py@@ -2967,6 +2967,21 @@ async def terminal_conversation(name: str, workspace: str | None = None) -> dict}+async def _with_prompt_receipts(term: Terminal, session: Session, events: list[dict]) -> list[dict]:+ """The transcript's events with the person's own words and pictures folded in.++ The CLI's record holds the brief Jarvis typed; the pane's prompt history+ holds what the person said and dropped alongside it. Joined here, off the+ event loop (the history is a file), so the chat stage draws the sentence+ and the image where the transcript alone would draw a "## Task" brief.+ """+ from jarvis.agentic_ide import prompt_receipts++ stored = await asyncio.to_thread(prompt_history.load, term.history_id)+ entries = prompt_history.merged(stored, term.prompt_records)+ return prompt_receipts.annotate(events, entries, workspace_id=session.id)++@router.get("/terminals/{name}/timeline",summary="One terminal's conversation as agent-chat events",@@ -3013,7 +3028,11 @@ async def terminal_timeline(name: str, workspace: str | None = None) -> dict:)if events is None:return {**base, "available": False, "events": []}- return {**base, "available": True, "events": events}+ return {+ **base,+ "available": True,+ "events": await _with_prompt_receipts(term, _session, events),+ }@router.get(@@ -3672,7 +3691,11 @@ async def terminal_prompt(request: Request, name: str, req: PromptRequest) -> di}try:- term = await registry.send_prompt(name, text)+ # The receipt beside the brief: the sentence as typed and the files+ # that went with it, for the pane's chat stage (prompt_receipts).+ term = await registry.send_prompt(+ name, text, typed=req.prompt, attachments=attachments+ )except SessionError as exc:raise HTTPException(status_code=409, detail=str(exc)) from excdiff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.test.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.test.tsxindex 3f3d39b209..b559ebbf56 100644--- a/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.test.tsx@@ -382,3 +382,41 @@ describe("a run of steps puts itself away", () => {expect(rows[0].dataset.state).toBe("error");});});++describe("the person's turn with files", () => {+ const SHOT = {+ name: "shot.png",+ kind: "image",+ described_by: "none",+ url: "/api/agentic-ide/workspaces/ide_1/file?path=.jarvis%2Fdrops%2Fshot.png",+ };++ it("draws an image that can be fetched as the picture itself", () => {+ // The complaint (maintainer, 2026-08-27): a screenshot dropped on a pane+ // showed up in the person's turn as "### shot.png - '.jarvis/drops/…'".+ // With a url, the turn shows the person's sentence and the picture.+ draw([ev("user_message", { text: "## Task\nlook", typed: "look at this", attachments: [SHOT] })]);+ const turn = screen.getByTestId("agent-message-user");+ expect(turn.textContent).toContain("look at this");+ expect(turn.textContent).not.toContain("## Task");+ const image = within(turn).getByTestId("agent-message-image") as HTMLImageElement;+ expect(image.getAttribute("src")).toBe(SHOT.url);+ expect(image.getAttribute("alt")).toBe("shot.png");+ });++ it("keeps the chip for a file with nothing to draw", () => {+ draw([+ ev("user_message", {+ text: "read these",+ attachments: [+ { name: "notes.md", kind: "text", described_by: "extraction" },+ { name: "front-page.png", kind: "image", described_by: "vision" },+ ],+ }),+ ]);+ const turn = screen.getByTestId("agent-message-user");+ expect(within(turn).queryByTestId("agent-message-image")).toBeNull();+ expect(turn.textContent).toContain("notes.md");+ expect(turn.textContent).toContain("front-page.png");+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.tsxindex 17e4b38134..4008446fec 100644--- a/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.tsx+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.tsx@@ -117,7 +117,25 @@ export function AgentTimeline({item.text && "mt-2 border-t border-border/60 pt-2",)}>- {item.attachments.map((file) => (+ {item.attachments.map((file) =>+ // The picture itself, where there is one to fetch: a+ // screenshot dropped on a pane is a thing the person+ // wants to SEE in their turn, not a file name with an+ // icon (maintainer, 2026-08-27). A file with no url —+ // a document, or the front page's chat, whose drops+ // are read and not stored — keeps the chip.+ file.kind === "image" && file.url ? (+ <img+ key={file.name}+ src={file.url}+ alt={file.name}+ title={file.name}+ loading="lazy"+ decoding="async"+ data-testid="agent-message-image"+ className="max-h-60 max-w-full rounded-lg border border-border/70 bg-background/40 object-contain"+ />+ ) : (<spankey={file.name}// The receipt says whether the model could actually@@ -138,7 +156,8 @@ export function AgentTimeline({)}<span className="max-w-[12rem] truncate font-mono">{file.name}</span></span>- ))}+ ),+ )}</div>)}</div>diff --git a/jarvis/ui/web/frontend/src/components/agentchat/reduce.test.ts b/jarvis/ui/web/frontend/src/components/agentchat/reduce.test.tsindex 8e49cfc892..c7df4a6bc3 100644--- a/jarvis/ui/web/frontend/src/components/agentchat/reduce.test.ts+++ b/jarvis/ui/web/frontend/src/components/agentchat/reduce.test.ts@@ -1,7 +1,14 @@import { describe, expect, it } from "vitest";import type { AgentChatEvent } from "@/lib/agentChatApi";-import { EMPTY_TIMELINE, reduceEvent, reduceEvents, runningTurn, type TurnItem } from "./reduce";+import {+ EMPTY_TIMELINE,+ reduceEvent,+ reduceEvents,+ runningTurn,+ type TurnItem,+ type UserItem,+} from "./reduce";let seq = 0;function ev(kind: string, payload: Record<string, unknown>, persisted = true): AgentChatEvent {@@ -135,3 +142,43 @@ describe("agent-chat reduce", () => {expect(turn.durationMs).not.toBeNull();});});++describe("a user message with files", () => {+ // A pane's chat reads the CLI's transcript, which holds the brief Jarvis+ // typed; the backend folds the person's own sentence and the file receipts+ // back in (jarvis/agentic_ide/prompt_receipts.py). The reducer shows the+ // sentence and carries the url an image can be drawn from.+ it("shows what the person said and keeps the picture's url", () => {+ const tl = reduceEvents(EMPTY_TIMELINE, [+ ev("user_message", {+ text: "## Task\nScroll the traces.\n\n## Dropped files\n### shot.png",+ typed: "scroll the traces into view",+ attachments: [+ {+ name: "shot.png",+ kind: "image",+ described_by: "none",+ url: "/api/agentic-ide/workspaces/ide_1/file?path=.jarvis%2Fdrops%2Fshot.png",+ },+ { name: "notes.md", kind: "text", described_by: "extraction" },+ { kind: "image" },+ ],+ }),+ ]);+ expect(tl.items[0]).toMatchObject({+ type: "user",+ text: "scroll the traces into view",+ attachments: [+ {+ name: "shot.png",+ kind: "image",+ describedBy: "none",+ url: "/api/agentic-ide/workspaces/ide_1/file?path=.jarvis%2Fdrops%2Fshot.png",+ },+ { name: "notes.md", kind: "text", describedBy: "extraction" },+ ],+ });+ const [, doc] = (tl.items[0] as UserItem).attachments;+ expect("url" in doc).toBe(false);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentchat/reduce.ts b/jarvis/ui/web/frontend/src/components/agentchat/reduce.tsindex 3bcb5d13ec..933f7a1614 100644--- a/jarvis/ui/web/frontend/src/components/agentchat/reduce.ts+++ b/jarvis/ui/web/frontend/src/components/agentchat/reduce.ts@@ -82,6 +82,13 @@ export interface UserAttachment {kind: string;/** `vision` / `extraction` / `none` — whether the model could read it. */describedBy: string;+ /**+ * Where the file itself can be fetched from, same-origin — set for an image+ * that lives inside an open workspace (a drop the Agentic IDE stored; the+ * backend folds it in, `jarvis/agentic_ide/prompt_receipts.py`). The+ * timeline draws the picture when it has this and a chip when it does not.+ */+ url?: string;}export interface TurnItem {@@ -144,7 +151,15 @@ function userAttachments(raw: unknown): UserAttachment[] {if (!entry || typeof entry !== "object") continue;const row = entry as Record<string, unknown>;const name = str(row.name);- if (name) out.push({ name, kind: str(row.kind), describedBy: str(row.described_by) });+ if (name) {+ const url = str(row.url);+ out.push({+ name,+ kind: str(row.kind),+ describedBy: str(row.described_by),+ ...(url ? { url } : {}),+ });+ }}return out;}diff --git a/tests/unit/agentic_ide/test_prompt_receipts.py b/tests/unit/agentic_ide/test_prompt_receipts.pynew file mode 100644index 0000000000..5c9cfd9027--- /dev/null+++ b/tests/unit/agentic_ide/test_prompt_receipts.py@@ -0,0 +1,286 @@+"""A pane's chat shows what the person said and dropped, not the brief.++The complaint (maintainer, 2026-08-27): the user's turn in a pane's chat read+"## Task … ## Dropped files ### shot.png - '.jarvis/drops/…' Could not be+described" — the brief Jarvis typed into the CLI, drawn as if the person had+written it, with the picture reduced to a path. The receipt recorded beside+the prompt at send time is what puts the sentence and the image back.+"""++from __future__ import annotations++import json+from pathlib import Path+from types import SimpleNamespace++import pytest+from fastapi import FastAPI+from fastapi.testclient import TestClient++from jarvis.agentic_ide import agent_transcript, drops, prompt_history, prompt_receipts+from jarvis.agentic_ide import session as session_mod+from jarvis.agentic_ide.agent_sessions import ResumeHandle+from jarvis.agentic_ide.drop_analysis import DropAnalysis+from jarvis.agentic_ide.session import Registry+from tests.fakes.fake_pty_manager import FakePtyManager++# A 1x1 PNG — enough for the file route to serve something a browser draws.+PNG = bytes.fromhex(+ "89504e470d0a1a0a0000000d49484452000000010000000108060000001f15c489"+ "0000000d49444154789c6360f8cfc000000301010018dd8db00000000049454e44ae426082"+)+++def _shot(reference: str = '".jarvis/drops/20260827-shot.png"') -> DropAnalysis:+ return DropAnalysis(+ name="shot.png",+ reference=reference,+ kind="image",+ detail="",+ described_by="none",+ note="Could not be described (ClientError); it is attached as a file.",+ )+++BRIEF = (+ "## Task\nScroll the reasoning traces into view automatically.\n\n"+ "## Dropped files\n### shot.png - \".jarvis/drops/20260827-shot.png\"\n"+ "Could not be described (ClientError); it is attached as a file."+)+SAID = "Ich möchte, dass im Agentic IDE automatisch mit runtergescrollt wird." # i18n-allow+++def _entry(text: str, typed: str = "", attachments: tuple[dict, ...] = (), at: float = 1.0):+ return prompt_history.PromptHistoryEntry(+ id=f"e{at}",+ sequence=int(at),+ text=text,+ at=at,+ submitted=True,+ typed=typed,+ attachments=attachments,+ )+++def _user(text: str, ts: int = 1000) -> dict:+ return {"seq": ts, "ts_ms": ts, "kind": "user_message", "payload": {"text": text}}+++# ------------------------------------------------------------------ pieces+++ ("reference", "path"),+ [+ ("@.jarvis/drops/a.png", ".jarvis/drops/a.png"),+ ('".jarvis/drops/with space.png"', ".jarvis/drops/with space.png"),+ ("'docs/x.md'", "docs/x.md"),+ ("", ""),+ ("plain/path.png", "plain/path.png"),+ ],+)+def test_dereference_undoes_both_reference_shapes(reference: str, path: str) -> None:+ assert drops.dereference(reference) == path+++def test_dereference_is_the_inverse_of_reference(monkeypatch: pytest.MonkeyPatch) -> None:+ from jarvis.workspace import agents as workspace_agents++ for wants_at in (True, False):+ spec = SimpleNamespace(file_reference="at" if wants_at else "quoted")+ monkeypatch.setattr(workspace_agents, "get_agent", lambda _n, s=spec: s)+ for path in (".jarvis/drops/a.png", ".jarvis/drops/with space.png"):+ assert drops.dereference(drops.reference(path, agent="x")) == path+++def test_receipts_keep_the_viewer_facts_and_drop_the_description() -> None:+ rows = prompt_receipts.receipts_for([_shot(), SimpleNamespace(name="", reference="@x")])+ assert rows == (+ {+ "name": "shot.png",+ "kind": "image",+ "described_by": "none",+ "note": "Could not be described (ClientError); it is attached as a file.",+ "path": ".jarvis/drops/20260827-shot.png",+ },+ )+++def test_file_url_matches_the_frontend_twin() -> None:+ # `workspaceFileUrl` in agenticIdeApi.ts writes the same address.+ assert (+ prompt_receipts.file_url("ide_1", ".jarvis/drops/a b.png")+ == "/api/agentic-ide/workspaces/ide_1/file?path=.jarvis%2Fdrops%2Fa%20b.png"+ )+++def test_history_row_round_trips_the_receipt(+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch+) -> None:+ monkeypatch.setattr(prompt_history, "_store_dir", lambda: tmp_path)+ entry = _entry(BRIEF, typed=SAID, attachments=prompt_receipts.receipts_for([_shot()]))+ prompt_history.append("pane", entry)+ assert prompt_history.load("pane") == [entry]+++def test_a_row_written_before_receipts_existed_still_loads(+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch+) -> None:+ monkeypatch.setattr(prompt_history, "_store_dir", lambda: tmp_path)+ old_row = {"id": "old", "sequence": 1, "text": "Continue.", "at": 1.0, "submitted": True}+ target = prompt_history._path("pane")+ target.parent.mkdir(parents=True, exist_ok=True)+ target.write_text(json.dumps(old_row) + "\n", encoding="utf-8")+ [loaded] = prompt_history.load("pane")+ assert (loaded.typed, loaded.attachments) == ("", ())+++# ---------------------------------------------------------------- annotate+++def test_the_users_turn_becomes_their_sentence_and_their_picture() -> None:+ entries = [_entry(BRIEF, typed=SAID, attachments=prompt_receipts.receipts_for([_shot()]))]+ [event] = prompt_receipts.annotate([_user(BRIEF)], entries, workspace_id="ide_1")+ assert event["payload"]["typed"] == SAID+ assert event["payload"]["text"] == BRIEF+ assert event["payload"]["attachments"] == [+ {+ "name": "shot.png",+ "kind": "image",+ "described_by": "none",+ "note": "Could not be described (ClientError); it is attached as a file.",+ "url": (+ "/api/agentic-ide/workspaces/ide_1/file"+ "?path=.jarvis%2Fdrops%2F20260827-shot.png"+ ),+ }+ ]+++def test_whitespace_and_the_readers_middle_cut_do_not_lose_the_match() -> None:+ long_brief = "## Task\n" + ("Inspect the parser carefully. " * 400)+ entries = [_entry(long_brief, typed=SAID)]+ shown = agent_transcript._clip(long_brief.replace("\n", " ") + " ")+ assert prompt_receipts.CLIP_MARK in shown+ [event] = prompt_receipts.annotate([_user(shown)], entries, workspace_id="ide_1")+ assert event["payload"]["typed"] == SAID+++def test_a_prompt_typed_straight_into_the_cli_is_left_alone() -> None:+ entries = [_entry(BRIEF, typed=SAID)]+ events = [+ _user("fix the tests"),+ {"seq": 2, "ts_ms": 2, "kind": "assistant_text", "payload": {"text": "ok"}},+ ]+ assert prompt_receipts.annotate(events, entries, workspace_id="ide_1") == events+++def test_two_identical_briefs_each_take_their_own_receipt() -> None:+ entries = [+ _entry(BRIEF, typed="first", at=1.0),+ _entry(BRIEF, typed="second", at=2.0),+ ]+ first, second, third = prompt_receipts.annotate(+ [_user(BRIEF, 1), _user(BRIEF, 2), _user(BRIEF, 3)], entries, workspace_id="w"+ )+ assert [e["payload"]["typed"] for e in (first, second, third)] == ["first", "second", "first"]+++def test_a_text_file_gets_no_url_and_nothing_is_mutated() -> None:+ doc = DropAnalysis(+ name="notes.md", reference="@notes.md", kind="text", detail="x", described_by="extraction"+ )+ entries = [_entry(BRIEF, attachments=prompt_receipts.receipts_for([doc]))]+ original = _user(BRIEF)+ [event] = prompt_receipts.annotate([original], entries, workspace_id="w")+ assert "url" not in event["payload"]["attachments"][0]+ assert "typed" not in event["payload"]+ assert original["payload"] == {"text": BRIEF}+++# ------------------------------------------------------------- end to end+++def registry(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> Registry:+ monkeypatch.setattr(session_mod, "agent_argv", lambda name: (f"/usr/bin/{name}",))+ monkeypatch.setattr(prompt_history, "_store_dir", lambda: tmp_path / "prompt-history")+ reg = Registry(pty_manager=FakePtyManager())+ monkeypatch.setattr(session_mod, "get_registry", lambda: reg)+ from jarvis.ui.web import agentic_ide_routes++ monkeypatch.setattr(agentic_ide_routes, "get_registry", lambda: reg)+ return reg+++def client(registry: Registry) -> TestClient:+ from jarvis.ui.web.agentic_ide_routes import router++ app = FastAPI()+ app.include_router(router)+ return TestClient(app)+++async def _noop(_text: str) -> None:+ return None+++async def _noop_exit(_code: int) -> None:+ return None+++async def _live_pane(registry: Registry, folder: Path, monkeypatch: pytest.MonkeyPatch) -> str:+ await registry.start(str(folder), [{"agent": "claude"}])+ assert registry.session is not None+ term = registry.session.terminals[0]+ await registry.attach(term.name, 100, 30, _noop, _noop_exit)++ async def accepted(*_args: object) -> bool:+ return True++ monkeypatch.setattr(registry, "_write_and_confirm", accepted)+ term.resume = ResumeHandle(kind="claude_session", id="sess-1", captured_at=1.0)+ return term.name+++async def test_the_timeline_serves_the_sentence_and_a_picture_that_loads(+ client: TestClient, registry: Registry, tmp_path: Path, monkeypatch: pytest.MonkeyPatch+) -> None:+ workspace = tmp_path / "ws"+ workspace.mkdir()+ name = await _live_pane(registry, workspace, monkeypatch)+ [stored] = drops.store(workspace, [("shot.png", PNG)])+ shot = _shot(reference=drops.reference(stored.relative_path, agent="claude"))++ # The typed path: the pane chat's composer sends the sentence with the file.+ await registry.send_prompt(name, BRIEF, typed=SAID, attachments=[shot])++ # What the CLI wrote down is the brief, whitespace and all.+ monkeypatch.setattr(+ agent_transcript,+ "read_timeline",+ lambda *_a, **_k: agent_transcript.TimelineRead(events=[_user(BRIEF + " ")]),+ )+ body = client.get(f"/api/agentic-ide/terminals/{name}/timeline").json()+ assert body["available"] is True+ [event] = body["events"]+ assert event["payload"]["typed"] == SAID+ [receipt] = event["payload"]["attachments"]+ assert receipt["name"] == "shot.png"+ assert receipt["url"].startswith("/api/agentic-ide/workspaces/")++ picture = client.get(receipt["url"])+ assert picture.status_code == 200+ assert picture.content == PNG+ assert picture.headers["content-type"].startswith("image/png")+++async def test_a_verbatim_prompt_records_no_typed_copy(+ registry: Registry, tmp_path: Path, monkeypatch: pytest.MonkeyPatch+) -> None:+ name = await _live_pane(registry, tmp_path, monkeypatch)+ await registry.send_prompt(name, "fix the tests", typed="fix the tests")+ assert registry.session is not None+ [record] = registry.session.terminals[0].prompt_records+ assert (record.typed, record.attachments) == ("", ())