Skip to content

cli host#264

Draft
pgherveou wants to merge 183 commits into
feat/signing-host-ring-vrffrom
headless-host
Draft

cli host#264
pgherveou wants to merge 183 commits into
feat/signing-host-ring-vrffrom
headless-host

Conversation

@pgherveou

@pgherveou pgherveou commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

What this adds

truapi-host is a native CLI for running TrUAPI without a browser or mobile app. It provides both sides of the host flow:

  • a signing host that manages the wallet identity, approvals, allowances, and signatures;
  • a pairing host that serves a product, emits a pairing link, and forwards requests to a signing host.

Both roles use the real Paseo Next v2 services, including LitePeople identity, the People-chain Statement Store, and Bulletin preimages.

Get started

Build and install the CLI once, then launch the signing host:

make headless install
truapi-host signing-host

The CLI selects or creates an attested account and waits for ring readiness. If an auto-managed account has no free Statement Store slot during pairing, it retries with another account. From the command bar you can:

  • paste a polkadotapp:// pairing link or use /deeplink <link>;
  • use /script to create or run a TypeScript product script;
  • use /session to keep separate local host profiles;
  • use /help to discover the remaining commands and shortcuts.

Product scripts run with Bun and receive a ready-to-use global truapi client. They can import npm dependencies directly; Bun installs missing packages automatically.

#!/usr/bin/env bun

import chalk from "chalk";

const result = await truapi.account.getUserId();
if (!result.isOk()) throw new Error(JSON.stringify(result.error));

console.log(chalk.green("user id:"), result.value);

Run a script directly when an interactive session is unnecessary:

truapi-host signing-host \
  --product-id my-product.dot \
  --script ./script.ts \
  --auto-accept

User experience

  • ⌨️ Fast command entry: a persistent command bar with aligned autocomplete, history, and keyboard shortcuts.
  • Clear feedback: quiet sentence-case progress and concise approval prompts, with debug and trace logs available on demand.
TrUAPI signing-host terminal interface

End-to-end coverage

The Playground's generated examples are also the headless compatibility suite. The battery discovers and executes all 64 exposed TrUAPI examples.

It is measured independently against both host topologies and writes browser-compatible reports consumed by the compatibility explorer.

Signing host

This command generates explorer/diagnosis-reports/signing-host-cli.md:

target/debug/truapi-host signing-host \
  --product-id truapi-playground.dot \
  --script rust/crates/truapi-host-cli/js/scripts/battery.ts \
  --auto-accept
Signing-host end-to-end diagnosis

Pairing host

Start the product-facing host, then answer its emitted link from a signing host. The pairing-host process generates explorer/diagnosis-reports/pairing-host-cli.md when the battery completes:

# Terminal 1
target/debug/truapi-host pairing-host \
  --product-id truapi-playground.dot \
  --script rust/crates/truapi-host-cli/js/scripts/battery.ts \
  --auto-accept

# Terminal 2
target/debug/truapi-host signing-host \
  --deeplink '<pairing link>' \
  --auto-accept
Pairing-host end-to-end diagnosis

The live coverage exercises pairing, permissions, account and legacy signing, transaction construction, chain RPC, Statement Store proofs and subscriptions, resource allocation, push notifications, and Bulletin preimages. Remaining failures are isolated to the Chat and Payment APIs that are not currently implemented by the host.

The PR also includes Rust unit/integration coverage, generated-client parity checks, and Bun tests for diagnosis discovery and reporting.

pgherveou added 30 commits June 30, 2026 17:30
Adds the canonical testing module (api/testing.rs) and its v01/v02/versioned
wiring used by the Rust host runtime and generated clients.
New crate defining the host syscall traits (storage, navigation, consent,
permissions, ...) that host runtimes implement. Types are re-exported from
truapi::versioned/v01 rather than redefined.
WASM host runtime that hosts implement: dispatcher, SCALE frames, subscription
streams, chain runtime, host logic (sessions, SSO pairing, permissions,
statement store, dotns) and the wasm bindings. Includes the committed generated
dispatcher/wire-table under src/generated/.
…backs

Extends the rustdoc-JSON code generator to emit the Rust dispatcher and wire
table consumed by truapi-server, plus the TS host-callbacks adapter. Golden
tests pin the emitted shapes.
New WASM-backed host runtime package embedding the Rust core, with web iframe
and Web Worker entry points. Updates the @parity/truapi client (SCALE, sandbox,
transport) and drops the obsolete explorer 0.3.2 codegen snapshot.
Updates CLAUDE.md/README, CI workflows, Makefile, deny.toml, changesets, and
linguist attributes for generated code, and bumps the dotli submodule to the
host integration that consumes the WASM runtime.
Adds the canonical testing module (api/testing.rs) and its v01/v02/versioned
wiring used by the Rust host runtime and generated clients.
New crate defining the host syscall traits (storage, navigation, consent,
permissions, ...) that host runtimes implement. Types are re-exported from
truapi::versioned/v01 rather than redefined.
…backs

Extends the rustdoc-JSON code generator to emit the Rust dispatcher and wire
table consumed by truapi-server, plus the TS host-callbacks adapter. Golden
tests pin the emitted shapes.
@pgherveou

Copy link
Copy Markdown
Collaborator Author

signing host:
signing-host-diagnosis

pairing host:
pairing-host-diagnosis

@pgherveou
pgherveou changed the base branch from main to feat/signing-host-ring-vrf July 23, 2026 13:42
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