Commit Graph

150 Commits

Author SHA1 Message Date
John b97c8e822e chore: add worker stream reconcile dry run 2026-07-02 07:28:58 +08:00
John e989526886 feat: gate code agent runs server side 2026-07-02 07:25:16 +08:00
John 304a9eaea2 chore: add code run entry check 2026-07-02 07:22:49 +08:00
John ac20ac212e feat: add gated h5 code run entry 2026-07-02 07:19:26 +08:00
John 0271d83756 feat: wire code agent runs to tool mode 2026-07-02 07:16:47 +08:00
John e17dcaf4a8 feat: gate code tools by task mode 2026-07-02 07:12:18 +08:00
John c9b7252832 fix: avoid opening sse in runtime check 2026-07-02 07:06:25 +08:00
John fa0024907b docs: record runtime ops rollout 2026-07-02 07:05:07 +08:00
John 4420cca340 chore: add runtime observability ops 2026-07-02 07:04:50 +08:00
John 04e308e582 feat: add streaming runtime router 2026-07-02 06:55:26 +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 c0ed894cff merge: record 0701bug002 into main 2026-07-01 18:35:36 +08:00
john 44d41d9851 merge: record remaining local branches into main 2026-07-01 18:35:25 +08:00
john 73a90c80fd fix: normalize alternate tkmind publish links 2026-07-01 18:34:04 +08:00
john 1297531b04 docs: record v2 direct-injection release id for 103 rollback
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 18:32:27 +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 75e5a56b86 docs: record 103 agent-time-fix release id for rollback
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 18:31:32 +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 9aa5229af8 docs: add portal-release skill for package/deploy/verify/rollback
Codifies the 103 production release workflow used for the
0701bug003 deploy: doc-mandated pre-release tests, build + dry-run,
release-portal-runtime-prod.sh, full post-deploy verification
(health, /auth/login, all 4 goosed ports, log keyword scan, real
API-driven page-create smoke test), and both a preferred rollback
(redeploy previous good commit) and an emergency manual rollback path.

Passwords are taken from env vars (JOHN_PASSWORD/H5_ACCESS_PASSWORD),
matching the existing scripts/fruit-theme-john-e2e.mjs convention —
never hardcoded in the skill file.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-01 18:19:40 +08:00
john 862824202f fix: guide agent to a real public link instead of dead-ending on apps__create_app
Diagnosed via production session logs (RDS + shared goose PG) that some
users' page-generation attempts drifted: the agent used apps__create_app
(no public URL) then fabricated a placeholder domain when asked for a
link, and separately burned many turns scraping unreachable/anti-bot
search engines. Steer both flows toward the already-working path instead
of banning tools outright:

