33 Commits

Author SHA1 Message Date
ishenwei
c517a0bbde sync_sessions.py: add --sync-ssh for remote session sync via SSH
- Add --sync-ssh HOST --sync-source-path PATH to sync sessions from
  a remote host without needing to install the script there.
- Key changes:
  * ssh_list_dir(): enumerate subdirs only (fixes 'sessions' file in agents/)
  * ssh_list_files(): use ls -p to filter directories; strip remote_dir prefix
  * ssh_stat_mtime_batch(): single SSH call via Python stdin, works on
    both Linux and macOS, avoids xargs command-line length limits
  * sync_sessions_via_ssh(): parallel mtime fetch per agent dir, then
    SSH-read & parse only new/modified files
  * parse_jsonl_content(): shared parser for both local files and SSH content
- Session sync now unified: run from macmini, targets macmini/ubuntu1/ubuntu2.
- Cron sync also updated to use ssh_stat_mtime_batch for efficiency.
2026-04-16 10:06:24 +08:00
ishenwei
6f0b3e231a Add: test scripts (sync_sessions, test_all_pages, test_e2e_agent_browser) 2026-04-14 11:04:37 +08:00
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
ishenwei
1a1985a270 fix: use hardcoded href instead of {% url %} to avoid NoReverseMatch in templates 2026-04-08 20:52:03 +08:00
ishenwei
6bd99d043c fix: add Daily Reports to admin sidebar via ready() monkey-patch
- openclaw_daily/apps.py ready(): monkey-patch admin.site.get_urls() to add
  daily/ and daily-reports/ URLs under admin namespace (admin: prefix)
- admin_custom_site.py: simplified (no custom site needed)
- Revert urls.py to use default admin.site
- URL now correctly resolves as admin:openclaw_daily_report_detail
2026-04-08 20:48:00 +08:00
ishenwei
21c5e895e0 feat: add Daily Reports to admin sidebar via monkey-patch
- urls.py: add daily/ and daily-reports/ URL patterns directly
- admin_new_views.py: use admin.site.each_context for full admin context
- openclaw_daily apps.py: monkey-patch admin.site.get_app_list to inject
  Daily Reports item into sidebar app list (no circular import issues)
2026-04-08 20:44:44 +08:00
ishenwei
9542ebde73 fix: use request.admin_site in daily report views to avoid circular import 2026-04-08 20:36:46 +08:00
ishenwei
9412e7880d fix: add Daily Reports to sidebar via get_app_list override
- Create openclaw_daily app (no models, just app config)
- Override get_app_list() in OpenClawAdminSite to inject Daily Reports item
- Use get_app_list approach (not nav-sidebar template override)
- Inject at top of app list for visibility
2026-04-08 19:42:10 +08:00
ishenwei
721b113c9d feat: add Daily Report to admin sidebar via custom AdminSite
- Create OpenClawAdminSite (openclaw_admin) with Daily Reports menu in sidebar
- Re-register Session/Message/ToolCall with custom site
- Add daily/daily-reports URLs at AdminSite level
- Override admin/index.html template for sidebar item
- Use self.admin_view (not admin.site.admin_view) for site-aware view wrapping
- Clean up admin.py: remove inline URLs from SessionAdmin (now at site level)
2026-04-08 19:38:02 +08:00
ishenwei
49d772139d feat: add daily report list and detail views
- New daily_report_list_view at /admin/openclaw/session/daily-reports/
  - Shows (agent, date) combos with message/session counts
  - Filter by agent name and date range
  - Click date to enter detail page
- New daily_report_detail_view at /admin/openclaw/session/daily-reports/<agent>/<date>/
  - Shows all messages for that agent on that date
  - Full message content, tool calls, arguments, results
  - Session metadata header per session
