Skip to content

feat(windows): add HyperHQ launcher and bridge plugin#806

Open
wizzomafizzo wants to merge 3 commits into
mainfrom
feat/windows-hyperhq-launcher
Open

feat(windows): add HyperHQ launcher and bridge plugin#806
wizzomafizzo wants to merge 3 commits into
mainfrom
feat/windows-hyperhq-launcher

Conversation

@wizzomafizzo
Copy link
Copy Markdown
Member

@wizzomafizzo wizzomafizzo commented May 10, 2026

  • Adds a HyperHQ launcher to the Windows platform. Core hosts a named pipe at \\.\pipe\zaparoo-hyperhq-ipc and exchanges JSON-line messages with a separate bridge plugin under scripts/windows/hyperhq-plugin/ that HyperHQ runs as a Socket.IO plugin per the HyperAI plugin API.
  • Two wire formats: pipe (Core ↔ bridge) is internal PascalCase JSON; HyperHQ Socket.IO (bridge ↔ HyperHQ) is camelCase per the API. The bridge handles challenge-response auth, plugin:register, subscribeEvents, requestData/dataResponse routing by requestId, and the hyperHqEvent envelope (gameLaunched / gameClosed).
  • Bridge module is exempt from forbidigo and depguard so it can use stdlib sync and log without pulling Zaparoo Core internals into its dep tree. Linted via task cross-lint:windows since winio is Windows-only.

Summary by CodeRabbit

  • New Features

    • Windows HyperHQ integration: discover games, map systems, and launch via local HyperHQ bridge.
    • Support for the hyperhq:// URI scheme.
  • Bug Fixes

    • Improved connection handling to avoid writes when plugin bridge is disconnected.
  • Chores

    • Added build pipeline and Docker build for the Windows HyperHQ plugin.
    • Updated linting configuration and task comments/toolchain version.
  • Tests

    • Extensive tests covering HyperHQ protocol, pipe server, launcher behavior, and large payload handling.

Review Change Stack

Adds a HyperHQ launcher to the Windows platform. Zaparoo Core hosts a
named pipe at \\.\pipe\zaparoo-hyperhq-ipc and exchanges JSON-line
messages with a bridge plugin (separate Go module under
scripts/windows/hyperhq-plugin/) that HyperHQ launches as a Socket.IO
plugin per the API at https://docs.hyperai.io/docs/plugins/.

Two wire formats: pipe (Core <-> bridge) is internal PascalCase JSON;
HyperHQ Socket.IO (bridge <-> HyperHQ) is camelCase per the API. The
bridge handles challenge-response auth, plugin:register, subscribeEvents,
requestData/dataResponse routing by requestId, and the hyperHqEvent
envelope (gameLaunched / gameClosed).

Bridge module is exempt from forbidigo and depguard so it can use stdlib
sync and log without pulling Zaparoo Core internals into its dep tree.
Linted via task cross-lint:windows since winio is Windows-only.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 54d41f53-6062-4438-9dfb-de2fb400fa25

📥 Commits

Reviewing files that changed from the base of the PR and between 47551af and ad3633c.

📒 Files selected for processing (6)
  • .golangci.yml
  • scripts/windows/hyperhq-plugin/go.mod
  • scripts/windows/hyperhq-plugin/main.go
  • scripts/windows/hyperhq-plugin/main_test.go
  • scripts/windows/hyperhq-plugin/pipe_unsupported.go
  • scripts/windows/hyperhq-plugin/pipe_windows.go
✅ Files skipped from review due to trivial changes (2)
  • scripts/windows/hyperhq-plugin/pipe_unsupported.go
  • scripts/windows/hyperhq-plugin/pipe_windows.go

📝 Walkthrough

Walkthrough

Adds Windows HyperHQ support: a named-pipe server in core, a Windows bridge plugin (Socket.IO client) with build artifacts, hyperhq URI scheme, a HyperHQ launcher, tests, and lint/build task updates.

Changes

HyperHQ Windows Integration

