edit session
This commit is contained in:
@@ -7,8 +7,22 @@
|
||||
|
||||
import type { ExtensionAPI, SessionBeforeSwitchEvent, SessionMessageEntry } from "@mariozechner/pi-coding-agent";
|
||||
|
||||
// Flag to track if we're in the middle of an edit-session reload
|
||||
let skipNextSwitchConfirm = false;
|
||||
|
||||
export default function (pi: ExtensionAPI) {
|
||||
// Listen for edit-session reload signal
|
||||
pi.events.on("edit-session:reload", () => {
|
||||
skipNextSwitchConfirm = true;
|
||||
});
|
||||
|
||||
pi.on("session_before_switch", async (event: SessionBeforeSwitchEvent, ctx) => {
|
||||
// Skip confirmation if this is an edit-session reload
|
||||
if (skipNextSwitchConfirm) {
|
||||
skipNextSwitchConfirm = false; // Reset the flag
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.reason === "new") {
|
||||
// Emit event for sound extensions (before hasUI check)
|
||||
pi.events.emit("peon:input_required", { source: "confirm-destructive", action: "clear-session" });
|
||||
|
||||
Reference in New Issue
Block a user