ishenwei 74458b4fab feat: add CronJob and CronJobRun models with bulk upsert API and admin
- CronJob: maps jobs.json (schedule, payload, delivery, state fields)
- CronJobRun: stores runs/*.jsonl per-job execution history with usage/tokens
- cron_bulk_upsert service: atomic upsert with GET_OR_CREATE for idempotency
- POST /api/cron/bulk_upsert/ endpoint
- Django Admin: CronJobAdmin with CronJobRunInline, CronJobRunAdmin
- sync_sessions.py --cron mode: SSH read jobs.json + runs/*.jsonl, incremental sync
- 0003_cronjob_cronjobrun migration
2026-04-13 13:34:24 +08:00
2026-04-06 18:55:48 +08:00
2026-04-06 18:55:48 +08:00
2026-04-06 18:55:48 +08:00

agent-base

OpenClaw Session Archive - 多 Agent 会话解析与归档系统。

Architecture

Three nodes (Mac Mini, Ubuntu1, Ubuntu2) run a sync script that parses local JSONL session files and pushes structured data to a central Django API. The Django service runs in Docker Compose and stores data in a remote PostgreSQL + TimescaleDB instance on NAS.

Quick Start

# 1. Configure environment
cp .env.example .env
# Edit .env with your database credentials and Django settings

# 2. Build and start
docker compose build
docker compose run --rm web python manage.py migrate
docker compose run --rm web python manage.py createsuperuser
docker compose up -d

# 3. Access
# Django Admin: http://<host>:8000/admin/
# API: http://<host>:8000/api/sessions/bulk_upsert/

Running Tests

pip install -r requirements-dev.txt
pytest -v

Client Sync Script

Deploy scripts/sync_sessions.py on each node:

python sync_sessions.py --remote-url http://<django-host>:8000/api/sessions/bulk_upsert/

Set SOURCE_NODE environment variable on each node (macmini, ubuntu1, ubuntu2).

Daily Export

In Django Admin, select sessions and choose "Export selected sessions to Markdown" action.

Description
No description provided
Readme 132 KiB
Languages
Python 93.9%
HTML 5.8%
Dockerfile 0.3%