Layer / File(s) Summary
URI Scheme & Data Contracts
pkg/platforms/shared/schemes.go, pkg/platforms/windows/hyperhq.go
Registers SchemeHyperHq = "hyperhq" and defines HyperHQ wire-protocol structs and mapping seeds.
Pipe Server Core
pkg/platforms/windows/hyperhq.go
Implements HyperHqPipeServer with Start/Stop, callbacks, RequestSystems, RequestGamesForSystemSync (sync wait + timeout), LaunchGame, pinging, and connection accept/scan loop.
Platform Integration
pkg/platforms/windows/platform.go, pkg/platforms/windows/hyperhq.go
Adds mapping fields and hyperHqPipe to Platform, initializes/cleans the pipe server, and wires systems/games callbacks to active media and mapping state.
Launcher Implementation
pkg/platforms/windows/hyperhq.go, pkg/platforms/windows/platform.go
Adds NewHyperHqLauncher scanner that requests games per system (virtual hyperhq: paths) and a Launch handler extracting HyperHQ game IDs.
LaunchBox Robustness
pkg/platforms/windows/launchbox.go
Adds nil-writer validation before sending GetGamesForPlatform to avoid nil write attempts.
Plugin Bridge Core & RPC
scripts/windows/hyperhq-plugin/main.go
Standalone bridge: Socket.IO auth/registration, lifecycle requests, requestData RPCs with requestId/sessionToken, pending-data matching, event conversion to pipe events, named-pipe session loop, and write utilities.
Plugin Manifest & Build
scripts/windows/hyperhq-plugin/plugin.json, scripts/windows/hyperhq-plugin/go.mod, scripts/windows/hyperhq-plugin/Dockerfile
Adds plugin manifest, new go.mod (go 1.26.3, winio/socket.io deps), and Dockerfile to cross-compile Windows AMD64 static executable.
Plugin Tests & Bridge Unit Tests
scripts/windows/hyperhq-plugin/main_test.go, pkg/platforms/windows/hyperhq_test.go
Adds unit tests for bridge logic (pending-data, lifecycle, pipe session writes, decode/unmarshal helpers, request ID) and comprehensive HyperHQ platform tests (JSON, mappings, virtual paths, large payload handling).
Build Tasks & Linting
scripts/tasks/windows.yml, scripts/tasks/cross-lint.yml, .golangci.yml, Taskfile.dist.yml
Adds build-hyperhq-plugin task, adjusts cross-lint command flow, excludes plugin dir from certain golangci linters, and documents Windows-only lint paths.
Pipe Dial Implementations
scripts/windows/hyperhq-plugin/pipe_windows.go, scripts/windows/hyperhq-plugin/pipe_unsupported.go
Provides Windows-specific dial via go-winio and non-Windows stub returning unavailable error.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

"🐰
A tiny bridge of pipes and code,
I hop where HyperHQ road is owed,
Games whisper through a newline song,
Zaparoo listens, hopping along."

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.75% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly and clearly describes the main change: adding HyperHQ launcher and bridge plugin support for Windows.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/windows-hyperhq-launcher

Comment @coderabbitai help to get the list of available commands and usage tips.

@sentry
Copy link
Copy Markdown

sentry Bot commented May 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/windows/hyperhq-plugin/main.go (1)

224-857: 🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift

Please add tests for the new bridge module.

I don't see companion coverage in this diff for the auth handshake, pipe request routing, or reconnect/error paths, and this file carries most of the new protocol risk.

As per coding guidelines, "Write tests for all new code — follow TESTING.md and pkg/testing/README.md patterns".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/windows/hyperhq-plugin/main.go` around lines 224 - 857, Add
unit/integration tests for the new bridge behavior: create tests exercising the
authentication handshake and reconnect path (exercise connectSocket by driving
"connect" and "authenticated" events and assert sessionToken set and authDone
behavior), request/response routing (test requestData/requestDataCtx together
with handleDataResponse to ensure pendingData mapping, cleanup, and error
paths), lifecycle request handling (call handleLifecycleRequest with various
hqLifecycleRequest payloads including missing ID and hqMethodShutdown to verify
plugin:response emit and cancel), pipe interaction (exercise writePipeEvent,
servePipeOnce/runPipeLoop by faking a pipe connection or using an in-memory
net.Pipe to verify pushed Systems/Games and command routing via
handlePipeCommand), and edge cases (decodeFirst, unmarshalIfPresent,
newRequestID uniqueness/fallback). Follow TESTING.md and pkg/testing/README.md
patterns: add a _test.go beside main.go, use test doubles/mocked socketio server
and a fake pipe connection, control contexts/timeouts to exercise reconnects and
error returns, and assert logs/returned errors where appropriate.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/windows/hyperhq-plugin/go.mod`:
- Line 3: The linter version in .golangci.yml is pinned to go: "1.25" which
conflicts with the root module's go 1.26.3 and the plugin's go 1.26.2; update
the go setting in .golangci.yml from "1.25" to "1.26.3" so the linter target
matches the root go.mod, and optionally also bump the plugin's go directive in
scripts/windows/hyperhq-plugin/go.mod from 1.26.2 to 1.26.3 to keep all go
versions consistent across the repo.

