opencode-supertask 0.1.33 → 0.1.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,59 @@
1
+ # Changelog
2
+
3
+ All notable user-facing changes are recorded here. This project follows semantic versioning while it is in the `0.x` development series.
4
+
5
+ ## [0.1.35] - 2026-07-18
6
+
7
+ ### Added
8
+
9
+ - Task and scheduled-task forms now include a server-side project folder browser. After a project is selected, the Dashboard runs that project's local `opencode agent list` and `opencode models` commands and exposes only directly runnable Agents plus the models actually available on the machine.
10
+ - Retry delays, run timeouts, and recurring intervals now use common human-readable presets. Number-and-unit input is shown only after choosing “Custom”; one-time schedules continue to use a local date/time picker.
11
+ - New Worker runs record the exact executable, argument array, and working directory. Execution Logs present the reproducible shell command, model text, failure diagnostics, and tool activity while retaining the complete raw OpenCode JSONL.
12
+
13
+ ### Fixed
14
+
15
+ - The model selector now explains that “default” follows the selected Agent/OpenCode configuration and does not pass `-m`, and splits large model catalogs into provider and model selectors.
16
+ - OpenCode subagents are no longer offered as direct `opencode run --agent` choices, avoiding silent fallback to a default primary Agent. Existing task values remain editable for compatibility.
17
+
18
+ [0.1.35]: https://github.com/vbgate/opencode-supertask/compare/v0.1.34...v0.1.35
19
+
20
+ ## [0.1.34] - 2026-07-18
21
+
22
+ ### Fixed
23
+
24
+ - Explicit `supertask install` and `supertask upgrade` now refresh the Gateway's OpenCode, XDG, and model-provider execution environment from the invoking terminal. PM2 identity, Bun, `HOME`, `PATH`, all `SUPERTASK_*` scope, database/config paths, and the complete rollback runtime remain pinned.
25
+ - Failed Worker runs now record the effective Agent, model source, and working directory next to the OpenCode exit code, making terminal-vs-Gateway differences diagnosable.
26
+ - `supertask doctor` now fails when the global CLI, exact OpenCode plugin, PM2 Gateway package, and ready-lock versions do not all match.
27
+
28
+ ### Added
29
+
30
+ - CLI help and interactive `doctor` / database summaries support `auto`, `zh-CN`, and `en` through `--lang` or `SUPERTASK_LANG`.
31
+ - Upgrade now detects whether the installed global CLI came from npm or Bun and synchronizes it to the same exact version after the plugin and Gateway are ready.
32
+ - README and operations guidance now cover custom primary Agent troubleshooting and execution-environment refresh behavior in both user languages.
33
+
34
+ ### Compatibility
35
+
36
+ - JSON field names and raw backend diagnostic errors are unchanged; language selection only affects human-facing help and summaries.
37
+
38
+ ## [0.1.33] - 2026-07-18
39
+
40
+ This release contains the full 0.1.32 change set plus a deterministic database-restore concurrency regression test. It is the stable upgrade target after 0.1.31.
41
+
42
+ ### Fixed
43
+
44
+ - Pinned plugin installation and Gateway launch to one exact npm version, rejecting stale floating `@latest` / `@next` cache entries and invalid file-as-directory working paths.
45
+ - Recorded and validated task working directories before queueing so Gateway-launched OpenCode runs execute in the submitting project.
46
+ - Hardened launcher/Worker IPC with a per-run guardian token and bidirectional drain proof; unknown or still-live process trees remain quarantined instead of being settled or retried unsafely.
47
+ - Made database clear/restore backup-first, transactional, WAL-consistent, schema-compatible across expand-only N/N-1 releases, and safe against concurrent successful writes.
48
+ - Hardened PM2 replacement, rollback, lifecycle locking, kill timeouts, macOS restart supervision, and Bun 1.1.45 IPC compatibility.
49
+
50
+ ### Added
51
+
52
+ - Project-directory grouping, project statistics, task creation/editing, priority/model controls, and project running-state visibility in the Web Dashboard.
53
+ - Web creation/editing for cron, delayed, and recurring tasks; “Run now” always creates a normal queued task and waits behind the global concurrency limit.
54
+ - PM2-backed “save and restart” configuration flow, light/dark/system themes, Chinese/English Web UI, and mobile layout.
55
+ - Global same-`batchId` serialization across projects and Gateway restarts, while independent batches can execute concurrently.
56
+ - Safe task deletion, dependency-aware retry, legacy quarantined-run recovery tooling, and stronger end-to-end diagnostics.
57
+
58
+ [0.1.34]: https://github.com/vbgate/opencode-supertask/compare/v0.1.33...v0.1.34
59
+ [0.1.33]: https://github.com/vbgate/opencode-supertask/compare/v0.1.31...v0.1.33
package/README.md CHANGED
@@ -7,7 +7,7 @@ AI-powered task queue for [OpenCode](https://opencode.ai) agents — schedule, r
7
7
 
8
8
  [简体中文](#简体中文)
9
9
 
10
- Documentation: [current architecture](docs/architecture.md) · [operations and troubleshooting](docs/operations.md) · [document index](docs/README.md)
10
+ Documentation: [changelog](CHANGELOG.md) · [current architecture](docs/architecture.md) · [operations and troubleshooting](docs/operations.md) · [document index](docs/README.md)
11
11
 
12
12
  ## Installation
13
13
 
@@ -32,8 +32,12 @@ supertask gateway # foreground mode: no pm2 required
32
32
 
33
33
  The plugin never installs global dependencies by itself. Without a running Gateway, queue-management tools still work, but scheduled and queued tasks are not executed and the Dashboard is unavailable.
34
34
 
35
+ Upgrades do not require uninstalling. Run `supertask upgrade`: it pins the exact latest plugin, replaces the Gateway, detects whether the global `supertask` came from npm or Bun, and synchronizes the CLI to that same version. `supertask doctor` fails if the CLI, plugin, Gateway package, or ready lock disagree. Versions through 0.1.33 cannot retroactively update their own old CLI, so upgrade from those releases by installing the new global CLI once with the original package manager, then run the new `supertask upgrade`.
36
+
35
37
  Gateway task execution currently requires macOS or Linux. Windows is rejected at startup until the Worker can use an OS Job Object to guarantee that detached OpenCode descendants cannot survive cancellation or recovery.
36
38
 
39
+ Run `supertask install` and `supertask upgrade` from the same terminal environment in which `opencode run --agent <name>` works. An explicit install or upgrade refreshes the Gateway's OpenCode/XDG/provider execution environment while keeping the proven Bun path, PM2 identity, database/config scope, and rollback runtime pinned. This matters when a custom primary agent selects a provider through environment variables or a non-default OpenCode config directory.
40
+
37
41
  ### Uninstall
38
42
 
39
43
  1. Run `supertask uninstall` to stop the Gateway and remove it from pm2
@@ -86,7 +90,9 @@ Or open the Web Dashboard:
86
90
  supertask ui # Opens http://localhost:4680 in browser
87
91
  ```
88
92
 
89
- The Task Queue page groups work by project directory and can create ordinary queued tasks with a model, prompt, priority, batch, retries, and timeout. A task is accepted only when its project path is an existing absolute directory; a full worker pool does not reject it—it remains pending in SQLite.
93
+ The Task Queue page groups work by project directory and can create ordinary queued tasks with a model, prompt, priority, batch, retries, and timeout. Choose the project with the built-in folder browser; the form then reads that directory's real `opencode agent list` and `opencode models` results. Models are grouped by provider, while only Agents that OpenCode marks as directly runnable are offered. A full worker pool does not reject a new task—it remains pending in SQLite.
94
+
95
+ Retry, timeout, and recurring-interval fields offer common presets first. Number-and-unit controls appear only under **Custom**, while one-time schedules use a local date/time picker. “Use the Agent / OpenCode default model” means SuperTask does not pass `-m`.
90
96
 
91
97
  ## SuperTask vs cron, PM2, and shell scripts
92
98
 
@@ -113,6 +119,8 @@ SuperTask's scheduler creates ordinary durable queue tasks, so scheduled and man
113
119
 
114
120
  ## CLI Reference
115
121
 
122
+ CLI help and interactive database/doctor summaries support Chinese and English. The default is `auto`: `zh*` system locales use Chinese and all other locales use English. Override it globally with `supertask --lang zh-CN <command>`, `supertask --lang en <command>`, or `SUPERTASK_LANG=zh-CN|en`. JSON field names and raw diagnostic errors are unchanged for scripts and Agents.
123
+
116
124
  ```bash
117
125
  # Gateway management
118
126
  supertask install # install Gateway as pm2 service
@@ -210,7 +218,7 @@ The complete configuration reference and restart semantics are documented in [Op
210
218
 
211
219
  Key mechanisms:
212
220
  - **Process supervision** — optional pm2 crash recovery with a 512 MB default memory restart threshold and a kill timeout no lower than Worker drain grace + 15 seconds; lifecycle operations and the macOS supervisor acquire the canonical `PM2_HOME` SQLite lock plus any recovered legacy custom lock for the whole mutation, reject a macOS LaunchAgent/CLI `PM2_HOME` mismatch before mutation, and never bypass PM2's `errored` fuse
213
- - **Version-aware restart** — package changes preserve the existing PM2 runtime environment; replacement is refused before deletion if that environment can no longer invoke PM2, and failed startup rolls back the prior entry, Bun path, environment, and version
221
+ - **Version-aware restart** — automatic recovery preserves the existing PM2 runtime environment; an explicit install/upgrade refreshes the OpenCode/provider execution environment while pinning the prior PM2/Bun/database/config identity. Replacement is refused before deletion if the old environment can no longer invoke PM2, and failed startup rolls back the complete prior runtime and version
214
222
  - **Process lock** — SQLite `BEGIN IMMEDIATE` ensures single instance, fences a process that loses ownership, and distinguishes a stale reused PID from a live Gateway
215
223
  - **Readiness check** — PM2 PID must match a fresh, ready Gateway lock; `/health` reports Worker, Scheduler, Watchdog and cleanup-loop failures
216
224
  - **Heartbeat** — Worker updates every 30s; new runs persist a per-run UUID in `locked_by` and launcher argv, and Watchdog signals a stale process group only when that identity and its OpenCode command match. Worker settles a normal exit only after the launcher returns a matching drain proof over private IPC; an unproved guardian exit remains quarantined until its process group is confirmed absent. Live legacy/v2 groups remain quarantined; an old run is recovered automatically only after both PID and PGID are confirmed absent.
@@ -231,13 +239,13 @@ http://localhost:4680 — 4 pages:
231
239
 
232
240
  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.
233
241
 
234
- 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. It requires the effective OpenCode plugin configuration to use one exact version, verifies that exact cache package, and compares it with the actual PM2 Gateway entry and ready-lock version; floating `@latest`/`@next` Gateway paths fail diagnostics. A global CLI version mismatch is reported with the exact reinstall command but does not make a healthy Gateway unhealthy.
242
+ 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. It requires the effective OpenCode plugin configuration to use one exact version, verifies that exact cache package, and compares it with the global CLI, actual PM2 Gateway entry, and ready-lock version; floating `@latest`/`@next` paths or any component version mismatch fail diagnostics.
235
243
 
236
244
  | Page | Features |
237
245
  |------|----------|
238
- | Task Queue | Group/filter by project directory, see running/queued/error counts, create or edit ordinary prioritized tasks, retry, cancel, guarded delete, and copy a validated `opencode --session …` command |
239
- | Scheduled Tasks | Create and edit model, agent, prompt, project directory, schedule, retries, and timeout; the instance limit controls automatic scheduling, while Run now always queues a task |
240
- | Execution Logs | task_runs history with session tracking |
246
+ | Task Queue | Browse a project folder, load its runnable Agents/models, see running/queued/error counts, create or edit prioritized tasks, retry, cancel, guarded delete, and copy a validated `opencode --session …` command |
247
+ | Scheduled Tasks | Create and edit model, Agent, prompt, project directory, schedule, retries, and timeout with common duration presets; Run now always queues a task |
248
+ | Execution Logs | Structured Agent output, errors, tools, exact reproducible command, raw OpenCode JSONL, and session tracking |
241
249
  | System Status | Config editor with saved/active state, PM2-backed save-and-restart, concurrency monitor, and backup-first transactional database clear |
242
250
 
243
251
  ## Data
@@ -262,7 +270,7 @@ MIT
262
270
 
263
271
  SuperTask 是一个基于 SQLite 的 AI Agent 任务调度系统,专为 [OpenCode](https://opencode.ai) 设计。
264
272
 
265
- 详细文档:[当前架构与决策](docs/architecture.md) · [运行与排障手册](docs/operations.md) · [文档索引](docs/README.md)
273
+ 详细文档:[更新记录](CHANGELOG.md) · [当前架构与决策](docs/architecture.md) · [运行与排障手册](docs/operations.md) · [文档索引](docs/README.md)
266
274
 
267
275
  ### 安装
268
276
 
@@ -285,7 +293,45 @@ supertask gateway # 前台运行:不需要 pm2
285
293
 
286
294
  插件不会自行安装全局依赖。Gateway 未运行时仍可管理队列,但不会执行排队/定时任务,也不会启动 Web 控制台。
287
295
 
288
- 升级无需卸载,执行 `supertask upgrade`。它会精确安装最新插件并替换 Gateway;重启 OpenCode 后生效。全局 CLI 由 npm 或 Bun 安装,命令不会猜测并静默更换包管理器;若 doctor 提示版本落后,用原包管理器安装输出中的精确版本(`npm install -g` `bun add -g`)。
296
+ 升级无需卸载,执行 `supertask upgrade`。它会精确安装最新插件、替换 Gateway,并根据全局 `supertask` 的真实路径识别 npm 或 Bun 后同步 CLI;无法安全确认包管理器时会明确失败并给出精确命令。`doctor` CLI、插件、Gateway 任一版本不一致视为异常。由于 0.1.33 及更早版本还不具备 CLI 自动同步能力,从这些版本升级时先用原包管理器安装一次新 CLI,再运行新版 `supertask upgrade`。
297
+
298
+ 请在手动执行 `opencode run --agent <名称>` 能工作的同一个终端环境中运行 `supertask install` 或 `supertask upgrade`。显式安装/升级会刷新 Gateway 使用的 OpenCode、XDG 与模型 Provider 执行环境,同时固定已经验证的 Bun、PM2、数据库/配置作用域,并保留完整旧环境用于失败回滚。这能避免自定义主 Agent 在终端正常、但 Gateway 仍沿用旧 Provider 凭据或旧 OpenCode 配置目录。
299
+
300
+ ### 快速开始
301
+
302
+ 启动 Gateway 后,可以直接打开 Web 管理界面:
303
+
304
+ ```bash
305
+ supertask ui # 打开 http://127.0.0.1:4680
306
+ ```
307
+
308
+ “任务队列”页可按项目目录查看、创建和编辑普通任务,设置 Agent、模型、提示词、优先级、批次、重试和超时;“定时任务”页可创建和编辑 cron、延迟执行与循环任务。项目目录可直接用文件夹选择器浏览;选定后,页面会在该目录执行本机 `opencode agent list` 和 `opencode models`,只显示可直接运行的 Agent,并按 Provider 分组模型。并发已满时新任务仍会成功入队并等待,不会因当下没有空位而拒绝创建。
309
+
310
+ 重试等待、单次超时和循环间隔默认是“30 秒”、“15 分钟”、“每 1 小时”这类直接选项;只有选择“自定义”才显示数字和单位。一次性任务使用本地日期时间选择器。“跟随 Agent / OpenCode 默认模型”表示不传 `-m`。
311
+
312
+ ### CLI 语言与命令速查
313
+
314
+ CLI 帮助以及 `doctor`、数据库维护命令的交互式摘要支持中英文。默认 `auto`:系统 locale 以 `zh` 开头时显示中文,否则显示英文。可以显式切换:
315
+
316
+ ```bash
317
+ supertask --lang zh-CN --help
318
+ supertask --lang en add --help
319
+ SUPERTASK_LANG=zh-CN supertask doctor
320
+ ```
321
+
322
+ 语言设置不改变 JSON 字段和后端原始诊断错误,Agent、管道与脚本仍可稳定解析。
323
+
324
+ ```bash
325
+ # Gateway 与诊断
326
+ supertask install | uninstall | gateway | ui | doctor
327
+
328
+ # 普通任务
329
+ supertask add | edit | list | get | status | retry | cancel | delete
330
+
331
+ # 定时任务与数据库
332
+ supertask template add | list | enable | disable | delete
333
+ supertask db check | backup | clear | restore
334
+ ```
289
335
 
290
336
  ### 卸载
291
337
 
@@ -346,14 +392,14 @@ SuperTask 的定时器会生成普通的持久队列任务,因此定时任务
346
392
  - **任务队列** — `cwd` 项目分组与查询隔离、优先级调度、全局同批次串行、依赖管理;工作目录必须是已存在的绝对目录
347
393
  - **安全停止** — 默认等待在途任务 30 秒;只有确认整棵进程树退出的任务才会被重新排队
348
394
  - **进程守护** — 可选 pm2 崩溃恢复;PM2 kill timeout 不低于 Worker drain 宽限期加 15 秒,`stop/delete` 至少再等待 5 秒并在返回前持续持有可崩溃释放的 SQLite 生命周期锁,macOS 监督器不会击穿 PM2 的 `errored` 熔断;显式 `supertask install` 同时安装/配置有限保留的日志轮转,插件加载不会安装全局依赖
349
- - **版本感知重启** — 已安装 pm2 时,插件加载会在包版本变化后安全替换 Gateway;旧环境无法执行 PM2 时会在删除前拒绝操作,否则保留原运行环境并在失败时回滚
395
+ - **版本感知重启** — 自动恢复继续使用原 PM2 运行环境;显式安装/升级会刷新 OpenCode/Provider 执行环境,同时固定原 PM2、Bun、数据库与配置身份。旧环境无法执行 PM2 时会在删除前拒绝操作,新环境启动失败时完整回滚旧环境
350
396
  - **外部升级边界** — Gateway 管理的 OpenCode 任务不能调用 `supertask_upgrade`;升级必须从外部 CLI 或非队列交互会话发起,避免任务终止承载自己的 Gateway
351
- - **定时任务** — cron / delayed / recurring,支持友好时间格式;`maxInstances` 限制自动调度,手动“立即运行一次”始终入队并在全局并发已满时等待
352
- - **Web 控制台** — 按项目目录显示运行/排队/异常数量,可创建和编辑带模型、提示词、优先级、批次、重试与超时的普通任务,也可创建和编辑定时任务;普通任务编辑保持 `cwd` 不变且拒绝运行中/终态任务;支持区分已保存/正在生效的配置、PM2 托管时保存并重启、自动备份后事务性清空数据库、中英文、跟随系统/浅色/深色主题和移动端布局
397
+ - **定时任务** — cron / delayed / recurring,常用间隔直接选择,只在自定义时输入数字和单位;`maxInstances` 限制自动调度,手动“立即运行一次”始终入队并在全局并发已满时等待
398
+ - **Web 控制台** — 按项目目录显示运行/排队/异常数量,可浏览文件夹并动态读取该项目本机 OpenCode 可运行 Agent/模型,可创建和编辑带提示词、优先级、批次、重试与超时的普通任务和定时任务;执行记录分层展示真实命令、Agent 输出、错误、工具和原始 JSONL;支持配置重启、安全清库、中英文、深浅主题和移动端
353
399
  - **Session 追踪** — 自动从 opencode run 输出中捕获 session ID;任务页和执行记录页可复制经过校验的 `opencode --session …` 命令继续会话
354
400
  - **安全删除** — 活跃执行必须先取消并收敛;仍被可执行任务依赖的前置任务也不会被误删
355
401
  - **安全重试** — 仅在依赖仍存在、同项目且可恢复时重置任务,历史清理并发时不会制造悬空 `pending`
356
- - **一键诊断** — `supertask doctor` 检查真实 OpenCode、精确锁定的插件配置/缓存、全局 CLI 提示、PM2 实际 Gateway 入口与 ready 锁版本、SQLite、Dashboard、日志轮转和 macOS 重启恢复链路;浮动 `@latest`/`@next` Gateway 路径会判异常
402
+ - **一键诊断** — `supertask doctor` 检查真实 OpenCode、精确锁定的插件配置/缓存、全局 CLIPM2 实际 Gateway 入口与 ready 锁版本、SQLite、Dashboard、日志轮转和 macOS 重启恢复链路;浮动 `@latest`/`@next` 路径或任一组件版本不一致都会判异常
357
403
 
358
404
  ### 数据库维护
359
405
 
@@ -385,3 +431,10 @@ supertask db check | jq '.counts'
385
431
 
386
432
  - 数据库:`~/.local/share/opencode/tasks.db`
387
433
  - 配置:`~/.config/opencode/supertask.json`
434
+
435
+ ### 运行要求
436
+
437
+ - Bun 1.1.45 或更高版本
438
+ - OpenCode
439
+ - Gateway Worker 当前支持 macOS 与 Linux;Windows 在 Job Object 进程树隔离完成前拒绝启动
440
+ - PM2 只在运行 `supertask install` 时显式安装/使用;前台 `supertask gateway` 不依赖 PM2