cj-tauri 2.1.0 → 2.1.3

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/README.md CHANGED
@@ -1,19 +1,26 @@
1
1
  # cj-tauri
2
2
 
3
- 用[仓颉语言](https://cangjie-lang.cn)写桌面应用的脚手架 CLI——把 Tauri 的三件套带到仓颉:
4
- 仓颉后端(静态编译)+ 系统 WebView 前端(HTML/CSS/JS),三件套与 Tauri 一致 ——
5
- WebView 宿主、IPC 双向桥(`invoke` / `resolve` / `event`)、能力安全模型(capability 白名单)。
6
-
7
- - 仓库与完整文档:<https://atomgit.com/qq8864/cj-tauri>
8
- - 当前版本:**2.1.0**(本版新增:单窗口多 WebView 内嵌视图与 ai-chat 网页版标签页、`fs:mkdir/rename/copy/stat` 四条命令、
9
- `http` / `sqlite` / `serial` 鸿蒙落地(真机取证)、`system:host` 补通知能力位;详见 CHANGELOG)
10
- - 当前状态:**Windows(WebView2)、Linux(WebKitGTK)与鸿蒙 PC(ArkWeb)均已实机跑通**,
11
- 鸿蒙侧菜单能力位与 fs/mqtt/redis/sqlite/store/http 真机取证通过
12
-
13
- ## 前置条件:仓颉 SDK
14
-
15
- **这个包不替代仓颉 SDK**。应用后端就是仓颉代码,`cj-tauri dev` / `build` 要调用 SDK 里的 `cjc` / `cjpm`
16
- 把你的应用编译出来。所以请先装 SDK(验证版本 **1.2.0**,含 **stdx**),并让本包能找到它:
3
+ A scaffold CLI for building desktop apps in the [Cangjie language](https://cangjie-lang.cn) — it brings
4
+ Tauri's trio to Cangjie: a Cangjie backend (statically compiled) plus a system WebView frontend
5
+ (HTML/CSS/JS), with the same three pieces Tauri has — a WebView host, a bidirectional IPC bridge
6
+ (`invoke` / `resolve` / `event`), and a capability-based security model (capability allowlists).
7
+
8
+ - Repository and full documentation: <https://github.com/yangyongzhen/cj-tauri>
9
+ - Current version: **2.1.3** (new in this release: `scripts/winbuild.sh` now pairs the Windows stdx
10
+ package with the installed `cjc` — a mismatched pair compiles and links fine but aborts at startup,
11
+ and under a GUI subsystem it leaves **no log at all** — plus the `cookie-export` round of Windows
12
+ fixes: `USERPROFILE` fallback for the home directory, an empty cookie filter that reads the whole
13
+ store instead of matching `about:blank`, a borrowed `ICoreWebView2CookieList` that was being
14
+ released, and a cookie reply buffer too small to stay valid JSON)
15
+ - Current status: **Windows (WebView2), Linux (WebKitGTK) and HarmonyOS PC (ArkWeb) all run on real
16
+ hardware**; on the HarmonyOS side the menu capability bit and `fs` / `mqtt` / `redis` / `sqlite` /
17
+ `store` / `http` have been verified on a device
18
+
19
+ ## Prerequisite: the Cangjie SDK
20
+
21
+ **This package does not replace the Cangjie SDK.** Your app backend is Cangjie code, and
22
+ `cj-tauri dev` / `build` invoke the SDK's `cjc` / `cjpm` to compile it. So install the SDK first
23
+ (verified with version **1.2.0**, including **stdx**) and make it discoverable:
17
24
 
18
25
  ```bash
19
26
  # Linux
@@ -23,108 +30,117 @@ export CANGJIE_HOME=/opt/cangjie/cangjie
23
30
  set CANGJIE_HOME=D:\Program Files (x86)\Cangjie
24
31
  ```
25
32
 
26
- 不设 `CANGJIE_HOME` 时,本包会探测常见安装位置(Windows `D:\Program Files (x86)\Cangjie`、
27
- Linux `/opt/cangjie/cangjie`)。另外两个变量视情况给:
33
+ When `CANGJIE_HOME` is unset, the package probes the usual install locations (Windows
34
+ `D:\Program Files (x86)\Cangjie`, Linux `/opt/cangjie/cangjie`). Three more variables are needed
35
+ in some situations:
28
36
 
29
- | 变量 | 什么时候需要 |
37
+ | Variable | When you need it |
30
38
  |---|---|
31
- | `CJ_TAURI_ROOT` | 不在 cj-tauri 仓库内运行、又找不到框架根目录时(`create` 要把框架路径写进工程) |
32
- | `CANGJIE_STDX` | 应用的 `cjpm.toml` 用 `${CANGJIE_STDX}` 展开 stdx 路径;本包会从框架/工程的 toml 里探测,探不到就照此变量 |
33
- | `CANGJIE_STDX_OHOS` | 只在构建鸿蒙工程时用(鸿蒙版 stdx,`build-hap.sh` 按它找动态库) |
39
+ | `CJ_TAURI_ROOT` | Running outside the cj-tauri repo when the framework root can't be located (`create` writes the framework path into your project) |
40
+ | `CANGJIE_STDX` | Your app's `cjpm.toml` expands the stdx path via `${CANGJIE_STDX}`; the package probes the framework/project toml for it and falls back to this variable |
41
+ | `CANGJIE_STDX_OHOS` | Only when building a HarmonyOS project (the HarmonyOS build of stdx; `build-hap.sh` locates its dynamic libraries through it) |
34
42
 
35
- 装好后自检:
43
+ Self-check once it's installed:
36
44
 
37
45
  ```bash
38
- npx cj-tauri info # 打印框架 / 项目 / stdx / SDK / cjpm / C 桥 的解析结果
46
+ npx cj-tauri info # prints the resolved framework / project / stdx / SDK / cjpm / C bridge
39
47
  ```
40
48
 
41
- 没装 SDK 时本包会直接给出提示与安装说明,而不是抛一句 `cjpm: command not found`。
42
- 另外 `npx cj-tauri --version` 不需要 SDK 也能查版本。
49
+ Without the SDK the package prints a clear hint and install instructions instead of throwing
50
+ `cjpm: command not found`. Note that `npx cj-tauri --version` works without the SDK.
43
51
 
44
- ## 用法
52
+ ## Usage
45
53
 
46
54
  ```bash
47
- npx cj-tauri create myapp --template app # 内联 HTML,零 Node(缺省模板)
55
+ npx cj-tauri create myapp --template app # inline HTML, zero Node (the default template)
48
56
  cd myapp
49
- npx cj-tauri sync # 按清单派生 targets/ 骨架(首次;重跑幂等)
50
- npx cj-tauri dev # 构建 C 桥 + cjpm build + 启动窗口
57
+ npx cj-tauri sync # derive the targets/ skeletons from the manifest (first run; idempotent)
58
+ npx cj-tauri dev # build the C bridge + cjpm build + open the window
51
59
 
52
- npx cj-tauri create myapp-vue --template vue # Vue 3 + Vite(前端工程在 assets/ui/)
60
+ npx cj-tauri create myapp-vue --template vue # Vue 3 + Vite (frontend project under assets/ui/)
53
61
  npx cj-tauri create myapp-react --template react # React 18 + Vite
54
62
 
55
- npx cj-tauri create myohos --template ohos # 鸿蒙 PC:同一份业务代码 + targets/ohos
56
- npx cj-tauri create myohos --template ohos --bundle com.example.myapp --label "我的应用"
63
+ npx cj-tauri create myohos --template ohos # HarmonyOS PC: same business code + targets/ohos
64
+ npx cj-tauri create myohos --template ohos --bundle com.example.myapp --label "My App"
57
65
 
58
- npm i -g cj-tauri # 也可以全局安装,之后直接用 cj-tauri <子命令>
66
+ npm i -g cj-tauri # or install globally and call cj-tauri <subcommand> directly
59
67
  ```
60
68
 
61
- **一份业务代码,骨架按目标派生**——`create` 只生成清单与业务侧,平台骨架是 `sync` 的产物:
69
+ **One body of business code, skeletons derived per target** — `create` only generates the manifest and
70
+ the business side; the platform skeletons are what `sync` produces:
62
71
 
63
72
  ```
64
73
  myapp/
65
- ├── cj-tauri.toml # 应用清单——单一真相(id/version/窗口/资产/能力目录)
66
- ├── cjpm.toml # 业务包(static 库;骨架以 path 依赖引用)
67
- ├── src/main.cj # 业务装配点 build(): AppSpec(零平台知识)
74
+ ├── cj-tauri.toml # app manifest — the single source of truth (id/version/window/assets/capability dir)
75
+ ├── cjpm.toml # business package (a static library; skeletons reference it by path)
76
+ ├── src/main.cj # business assembly point build(): AppSpec (zero platform knowledge)
68
77
  ├── assets/
69
- │ ├── ui/index.html # 前端页面(任意 Web 技术栈)
70
- │ └── capabilities/default.json # 能力白名单(命令 / 事件 / 权限集)
71
- └── targets/ # cj-tauri sync 生成(勿手改;check 判漂移)
72
- ├── desktop/ # 桌面可执行(launcher 调 build())
73
- └── ohos/ # 鸿蒙 hap 工程(DevEco + build-hap.sh)
78
+ │ ├── ui/index.html # frontend page (any web stack)
79
+ │ └── capabilities/default.json # capability allowlist (commands / events / permission sets)
80
+ └── targets/ # generated by cj-tauri sync (don't hand-edit; check reports drift)
81
+ ├── desktop/ # desktop executable (the launcher calls build())
82
+ └── ohos/ # HarmonyOS hap project (DevEco + build-hap.sh)
74
83
  ```
75
84
 
76
- | 子命令 | 作用 |
85
+ | Subcommand | What it does |
77
86
  |---|---|
78
- | `create <项目名> [--template app\|vue\|react\|ohos]` | 生成统一工程(清单 + `src/` + `assets/`);`--bundle` / `--label` 只对 `ohos` 模板有意义,缺省由项目名推导 |
79
- | `sync [desktop\|ohos]` | 按清单派生 `targets/` 骨架(缺省两端都派生;幂等重跑) |
80
- | `dev` | 构建 C 桥 + `cjpm build` + 启动应用;Vite 模板会接管 dev server(HMR) |
81
- | `build` | 构建 C 桥 + `cjpm build`;鸿蒙端在 `targets/ohos` 里 `bash build-hap.sh` |
82
- | `run` | 运行已构建产物;鸿蒙端 `bash build-hap.sh --install`(构建 + 装机 + 拉起) |
83
- | `check` | 校验 `cj-tauri.toml`(id / 窗口 / 资产存在)+ `targets/` 骨架漂移 + 插件三方比对 |
84
- | `info [--json]` | 环境自检(排障先跑它);`--json` 只输出插件清单,机器可读 |
85
- | `doctor` | 环境自检逐行给结论(每条自带「缺了就怎么办」) |
86
- | `help` | 帮助 |
87
-
88
- ## 鸿蒙 PC(`--template ohos`)
89
-
90
- 同一套框架换个宿主:桌面用 WebView2 / WebKitGTK,鸿蒙 PC 用 **ArkWeb**,上层页面、命令层、能力校验不用改。
91
- `--template ohos` 生成的仍是那种**统一工程**(`cj-tauri.toml` + `src/` + `assets/`),只是清单里带鸿蒙端信息
92
- (`[app] id` 就是 `bundleName`);DevEco 工程是 `sync` 的产物,落在 `targets/ohos/`:
87
+ | `create <name> [--template app\|vue\|react\|ohos]` | Generate the unified project (manifest + `src/` + `assets/`); `--bundle` / `--label` only matter for the `ohos` template, otherwise they're derived from the project name |
88
+ | `sync [desktop\|ohos]` | Derive the `targets/` skeletons from the manifest (both ends by default; idempotent) |
89
+ | `dev` | Build the C bridge + `cjpm build` + launch the app; Vite templates take over their dev server (HMR) |
90
+ | `build` | Build the C bridge + `cjpm build`; on HarmonyOS run `bash build-hap.sh` inside `targets/ohos` |
91
+ | `run` | Run the built artifact; on HarmonyOS `bash build-hap.sh --install` (build + install + launch) |
92
+ | `check` | Validate `cj-tauri.toml` (id / window / assets present) + `targets/` skeleton drift + three-way plugin comparison |
93
+ | `info [--json]` | Environment self-check (run this first when troubleshooting); `--json` prints only the plugin manifest, machine-readable |
94
+ | `doctor` | Environment self-check with a verdict per line (each line says what to do if it's missing) |
95
+ | `help` | Help |
96
+
97
+ ## HarmonyOS PC (`--template ohos`)
98
+
99
+ The same framework with a different host: desktop uses WebView2 / WebKitGTK, HarmonyOS PC uses **ArkWeb**,
100
+ while the page layer, the command layer and capability validation stay untouched. `--template ohos` still
101
+ generates that **unified project** (`cj-tauri.toml` + `src/` + `assets/`), only the manifest carries the
102
+ HarmonyOS side (`[app] id` is the `bundleName`); the DevEco project is a product of `sync`, landing in
103
+ `targets/ohos/`:
93
104
 
94
105
  ```bash
95
- npx cj-tauri create myohos --template ohos --bundle com.example.myapp --label "我的应用"
106
+ npx cj-tauri create myohos --template ohos --bundle com.example.myapp --label "My App"
96
107
  cd myohos
97
- npx cj-tauri sync ohos # 派生 targets/ohos(DevEco 骨架 + rawfile 里的页面与能力清单)
108
+ npx cj-tauri sync ohos # derive targets/ohos (DevEco skeleton + the page and capability manifest in rawfile)
98
109
  cd targets/ohos
99
- bash build-hap.sh --install # 构建 hap + hdc 装机 + aa start
110
+ bash build-hap.sh --install # build the hap + install via hdc + aa start
100
111
  ```
101
112
 
102
- `targets/ohos/` 是标准 DevEco 工程(`entry/` + `AppScope/` + `build-profile.json5` + `hvigorfile.ts`),
103
- 鸿蒙相关的那层很薄:
113
+ `targets/ohos/` is a standard DevEco project (`entry/` + `AppScope/` + `build-profile.json5` +
114
+ `hvigorfile.ts`), and the HarmonyOS-specific layer is thin:
104
115
 
105
- | 路径 | 作用 |
116
+ | Path | Purpose |
106
117
  |---|---|
107
- | `entry/src/main/cangjie/main_ability.cj` | UIAbility:`ArkWebRuntime.configure(filesDir)` → 非 UI 线程 `spawn { run() }` → 等宿主登记再 `loadContent` |
108
- | `entry/src/main/cangjie/app_host.cj` | `@Component` 的 ArkWeb 宿主 + 双向桥(**必须住应用模块**,框架包引用 ArkUI 会启动即崩);调你 `assets/` 里那份业务 `build()` |
109
- | `entry/src/main/resources/rawfile/` | `index.html` 与能力清单(从 `assets/` 拷进来的真文件) |
110
- | `build-hap.sh` | 唯一构建入口:探测 DevEco / stdx、`--no-daemon` 跑 hvigor、可选 `--install` |
118
+ | `entry/src/main/cangjie/main_ability.cj` | UIAbility: `ArkWebRuntime.configure(filesDir)` → `spawn { run() }` off the UI thread → wait for the host to register, then `loadContent` |
119
+ | `entry/src/main/cangjie/app_host.cj` | the `@Component` ArkWeb host + bidirectional bridge (**must live in the app module**; a framework package referencing ArkUI crashes at startup); calls the business `build()` in your `assets/` |
120
+ | `entry/src/main/resources/rawfile/` | `index.html` and the capability manifest (real files copied in from `assets/`) |
121
+ | `build-hap.sh` | the single build entry: probes DevEco / stdx, runs hvigor with `--no-daemon`, optional `--install` |
111
122
 
112
- 前置两件事:
123
+ Two prerequisites:
113
124
 
114
- - **DevEco Studio 6.1**(含仓颉插件)+ 已配好签名。`build-hap.sh` 用 `DEVECO_WIN` 找安装根
115
- (默认 `D:\oh\DevEcoStudio`),用 `CANGJIE_STDX_OHOS` 找鸿蒙版 stdx 动态库;两者给不出时脚本会直接说清楚缺哪个。
116
- - 真机开着**开发者模式 + USB 调试**,`hdc` 能列到设备;`aa start` 需要**屏幕已解锁**。
125
+ - **DevEco Studio 6.1** (with the Cangjie plugin) and signing already configured. `build-hap.sh` finds the
126
+ install root via `DEVECO_WIN` (default `D:\oh\DevEcoStudio`) and the HarmonyOS build of stdx's dynamic
127
+ libraries via `CANGJIE_STDX_OHOS`; when either is missing the script says exactly which one.
128
+ - A device with **developer mode + USB debugging** on, so `hdc` lists it; `aa start` needs the **screen unlocked**.
117
129
 
118
- 工程默认是桌面形态:`module.json5` 的 `deviceTypes` 写 `2in1`,并在 `entry/build-profile.json5` 里
119
- `cangjieOptions.checkDeviceTypes = false`(插件默认只放行 `phone` / `tablet`,写 `2in1` 会判 `01103012`);
120
- 窗口**不干预尺寸**,沿用系统给的默认矩形(实测本机 `2090×1394`,约屏宽 2/3 且居中)。
130
+ The project defaults to desktop form factor: `deviceTypes` in `module.json5` is `2in1`, and
131
+ `cangjieOptions.checkDeviceTypes = false` in `entry/build-profile.json5` (the plugin only allows
132
+ `phone` / `tablet` by default, and writing `2in1` fails with `01103012`). The window **does not touch the
133
+ size** and keeps the system default rectangle (measured at `2090×1394`, about two thirds of the screen
134
+ width and centered).
121
135
 
122
- 已知限制:签名要在 DevEco 里配(命令行不做自动签名,换 `bundleName` 需重新签);同一份调试签名下两个
123
- 工程会互相顶掉安装位;单窗口、暂无原生对话框(那两条能力位如实返回 0);没有可用的 C 桥,
124
- `launchHidden` / 串口 / 托盘这类宿主能力在鸿蒙上不提供。改完 `assets/` 里的页面或能力清单要重跑
125
- `cj-tauri sync ohos`(`targets/` 是生成物,`check` 会报漂移)。
136
+ Known limitations: signing is configured in DevEco (the command line does not auto-sign, and changing the
137
+ `bundleName` requires re-signing); two projects under the same debug signature evict each other's install;
138
+ single window with no native dialogs yet (those two capability bits honestly return 0); there is no usable
139
+ C bridge, so host capabilities like `launchHidden` / serial / tray are not available on HarmonyOS. After
140
+ editing pages or the capability manifest under `assets/`, re-run `cj-tauri sync ohos` (`targets/` is
141
+ generated, and `check` reports it as drift).
126
142
 
127
- 真机上怎么自证它通了(hilog,`CjTauri` tag):
143
+ How to prove it works on a device (hilog, `CjTauri` tag):
128
144
 
129
145
  ```
130
146
  host registered after N polls label=main
@@ -133,42 +149,114 @@ page begin label=main
133
149
  main window keeps system default 2090x1394 px at density 190% on screen 3120x2080
134
150
  ```
135
151
 
136
- ## 这个包装层做了什么
137
-
138
- - **跨平台入口**:Windows / Linux / Git Bash 都是同一条 `cj-tauri` 命令,不再分 `.bat` 与 `.sh`;
139
- - **环境自检**:`cjpm` 与 SDK 运行时库的定位、`PATH` / `LD_LIBRARY_PATH` 的拼装都在这里完成;
140
- - **CLI 本体的获取**:优先用包内预编译二进制(`prebuilt/<平台-架构>/`),没有则把 CLI 源码拷到
141
- `~/.cache/cj-tauri/<版本>/` 下用本机 `cjpm build` 一次并缓存 —— 不往安装目录写产物,避免全局安装只读;
142
- - **数据目录**:Linux 用 `$XDG_CACHE_HOME/cj-tauri`(默认 `~/.cache/cj-tauri`),Windows 用 `%LOCALAPPDATA%\cj-tauri`。
143
-
144
- 已知限制:首次 `dev` / `build` 会把 C 桥构建到**框架目录的 `native/`** 下(应用 `cjpm.toml` 的
145
- 链接参数指向那里),所以包安装目录需要可写;如果装在只读路径下,请改用仓库内运行方式。
146
-
147
- ## 2.1.0 变更
148
-
149
- - **新增**:单窗口多 WebView 内嵌视图(`webview:*`,一个窗口内挂多个页面视图、LRU 上限 4 枚,
150
- ai-chat 的九家网页版标签页即由它驱动);`fs:mkdir` / `fs:rename` / `fs:copy` / `fs:stat` 四条命令
151
- (带 overwrite 与双路径 scope 校验);`http` 插件鸿蒙传输层(走 `ohos.net.http` 系统栈,https 恢复可用);
152
- `sqlite` / `serial` 鸿蒙落地;`system:host` 补 `notification` 能力位;CLI `doctor` 补 SDK 下载指路。
153
- - **修复**:Linux C 桥 `duplicate member 'h'` 编译错误(内嵌视图的几何字段与宿主指针撞名)、
154
- `ai-chat` 收起侧栏后内嵌视图不跟随变宽、鸿蒙宿主能力位文档口径(菜单位已真机取证,不再是全 0)。
155
- - 鸿蒙侧真机取证:`fs` / `mqtt` / `redis` / `sqlite` / `store` / `http` 与菜单能力位。
156
-
157
- 完整变更见仓库的 `CHANGELOG.md` 的 `[2.1.0] - 2026-10-25`。
158
-
159
- ## 2.0.0 变更
160
-
161
- - **不兼容**:删除已失效的公开 API `setHostFactory` / `requireInjectedHost`(框架侧单槽宿主注入)。
162
- 源码里仍在调用它们的应用会编译失败——那些调用本来也不生效(`requireInjectedHost` 没有任何调用方)。
163
- 多宿主注入走 `registerHost(HostProvider)`(带优先级),鸿蒙宿主已内置。
164
- - **修复**:`sync` 生成的工程在 Windows 上编不过(TOML 路径保留反斜杠触发 `errLexEscape`、鸿蒙 entry 的
165
- `compile-option` 内层引号未转义、生成源码里 `url=\"…\"` 少一层转义);`cj-tauri check` 的三方比对在
166
- Windows 上因产物名 `main.exe` 恒被跳过;示例 `modbus-poll` 缺串口插件 import。
167
- - **门禁**:版本校验从五处扩到六处(新增官网 `website/index.html`),并给与 `docs/` 同源的图片 / 图
168
- 加上了逐字节比对——官网是独立拷贝、此前不在门禁里,正是它漏更的根因。
169
-
170
- 完整变更见仓库的 `CHANGELOG.md` 的 `[2.0.0] - 2026-10-23`。
152
+ ## What this wrapper layer does
153
+
154
+ - **One cross-platform entry point**: Windows / Linux / Git Bash all use the same `cj-tauri` command, with
155
+ no more separate `.bat` and `.sh`;
156
+ - **Environment self-check**: locating `cjpm` and the SDK runtime libraries, and assembling `PATH` /
157
+ `LD_LIBRARY_PATH`, all happen here;
158
+ - **Obtaining the CLI itself**: the packaged prebuilt binary is preferred (`prebuilt/<platform-arch>/`);
159
+ otherwise the CLI sources are copied to `~/.cache/cj-tauri/<version>/`, built once with the local
160
+ `cjpm build` and cached — nothing is written into the install directory, so a global install can stay
161
+ read-only;
162
+ - **Data directories**: `$XDG_CACHE_HOME/cj-tauri` on Linux (default `~/.cache/cj-tauri`),
163
+ `%LOCALAPPDATA%\cj-tauri` on Windows.
164
+
165
+ Known limitation: the first `dev` / `build` builds the C bridge into the **framework directory's `native/`**
166
+ (that's where the app's `cjpm.toml` link options point), so the package install directory must be writable;
167
+ if you installed under a read-only path, run from inside the repository instead.
168
+
169
+ ## Changes in 2.1.3
170
+
171
+ - **Windows single-file builds use the cjc-matched stdx**: `scripts/winbuild.sh` defaulted to the
172
+ `1.0.5.1` Windows stdx while `cjc` was `1.2.0`. That pair builds, links and ships, but the app
173
+ aborts at startup — and with `--subsystem=windows` stderr is not connected, so double-clicking a
174
+ broken exe produced **no log whatsoever**. The default now points at the matched package
175
+ (log line `[winbuild] cjc 1.2.0 + windows stdx 1.2.0.1`) and a guard refuses to build when the
176
+ major/minor versions differ.
177
+ - `examples/cookie-export` Windows fixes: `homeDir()` falls back to `USERPROFILE` (and only wins when
178
+ the directory really exists), an empty cookie filter reads the whole store instead of matching the
179
+ `about:blank` URL, the borrowed `ICoreWebView2CookieList` is no longer released (it crashed the
180
+ WebView2 process with `0xc0000005`), and the cookie reply buffer is large enough to stay valid JSON.
181
+
182
+ For the full list see `[2.1.3] - 2026-11-06` in the repository's `CHANGELOG.md`.
183
+
184
+ ## Changes in 2.1.2
185
+
186
+ - **Native CookieManager bridge**: `WebViewHost.cookiesJson(filter)` (C side `cj_bridge_get_cookies`)
187
+ returns the whole cookie store as `{"ok":true,"cookies":[…]}` — `webkit_cookie_manager_get_all_cookies`
188
+ on Linux, `ICoreWebView2_2::getCookieManager` + `GetCookies` on Windows. Embedded page views share the
189
+ host's WebKit context / WebView2 environment, so **httpOnly** session cookies (`z_c0`, `sessionid`,
190
+ `UserToken`) are readable — the ones `document.cookie` can never see. Blocking on the outside,
191
+ asynchronous on the inside: the platform layer posts the read to the UI thread and the caller waits
192
+ with a timeout, reporting `ok=false` with a reason instead of hanging.
193
+ - New `examples/cookie-export` app: embedded login for 5 platforms (CSDN / Zhihu / Juejin / OSChina /
194
+ Baijiahao), field validation against cspub's hard requirements, and export in both formats
195
+ (`~/.cspub/config.json` merged — other platforms' keys are preserved — plus `~/.cspub/cookie_<platform>`
196
+ at mode 600). Ships with 8 unit tests covering bridge-reply parsing, domain filtering, header assembly,
197
+ required-field checks and the merge-write.
198
+ - **Fixed** the `GLib-GObject-CRITICAL: g_object_unref: assertion 'G_IS_OBJECT (object)' failed` printed
199
+ on every bridge round-trip on Linux: `on_js_done` used the deprecated `webkit_web_view_run_javascript`,
200
+ whose finished result must not be unreffed as a `GObject` on WebKitGTK 2.52. Switched to
201
+ `evaluate_javascript` (`JSCValue`, transfer full) — warning gone, bridge builds warning-free.
202
+
203
+ ## Changes in 2.1.1
204
+
205
+ - **Serial command groups** (issue #6-4): `IpcHub.registerSerial(cmd, handler, group)` /
206
+ `TauriApp.registerSerial` — commands in the same group execute strictly in **arrival order**,
207
+ while other groups and plain commands keep the concurrent semantics. Guaranteed by structure:
208
+ dispatch happens on the bridge's message-callback thread, so enqueue order is arrival order,
209
+ and each group has a single worker draining the queue under one lock. ai-chat's five web-tab
210
+ commands are enrolled in the `webtab` group (the front-end queue stays — page emission order
211
+ and host execution order are two halves of the same guarantee).
212
+ - **sync keeps the launcher on the business package's framework path** (issue #6-1): the launcher's
213
+ `cjTauri` dependency now reads the path the business package declares in its own `cjpm.toml`
214
+ (relative paths absolutized against the project root), so editing that path no longer causes
215
+ a cjpm module conflict between two framework copies.
216
+ - **The desktop launcher locates its assets** (issue #6-2/3): `assets/` and `capabilities/` are
217
+ found by walking up two levels, so running the binary straight from `targets/desktop/` no longer
218
+ dies with "asset not found"; sync's next-steps output names the runtime library path
219
+ (`<framework>/native` for `libcjtbridge.so`).
220
+ - New `examples/hello-world` (smallest runnable app, generated by this CLI) and
221
+ `docs/hello-world-入门教程.md` — a starter guide written from an actual npx-create-to-window run.
222
+
223
+ For the full list see `[2.1.2] - 2026-11-05` in the repository's `CHANGELOG.md`.
224
+
225
+ ## Changes in 2.1.0
226
+
227
+ - **New**: in-window multi-WebView views (`webview:*` — several page views inside one window with an LRU
228
+ cap of 4, which is what drives ai-chat's nine web-version tabs); the four commands `fs:mkdir` /
229
+ `fs:rename` / `fs:copy` / `fs:stat` (with overwrite and two-path scope validation); the `http` plugin's
230
+ HarmonyOS transport layer (over the `ohos.net.http` system stack, which brings https back); `sqlite` /
231
+ `serial` landing on HarmonyOS; a `notification` capability bit in `system:host`; a pointer to the SDK
232
+ download in the CLI's `doctor`.
233
+ - **Fixed**: the Linux C bridge `duplicate member 'h'` compile error (the embedded view's geometry field
234
+ collided with the host pointer), ai-chat's embedded view not following the widening after the sidebar
235
+ collapses, and the documented state of the HarmonyOS host capability bits (the menu bit is verified on a
236
+ device, so it's no longer all zeros).
237
+ - Verified on a HarmonyOS device: `fs` / `mqtt` / `redis` / `sqlite` / `store` / `http` and the menu
238
+ capability bit.
239
+
240
+ For the full list see `[2.1.0] - 2026-10-25` in the repository's `CHANGELOG.md`.
241
+
242
+ ## Changes in 2.0.0
243
+
244
+ - **Breaking**: removed the dead public APIs `setHostFactory` / `requireInjectedHost` (the framework's
245
+ single-slot host injection). Apps still calling them will fail to compile — and those calls never took
246
+ effect anyway (`requireInjectedHost` had no callers at all). Multi-host injection goes through
247
+ `registerHost(HostProvider)` (with priorities); the HarmonyOS host is built in.
248
+ - **Fixed**: projects generated by `sync` wouldn't compile on Windows (TOML paths keeping backslashes
249
+ triggered `errLexEscape`, the HarmonyOS entry's `compile-option` had unescaped inner quotes, and
250
+ `url=\"…\"` in the generated sources was one escape level short); `cj-tauri check`'s three-way
251
+ comparison was always skipped on Windows because of the `main.exe` artifact name; the `modbus-poll`
252
+ example was missing the serial plugin import.
253
+ - **Gates**: version validation grew from five sites to six (adding the website's `website/index.html`),
254
+ and the images / diagrams that share a source with `docs/` now get a byte-for-byte comparison — the
255
+ website is an independent copy that previously sat outside the gate, which is exactly why it went stale.
256
+
257
+ For the full list see `[2.0.0] - 2026-10-23` in the repository's `CHANGELOG.md`.
171
258
 
172
259
  ## License
173
260
 
174
- [MIT](https://atomgit.com/qq8864/cj-tauri/blob/main/LICENSE) © 2026 yangyongzhen
261
+ [MIT](https://github.com/yangyongzhen/cj-tauri/blob/main/LICENSE) © 2026 yangyongzhen
262
+
package/cjpm.toml CHANGED
@@ -2,7 +2,7 @@
2
2
  cjc-version = "1.0.5"
3
3
  name = "cjTauri"
4
4
  description = "仓颉版 Tauri:轻量跨端混合开发框架(WebView 宿主 + IPC 桥 + 能力安全模型)"
5
- version = "2.1.0"
5
+ version = "2.1.3"
6
6
  target-dir = ""
7
7
  output-type = "static"
8
8
  compile-option = ""
package/cli/cjpm.toml CHANGED
@@ -2,7 +2,7 @@
2
2
  cjc-version = "1.0.5"
3
3
  name = "cli"
4
4
  description = "cj-tauri CLI:脚手架 create / dev / build / run / info"
5
- version = "2.1.0"
5
+ version = "2.1.3"
6
6
  target-dir = ""
7
7
  output-type = "executable"
8
8
  compile-option = ""
@@ -366,13 +366,24 @@ public class Manifest {
366
366
  "import cjTauri.*\n" +
367
367
  "import cjTauri.platform.*\n" +
368
368
  "import " + this.pkg + ".*\n" +
369
+ "import std.fs.*\n" +
370
+ "\n" +
371
+ "// assets/ 与 capabilities/ 按启动时工作目录相对读取;从 targets/<端>/ 直接启动会找不到\n" +
372
+ "//(issue #6-②,实测「资产未找到」秒退)——向上探两级回到项目根;都找不到就原样返回,\n" +
373
+ "// 让框架按自己的口径报错。\n" +
374
+ "func findDir(rel: String): String {\n" +
375
+ " if (exists(rel)) { return rel }\n" +
376
+ " if (exists(\"../\" + rel)) { return \"../\" + rel }\n" +
377
+ " if (exists(\"../../\" + rel)) { return \"../../\" + rel }\n" +
378
+ " return rel\n" +
379
+ "}\n" +
369
380
  "\n" +
370
381
  "main(): Int64 {\n" +
371
382
  " let spec = build()\n" +
372
383
  " .page(PageSource.Asset(\"" + this.page + "\"))\n" +
373
384
  " .window(WindowConfig(\"${w.title}\", ${w.width}, ${w.height}))\n" +
374
- " .assets(DirectoryAssetResolver(\"" + this.assetsRoot + "\"))\n" +
375
- " .capabilities(\"" + this.capabilitiesDir + "\")\n" +
385
+ " .assets(DirectoryAssetResolver(findDir(\"" + this.assetsRoot + "\")))\n" +
386
+ " .capabilities(findDir(\"" + this.capabilitiesDir + "\"))\n" +
376
387
  " launch(spec)\n" +
377
388
  " return 0\n" +
378
389
  "}\n"
@@ -10,7 +10,7 @@ import std.collection.*
10
10
 
11
11
  /** CLI 版本:须与 cli/cjpm.toml 的 version、CHANGELOG 顶部版本一致(scripts/check-version.sh 校验) */
12
12
  func cliVersion(): String {
13
- return "2.1.0"
13
+ return "2.1.3"
14
14
  }
15
15
 
16
16
  /** 一次命令所需的路径上下文 */