opencode-supertask 0.1.41 → 0.2.0

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.
Files changed (97) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/README.md +66 -39
  3. package/README.zh-CN.md +66 -39
  4. package/dist/cli/chunk-3PIYMBV3.js +45 -0
  5. package/dist/cli/chunk-3PIYMBV3.js.map +1 -0
  6. package/dist/cli/chunk-4FK5KE6G.js +111 -0
  7. package/dist/cli/chunk-4FK5KE6G.js.map +1 -0
  8. package/dist/cli/chunk-5VKFECHP.js +412 -0
  9. package/dist/cli/chunk-5VKFECHP.js.map +1 -0
  10. package/dist/cli/chunk-AZM76ISG.js +143 -0
  11. package/dist/cli/chunk-AZM76ISG.js.map +1 -0
  12. package/dist/cli/chunk-CMEP6IB4.js +9379 -0
  13. package/dist/cli/chunk-CMEP6IB4.js.map +1 -0
  14. package/dist/cli/chunk-DF56RPNL.js +65 -0
  15. package/dist/cli/chunk-DF56RPNL.js.map +1 -0
  16. package/dist/cli/chunk-DIJEKFBV.js +486 -0
  17. package/dist/cli/chunk-DIJEKFBV.js.map +1 -0
  18. package/dist/cli/chunk-DYXFSX5J.js +28 -0
  19. package/dist/cli/chunk-DYXFSX5J.js.map +1 -0
  20. package/dist/cli/chunk-EQWICVCJ.js +1701 -0
  21. package/dist/cli/chunk-EQWICVCJ.js.map +1 -0
  22. package/dist/cli/chunk-GHXFMJTS.js +42 -0
  23. package/dist/cli/chunk-GHXFMJTS.js.map +1 -0
  24. package/dist/cli/chunk-IYYBJHZF.js +28 -0
  25. package/dist/cli/chunk-IYYBJHZF.js.map +1 -0
  26. package/dist/cli/chunk-J34FWHQU.js +376 -0
  27. package/dist/cli/chunk-J34FWHQU.js.map +1 -0
  28. package/dist/cli/chunk-LX5CBJLP.js +121 -0
  29. package/dist/cli/chunk-LX5CBJLP.js.map +1 -0
  30. package/dist/cli/chunk-MVQ2XONT.js +139 -0
  31. package/dist/cli/chunk-MVQ2XONT.js.map +1 -0
  32. package/dist/cli/chunk-NCT3ETTK.js +1332 -0
  33. package/dist/cli/chunk-NCT3ETTK.js.map +1 -0
  34. package/dist/cli/chunk-YB7MYTE5.js +34 -0
  35. package/dist/cli/chunk-YB7MYTE5.js.map +1 -0
  36. package/dist/cli/chunk-YGELD2E5.js +5464 -0
  37. package/dist/cli/chunk-YGELD2E5.js.map +1 -0
  38. package/dist/cli/chunk-ZBH7YWXF.js +314 -0
  39. package/dist/cli/chunk-ZBH7YWXF.js.map +1 -0
  40. package/dist/cli/config-ED56ZLHY.js +20 -0
  41. package/dist/cli/config-ED56ZLHY.js.map +1 -0
  42. package/dist/cli/database-maintenance.service-F3IZU52F.js +16 -0
  43. package/dist/cli/database-maintenance.service-F3IZU52F.js.map +1 -0
  44. package/dist/cli/database-output-GH7F6X6D.js +165 -0
  45. package/dist/cli/database-output-GH7F6X6D.js.map +1 -0
  46. package/dist/cli/db-H7GIFWS2.js +26 -0
  47. package/dist/cli/db-H7GIFWS2.js.map +1 -0
  48. package/dist/cli/doctor-smoke-QXHF7UNN.js +150 -0
  49. package/dist/cli/doctor-smoke-QXHF7UNN.js.map +1 -0
  50. package/dist/cli/duration-Q3UMLO6F.js +10 -0
  51. package/dist/cli/duration-Q3UMLO6F.js.map +1 -0
  52. package/dist/cli/gateway-HNMX5ZTO.js +1738 -0
  53. package/dist/cli/gateway-HNMX5ZTO.js.map +1 -0
  54. package/dist/cli/gateway-wake-U4HTV56Q.js +14 -0
  55. package/dist/cli/gateway-wake-U4HTV56Q.js.map +1 -0
  56. package/dist/cli/index.js +626 -26583
  57. package/dist/cli/index.js.map +1 -1
  58. package/dist/cli/job-templates-RPQJ4XXW.js +21 -0
  59. package/dist/cli/job-templates-RPQJ4XXW.js.map +1 -0
  60. package/dist/cli/logs-QD2N62KK.js +316 -0
  61. package/dist/cli/logs-QD2N62KK.js.map +1 -0
  62. package/dist/cli/output-2INTEUFQ.js +19 -0
  63. package/dist/cli/output-2INTEUFQ.js.map +1 -0
  64. package/dist/cli/pm2-WY644BUO.js +49 -0
  65. package/dist/cli/pm2-WY644BUO.js.map +1 -0
  66. package/dist/cli/task-run.service-QMDINJKG.js +15 -0
  67. package/dist/cli/task-run.service-QMDINJKG.js.map +1 -0
  68. package/dist/cli/task-template.service-SZBKGLCB.js +12 -0
  69. package/dist/cli/task-template.service-SZBKGLCB.js.map +1 -0
  70. package/dist/cli/task.service-ZVDJ6VSQ.js +19 -0
  71. package/dist/cli/task.service-ZVDJ6VSQ.js.map +1 -0
  72. package/dist/cli/update-FYD546I2.js +2058 -0
  73. package/dist/cli/update-FYD546I2.js.map +1 -0
  74. package/dist/cli/web-2S7DW7XA.js +9403 -0
  75. package/dist/cli/web-2S7DW7XA.js.map +1 -0
  76. package/dist/daemon/gateway-diagnostic-runner.js +280 -238
  77. package/dist/daemon/gateway-diagnostic-runner.js.map +1 -1
  78. package/dist/gateway/index.d.ts +82 -1
  79. package/dist/gateway/index.js +9154 -2577
  80. package/dist/gateway/index.js.map +1 -1
  81. package/dist/plugin/supertask.d.ts +157 -1
  82. package/dist/plugin/supertask.js +5056 -1550
  83. package/dist/plugin/supertask.js.map +1 -1
  84. package/dist/pm2-cli-CEDhULjk.d.ts +40 -0
  85. package/dist/web/index.d.ts +36 -34
  86. package/dist/web/index.js +9951 -4006
  87. package/dist/web/index.js.map +1 -1
  88. package/dist/worker/index.d.ts +5 -0
  89. package/dist/worker/index.js +1989 -331
  90. package/dist/worker/index.js.map +1 -1
  91. package/dist/worker/launcher.d.ts +46 -1
  92. package/dist/worker/launcher.js +218 -68
  93. package/dist/worker/launcher.js.map +1 -1
  94. package/drizzle/0009_little_weapon_omega.sql +7 -0
  95. package/drizzle/meta/0009_snapshot.json +681 -0
  96. package/drizzle/meta/_journal.json +7 -0
  97. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -2,6 +2,83 @@
2
2
 
3
3
  All notable user-facing changes are recorded here. This project follows semantic versioning while it is in the `0.x` development series.
4
4
 
