insights and other extension fixes

This commit is contained in:
Alex Selimov 2026-06-18 14:50:25 -04:00
parent 8bd65f7313
commit ca9acbdffb
8 changed files with 955 additions and 4 deletions

View file

@ -1,4 +1,4 @@
import type { ExtensionAPI, SessionEntry } from "@earendil-works/pi-coding-agent";
import type { ExtensionAPI, ExtensionCommandContext, SessionEntry } from "@earendil-works/pi-coding-agent";
const QUICK_MARKER_TYPE = "quick-question-session";
@ -27,10 +27,20 @@ export default function (pi: ExtensionAPI) {
const marker = getQuickSessionMarker(ctx.sessionManager.getBranch());
if (marker) {
(ctx.sessionManager as unknown as { setSessionFile(path: string): void }).setSessionFile(marker.returnSession);
// switchSession reloads the session and refreshes the chat window, unlike the
// low-level setSessionFile which only swaps the file pointer. switchSession lives
// on ExtensionCommandContext; the input handler's ctx is command-capable at runtime.
const cmdCtx = ctx as unknown as ExtensionCommandContext;
ctx.ui.setStatus("quick-question", undefined);
ctx.ui.setWidget("quick-question", undefined);
ctx.ui.notify("Returned from quick session.", "info");
const result = await cmdCtx.switchSession(marker.returnSession, {
withSession: async (replacementCtx) => {
replacementCtx.ui.notify("Returned from quick session.", "info");
},
});
if (result.cancelled) {
ctx.ui.notify("Return to original session cancelled", "info");
}
return { action: "handled" };
}