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:
john
2026-08-24 15:59:17 +08:00
parent b93c92a3e2
commit d58dc2a251
45 changed files with 4972 additions and 30 deletions
@@ -26,6 +26,9 @@ import {
} from '../plaza-tasks.mjs';
import { createScheduleService } from '../schedule-service.mjs';
import { createScheduledTaskService } from '../scheduled-task-service.mjs';
import { createIntentDraftService } from '../intent-draft-service.mjs';
import { createTaskUnifiedService } from '../task-unified-service.mjs';
import { attachUnifiedTaskSync } from '../task-unified-sync.mjs';
import { createFeedbackService } from '../user-feedback.mjs';
import { PUBLISH_KEY_UUID } from '../user-publish.mjs';
import { initSchema } from '../db.mjs';
@@ -49,6 +52,8 @@ export async function bootstrapPortalDomainServices({
loadMindSpaceConfigCachedFn = loadMindSpaceConfigCached,
createScheduleServiceFn = createScheduleService,
createScheduledTaskServiceFn = createScheduledTaskService,
createIntentDraftServiceFn = createIntentDraftService,
createTaskUnifiedServiceFn = createTaskUnifiedService,
createPageDataServiceFn = createPageDataService,
createPageDataPublicServiceFn =
createPageDataPublicService,
@@ -116,6 +121,24 @@ export async function bootstrapPortalDomainServices({
defaultTimezone:
env.H5_DEFAULT_TIMEZONE || 'Asia/Shanghai',
});
const intentDraftService =
env.H5_INTENT_TRANSACTION_ENABLED === '1'
? createIntentDraftServiceFn(pool)
: null;
const taskUnifiedService =
env.H5_UNIFIED_TASKS_ENABLED === '1'
? createTaskUnifiedServiceFn(pool)
: null;
if (taskUnifiedService) {
attachUnifiedTaskSync({
scheduleService,
scheduledTaskService,
taskUnifiedService,
pool,
env,
logger,
});
}
const pageDataService = createPageDataServiceFn({
getUserAuth,
getPool: () => pool,
@@ -286,6 +309,8 @@ export async function bootstrapPortalDomainServices({
mindSpaceAnalyticsConfig: resolvedAnalyticsConfig,
scheduleService,
scheduledTaskService,
intentDraftService,
taskUnifiedService,
pageDataService,
pageDataPublicService,
feedbackService,
@@ -29,6 +29,8 @@ export async function bootstrapPortalIntegrationServices({
tkmindProxy,
scheduleService,
scheduledTaskService = null,
intentDraftService = null,
taskUnifiedService = null,
sessionSnapshotService = null,
wechatScheduleLlmConfigService,
wechatIntentRouter = null,
@@ -163,6 +165,14 @@ export async function bootstrapPortalIntegrationServices({
env.H5_SCHEDULE_ENABLED === '1'
? scheduledTaskService
: null,
intentDraftService:
env.H5_INTENT_TRANSACTION_ENABLED === '1'
? intentDraftService
: null,
taskUnifiedService:
env.H5_UNIFIED_TASKS_ENABLED === '1'
? taskUnifiedService
: null,
wechatScheduleLlmConfigService,
llmProviderService,
chatIntentRouter,