opencode-supertask 0.1.15 → 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.
@@ -6309,9 +6309,10 @@ var init_task_service = __esm({
6309
6309
  const hasExcludedBatches = scope.excludedBatchIds && scope.excludedBatchIds.length > 0;
6310
6310
  let batchFilter;
6311
6311
  if (hasExcludedBatches) {
6312
- const conditions2 = [];
6313
- conditions2.push(sql`${tasks2.batchId} NOT IN ${scope.excludedBatchIds}`);
6314
- batchFilter = and(...conditions2);
6312
+ batchFilter = or(
6313
+ isNull(tasks2.batchId),
6314
+ sql`${tasks2.batchId} NOT IN ${scope.excludedBatchIds}`
6315
+ );
6315
6316
  }
6316
6317
  const statusConditions = or(
6317
6318
  and(
@@ -6476,7 +6477,7 @@ var init_task_service = __esm({
6476
6477
  if (conditions.length > 0) {
6477
6478
  query = query.where(and(...conditions));
6478
6479
  }
6479
- query = query.orderBy(desc(tasks2.createdAt));
6480
+ query = query.orderBy(desc(tasks2.createdAt), desc(tasks2.id));
6480
6481
  if (options.limit) {
6481
6482
  query = query.limit(options.limit);
6482
6483
  }
@@ -6586,10 +6587,10 @@ var init_task_run_service = __esm({
6586
6587
  return result[0] || null;
6587
6588
  }
6588
6589
  static async listByTaskId(taskId) {
6589
- return await db.select().from(taskRuns2).where(eq(taskRuns2.taskId, taskId)).orderBy(desc(taskRuns2.startedAt));
6590
+ return await db.select().from(taskRuns2).where(eq(taskRuns2.taskId, taskId)).orderBy(desc(taskRuns2.startedAt), desc(taskRuns2.id));
6590
6591
  }
6591
6592
  static async getLatestByTaskId(taskId) {
6592
- const result = await db.select().from(taskRuns2).where(eq(taskRuns2.taskId, taskId)).orderBy(desc(taskRuns2.startedAt)).limit(1);
6593
+ const result = await db.select().from(taskRuns2).where(eq(taskRuns2.taskId, taskId)).orderBy(desc(taskRuns2.startedAt), desc(taskRuns2.id)).limit(1);
6593
6594
  return result[0] || null;
6594
6595
  }
6595
6596
  static async getLatestByTaskIds(taskIds) {
@@ -6637,7 +6638,7 @@ var init_task_run_service = __esm({
6637
6638
  }));
6638
6639
  }
6639
6640
  static async getRunningRunByTaskId(taskId) {
6640
- const result = await db.select().from(taskRuns2).where(and(eq(taskRuns2.taskId, taskId), eq(taskRuns2.status, "running"))).orderBy(desc(taskRuns2.startedAt)).limit(1);
6641
+ 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);
6641
6642
  return result[0] || null;
6642
6643
  }
6643
6644
  static async deleteByTaskIds(taskIds) {