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

@@ -4,7 +4,6 @@ import {
ScheduleId,
ScheduleInputError,
ScheduleLogError,
SCHEDULE_REMINDER_PRESENTATION_KEY,
allocateScheduleId,
createAfterScheduleRecord,
decodeScheduleChange,
@@ -98,7 +97,6 @@ describe('version-1 Schedule decoding and folding', () => {
scheduleEvent(createData('same-id', 'child prompt'), 2),
scheduleEvent({ version: 1, operation: 'dispatch', id: 'same-id' }, 3),
]
expect(SCHEDULE_REMINDER_PRESENTATION_KEY).toBe('schedule/reminder')
expect(scheduleReminderPresentation(events, 1, 2)).toEqual({
scheduleId: 'same-id',
prompt: 'parent prompt',

View File

@@ -185,6 +185,17 @@ describe('Schedule tool protocol', () => {
.toMatchObject({ id: 'schedule-2' })
})
it('rejects an empty or padded delete id before persistence', async () => {
const test = await harness()
for (const id of ['', ' schedule-1']) {
expect(value(await execute(test, 'schedule_delete', { id }))).toEqual({
code: 'invalid_rule',
message: 'schedule_delete id must be non-empty without surrounding whitespace.',
})
}
expect(test.flushes.count).toBe(0)
})
it('returns a range error only after the create preflight', async () => {
const test = await harness()
expect(value(await execute(test, 'schedule_create', {