feat(health): complete P0 health channel — baseline engine, page-data, MindSpace UI

Deliver encrypted health zone, observation API, baseline maturity pipeline,
page-data bindings, and H5/WeChat channel integration for health P0.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-09-09 18:04:22 +08:00
parent 7bf16500a1
commit 2baf29b3ae
94 changed files with 7283 additions and 194 deletions
+23 -4
View File
@@ -76,7 +76,7 @@ import { attachPortalTemporalRecallRoutes } from './server/portal-temporal-recal
import { attachPortalGoalRunRoutes } from './server/portal-goal-run-routes.mjs';
import { attachPortalHealthRoutes } from './server/portal-health-routes.mjs';
import { createHealthChannelSessionStore } from './health-channel-session-store.mjs';
import { createInMemoryHealthObservationStore } from './health-observation-store.mjs';
import { createHealthDataRuntime } from './health-data-runtime.mjs';
import { assertMindSpaceRoute, mindspaceFlags } from './mindspace-flags.mjs';
import { loadMindSpaceConfigCached } from './mindspace-config.mjs';
import { createMindspaceSeoDiscoveryService } from './mindspace-seo-discovery-service.mjs';
@@ -325,7 +325,7 @@ let subscriptionService = null;
let wechatPayClient = null;
let wechatOAuthService = null;
let wechatMpService = null;
const healthObservationStore = createInMemoryHealthObservationStore();
const healthDataRuntime = createHealthDataRuntime({ env: process.env, logger: console });
const healthChannelStore = createHealthChannelSessionStore();
let notificationDispatcher = null;
let scheduleService = null;
@@ -391,6 +391,15 @@ async function bootstrapUserAuth() {
pageDataService = domainServices.pageDataService;
pageDataPublicService =
domainServices.pageDataPublicService;
healthDataRuntime.upgradeToPageData({
env: process.env,
getUserAuth: () => userAuth,
resolveWorkspaceRoot: async (userId) => userAuth?.resolveWorkingDir?.(userId) ?? null,
logger: console,
});
if (healthDataRuntime.storageBackend === 'page_data') {
console.log('[Health] Observation storage: Page Data (PostgreSQL user schema)');
}
feedbackService = domainServices.feedbackService;
mindSpace = domainServices.mindSpace;
mindSpaceServiceFacade =
@@ -589,7 +598,11 @@ async function bootstrapUserAuth() {
mindSpacePages,
mindSpacePageLiveEdit,
healthChannelStore,
healthObservationStore,
healthObservationStore: healthDataRuntime.observationStore,
healthObservationService: healthDataRuntime.observationService,
healthDocumentStore: healthDataRuntime.documentStore,
healthDataRuntime,
healthEventStore: healthDataRuntime.eventStore,
logger: console,
});
wechatMpService =
@@ -914,7 +927,13 @@ attachPortalGoalRunRoutes(api, {
attachPortalHealthRoutes({
api,
observationStore: healthObservationStore,
healthDataRuntime,
getLlmProviderService: () => llmProviderService,
getMindSpaceAssets: () => mindSpaceAssets,
getMindSpacePages: () => mindSpacePages,
getUserAuth: () => userAuth,
getAuthPool: () => authPool,
h5Root: H5_ROOT,
env: process.env,
});