opencode-supertask 0.1.34 → 0.1.36
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 +30 -0
- package/README.md +16 -9
- package/dist/cli/index.js +854 -78
- package/dist/cli/index.js.map +1 -1
- package/dist/gateway/index.js +684 -57
- package/dist/gateway/index.js.map +1 -1
- package/dist/plugin/supertask.js +30 -0
- package/dist/plugin/supertask.js.map +1 -1
- package/dist/web/index.d.ts +19 -1
- package/dist/web/index.js +695 -89
- package/dist/web/index.js.map +1 -1
- package/dist/worker/index.d.ts +3 -1
- package/dist/worker/index.js +18 -3
- package/dist/worker/index.js.map +1 -1
- package/package.json +1 -1
package/dist/plugin/supertask.js
CHANGED
|
@@ -28400,6 +28400,34 @@ function scopesMatch(left, right) {
|
|
|
28400
28400
|
function currentScope() {
|
|
28401
28401
|
return runtimeScope({ cwd: process.cwd(), env: process.env });
|
|
28402
28402
|
}
|
|
28403
|
+
function diagnoseOpenCodeRuntime(runtime = {
|
|
28404
|
+
cwd: process.cwd(),
|
|
28405
|
+
env: process.env
|
|
28406
|
+
}) {
|
|
28407
|
+
const executable = runtimeScope(runtime).opencodePath;
|
|
28408
|
+
const result = spawnSync(executable, ["--version"], {
|
|
28409
|
+
cwd: runtime.cwd,
|
|
28410
|
+
env: runtime.env,
|
|
28411
|
+
encoding: "utf8",
|
|
28412
|
+
timeout: 1e4,
|
|
28413
|
+
killSignal: "SIGKILL"
|
|
28414
|
+
});
|
|
28415
|
+
const ok = result.status === 0 && result.error === void 0;
|
|
28416
|
+
return {
|
|
28417
|
+
ok,
|
|
28418
|
+
executable,
|
|
28419
|
+
version: ok ? result.stdout.trim() || result.stderr.trim() || null : null,
|
|
28420
|
+
error: ok ? null : result.error?.message || result.stderr.trim() || result.stdout.trim() || `exit code ${result.status}`
|
|
28421
|
+
};
|
|
28422
|
+
}
|
|
28423
|
+
function assertOpenCodeRuntime(runtime) {
|
|
28424
|
+
const diagnostic = diagnoseOpenCodeRuntime(runtime);
|
|
28425
|
+
if (!diagnostic.ok) {
|
|
28426
|
+
throw new Error(
|
|
28427
|
+
`[supertask] \u76EE\u6807 Gateway \u73AF\u5883\u65E0\u6CD5\u6267\u884C OpenCode (${diagnostic.executable}): ${diagnostic.error}`
|
|
28428
|
+
);
|
|
28429
|
+
}
|
|
28430
|
+
}
|
|
28403
28431
|
function writeRunningVersion(version3, env = process.env, cwd = process.cwd()) {
|
|
28404
28432
|
const path = versionFile(env, cwd);
|
|
28405
28433
|
mkdirSync3(dirname4(path), { recursive: true });
|
|
@@ -28856,6 +28884,7 @@ function upgradeUnlocked(target) {
|
|
|
28856
28884
|
assertRuntimeCanControlPm2(oldRuntime, existing);
|
|
28857
28885
|
gatewayKillTimeoutMs(targetRuntime);
|
|
28858
28886
|
gatewayTerminationCommandTimeoutMs(targetRuntime);
|
|
28887
|
+
assertOpenCodeRuntime(targetRuntime);
|
|
28859
28888
|
if (existing) requirePm2Termination("delete", "pm2 delete old Gateway", oldRuntime);
|
|
28860
28889
|
try {
|
|
28861
28890
|
pm2StartGateway(targetRuntime);
|
|
@@ -28908,6 +28937,7 @@ function ensureGatewayUnlocked() {
|
|
|
28908
28937
|
const before = getRunningVersion(oldRuntime?.env ?? process.env, oldRuntime?.cwd);
|
|
28909
28938
|
gatewayKillTimeoutMs(targetRuntime);
|
|
28910
28939
|
gatewayTerminationCommandTimeoutMs(targetRuntime);
|
|
28940
|
+
assertOpenCodeRuntime(targetRuntime);
|
|
28911
28941
|
if (existing) requirePm2Termination("delete", "pm2 delete stale Gateway", oldRuntime);
|
|
28912
28942
|
try {
|
|
28913
28943
|
pm2StartGateway(targetRuntime);
|