opencode-supertask 0.1.21 → 0.1.22

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/web/index.js CHANGED
@@ -16840,6 +16840,23 @@ var TaskService = class {
16840
16840
  ).returning();
16841
16841
  return result.length;
16842
16842
  }
16843
+ static async resetOrphanRunningToPending() {
16844
+ const result = await db.update(tasks2).set({
16845
+ status: "pending",
16846
+ startedAt: null,
16847
+ finishedAt: null
16848
+ }).where(
16849
+ and(
16850
+ eq(tasks2.status, "running"),
16851
+ sql`NOT EXISTS (
16852
+ SELECT 1 FROM ${taskRuns2}
16853
+ WHERE ${taskRuns2.taskId} = ${tasks2.id}
16854
+ AND ${taskRuns2.status} = 'running'
16855
+ )`
16856
+ )
16857
+ ).returning();
16858
+ return result.length;
16859
+ }
16843
16860
  static async cancel(id, scope = {}) {
16844
16861
  const conditions = [
16845
16862
  eq(tasks2.id, id),