import { type AgentId } from '../agents/registry'; export type LockFeature = 'instruction' | 'hooks' | 'mcp'; export type AgentFeatureVersions = Partial>; export interface ContentSkillSetAgentLockEntry { version: string; dir: string; } /** One content-specific skill set installed by `mswai content install`. */ export interface ContentSkillSetLockEntry { version: string; dirs: string[]; /** Per-agent stamps are required because several agents share `.agents/skills`. */ agents?: Partial>; } export interface MswaiLock { version: 3; packageVersion: string; lastUpdated: string; files: Partial>; /** Topic directory names installed under each hooks dir. Used by orphan * cleanup to detect topics dropped in newer versions. Keys are the * agent hooks dir (e.g. ".claude/hooks"); values are unsorted topic ids * (matched against the templates/hook/scripts/ tree). NEW in v3. */ hookEntries?: Record; /** Workspace-relative path → normalized sha256 16-hex prefix. Limited to * hook scripts (`.cjs`). Used to distinguish "we wrote this last time" * from "user took ownership" before orphan deletion. NEW in v3. */ fileHashes?: Record; /** Skill names mswai installed via `npx skills add` on the last run. * Kept for backward compatibility; new cleanup logic uses skillsByDir. */ skills?: string[]; /** Skill names installed in each agent skills directory. This preserves * orphan tracking across partial runs such as `mswai skill -a claude-code`. */ skillsByDir?: Record; /** Server names mswai wrote into per-agent MCP configs on the last run. * Lets `update` / `init` strip entries that disappeared from mcp.yaml * instead of leaving stale servers in the user's config. */ mcpServers?: string[]; /** Per-agent per-feature version stamps. Each entry is the mswai * packageVersion that last wrote that (agent, feature) pair. */ agents?: Partial>; /** Content-specific skill sets keyed by catalog id. */ contentSkillSets?: Record; /** Read-only migration source written by the pre-release `custom` command. */ customSkillSets?: Record; } export interface LockVersionDrift { drifted: boolean; previousVersion: string | null; currentVersion: string; } export declare function detectLockVersionDrift(cwd: string): LockVersionDrift; /** * Read existing lock; returns null when missing, corrupt, or not v3. The * next writer will overwrite the file cleanly. */ export declare function loadLock(cwd: string): MswaiLock | null; /** * Idempotently record which files mswai owns under `feature` and which agents * received this feature on this run. Replaces only that feature's array; * other feature arrays, mcpServers, hookEntries, fileHashes, skills, and * other agents' version stamps are preserved. */ export declare function updateLock(cwd: string, feature: LockFeature, files: string[], agents?: AgentId[]): void; /** * Stamp `agents` × `feature` to the current package version without touching * the `files` inventory. */ export declare function bumpAgentVersions(cwd: string, feature: LockFeature, agents: AgentId[]): void; /** * Record the server names mswai wrote into per-agent MCP configs on this run. */ export declare function updateLockMcpServers(cwd: string, serverNames: string[]): void; /** * Record one custom skill-set connection without disturbing other entries. */ export declare function updateLockContentSkill(cwd: string, id: string, version: string, dirs: string[], agents?: AgentId[]): void; /** * Record the topic ownership map under each hooks dir. Used by hook orphan * cleanup to detect topics that disappeared from newer hooks.json. */ export declare function updateLockHookEntries(cwd: string, hookEntries: Record): void; /** * Record the normalized sha256 16-hex prefixes for hook scripts we wrote. * Caller merges (not replaces) — this function does the merge for them. */ export declare function updateLockFileHashes(cwd: string, hashes: Record, replace?: boolean): void; /** * Record the skill names mswai installed via `npx skills add` on this run. * Diffed against skills.yaml on the next run to drive `npx skills remove` * for orphans. */ export declare function updateLockSkills(cwd: string, skills: string[], skillsDirs?: string[]): void;