5
+ ## [Unreleased]
6
+
7
+ ## [0.2.0] - 2026-12-05
8
+
9
+ ### Added
10
+
11
+ - **OpenCode 2.x (tested through v2.4.3) support alongside 1.x (1.2.20+)**:
12
+ - The plugin default export carries both the 1.x `server` and the 2.x `setup` entry and now registers **12 native tools** (`add`, `next`, `status`, `retry`, `cancel`, `edit`, `clone`, `list`, `get`, `logs`, `schedule`, `upgrade`), locking project-scoped tools to `context.directory` / `ctx.location.directory` (`supertask_status(batchId)` also reports cross-project batch occupancy and `supertask_upgrade` manages the shared installation) while keeping `start`/`done`/`fail` strictly Gateway-owned. `supertask_clone` clears `dependsOn` by default unless explicitly specified.
13
+ - Workers detect the OpenCode major version before claiming work. On 2.x they invoke `opencode run --standalone --title=<name> ... -- <prompt>` (preventing `-`-prefixed titles or Markdown prompts from being parsed as flags) and pass variants via `-m provider/model#variant` (`provider/model#variant` also works on 1.x); variant-only tasks without a model fail fast to `dead_letter`.
14
+ - The Dashboard catalog, `supertask doctor`, and `supertask upgrade` understand 2.x (`api agent.list`/`model.list` with `enabled === false` filtering and 30s caching, `debug config` source arrays, `plugin add`, and `npm/<spec>/<generation>` cache layout).
15
+ - `scripts/opencode-compat-smoke.ts` verifies plugin registration, Gateway execution, `--title=`/`--` handling, session capture, and session resume against real OpenCode binaries with isolated XDG directories and a local fake model.
16
+ - **100x+ SQLite Dispatch & Event-Driven Engine**:
17
+ - Added expand-only migration `drizzle/0009_little_weapon_omega.sql` (7 composite/covering indexes) and rewrote `claimNext`/`next` using a `MATERIALIZED` CTE + `COALESCE(retry_after, 0) <= ?` (`next()` 0.067 ms / 77,000x+, `claimNext()` 0.336 ms / 15,351x on a 10K-task / 50K-run DB).
18
+ - Added `GatewayEventBus` (`src/gateway/events.ts`) and loopback `POST /api/internal/wake` for zero-poll-wait dispatch (~33 ms p50 launch), global SSE (`/api/events`), and per-run live log SSE (`/api/runs/:id/stream`) with bounded ring-buffer replay.
19
+ - Added `TaskService.dashboardOverview()`, `TaskService.clone()`, `TaskService.cancelBatch()`, `TaskService.retryIds()`, `TaskService.deleteBatch()`, `TaskRunService.listMeta()`, and `TaskRunService.getLogById()`.
20
+ - **Three-Pane Control Plane Dashboard**:
21
+ - Rebuilt Web Dashboard with a 244px project sidebar (7-day metrics, Gateway pulse & language/theme controls), single-row topbar with server-side search, segmented status strip, non-modal right Inspector drawer (J/K keyboard navigation with stale-request guards, dependency topology, live SSE log stream), multi-select batch actions, one-click clone, embedded 4-component health grid on `/system`, ETag-cached `/assets/app.css`, `/assets/app.js`, and locale-split `/assets/i18n-*.js`, and OpenCode 2.4.3 structured log presentation (completed steps, tokens, cost, tool calls & errors).
22
+ - Slimmed `GET /` SSR HTML by **68.8%** (down to **83.6 KB**) via SVG Sprite `<use>`, a shared floating `#global-row-menu`, externalized `/assets/i18n-*.js`, minimal boot JSON (<300 B), and 240-char `title` truncation; `/runs` renders metadata-only first paint (-83.4% HTML, 38x faster SSR) and loads full logs on demand via `/api/runs/:id/log`.
23
+ - Added Top Layer `#toast-region` (`popover="manual"`) with nested `<dialog>` close-return handling, SSE disconnect indicator with automatic reconnect resync (plus retry on transient resync failure and open-dialog draft protection), viewport-clamped scrollable floating menus, and full-database agent/batch facet selects.
24
+ - **SQLite Hot-Path & Reliability Hardening (Cycle 2)**:
25
+ - Added `PRAGMA user_version` migration fast-path (`src/core/db/index.ts`) guarded by core-table existence checks, unconditional `PRAGMA foreign_key_check` on slow-path/upgrade/post-`restore()` opens, and `restore()` `user_version = 0` reset.
26
+ - Added in-process `TaskService.dashboardOverview()` snapshot caching (`WeakMap<Database>` + `BEGIN DEFERRED` single read-snapshot `PRAGMA data_version` / `total_changes()` + 7-day `next7dExpirySec` expiry tracking, skipping cache inside outer transactions) and narrowed `batchIdMatchCondition` whitespace range scans (with automatic UTF-16LE/BE fallback).
27
+ - **Expanded CLI & Lazy Loading**:
28
+ - Added `supertask logs [--id|--run-id] [--tail] [--follow]`, `supertask clone`, `supertask list --search/--agent/--template/--all`, `supertask add/edit --prompt-file`, and `supertask template edit/trigger`.
29
+ - Enabled tsup code-splitting and lazy command imports (`dist/cli/index.js` reduced from 992 KB to 181 KB, `-81.7%`; `--version` startup `-39%`) plus compact TTY human-readable output preserving JSON for non-TTY and `--json`.
30
+ - **Daemon & Workflow Cleanup**:
31
+ - Split `src/daemon/pm2.ts` into acyclic `pm2-cli.ts`, `pm2-scope.ts`, `pm2-startup.ts`, and `pm2-lifecycle.ts`, extracted `executeUpgrade()`, removed unused `glob` dependency and ad-hoc `scripts/batch-translate.ts` / `scripts/reset-status.ts`, and removed `.github/workflows/ci.yml` (`publish.yml` remains release-only).
32
+
33
+ ### Fixed
34
+
35
+ - **Cycle 2 & Round 3 adversarial review hardening**:
36
+ - `src/worker/launcher.ts`: ensured ignored `SIGPIPE` child termination always maps to a non-zero exit code, caught synchronous `spawn()` exceptions (covering Bun 1.1.45 missing-executable `ENOENT` and restricted `ps` `EPERM`) so drain proof & exit-code handling remain intact, added `sawSelf` verification on fallback `ps -axo`, and re-scanned Linux `/proc` on `ENOENT`/`ESRCH` race before declaring the process group drained.
37
+ - `src/gateway/index.ts` & `src/gateway/scheduler/index.ts`: moved `loadConfig()` ahead of `acquireLock()`, re-checked `shuttingDown` / `stopped` across async startup/init awaits, and added `createLockHeartbeatTracker()` tolerating transient `SQLITE_BUSY`/`SQLITE_LOCKED` contention within the stale threshold while immediately stopping on missing lock rows or fatal DB errors (such as `no such table: gateway_lock`).
38
+ - `plugin/supertask.ts` & `src/core/services/task-run.service.ts`: made `supertask_logs` authorize `cwd` and read log slices in a single joined SQL query (eliminating cross-project Oracle and concurrent `restore()` TOCTOU), prevented `SUPERTASK_MANAGED_RUN=1` plugin initialization from calling `ensureGateway()` against its host Gateway, blocked writes on hot sessions when a fresh ready lock has `version = NULL` or drifted version, avoided locking the current session on same-version CLI repair upgrades, and switched numeric SemVer comparison (`src/core/semver.ts`) to `BigInt`.
39
+ - `src/core/services/task.service.ts`, `src/cli/doctor-smoke.ts`, `src/daemon/pm2-startup.ts`, & `src/web/*`: included `tasks.status IS NULL` rows with active running runs in `countRunning()` and `dashboardOverview()`, re-evaluated final status in `doctor --smoke` if `cancel()` returns `null` after a deadline-edge completion, matched exact resolved `PM2_HOME` assignments in Linux systemd units (rejecting prefix collisions like `/srv/pm2-old`), and emitted explicit `<option value>` when batch/agent names contain tabs or collapsible whitespace.
40
+ - **Cross-family review & concurrency/SSE/security hardening (`deb6705`)**:
41
+ - Gateway embedded `Bun.serve` now configures `idleTimeout: 60`, preventing Bun's 10s default timeout from dropping idle SSE connections before the 15s keepalive.
42
+ - `GET /api/runs/:id/stream` re-checks SQLite immediately and periodically when a subscription is not active in memory (`sub.finished`, DB-transitioned between read and subscribe, or externally settled via `run abandon`), supports optional `tail` slicing and atomic `expectedPid`/`expectedReadyAt`/`expectedDb` validation, and closes cleanly with `done`.
43
+ - Linux `/proc` process-group scan in `src/worker/launcher.ts` requires observing `process.pid` (`sawSelf`) before trusting an empty scan (falling back to `ps` otherwise); `WorkerEngine.handleChildClose()` re-verifies kernel process-tree absence after guardian exit, clears `guardianDrained` on lingering groups, and `killEntry()` re-checks kernel presence before trusting `guardianDrained`.
44
+ - Gateway startup runs `assertNoOrphanRunningTaskRuns()` unconditionally before recovery, failing closed if legacy/corrupted DBs contain orphan `running` rows in `task_runs` with no parent task.
45
+ - `supertask logs --follow` verifies target Gateway `pid`, `dbPath`, and `lock.readyAt` via `/health` and atomically on `/api/runs/:id/stream` against the local fresh ready `gateway_lock`, and falls back to local DB polling without losing or duplicating output if SSE drops before `done`.
46
+ - Fixed `/runs` expanded long single-line command (`.log-pre.command`) stretching the table past `.table-wrap` (`contain: inline-size` + `max-width: 0` on `.run-log-row td`), switched task/run log previews to trailing 512 chars so `supertask_command` headers no longer mask task error summaries, fixed `/runs?cwd=__supertask_legacy__` legacy-project filtering, prevented rapid `J`/`K` Inspector navigation from racing or leaking `EventSource` handles, fixed plugin `supertask_upgrade` duplicate rollback error text, tightened client-side tool-error deduplication so distinct Provider errors are preserved, corrected System page PID tooltip to `Worker › Guardian`, and improved zero-count KPI pill contrast.
47
+ - Fixed Worker idle backoff shrinking intervals when `pollIntervalMs > 2500`, `PUT /api/config` concurrent lost-update window, shutdown stalling on already-exited unreleased launchers, cancel-vs-fail race emitting `status: 'failed'`, selection-order sensitivity in `cancelBatch`/`retryIds`, non-transactional two-step `TaskService.next()`, blank `cwd` accepted by `POST /api/tasks/:id/clone`, leaked `EventSource` handles during Dashboard soft refresh/fast collapse, retained references in evicted ring-buffer slots, contradictory/duplicated dual-rollback upgrade error text, and top-level `gateway.pm_cwd` fallback in legacy lock discovery.
48
+ - Plugin `ensureInit()` no longer permanently locks out subsequent tool calls after a transient initialization failure.
49
+ - `PUT /api/config` properly normalizes v1→v2 configs when persisting changes.
50
+ - "Continue session" now copies reliably: the clipboard write starts inside the click (Safari and embedded browsers rejected the old write-after-fetch), falls back to `execCommand`, then to a pre-selected manual-copy dialog. The command now enters the run's directory and uses the exact OpenCode executable that ran it.
51
+ - The Worker takes the session ID from the first top-level stdout event only, instead of rescanning a sliding output tail where subagent session IDs could overwrite it; stderr chunks no longer splice into stdout JSON lines.
52
+ - Run logs now show OpenCode error events from both versions (structured `error` objects were previously dropped), and the reproducible command always comes from the first recorded metadata line.
53
+ - A missing or unrecognizable OpenCode no longer consumes task retries: the Worker reports itself unhealthy without claiming work.
54
+ - The Dashboard catalog no longer offers 1.x hidden built-in agents (`compaction`, `title`, `summary`) and sets `PWD` to the selected project.
55
+ - `@opencode-ai/plugin` is bundled, so the peer dependency is now optional and no longer pulls its runtime tree into every OpenCode plugin cache.
56
+ - Guardian identity checks no longer fail when the install path or OpenCode path contains spaces; previously every cancel, timeout, and Watchdog recovery left such runs quarantined forever.
57
+ - A quarantined run now blocks only its own batch and concurrency slot instead of stopping dispatch for the whole queue.
58
+ - Legacy-project (no `cwd`) filters in the Dashboard respect status and batch conditions; an unparenthesized SQL `OR` previously ignored them.
59
+ - Re-enabling a disabled cron or recurring template resumes the schedule instead of firing a missed slot immediately, and recurring templates advance from their scheduled slot so scheduler latency no longer accumulates.
60
+ - Lowering `maxRetries` also dead-letters pending tasks that were re-queued by recovery with an exhausted budget.
61
+ - `parseDuration` rejects empty ISO 8601 durations (`P`, `PT`, `P.D`) and rounds to whole milliseconds, so values like `12.345s` are accepted.
62
+ - Dashboard task/template edits and system settings save values such as 12.345 s, 1.5 min, or 0.5 h instead of silently failing native form validation, form limits now come from the same bounds as `validateConfig`, and an invalid field inside a collapsed section opens it.
63
+ - Editing a task keeps its saved Agent selected while the catalog loads or when the catalog fails.
64
+ - All Dashboard API requests, including GETs, reject cross-site `Sec-Fetch-Site`; a cross-site `<img>` could previously make the Gateway start OpenCode (and its project plugins) in an arbitrary directory.
65
+ - `supertask delete` and `supertask template delete` exit non-zero when nothing was deleted, and `--lang zh` is accepted.
66
+ - Late `error` events from a launcher (for example an IPC send after exit) are logged instead of being misreported as a startup failure or crashing the Gateway.
67
+ - An older plugin never replaces a Gateway whose lock records a newer version, even while that Gateway is restarting and not yet ready.
68
+ - On Bun 1.1.x a launcher whose Gateway died before releasing it now exits instead of lingering forever (the IPC handle kept its event loop alive); OpenCode was never started in that window.
69
+ - `supertask db clear` / `db restore` refuse running work **before** stopping a PM2 Gateway. Previously the Gateway's graceful stop interrupted running tasks and reset them to pending, so the refusal never fired and the interrupted work was deleted. A run started between the check and the stop also aborts the maintenance and restores the Gateway, and a failed `pm2 stop` no longer leaves the Gateway stopped.
70
+ - Stopping or replacing a PM2 Gateway whose saved `kill_timeout` is shorter than shutdown grace + 15 s is refused while tasks are running, instead of letting PM2 SIGKILL it mid-shutdown.
71
+ - A failed Gateway replacement always attempts to restore the previous Gateway and reports every cleanup error alongside the original one; a new Gateway that becomes ready with a different version than the target is rolled back.
72
+ - Processes opening a new or not-yet-migrated database at the same time (Gateway, plugin, CLI after an upgrade) no longer fail with `database is locked` or duplicate-migration errors.
73
+ - `bun run package:smoke` understands npm 12's `npm pack --json` output.
74
+
75
+ ### Pre-Release Verification Summary (All Gaps Cleared)
76
+
77
+ - **Minimum Bun `1.1.45` runtime verified**: Executed in an isolated `bun-v1.1.45` (`bun-darwin-aarch64.zip`, SHA256 verified) environment without touching `~/.bun`: `scripts/launcher-ipc-smoke.ts dist/worker/launcher.js` (`launcher IPC compatible with Bun 1.1.45`), 6 representative suites (`90 pass / 0 fail`), and `scripts/package-install-smoke.ts` (`installed package smoke passed`). This real run also caught and fixed a Bun 1.1.45 synchronous `spawn()` `ENOENT` difference in `src/worker/launcher.ts`.
78
+ - **Cross-family multi-round adversarial review completed**: Completed with `zai-coding-plan/glm-5.4#low` plus **3 rounds of Codex CLI (`--sandbox read-only`) adversarial review**; every confirmed finding was fixed with targeted regression tests (`598 pass / 0 fail`, line coverage **88.97%**, function coverage **90.46%**).
79
+
80
+ [0.2.0]: https://github.com/vbgate/opencode-supertask/compare/v0.1.41...v0.2.0
81
+
5
82
  ## [0.1.41] - 2026-07-19
