Fork dsh-cron-tasks as dsh-ops-cron with DSH/IM delivery.

Agent cron_* jobs default to IM when created from a WhatsApp session with a matching delivery target; otherwise DSH sidebar sessions. Fire path soft-calls ctx.dshIm.send for summaries.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-05 21:48:17 +08:00
parent 4447404361
commit 2f08136adf
17 changed files with 472 additions and 285 deletions

View file

@ -8,6 +8,7 @@ import { dirname, join } from 'node:path'
import { randomUUID } from 'node:crypto'
import { applyRunIsolation, recordHiddenSession } from './isolation.js'
import { nextFire, validateSchedule } from './scheduler.js'
import { normalizeDelivery } from './delivery.js'
export const STORE_VERSION = 1
@ -92,6 +93,7 @@ export function createJobRecord(input, state, now) {
const schedule = validateSchedule(input.schedule, settings.timezone)
const timeoutMinutes = Number(input.timeoutMinutes)
const model = normalizeJobModel(input)
const delivery = normalizeDelivery(input.delivery)
const job = {
id: String(input.id || newId()),
name,
@ -104,6 +106,7 @@ export function createJobRecord(input, state, now) {
provider: model.provider,
model: model.model,
reasoningEffort: model.reasoningEffort,
delivery,
schedule: schedule.kind === 'cron'
? { kind: 'cron', expr: schedule.expr, timezone: schedule.timezone }
: { kind: 'at', at: new Date(schedule.at).toISOString(), timezone: schedule.timezone },
@ -253,5 +256,5 @@ function hydrate(parsed) {
}
export function storePath(dshHome) {
return join(dshHome, 'cron-tasks', 'store.json')
return join(dshHome, 'ops-cron', 'store.json')
}