Bridge Remote keys to typed reader IPC and record checks

This commit is contained in:
ak47 committed 2026-11-05 21:28:53 -05:00
1 parent 76993ecbfa
commit 0086b8987a
8 files changed
+169 -11

No files matched your search

+31 -4
View File
@@ -3,9 +3,10 @@
`src/keyboard.go` supplies an isolated, bidirectional conversion between XKB
keysym names and NVDA Remote `vk_code`/`extended` identities. The subsequent
`src/keyboard_state.go` adds outgoing key-pair planning with bounded state and
write acknowledgements. Neither helper captures, forwards or injects keys.
The source command still discards incoming keyboard payloads and requests no
keyboard grant. No reader code changed for either increment.
write acknowledgements. A further reader increment adds typed `remote.key` IPC
and an explicitly attached mailbox, with the external conversion bridge in
`src/keyboard_bridge.go`. The source command still discards incoming keyboard
payloads and requests no keyboard grant. No production input owner is attached.
## Mapping contract
@@ -89,10 +90,34 @@ encoder is not safe for concurrent mutation; its future owner must serialize
events, acknowledgements and retirement. It has no automatic retry, consent,
capture acquisition or native recovery mechanism.
## Incoming reader IPC
`reader_key` converts an understood relay key through the selected immutable
map to the public SDK's canonical `RemoteKey` identity and press state. Unknown,
ambiguous and unsupported payloads return a constant error and no partial key.
It does not add origin metadata, queue work or open a lease. Every canonical
portable/US mapper result is checked against the SDK representation in tests.
The reader's [typed keyboard contract](../../cthulhu/docs/tentacle-remote-keyboard.md)
now supplies `RemoteKeyRequest` and `remote.key`. The host checks the original
process, controlled role, `keyboard-inject` consent, deadline and shared operation
sequence. An explicitly attached reader owner receives a bounded 256-item,
256-KiB mailbox; admission includes in-flight accounting until idempotent
release. Overflow revokes the lease and drains pending input. Revoke, close,
replacement, expiry, policy cancellation, disable and host failure invalidate
accepted work. Stale owner releases cannot affect replacement capacity.
No production reader owner calls `EnableRemoteKeys`, so ordinary sessions return
owner-unavailable. The bridge is not attached to the live coordinator, and a
successful test mailbox admission is not native injection completion. Captured
key events, native key ownership, input recovery and live acceptance remain
unfinished. Both SDK process fixtures exercise the mailbox with synthetic keys;
they never inject into a desktop.
## Integration boundaries
These helpers have no callers in the live coordinator. Before connecting them to
keyboard services, the reader must provide exclusive capture, trusted routing,
production keyboard services, the reader must provide exclusive capture, trusted routing,
delivery-time lease checks, a core escape and independent injection cleanup.
The encoder supplies original wire key-pair identity, but the reader still
must own actual capture/injection and the destination key ledger. Mapping
@@ -133,6 +158,8 @@ A closed pipe verifies failed release writes retain cleanup ownership. A private
TLS relay receives planned downs, repeats, original-key ups and post-collision
cleanup in order. These checks exercise the production frame codec/transport
without attaching the encoder to the live coordinator or to desktop services.
The reader-host and both SDK process checks now cover typed incoming key IPC;
see the linked reader contract for the ownership and delivery boundary.
The VK values and layout dependence were checked against Microsoft's
[virtual-key reference](https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes).