Refine routines editor flow

Align the routines list and detail editors with the issue-composer interaction model, and fix the scheduler's typed date comparison.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
dotta
2026-03-19 11:36:01 -05:00
parent 8f5196f7d6
commit 500d926da7
3 changed files with 654 additions and 292 deletions

View File

@@ -1,5 +1,5 @@
import crypto from "node:crypto";
import { and, asc, desc, eq, inArray, isNull, ne, or, sql } from "drizzle-orm";
import { and, asc, desc, eq, inArray, isNotNull, isNull, lte, ne, or } from "drizzle-orm";
import type { Db } from "@paperclipai/db";
import {
agents,
@@ -1030,8 +1030,8 @@ export function routineService(db: Db) {
eq(routineTriggers.kind, "schedule"),
eq(routineTriggers.enabled, true),
eq(routines.status, "active"),
sql`${routineTriggers.nextRunAt} is not null`,
sql`${routineTriggers.nextRunAt} <= ${now}`,
isNotNull(routineTriggers.nextRunAt),
lte(routineTriggers.nextRunAt, now),
),
)
.orderBy(asc(routineTriggers.nextRunAt), asc(routineTriggers.createdAt));