diff --git a/src/index.ts b/src/index.ts index 244fbbc..bde8cea 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,6 +24,7 @@ import { import { applyPendingReinjectAfterCompact, clearPendingReinjectOnUserPrompt, + deliverDeferredReinjectSteer, planDeferredReinject, planReinject, sendImmediateReinjectAllFollowUp, @@ -101,6 +102,8 @@ export default function skillReinject(pi: ExtensionAPI): void { const skills = resolveRegisteredSkills(ctx.cwd, registeredSkills); const branch = ctx.sessionManager.getBranch(); compactionRuntime.lastCompactionFirstKeptEntryId = event.compactionEntry.firstKeptEntryId; + compactionRuntime.lastCompactionEntryId = event.compactionEntry.id; + compactionRuntime.deferredDeliveredForCompactionId = null; const trackedNames = state.skills.map((skill) => skill.name); const keptEntries = getKeptEntries(branch, event.compactionEntry.firstKeptEntryId); const keptPresent = skillsPresentInKeptWindow(keptEntries, trackedNames); @@ -126,6 +129,17 @@ export default function skillReinject(pi: ExtensionAPI): void { ); if (deliveryMode === "defer") { + if (shouldReinject && planned.length > 0 && !ctx.isIdle()) { + deliverDeferredReinjectSteer( + pi, + state, + settings, + skills, + compactionRuntime, + event.compactionEntry.id, + ctx, + ); + } persistState(); return; }