feat(health): wire H5 health page, WeChat channel, and observation API.

Expose /health and /api/health/observations behind MEMIND_HEALTH_ENABLED, redirect ordinary chat health intents without persisting, and run a dedicated WeChat menu flow with confirm-before-write semantics.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-09-02 10:05:56 +08:00
parent f96fdcb3b9
commit 7bf16500a1
22 changed files with 1132 additions and 10 deletions
+7 -2
View File
@@ -4,7 +4,10 @@ import { SubscribeModal } from '../components/SubscribeModal';
import { useTKMindChat } from '../hooks/useTKMindChat';
import type { CapabilityMap, PortalUser } from '../types';
type ChatContextValue = ReturnType<typeof useTKMindChat>;
type ChatContextValue = ReturnType<typeof useTKMindChat> & {
goalRunEnabled?: boolean;
healthEnabled?: boolean;
};
const ChatContext = createContext<ChatContextValue | null>(null);
@@ -13,6 +16,7 @@ export function ChatProvider({
capabilities,
grantedSkills,
goalRunEnabled,
healthEnabled,
onUserUpdate,
children,
}: {
@@ -20,13 +24,14 @@ export function ChatProvider({
capabilities?: CapabilityMap | null;
grantedSkills?: string[];
goalRunEnabled?: boolean;
healthEnabled?: boolean;
onUserUpdate?: (user: PortalUser) => void;
children: ReactNode;
}) {
const chat = useTKMindChat(user, onUserUpdate, capabilities, grantedSkills);
return (
<ChatContext.Provider value={{ ...chat, goalRunEnabled }}>
<ChatContext.Provider value={{ ...chat, goalRunEnabled, healthEnabled }}>
{children}
{typeof chat.balanceCents === 'number' && chat.rechargePrompt && (
<RechargeModal