opencode-supertask 0.1.21 → 0.1.23

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.
@@ -5504,6 +5504,23 @@ var TaskService = class {
5504
5504
  ).returning();
5505
5505
  return result.length;
5506
5506
  }
5507
+ static async resetOrphanRunningToPending() {
5508
+ const result = await db.update(tasks2).set({
5509
+ status: "pending",
5510
+ startedAt: null,
5511
+ finishedAt: null
5512
+ }).where(
5513
+ and(
5514
+ eq(tasks2.status, "running"),
5515
+ sql`NOT EXISTS (
5516
+ SELECT 1 FROM ${taskRuns2}
5517
+ WHERE ${taskRuns2.taskId} = ${tasks2.id}
5518
+ AND ${taskRuns2.status} = 'running'
5519
+ )`
5520
+ )
5521
+ ).returning();
5522
+ return result.length;
5523
+ }
5507
5524
  static async cancel(id, scope = {}) {
5508
5525
  const conditions = [
5509
5526
  eq(tasks2.id, id),