6
83
 
7
84
  ### Added
package/README.md CHANGED
@@ -1,10 +1,9 @@
1
1
  # SuperTask
2
2
 
3
- <p align="center"><strong>Queue it. Schedule it. Retry it. Know what happened.</strong></p>
3
+ <p align="center"><strong>Autonomous Task Control Plane for OpenCode — Queue it. Schedule it. Stream it. Recover it.</strong></p>
4
4
 
5
5
  <p align="center">
6
6
  <a href="https://www.npmjs.com/package/opencode-supertask"><img alt="npm version" src="https://img.shields.io/npm/v/opencode-supertask.svg"></a>
7
- <a href="https://github.com/vbgate/opencode-supertask/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/vbgate/opencode-supertask/actions/workflows/ci.yml/badge.svg"></a>
8
7
  <a href="https://opensource.org/licenses/MIT"><img alt="MIT License" src="https://img.shields.io/badge/License-MIT-yellow.svg"></a>
9
8
  </p>
10
9
 
@@ -12,9 +11,9 @@
12
11
  <strong>English</strong> | <a href="https://github.com/vbgate/opencode-supertask/blob/main/README.zh-CN.md">简体中文</a>
13
12
  </p>
14
13
 
15
- SuperTask turns one-off `opencode run` commands into durable Agent operations. It gives OpenCode agents a persistent SQLite queue, scheduling, retries, concurrency control, safe cancellation, execution history, and a local Web Dashboard.
14
+ SuperTask is a local **Autonomous Task Control Plane** for OpenCode agents. It turns one-off `opencode run` invocations into durable, observable, event-driven operations with a persistent SQLite WAL queue, cron/delayed/recurring scheduling, exponential-backoff retries, global batch serialization, real-time SSE log streaming, 12 native OpenCode tools, and a three-pane local Web Dashboard.
16
15
 
