Commit Graph

30 Commits

Author SHA1 Message Date
john da422a82e6 fix(wechat): restore session routing exports after merge
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-12 22:44:18 +08:00
john 16fd99e8ba fix(page-data): trust live API smoke and WeChat survey submit compat
Stop blocking WeChat delivery when Page Data insert works but publish
quota blocks h5_publish_records; fix smoke URL missing /api; patch survey
radios for WeChat X5 and detect dataset constants in admin pages.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-12 22:42:47 +08:00
john ca4805533b fix(wechat): isolate page data sessions 2026-07-12 21:13:45 +08:00
john 73b308af0a fix(page-data): enforce full workspace bind delivery and repair tooling
Prevent false-positive Finish Guard passes and sync-created fake bindings by assessing publication, policy, dataset, injection, and insert smoke before H5 delivery.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-12 15:30:52 +08:00
john 294e331a03 fix(page-data): deliver MindSpace workspace URLs instead of /u/.../pages/ routes.
Page Data questionnaires were returning publication slugs to users; password-mode
pages always fell back to /u/ routes. Prefer MindSpace paths at publish time and
rewrite mistaken delivery links in WeChat and Portal chat.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-12 13:54:24 +08:00
john 32fb2cdeaf feat: chat uploads, vision turn isolation, and MindSpace agent improvements
Add chat file/image upload UX, attachment proxying, vision thumbnails, and per-turn image scoping so agents only use the current upload. Extend MindSpace asset context, billing token state, OA/scenario verify scripts, and related runtime config.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-11 00:23:01 +08:00
john 81967eaf8c Add wechat reminder LLM toggle 2026-07-07 12:10:21 +08:00
john 08feae8bef feat(h5-session): Session Broker、run SSE replay 与 Finish 竞态修复
落地 H5 Session 架构 Patch 1–5(Broker 收口、Router decision、SSE taxonomy、goosed 边界检查),
并新增可选 MEMIND_RUN_STREAM_REPLAY run 事件回放与 H5 假交付 guard;修复 Finish 先于 agent-run
gate 导致 UI 永久 loading 的竞态,接入 verify:h5-session-patches 回归脚本。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 14:19:48 +08:00
john 031c6e086a feat(wechat): migrate schedule and sync handlers into wechat package
Extract schedule, greeting/status/connectivity replies, chat-general prompt, and display-name helpers from wechat-mp.mjs. Route sync intents via classifyWechatIntent and add channel isolation CI check.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 13:48:47 +08:00
tkmind 2a3579c73a feat(wechat): channel split with stub-safe page delivery
Introduce wechat/ channel package; never send stub HTML links to service-account users.
2026-07-04 05:21:13 +00:00
john 6bc5d128d2 fix(wechat): deliver failure notices and hot-swappable wechat-mp bundle
Notify users when HTML publish guards reject stub pages instead of silently
failing, send real page links when non-stub files exist, and split wechat-mp
into wechat-mp.bundle.mjs for fast production updates without full portal rebuilds.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 12:52:59 +08:00
john 5ed655b6c3 fix(wechat): detect tool_calls errors in Finish reply and sanitize outbound text
When Goose surfaces session poison errors as assistant text instead of Error events,
assertWechatAgentReplyIsSendable now throws to trigger session recreation. Outbound
sanitization prevents raw API errors from reaching WeChat users.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 12:38:00 +08:00
john 8c72d0c950 fix: tighten WeChat session rotation and defer snapshot refresh
Use session snapshot message counts alongside WeChat route counts so long-lived dedicated sessions rotate before Goose history bloats, and refresh snapshots asynchronously so customer replies are not blocked.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 12:21:14 +08:00
john bef72b2768 fix wechat mp session rotation and bootstrap reuse 2026-07-04 12:10:22 +08:00
john 7b09abeaa2 fix: auto-recover WeChat agent sessions poisoned by dangling tool_calls
When a dedicated WeChat session history leaves unmatched tool_calls, the next reply fails with a 400 LLM validation error; detect that pattern and recreate the session before retrying.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 09:53:59 +08:00
john 72fc7cc618 fix wechat mp page reply routing 2026-07-03 10:43:13 +08:00
john aba72c6cf8 Route WeChat publish URLs through facade 2026-07-02 21:11:36 +08:00
john 4fc59729ee fix: add session origin tracking + idle rotation foundation (schema/auth/config)
Backend infrastructure for WeChat/H5 session unification:

