3a94e7c003
Security (critical):
- SESSION_SECRET fail-fast: refuse to boot without a 32+ char secret
(src/lib/session.ts, src/app/actions/clientAuth.ts)
- Rate limit with pluggable backend: in-memory by default, auto-promotes
to Upstash Redis when REDIS_URL is set (src/lib/rateLimit.ts)
- CSRF (double-submit HMAC) + Zod validation on /api/consultation;
new /api/csrf endpoint mints tokens (src/lib/csrf.ts)
- escapeHtml + safeMailto helpers; consultation email template now
fully escapes user-controlled fields (src/lib/escapeHtml.ts)
- Magic-byte validation for /api/public-upload — rejects HTML/JS
payloads renamed to .png/.mp4 (src/lib/fileType.ts)
- Nginx: CSP, X-Frame-Options, X-Content-Type-Options, Referrer-Policy,
Permissions-Policy + 5r/m upload zone for /api/public-upload and
/api/assets (nginx/conf.d/flux.conf)
Quality:
- Delete GlobalOperations_old.tsx dead code (310 LOC)
- NavBar: replace 2s session polling with CustomEvent("flux:session-
changed") + visibilitychange listener (no more interval leaks)
- Type-safe CMS shapes via src/types/cms.ts (replaces any[] in
ApplicationsDashboard + GlobalOperations)
- /api/health now pings Postgres; docker-compose healthcheck added
- Structured JSON logger (src/lib/logger.ts) — drop-in replacement
for console.error across API routes
- Prisma indices on isActive/category/nodeType filters
FluxAI persistence + analytics:
- New models AiConversation + AiEvent with funnel stage detection
(DISCOVERY -> QUALIFY -> RECOMMEND -> HANDOFF) and OperationsSignal
back-ref so converted chats link to their consultation ticket
- /api/chat persists every user msg, ai msg, tool call, tool result;
IP is sha256-hashed with SESSION_SECRET salt; promptCacheKey wired
for when @ai-sdk/openai lands the feature
- New HQ dashboard at /hq-command/dashboard/conversations: 4 KPIs
(total, conversion rate, avg messages, avg tools), funnel + industry
breakdowns, last-50 table, per-id transcript with tool timeline
- SilentObserver sends sessionId/locale/pageUrl in transport body so
the route can stitch messages into the same conversation
- src/lib/aiSessionId.ts: localStorage UUID with sessionStorage +
in-memory fallbacks for privacy mode
- Golden tests via node --test (13 cases, no new deps);
npm run test:ai
Migration:
- prisma/migrations/20260526180000_add_indexes_and_ai_telemetry —
additive only, IF NOT EXISTS guards, safe for migrate deploy
env template hardened: SESSION_SECRET documented as required + how
to generate; REDIS_URL/REDIS_TOKEN documented as opt-in for multi-
instance deploys.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
66 lines
1.7 KiB
JSON
66 lines
1.7 KiB
JSON
{
|
|
"name": "flux-srl",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"scripts": {
|
|
"dev": "next dev",
|
|
"build": "next build",
|
|
"start": "next start",
|
|
"lint": "eslint",
|
|
"test:ai": "node --test tests/ai/golden.test.mjs"
|
|
},
|
|
"dependencies": {
|
|
"@ai-sdk/openai": "^3.0.41",
|
|
"@ai-sdk/react": "^3.0.118",
|
|
"@prisma/adapter-pg": "^7.5.0",
|
|
"@prisma/client": "^7.5.0",
|
|
"@react-three/drei": "^10.7.7",
|
|
"@react-three/fiber": "^9.5.0",
|
|
"@swc/helpers": "^0.5.17",
|
|
"@types/nodemailer": "^7.0.11",
|
|
"ai": "^6.0.116",
|
|
"bcryptjs": "^3.0.3",
|
|
"clsx": "^2.1.1",
|
|
"framer-motion": "^12.35.2",
|
|
"jose": "^6.2.1",
|
|
"lucide-react": "^0.577.0",
|
|
"next": "16.1.6",
|
|
"next-intl": "^4.8.3",
|
|
"nodemailer": "^8.0.2",
|
|
"pg": "^8.20.0",
|
|
"qrcode": "^1.5.4",
|
|
"react": "19.2.4",
|
|
"react-dom": "19.2.4",
|
|
"resend": "^6.9.3",
|
|
"sharp": "^0.34.5",
|
|
"speakeasy": "^2.0.0",
|
|
"tailwind-merge": "^3.5.0",
|
|
"three": "^0.183.2",
|
|
"zod": "^4.3.6",
|
|
"zustand": "^5.0.11"
|
|
},
|
|
"devDependencies": {
|
|
"@tailwindcss/postcss": "^4",
|
|
"@types/bcryptjs": "^3.0.0",
|
|
"@types/node": "^25",
|
|
"@types/pg": "^8.18.0",
|
|
"@types/qrcode": "^1.5.6",
|
|
"@types/react": "^19",
|
|
"@types/react-dom": "^19",
|
|
"@types/speakeasy": "^2.0.10",
|
|
"eslint": "^10",
|
|
"eslint-config-next": "16.1.6",
|
|
"prisma": "^7.5.0",
|
|
"tailwindcss": "^4",
|
|
"typescript": "^5"
|
|
},
|
|
"optionalDependencies": {
|
|
"@img/sharp-linuxmusl-x64": "0.34.5",
|
|
"@img/sharp-linuxmusl-arm64": "0.34.5",
|
|
"@img/sharp-linux-x64": "0.34.5",
|
|
"@img/sharp-linux-arm64": "0.34.5",
|
|
"@img/sharp-darwin-arm64": "0.34.5",
|
|
"@img/sharp-darwin-x64": "0.34.5"
|
|
}
|
|
}
|