Skip to content

Commit b363d5a

Browse files
authored
feat(linux): canvas UI via CLI-node + Tauri app IPC bridge (#107633)
* feat(linux): canvas via CLI-node + Tauri app IPC bridge * refactor: extract gateway helper modules * build(linux-canvas): register plugin package in lockfile * fix(linux-canvas): move canvas advertise test out of core, regen docs/protocol/deadcode * fix(gateway): break node-catalog/registry import cycle via leaf normalize module; add canvas glossary term * style: oxfmt invoke.ts and runtime.ts after buildNodeEventParams extraction * fix(linux): load Canvas WebView via dedicated data_directory context Wry's Linux/WebKitGTK incognito mode discards Tauri's registered WebContext (wry webkitgtk/mod.rs), so the Canvas window got a fresh ephemeral context without the openclaw-canvas:// scheme handler — the bundled A2UI page never committed (stayed about:blank) and every A2UI command timed out. Use an isolated cache-backed data_directory instead, which keeps the protocol handler while still isolating Canvas storage from the dashboard window. * fix(linux): keep Canvas WebView ephemeral via incognito + data_directory Autoreview flagged that a dedicated data_directory alone persists Canvas browser state (cookies, localStorage, IndexedDB, service workers) across restarts, so an agent that navigates Canvas to a site could leak an authenticated session into a later session. iOS uses a non-persistent store; Linux should match. Add .incognito(true) alongside .data_directory(): the distinct directory gives Tauri a fresh WebContext key so it still attaches the openclaw-canvas:// protocol closure, and incognito makes Wry swap in a fresh *ephemeral* context carrying those protocols. Live-verified on a Wayland/WebKitGTK box: the bundled page still loads (location.href=openclaw-canvas://localhost/index.html, openclawA2UI present, A2UI renders) and the canvas-webview dir holds no persistent cookie/storage files.
1 parent 85e4a42 commit b363d5a

69 files changed

Lines changed: 2941 additions & 132 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/labeler.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@
228228
- any-glob-to-any-file:
229229
- "apps/linux/**"
230230
- "docs/platforms/linux.md"
231+
- "extensions/linux-canvas/**"
231232
"app: web-ui":
232233
- changed-files:
233234
- any-glob-to-any-file:

‎apps/linux/README.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ cargo build
2626

2727
The app uses `OPENCLAW_DESKTOP_CLI` when set. Otherwise it checks `~/.openclaw/bin/openclaw`, then `openclaw` on `PATH`.
2828

29+
## Canvas bridge
30+
31+
The running app gives the headless `openclaw node run` host a single Canvas WebView. The bundled `linux-canvas` plugin advertises `canvas.*` only while the app socket exists. The app listens at `$XDG_RUNTIME_DIR/openclaw-canvas.sock` (or `/tmp/openclaw-canvas-$UID.sock`) with mode `0600`; a headless Linux node without the app does not advertise Canvas.
32+
33+
The plugin-generated A2UI renderer in `extensions/canvas/src/host/a2ui/` remains the source of truth. The app embeds its committed, synced OpenClawKit mirror from `apps/shared/OpenClawKit/Sources/OpenClawKit/Resources/CanvasA2UI/`. Run `node scripts/sync-native-a2ui.mjs --check` from the repository root after changing those assets.
34+
2935
## Installer resource
3036

3137
`tauri.conf.json` bundles the repository's canonical `scripts/install-cli.sh` directly as `install-cli.sh`. The app never keeps a forked copy. Stable, beta, and dev installs select `latest`, `beta`, and a managed Git `main` checkout respectively, always under `~/.openclaw`.

‎apps/linux/src-tauri/Cargo.lock‎

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎apps/linux/src-tauri/Cargo.toml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ path = "src/main.rs"
1313
tauri-build = "2.6.3"
1414

1515
[dependencies]
16+
base64 = "0.22.1"
17+
cairo-rs = { version = "0.18.5", features = ["png"] }
18+
image = { version = "0.25.10", default-features = false, features = ["jpeg", "png"] }
19+
libc = "0.2.186"
1620
serde = { version = "1.0.228", features = ["derive"] }
1721
serde_json = "1.0.150"
1822
tauri = { version = "2.11.5", features = ["image-png", "tray-icon"] }
23+
webkit2gtk = "2.0.2"

‎apps/linux/src-tauri/build.rs‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
fn main() {
2-
tauri_build::build();
2+
const COMMANDS: &[&str] = &[
3+
"bootstrap",
4+
"canvas_a2ui_action",
5+
"gateway_action",
6+
"install_cli",
7+
];
8+
tauri_build::try_build(
9+
tauri_build::Attributes::new()
10+
.app_manifest(tauri_build::AppManifest::new().commands(COMMANDS)),
11+
)
12+
.expect("Tauri build configuration should be valid");
313
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Automatically generated - DO NOT EDIT!
2+
3+
[[permission]]
4+
identifier = "allow-bootstrap"
5+
description = "Enables the bootstrap command without any pre-configured scope."
6+
commands.allow = ["bootstrap"]
7+
8+
[[permission]]
9+
identifier = "deny-bootstrap"
10+
description = "Denies the bootstrap command without any pre-configured scope."
11+
commands.deny = ["bootstrap"]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Automatically generated - DO NOT EDIT!
2+
3+
[[permission]]
4+
identifier = "allow-canvas-a2ui-action"
5+
description = "Enables the canvas_a2ui_action command without any pre-configured scope."
6+
commands.allow = ["canvas_a2ui_action"]
7+
8+
[[permission]]
9+
identifier = "deny-canvas-a2ui-action"
10+
description = "Denies the canvas_a2ui_action command without any pre-configured scope."
11+
commands.deny = ["canvas_a2ui_action"]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Automatically generated - DO NOT EDIT!
2+
3+
[[permission]]
4+
identifier = "allow-gateway-action"
5+
description = "Enables the gateway_action command without any pre-configured scope."
6+
commands.allow = ["gateway_action"]
7+
8+
[[permission]]
9+
identifier = "deny-gateway-action"
10+
description = "Denies the gateway_action command without any pre-configured scope."
11+
commands.deny = ["gateway_action"]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Automatically generated - DO NOT EDIT!
2+
3+
[[permission]]
4+
identifier = "allow-install-cli"
5+
description = "Enables the install_cli command without any pre-configured scope."
6+
commands.allow = ["install_cli"]
7+
8+
[[permission]]
9+
identifier = "deny-install-cli"
10+
description = "Denies the install_cli command without any pre-configured scope."
11+
commands.deny = ["install_cli"]

0 commit comments

Comments
 (0)