- schema.sql: h5_user_sessions adds origin ENUM('h5','wechat') column
- db.mjs: idempotent migration for origin column (adds after user_id)
- user-auth.mjs:
  - setSessionOrigin(sessionId, origin) - tag where session was created
  - getSessionOrigins(sessionIds) - batch lookup for history labeling
  - touchWechatAgentRoute(appId, openid) - refresh activity timestamp
- wechat-mp.mjs:
  - DEFAULT_SESSION_IDLE_ROTATE_MS = 30min (env-configurable)
  - loadWechatMpConfig includes sessionIdleRotateMs

Tests: 50/50 pass ✓

Still TODO:
- ensureWechatAgentSession idle rotation check + setSessionOrigin call
- runIntentMessage grantedSkills flow + touchWechatAgentRoute calls
- Frontend type/UI component updates
- Integration test for idle rotation

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-01 21:10:56 +08:00
john ec375b1402 fix(wip): WIP - partial unify WeChat/H5 skill prompts (build agent changes)
- Reuse H5's buildAutoChatSkillPrefix in buildWechatAgentPrompt signature
- Inject autoSkillPrefix into voice/text message prompts
- Add origin tagging in GET /sessions for h5/wechat channel labels

Still TODO (will complete in next cycle):
- Full resolveGrantedSkills → buildWechatAgentPrompt flow
- ensureWechatAgentSession idle rotation logic
- setSessionOrigin + touchWechatAgentRoute calls
- Backend schema/migrations (h5_user_sessions origin column)
- Frontend type + UI component updates

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-01 21:07:25 +08:00
john 164c6627a0 fix: register direct wechat sessions after start fallback 2026-07-01 18:36:46 +08:00
john de5fab370c fix(agent): inject Shanghai time into each reply message
103 goosed harness_remember returns remembered:false, so session memory
never carried the time anchor. Prepend buildCurrentTimeAgentPrefix on every
H5 /reply and WeChat agent prompt so the model sees Asia/Shanghai clock.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 18:32:27 +08:00
john 62c1d72470 fix(agent): inject Asia/Shanghai time anchor on 0630007 line
Agent replies were reporting UTC time because 0630007-memind never injected
TKMind 当前时间基准 into session memory. Port the time anchor from the
0630004 work only—no miniapp branch changes—and add a 103 rollback script.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 18:31:32 +08:00
john 235ca0971e fix: reconcile reused wechat agent sessions 2026-07-01 18:30:50 +08:00
john ee3dd3b23c fix: require docx generation for downloadable pages 2026-07-01 18:08:06 +08:00
john 2c91689692 feat(schedule): 待办提醒推送、行事历仅展示提醒与管理 API
单次提醒 worker 投递、local 时间写入校验、未来 7 天提醒列表与忽略/批量删除;行事历去掉事项重复展示。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 18:08:06 +08:00
john a40e340a41 release: prepare 0629001 portal updates 2026-06-29 22:20:04 +08:00
john e80831ad4f feat: add wechat publish recovery and conversation memory 2026-06-29 07:08:59 +08:00
john 4a9bc710f1 feat: sync portal runtime fixes for release 2026-06-27 22:28:41 +08:00
john 9b4a25799f Add smart ACK provider for WeChat MP replies
Replace fixed ackText with a rule-based AckProvider that picks
response templates by message type and intent (translate, summary,
rewrite, poster, ppt, mindmap, code, search, schedule). Pure sync,
zero I/O, auto-falls back to config.ackText on any error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 15:19:03 +08:00
john 229805a070 Improve WeChat MP replies and ship MindSpace/H5 production updates.
Add WeChat service account routing with sync acks, connectivity tests, and context isolation; document deploy runbooks; and bundle related MindSpace, voice, Plaza, and server gateway changes for production rollout.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-19 23:06:43 +08:00