refactor(coding-agent): add runtime host for session switching closes #2024
This commit is contained in:
@@ -1,17 +1,9 @@
|
||||
import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent";
|
||||
|
||||
const applyWidgets = (ctx: ExtensionContext) => {
|
||||
if (!ctx.hasUI) return;
|
||||
ctx.ui.setWidget("widget-above", ["Above editor widget"]);
|
||||
ctx.ui.setWidget("widget-below", ["Below editor widget"], { placement: "belowEditor" });
|
||||
};
|
||||
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
||||
|
||||
export default function widgetPlacementExtension(pi: ExtensionAPI) {
|
||||
pi.on("session_start", (_event, ctx) => {
|
||||
applyWidgets(ctx);
|
||||
});
|
||||
|
||||
pi.on("session_switch", (_event, ctx) => {
|
||||
applyWidgets(ctx);
|
||||
if (!ctx.hasUI) return;
|
||||
ctx.ui.setWidget("widget-above", ["Above editor widget"]);
|
||||
ctx.ui.setWidget("widget-below", ["Below editor widget"], { placement: "belowEditor" });
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user