feat(schedule): add durable after reminders

This commit is contained in:
pku-xht
2026-08-06 03:47:37 +08:00
committed by Tianyi Cui
parent f7e7851e3f
commit 8b69252664
41 changed files with 354 additions and 146 deletions

View File

@@ -15,9 +15,6 @@ import type {
/** Durable Schedule protocol version implemented by this package. */
export const SCHEDULE_CHANGE_VERSION = 1 as const
/** Key used by the generic Host/client event-presentation slot. */
export const SCHEDULE_REMINDER_PRESENTATION_KEY = 'schedule/reminder'
const MAX_FOUR_DIGIT_YEAR_MS = Date.parse('9999-12-31T23:59:59.999Z')
const UTC_INSTANT = /^(?!0000)\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d\.\d{3}Z$/

View File

@@ -12,7 +12,6 @@ import { registerScheduleTools } from './tools.ts'
export type * from './types.ts'
export {
SCHEDULE_CHANGE_VERSION,
SCHEDULE_REMINDER_PRESENTATION_KEY,
ScheduleId,
ScheduleInputError,
ScheduleLogError,

View File

@@ -310,6 +310,9 @@ export function registerScheduleTools(
},
output: { schema: DELETE_OUTPUT_SCHEMA, render: renderValue },
async execute(args, exec): Promise<ScheduleDeleteValue> {
if (args.id.length === 0 || args.id.trim() !== args.id) {
return { code: 'invalid_rule', message: 'schedule_delete id must be non-empty without surrounding whitespace.' }
}
const id = ScheduleId(args.id)
if (exec.agent !== agent) return internalError()
const uncertain = await preflight(rootCtx, agent, 'delete', id)