opencode-supertask 0.1.7 → 0.1.8
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/dist/cli/index.js +21 -49
- package/dist/cli/index.js.map +1 -1
- package/dist/plugin/supertask.js +20 -34
- package/dist/plugin/supertask.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -22832,6 +22832,23 @@ function findBunPath() {
|
|
|
22832
22832
|
return process.execPath;
|
|
22833
22833
|
}
|
|
22834
22834
|
}
|
|
22835
|
+
function pm2StartGateway(version2) {
|
|
22836
|
+
const bunPath = findBunPath();
|
|
22837
|
+
return pm2Exec([
|
|
22838
|
+
"start",
|
|
22839
|
+
bunPath,
|
|
22840
|
+
"--name",
|
|
22841
|
+
PROCESS_NAME,
|
|
22842
|
+
"--interpreter",
|
|
22843
|
+
"none",
|
|
22844
|
+
"--restart-delay",
|
|
22845
|
+
"5000",
|
|
22846
|
+
"--max-restarts",
|
|
22847
|
+
"30",
|
|
22848
|
+
"--",
|
|
22849
|
+
GATEWAY_ENTRY
|
|
22850
|
+
]);
|
|
22851
|
+
}
|
|
22835
22852
|
function install() {
|
|
22836
22853
|
if (!isPm2Installed()) {
|
|
22837
22854
|
if (!installPm2()) {
|
|
@@ -22850,22 +22867,8 @@ function install() {
|
|
|
22850
22867
|
}
|
|
22851
22868
|
} else {
|
|
22852
22869
|
console.log("[supertask] Starting Gateway with pm2...");
|
|
22853
|
-
const bunPath = findBunPath();
|
|
22854
22870
|
const version2 = getPackageVersion();
|
|
22855
|
-
const { ok, output } =
|
|
22856
|
-
"start",
|
|
22857
|
-
GATEWAY_ENTRY,
|
|
22858
|
-
"--name",
|
|
22859
|
-
PROCESS_NAME,
|
|
22860
|
-
"--interpreter",
|
|
22861
|
-
bunPath,
|
|
22862
|
-
"--restart-delay",
|
|
22863
|
-
"5000",
|
|
22864
|
-
"--max-restarts",
|
|
22865
|
-
"30",
|
|
22866
|
-
"--env",
|
|
22867
|
-
`SUPERTASK_VERSION=${version2}`
|
|
22868
|
-
]);
|
|
22871
|
+
const { ok, output } = pm2StartGateway(version2);
|
|
22869
22872
|
if (!ok) {
|
|
22870
22873
|
throw new Error(`[supertask] pm2 start failed: ${output}`);
|
|
22871
22874
|
}
|
|
@@ -22910,25 +22913,8 @@ function ensureGateway() {
|
|
|
22910
22913
|
return;
|
|
22911
22914
|
}
|
|
22912
22915
|
console.log(`[supertask] Version changed: ${envVersion ?? "unknown"} \u2192 ${currentVersion}, reloading Gateway...`);
|
|
22913
|
-
|
|
22914
|
-
|
|
22915
|
-
"delete",
|
|
22916
|
-
PROCESS_NAME
|
|
22917
|
-
]);
|
|
22918
|
-
pm2Exec([
|
|
22919
|
-
"start",
|
|
22920
|
-
GATEWAY_ENTRY,
|
|
22921
|
-
"--name",
|
|
22922
|
-
PROCESS_NAME,
|
|
22923
|
-
"--interpreter",
|
|
22924
|
-
bunPath,
|
|
22925
|
-
"--restart-delay",
|
|
22926
|
-
"5000",
|
|
22927
|
-
"--max-restarts",
|
|
22928
|
-
"30",
|
|
22929
|
-
"--env",
|
|
22930
|
-
`SUPERTASK_VERSION=${currentVersion}`
|
|
22931
|
-
]);
|
|
22916
|
+
pm2Exec(["delete", PROCESS_NAME]);
|
|
22917
|
+
pm2StartGateway(currentVersion);
|
|
22932
22918
|
pm2Exec(["save"]);
|
|
22933
22919
|
return;
|
|
22934
22920
|
}
|
|
@@ -22952,22 +22938,8 @@ function ensureGateway() {
|
|
|
22952
22938
|
if (existing) {
|
|
22953
22939
|
pm2Exec(["restart", PROCESS_NAME]);
|
|
22954
22940
|
} else {
|
|
22955
|
-
const bunPath = findBunPath();
|
|
22956
22941
|
const version2 = getPackageVersion();
|
|
22957
|
-
|
|
22958
|
-
"start",
|
|
22959
|
-
GATEWAY_ENTRY,
|
|
22960
|
-
"--name",
|
|
22961
|
-
PROCESS_NAME,
|
|
22962
|
-
"--interpreter",
|
|
22963
|
-
bunPath,
|
|
22964
|
-
"--restart-delay",
|
|
22965
|
-
"5000",
|
|
22966
|
-
"--max-restarts",
|
|
22967
|
-
"30",
|
|
22968
|
-
"--env",
|
|
22969
|
-
`SUPERTASK_VERSION=${version2}`
|
|
22970
|
-
]);
|
|
22942
|
+
pm2StartGateway(version2);
|
|
22971
22943
|
}
|
|
22972
22944
|
pm2Exec(["save"]);
|
|
22973
22945
|
}
|