feat(wechat): add Intent Transaction Layer with unified task schema
Introduce Draft → Confirm → Commit flow for WeChat schedule intents behind feature flags, plus h5_tasks dual-write/read aggregation and rollout scripts so reminders and automations get explicit user confirmation before persisting. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -66,6 +66,17 @@ test('balance reminder asks for threshold when missing', () => {
|
||||
assert.deepEqual(intent.needsClarification, ['threshold']);
|
||||
});
|
||||
|
||||
test('parse bare set reminder command as slot fill intent', () => {
|
||||
const intent = parseScheduleIntent('设置提醒');
|
||||
assert.equal(intent.action, 'create_timed_reminder');
|
||||
assert.deepEqual(intent.needsClarification, ['reminder_time', 'reminder_title']);
|
||||
});
|
||||
|
||||
test('parse bare set reminder with asr prefix', () => {
|
||||
const intent = parseScheduleIntent('嗯设置提醒');
|
||||
assert.equal(intent.action, 'create_timed_reminder');
|
||||
});
|
||||
|
||||
test('parses plain todo record request with quoted title', () => {
|
||||
const intent = parseScheduleIntent('帮我记一下「🍽️ 跟段吃饭」');
|
||||
assert.equal(intent.action, 'create_todo');
|
||||
@@ -107,10 +118,39 @@ test('reminder todo request routes to schedule assistant instead of plain todo s
|
||||
|
||||
test('specific dated reminder still routes to schedule assistant', () => {
|
||||
const intent = parseScheduleIntent('明天下午三点提醒我开会');
|
||||
assert.equal(intent.action, 'none');
|
||||
assert.equal(intent.action, 'create_timed_reminder');
|
||||
assert.equal(intent.title, '开会');
|
||||
assert.equal(intent.hour, 15);
|
||||
assert.equal(shouldUseScheduleAssistant('明天下午三点提醒我开会'), true);
|
||||
});
|
||||
|
||||
test('parses direct reminder setup phrase from wechat', () => {
|
||||
const now = Date.UTC(2026, 7, 24, 4, 0, 0); // 2026-08-24 12:00 Asia/Shanghai
|
||||
const intent = parseScheduleIntent('帮我设置提醒,下午 14:30 分开会,项目计划例会', {
|
||||
timezone: 'Asia/Shanghai',
|
||||
now,
|
||||
});
|
||||
assert.equal(intent.action, 'create_timed_reminder');
|
||||
assert.equal(intent.title, '项目计划例会');
|
||||
assert.equal(intent.remindLocal, '2026-08-24 14:30');
|
||||
});
|
||||
|
||||
test('simple reminder today rolls to tomorrow when time already passed', () => {
|
||||
const now = Date.UTC(2026, 7, 24, 7, 0, 0); // 2026-08-24 15:00 Asia/Shanghai
|
||||
const intent = parseScheduleIntent('今天10点提醒我吃药', {
|
||||
timezone: 'Asia/Shanghai',
|
||||
now,
|
||||
});
|
||||
assert.equal(intent.action, 'create_timed_reminder');
|
||||
assert.equal(intent.remindLocal, '2026-08-25 10:00');
|
||||
});
|
||||
|
||||
test('multi-time reminder still falls through to agent prompt', () => {
|
||||
const intent = parseScheduleIntent('明天早上六点去跑步,五点半提醒我');
|
||||
assert.equal(intent.action, 'none');
|
||||
assert.equal(shouldUseScheduleAssistant('明天早上六点去跑步,五点半提醒我'), true);
|
||||
});
|
||||
|
||||
test('simple schedule query still works', () => {
|
||||
const intent = parseScheduleIntent('看看我的待办');
|
||||
assert.equal(intent.action, 'query_schedule');
|
||||
|
||||
Reference in New Issue
Block a user