Files
PAGIVA/package.json
T
Loma Bot Ops 6994ba1a4e Move AI to Codex CLI + ChatGPT browser workers with a durable post queue
Text generation now runs through a PM2 automation worker (codex exec) and
images through the ChatGPT Chrome extension, replacing the Anthropic API.
generateStructured keeps its signature; results are Zod-validated on the web
side and the worker is reached with a bearer secret.

- AI image assistant in the post editor: editable prompt step, then image
  (square or 3:2 only, since Instagram rejects 2:3), stored via putBlob
- Full-post queue (PostGenerationJob + migration): enqueue returns 202, FIFO
  claim under an advisory lock, heartbeat, stale-job failure, per-user
  request key, cancel while QUEUED; output is always a DRAFT with audit rows
- Separate 10 images/page/day quota; text quota excludes images
- Worker reports Codex usage-limit as 429 with a clear Thai message
- Docs: AI-AUTOMATION.md, ARCHITECTURE/README/.env.example updated

Known gap: the live FIFO queue check (scripts/check-post-queue.mjs) has not
passed yet; the last run hit the Codex account usage limit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 21:52:09 +07:00

52 lines
1.5 KiB
JSON

{
"name": "page-manager",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --webpack",
"build": "next build --webpack",
"start": "next start",
"lint": "eslint",
"typecheck": "tsc --noEmit",
"user:create": "node scripts/create-user.mjs create",
"user:list": "node scripts/create-user.mjs list",
"worker:analysis": "node scripts/analysis-worker.mjs",
"worker:start": "pm2 start ecosystem.config.cjs",
"worker:stop": "pm2 stop ecosystem.config.cjs",
"worker:logs": "pm2 logs page-analysis-worker",
"gen-key": "node -e \"console.log(require('crypto').randomBytes(32).toString('base64'))\"",
"postinstall": "prisma generate",
"worker:ai": "node scripts/ai-automation-worker.mjs",
"worker:post-queue": "node scripts/post-generation-worker.mjs"
},
"dependencies": {
"@anthropic-ai/sdk": "^1.12.0",
"@prisma/adapter-pg": "^7.9.1",
"@prisma/client": "^7.9.1",
"@vercel/blob": "^2.9.0",
"dotenv": "^17.3.1",
"jose": "^6.2.8",
"next": "16.3.0",
"pg": "^8.22.0",
"playwright": "^1.65.1",
"prisma": "^7.9.1",
"react": "19.2.8",
"react-dom": "19.2.8",
"recharts": "^3.10.1",
"sharp": "^0.35.5",
"zod": "^4.6.7"
},
"devDependencies": {
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@types/pg": "^8.20.4",
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "16.3.0",
"pm2": "^7.1.2",
"tailwindcss": "^4",
"typescript": "^5"
}
}