feat: add task workflow and asset downloads
This commit is contained in:
73
progress.md
73
progress.md
@@ -10,7 +10,7 @@
|
||||
- Confirmed no prior planning files existed.
|
||||
- Created lightweight planning files for this project understanding pass.
|
||||
- Inspected top-level directory, Git status, file inventory, and root package/config candidates.
|
||||
- Learned that this is not a Git repository and that the main app appears under `runtime/nianxx-play`.
|
||||
- Learned that this is not a Git repository and that the main app appears under `removed extracted runtime`.
|
||||
- Read root README, root package metadata, runtime README, runtime package metadata, and a filtered non-media source list.
|
||||
- Files created/modified:
|
||||
- `task_plan.md`
|
||||
@@ -238,6 +238,46 @@
|
||||
| 2026-05-29 | Browser REPL variable names collided across verification cells | 1 | Reused or renamed persistent variables instead of redeclaring constants |
|
||||
| 2026-05-29 | White logo required a dark frame on the light topbar and looked off-brand | 1 | Switched to black/blue logo, generated a transparent cropped asset, and removed frame styling |
|
||||
|
||||
## Session: 2026-05-29 - Server One-Command Deployment Support
|
||||
|
||||
### Docker and Script Deployment
|
||||
- **Status:** complete
|
||||
- Actions taken:
|
||||
- Added `.dockerignore` to keep secrets, local runtime data, Next build cache, dependencies, and bulky legacy media out of Docker build context.
|
||||
- Added a multi-stage `Dockerfile` using Node 22 Alpine, `npm ci`, `next build`, production dependency pruning, and `next start` on `0.0.0.0`.
|
||||
- Added `docker-compose.yml` with `zhinian-aigc` service, `.env.local` env file, `APP_PORT` host mapping, persistent `./.runtime:/app/.runtime`, restart policy, and HTTP healthcheck.
|
||||
- Added `scripts/setup.sh` for local preparation.
|
||||
- Added `scripts/deploy.sh` for server deployment with Docker Compose detection, `.env.local` creation, runtime directory creation, image build, and background startup.
|
||||
- Added `start:server` npm script for non-Docker Node/PM2 deployment.
|
||||
- Updated `.env.example` with `APP_PORT`.
|
||||
- Expanded `README.zh-CN.md` with server deployment, Docker commands, Node deployment fallback, and backup notes.
|
||||
- Added a short deployment entry to `README.md`.
|
||||
- Files created/modified:
|
||||
- `.dockerignore`
|
||||
- `Dockerfile`
|
||||
- `docker-compose.yml`
|
||||
- `scripts/setup.sh`
|
||||
- `scripts/deploy.sh`
|
||||
- `.env.example`
|
||||
- `package.json`
|
||||
- `README.md`
|
||||
- `README.zh-CN.md`
|
||||
|
||||
## Test Results - Server Deployment Support
|
||||
| Test | Input | Expected | Actual | Status |
|
||||
|------|-------|----------|--------|--------|
|
||||
| Shell syntax | `bash -n scripts/setup.sh scripts/deploy.sh` | No syntax errors | Passed | pass |
|
||||
| Unit tests | `npm test` | All tests pass | 6 files / 16 tests passed | pass |
|
||||
| Production build | `npm run build` | Build succeeds | Build succeeded | pass |
|
||||
| Local health | `curl --noproxy '*' /api/health` | `ok: true` | `ok: true` | pass |
|
||||
| Docker CLI availability | `docker --version` | Docker version if installed | No Docker CLI output in current environment | not run |
|
||||
|
||||
## Error Log - Server Deployment Support
|
||||
| Timestamp | Error | Attempt | Resolution |
|
||||
|-----------|-------|---------|------------|
|
||||
| 2026-05-29 | First `scripts/deploy.sh` draft had a shell quoting error while stripping quotes from `APP_PORT` | 1 | Simplified quote stripping and verified with `bash -n` |
|
||||
| 2026-05-29 | Docker CLI is unavailable in the current local environment | 1 | Documented that Docker build should be validated on the target server; local Next build/test/health passed |
|
||||
|
||||
## 5-Question Reboot Check
|
||||
| Question | Answer |
|
||||
|----------|--------|
|
||||
@@ -246,3 +286,34 @@
|
||||
| What's the goal? | Understand and explain the whole project |
|
||||
| What have I learned? | This is an extracted standalone Next.js runtime for 智念创作助手, with local JSON persistence and optional Seedance/OSS integrations |
|
||||
| What have I done? | Completed repository survey, architecture mapping, and runtime verification |
|
||||
|
||||
## Session: 2026-05-29 - Task Management and Public API v1
|
||||
|
||||
### Planning and Scope
|
||||
- **Status:** in progress
|
||||
- Actions taken:
|
||||
- Confirmed the current app already has `GenerationJob`, image/video submit routes, polling routes, Supabase/local JSON persistence, and Docker Compose deployment support.
|
||||
- Accepted the user decision that multi-task support should be implemented as task management logic, not a separate message queue system.
|
||||
- Set the implementation path: API Key auth, `/api/v1` public routes, task-state/locking fields, provider execution via Worker, and a Docker Compose worker service.
|
||||
|
||||
### Implementation
|
||||
- **Status:** complete
|
||||
- Actions taken:
|
||||
- Extended `GenerationJob` with external client, idempotency, priority, retry, lock, timing, and webhook fields.
|
||||
- Updated local JSON and Supabase mappings, plus `supabase/schema.sql` with queue indexes and `claim_generation_jobs`.
|
||||
- Changed image/video submit services so creation enqueues jobs only; provider dispatch and polling now happen through `advanceImageJob` / `advanceVideoJob`.
|
||||
- Added task manager, API Key auth, public idempotency helper, webhook signing/delivery, internal Worker tick route, and `scripts/worker.mjs`.
|
||||
- Added `/api/v1/capabilities`, `/api/v1/assets`, `/api/v1/jobs`, `/api/v1/jobs/:id`, `/api/v1/jobs/:id/cancel`, and `/api/v1/openapi.json`.
|
||||
- Added `npm run worker`, `npm run worker:once`, and a `zhinian-worker` Docker Compose service.
|
||||
- Updated README files and `.env.example` with API/Worker/Webhook configuration.
|
||||
|
||||
### Verification
|
||||
- **Status:** complete
|
||||
- Results:
|
||||
- `npm test`: 7 files / 21 tests passed.
|
||||
- `npm run build`: production build succeeded.
|
||||
- `npm run health`: returned `ok: true`.
|
||||
- Local `/api/v1/capabilities` with API Key returned capabilities.
|
||||
- Local `/api/v1/jobs` created a queued job with idempotency key.
|
||||
- `npm run worker:once` claimed the queued job and processed it to `succeeded` in mock mode.
|
||||
- Docker CLI is unavailable in this local environment, so `docker compose up --build` still needs server-side validation.
|
||||
|
||||
Reference in New Issue
Block a user