// engine/freeze/unlock-token.ts — In-memory edit window for frozen specs
const tokens = new Set();
/**
 * Grant a single-edit unlock token for a spec.
 */
export function grantUnlock(_specId, targetPath) {
    // We key by targetPath because that's what atomicWriteFile checks
    tokens.add(targetPath);
    // Auto-expire after 60s
    setTimeout(() => tokens.delete(targetPath), 60000).unref();
}
/**
 * Check if a spec path has a valid unlock token.
 */
export function hasUnlockToken(targetPath) {
    return tokens.has(targetPath);
}
/**
 * Consume an unlock token (single-use).
 */
export function consumeUnlock(targetPath) {
    tokens.delete(targetPath);
}
/**
 * Clear all tokens (used in tests).
 */
export function clearAllTokens() {
    tokens.clear();
}
//# sourceMappingURL=unlock-token.js.map