refactor(bridge): type the bridge and harden the websocket and file server

Type every module under bridge/src against a shared types.ts vocabulary and the
protocol payload types; narrow Wand IPC input as unknown instead of any.
Keep the Electron port types out of the CommonJS runtime files, where an export
statement makes esbuild treat the module as ESM and drop module.exports.

Reject unmasked client frames, enforce control-frame length and fragmentation
limits, and echo the peer close code.
Resolve static requests inside the panel root and serve the whole root, not
only assets/.
Ignore value-changed events that name a different trainer.
Validate envelopes through the shared protocol validator.
Bind the renderer destroyed listener once per sender.
Handle https response errors while fetching trainer strings.
Compare installed-app snapshots structurally so no field is missed.
This commit is contained in:
kitbyte
2026-08-29 16:56:45 +03:00
parent e04e313fa3
commit 5d1aa69a97
22 changed files with 758 additions and 502 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
import { PROTOCOL_VERSION } from './contract';
import type { IncomingMessage, OutgoingMessage } from './messages';
import { PROTOCOL_VERSION } from './contract.js';
import type { IncomingMessage, OutgoingMessage } from './messages.js';
const INCOMING_TYPES = new Set<IncomingMessage['type']>([
'hello_ack',