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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user