- Added django.contrib.humanize for intcomma template filter
2026-04-08 19:25:07 +08:00
ishenwei
1a32801e39 Add tool_call_count and status to Session list_display 2026-04-08 13:35:50 +08:00
ishenwei
435bbf23d0 Show arguments and result_text in ToolCallInline (readonly) 2026-04-08 12:05:26 +08:00
ishenwei
d7498f8954 Set TIME_ZONE to Asia/Shanghai, USE_TZ=True, LANGUAGE_CODE=zh-hans 2026-04-08 11:57:49 +08:00
ishenwei
c474c9404b feat: add agent_name column to Message admin + export_agent_daily script
- Message list now shows agent_name via get_agent_name method
- New scripts/export_agent_daily.py for agent daily message export
  - Accepts --agent and --date (YYYY-MM-DD) arguments
  - Focuses on messages within target date (session may span multiple days)
  - Outputs Markdown with session info, messages, tool calls
2026-04-07 18:22:24 +08:00
ishenwei
f205c42714 fix: resolve startup issues and JSONL parsing bugs
- Add PYTHONPATH/DJANGO_SETTINGS_MODULE for Docker environment
- Fix gunicorn bind port (8000 instead of 8765)
- Add whitenoise for static file serving
- Fix JSONL parser: read role/content from event.message.* (nested structure)
- Fix session counts (message_count/tool_call_count/error_count were all 0)
- Increase DATA_UPLOAD_MAX_MEMORY_SIZE to 50MB for large batch syncs
- Add STATIC_ROOT and WhiteNoise middleware for admin CSS
- Fix index name length (>30 chars issue)
- Replace unique_together with indexes (Django 5.x compatible)
- Add graceful degradation for TimescaleDB hypertable creation
- Add static_volume/ to .gitignore
2026-04-06 20:51:51 +08:00
0653c26523 update gunicorn prot 2026-04-06 19:04:33 +08:00
8161430ada update web port 2026-04-06 19:02:51 +08:00
4206c57478 update docker-compose.yml for build 2026-04-06 18:59:01 +08:00
f754f6a275 update django port 2026-04-06 18:55:48 +08:00
d141313a24 docs: add implementation plan
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 18:07:41 +08:00
5858c617df feat: TimescaleDB hypertable migration and README
Add hypertable migration that only runs on PostgreSQL (no-op for SQLite dev/tests).
Update README with architecture, quick start, and client sync instructions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 18:06:00 +08:00
e47ca5a835 feat: Docker Compose deployment configuration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 16:28:10 +08:00
414c30f023 feat: client JSONL parse and push script
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 16:27:27 +08:00
9ec684dfe2 feat: daily Markdown export admin action
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 15:03:39 +08:00
9fa698b3ea feat: admin daily conversation view with date filtering
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 14:57:17 +08:00
a20eed9387 feat: Django Admin for Session, Message, ToolCall with inlines
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 14:54:56 +08:00
0b94b6765d feat: bulk upsert API with idempotent writes
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 14:54:33 +08:00
efc8c474fc feat: add Session, Message, ToolCall models with migrations
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 14:51:29 +08:00
f115a48c59 feat: Django project skeleton with pytest setup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 13:46:53 +08:00
1d2531a71f 完善spec:本地解析推送结构化数据 & Django Admin每日导出
- 架构调整:三节点本地解析JSONL,推送结构化JSON而非原始文件
- API改为bulk_upsert接口,接收sessions/messages/tool_calls数组
- 推送脚本改用纯标准库,由OpenClaw cron job每天凌晨触发
- 新增Admin按时间范围查询对话和Daily Markdown导出功能
- Markdown导出精简thinking,保留user/assistant对话和tool调用
- 非技术决策:原始JSONL保留在各节点本地

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 13:32:24 +08:00
fc6d2c728f 完善spec:Docker Compose部署方案及Django ORM管理数据模型
- 声明所有数据模型通过Django Model + Migration管理
- 新增Docker Compose部署章节(单服务web,远程NAS数据库)
- 添加Dockerfile、compose.yml、.env模板、运维命令
- 预留Nginx反向代理配置
- hypertable通过RunSQL嵌入migration创建

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 13:18:58 +08:00
82dd6e3f32 init spec 2026-04-05 13:03:32 +08:00
e3d03d92aa Initial commit 2026-04-05 04:56:37 +00:00