fix(coding-agent): buffer early input before prompt loop
This commit is contained in:
@@ -277,6 +277,7 @@ export class InteractiveMode {
|
||||
private version: string;
|
||||
private isInitialized = false;
|
||||
private onInputCallback?: (text: string) => void;
|
||||
private pendingUserInputs: string[] = [];
|
||||
private loadingAnimation: Loader | undefined = undefined;
|
||||
private workingMessage: string | undefined = undefined;
|
||||
private workingVisible = true;
|
||||
@@ -2660,6 +2661,8 @@ export class InteractiveMode {
|
||||
|
||||
if (this.onInputCallback) {
|
||||
this.onInputCallback(text);
|
||||
} else {
|
||||
this.pendingUserInputs.push(text);
|
||||
}
|
||||
this.editor.addToHistory?.(text);
|
||||
};
|
||||
@@ -3231,6 +3234,11 @@ export class InteractiveMode {
|
||||
}
|
||||
|
||||
async getUserInput(): Promise<string> {
|
||||
const queuedInput = this.pendingUserInputs.shift();
|
||||
if (queuedInput !== undefined) {
|
||||
return queuedInput;
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
this.onInputCallback = (text: string) => {
|
||||
this.onInputCallback = undefined;
|
||||
|
||||
Reference in New Issue
Block a user