From db04a1dd015602768680fd24ab482852ad501e2b Mon Sep 17 00:00:00 2001 From: GRayHook Date: Wed, 17 Jun 2026 10:02:42 +0700 Subject: [PATCH] =?UTF-8?q?Phase=201:=20add=20saveState=20=E2=80=94=20pers?= =?UTF-8?q?ist=20ExtensionState=20via=20appendEntry.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit STATE_ENTRY_TYPE skill-reinject:state matches SPEC §6.1 so state survives /resume and branch reload without a full rescan. Co-authored-by: Cursor --- src/state.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/state.ts b/src/state.ts index 85a333f..be97fa0 100644 --- a/src/state.ts +++ b/src/state.ts @@ -1,3 +1,5 @@ +import type { ExtensionAPI } from "@earendil-works/pi-coding-agent"; + /** How a skill was first observed in the session (SPEC §6.2). */ export type SkillSource = "slash" | "skill-block" | "read"; @@ -31,6 +33,12 @@ export interface RuntimeFlags { autoCompactIntegration: AutoCompactIntegration; } +export const STATE_ENTRY_TYPE = "skill-reinject:state"; + +export function saveState(pi: ExtensionAPI, state: ExtensionState): void { + pi.appendEntry(STATE_ENTRY_TYPE, state); +} + export function createInitialState(): ExtensionState { return { version: 1,