DOC-005 定义 App-Rust 调用协议 #5

Closed
opened 2026-05-30 19:48:59 +08:00 by wangdl · 1 comment
Owner

编写 docs/app-rust-bridge.md,定义 App 调 Rust 的函数边界。

App 调用 Rust(至少):
detect_material_type、open_document、get_document_info、get_markdown_blocks、get_text_content、search_document、update_reading_position、export_pending_events、create_note_anchor

Rust 不允许直接做:
download_file、upload_reading_events、call_ai_chat、save_note_to_backend、share_file、delete_material

验收标准:文档存在、明确 Rust 不负责网络、明确文件由 App 下载到本地后交 path/bytes 给 Rust、明确阅读事件由 Rust 生成 App 负责上传

编写 docs/app-rust-bridge.md,定义 App 调 Rust 的函数边界。 App 调用 Rust(至少): detect_material_type、open_document、get_document_info、get_markdown_blocks、get_text_content、search_document、update_reading_position、export_pending_events、create_note_anchor Rust 不允许直接做: download_file、upload_reading_events、call_ai_chat、save_note_to_backend、share_file、delete_material 验收标准:文档存在、明确 Rust 不负责网络、明确文件由 App 下载到本地后交 path/bytes 给 Rust、明确阅读事件由 Rust 生成 App 负责上传
wangdl added this to the M0:项目初始化与技术边界冻结 milestone 2026-05-30 19:48:59 +08:00
wangdl added the
priority:p0
type:design
area:ffi
labels 2026-05-30 19:48:59 +08:00
Author
Owner

完成项

docs/app-rust-bridge.md 已编写并推送

文档内容

Rust 暴露的 11 个函数

# 函数 用途
1 detect_material_type 文件类型识别
2 open_document 打开文档,返回不透明句柄
3 get_document_info 获取 DocumentInfo
4 get_markdown_blocks 解析 MD 为 DocumentBlock[]
5 get_text_content 读取 TXT 全文
6 get_image_meta 图片宽高/格式/大小
7 search_document 文档内搜索
8 update_reading_position 更新阅读位置
9 export_pending_events 导出未上传事件
10 clear_exported_events 确认已上传,清空缓冲区
11 create_note_anchor 创建笔记锚点

App 侧 8 项职责

download_file / upload_reading_events / save_note / call_ai_chat / share_file / delete_material / get_user_token / open_system_preview

附带内容

  • Markdown 阅读完整时序(13 步)
  • PDF 平台预览时序(6 步)
  • 错误处理约定(5 种错误 → App 处理方式)
  • 线程安全要求(后台线程 + Mutex)

M0 完成状态

DOC-001 workspace
DOC-002 README + docs
DOC-003 格式分级
DOC-004 核心数据模型
DOC-005 调用协议

M0 全部 5 个 Issue 均已完成,可进行里程碑审查。

## 完成项 ✅ docs/app-rust-bridge.md 已编写并推送 ## 文档内容 ### Rust 暴露的 11 个函数 | # | 函数 | 用途 | |---|------|------| | 1 | detect_material_type | 文件类型识别 | | 2 | open_document | 打开文档,返回不透明句柄 | | 3 | get_document_info | 获取 DocumentInfo | | 4 | get_markdown_blocks | 解析 MD 为 DocumentBlock[] | | 5 | get_text_content | 读取 TXT 全文 | | 6 | get_image_meta | 图片宽高/格式/大小 | | 7 | search_document | 文档内搜索 | | 8 | update_reading_position | 更新阅读位置 | | 9 | export_pending_events | 导出未上传事件 | | 10 | clear_exported_events | 确认已上传,清空缓冲区 | | 11 | create_note_anchor | 创建笔记锚点 | ### App 侧 8 项职责 download_file / upload_reading_events / save_note / call_ai_chat / share_file / delete_material / get_user_token / open_system_preview ### 附带内容 - Markdown 阅读完整时序(13 步) - PDF 平台预览时序(6 步) - 错误处理约定(5 种错误 → App 处理方式) - 线程安全要求(后台线程 + Mutex) ## M0 完成状态 ⬜ DOC-001 workspace ✅ ⬜ DOC-002 README + docs ✅ ⬜ DOC-003 格式分级 ✅ ⬜ DOC-004 核心数据模型 ✅ ⬜ DOC-005 调用协议 ✅ **M0 全部 5 个 Issue 均已完成,可进行里程碑审查。**
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wangdl/zhixi-document-runtime#5
No description provided.