opencode-supertask 0.1.38 → 0.1.39

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 CHANGED
@@ -2,6 +2,16 @@
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
+ ## [0.1.39] - 2026-07-18
6
+
7
+ ### Fixed
8
+
9
+ - `supertask upgrade` now exits without reinstalling or restarting when the CLI, effective plugin configuration, plugin cache, and ready PM2 Gateway already match npm `latest`.
10
+ - Added `supertask upgrade --force` for intentionally reinstalling the current version, refreshing the Gateway environment, and restarting PM2.
11
+ - The OpenCode `supertask_upgrade` tool now reports an up-to-date no-op instead of restarting an already converged Gateway.
12
+
13
+ [0.1.39]: https://github.com/vbgate/opencode-supertask/compare/v0.1.38...v0.1.39
14
+
5
15
  ## [0.1.38] - 2026-07-18
6
16
 
7
17
  ### Fixed
package/README.md CHANGED
@@ -32,11 +32,11 @@ 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`.
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. When the CLI, effective plugin, cache, and ready Gateway already match npm `latest`, the command exits without reinstalling or restarting; use `supertask upgrade --force` to intentionally refresh the environment and restart the current 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
36
 
37
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.
38
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.
39
+ Run `supertask install` and `supertask upgrade` from the same terminal environment in which `opencode run --agent <name>` works. An install or version-changing 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. Use `supertask upgrade --force` when the version is already current but the saved environment needs refreshing.
40
40
 
41
41
  ### Uninstall
42
42
 
@@ -131,7 +131,7 @@ supertask config # show current config
131
131
  supertask doctor [--json] # static end-to-end runtime diagnostics
132
132
  supertask doctor --smoke [--smoke-agent build] [--smoke-model provider/model]
133
133
  # queue one real Gateway/OpenCode verification task
134
- supertask upgrade # pin latest plugin version and replace Gateway
134
+ supertask upgrade [--force] # update if needed; force refreshes and restarts
135
135
 
136
136
  # Task management
137
137
  supertask add -n "Task" -a "agent" -p "prompt" --importance 5 \
@@ -295,9 +295,9 @@ supertask gateway # 前台运行:不需要 pm2
295
295
 
296
296
  插件不会自行安装全局依赖。Gateway 未运行时仍可管理队列,但不会执行排队/定时任务,也不会启动 Web 控制台。
297
297
 
298
- 升级无需卸载,执行 `supertask upgrade`。它会精确安装最新插件、替换 Gateway,并根据全局 `supertask` 的真实路径识别 npm 或 Bun 后同步 CLI;无法安全确认包管理器时会明确失败并给出精确命令。`doctor` 把 CLI、插件、Gateway 任一版本不一致视为异常。由于 0.1.33 及更早版本还不具备 CLI 自动同步能力,从这些版本升级时先用原包管理器安装一次新 CLI,再运行新版 `supertask upgrade`。
298
+ 升级无需卸载,执行 `supertask upgrade`。它会精确安装最新插件、替换 Gateway,并根据全局 `supertask` 的真实路径识别 npm 或 Bun 后同步 CLI;当 CLI、有效插件配置、缓存和就绪 Gateway 已全部匹配 npm `latest` 时直接返回,不重新安装或重启。需要在同版本下强制刷新环境时执行 `supertask upgrade --force`。无法安全确认包管理器时会明确失败并给出精确命令。`doctor` 把 CLI、插件、Gateway 任一版本不一致视为异常。由于 0.1.33 及更早版本还不具备 CLI 自动同步能力,从这些版本升级时先用原包管理器安装一次新 CLI,再运行新版 `supertask upgrade`。
299
299
 
300
- 请在手动执行 `opencode run --agent <名称>` 能工作的同一个终端环境中运行 `supertask install` 或 `supertask upgrade`。显式安装/升级会刷新 Gateway 使用的 OpenCode、XDG 与模型 Provider 执行环境,同时固定已经验证的 Bun、PM2、数据库/配置作用域,并保留完整旧环境用于失败回滚。这能避免自定义主 Agent 在终端正常、但 Gateway 仍沿用旧 Provider 凭据或旧 OpenCode 配置目录。
300
+ 请在手动执行 `opencode run --agent <名称>` 能工作的同一个终端环境中运行 `supertask install` 或 `supertask upgrade`。安装或发生版本变化的升级会刷新 Gateway 使用的 OpenCode、XDG 与模型 Provider 执行环境,同时固定已经验证的 Bun、PM2、数据库/配置作用域,并保留完整旧环境用于失败回滚。同版本下需要刷新旧 Provider 凭据或 OpenCode 配置目录时使用 `supertask upgrade --force`。
301
301
 
302
302
  ### 快速开始
303
303
 
package/dist/cli/index.js CHANGED
@@ -22220,9 +22220,11 @@ var init_semver = __esm({
22220
22220
  var update_exports = {};
22221
22221
  __export(update_exports, {
22222
22222
  getGlobalCliDiagnostic: () => getGlobalCliDiagnostic,
22223
+ getLatestVersion: () => getLatestVersion,
22223
22224
  getOpenCodePluginDiagnostic: () => getOpenCodePluginDiagnostic,
22224
22225
  installLatestPlugin: () => installLatestPlugin,
22225
22226
  installPluginVersion: () => installPluginVersion,
22227
+ isVersionConverged: () => isVersionConverged,
22226
22228
  resolveConfiguredPluginSpec: () => resolveConfiguredPluginSpec,
22227
22229
  resolveInstalledPlugin: () => resolveInstalledPlugin,
22228
22230
  resolveInstalledPluginVersion: () => resolveInstalledPluginVersion,
@@ -22242,6 +22244,9 @@ import {
22242
22244
  } from "fs";
22243
22245
  import { homedir as homedir4, tmpdir as tmpdir2 } from "os";
22244
22246
  import { dirname as dirname7, join as join5, resolve as resolve4 } from "path";
22247
+ function isVersionConverged(version2, state2) {
22248
+ return state2.packageVersion === version2 && state2.plugin.ok && state2.plugin.version === version2 && state2.plugin.cachedVersion === version2 && (!state2.cli.installed || state2.cli.version === version2) && state2.gateway.pm2Installed && state2.gateway.processFound && state2.gateway.status === "online" && state2.gateway.ready && state2.gateway.runningVersion === version2 && state2.gateway.gatewayPackageVersion === version2 && state2.gateway.scopeMatches;
22249
+ }
22245
22250
  function pluginAt(packageDir) {
22246
22251
  const packageJson = join5(packageDir, "package.json");
22247
22252
  const gatewayEntry = join5(packageDir, "dist/gateway/index.js");
@@ -22409,7 +22414,7 @@ function updateGlobalCli(version2) {
22409
22414
  }
22410
22415
  return { ...after, action: "updated" };
22411
22416
  }
22412
- function latestVersion() {
22417
+ function getLatestVersion() {
22413
22418
  const result = spawnSync3(npmBin(), [
22414
22419
  "view",
22415
22420
  PACKAGE_NAME,
@@ -22583,7 +22588,7 @@ function installPluginVersion(version2) {
22583
22588
  return resolveInstalledPluginVersion(version2);
22584
22589
  }
22585
22590
  function installLatestPlugin() {
22586
- return installPluginVersion(latestVersion());
22591
+ return installPluginVersion(getLatestVersion());
22587
22592
  }
22588
22593
  var PACKAGE_NAME;
22589
22594
  var init_update2 = __esm({
@@ -29732,25 +29737,43 @@ program2.command("uninstall").description(t2("\u505C\u6B62\u5E76\u79FB\u9664 PM2
29732
29737
  process.exit(1);
29733
29738
  }
29734
29739
  });
29735
- program2.command("upgrade").description(t2("\u66F4\u65B0 OpenCode \u63D2\u4EF6\u7F13\u5B58\u5E76\u91CD\u542F Gateway", "update the OpenCode plugin cache and restart the Gateway")).action(async () => {
29736
- console.log(t2("\u6B63\u5728\u66F4\u65B0 opencode-supertask...", "Updating opencode-supertask..."));
29740
+ program2.command("upgrade").description(t2("\u66F4\u65B0 OpenCode \u63D2\u4EF6\u3001CLI \u548C Gateway\uFF1B\u5DF2\u662F\u6700\u65B0\u7248\u672C\u65F6\u4E0D\u91CD\u542F", "update the OpenCode plugin, CLI, and Gateway without restarting when already current")).option("--force", t2("\u5373\u4F7F\u5DF2\u662F\u6700\u65B0\u7248\u672C\u4E5F\u91CD\u65B0\u5B89\u88C5\u5E76\u91CD\u542F Gateway", "reinstall and restart the Gateway even when already current")).action(async (options) => {
29741
+ console.log(t2("\u6B63\u5728\u68C0\u67E5 opencode-supertask \u66F4\u65B0...", "Checking for opencode-supertask updates..."));
29737
29742
  let installed;
29738
29743
  let previousVersion;
29744
+ let targetVersion;
29745
+ let updater;
29739
29746
  try {
29740
- const { resolveInstalledPlugin: resolveInstalledPlugin2 } = await Promise.resolve().then(() => (init_update2(), update_exports));
29741
- previousVersion = resolveInstalledPlugin2().version;
29747
+ updater = await Promise.resolve().then(() => (init_update2(), update_exports));
29748
+ const { getGatewayDiagnostic: getGatewayDiagnostic2 } = await Promise.resolve().then(() => (init_pm2(), pm2_exports));
29749
+ targetVersion = updater.getLatestVersion();
29750
+ const plugin = updater.getOpenCodePluginDiagnostic();
29751
+ const cli = updater.getGlobalCliDiagnostic();
29752
+ const gateway = getGatewayDiagnostic2();
29753
+ if (!options.force && updater.isVersionConverged(targetVersion, {
29754
+ packageVersion: getPackageVersion(),
29755
+ plugin,
29756
+ cli,
29757
+ gateway
29758
+ })) {
29759
+ console.log(t2(
29760
+ `SuperTask \u5DF2\u662F\u6700\u65B0\u7248\u672C v${targetVersion}\uFF0C\u65E0\u9700\u5347\u7EA7\uFF1BGateway \u672A\u91CD\u542F\u3002`,
29761
+ `SuperTask is already up to date at v${targetVersion}; the Gateway was not restarted.`
29762
+ ));
29763
+ return;
29764
+ }
29765
+ previousVersion = plugin.version ?? updater.resolveInstalledPlugin().version;
29742
29766
  } catch (error) {
29743
- console.error(t2("\u65E0\u6CD5\u786E\u8BA4\u5F53\u524D OpenCode \u63D2\u4EF6\u7248\u672C\uFF0C\u5DF2\u53D6\u6D88\u5347\u7EA7\uFF1A", "Could not determine the current OpenCode plugin version; upgrade cancelled: ") + (error instanceof Error ? error.message : String(error)));
29767
+ console.error(t2("\u65E0\u6CD5\u68C0\u67E5\u5F53\u524D\u7248\u672C\uFF0C\u5DF2\u53D6\u6D88\u5347\u7EA7\uFF1A", "Could not check the current version; upgrade cancelled: ") + (error instanceof Error ? error.message : String(error)));
29744
29768
  process.exit(1);
29745
29769
  }
29770
+ console.log(t2("\u6B63\u5728\u66F4\u65B0 opencode-supertask...", "Updating opencode-supertask..."));
29746
29771
  try {
29747
- const { installLatestPlugin: installLatestPlugin2 } = await Promise.resolve().then(() => (init_update2(), update_exports));
29748
- installed = installLatestPlugin2();
29772
+ installed = updater.installPluginVersion(targetVersion);
29749
29773
  } catch (err) {
29750
29774
  let detail = err instanceof Error ? err.message : String(err);
29751
29775
  try {
29752
- const { installPluginVersion: installPluginVersion2 } = await Promise.resolve().then(() => (init_update2(), update_exports));
29753
- installPluginVersion2(previousVersion);
29776
+ updater.installPluginVersion(previousVersion);
29754
29777
  } catch (rollbackError) {
29755
29778
  detail += `; OpenCode \u63D2\u4EF6\u56DE\u6EDA\u5931\u8D25: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`;
29756
29779
  }
@@ -29794,8 +29817,7 @@ SuperTask upgraded: ${result.before ?? "unknown"} \u2192 ${result.after}`
29794
29817
  let detail = err instanceof Error ? err.message : String(err);
29795
29818
  try {
29796
29819
  if (previousVersion !== installed.version) {
29797
- const { installPluginVersion: installPluginVersion2 } = await Promise.resolve().then(() => (init_update2(), update_exports));
29798
- installPluginVersion2(previousVersion);
29820
+ updater.installPluginVersion(previousVersion);
29799
29821
  }
29800
29822
  } catch (rollbackError) {
29801
29823
  detail += `; Gateway \u5DF2\u56DE\u6EDA\uFF0C\u4F46 OpenCode \u63D2\u4EF6\u56DE\u6EDA\u5931\u8D25: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`;