In `@scripts/windows/hyperhq-plugin/main.go`:
- Around line 584-586: The goroutines started by b.pushSystems and pushGames are
using the shared b.pipeWriter and can outlive servePipeOnce, causing late writes
to hit a new session; fix by making the work session-scoped: in servePipeOnce
create a per-connection context or generation ID and a session-scoped writer
(e.g. capture the current b.pipeWriter into a local variable or pass a
sessionWriter interface into pushSystems/pushGames), pass that session writer
and context/generation into the goroutines, have the goroutines check the
context/generation (or return early if writer is nil/closed) before writing, and
cancel or bump the generation on reconnect so late completions are dropped
instead of writing to the new pipe.
- Around line 384-386: The disconnect handler registered via onSocket should
clear the bridge's authentication state so requestDataCtx doesn't think the
bridge is still authenticated; inside the "disconnect" callback clear
b.sessionToken (and optionally b.authenticated or any flag used to indicate an
authenticated state) so subsequent transient reconnects don't use a stale token
until a new "authenticated" event repopulates it.

---

Outside diff comments:
In `@scripts/windows/hyperhq-plugin/main.go`:
- Around line 224-857: Add unit/integration tests for the new bridge behavior:
create tests exercising the authentication handshake and reconnect path
(exercise connectSocket by driving "connect" and "authenticated" events and
assert sessionToken set and authDone behavior), request/response routing (test
requestData/requestDataCtx together with handleDataResponse to ensure
pendingData mapping, cleanup, and error paths), lifecycle request handling (call
handleLifecycleRequest with various hqLifecycleRequest payloads including
missing ID and hqMethodShutdown to verify plugin:response emit and cancel), pipe
interaction (exercise writePipeEvent, servePipeOnce/runPipeLoop by faking a pipe
connection or using an in-memory net.Pipe to verify pushed Systems/Games and
command routing via handlePipeCommand), and edge cases (decodeFirst,
unmarshalIfPresent, newRequestID uniqueness/fallback). Follow TESTING.md and
pkg/testing/README.md patterns: add a _test.go beside main.go, use test
doubles/mocked socketio server and a fake pipe connection, control
contexts/timeouts to exercise reconnects and error returns, and assert
logs/returned errors where appropriate.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 207c0fcd-bec9-4c97-98a6-7d6d7c3f1593

📥 Commits

Reviewing files that changed from the base of the PR and between 1221591 and 47551af.

⛔ Files ignored due to path filters (1)
  • scripts/windows/hyperhq-plugin/go.sum is excluded by !**/*.sum
📒 Files selected for processing (13)
  • .golangci.yml
  • Taskfile.dist.yml
  • pkg/platforms/shared/schemes.go
  • pkg/platforms/windows/hyperhq.go
  • pkg/platforms/windows/hyperhq_test.go
  • pkg/platforms/windows/launchbox.go
  • pkg/platforms/windows/platform.go
  • scripts/tasks/cross-lint.yml
  • scripts/tasks/windows.yml
  • scripts/windows/hyperhq-plugin/Dockerfile
  • scripts/windows/hyperhq-plugin/go.mod
  • scripts/windows/hyperhq-plugin/main.go
  • scripts/windows/hyperhq-plugin/plugin.json

Comment thread scripts/windows/hyperhq-plugin/go.mod Outdated
Comment thread scripts/windows/hyperhq-plugin/main.go
Comment thread scripts/windows/hyperhq-plugin/main.go Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant