Skip to content

cli host#264

Draft
pgherveou wants to merge 2 commits into
async-trait-migrationfrom
headless-host
Draft

cli host#264
pgherveou wants to merge 2 commits into
async-trait-migrationfrom
headless-host

Conversation

@pgherveou

@pgherveou pgherveou commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

Depends on #312.

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

Try it

The crate isn't published yet, so install straight from this branch:

cargo install --git ssh://git@github.com/paritytech/truapi --branch headless-host truapi-host-cli

Then launch a signing host against Paseo Next v2:

truapi-host signing-host

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.

@socket-security

socket-security Bot commented Jul 5, 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
Addedcargo/​reqwest@​0.12.287910094100100
Addedcargo/​fs2@​0.4.310010090100100
Addedcargo/​arboard@​3.6.19910093100100
Addedcargo/​crossterm@​0.29.09910093100100
Addedcargo/​ratatui@​0.30.210010093100100
Addedcargo/​tokio-tungstenite@​0.24.09910093100100
Addedcargo/​unicode-width@​0.2.299100100100100

View full report

@pgherveou pgherveou changed the title Headless pairing + signing hosts for local e2e (signing-bot replacement) Headless pairing + signing hosts Jul 6, 2026
@TarikGul
TarikGul self-requested a review July 7, 2026 15:46
decrypto21 added a commit that referenced this pull request Jul 8, 2026
@decrypto21 decrypto21 mentioned this pull request Jul 8, 2026
@pgherveou
pgherveou changed the base branch from worktree-issue-96-rust-core-port to bulletin-preimage-in-core July 11, 2026 13:26
Base automatically changed from bulletin-preimage-in-core to main July 14, 2026 05:20
@pgherveou pgherveou changed the title Headless pairing + signing hosts cli host Jul 17, 2026
pgherveou added a commit that referenced this pull request Jul 21, 2026
Preserve headless SSO resource allocation while aligning Ring-VRF wire variants and confirmation policy with the iOS host.

Refs #264, #288
@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
@pgherveou
pgherveou changed the base branch from feat/signing-host-ring-vrf to async-trait-migration July 24, 2026 16:07
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