opencode-supertask 0.1.7 → 0.1.9
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 +23 -49
- package/dist/cli/index.js.map +1 -1
- package/dist/gateway/index.js +2 -0
- package/dist/gateway/index.js.map +1 -1
- package/dist/plugin/supertask.js +25 -36
- package/dist/plugin/supertask.js.map +1 -1
- package/dist/web/index.js +2 -0
- package/dist/web/index.js.map +1 -1
- package/dist/worker/index.js +2 -0
- package/dist/worker/index.js.map +1 -1
- package/drizzle/0004_tiny_the_watchers.sql +30 -0
- package/drizzle/meta/0004_snapshot.json +479 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -9317,6 +9317,8 @@ var init_schema = __esm({
|
|
|
9317
9317
|
// 任务分组与依赖
|
|
9318
9318
|
batchId: text("batch_id"),
|
|
9319
9319
|
dependsOn: integer("depends_on"),
|
|
9320
|
+
// OpenCode Session
|
|
9321
|
+
sessionId: text("session_id"),
|
|
9320
9322
|
// 状态
|
|
9321
9323
|
status: text("status").default("pending"),
|
|
9322
9324
|
// 时间戳(老字段保持秒级 timestamp)
|
|
@@ -22832,6 +22834,23 @@ function findBunPath() {
|
|
|
22832
22834
|
return process.execPath;
|
|
22833
22835
|
}
|
|
22834
22836
|
}
|
|
22837
|
+
function pm2StartGateway(version2) {
|
|
22838
|
+
const bunPath = findBunPath();
|
|
22839
|
+
return pm2Exec([
|
|
22840
|
+
"start",
|
|
22841
|
+
bunPath,
|
|
22842
|
+
"--name",
|
|
22843
|
+
PROCESS_NAME,
|
|
22844
|
+
"--interpreter",
|
|
22845
|
+
"none",
|
|
22846
|
+
"--restart-delay",
|
|
22847
|
+
"5000",
|
|
22848
|
+
"--max-restarts",
|
|
22849
|
+
"30",
|
|
22850
|
+
"--",
|
|
22851
|
+
GATEWAY_ENTRY
|
|
22852
|
+
]);
|
|
22853
|
+
}
|
|
22835
22854
|
function install() {
|
|
22836
22855
|
if (!isPm2Installed()) {
|
|
22837
22856
|
if (!installPm2()) {
|
|
@@ -22850,22 +22869,8 @@ function install() {
|
|
|
22850
22869
|
}
|
|
22851
22870
|
} else {
|
|
22852
22871
|
console.log("[supertask] Starting Gateway with pm2...");
|
|
22853
|
-
const bunPath = findBunPath();
|
|
22854
22872
|
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
|
-
]);
|
|
22873
|
+
const { ok, output } = pm2StartGateway(version2);
|
|
22869
22874
|
if (!ok) {
|
|
22870
22875
|
throw new Error(`[supertask] pm2 start failed: ${output}`);
|
|
22871
22876
|
}
|
|
@@ -22910,25 +22915,8 @@ function ensureGateway() {
|
|
|
22910
22915
|
return;
|
|
22911
22916
|
}
|
|
22912
22917
|
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
|
-
]);
|
|
22918
|
+
pm2Exec(["delete", PROCESS_NAME]);
|
|
22919
|
+
pm2StartGateway(currentVersion);
|
|
22932
22920
|
pm2Exec(["save"]);
|
|
22933
22921
|
return;
|
|
22934
22922
|
}
|
|
@@ -22952,22 +22940,8 @@ function ensureGateway() {
|
|
|
22952
22940
|
if (existing) {
|
|
22953
22941
|
pm2Exec(["restart", PROCESS_NAME]);
|
|
22954
22942
|
} else {
|
|
22955
|
-
const bunPath = findBunPath();
|
|
22956
22943
|
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
|
-
]);
|
|
22944
|
+
pm2StartGateway(version2);
|
|
22971
22945
|
}
|
|
22972
22946
|
pm2Exec(["save"]);
|
|
22973
22947
|
}
|