opencode-supertask 0.1.16 → 0.1.17

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.
@@ -5280,9 +5280,10 @@ var TaskService = class {
5280
5280
  const hasExcludedBatches = scope.excludedBatchIds && scope.excludedBatchIds.length > 0;
5281
5281
  let batchFilter;
5282
5282
  if (hasExcludedBatches) {
5283
- const conditions2 = [];
5284
- conditions2.push(sql`${tasks2.batchId} NOT IN ${scope.excludedBatchIds}`);
5285
- batchFilter = and(...conditions2);
5283
+ batchFilter = or(
5284
+ isNull(tasks2.batchId),
5285
+ sql`${tasks2.batchId} NOT IN ${scope.excludedBatchIds}`
5286
+ );
5286
5287
  }
5287
5288
  const statusConditions = or(
5288
5289
  and(
@@ -5447,7 +5448,7 @@ var TaskService = class {
5447
5448
  if (conditions.length > 0) {
5448
5449
  query = query.where(and(...conditions));
5449
5450
  }
5450
- query = query.orderBy(desc(tasks2.createdAt));
5451
+ query = query.orderBy(desc(tasks2.createdAt), desc(tasks2.id));
5451
5452
  if (options.limit) {
5452
5453
  query = query.limit(options.limit);
5453
5454
  }
@@ -5549,10 +5550,10 @@ var TaskRunService = class {
5549
5550
  return result[0] || null;
5550
5551
  }
5551
5552
  static async listByTaskId(taskId) {
5552
- return await db.select().from(taskRuns2).where(eq(taskRuns2.taskId, taskId)).orderBy(desc(taskRuns2.startedAt));
5553
+ return await db.select().from(taskRuns2).where(eq(taskRuns2.taskId, taskId)).orderBy(desc(taskRuns2.startedAt), desc(taskRuns2.id));
5553
5554
  }
5554
5555
  static async getLatestByTaskId(taskId) {
5555
- const result = await db.select().from(taskRuns2).where(eq(taskRuns2.taskId, taskId)).orderBy(desc(taskRuns2.startedAt)).limit(1);
5556
+ const result = await db.select().from(taskRuns2).where(eq(taskRuns2.taskId, taskId)).orderBy(desc(taskRuns2.startedAt), desc(taskRuns2.id)).limit(1);
5556
5557
  return result[0] || null;
5557
5558
  }
5558
5559
  static async getLatestByTaskIds(taskIds) {
@@ -5600,7 +5601,7 @@ var TaskRunService = class {
5600
5601
  }));
5601
5602
  }
5602
5603
  static async getRunningRunByTaskId(taskId) {
5603
- const result = await db.select().from(taskRuns2).where(and(eq(taskRuns2.taskId, taskId), eq(taskRuns2.status, "running"))).orderBy(desc(taskRuns2.startedAt)).limit(1);
5604
+ const result = await db.select().from(taskRuns2).where(and(eq(taskRuns2.taskId, taskId), eq(taskRuns2.status, "running"))).orderBy(desc(taskRuns2.startedAt), desc(taskRuns2.id)).limit(1);
5604
5605
  return result[0] || null;
5605
5606
  }
5606
5607
  static async deleteByTaskIds(taskIds) {