17
- OpenCode can run an Agent now. SuperTask makes sure the work is still tracked after the terminal closes, the process fails, or the machine restarts.
16
+ OpenCode can run an Agent now. SuperTask makes sure long-running and recurring Agent workflows keep moving after the terminal closes, survive crashes or reboots, stay within concurrency and dependency rules, and expose completed steps, tokens, tool calls, and reproducible commands within each run's bounded 65,536-character log tail.
18
17
 
19
18
  ## Why SuperTask?
20
19
 
@@ -31,14 +30,15 @@ SuperTask is not another wrapper around cron. Scheduled work becomes an ordinary
31
30
 
32
31
  | Capability | What it means |
33
32
  | --- | --- |
34
- | Durable queue | Tasks and every run survive process and machine restarts in SQLite WAL |
35
- | Three schedule types | Cron, run-once delay, and fixed recurring interval |
36
- | Automatic recovery | Retry budgets, exponential backoff, dead-letter state, and manual retry |
37
- | Controlled execution | Global concurrency, priority ordering, dependencies, and global batch serialization |
38
- | Project awareness | Each task keeps its OpenCode project directory, Agent, model, and optional model variant |
39
- | Safe process handling | Cancel and shutdown wait for the managed OpenCode Unix process group to drain |
40
- | Observable runs | Session ID, exact reproducible command, model output, tools, errors, and raw JSONL |
41
- | Local Dashboard | Create, schedule, inspect, retry, cancel, and diagnose from `127.0.0.1` |
33
+ | Durable SQLite WAL queue | Tasks and every run survive process and machine restarts; indexed dispatch reaches sub-millisecond latency even at 10K tasks / 50K runs |
34
+ | OpenCode 1.x & 2.4.3+ ready | Runtime version detection with 2.x `--standalone`, `--title=<name>`, `--` prompt delimiter, `-m provider/model#variant`, and `api agent.list`/`model.list` (`enabled` filtering) |
35
+ | Event-driven zero-idle wake | `GatewayEventBus` + `/api/internal/wake` wake Workers immediately on enqueue/retry/trigger (~33 ms p50 launch instead of waiting for poll intervals) |
36
+ | Three schedule types | Cron, run-once delay, and fixed recurring interval with `maxInstances` limits and instant manual trigger |
37
+ | Automatic & batch recovery | Retry budgets, exponential backoff, dead-letter convergence, order-independent batch cancel/retry, and one-click clone |
38
+ | Controlled execution | Global concurrency, priority ordering, same-project dependencies, and global batch serialization |
39
+ | Safe process handling | Per-run UUID `gated-v3-token-guardian`, Unix process-group drain proof, and kernel recheck on exit |
40
+ | Real-time observability | Live SSE log streaming (`/api/runs/:id/stream` & `supertask logs --follow`), OpenCode 2.4.3 step/token/cost/tool-error parser, Session resume, and exact reproducible command |
41
+ | Three-pane Control Plane UI | Project sidebar with 7-day metrics & Gateway pulse, single-row topbar, non-modal Inspector drawer, batch actions, and backup-first DB maintenance on `127.0.0.1` |
42
42
 
43
43
  ## Three-Minute Quick Start
44
44
 
@@ -50,6 +50,8 @@ npm install -g "opencode-supertask@$VERSION"
50
50
  opencode plugin "opencode-supertask@$VERSION" --global --force
51
51
  ```
52
52
 
53
+ OpenCode 2.x (tested through v2.4.3) uses `opencode plugin add "opencode-supertask@$VERSION"` instead of the last line. SuperTask detects the OpenCode major version at runtime and supports both 1.x (1.2.20+) and 2.x; `supertask upgrade` keeps a single pinned plugin entry in either config format.
54
+
53
55
  Pinning the exact version keeps the OpenCode plugin, global CLI, and Gateway on the same build. Do not replace it with a bare package name or `@latest` in `opencode.json`.
54
56
 
55
57
  ### 2. Restart OpenCode and start the Gateway
@@ -73,7 +75,7 @@ Create a SuperTask named "Review API errors".
73
75
  Use the build agent in this project, retry twice, and run it now.
74
76
  ```
75
77
 
