fix: align headless interactive tool behavior with bidirectional parity (#894)
This commit is contained in:
@@ -3,7 +3,17 @@
|
||||
* Exits plan mode - the plan is read from the plan file by the UI
|
||||
*/
|
||||
|
||||
import { permissionMode } from "../../permissions/mode";
|
||||
|
||||
export async function exit_plan_mode(): Promise<{ message: string }> {
|
||||
// In interactive mode, the UI restores mode before calling this tool.
|
||||
// In headless/bidirectional mode, there is no UI layer to do that, so
|
||||
// restore here as a fallback to avoid getting stuck in plan mode.
|
||||
if (permissionMode.getMode() === "plan") {
|
||||
const restoredMode = permissionMode.getModeBeforePlan() ?? "default";
|
||||
permissionMode.setMode(restoredMode);
|
||||
}
|
||||
|
||||
// Return confirmation message that plan was approved
|
||||
// Note: The plan is read from the plan file by the UI before this return is shown
|
||||
// The UI layer checks if the plan file exists and auto-rejects if not
|
||||
|
||||
Reference in New Issue
Block a user