10 Commits
Author SHA1 Message Date
xiaomakuaiz c070f50f5f fix(mobile): trim history overlapping the live round at the boundary
Re-entering a running task can surface the current round twice around
the attach window: REST backfill / locally archived messages and the
attach replay both carry the round's opening (decoded ids are freshly
generated, so key-based dedupe is impossible), which visually wedges the
round's user input into the middle of the streaming output. Cut history
at the live stream's first timestamped message - the active round is
sourced from the live stream only.
2026-08-30 20:08:23 +08:00
xiaomakuaiz 446b8744ac fix(mobile): stop duplicate rounds when loading earlier history
Two probabilistic duplication vectors (decoded message ids are freshly
generated per decode, so duplicates cannot be deduped by key):

- loadEarlier guarded re-entry with async React state; the auto-prefill
  effect and the inverted list's initial onEndReached could both pass the
  guard in the same frame and fetch the same cursor page twice. Guard
  with a ref (synchronous).
- In cursorless sessions, handleSend archives the previous live round
  locally, then the REST fallback seeded a cursor that still covered the
  archived rounds, so paging up re-fetched them. Track archived round
  count, skip that many when seeding, drop stale seeds, and stop hc
  re-seeding once local archives exist.
2026-08-30 19:10:47 +08:00
xiaomakuaiz 7c943b1994 fix(mobile): address review findings for math rendering and stream lifecycle
Review-driven batch on top of the math feature:

- Ask-card custom answer: scroll the card above the keyboard on input
  focus (inverted-list scrollToIndex, viewPosition 0).
- Inline math boundaries: closing-$ guard switched to a negated class so
  bold-wrapped/operator-adjacent formulas (**$E=mc^2$**, $a$-$b$) and
  han-adjacent Chinese phrasing render; CJK/full-width punctuation
  excluded from $-content to kill currency false positives.
- Clamp MathJax output size (rule-bomb guard), reject empty $$ blocks,
  clamp throttle elapsed against clock steps, and gate O(n^2) slicing in
  the inline tokenizer behind a first-char check.
- Streaming perf: stable body root key + content-hash node keys keep
  top-level formulas mounted across re-parses; TeX->SVG and parsed-AST
  LRU caches; memoized markdown style object.
- Android: scale inline formulas into the fixed line box and drop the
  baseline shift (CustomLineHeightSpan overlaps oversized inline views).
- handleSend snapshots the disconnect() return so throttled tail chunks
  are archived; effect cleanup also disconnects the newRound client;
  failPendingToolCalls replaces message objects so memoized tool cards
  observe the status flip.
- Swap @babel/plugin-transform-dynamic-import to the ^7 line (the ^8
  line is Babel-8/ESM-only and breaks installs and jest on older Node).
2026-08-30 17:52:36 +08:00
xiaomakuaiz 1d6628b488 fix(mobile): coalesce stream emits to stop update-depth warnings
Replaying long conversations emits hundreds of per-chunk state updates,
driving back-to-back commits whose passive-effect flushes keep React's
nested-update counter climbing (Maximum update depth exceeded warning).
Throttle TaskStreamClient.emit with a leading+trailing 50ms window
(flushed on disconnect so terminal states still land), and key the
context-usage effect on primitive values instead of the per-emit
contextUsage object identity.
2026-08-28 23:37:06 +08:00
xiaomakuaiz 2a009ecb3c fix: improve mobile task workflows 2026-07-10 20:11:06 +08:00
xiaomakuaiz d70bf525b4 fix mobile mermaid rendering 2026-07-04 17:50:44 +08:00
xiaomakuaiz 91104d2082 feat(mobile): iOS 按会员等级隐藏更高档位的额度条与模型分组
- 我的页面:仅 iOS 只展示当前会员等级包含的 token 额度条(基础会员只看到基础模型)
- 选择/切换模型:仅 iOS 隐藏高于当前等级的内置分组(专业/旗舰)——App 内无升级
  购买路径,展示用不了的档位既是死入口也有审核风险
- Android 不受影响,保持全部展示
2026-06-12 21:20:21 +08:00
xiaomakuaiz 2ac5e22e41 feat(mobile): 首次 AI 交互前的数据处理同意弹窗(App Store 审核 Guideline 2.1)
向 AI(含第三方服务)发送用户内容前取得明确同意:
- 新增 src/components/AiConsent.tsx:useAiConsent()(AsyncStorage 持久化 mc.aiConsent.v2,一次性)+ AiConsentModal
- 主提示点:登录后进入首页((tabs)/_layout)首次弹出,「同意并继续」记住、「暂不使用」本次关闭
- 硬拦截兜底:任务会话页(可交互时)与新建任务页未同意则弹窗,不同意则退出该页
- 弹窗说明发送内容(指令/代码/文件/图片)会经 AI 模型处理、可能含第三方 AI 服务商,附《隐私政策》入口
2026-06-10 15:45:54 +08:00
xiaomakuaiz 301a75fb16 feat(mobile): 任务对话支持选图作为附件发送 + 对话图片保存到相册
对齐 Web chat-inputbox:
- 选图:expo-image-picker 相册多选(≤3 张、仅图片);超 2MB 自动用 expo-image-manipulator
  缩边长 + JPEG 压缩到 2MB 内(≤2MB 原图直接用)
- 上传:预签名直传(POST /api/v1/uploader/presign → PUT 原始字节)。用 XHR(responseType blob)
  取本地文件,blob.slice(...,'') 去掉 Content-Type,fetch credentials:'omit' 跨域直传——对齐 Web
  的 new Blob([file]);否则 iOS 多发的 Content-Type 进入 SigV4 规范请求触发 SignatureDoesNotMatch
- 发送:user-input 负载带 attachments:[{url,filename}](原来恒为空);历史/实时用户消息渲染缩略图
- composer:暂存缩略图(上传中/失败态、可移除)、上传中禁发、并发上传;快捷指令不带走暂存图
- AI 的 markdown 图片:覆盖 markdown image 规则,用普通 <Image> + onLoad 自适应比例,修掉
  react-native-fit-image 永久 loading 转圈 + React19 "key spread into JSX" 告警
- 保存到相册:点对话里的图片 → expo-media-library/legacy 存系统相册
- 新增原生依赖 expo-image-picker / expo-image-manipulator / expo-media-library
  (需重新原生构建;app.json 加图库读/写权限)
2026-06-09 22:06:33 +08:00
xiaomakuaiz a6fd8ecbc8 chore(mobile): 移除旧 Capacitor 客户端,Expo 客户端(mobile-expo)重命名为 mobile
删除原 Capacitor 版 mobile/;将 SDK56 重构的 mobile-expo/ 重命名为 mobile/。
(android/ios/node_modules 等为 gitignore 生成物,未入库;本地需重新 npm install + prebuild)
2026-06-09 00:52:42 +08:00