76
- OpenCode receives eight native `supertask_*` plugin tools. The current project directory is taken from OpenCode's tool context rather than trusted from model input.
78
+ OpenCode receives **12 native `supertask_*` plugin tools** (`add`, `next`, `status`, `retry`, `cancel`, `edit`, `clone`, `list`, `get`, `logs`, `schedule`, `upgrade`). The current project directory is locked to OpenCode's tool context rather than trusted from model input, and runtime execution transitions (`start`/`done`/`fail`) remain exclusively owned by the Gateway.
77
79
 
78
80
  ### 4. Watch it run
79
81
 
@@ -89,16 +91,35 @@ The Dashboard opens at <http://127.0.0.1:4680>.
89
91
 
90
92
  ```mermaid
91
93
  flowchart LR
92
- A[OpenCode tools / CLI / Dashboard] --> B[SQLite task queue]
93
- B --> C[Gateway]
94
- C --> D[Worker]
95
- C --> E[Scheduler]
96
- C --> F[Watchdog]
97
- D --> G[opencode run]
98
- G --> H[Run history and session]
94
+ A[OpenCode 12 tools / CLI / Dashboard] --> B[SQLite WAL + Indexed Queue]
95
+ A -. "/api/internal/wake" .-> E[GatewayEventBus]
96
+ B --> C[Single Gateway]
97
+ C --> D[Worker + Guardian]
98
+ C --> F[Scheduler]
99
+ C --> G[Watchdog]
100
+ E --> D
101
+ D --> H[opencode run 1.x / 2.x]
102
+ H --> I[Run History + Live SSE Stream]
99
103
  ```
100
104
 
101
- The single Gateway owns runtime state transitions. Clients create and manage work; only the Gateway marks runs started, completed, failed, retried, or cancelled.
105
+ The single Gateway owns `running` and normal execution outcomes (`done` / `failed` / automatic retry). Clients create, edit, cancel, retry, and inspect work (and `run abandon` is an explicit operator escape hatch for legacy NULL-protocol runs); run records use `running | done | failed`. Writes trigger best-effort internal wakeups so Workers dispatch without polling delay, while Dashboard and `supertask logs --follow` stream live updates over SSE.
106
+
107
+ ## Measured Performance (10K Tasks / 50K Runs, ~229 MB SQLite DB)
108
+
109
+ Benchmarked on the same 10K-task / 50K-run on-disk SQLite database before and after the `0009` index + `GatewayEventBus` + CLI code-splitting refactor:
110
+
111
+ | Operation / Metric | Baseline | Current (p50) | Improvement |
112
+ | --- | ---: | ---: | ---: |
113
+ | `TaskService.next(excludedBatchIds=2)` | 5,158–6,974 ms | **0.067 ms** | **77,000x+** |
114
+ | `TaskService.claimNext()` (immediate tx) | 5,157.94 ms | **0.336 ms** | **15,351x** |
115
+ | `TaskRunService.listMeta({ limit: 50 })` | 188.46 ms | **0.224 ms** | **841x** |
116
+ | `TaskService.list({ activeExecution })` | 51.70 ms | **0.076 ms** | **680x** |
117
+ | `Dashboard SSR GET /` (homepage HTML) | 268.1 KB | **83.6 KB** (Sprite + shared menu + split i18n) | **-68.8%** HTML |
118
+ | `Dashboard SSR GET /runs` | 188.46 ms (634.9 KB) | **4.94 ms (105.6 KB)** | **38.2x** (**-83.4%** HTML) |
119
+ | `TaskService.dashboardOverview()` (cache hit) | ~50 ms cold aggregate | **~0.04 ms** (single-snapshot cache) | **1,000x+** warm hit |
120
+ | `initDb()` DB reopen (`PRAGMA user_version` fast-path) | 24.70 ms | **0.429 ms** | **57.6x** |
121
+ | Enqueue → OpenCode launch (`pollIntervalMs=1000`) | ~500 ms avg / 1,000 ms worst | **33 ms** (zero poll wait) | **~15x** end-to-end |
122
+ | CLI bundle (`dist/cli/index.js`) & `--version` | 992.3 KB / 28.9 ms | **181.1 KB / 17.6 ms** | **-81.7%** size / **-39%** startup |
102
123
 
103
124
  ## Use It Your Way
104
125
 
@@ -114,50 +135,55 @@ Show failed tasks in this project and retry the recoverable ones.
114
135
  Check whether batch "release" is running in another project.
115
136
  ```
116
137
 
117
- Available plugin tools:
138
+ Available plugin tools (12 total; `start`/`done`/`fail` are intentionally not exposed, and `supertask_clone` clears `dependsOn` by default unless explicitly passed):
118
139
 
119
140
  ```text
120
- supertask_add supertask_schedule supertask_status supertask_retry
121
- supertask_list supertask_get supertask_next supertask_upgrade
141
+ supertask_add supertask_edit supertask_clone supertask_cancel
142
+ supertask_retry supertask_logs supertask_list supertask_get
143
+ supertask_next supertask_status supertask_schedule supertask_upgrade
122
144
  ```
123
145
 
124
146
  ### CLI
125
147
 
126
148
  ```bash
127
- # Queue work
149
+ # Queue work (supports --prompt-file for long Markdown prompts)
128
150
  supertask add --name "Security review" --agent build \
129
151
  --model openai/gpt-5.6-sol --variant xhigh \
130
- --prompt "Review authentication and authorization" \
152
+ --prompt-file ./prompts/security-review.md \
131
153
  --importance 5 --urgency 4 --max-retries 2 \
132
154
  --retry-backoff 30s --timeout 30min
133
155
 
134
- # Schedule work
156
+ # Schedule, edit, or trigger templates
135
157
  supertask template add --name "Weekday report" --agent build \
136
158
  --model openai/gpt-5.6-sol --variant high \
137
159
  --prompt "Summarize important project changes" \
138
160
  --type cron --cron "0 9 * * 1-5"
161
+ supertask template edit --id 1 --cron "30 9 * * 1-5"
162
+ supertask template trigger --id 1
139
163
 
140
- # Inspect and recover
164
+ # Search, inspect, stream logs, clone, and recover
141
165
  supertask status
142
- supertask list --status failed --limit 20
166
+ supertask list --search "security" --agent build --all --limit 20
167
+ supertask logs --id 42 --tail 100 --follow
168
+ supertask clone --id 42 --name "Security review (re-run)"
143
169
  supertask retry --id 42
144
170
  supertask cancel --id 42
