From dc73ea97472fc2f7bbe71ddd8567af8462abfe3d Mon Sep 17 00:00:00 2001 From: GRayHook Date: Wed, 17 Jun 2026 11:58:29 +0700 Subject: [PATCH] =?UTF-8?q?Phase=207:=20add=20sendImmediateReinjectAllFoll?= =?UTF-8?q?owUp=20=E2=80=94=20queue=20all=20blocks=20when=20streaming=20or?= =?UTF-8?q?=20willRetry.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Uses deliverAs followUp for every skill block so re-inject does not interrupt an active agent turn or overflow recovery. Co-authored-by: Cursor --- src/reinject.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/reinject.ts b/src/reinject.ts index fdec78a..174ae66 100644 --- a/src/reinject.ts +++ b/src/reinject.ts @@ -113,6 +113,19 @@ export function sendImmediateReinjectIdle( }); } +/** Immediate path when streaming or overflow willRetry: all blocks as followUp (SPEC §5.2, §6.5.2). */ +export function sendImmediateReinjectAllFollowUp( + pi: ExtensionAPI, + skillNames: readonly string[], + state: ExtensionState, + settings: SkillReinjectSettings, + registeredSkills: readonly Pick[], +): void { + for (const block of buildReinjectBlocks(skillNames, state, settings, registeredSkills)) { + pi.sendUserMessage(block, { deliverAs: "followUp" }); + } +} + /** * Defer path on before_agent_start: inject one combined message, then clear queue (SPEC §6.5.1). * Returns undefined when pendingReinject is empty.