收口H5桌面壳命令入口

共享HostBridge契约导出唯一Tauri命令名

H5原生壳Transport改用共享Tauri命令常量

桌面壳配置检查对齐H5与Rust命令入口

宿主壳方案文档补充Tauri命令入口门禁

共享决策日志记录H5 Tauri命令边界
This commit is contained in:
2026-06-18 14:06:05 +08:00
parent c2dd4424e4
commit 8754269705
7 changed files with 60 additions and 3 deletions
@@ -4,6 +4,7 @@ import { afterEach, describe, expect, test, vi } from 'vitest';
import {
HOST_BRIDGE_PROTOCOL,
HOST_BRIDGE_TAURI_COMMAND,
HOST_BRIDGE_VERSION,
type HostBridgeRequest,
type HostBridgeResponse,
@@ -111,7 +112,7 @@ describe('nativeAppHostBridge', () => {
expect(canUseTauriHostBridge()).toBe(true);
expect(canUseNativeAppHostBridge()).toBe(true);
expect(invoke).toHaveBeenCalledWith('host_bridge_request', {
expect(invoke).toHaveBeenCalledWith(HOST_BRIDGE_TAURI_COMMAND, {
request: expect.objectContaining({
method: 'auth.requestLogin',
}),
@@ -1,5 +1,6 @@
import {
HOST_BRIDGE_PROTOCOL,
HOST_BRIDGE_TAURI_COMMAND,
HOST_BRIDGE_VERSION,
type HostBridgeError,
type HostBridgeEvent,
@@ -233,7 +234,7 @@ export async function requestNativeAppHostBridge<Result = unknown>(
const tauriInvoke = nativeWindow.__TAURI__?.core?.invoke;
if (typeof tauriInvoke === 'function') {
const response = await tauriInvoke<HostBridgeResponse<Result>>(
'host_bridge_request',
HOST_BRIDGE_TAURI_COMMAND,
{ request },
);
if (!isHostBridgeResponse(response)) {