145
171
  ```
146
172
 
147
- Run `supertask --help` or `supertask <command> --help` for the complete command surface. CLI help and human-readable diagnostics support `auto`, `en`, and `zh-CN`.
173
+ Interactive terminals render compact human-readable output, while non-TTY pipes and explicit `--json` return machine-parseable JSON for non-streaming commands (`supertask logs --follow` streams raw log lines continuously). Run `supertask --help` or `supertask <command> --help` for the complete command surface (`auto`, `en`, and `zh-CN`).
148
174
 
149
175
  ## Dashboard
150
176
 
151
- The responsive Dashboard supports English and Chinese, light and dark themes, and four focused views:
177
+ The three-pane Control Plane Dashboard supports English and Chinese, light and dark themes, live SSE updates (`/api/events` & `/api/runs/:id/stream`), and four focused views:
152
178
 
153
179
  | Page | Purpose |
154
180
  | --- | --- |
155
- | Task Queue | Browse projects, create/edit tasks, see priorities and active state, retry, cancel, or delete safely |
181
+ | Task Queue | Left project sidebar (7-day metrics, Gateway pulse & language/theme controls), single-row topbar with server-side search, segmented status filter strip, multi-select batch retry/cancel/delete, one-click clone, and non-modal right Inspector drawer |
156
182
  | Scheduled Tasks | Create/edit cron, delayed, and recurring templates; run one immediately without bypassing the queue |
157
- | Execution Logs | Read structured output, tools, errors, sessions, and the exact historical command |
158
- | System Status | Inspect active configuration, health, concurrency, and backup-first database maintenance |
183
+ | Execution Logs | Lightweight `/runs` list with on-demand `/api/runs/:id/log` expansion, live SSE streaming for active runs, OpenCode 2.4.3 step/token/cost/tool-error breakdown, Session resume, and exact historical command |
184
+ | System Status | Active vs. saved config card with embedded 4-component health grid, concurrency controls, and backup-first transactional database maintenance |
159
185
 
160
- The project picker reads the selected directory's real `opencode agent list` and `opencode models --verbose` output, so forms offer only locally available models, each model's declared variants, and directly runnable Agents. Leaving variant at its default omits `--variant` and follows the Agent/model configuration.
186
+ The project picker reads the selected directory's real OpenCode catalog (`agent list` / `models --verbose` on 1.x; `api agent.list` / `api model.list` filtering disabled models on 2.x with 30s caching), so forms offer only locally available models, each model's declared variants, and directly runnable Agents. Leaving variant at its default omits `--variant` and follows the Agent/model configuration.
161
187
 
162
188
  ## Reliability Without Hand-Waving
163
189
 
@@ -217,7 +243,7 @@ Then restart OpenCode and run `bun run gateway` from the repository.
217
243
 
218
244
  - Tool descriptions include scheduling, retries, global batches, dependencies, and project-scope semantics.
219
245
  - Plugin tools use the OpenCode context directory and reject a model-supplied working directory.
220
- - Task-management commands return JSON, while database and doctor commands support explicit `--json`; interactive summaries are concise and localized.
246
+ - CLI commands render concise localized output on a TTY while preserving machine-parseable JSON for non-TTY pipes and explicit `--json`.
221
247
  - `AGENTS.md` records architecture invariants, testing rules, release rules, and unsafe shortcuts for coding agents.
222
248
  - Commands record the exact executable, arguments, model, variant, Agent, and working directory for reproducible diagnosis.
223
249
 
@@ -233,17 +259,18 @@ Then restart OpenCode and run `bun run gateway` from the repository.
233
259
 
234
260
  ```bash
235
261
  bun install --frozen-lockfile
236
- bun test
237
262
  bun run typecheck
238
263
  bun run typecheck:tests
239
264
  bun run lint
265
+ bun run build
266
+ bun test
240
267
  bun run test:coverage
241
268
  bun run test:browser
242
- bun run build
243
269
  bun run package:smoke
270
+ bun scripts/opencode-compat-smoke.ts
244
271
  ```
245
272
 
246
- CI runs the suite on Linux and macOS, exercises the real Dashboard in Chromium, installs the packed npm artifact, and runs representative built-product tests on the minimum supported Bun version.
273
+ GitHub Actions CI is intentionally disabled (`.github/workflows/ci.yml` has been removed; `publish.yml` is a release-only artifact publisher triggered by GitHub Release or manual `workflow_dispatch`). Run the full local verification suite—including `scripts/launcher-ipc-smoke.ts` on the minimum supported Bun 1.1.45 runtime—before cutting a release.
247
274
 
248
275
  ## License
249
276
 
package/README.zh-CN.md CHANGED
@@ -1,10 +1,9 @@
1
1
  # SuperTask
2
2
 
3
- <p align="center"><strong>排得上、定得准、失败能重试、执行有记录。</strong></p>
3
+ <p align="center"><strong>OpenCode 本地自治 Agent 任务编排与控制中枢 — 排得上、定得准、看得见、可恢复。</strong></p>
4
4
 
5
5
  <p align="center">
6
6
  <a href="https://www.npmjs.com/package/opencode-supertask"><img alt="npm 版本" src="https://img.shields.io/npm/v/opencode-supertask.svg"></a>
7
- <a href="https://github.com/vbgate/opencode-supertask/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/vbgate/opencode-supertask/actions/workflows/ci.yml/badge.svg"></a>
8
7
  <a href="https://opensource.org/licenses/MIT"><img alt="MIT 许可证" src="https://img.shields.io/badge/License-MIT-yellow.svg"></a>
9
8
  </p>
10
9
 
@@ -12,9 +11,9 @@
12
11
  <a href="https://github.com/vbgate/opencode-supertask#readme">English</a> | <strong>简体中文</strong>
13
12
  </p>
14
13
 
15
- SuperTask 把一次性的 `opencode run` 变成可持续运行的 Agent 工作系统:持久化任务队列、定时调度、自动重试、并发控制、安全取消、执行历史和本地 Web 控制台,一套全有。
14
+ SuperTask 是面向 OpenCode Agent 的本地**自治任务编排与控制中枢(Autonomous Task Control Plane)**。它把一次性的 `opencode run` 升级为可持续运行的事件驱动 Agent 作业系统:持久化 SQLite WAL 队列、定时调度、指数退避重试、全局批次串行、实时 SSE 日志流、12 个原生插件工具与三段式本地 Web 控制台,一套全有。
16
15
 
17
- OpenCode 能立刻运行一个 Agent;SuperTask 负责在终端关闭、进程失败或机器重启之后,仍然知道任务在哪、跑了几次、为什么失败、该不该重试。
16
+ OpenCode 能立刻运行一个 Agent;SuperTask 负责在终端关闭、进程失败或机器重启之后,仍然按优先级与依赖持续推进,并在有界的 65,536 字符日志尾部内沉淀完成步骤、Token、费用、工具调用与可复现命令。
18
17
 
19
18
  ## 为什么需要 SuperTask?
20
19
 
@@ -31,14 +30,15 @@ SuperTask 不是给 cron 套一层壳。定时器生成的也是普通持久任
31
30
 
32
31
  | 能力 | 实际价值 |
33
32
  | --- | --- |
34
- | 持久任务队列 | 任务及每次执行写入 SQLite WAL,进程或机器重启后仍在 |
35
- | 三种定时方式 | Cron、延迟执行一次、固定间隔循环 |
36
- | 自动恢复 | 重试预算、指数退避、停止重试状态和人工恢复 |
37
- | 可控执行 | 全局并发、优先级、依赖关系和全局同批次串行 |
38
- | 项目感知 | 每个任务保留 OpenCode 项目目录、Agent、模型和可选模型 variant |
39
- | 安全进程管理 | 取消或停机时等待受管 OpenCode Unix 进程组排空 |
40
- | 可观测执行 | Session、真实命令、模型输出、工具、错误和原始 JSONL |
41
- | 本地控制台 | 在 `127.0.0.1` 创建、定时、查看、重试、取消和诊断 |
33
+ | 高性能 SQLite WAL 队列 | 任务及每次执行写入 SQLite WAL;`0009` 覆盖索引让 10K 任务 / 50K 运行库仍保持亚毫秒级派发 |
34
+ | 完整适配 OpenCode 1.x 与 2.4.3+ | 运行时识别主版本,2.x 自动使用 `--standalone`、`--title=<name>`、`--` 提示词分隔、`-m provider/model#variant` 与 `api agent.list`/`model.list`(过滤禁用模型) |
35
+ | 事件驱动零轮询空等 | `GatewayEventBus` + `/api/internal/wake` 在入队/重试/触发时即时唤醒 Worker(实测 p50 33ms 启动) |
36
+ | 三种定时方式 | Cron、延迟执行一次、固定间隔循环,支持 `maxInstances` 上限与立即手动触发 |
37
+ | 自动与批量恢复 | 重试预算、指数退避、死信级联收敛、不受勾选顺序影响的批量取消/重试与一键克隆 |
38
+ | 可控执行 | 全局并发、优先级、同项目依赖关系和全局同批次串行 |
39
+ | 安全进程管理 | 每 run 唯一 UUID `gated-v3-token-guardian`、Unix 进程组排空双向确认与退出后内核复核 |
40
+ | 实时可观测执行 | SSE 实时日志流(`/api/runs/:id/stream` 与 `supertask logs --follow`)、OpenCode 2.4.3 步骤/Token/费用/工具报错解析、Session 续跑与历史真实命令 |
41
+ | 三段式本地控制中枢 | 左栏项目与 7 天指标 + Gateway 脉搏、单行顶栏与服务端搜索、非模态右侧 Inspector 抽屉、多选批量操作与先备份后维护数据库 |
42
42
 
43
43
  ## 三分钟开始使用
44
44
 
@@ -50,6 +50,8 @@ npm install -g "opencode-supertask@$VERSION"
50
50
  opencode plugin "opencode-supertask@$VERSION" --global --force
51
51
  ```
52
52
 
53
+ OpenCode 2.x(已完整实测 v2.4.3)请把最后一行换成 `opencode plugin add "opencode-supertask@$VERSION"`。SuperTask 在运行时识别 OpenCode 主版本,同时支持 1.x(1.2.20+)与 2.x;`supertask upgrade` 在两种配置格式下都只保留一条固定版本的插件声明。
54
+
53
55
  固定精确版本可以保证 OpenCode 插件、全局 CLI 和 Gateway 使用同一份构建。不要在 `opencode.json` 中改成裸包名或 `@latest`。
54
56
 
55
57
  ### 2. 重启 OpenCode,再启动 Gateway
@@ -73,7 +75,7 @@ supertask gateway
73
75
  使用当前项目的 build Agent,失败重试两次,现在执行。
74
76
  ```
75
77
 
76
- OpenCode 会获得 8 个原生 `supertask_*` 插件工具。任务目录来自 OpenCode 工具上下文,不信任模型自行传入的工作目录。
78
+ OpenCode 会获得 **12 个原生 `supertask_*` 插件工具**(`add/next/status/retry/cancel/edit/clone/list/get/logs/schedule/upgrade`)。任务目录严格锁定自 OpenCode 工具上下文,不信任模型传入的工作目录;运行态与终态写入(`start`/`done`/`fail`)仍由 Gateway 独占。
77
79
 
78
80
  ### 4. 看着它跑完
79
81
 
@@ -89,16 +91,35 @@ supertask ui
89
91
 
90
92
  ```mermaid
91
93
  flowchart LR
92
- A[OpenCode 工具 / CLI / Web] --> B[SQLite 任务队列]
93
- B --> C[Gateway]
94
- C --> D[Worker]
95
- C --> E[Scheduler]
96
- C --> F[Watchdog]
97
- D --> G[opencode run]
98
- G --> H[执行历史与 Session]
94
+ A[OpenCode 12 工具 / CLI / Web] --> B[SQLite WAL 索引队列]
95
+ A -. "/api/internal/wake" .-> E[GatewayEventBus]
96
+ B --> C[单实例 Gateway]
97
+ C --> D[Worker + Guardian]
98
+ C --> F[Scheduler]
99
+ C --> G[Watchdog]
100
+ E --> D
101
+ D --> H[opencode run 1.x / 2.x]
102
+ H --> I[执行历史与 SSE 实时流]
99
103
  ```
100
104
 
101
- 单实例 Gateway 独占运行状态迁移。客户端负责创建和管理任务,只有 Gateway 能把执行记录标记为开始、完成、失败、重试或取消。
105
+ 单实例 Gateway 独占 `running` 与常规执行终态(`done`/`failed`/自动重试);客户端负责创建、编辑、取消、重试与查询(`run abandon` 仅作为旧版 NULL 协议隔离 run 的人工强确认关闭入口),执行记录状态为 `running | done | failed`。外部写入会 best-effort 触发内部唤醒消除轮询空等,Web 控制台与 `supertask logs --follow` 通过 SSE 实时接收事件与日志。
106
+
107
+ ## 实测性能(10K 任务 / 50K 执行记录,~229 MB 盘上 SQLite 库)
108
+
109
+ 同一份 10K 任务 / 50K 运行盘上库在 `0009` 索引 + `GatewayEventBus` + CLI 分块懒加载改造前后的同口径实测对比:
110
+
111
+ | 路径 / 指标 | 改造前基线 | 当前实测(p50) | 提速 / 改善 |
112
+ | --- | ---: | ---: | ---: |
113
+ | `TaskService.next(excludedBatchIds=2)` | 5,158–6,974 ms | **0.067 ms** | **77,000x+** |
114
+ | `TaskService.claimNext()`(含写事务) | 5,157.94 ms | **0.336 ms** | **15,351x** |
115
+ | `TaskRunService.listMeta({ limit: 50 })` | 188.46 ms | **0.224 ms** | **841x** |
116
+ | `TaskService.list({ activeExecution })` | 51.70 ms | **0.076 ms** | **680x** |
117
+ | `Dashboard SSR GET /`(首页 HTML 体积) | 268.1 KB | **83.6 KB**(Sprite + 共享菜单 + 拆分 i18n) | 体积 **-68.8%** |
118
+ | `Dashboard SSR GET /runs` | 188.46 ms(634.9 KB) | **4.94 ms(105.6 KB)** | **38.2x**(体积 **-83.4%**) |
119
+ | `TaskService.dashboardOverview()`(缓存命中) | ~50 ms 冷聚合 | **~0.04 ms**(同快照事务缓存) | 热命中 **1,000x+** |
120
+ | `initDb()` 盘上库重开(`PRAGMA user_version` 快路径) | 24.70 ms | **0.429 ms** | **57.6x** |
121
+ | 入队 → OpenCode 启动延迟(`pollIntervalMs=1000`) | ~500 ms 平均 / 1,000 ms 最坏 | **33 ms**(轮询空等归零) | **~15x** 端到端 |
122
+ | CLI 入口体积(`dist/cli/index.js`)与 `--version` | 992.3 KB / 28.9 ms | **181.1 KB / 17.6 ms** | 体积 **-81.7%** / 启动 **-39%** |
102
123
 
103
124
  ## 多种使用方式
104
125
 
@@ -114,50 +135,55 @@ flowchart LR
114
135
  检查 release 批次是否正在其他项目中运行。
115
136
  ```
116
137
 
117
- 可用插件工具:
138
+ 可用插件工具(共 12 个;刻意不暴露 `start`/`done`/`fail`,且 `supertask_clone` 默认清空 `dependsOn`,需要依赖时显式传入):
118
139
 
119
140
  ```text
120
- supertask_add supertask_schedule supertask_status supertask_retry
121
- supertask_list supertask_get supertask_next supertask_upgrade
141
+ supertask_add supertask_edit supertask_clone supertask_cancel
142
+ supertask_retry supertask_logs supertask_list supertask_get
143
+ supertask_next supertask_status supertask_schedule supertask_upgrade
122
144
  ```
123
145
 
124
146
  ### 使用 CLI
125
147
 
126
148
  ```bash
127
- # 创建任务
149
+ # 创建任务(长提示词支持 --prompt-file)
128
150
  supertask add --name "安全审查" --agent build \
