Skip to content

Commit 72cefb6

Browse files
committed
feat: modernize dashboard interface
1 parent c5f84f3 commit 72cefb6

8 files changed

Lines changed: 1157 additions & 463 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ dist/
77
.env
88
.env.*
99
.factory/
10+
.playwright-cli/
11+
output/playwright/

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ Key mechanisms:
205205

206206
http://localhost:4680 — 4 pages:
207207

208+
The responsive Dashboard supports Chinese and English plus system, light, and dark themes. Language is stored in a same-site cookie, while theme preference stays in browser local storage; both survive refreshes without changing Gateway configuration.
209+
208210
Health endpoint: `GET http://localhost:4680/health` returns 200 only after Gateway startup completes and its internal loops remain active without an unrecovered loop failure. `supertask doctor` also checks OpenCode, SQLite, PM2 readiness, Dashboard health, log rotation, and on macOS the loaded LaunchAgent plus its recoverable PM2 dump.
209211

210212
| Page | Features |
@@ -302,7 +304,7 @@ supertask template add --type cron --cron "0 9 * * *" ...
302304
- **版本感知重启** — 已安装 pm2 时,插件加载会在包版本变化后安全替换 Gateway;旧环境无法执行 PM2 时会在删除前拒绝操作,否则保留原运行环境并在失败时回滚
303305
- **外部升级边界** — Gateway 管理的 OpenCode 任务不能调用 `supertask_upgrade`;升级必须从外部 CLI 或非队列交互会话发起,避免任务终止承载自己的 Gateway
304306
- **定时任务** — cron / delayed / recurring,支持友好时间格式
305-
- **Web 控制台** — 任务监控、执行日志、在线配置、自动备份后事务性清空数据库
307+
- **Web 控制台** — 任务监控、执行日志、在线配置、自动备份后事务性清空数据库;支持中英文、跟随系统/浅色/深色主题和移动端布局
306308
- **Session 追踪** — 自动从 opencode run 输出中捕获 session ID
307309
- **安全删除** — 活跃执行必须先取消并收敛;仍被可执行任务依赖的前置任务也不会被误删
308310
- **安全重试** — 仅在依赖仍存在、同项目且可恢复时重置任务,历史清理并发时不会制造悬空 `pending`

docs/architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Dashboard ─────┘ ↑ ↑
4040
| Worker | 抢占任务、启动目标 Agent、心跳、超时和结果落库 | [`src/worker/index.ts`](../src/worker/index.ts) |
4141
| Scheduler | 检查到期模板并克隆普通任务 | [`src/gateway/scheduler/`](../src/gateway/scheduler/) |
4242
| Watchdog | 恢复心跳过期任务、清理历史数据 | [`src/gateway/watchdog/`](../src/gateway/watchdog/) |
43-
| Dashboard | 本地 SSR 页面与管理 API | [`src/web/index.tsx`](../src/web/index.tsx) |
43+
| Dashboard | 本地 SSR 页面与管理 API;响应式中英文界面及浏览器本地主题偏好 | [`src/web/index.tsx`](../src/web/index.tsx)[`src/web/ui.ts`](../src/web/ui.ts) |
4444
| PM2 适配 | 显式安装、启停、版本变化后的重启 | [`src/daemon/pm2.ts`](../src/daemon/pm2.ts) |
4545

4646
## Gateway 生命周期

docs/operations.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ curl -fsS http://127.0.0.1:4680/health
152152

153153
- PM2 `online` 只说明包装进程存在;SuperTask 自身还要求 PM2 PID 与 ready 锁 PID 一致。
154154
- `/health` 可访问说明 Gateway 的 HTTP、数据库锁及内部循环正常;如果禁用了 Dashboard,此信号不适用,PM2 管理仍使用 ready 锁判断。
155+
- Dashboard 顶栏可切换中文/English 和跟随系统/浅色/深色主题。语言写入当前站点 Cookie,主题写入浏览器本地存储;它们只影响当前浏览器显示,不修改 Gateway 配置。
155156
- 新 run 使用 `gated-v3-token-guardian`,每 run UUID 会同时写入 `task_runs.locked_by` 和 launcher argv。Watchdog 只有在 launcher、OpenCode 参数与 UUID 全部匹配时才终止进程组;Worker 仅在收到 launcher 通过独立 IPC 返回的同 UUID 排空证明后才结算正常退出。guardian 无证明退出会保持 run 和批次隔离,进程组明确消失后才作失败收敛。旧 v2/legacy 记录的 PID 或 PGID 仍存活、被复用或无法确认时只隔离且不发信号,只有二者都明确消失才恢复。无法确认子进程退出时 `/health` 会降级;旧版 `started_at`/`heartbeat_at` 同时缺失的运行记录也会立即进入诊断隔离。
156157
- 旧版 `launch_protocol IS NULL` 且没有 child PID 的 run 无法自动证明进程退出。`doctor` 和 Watchdog 日志会给出任务/run ID:先在任务 `cwd` 执行 `supertask cancel --id <taskId>`,人工确认没有遗留 OpenCode,再执行 `supertask run abandon --id <runId> --confirm ABANDON`。未知非空协议、当前 guardian、存活 owner 或已记录 child PID 都会失败关闭,不能用该命令绕过。
157158
- 最可靠的运行证据是 `supertask doctor` 全部通过、`pm2 logs supertask-gateway` 中有启动/状态变化,以及最新 `task_runs` 心跳。`doctor` 失败时返回非零退出码,适合外部巡检。
@@ -203,6 +204,7 @@ sqlite3 ~/.local/share/opencode/tasks.db 'PRAGMA foreign_key_check;'
203204
- 确认 `dashboard.enabled=true`,端口没有被占用,并且访问 `http://127.0.0.1:<port>`
204205
- Dashboard 不对局域网地址监听;这是安全边界,不是网络配置遗漏。
205206
- 浏览器写请求必须同源。经过反向代理、不同主机名或不同端口访问会被拒绝。
207+
- 主题或语言显示异常时,可先切回“跟随系统”或重新选择语言;这两项是浏览器本地偏好,不影响任务与数据库。
206208

207209
## 数据库检查、备份、清空与恢复
208210

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "opencode-supertask",
3-
"version": "0.1.28",
3+
"version": "0.1.29",
44
"description": "AI Agent 任务调度系统 — OpenCode 插件 + CLI + Gateway 常驻进程",
55
"type": "module",
66
"main": "dist/plugin/supertask.js",

0 commit comments

Comments
 (0)