Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/resources/extensions/gsd/bootstrap/register-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,12 +430,15 @@ export function registerHooks(

pi.on("session_start", async (_event, ctx) => {
const basePath = contextBasePath(ctx);
const autoActive = isAutoActive();
initSessionNotifications(ctx);
if (!isAutoActive()) {
if (!autoActive) {
const { initHealthWidget } = await import("../health-widget.js");
initHealthWidget(ctx);
}
resetWriteGateState(basePath);
// #5945: preserve auto-dispatch pre-marked depth verification across
// spawned session startup so discuss-milestone can write CONTEXT.
if (!autoActive) resetWriteGateState(basePath);
resetToolCallLoopGuard();
approvalQuestionAbortInFlight = false;
clearDeferredApprovalGate();
Expand All @@ -458,19 +461,20 @@ export function registerHooks(
} catch { /* non-fatal */ }
await installWelcomeHeader(ctx);
await loadToolApiKeysForSession();
if (isAutoActive()) {
if (autoActive) {
ctx.ui.setWidget("gsd-health", undefined);
}
});

pi.on("session_switch", async (_event, ctx) => {
const basePath = contextBasePath(ctx);
const autoActive = isAutoActive();
initSessionNotifications(ctx);
resetWriteGateState(basePath);
if (!autoActive) resetWriteGateState(basePath);
resetToolCallLoopGuard();
clearDeferredApprovalGate();
await resetAskUserQuestionsTurnCache();
clearDiscussionFlowState(basePath);
if (!autoActive) clearDiscussionFlowState(basePath);
await syncServiceTierStatus(ctx);
await applyDisabledModelProviderPolicy(ctx);
await applyCompactionThresholdOverride(ctx);
Expand All @@ -484,7 +488,7 @@ export function registerHooks(
prepareWorkflowMcpForProject(ctx, basePath);
}
await loadToolApiKeysForSession();
if (!isAutoActive()) {
if (!autoActive) {
ctx.ui.setWidget("gsd-progress", undefined);
ctx.ui.setWidget("gsd-outcome", undefined);
const { initHealthWidget } = await import("../health-widget.js");
Expand Down
Loading