feat(notes): liens internes, onglet Réseau, living blocks et consentement IA
Some checks failed
CI / Lint, Test & Build (push) Failing after 1m19s
CI / Deploy production (on server) (push) Has been skipped

Rend les liens entre notes visibles et persistants (sync NoteLink au save, auto-save, graphe réseau rafraîchi), ajoute living blocks, Memory Echo, recherche globale, consentement IA explicite et consolide les prototypes design en architectural-grid.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Antigravity
2026-05-24 14:27:29 +00:00
parent 077e665dfc
commit e2672cd2c2
323 changed files with 20670 additions and 42431 deletions

View File

@@ -0,0 +1,39 @@
const LOCAL_STORAGE_KEY = 'memento-ai-consent-v1'
/**
* Reads the persistent AI processing consent value from local storage.
* Returns true if consented, false if rejected or not set.
*/
export function getLocalStorageAiConsent(): boolean {
if (typeof window === 'undefined') return false
try {
const val = localStorage.getItem(LOCAL_STORAGE_KEY)
return val === 'true'
} catch {
return false
}
}
/**
* Writes the persistent AI processing consent value to local storage.
*/
export function setLocalStorageAiConsent(value: boolean): void {
if (typeof window === 'undefined') return
try {
localStorage.setItem(LOCAL_STORAGE_KEY, value ? 'true' : 'false')
} catch (e) {
console.error('[setLocalStorageAiConsent] Failed to write to localStorage:', e)
}
}
/**
* Removes the persistent AI processing consent value from local storage.
*/
export function removeLocalStorageAiConsent(): void {
if (typeof window === 'undefined') return
try {
localStorage.removeItem(LOCAL_STORAGE_KEY)
} catch (e) {
console.error('[removeLocalStorageAiConsent] Failed to remove from localStorage:', e)
}
}

View File

@@ -0,0 +1,30 @@
import { auth } from '@/auth'
import { prisma } from '@/lib/prisma'
import { NextResponse } from 'next/server'
/**
* Checks if the authenticated user has explicit GDPR AI processing consent.
* Persistent consent: UserAISettings.aiProcessingConsent
* Session-only consent: signed JWT claim (not client headers — GDPR-safe)
*/
export async function hasUserAiConsent(): Promise<boolean> {
const session = await auth()
if (!session?.user?.id) {
return false
}
if (session.aiSessionConsent === true) {
return true
}
const settings = await prisma.userAISettings.findUnique({
where: { userId: session.user.id },
select: { aiProcessingConsent: true },
})
return settings?.aiProcessingConsent ?? false
}
export function aiConsentForbiddenResponse() {
return NextResponse.json({ error: 'ai_consent_required' }, { status: 403 })
}