Implement the core write-through cache pattern for node creation. This is the architectural foundation of the application. Changes: - Add @google/generative-ai dependency for embeddings - Create lib/db.ts: SurrealDB connection helper with JWT auth - Create lib/ai.ts: AI embedding generation using text-embedding-004 - Create app/api/nodes/route.ts: POST endpoint implementing write-through cache Write-through cache flow: 1. Authenticate user via SurrealDB JWT 2. Publish node to ATproto PDS (source of truth) 3. Generate 768-dimensional embedding via Google AI 4. Cache node + embedding + links in SurrealDB Updated schema to use 768-dimensional embeddings (text-embedding-004) instead of 1536 dimensions. Security: - Row-level permissions enforced via SurrealDB JWT - All secrets server-side only - ATproto OAuth tokens from secure cookies 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
50 lines
1.2 KiB
JSON
50 lines
1.2 KiB
JSON
{
|
|
"name": "ponderants",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"scripts": {
|
|
"dev": "next dev",
|
|
"build": "next build",
|
|
"start": "next start",
|
|
"lint": "next lint",
|
|
"test": "npx magnitude"
|
|
},
|
|
"dependencies": {
|
|
"@ai-sdk/google": "latest",
|
|
"@ai-sdk/react": "latest",
|
|
"@atproto/api": "latest",
|
|
"@deepgram/sdk": "latest",
|
|
"@google/generative-ai": "^0.24.1",
|
|
"@mantine/core": "latest",
|
|
"@mantine/form": "latest",
|
|
"@mantine/hooks": "latest",
|
|
"@react-three/drei": "latest",
|
|
"@react-three/fiber": "latest",
|
|
"ai": "latest",
|
|
"jsonwebtoken": "latest",
|
|
"next": "latest",
|
|
"openid-client": "latest",
|
|
"react": "latest",
|
|
"react-dom": "latest",
|
|
"surrealdb": "latest",
|
|
"three": "latest",
|
|
"umap-js": "latest",
|
|
"zod": "latest"
|
|
},
|
|
"devDependencies": {
|
|
"@types/jsonwebtoken": "latest",
|
|
"@types/node": "latest",
|
|
"@types/react": "latest",
|
|
"@types/react-dom": "latest",
|
|
"eslint": "latest",
|
|
"eslint-config-next": "latest",
|
|
"jiti": "^2.6.1",
|
|
"magnitude-test": "latest",
|
|
"playwright": "^1.56.1",
|
|
"postcss": "latest",
|
|
"postcss-preset-mantine": "latest",
|
|
"postcss-simple-vars": "latest",
|
|
"typescript": "latest"
|
|
}
|
|
}
|