opencode-supertask 0.1.2 → 0.1.3
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 +12 -7
- package/dist/cli/index.js.map +1 -1
- package/dist/gateway/index.js +0 -1
- package/dist/gateway/index.js.map +1 -1
- package/dist/plugin/supertask.js +16 -2
- package/dist/plugin/supertask.js.map +1 -1
- package/dist/web/index.js +0 -1
- package/dist/web/index.js.map +1 -1
- package/dist/worker/index.js +0 -1
- package/dist/worker/index.js.map +1 -1
- package/package.json +1 -1
package/dist/plugin/supertask.js
CHANGED
|
@@ -26817,7 +26817,6 @@ function getMigrationsFolder() {
|
|
|
26817
26817
|
}
|
|
26818
26818
|
function initDb() {
|
|
26819
26819
|
const dataDir = dirname(DB_FILE_PATH);
|
|
26820
|
-
const dbExisted = existsSync(DB_FILE_PATH);
|
|
26821
26820
|
if (!existsSync(dataDir)) {
|
|
26822
26821
|
mkdirSync(dataDir, { recursive: true });
|
|
26823
26822
|
}
|
|
@@ -27243,6 +27242,14 @@ function pm2JsonList() {
|
|
|
27243
27242
|
return [];
|
|
27244
27243
|
}
|
|
27245
27244
|
}
|
|
27245
|
+
function findBunPath() {
|
|
27246
|
+
try {
|
|
27247
|
+
const cmd = process.platform === "win32" ? "where bun" : "which bun";
|
|
27248
|
+
return execSync(cmd, { stdio: "pipe" }).toString().trim().split("\n")[0];
|
|
27249
|
+
} catch {
|
|
27250
|
+
return process.execPath;
|
|
27251
|
+
}
|
|
27252
|
+
}
|
|
27246
27253
|
function ensureGateway() {
|
|
27247
27254
|
try {
|
|
27248
27255
|
const list2 = pm2JsonList();
|
|
@@ -27268,7 +27275,7 @@ function ensureGateway() {
|
|
|
27268
27275
|
if (existing) {
|
|
27269
27276
|
pm2Exec(["restart", PROCESS_NAME]);
|
|
27270
27277
|
} else {
|
|
27271
|
-
const bunPath =
|
|
27278
|
+
const bunPath = findBunPath();
|
|
27272
27279
|
pm2Exec([
|
|
27273
27280
|
"start",
|
|
27274
27281
|
GATEWAY_ENTRY,
|
|
@@ -27296,6 +27303,13 @@ function ensureInit() {
|
|
|
27296
27303
|
console.error("[supertask] DB init failed:", err instanceof Error ? err.message : String(err));
|
|
27297
27304
|
return;
|
|
27298
27305
|
}
|
|
27306
|
+
try {
|
|
27307
|
+
const lockRow = sqlite.prepare("SELECT pid, heartbeat_at FROM gateway_lock WHERE id = 1").get();
|
|
27308
|
+
if (lockRow && Date.now() - lockRow.heartbeat_at < 3e4) {
|
|
27309
|
+
return;
|
|
27310
|
+
}
|
|
27311
|
+
} catch {
|
|
27312
|
+
}
|
|
27299
27313
|
try {
|
|
27300
27314
|
ensureGateway();
|
|
27301
27315
|
} catch {
|