src/client/client_core_wasm_check.zig
Ref: Size: 1.2 KiB History
const client_core = @import("client_core.zig");
/// Compile-only canary: keep a real typed mode receive call in the wasm
/// build, without exporting or embedding this check in the hub.
export fn clientCoreWasmModesCheck() void {
var core = client_core.ClientCore{};
const payload = [_]u8{ 1, 0, 0, 0 };
const result = core.receive(.term_modes, &payload);
switch (result) {
.state => |state| switch (state) {
.terminal_modes => |modes| if (!modes.bracketed_paste) unreachable,
},
else => unreachable,
}
}
/// Compile-only canary for clipboard event decoding and validation. The
/// payload exercises the accepted target and alphabet through the public API.
export fn clientCoreWasmClipboardCheck() void {
var core = client_core.ClientCore{};
const payload = [_]u8{ 0, 'c', 'A', 'B', '0', '1', '2', '9', '+', '/', '=' };
const result = core.receive(.term_event, &payload);
switch (result) {
.effect => |effect| switch (effect) {
.clipboard_set => |set| {
if (set.target != 'c' or set.base64.len != 9) unreachable;
},
else => unreachable,
},
else => unreachable,
}
}