This directory contains the native WeChat Mini Program client. It is intentionally isolated from the H5/backend code so development can proceed without changing existing services.
## Current MVP
- Native WeChat login entry via `wx.login`.
- H5 account/password login fallback through `/auth/login`.
- Chat submission through `/api/agent/runs`.
- Agent run polling through `/api/agent/runs/:runId`.
- Session detail refresh through `/api/sessions/:sessionId`.
- Session list through `/api/sessions`.
- MindSpace page list through `/api/mindspace/v1/pages`.
- Page preview through Mini Program `web-view`.
## Backend Assumptions
The H5 APIs are reused as-is. Native Mini Program login posts the `wx.login` code to `MINIAPP_LOGIN_PATH` in `utils/config.js`; the current default is `/auth/wechat-miniapp/login`. If that backend endpoint is not available yet, use the account/password login fallback during local development.
# or ensure http://127.0.0.1:8081/auth/status responds
```
2. Switch miniapp back to local Portal **without** touching production:
- In `utils/config.js`, set `LOCAL_DEV = true`, **or**
- Copy `utils/config.local.example.js` → `utils/config.local.js` and set `API_BASE_URL`.
`project.private.config.json` only affects DevTools compiler settings; it is **not** available to runtime `require()`.
3. WeChat DevTools → 详情 → 本地设置 (local only):
- enable **Do not verify合法域名 / TLS**
- keep **tourist AppID** only if you use account/password login; real AppID is required for `wx.login`
4. Restart Portal after pulling local server changes. Local Portal only bypasses CSRF for WeChat `servicewechat.com` referrers; production `m.tkmind.cn` is unchanged.
5. Use an account that exists in your local `.env` database auth. Wrong credentials return `401`, not `403`.
Mini Program work should stay inside `miniapp/`. Do not modify backend, H5, Memory, MindSpace, or production release files for this MVP unless explicitly approved.