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.
@@ -26739,6 +26739,8 @@ var tasks = sqliteTable("tasks", {
26739
26739
  // 任务分组与依赖
26740
26740
  batchId: text("batch_id"),
26741
26741
  dependsOn: integer2("depends_on"),
26742
+ // OpenCode Session
26743
+ sessionId: text("session_id"),
26742
26744
  // 状态
26743
26745
  status: text("status").default("pending"),
26744
26746
  // 时间戳(老字段保持秒级 timestamp)
@@ -27289,6 +27291,23 @@ function findBunPath() {
27289
27291
  return process.execPath;
27290
27292
  }
27291
27293
  }
27294
+ function pm2StartGateway(version3) {
27295
+ const bunPath = findBunPath();
27296
+ return pm2Exec([
27297
+ "start",
27298
+ bunPath,
27299
+ "--name",
27300
+ PROCESS_NAME,
27301
+ "--interpreter",
27302
+ "none",
27303
+ "--restart-delay",
27304
+ "5000",
27305
+ "--max-restarts",
27306
+ "30",
27307
+ "--",
27308
+ GATEWAY_ENTRY
27309
+ ]);
27310
+ }
27292
27311
  function ensureGateway() {
27293
27312
  const currentVersion = getPackageVersion();
27294
27313
  try {
@@ -27301,25 +27320,8 @@ function ensureGateway() {
27301
27320
  return;
27302
27321
  }
27303
27322
  console.log(`[supertask] Version changed: ${envVersion ?? "unknown"} \u2192 ${currentVersion}, reloading Gateway...`);
27304
- const bunPath = findBunPath();
27305
- pm2Exec([
27306
- "delete",
27307
- PROCESS_NAME
27308
- ]);
27309
- pm2Exec([
27310
- "start",
27311
- GATEWAY_ENTRY,
27312
- "--name",
27313
- PROCESS_NAME,
27314
- "--interpreter",
27315
- bunPath,
27316
- "--restart-delay",
27317
- "5000",
27318
- "--max-restarts",
27319
- "30",
27320
- "--env",
27321
- `SUPERTASK_VERSION=${currentVersion}`
27322
- ]);
27323
+ pm2Exec(["delete", PROCESS_NAME]);
27324
+ pm2StartGateway(currentVersion);
27323
27325
  pm2Exec(["save"]);
27324
27326
  return;
27325
27327
  }
@@ -27343,22 +27345,8 @@ function ensureGateway() {
27343
27345
  if (existing) {
27344
27346
  pm2Exec(["restart", PROCESS_NAME]);
27345
27347
  } else {
27346
- const bunPath = findBunPath();
27347
27348
  const version3 = getPackageVersion();
27348
- pm2Exec([
27349
- "start",
27350
- GATEWAY_ENTRY,
27351
- "--name",
27352
- PROCESS_NAME,
27353
- "--interpreter",
27354
- bunPath,
27355
- "--restart-delay",
27356
- "5000",
27357
- "--max-restarts",
27358
- "30",
27359
- "--env",
27360
- `SUPERTASK_VERSION=${version3}`
27361
- ]);
27349
+ pm2StartGateway(version3);
27362
27350
  }
27363
27351
  pm2Exec(["save"]);
27364
27352
  }
@@ -27495,7 +27483,7 @@ var SuperTaskPlugin = async () => {
27495
27483
  "(\u5DF2\u5E9F\u5F03) \u5DE5\u4F5C\u76EE\u5F55\u3002\u7CFB\u7EDF\u4F1A\u81EA\u52A8\u8BB0\u5F55\u63D0\u4EA4\u4EFB\u52A1\u65F6\u7684 opencode run \u542F\u52A8\u76EE\u5F55\u3002"
27496
27484
  )
27497
27485
  },
27498
- async execute(args) {
27486
+ async execute(args, ctx) {
27499
27487
  try {
27500
27488
  const submitCwd = process.cwd();
27501
27489
  const task = await TaskService.add({
@@ -27508,7 +27496,8 @@ var SuperTaskPlugin = async () => {
27508
27496
  urgency: args.urgency ?? 3,
27509
27497
  batchId: args.batchId,
27510
27498
  dependsOn: args.dependsOn,
27511
- cwd: submitCwd
27499
+ cwd: submitCwd,
27500
+ sessionId: ctx.sessionID
27512
27501
  });
27513
27502
  return JSON.stringify({ id: task.id, status: "created" });
27514
27503
  } catch (error45) {