Skip to content

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.

feat(agentic-ide): the typed prompt bar composes exactly like the spoken one

rubenluetke10-beep67ba77118148
diff --git a/jarvis/agentic_ide/prompt_composer.py b/jarvis/agentic_ide/prompt_composer.py
index 52e436106e..5908cdb03d 100644
--- a/jarvis/agentic_ide/prompt_composer.py
+++ b/jarvis/agentic_ide/prompt_composer.py
@@ -778,10 +778,10 @@ async def compose(
to have understood more than the sentence.
``on_progress`` receives a ``ComposeNotice`` at each beat of the
- composition; left None they are printed (see ``print_notice``). The typed
- prompt bar passes ``use_llm=False`` and gets no notices at all — nothing is
- being written there, and a progress line about an instant operation is
- noise.
+ composition; left None they are printed (see ``print_notice``). A caller
+ that wants only the deterministic layer passes ``use_llm=False`` and gets
+ no notices at all — nothing is being written there, and a progress line
+ about an instant operation is noise.
Never raises: every failure path lands on the deterministic prompt, because
"the agent got a rougher prompt" is a far better outcome than "your
diff --git a/jarvis/ui/web/agentic_ide_routes.py b/jarvis/ui/web/agentic_ide_routes.py
index 5f53a8978b..4c4e276e0d 100644
--- a/jarvis/ui/web/agentic_ide_routes.py
+++ b/jarvis/ui/web/agentic_ide_routes.py
@@ -3415,9 +3415,9 @@ async def terminal_prompt(request: Request, name: str, req: PromptRequest) -> di
With ``compose=true`` the text is first rewritten into a prompt worth
running — speech artefacts removed, the task stated as an imperative, and
- the relevant files of this workspace attached as ``@path`` references. That
- is the path a spoken instruction takes; the UI's prompt bar sends verbatim,
- because someone who typed it already wrote what they meant.
+ the relevant files of this workspace attached as ``@path`` references. Both
+ the spoken path and the UI's typed prompt bar send with it on (maintainer
+ decision 2026-08-12): typed or said, Jarvis writes the brief either way.
``dry_run=true`` returns the composed prompt without sending it, so a caller
can show it for approval first.
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
index fd1aa24a8b..424e82c950 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
@@ -40,7 +40,6 @@ vi.mock("@/lib/agenticIdeApi", () => ({
attachToTerminal: vi.fn(),
closeTerminal: vi.fn(),
closeTerminals: vi.fn(),
- composePrompt: vi.fn(),
moveTerminal: vi.fn(),
renameTerminal: vi.fn(),
// Polled by the grid so the pane headers keep saying what their agents are
@@ -323,15 +322,10 @@ beforeEach(() => {
failed: [],
session: sessionWith([]),
});
- vi.mocked(api.composePrompt).mockResolvedValue({
- composed: "## Task\nRun the tests.",
- composed_by: "llm",
- files: [],
- });
vi.mocked(api.promptTerminal).mockResolvedValue({
terminal: "Mika",
sent: "## Task\nRun the tests.",
- composed_by: "raw",
+ composed_by: "llm",
files: [],
submitted: true,
});
@@ -1023,79 +1017,68 @@ describe("restarting a dead pane", () => {
});
});
-describe("the prompt bar composes before it sends", () => {
+describe("the prompt bar composes as it sends", () => {
const type = (text: string) => {
const box = screen.getByLabelText(/instruction for Mika/i);
fireEvent.change(box, { target: { value: text } });
fireEvent.keyDown(box, { key: "Enter" });
};
- it("shows the briefed prompt for approval instead of sending straight away", async () => {
- renderGrid();
- type("run the tests");
-
- await waitFor(() => expect(screen.getByTestId("prompt-preview")).toBeTruthy());
- // The third argument is the dropped-file list — empty here, because this
- // instruction was typed with nothing attached.
- expect(api.composePrompt).toHaveBeenCalledWith("Mika", "run the tests", []);
- expect(api.promptTerminal).not.toHaveBeenCalled();
- });
-
- it("sends the composed prompt when the user approves it", async () => {
+ it("asks the backend to compose in the same request that sends", async () => {
+ // One step, exactly like the spoken "prompt Mika …": the backend writes
+ // the brief and types it in. The retired approval preview held the brief
+ // for a click here, and its fallback paths sent the raw text.
renderGrid();
type("run the tests");
- await waitFor(() => expect(screen.getByTestId("prompt-preview")).toBeTruthy());
-
- fireEvent.click(screen.getByTestId("prompt-preview-send"));
await waitFor(() =>
- expect(api.promptTerminal).toHaveBeenCalledWith(
- "Mika",
- "## Task\nRun the tests.",
- // Nothing carried alongside: the composed text already contains
- // whatever was dropped, so sending it again would duplicate it.
- { attachments: [] },
- ),
+ expect(api.promptTerminal).toHaveBeenCalledWith("Mika", "run the tests", {
+ compose: true,
+ attachments: [],
+ }),
);
});
- it("sends the user's own wording when they prefer it", async () => {
+ it("clears the editor once the instruction was delivered", async () => {
renderGrid();
type("run the tests");
- await waitFor(() => expect(screen.getByTestId("prompt-preview")).toBeTruthy());
-
- fireEvent.click(screen.getByTestId("prompt-preview-verbatim"));
await waitFor(() =>
- expect(api.promptTerminal).toHaveBeenCalledWith("Mika", "run the tests", {
- attachments: [],
- }),
+ expect(pushToast).toHaveBeenCalledWith("warning", "Mika did not accept the prompt."),
);
});
- it("gives the typed text back when the preview is discarded", async () => {
+ it("keeps the draft when the request fails, instead of sending it raw", async () => {
+ // A failed request typed nothing anywhere. Retrying it verbatim would
+ // reintroduce the exact behaviour this path exists to rule out, so the
+ // words stay in the editor and the failure is said out loud.
+ vi.mocked(api.promptTerminal).mockRejectedValue(new Error("no session"));
renderGrid();
type("run the tests");
- await waitFor(() => expect(screen.getByTestId("prompt-preview")).toBeTruthy());
-
- fireEvent.click(screen.getByTestId("prompt-preview-cancel"));
- await waitFor(() => expect(screen.queryByTestId("prompt-preview")).toBeNull());
+ await waitFor(() => expect(pushToast).toHaveBeenCalledWith("error", "no session"));
+ expect(api.promptTerminal).toHaveBeenCalledTimes(1);
expect(
(screen.getByLabelText(/instruction for Mika/i) as HTMLTextAreaElement).value,
).toBe("run the tests");
- expect(api.promptTerminal).not.toHaveBeenCalled();
});
- it("still delivers the instruction when composing fails outright", async () => {
- vi.mocked(api.composePrompt).mockRejectedValue(new Error("no session"));
+ it("warns when the pane held the prompt without starting on it", async () => {
+ vi.mocked(api.promptTerminal).mockResolvedValue({
+ terminal: "Mika",
+ sent: "## Task\nRun the tests.",
+ composed_by: "llm",
+ files: [],
+ submitted: false,
+ detail: "Mika did not accept the prompt.",
+ });
renderGrid();
type("run the tests");
await waitFor(() =>
- expect(api.promptTerminal).toHaveBeenCalledWith("Mika", "run the tests", {
- attachments: [],
- }),
+ expect(
+ (screen.getByLabelText(/instruction for Mika/i) as HTMLTextAreaElement).value,
+ ).toBe(""),
);
});
});
@@ -1162,26 +1145,11 @@ describe("dropping files on the prompt bar", () => {
fireEvent.change(box, { target: { value: "fix this" } });
fireEvent.keyDown(box, { key: "Enter" });
- await waitFor(() => expect(api.composePrompt).toHaveBeenCalled());
- const attachments = vi.mocked(api.composePrompt).mock.calls[0][2];
- expect(attachments).toHaveLength(1);
- expect(attachments?.[0].detail).toContain("submit button overflows");
- });
-
- it("keeps the attachment when the user backs out of the rewrite", async () => {
- // Discarding a proposed wording is not a reason to lose the dropped file.
- renderGrid();
- drop();
- await waitFor(() => expect(screen.getByTestId("agentic-attachments")).toBeTruthy());
-
- const box = screen.getByLabelText(/instruction for Mika/i);
- fireEvent.change(box, { target: { value: "fix this" } });
- fireEvent.keyDown(box, { key: "Enter" });
- await waitFor(() => expect(screen.getByTestId("prompt-preview")).toBeTruthy());
-
- fireEvent.click(screen.getByTestId("prompt-preview-cancel"));
-
- expect(screen.getByTestId("agentic-attachments").textContent).toContain("shot.png");
+ await waitFor(() => expect(api.promptTerminal).toHaveBeenCalled());
+ const options = vi.mocked(api.promptTerminal).mock.calls[0][2];
+ expect(options?.compose).toBe(true);
+ expect(options?.attachments).toHaveLength(1);
+ expect(options?.attachments?.[0].detail).toContain("submit button overflows");
});
it("lets an attachment be taken back off", async () => {
@@ -1202,8 +1170,6 @@ describe("dropping files on the prompt bar", () => {
const box = screen.getByLabelText(/instruction for Mika/i);
fireEvent.change(box, { target: { value: "fix this" } });
fireEvent.keyDown(box, { key: "Enter" });
- await waitFor(() => expect(screen.getByTestId("prompt-preview")).toBeTruthy());
- fireEvent.click(screen.getByTestId("prompt-preview-send"));
// Otherwise the next, unrelated instruction would silently carry the old
// screenshot along with it.
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
index 2c31d0d845..02aa18076c 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
@@ -79,7 +79,6 @@ import {
import { ContinueInterrupted } from "./ContinueInterrupted";
import { PaneNotifications } from "./PaneNotifications";
import { isVoiceActive } from "./useVoiceCall";
-import { PromptPreview } from "./PromptPreview";
import { PromptEditor } from "./PromptEditor";
import { WorkspaceSettings } from "./WorkspaceSettings";
import { WorkspaceExplorer } from "./WorkspaceExplorer";
@@ -106,7 +105,6 @@ import {
attachToTerminal,
closeTerminal,
closeTerminals,
- composePrompt,
moveTerminal,
clearTerminalRecap,
fetchTerminalActivity,
@@ -118,7 +116,6 @@ import {
syncAgenticIdeSurface,
setTerminalRecap,
promptTerminal,
- type ComposedPreview,
type DropAttachment,
type IdeAccountState,
type IdeState,
@@ -794,17 +791,12 @@ export function AgenticGrid({
recapCache.workspaceId === session.id ? recapCache.rows : {};
// The editor owns ordinary keystrokes so typing does not re-render every
// xterm pane in this very large component. This seed changes only when the
- // parent intentionally replaces the draft (successful send or preview undo).
+ // parent intentionally replaces the draft (successful send).
const [promptSeed, setPromptSeed] = useState({ value: "", revision: 0 });
const replacePrompt = useCallback((value: string) => {
setPromptSeed((current) => ({ value, revision: current.revision + 1 }));
}, []);
const [sending, setSending] = useState(false);
- // The composed prompt waiting for the user's approval, and the wording they
- // originally typed. Both are kept so "Send verbatim" and Escape can hand the
- // original back — nothing typed here is ever lost behind the preview.
- const [preview, setPreview] = useState<ComposedPreview | null>(null);
- const [previewSource, setPreviewSource] = useState("");
// Bumping a pane's token reconnects just that pane, which respawns its agent.
// Keyed by call-sign so closing or splitting never disturbs the others.
@@ -2267,13 +2259,30 @@ export function AgenticGrid({
setAttachments((prev) => prev.filter((a) => a.name !== name));
}, []);
- /** Type `text` into `target` and report honestly if it was not accepted. */
- const deliver = async (text: string, carry: DropAttachment[] = []) => {
+ /**
+ * Compose and deliver in one request — the same thing "prompt Mika …" does
+ * by voice.
+ *
+ * The backend rewrites the typed instruction into a briefed task with the
+ * relevant `@file` references attached and types THAT into the pane. It owns
+ * every failure mode: a slow writer is hedged, a dead one is substituted,
+ * and when no capable model is reachable the deterministic rendering ships
+ * instead — so the pane always receives a prompt, never nothing. An earlier
+ * version composed in a dry run first and held the result for approval, with
+ * a "Send verbatim" escape; the maintainer retired that detour (2026-08-12)
+ * because its fallback paths sent the raw text, and the typed bar must
+ * behave exactly like the spoken one.
+ *
+ * On a failed REQUEST nothing was typed anywhere, so the draft stays in the
+ * editor rather than being retried verbatim — silently downgrading to the
+ * raw text is the one behaviour this path exists to rule out.
+ */
+ const send = async (draft: string) => {
+ const text = draft.trim();
+ if (!text || !target) return;
setSending(true);
try {
- const result = await promptTerminal(target, text, { attachments: carry });
- setPreview(null);
- setPreviewSource("");
+ const result = await promptTerminal(target, text, { compose: true, attachments });
replacePrompt("");
setAttachments([]);
// The pane's badge flips to "working" NOW, not when the poll catches the
@@ -2299,38 +2308,6 @@ export function AgenticGrid({
}
};
- /**
- * Compose first, then ask.
- *
- * Jarvis turns a rough instruction into a briefed task with the relevant
- * files attached, which is a real improvement — but replacing someone's own
- * wording without showing them would be the wrong kind of helpful. So the
- * rewrite is offered, not imposed: send the brief, send what you typed, or
- * back out. If composition fails outright the original goes straight through
- * rather than blocking on a nicety.
- */
- const send = async (draft: string) => {
- const text = draft.trim();
- if (!text || !target) return;
- setSending(true);
- try {
- const composed = await composePrompt(target, text, attachments);
- if (composed.composed && composed.composed !== text) {
- setPreviewSource(text);
- setPreview(composed);
- return;
- }
- // The composed text already contains the attachments, so it carries none
- // of its own; this branch did not compose, so they still have to travel.
- await deliver(text, attachments);
- } catch (e) {
- pushToast("warning", `Could not prepare the prompt: ${(e as Error).message}`);
- await deliver(text, attachments);
- } finally {
- setSending(false);
- }
- };
-
const project = session.project;
const branchLabel = useMemo(
() => (project.is_repo && project.branch ? `on ${project.branch}` : ""),
@@ -3485,29 +3462,6 @@ export function AgenticGrid({
/>
</div>
)}
- {preview && (
- <div className="mb-2 shrink-0 overflow-y-auto px-2 pt-2 scrollbar-jarvis">
- <PromptPreview
- terminal={target}
- composed={preview.composed}
- files={preview.files}
- composedBy={preview.composed_by}
- attachments={attachments}
- // The composed text already contains the attachments; the
- // verbatim path does not, so only that one carries them.
- onSend={() => void deliver(preview.composed)}
- onSendVerbatim={() => void deliver(previewSource, attachments)}
- onCancel={() => {
- // Give the user their own words back rather than dropping
- // them. The attachments stay too — backing out of a rewrite
- // is not a reason to lose the file they dropped.
- replacePrompt(previewSource);
- setPreview(null);
- setPreviewSource("");
- }}
- />
- </div>
- )}
{/*
The input takes whatever the seam left over, which is the point of
dragging it: pull the bar up and you get a real writing surface, not a
diff --git a/jarvis/ui/web/frontend/src/components/agentic/PromptPreview.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/PromptPreview.test.tsx
deleted file mode 100644
index f43ae69618..0000000000
--- a/jarvis/ui/web/frontend/src/components/agentic/PromptPreview.test.tsx
+++ /dev/null
@@ -1,141 +0,0 @@
-import { render, screen, fireEvent } from "@testing-library/react";
-import { describe, expect, it, vi } from "vitest";
-import { PromptPreview } from "./PromptPreview";
-
-const base = {
- terminal: "Mika",
- composed:
- "## Task\nReview the ranking pipeline.\n\n## Key files\n- `@jarvis/rank.py` - ranking",
- files: ["jarvis/rank.py"],
- composedBy: "llm" as const,
- onSend: () => {},
- onSendVerbatim: () => {},
- onCancel: () => {},
-};
-
-describe("PromptPreview", () => {
- it("shows the composed prompt with its line structure intact", () => {
- render(<PromptPreview {...base} />);
- const body = screen.getByTestId("prompt-preview-body");
- expect(body.textContent).toContain("## Task");
- expect(body.textContent).toContain("Review the ranking pipeline.");
- expect(body.textContent).toContain("## Key files");
- });
-
- it("names the terminal it would go to", () => {
- render(<PromptPreview {...base} />);
- expect(screen.getByText(/Mika/)).toBeTruthy();
- });
-
- it("sends the composed prompt", () => {
- const onSend = vi.fn();
- render(<PromptPreview {...base} onSend={onSend} />);
- fireEvent.click(screen.getByTestId("prompt-preview-send"));
- expect(onSend).toHaveBeenCalledTimes(1);
- });
-
- it("offers sending the original wording unchanged", () => {
- const onSendVerbatim = vi.fn();
- render(<PromptPreview {...base} onSendVerbatim={onSendVerbatim} />);
- fireEvent.click(screen.getByTestId("prompt-preview-verbatim"));
- expect(onSendVerbatim).toHaveBeenCalledTimes(1);
- });
-
- it("cancels on Escape so the typed text is never trapped", () => {
- const onCancel = vi.fn();
- render(<PromptPreview {...base} onCancel={onCancel} />);
- fireEvent.keyDown(window, { key: "Escape" });
- expect(onCancel).toHaveBeenCalledTimes(1);
- });
-
- it("says so when only the deterministic prompt could be built", () => {
- render(<PromptPreview {...base} composedBy="fallback" />);
- expect(screen.getByTestId("prompt-preview-note")).toBeTruthy();
- });
-
- it("stays quiet about provenance on the happy path", () => {
- render(<PromptPreview {...base} />);
- expect(screen.queryByTestId("prompt-preview-note")).toBeNull();
- });
-
- it("lists the files the prompt pulled in", () => {
- render(<PromptPreview {...base} />);
- expect(screen.getByText("jarvis/rank.py")).toBeTruthy();
- });
-});
-
-/*
- * The dropped-file panel answers one question the prompt text cannot: was the
- * picture actually LOOKED at? On an install whose providers are all text-only
- * it was not, and the user has to be able to see that before the agent starts
- * rather than after it asks what the screenshot showed.
- */
-describe("PromptPreview attachments", () => {
- const described = {
- name: "shot.png",
- reference: "@.jarvis/drops/shot.png",
- kind: "image" as const,
- detail: "A login dialog whose submit button overflows its container.",
- described_by: "vision" as const,
- note: "",
- };
-
- const undescribed = {
- name: "photo.png",
- reference: "@photo.png",
- kind: "image" as const,
- detail: "",
- described_by: "none" as const,
- note: "No provider that can see images is reachable.",
- };
-
- it("shows nothing at all when nothing was dropped", () => {
- render(<PromptPreview {...base} />);
- expect(screen.queryByTestId("prompt-preview-attachments")).toBeNull();
- });
-
- it("shows what was read out of a dropped screenshot", () => {
- render(<PromptPreview {...base} attachments={[described]} />);
- const panel = screen.getByTestId("prompt-preview-attachments");
- expect(panel.textContent).toContain("shot.png");
- expect(panel.textContent).toContain("submit button overflows");
- expect(panel.textContent).toContain("described");
- });
-
- it("says plainly when the image could NOT be described", () => {
- render(<PromptPreview {...base} attachments={[undescribed]} />);
- const panel = screen.getByTestId("prompt-preview-attachments");
- expect(panel.textContent).toContain("attached as a file only");
- // The reason travels with it — "it did not work" without a why is not an
- // answer the user can act on.
- expect(panel.textContent).toContain("No provider that can see images");
- });
-
- it("distinguishes an extracted document from a described image", () => {
- render(
- <PromptPreview
- {...base}
- attachments={[
- {
- name: "spec.md",
- reference: '"spec.md"',
- kind: "text" as const,
- detail: "The endpoint must return 202.",
- described_by: "extraction" as const,
- note: "",
- },
- ]}
- />,
- );
- const panel = screen.getByTestId("prompt-preview-attachments");
- expect(panel.textContent).toContain("text read");
- expect(panel.textContent).toContain("must return 202");
- });
-
- it("lists every dropped file rather than only the first", () => {
- render(<PromptPreview {...base} attachments={[described, undescribed]} />);
- const panel = screen.getByTestId("prompt-preview-attachments");
- expect(panel.textContent).toContain("shot.png");
- expect(panel.textContent).toContain("photo.png");
- });
-});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/PromptPreview.tsx b/jarvis/ui/web/frontend/src/components/agentic/PromptPreview.tsx
deleted file mode 100644
index 7819de428f..0000000000
--- a/jarvis/ui/web/frontend/src/components/agentic/PromptPreview.tsx
+++ /dev/null
@@ -1,174 +0,0 @@
-import { useEffect } from "react";
-import { FileCode2, Image as ImageIcon, Paperclip, Send, Type, X } from "lucide-react";
-import type { DropAttachment } from "@/lib/agenticIdeApi";
-
-/**
- * The composed prompt, shown for approval before it is typed into an agent.
- *
- * Jarvis rewrites a rough instruction into a briefed markdown task with the
- * relevant files attached. That is a genuine improvement for a spoken sentence,
- * where the alternative is a transcript — but someone who TYPED an instruction
- * already chose their words, and silently replacing them would be the wrong
- * kind of helpful. So the typed path composes, shows the result, and lets the
- * user pick: send the brief, send exactly what they wrote, or back out.
- *
- * Escape always cancels. The caller keeps the original text, so nothing the
- * user typed can be lost behind this.
- */
-export interface PromptPreviewProps {
- /** Call-sign of the terminal this would go to. */
- terminal: string;
- /** The briefed markdown prompt. */
- composed: string;
- /** Repo-relative files the prompt references. */
- files: string[];
- /** Which layer produced it — `llm` is the full path. */
- composedBy: "llm" | "fallback" | "raw";
- /** Files dropped with the instruction, and what was read out of them. */
- attachments?: DropAttachment[];
- onSend: () => void;
- onSendVerbatim: () => void;
- onCancel: () => void;
-}
-
-export function PromptPreview({
- terminal,
- composed,
- files,
- composedBy,
- attachments = [],
- onSend,
- onSendVerbatim,
- onCancel,
-}: PromptPreviewProps) {
- useEffect(() => {
- const onKey = (event: KeyboardEvent) => {
- if (event.key === "Escape") onCancel();
- };
- window.addEventListener("keydown", onKey);
- return () => window.removeEventListener("keydown", onKey);
- }, [onCancel]);
-
- return (
- <div
- className="rounded-lg border border-primary/40 bg-card/80 p-3"
- data-testid="prompt-preview"
- >
- <div className="mb-2 flex items-center justify-between gap-2">
- <span className="text-xs font-medium text-muted-foreground">
- Prompt for <span className="text-foreground">{terminal}</span>
- </span>
- <button
- type="button"
- onClick={onCancel}
- className="btn-ghost h-7 w-7 p-0"
- aria-label="Discard this prompt"
- data-testid="prompt-preview-cancel"
- >
- <X className="h-3.5 w-3.5" />
- </button>
- </div>
-
- <pre
- className="max-h-64 overflow-y-auto whitespace-pre-wrap break-words rounded-md
- border border-border bg-background/60 px-3 py-2 font-mono text-xs
- leading-relaxed text-foreground"
- data-testid="prompt-preview-body"
- >
- {composed}
- </pre>
-
- {files.length > 0 && (
- <div className="mt-2 flex flex-wrap items-center gap-1.5">
- <FileCode2 className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />
- {files.map((file) => (
- <span key={file} className="chip font-mono text-[10px]">
- {file}
- </span>
- ))}
- </div>
- )}
-
- {/*
- What was read out of the dropped files, shown as itself.
-
- The description is already folded into the prompt above, so this is not
- a second copy of the content — it is the answer to the one question the
- prompt text cannot settle: did the picture actually get looked at? On an
- install with no vision-capable provider it did not, the brief was
- written without it, and the user needs to see that BEFORE the agent
- starts rather than after it asks what the screenshot showed.
- */}
- {attachments.length > 0 && (
- <div className="mt-2" data-testid="prompt-preview-attachments">
- {attachments.map((item) => {
- const read = item.described_by !== "none" && item.detail.length > 0;
- return (
- <details
- key={item.name}
- className="mt-1 rounded-md border border-border bg-background/40 px-2 py-1.5"
- >
- <summary className="flex cursor-pointer items-center gap-1.5 text-[11px] text-muted-foreground">
- {item.kind === "image" ? (
- <ImageIcon className="h-3 w-3 shrink-0" />
- ) : (
- <Paperclip className="h-3 w-3 shrink-0" />
- )}
- <span className="max-w-[14rem] truncate font-mono text-foreground">
- {item.name}
- </span>
- <span>
- {read
- ? item.described_by === "vision"
- ? "— described and included below"
- : "— text read and included"
- : "— attached as a file only"}
- </span>
- </summary>
- <p className="mt-1.5 max-h-40 overflow-y-auto whitespace-pre-wrap break-words text-[11px] leading-relaxed text-muted-foreground">
- {read ? item.detail : item.note || "Nothing could be read from this file."}
- </p>
- </details>
- );
- })}
- </div>
- )}
-
- {/* Only ever shown when the full path did NOT run. The readback must not
- claim more than happened, and neither must this. */}
- {composedBy !== "llm" && (
- <p
- className="mt-2 text-[11px] text-muted-foreground"
- data-testid="prompt-preview-note"
- >
- Roughly prepared — no capable writing model was reachable, so this is
- the cleaned-up version of what you typed rather than a full brief.
- </p>
- )}
-
- <div className="mt-3 flex flex-wrap items-center gap-2">
- <button
- type="button"
- onClick={onSend}
- className="btn-primary"
- data-testid="prompt-preview-send"
- >
- <Send className="h-3.5 w-3.5" />
- Send
- </button>
- <button
- type="button"
- onClick={onSendVerbatim}
- className="btn-ghost"
- data-testid="prompt-preview-verbatim"
- >
- <Type className="h-3.5 w-3.5" />
- Send verbatim
- </button>
- <span className="ml-auto text-[11px] text-muted-foreground">
- Esc to discard
- </span>
- </div>
- </div>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
index 813e41c22d..503fca5935 100644
--- a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
@@ -1515,18 +1515,15 @@ export interface PromptResult {
* Send an instruction to one terminal.
*
* `compose` asks the backend to rewrite a rough instruction into a briefed
- * prompt with `@file` references attached. The typed prompt bar sends with
- * `compose` OFF here — it composes in a separate step first (see
- * `composePrompt`) so the user approves the rewrite before it is typed into
- * their agent. Silently rewriting what someone typed would be the wrong kind
- * of helpful; showing it and asking is not.
+ * prompt with `@file` references attached before typing it in. The typed
+ * prompt bar sends with `compose` ON — the identical treatment a spoken
+ * "prompt Mika …" gets, in the same single request. An approval preview used
+ * to sit between the two steps; the maintainer retired it (2026-08-12)
+ * because its fallback paths delivered the raw text.
*
- * `attachments` belong on the VERBATIM path, not on the composed one. Someone
- * who chose their own wording still dropped a screenshot on purpose, and
- * sending their sentence without it would lose the file they attached; the
- * backend appends the contents underneath their words rather than rewriting
- * them. The composed text already carries the same material, so passing them
- * with it would say everything twice.
+ * `attachments` travel with the instruction either way. With `compose` the
+ * backend folds their descriptions into the brief it writes; without it the
+ * contents are appended underneath the caller's own words.
*/
export async function promptTerminal(
name: string,
@@ -1549,54 +1546,6 @@ export async function promptTerminal(
return (await res.json()) as PromptResult;
}
-export interface ComposedPreview {
- /** The briefed markdown prompt, ready to send. */
- composed: string;
- /** `llm` when a model wrote it, `fallback` when no capable model was up. */
- composed_by: "llm" | "fallback" | "raw";
- /** Repo-relative files the prompt references with `@`. */
- files: string[];
-}
-
-/**
- * Build the briefed prompt for `name` WITHOUT sending it.
- *
- * Same composition the spoken path uses, stopped one step short so the user can
- * read it. Takes as long as one model call plus reading a few files — the
- * caller should show that it is working.
- *
- * `attachments` are files the user dropped onto the prompt bar, already read by
- * the attach endpoint. They are passed HERE and not on the send that follows:
- * the composed text already contains their contents, so sending them twice
- * would append the same description underneath the brief that just described
- * it.
- */
-export async function composePrompt(
- name: string,
- prompt: string,
- attachments: DropAttachment[] = [],
-): Promise<ComposedPreview> {
- const res = await fetch(
- `/api/agentic-ide/terminals/${encodeURIComponent(name)}/prompt`,
- {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({ prompt, compose: true, dry_run: true, attachments }),
- },
- );
- if (!res.ok) throw new Error(await detail(res));
- const data = (await res.json()) as {
- composed: string;
- composed_by: ComposedPreview["composed_by"];
- files: string[];
- };
- return {
- composed: data.composed,
- composed_by: data.composed_by,
- files: data.files ?? [],
- };
-}
-
// --------------------------------------------------------- prompt writer
/** One choice for who writes Agentic-IDE task briefs. */
export type PromptWriterOption = {