129
151
  --model openai/gpt-5.6-sol --variant xhigh \
130
- --prompt "检查认证与授权实现" \
152
+ --prompt-file ./prompts/security-review.md \
131
153
  --importance 5 --urgency 4 --max-retries 2 \
132
154
  --retry-backoff 30s --timeout 30min
133
155
 
134
- # 创建定时任务
156
+ # 创建、编辑与立即触发定时任务
135
157
  supertask template add --name "工作日汇报" --agent build \
136
158
  --model openai/gpt-5.6-sol --variant high \
137
159
  --prompt "汇总项目的重要变化" \
138
160
  --type cron --cron "0 9 * * 1-5"
161
+ supertask template edit --id 1 --cron "30 9 * * 1-5"
162
+ supertask template trigger --id 1
139
163
 
140
- # 查看与恢复
164
+ # 搜索、实时追日志、克隆与恢复
141
165
  supertask status
142
- supertask list --status failed --limit 20
166
+ supertask list --search "安全" --agent build --all --limit 20
167
+ supertask logs --id 42 --tail 100 --follow
168
+ supertask clone --id 42 --name "安全审查(复跑)"
143
169
  supertask retry --id 42
144
170
  supertask cancel --id 42
145
171
  ```
146
172
 
147
- 运行 `supertask --help` 或 `supertask <命令> --help` 查看完整参数。CLI 帮助和人类可读诊断支持 `auto`、`zh-CN` 和 `en`。
173
+ 交互式终端自动展示紧凑易读的摘要与表格,非 TTY 管道及显式 `--json` 在非流式命令下始终输出可解析 JSON(`supertask logs --follow` 会持续输出原始日志行)。运行 `supertask --help` 或 `supertask <命令> --help` 查看完整参数(支持 `auto`、`zh-CN` 和 `en`)。
148
174
 
149
175
  ## Web 控制台
150
176
 
151
- 响应式 Dashboard 支持中英文、深浅主题,包含四个聚焦页面:
177
+ 三段式控制中枢 Dashboard 支持中英文、深浅主题、实时 SSE 推送(`/api/events` 与 `/api/runs/:id/stream`),包含四个聚焦页面:
152
178
 
153
179
  | 页面 | 用途 |
154
180
  | --- | --- |
155
- | 任务队列 | 浏览项目、创建和编辑任务、查看优先级和运行状态、安全重试、取消或删除 |
181
+ | 任务队列 | 左侧项目栏(7 天指标、Gateway 脉搏与底部语言/主题切换)、单行顶栏搜索与正文分段状态筛选、多选批量重试/取消/删除、一键克隆与非模态右侧 Inspector 抽屉 |
156
182
  | 定时任务 | 创建和编辑 cron、延迟、循环模板;“立即运行”仍然进入统一队列 |
157
- | 执行记录 | 查看结构化输出、工具、错误、Session 和历史真实命令 |
158
- | 系统状态 | 检查生效配置、健康状态、并发,以及先备份后维护数据库 |
183
+ | 执行记录 | 轻量化 `/runs` 列表,按需拉取 `/api/runs/:id/log` 行内展开、运行中实时 SSE 流式日志、OpenCode 2.4.3 步骤/Token/费用/工具报错解析、Session 续跑与历史真实命令 |
184
+ | 系统状态 | 已保存/生效配置卡并入四组件健康度网格、并发调优,以及先备份后维护数据库 |
159
185
 
160
- 项目选择器会读取目标目录真实的 `opencode agent list` 和 `opencode models --verbose`,表单只展示本机可用模型、各模型声明的 variants 和可以直接运行的 Agent。variant 留在默认值时不会传 `--variant`,继续跟随 Agent/模型配置。
186
+ 项目选择器会读取目标目录真实的 OpenCode 能力目录(1.x:`agent list` / `models --verbose`;2.x:`api agent.list` / `api model.list` 并过滤 `enabled === false` 模型且短时缓存 30s),表单只展示本机可用模型、各模型声明的 variants 和可以直接运行的 Agent。variant 留在默认值时不会传 `--variant`,继续跟随 Agent/模型配置。
161
187
 
162
188
  ## 可靠不是一句口号
163
189
 
@@ -217,7 +243,7 @@ bun run build
217
243
 
218
244
  - 工具描述包含定时、重试、全局批次、依赖和项目作用域语义。
219
245
  - 插件工具使用 OpenCode 上下文目录,拒绝模型伪造工作目录。
220
- - 任务管理命令返回 JSON,数据库与 doctor 命令支持显式 `--json`;交互摘要保持简洁并支持中英文。
246
+ - CLI 命令在交互式终端输出简洁可读的中英文摘要,在非 TTY 管道或显式 `--json` 下保持完整 JSON 兼容。
221
247
  - `AGENTS.md` 为编码 Agent 记录架构不变量、测试规则、发布流程和禁止的危险捷径。
222
248
  - 每次执行记录真实 executable、参数、模型、variant、Agent 和工作目录,方便 AI 精确复现和诊断。
223
249
 
@@ -233,17 +259,18 @@ bun run build
233
259
 
234
260
  ```bash
235
261
  bun install --frozen-lockfile
236
- bun test
237
262
  bun run typecheck
238
263
  bun run typecheck:tests
239
264
  bun run lint
265
+ bun run build
266
+ bun test
240
267
  bun run test:coverage
241
268
  bun run test:browser
242
- bun run build
243
269
  bun run package:smoke
270
+ bun scripts/opencode-compat-smoke.ts
244
271
  ```
245
272
 
246
- CI 在 Linux 和 macOS 运行测试,用真实 Chromium 执行 Dashboard 冒烟验证,隔离安装 npm 打包产物,并在最低支持 Bun 版本运行代表性的构建产物测试。
273
+ 项目已移除 GitHub Actions CI 工作流(`.github/workflows/ci.yml`);`publish.yml` 仅在创建 GitHub Release 或手动 `workflow_dispatch` 时执行构建打包与 npm OIDC 发布。发布前需在本地或受控环境跑完上述全部验证,并在最低支持版本 Bun 1.1.45 上执行 `scripts/launcher-ipc-smoke.ts`。
247
274
 
248
275
  ## 许可证
249
276
 
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env bun
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
10
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
11
+ }) : x)(function(x) {
12
+ if (typeof require !== "undefined") return require.apply(this, arguments);
13
+ throw Error('Dynamic require of "' + x + '" is not supported');
14
+ });
15
+ var __commonJS = (cb, mod) => function __require2() {
16
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
17
+ };
18
+ var __export = (target, all) => {
19
+ for (var name in all)
20
+ __defProp(target, name, { get: all[name], enumerable: true });
21
+ };
22
+ var __copyProps = (to, from, except, desc) => {
23
+ if (from && typeof from === "object" || typeof from === "function") {
24
+ for (let key of __getOwnPropNames(from))
25
+ if (!__hasOwnProp.call(to, key) && key !== except)
26
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
27
+ }
28
+ return to;
29
+ };
30
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
31
+ // If the importer is in node compatibility mode or this is not an ESM
32
+ // file that has been converted to a CommonJS file using a Babel-
33
+ // compatible transform (i.e. "__esModule" has not been set), then set
34
+ // "default" to the CommonJS "module.exports" for node compatibility.
35
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
36
+ mod
37
+ ));
38
+
39
+ export {
40
+ __require,
41
+ __commonJS,
42
+ __export,
43
+ __toESM
44
+ };
45
+ //# sourceMappingURL=chunk-3PIYMBV3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}