Skip to content

feat(js): add @parity/truapi-dev-host, the local development signing host - #502

Draft
peetzweg wants to merge 2 commits into
mainfrom
feat/truapi-dev-host
Draft

feat(js): add @parity/truapi-dev-host, the local development signing host#502
peetzweg wants to merge 2 commits into
mainfrom
feat/truapi-dev-host

Conversation

@peetzweg

@peetzweg peetzweg commented Aug 25, 2026

Copy link
Copy Markdown
Member

Closes #462.

Adds js/packages/truapi-dev-host: the truapi-host CLI as an npm dev dependency, wrapped in the plumbing every product currently rebuilds by hand.

Why: TS product teams need a Rust toolchain and a three-minute build just to run a local signing host, then each copy ~90 lines of WebSocket↔MessagePort plumbing into their app. And because the CLI and @parity/truapi version independently, wire skew shows up as a misleading MalformedFrame. Shipping both from this repo, versioned together, kills all three problems.

How: two bins — truapi-host (passthrough to the native binary, pinned by the lockfile) and truapi-dev-host (launcher: spawns/attaches a signing-host --serve --auto-accept, waits for a real signer identity, pre-flights the product account, then runs the wrapped dev command with the frame endpoint, genesis, and resolved product id injected as env vars). The browser bridge ships as a /browser subpath export rather than in @parity/truapi — a deliberate call, since production hosts embed the runtime in-process and never dial a WebSocket, so the transport is dev-tooling, not protocol surface. The binary resolves through a chain: TRUAPI_HOST_BIN → installed platform package → checkout cargo build → PATH (skipping node_modules/.bin, which would recurse into this package's own shim).

Using it from this branch, before anything is published:

git switch feat/truapi-dev-host
npm install
npm run build --prefix js/packages/truapi-dev-host
cargo build -p truapi-host-cli --bin truapi-host   # or use an installed CLI

then in the consuming app: "@parity/truapi-dev-host": "file:../host-rust-core/js/packages/truapi-dev-host" and truapi-dev-host -- <your dev command>. The package README documents the knobs. A working consumer is paritytech/host-playground#77 — a demo-only draft that stays a file:-dependency branch until this package is merged and released, verified end to end on Paseo Next v2 (identity, raw signing, and chain-state cards in a plain browser tab).

Scope notes: the per-platform binary packages and their release wiring are the follow-up PR — until then the package pins @parity/truapi ^0.9.0, the wire major current product-sdk-host (0.16) pairs with. Unit tests cover network/product-id resolution and the SS58 encoder (bun test).

@socket-security

socket-security Bot commented Aug 25, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​types/​node@​22.20.11001008196100
Updatednpm/​@​parity/​truapi@​0.10.0 ⏵ 0.9.088 -110010098100
Updatednpm/​@​parity/​truapi@​0.10.0 ⏵ 0.10.0N/AN/AN/AN/AN/A

View full report

@peetzweg peetzweg changed the title feat(js): add @parity/truapi-dev-host, the local development signing host feat(js): add @parity/truapi-dev-host, the local development signing host Aug 25, 2026
…host

Ships the truapi-host CLI as an npm dev dependency (host-rust-core#462):
a process supervisor that spawns/attaches a signing-host and pre-flights
its signer identity and product account, network presets that steer host
and app from one knob, a truapi-dev-host launcher that wraps a dev
command with the connection details injected, and a /browser export with
the WebSocket-to-MessagePort bridge every product currently hand-rolls.

The binary resolves through a chain (TRUAPI_HOST_BIN, installed platform
package, checkout cargo build, PATH); the per-platform binary packages
and their release wiring are a follow-up PR.
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.

Ship the host CLI as an npm dev dependency

1 participant