Skip to content

v0.12.181: OKX-first wallet onboarding via guided setup#3

Merged
1bcMax merged 4 commits into
BlockRunAI:mainfrom
KillerQueen-Z:main
May 13, 2026
Merged

v0.12.181: OKX-first wallet onboarding via guided setup#3
1bcMax merged 4 commits into
BlockRunAI:mainfrom
KillerQueen-Z:main

Conversation

@KillerQueen-Z
Copy link
Copy Markdown
Collaborator

Summary

Fresh installs no longer silently generate a local BIP-39 wallet. The plugin now defaults to the OKX Agentic Wallet (onchainos), guiding users through installation + email/OTP login via a new xclawrouter setup command.

What changed

  • src/auth.tsresolveOrGenerateWalletKey() throws OnchainOsRequiredError on a fresh install when no OKX session + no saved wallet exist, instead of falling back to local-key generation. XCLAWROUTER_USE_LOCAL_WALLET=1 opts back into the legacy local BIP-39 path; saved wallets continue to work unchanged (zero-disruption upgrade for existing users).
  • src/cli.ts — added xclawrouter setup subcommand. On an interactive TTY, npx @blockrun/xclawrouter auto-triggers setup when no wallet is present. Non-interactive callers (CI, Docker, gateway daemon) still get the fail-fast exit 2 contract so automation isn't left hanging on stdin. Polished ANSI-styled UI for email + OTP prompts with a summary box on success.
  • src/index.ts — handles OnchainOsRequiredError from both the plugin register hook and the gateway-mode wallet resolution path; prints the multi-line guidance via api.logger.warn instead of crashing.
  • scripts/reinstall.sh — bootstraps the onchainos binary via OKX's official install.sh, then surfaces a prominent "Next step — log in to your OKX Agentic Wallet" block at the end of installs that aren't already logged in.
  • CLI bin renameclawrouterxclawrouter (matches package name).
  • README — documents the three OpenClaw install paths (curl one-liner, openclaw plugins install, global npm install -g).
  • Tests — integration tests opt into local wallet via XCLAWROUTER_USE_LOCAL_WALLET=1 so they don't need a real OKX session.

Commits

  • af3556e v0.12.180: OKX-first wallet onboarding via guided setup
  • 09e1eac v0.12.181: polish setup UX, drop skill-install duplication

Test plan

  • npm run typecheck clean
  • npm run lint clean
  • npx vitest run src/ — 460 unit tests pass
  • npm pack + global install of the tgz — xclawrouter --version returns 0.12.181, xclawrouter --help shows new command name
  • Fresh install (no wallet, no OKX) → clean error pointing at xclawrouter setup, exit 2
  • Existing wallet.key saved → still loaded as before (Using saved wallet: 0x...)
  • XCLAWROUTER_USE_LOCAL_WALLET=1 → legacy local generation still works
  • End-to-end with real OKX andy@blockrun.ai account — email + OTP completes, proxy on port 8402 uses OKX wallet, no wallet.key written to disk
  • npm publish --dry-run clean

KillerQueen-Z and others added 4 commits May 12, 2026 16:34
Fresh installs no longer silently generate a local BIP-39 wallet. When
no OKX onchainos session and no saved wallet are present,
resolveOrGenerateWalletKey throws OnchainOsRequiredError instead of
falling back to local-key generation. The new flow:

- `npx @blockrun/xclawrouter` on a fresh interactive terminal auto-runs
  the guided setup (install onchainos binary if missing → email → OTP
  via `wallet login` + `wallet verify` two-step).
- Non-interactive callers (CI, Docker, gateway daemon) keep the
  fail-fast error + exit 2 contract so automation isn't left hanging
  on a stdin prompt.
- `xclawrouter setup` exposes the same flow as an explicit subcommand.
- `XCLAWROUTER_USE_LOCAL_WALLET=1` opts back into the legacy local
  BIP-39 path; saved wallets keep working unchanged so existing users
  upgrade with zero disruption.