- apps__create_app is fine for designing/previewing a page, but the
  agent must still write_file the result into public/*.html per the
  static-page-publish skill and return a link built from the real
  public URL template (no invented domains)
- for real-world lookups, load_skill('web') first and prefer
  Bing/360 over retrying google.com or hammering anti-bot sites

Also folds in generate_docx guidance for Word-download attachments
(sandbox-fs tool) that landed in the same files during this pass.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-01 18:19:40 +08:00
john b273bb7aa2 fix: gate public page download links before Portal release
Add a MindSpace public HTML checker for missing companion docx/PDF paths, wire it into runtime packaging and release-portal-runtime-prod.sh, and document the workflow for agents and ops.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 18:18:27 +08:00
john 5a970e612e chore: enforce standard branch release workflow 2026-07-01 18:14:24 +08:00
john 394d3640d1 fix(chat): speed up history switch 2026-07-01 18:13:24 +08:00
john b7af5b00dc fix(release): restart m.tkmind.cn portal tunnel after Portal deploy
Bundle memind-portal-tunnel.sh into the runtime artifact and kickstart
cn.tkmind.memind-portal-tunnel on 103 after Portal health checks so 105
nginx can reach 127.0.0.1:19081 following runtime releases.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 18:12:31 +08:00
john d7cbf3cc96 chore: add 105 runtime and openhands ops tooling 2026-07-01 18:10:48 +08:00
john 65e8a3a5a8 fix: escape docx publish hints in workspace templates 2026-07-01 18:08:06 +08:00
john ee3dd3b23c fix: require docx generation for downloadable pages 2026-07-01 18:08:06 +08:00
john 6cb1a2475d fix: harden public download companion sync 2026-07-01 18:08:06 +08:00
john 6e4e0e2937 refactor: centralize wechat notification dispatch 2026-07-01 18:08:06 +08:00
john 9c653e9b16 feat: auto grant one-time low balance gift for new users 2026-07-01 18:08:06 +08:00
john ae6eaf8c3e docs: 103 发布 0630004 回退说明与备份路径
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 18:08:06 +08:00
john 722b18326f feat(mindspace): 0630004 空间 UI、聊天连接、微信分享与 Agent 能力
含 MindSpace 三列布局与统计修复、聊天加载态与连接降级、平台页脚标记与 og:site_name 微信卡片、勾选资料删除 Agent 接口及内部话术过滤。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 18:08:06 +08:00
john b1b8d3afc6 docs: 103 发布 0630003 回退说明与备份路径
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 18:08:06 +08:00
john 71e536eceb feat(mindspace): 悬浮聊天勾选资料联动、UI 与交互优化
勾选单个文件时 Agent 获知上下文并主动问候;打开悬浮窗使用新会话。
统一弹窗浅色主题、固定高度与输入区布局,支持点击外部收起。

Co-authored-by: Cursor <cursoragent@cursor.com>
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 06eb129a28 fix(mindspace): 修复删除时无法解析 MySQL JSON 导致页面复活
source_snapshot_json 在 mysql2 中已是对象,JSON.parse 失败会使 relative_path 丢失、工作区 HTML 未清理;同步后页面重新出现。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 18:08:06 +08:00
john 2f6a52151a docs: 103 发布 0630001 回退说明与备份路径
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 18:08:06 +08:00
john ea6c49f046 feat(mindspace): 全部页面管理、级联删除与页面同步去重
支持全部页面分页/多选/删除/分享,删除时可选移除广场帖并清理工作区附件;修复并发同步重复创建页面,并补齐预览下载链接重写与 iframe 下载权限。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 18:08:06 +08:00
john 6e6d00568a merge: integrate 0629004-bug 2026-07-01 17:57:14 +08:00
john 0293abc11f merge: integrate codex/mindspace-ui 2026-07-01 17:57:11 +08:00
john 7f0b216775 docs: add portal-release skill for package/deploy/verify/rollback
Codifies the 103 production release workflow used for the
0701bug003 deploy: doc-mandated pre-release tests, build + dry-run,
release-portal-runtime-prod.sh, full post-deploy verification
(health, /auth/login, all 4 goosed ports, log keyword scan, real
API-driven page-create smoke test), and both a preferred rollback
(redeploy previous good commit) and an emergency manual rollback path.

Passwords are taken from env vars (JOHN_PASSWORD/H5_ACCESS_PASSWORD),
matching the existing scripts/fruit-theme-john-e2e.mjs convention —
never hardcoded in the skill file.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-01 15:21:55 +08:00
john 27960a3762 fix: guide agent to a real public link instead of dead-ending on apps__create_app
Diagnosed via production session logs (RDS + shared goose PG) that some
users' page-generation attempts drifted: the agent used apps__create_app
(no public URL) then fabricated a placeholder domain when asked for a
link, and separately burned many turns scraping unreachable/anti-bot
search engines. Steer both flows toward the already-working path instead
of banning tools outright:

- apps__create_app is fine for designing/previewing a page, but the
  agent must still write_file the result into public/*.html per the
  static-page-publish skill and return a link built from the real
  public URL template (no invented domains)
- for real-world lookups, load_skill('web') first and prefer
  Bing/360 over retrying google.com or hammering anti-bot sites

Also folds in generate_docx guidance for Word-download attachments
(sandbox-fs tool) that landed in the same files during this pass.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-01 14:19:09 +08:00
john 945b0a609b fix: guide agent to a real public link instead of dead-ending on apps__create_app
Diagnosed via production session logs (RDS + shared goose PG) that some
users' page-generation attempts drifted: the agent used apps__create_app
(no public URL) then fabricated a placeholder domain when asked for a
link, and separately burned many turns scraping unreachable/anti-bot
search engines. Steer both flows toward the already-working path instead
of banning tools outright:

- apps__create_app is fine for designing/previewing a page, but the
  agent must still write_file the result into public/*.html per the
  static-page-publish skill and return a link built from the real
  public URL template (no invented domains)
- for real-world lookups, load_skill('web') first and prefer
  Bing/360 over retrying google.com or hammering anti-bot sites

Also folds in generate_docx guidance for Word-download attachments
(sandbox-fs tool) that landed in the same files during this pass.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-01 14:11:09 +08:00
john b4a2b2bdaf fix: gate public page download links before Portal release
Add a MindSpace public HTML checker for missing companion docx/PDF paths, wire it into runtime packaging and release-portal-runtime-prod.sh, and document the workflow for agents and ops.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 12:40:59 +08:00
john 07530a888c fix: escape docx publish hints in workspace templates 2026-07-01 12:13:26 +08:00
john ea4daa1298 fix: require docx generation for downloadable pages 2026-07-01 12:07:46 +08:00
john 58521df36a fix: harden public download companion sync 2026-07-01 11:10:58 +08:00