From 57d96e8b4693c7ec730fccc29766bf1cda06ca6e Mon Sep 17 00:00:00 2001 From: GRayHook Date: Wed, 17 Jun 2026 09:59:51 +0700 Subject: [PATCH] =?UTF-8?q?Phase=201:=20add=20state.ts=20types=20=E2=80=94?= =?UTF-8?q?=20shared=20SPEC=20=C2=A76.1=20contract.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TrackedSkill, ExtensionState (version 1), and RuntimeFlags with union aliases for skill sources, compaction source, and auto-compact integration. Co-authored-by: Cursor --- src/state.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/state.ts diff --git a/src/state.ts b/src/state.ts new file mode 100644 index 0000000..8b3a2af --- /dev/null +++ b/src/state.ts @@ -0,0 +1,32 @@ +/** How a skill was first observed in the session (SPEC §6.2). */ +export type SkillSource = "slash" | "skill-block" | "read"; + +/** Compaction that triggered or skipped re-inject (SPEC §8). */ +export type CompactionSource = "auto" | "manual"; + +/** pi-auto-compact delivery mode (SPEC §6.5, §16). */ +export type AutoCompactIntegration = "auto" | "defer" | "immediate" | "off"; + +export interface TrackedSkill { + name: string; + filePath: string; + baseDir: string; + firstSeenAt: number; + lastSeenAt: number; + sources: SkillSource[]; +} + +export interface ExtensionState { + version: 1; + sessionOverride: boolean | null; + skills: TrackedSkill[]; + lastCompactionSource: CompactionSource | null; + /** Skill names awaiting re-inject on the next before_agent_start (SPEC §6.5). */ + pendingReinject: string[]; +} + +/** Runtime-only; not persisted via appendEntry (SPEC §6.1). */ +export interface RuntimeFlags { + autoCompactDetected: boolean; + autoCompactIntegration: AutoCompactIntegration; +}