fix(coding-agent): guarded pasted shell prompts from python

- Detected copied shell-prompt transcripts before the Python shortcut router.
- Forwarded OMP terminal chrome pastes through normal prompt submission.
- Added regression coverage for the #4678 transcript shape.

Fixes #4678
This commit is contained in:
roboomp
2026-07-06 06:13:55 +00:00
parent 674cf01762
commit 2d180b885f
3 changed files with 51 additions and 1 deletions
@@ -109,6 +109,36 @@ describe("InputController Python prompt prefix", () => {
]);
});
it("submits pasted shell-prompt transcripts with OMP chrome as a normal prompt", async () => {
const transcript =
"$ cd ~/project && sudo ./build-and-push.sh o5.7 2>&1 | tail -4\n" +
" |\n" +
" in: 282 out: 152 cache 344K t: 3.3s tok/s: 351.9/s\n" +
" is this command stuck in limbo";
const { ctx, editor, handlePythonCommand, onInputCallback, startPendingSubmission, submitted } = createContext();
const controller = new InputController(ctx);
controller.setupEditorSubmitHandler();
await editor.onSubmit?.(transcript);
expect(handlePythonCommand).not.toHaveBeenCalled();
expect(startPendingSubmission).toHaveBeenCalledWith({
text: transcript,
images: undefined,
imageLinks: undefined,
streamingBehavior: "steer",
});
expect(onInputCallback).toHaveBeenCalledTimes(1);
expect(submitted).toEqual([
{
text: transcript,
images: undefined,
imageLinks: undefined,
streamingBehavior: "steer",
},
]);
});
it("keeps space-separated Python shortcuts available", async () => {
const { ctx, editor, handlePythonCommand, onInputCallback } = createContext();
const controller = new InputController(ctx);