@deeprespond/im-tauri 0.0.0-stage → 1.0.0-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 深应智能(DeepRespond)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,71 @@
1
- # Temporary Holding Version
1
+ # 深应智能 IM · Tauri SDK
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 给用 Tauri 2 开发的桌面应用(Windows、macOS、Linux)使用的客户端 SDK。设计见 [docs/sdk-tauri](../../docs/sdk-tauri/)。
4
+
5
+ | 目录 | 内容 |
6
+ | --- | --- |
7
+ | `src/` | npm 包 `@deeprespond/im-tauri`:平台适配层(`adapter/`)、桌面模块与提醒(`desktop/`)、界面窗口的入口 `index.ts`、引擎页的入口 `engine.ts`(子路径 `/engine`) |
8
+ | `src/templates/engine.html` | 引擎页模板 |
9
+ | `plugin/` | Rust 插件 `tauri-plugin-deeprespond-im`:本地存储(SQLite)、安全存储、锁与频道、引擎窗口、系统事件、通知与角标、文件 |
10
+ | `example/` | 示例 App(Vite + 原生 TypeScript,微信风格的完整 IM 界面:好友、群聊、会话、消息、文件、通话,加上 Tauri 桌面特性),端到端测试经它运行 |
11
+ | `test/unit/` | JavaScript 单元测试:假插件(`fake-plugin.ts`)加 Web SDK 的假服务端,引擎页和界面窗口在同一进程中 |
12
+ | `test/e2e/` | 端到端测试:tauri-driver 驱动示例 App,服务端为 `sdk/conformance/harness` |
13
+ | `ci/Dockerfile.linux` | Linux 的构建和测试环境(WebKitGTK 4.1、Rust、Node.js、tauri-driver、Xvfb、钥匙环、通知服务) |
14
+
15
+ JavaScript 部分不复制 Web SDK 的代码:协议和各模块都来自 `@deeprespond/im-web`,本包只替换平台适配层(`platformAdapter`,类型从 `@deeprespond/im-web/platform` 导入)。
16
+
17
+ ## 接入
18
+
19
+ ```rust
20
+ // src-tauri/src/lib.rs
21
+ tauri::Builder::default()
22
+ .plugin(tauri_plugin_deeprespond_im::Builder::new().engine_url("engine.html").main_window("main").build())
23
+ .run(tauri::generate_context!())
24
+ ```
25
+
26
+ ```ts
27
+ // engine.html 的脚本(引擎页,SDK 提供模板 src/templates/engine.html)
28
+ import { createDRTauriEngine } from '@deeprespond/im-tauri/engine';
29
+ createDRTauriEngine({ appKey: 'org#app', apiUrl: 'https://im.example.com' });
30
+
31
+ // 界面窗口
32
+ import { createDRTauriClient } from '@deeprespond/im-tauri';
33
+ const client = createDRTauriClient({ appKey: 'org#app' });
34
+ ```
35
+
36
+ 界面窗口要在 `src-tauri/capabilities/` 中授予 `deeprespond-im:window`;引擎窗口的权限由插件自动授予。完整的说明见《docs/sdk-tauri/3.接口设计》。
37
+
38
+ ## 开发与测试
39
+
40
+ 本机(Ubuntu 20.04)没有 Tauri 2 需要的 WebKitGTK 4.1,Rust 插件和示例 App 在开发镜像中构建:
41
+
42
+ ```bash
43
+ make sdk-tauri-image # 构建镜像 im/tauri-dev
44
+ make sdk-tauri-test # JavaScript 单元测试;镜像中的 Rust 单元测试和 Windows 交叉检查
45
+ make sdk-tauri-e2e # 先启动 harness(sdk/conformance/README.md),再构建示例 App 并运行端到端测试
46
+ ```
47
+
48
+ - JavaScript 单元测试依赖构建好的 `sdk/web/dist`(`link:../web`),改了 Web SDK 先 `cd sdk/web && pnpm build`。
49
+ - 端到端测试在镜像中启动 Xvfb、会话 D-Bus、GNOME 钥匙环(Secret Service)、dunst(通知服务)和 tauri-driver(WebKitWebDriver);
50
+ 示例 App 从环境变量 `IM_APP_KEY`、`IM_API_URL` 读取服务端(由脚本从 harness 的 `/env` 取得)。
51
+ - Windows 的代码在镜像中以 `x86_64-pc-windows-gnu` 交叉检查编译;macOS 的代码在本机无法编译,要在 Mac 上构建和手工验证(《4.实现与测试》第 7 节)。
52
+
53
+ ## 发布
54
+
55
+ npm 包与 Rust 插件(crate)一起发布,版本号必须相同:
56
+
57
+ ```bash
58
+ ./release.sh 1.0.0-alpha.1 # 同步修改 package.json 与 plugin/Cargo.toml 的版本号,提交并打标签 tauri-v<版本>
59
+ pnpm build && npm publish # npm 包(publishConfig 已设 access: public)
60
+ cd plugin && cargo publish # Rust 插件(发布到 crates.io;权限文件随 crate 分发)
61
+ ```
62
+
63
+ - 依赖通过 peerDependencies 声明(`@deeprespond/im-web`、`@tauri-apps/api`),由接入的 App 安装;`~1.0.0-alpha` 的范围跟随 Web SDK 的版本节奏,Web SDK 与本包同版本号发布。
64
+ - 每次发布附变更说明,标明协议能力的变化和需要的最低服务端版本(《docs/sdk-web/4.实现与测试》第 8 节的约定)。
65
+ - 发布前确认 `make sdk-tauri-test`、`make sdk-tauri-e2e` 通过;macOS 侧(角标、钥匙串)要在 Mac 上构建并手工验证后才发正式版(《4.实现与测试》第 7 节)。
66
+
67
+ ## 独立 RTC 频道
68
+
69
+ 界面客户端提供 `im.channels`,复用 Web SDK 的自建 LiveKit 媒体。引擎转发鉴权 HTTP 请求,界面窗口持有媒体连接,默认不启用采集;隐藏引擎不能加入媒体。窗口销毁、pagehide/freeze 与引擎重启清理本窗口媒体。运行时支持检查不等同于 WebView 设备互通验收。
70
+
71
+ 完整接入与测试边界见 [RTC 多端接入](../../docs/RTC频道/7.多端接入.md)。本地工作区类型检查和测试使用 Web SDK 源码,无需先生成 dist;发布时仍须协调 Web/Tauri 的制品版本。