Phase 1: add state.ts types — shared SPEC §6.1 contract.

TrackedSkill, ExtensionState (version 1), and RuntimeFlags with union
aliases for skill sources, compaction source, and auto-compact integration.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-17 09:59:51 +07:00
parent 645a46c0e9
commit 57d96e8b46
+32
View File
@@ -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;
}