- scripts/reinstall.sh bootstraps the onchainos binary via OKX's
  official install.sh and stages the okx-agentic-wallet SKILL.md into
  the OpenClaw workspace.
- CLI bin renamed to `xclawrouter`; help text + updater point at the
  new package name.
- README documents the three OpenClaw install paths (curl one-liner,
  `openclaw plugins install`, global `npm install -g`).
- src/cli.ts (cmdSetup): redesigned interactive flow with ANSI-styled
  header, two-line summary box, suppressed onchainos JSON output, and
  cyan/green/yellow status indicators. Falls back to plain text when
  stdout isn't a TTY or NO_COLOR is set.
- scripts/reinstall.sh: removed the `okx-agentic-wallet` SKILL.md
  bootstrap and the "ask your agent" hand-off message. The skill is
  OKX's parallel onboarding path; running both confused users about
  which route to follow. Email login now flows exclusively through
  `xclawrouter setup`.
- scripts/reinstall.sh: added a prominent "Next step — log in to your
  OKX Agentic Wallet" block at the end of installs that aren't already
  logged in, pointing users at `xclawrouter setup`. Skipped when an
  OKX session, a legacy wallet.key, or XCLAWROUTER_USE_LOCAL_WALLET=1
  is already in place.
Resolves CI "Check formatting" failure on BlockRunAI#3.
Addresses the review on PR BlockRunAI#3 (blocking + should-fix items, plus two
small DRY nits):

- Restore `clawrouter` bin name as a deprecation alias (blocking).
  v0.12.180 renamed the bin to `xclawrouter` with no transitional alias,
  breaking pm2 processes, shell aliases, and onboarding docs that
  referenced the old name. package.json now ships both bins pointing at
  the same dist/cli.js. Invocations under the old name print a one-line
  deprecation notice to stderr (suppressible via XCLAW_SUPPRESS_RENAME_NOTICE=1)
  and continue normally. Alias removed in v0.13 — one release of runway.

- Guard the post-setup wallet re-resolve. main() auto-launches cmdSetup
  on fresh interactive installs then re-calls resolveOrGenerateWalletKey.
  If a transient TEE issue leaves the wallet still undetected after setup
  claims success, the second call was throwing OnchainOsRequiredError
  straight through to main().catch as a generic "Fatal error". Now caught
  with a targeted "Setup completed but the wallet still isn't detected —
  diagnose with onchainos wallet status" hint before exit 1.

- humanizeDetectionKind() for cmdSetup post-verify failure. The recovery
  error message used to surface the raw enum (`no-evm-address`,
  `addresses-error`) to end users. Mapped to one-line plain-English
  descriptions ("no EVM address found — is this a Solana-only OKX
  account?"). Only used in the cmdSetup recovery path —
  formatAgenticWalletStatus already humanizes its lines.

- ONCHAINOS_INSTALLER_URL exported from src/auth.ts. The curl-able
  installer URL was hardcoded in both src/cli.ts (cmdSetup auto-install)
  and scripts/reinstall.sh. Promoted to one TS-side constant; reinstall.sh
  keeps its bash variable with a comment to stay in sync (POSIX shell
  can't import TS).

- logOnchainOsRequiredError(logger, err) helper in src/index.ts. The
  line-by-line warn loop for surfacing the multi-line OnchainOsRequiredError
  guide was duplicated at the two wallet-resolution sites (gateway-mode
  startProxyInBackground and the non-gateway-mode register() callback).
  One helper, same behaviour.

Test plan
- npm run typecheck — clean
- npm run lint — clean
- npm run format:check — clean
- npx vitest run src/ — 460 pass, 0 fail (same as PR baseline)
- npm run build — dist regenerated; new symbols verified embedded in
  dist/cli.js and dist/index.js
- node dist/cli.js --version → 0.12.182
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