## Summary - remove MVP wording from repository docs and guidance - rename the system plan document and update references to it - align the default subscription plan code/name with product wording - document hard subscription expiry with no grace period ## Verification - docker build -f infra/docker/web.Dockerfile . - docker build -f infra/docker/migrate.Dockerfile . Co-authored-by: sirily <sirily@git.shararam.party> Reviewed-on: #15
6.6 KiB
6.6 KiB
Codex Status
Этот файл нужен как быстрый вход для следующего запуска Codex.
Текущее состояние
- Репозиторий уже не на стадии пустых заглушек:
web,worker,bot,cli,db,domain,providersимеют рабочий runtime-код. - Архитектурные границы пока соблюдены:
- бизнес-правила живут в
packages/domain - persistence и Prisma-транзакции живут в
packages/db - transport/integration adapters живут в
packages/providers apps/*в основном собирают transport + use cases
- бизнес-правила живут в
Реализовано
packages/domain
- quota buckets
100/80/60/40/20/0 - provider-key pool policy:
- round-robin selection
- retry vs stop decision
- cooldown / manual_review / out_of_funds transitions
- configurable manual-review threshold
- generation use cases:
createGenerationRequestmarkGenerationRequestSucceeded
- auth helpers:
- email normalization/validation
- password validation
- password hashing/verification
- session token hashing
- password reset token hashing
- telegram pairing helpers:
- code normalization
- code hashing
- expiration check
packages/db
- Prisma schema and migration history for:
- users
- sessions
- password reset tokens
- subscriptions and plans
- invoices
- generation requests / attempts / assets
- usage ledger
- provider keys / status events / proxies
- Telegram pairing / allowlist / audit log
- bootstrap:
- default subscription plan seed
- migrate-time bootstrap entrypoint
- stores:
auth-storeaccount-storebilling-storegeneration-storeworker-storetelegram-pairing-storetelegram-bot-store
packages/providers
- simulated
nano_bananaadapter - Telegram Bot API transport
- email transport
- payment provider adapter for invoice creation
apps/web
- auth/session endpoints:
POST /api/auth/registerPOST /api/auth/loginPOST /api/auth/password-reset/requestPOST /api/auth/password-reset/confirmPOST /api/auth/logoutGET /api/auth/meGET /api/auth/sessionsDELETE /api/auth/sessions/:idPOST /api/auth/logout-all
- account and billing endpoints:
GET /api/accountGET /api/billing/invoicesPOST /api/billing/invoicesPOST /api/admin/invoices/:id/mark-paid
- generation endpoints:
POST /api/generationsGET /api/generations/:id
- uses cookie-based server sessions instead of temporary
x-user-id
apps/worker
- polls queued generation requests
- claims one request at a time
- builds provider-key attempt order
- persists
GenerationAttempt - persists generated assets
- marks request
succeeded/failed - consumes quota only on success
- updates provider-key state and audit events
- supports proxy-first then direct fallback inside one key attempt
- runs cooldown recovery sweep back to
active
apps/cli
- real Telegram pairing commands:
nproxy pair <code> [--yes]nproxy pair listnproxy pair revoke <telegram-user-id> [--yes]nproxy pair cleanup [--yes]
- mutating commands require confirmation unless
--yes - successful mutations write audit logs
apps/bot
- Telegram long polling
- allowlist check
- pending pairing creation for unpaired users
- pairing code issuance
- system audit log on pairing initiation
Проверено
docker build -f infra/docker/web.Dockerfile .проходитdocker build -f infra/docker/worker.Dockerfile .проходитdocker build -f infra/docker/bot.Dockerfile .проходитdocker build -f infra/docker/cli.Dockerfile .проходитdocker build -f infra/docker/migrate.Dockerfile .проходитdocker run --env-file .env.exampleранее успешно стартовал дляweb,worker,botprisma migrate deployранее успешно проверялся против временногоpostgres:16-alpine
Что уже есть как product foundation
- регистрация и логин
- серверные сессии в БД
- password reset backend
- session management backend
- account overview backend
- billing invoice creation backend
- paid invoice -> subscription activation flow
- generation request lifecycle backend
- worker execution flow
- Telegram admin pairing flow
Что ещё отсутствует
Auth / account
- email verification
- device metadata / session rotation
- frontend account UI
Billing
- payment reconciliation worker flow
- invoice expiration / cancel flow
- webhook/provider callback handling
- полноценный billing history / admin payment operations surface
Generations
- реальный provider HTTP adapter вместо simulated
nano_banana - object storage upload/download path
- richer request/result payloads for frontend polling
Web product
- реальный frontend:
- landing
- dashboard
- billing pages
- chat UI
- admin UI
Bot / ops
- richer admin commands for allowed Telegram admins
- alerts / notifications
- provider health and billing events in bot output
Следующие шаги
- Довести billing lifecycle:
- reconciliation flow
- invoice expiration/cancel
- webhook/provider callback handling
- Заменить simulated image provider adapter на реальный transport adapter
- Расширить
webaccount/billing/generation API под реальный frontend - Добавить frontend surfaces поверх уже существующего backend
- Расширить
botдля operational alerts и admin commands
Ограничения и договорённости
- Не переносить бизнес-правила в
apps/*. - Provider-specific HTTP код должен оставаться в
packages/providers. - Сохранять разделение
GenerationRequestиGenerationAttempt. - Деплой остаётся
single VPS + Docker Compose. - User-facing quota остаётся approximate buckets only.
Полезные файлы
AGENTS.mddocs/plan/system-plan.mddocs/architecture/system-overview.mddocs/ops/deployment.mddocs/ops/provider-key-pool.mddocs/ops/telegram-pairing.md
Ограничение текущей среды Codex
- В текущем runtime нет локальных
node,npm,pnpm,corepack,tscв PATH. - Проверка делалась через Docker-based builds.