fix(schedule): harden reminder utterance routing for WeChat ITL
Memind CI / Test, build, and release guards (push) Successful in 3m43s

Expand ASR normalization and colloquial reminder parsing so simple timed reminders route to L1 confirm cards instead of the agent, and disable schedule-guard false failures when ITL is enabled.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-24 18:02:19 +08:00
parent 2319c9c808
commit 9dfafb99ca
10 changed files with 319 additions and 26 deletions
+36
View File
@@ -219,3 +219,39 @@ test('nextDailyRunAt rolls to tomorrow when today time has passed', () => {
const next = nextDailyRunAt({ hour: 7, minute: 0, timezone: 'Asia/Shanghai', now });
assert.equal(next, Date.UTC(2026, 5, 18, 23, 0, 0)); // 2026-06-19 07:00 Asia/Shanghai
});
test('parses colloquial add-reminder phrases', () => {
const now = Date.UTC(2026, 7, 24, 9, 0, 0);
const cases = [
['加个提醒明天9点开会', { title: '开会', hour: 9 }],
['添加提醒后天10点体检', { title: '体检', hour: 10 }],
['创建提醒明早6点跑步', { title: '跑步', hour: 6 }],
['备忘提醒下午3点交报告', { title: '交报告', hour: 15 }],
];
for (const [text, expected] of cases) {
const intent = parseScheduleIntent(text, { timezone: 'Asia/Shanghai', now });
assert.equal(intent.action, 'create_timed_reminder', text);
assert.equal(intent.title, expected.title, text);
assert.equal(intent.hour, expected.hour, text);
}
});
test('colloquial add-reminder phrases route to ITL timed reminder', () => {
for (const text of [
'加个提醒明天9点开会',
'添加提醒后天10点体检',
'备忘提醒下午3点交报告',
]) {
const result = classifyUserIntent(text);
assert.equal(result.kind, 'timed_reminder', text);
assert.equal(result.layer, 'L1', text);
}
});
test('time-only reminder without title asks for clarification', () => {
const now = Date.UTC(2026, 7, 24, 9, 0, 0);
const intent = parseScheduleIntent('安排一个提醒今晚8点', { timezone: 'Asia/Shanghai', now });
assert.equal(intent.action, 'create_timed_reminder');
assert.deepEqual(intent.needsClarification, ['reminder_title']);
assert.equal(intent.hour, 20);
});