Skip to content

fix(ai-path): restore packaging + fail fast before payment when no tunnel binary (v2.8.0)#33

Merged
Sentinel-Bluebuilder merged 2 commits into
masterfrom
ai-path/no-binary-fail-fast
Jun 12, 2026
Merged

fix(ai-path): restore packaging + fail fast before payment when no tunnel binary (v2.8.0)#33
Sentinel-Bluebuilder merged 2 commits into
masterfrom
ai-path/no-binary-fail-fast

Conversation

@Sentinel-Bluebuilder

Copy link
Copy Markdown
Owner

Consumer context (x402 pay-per-use VPN)

An AI agent following the x402 flow (pay USDC on Base → receive Sentinel subscription → connect() via blue-js-sdk/ai-path) was rated end-to-end on a machine with no V2Ray and no WireGuard installed. Result: 88/100. The two deductions traced straight to the SDK:

1. Published 2.7.2 is missing ai-path entirely (release blocker)

npm view blue-js-sdk@2.7.2 exports has no ./ai-path; files has no ai-path/; bin has no sentinel-ai. With an exports map present, import 'blue-js-sdk/ai-path' throws ERR_PACKAGE_PATH_NOT_EXPORTED for every npm consumer. Only apps pinned to 2.3.0 (like x402's fresh-test) still work.

Regression source: f6162f4 ("fix: silent truncation in rpcQueryNodes...", Apr 19) accidentally reverted package.json, undoing what 87cc4df added. This is the identical failure class the v2.7.2 CHANGELOG entry documents for auth//operator/ — except the CI tarball gate added there only imports the package root, so subpath drift slipped through.

2. A binary-less agent burns a real on-chain session

connect() step 1 detects the environment but never gates on it. On the no-binary machine the trace was: wallet derived → balance OK → node selected → MsgStartSession TX broadcast and paid → tunnel step fails with V2RAY_NOT_FOUND. The session payment and the fee granter's allowance are gone. (FAILURES.md rule 5 — "check BEFORE paying" — was already enforced for WireGuard-without-admin, but not for the no-binary-at-all case.)

Also: the exported setup() was detect-only — the actual V2Ray download lives in the root setup.js, which was unsafe to import (ran main() with npm-install/MSI side effects on import).

Changes

  • package.json — restore "./ai-path" export, ai-path/ in files, sentinel-ai bin; version 2.8.0.
  • ai-path/connect.js — step 1 now gates: no V2Ray and no admin-usable WireGuard → auto-download V2Ray (no admin needed) → re-detect; if still unusable, throw ENVIRONMENT_NOT_READY (existing code, nextAction run_setup) before any chain work. Skipped in dryRun. Human-error map entry added.
  • ai-path/environment.jssetup() now actually installs: downloads V2Ray (SHA256-verified, to SDK bin/) via the root setup script when no usable binary exists, re-detects, returns installed: true. Opt out with { autoInstall: false }. Reuses existing ENVIRONMENT_NOT_READY — no new error code, no JS↔C# parity work (ai-path is JS-only).
  • setup.js (root) — exports setupV2Ray, setupWireGuard, setup(); main() only runs when executed directly.
  • .github/workflows/ci.yml — tarball gate now imports every subpath export (blue-js-sdk/ai-path, /consumer, /operator) from the packed install, closing the gap that let this regression publish.
  • Docs (same diff)ai-path/README.md (setup() API + auto-install, ENVIRONMENT_NOT_READY row, --ignore-scripts note, lifecycle step 1), ai-path/FAILURES.md (D8: detection-without-gate, D9: subpath packaging), CHANGELOG.md v2.8.0 entry.

Verification

  • All edited files import cleanly; importing root setup.js no longer triggers side effects.
  • npm pack → install tarball in temp dir with --ignore-scriptsblue-js-sdk/ai-path (46 exports), /consumer (63), /operator (68) all resolve. Root: 401 exports.
  • Distribution greps (wallet addresses, AI tool names, local paths, mnemonics) clean on all changed files.

Why minor bump (2.8.0)

New behavior: setup() and connect() now download V2Ray at runtime when nothing usable is present. Restores the published surface 2.7.x silently dropped. After merge, publishing 2.8.0 unblocks every npm ai-path consumer.

…nnel binary (v2.8.0)

Two regressions, one failure class, found by an AI-agent consumer (x402
pay-per-use VPN) on a machine with no tunnel binary:

1. Published 2.7.2 dropped ai-path entirely. Commit f6162f4 reverted
   package.json, removing "./ai-path" from exports, ai-path/ from files,
   and the sentinel-ai bin. With an exports map present, every npm
   consumer of `import 'blue-js-sdk/ai-path'` threw
   ERR_PACKAGE_PATH_NOT_EXPORTED. The 2.7.2 CI tarball gate only imported
   the package root, so the subpath drift slipped through.

2. A binary-less agent burned a real on-chain session. connect() step 1
   detected the environment but never gated on it - wallet, balance,
   node selection, and the MsgStartSession TX all ran, then the tunnel
   step failed with V2RAY_NOT_FOUND, wasting the session payment and the
   fee granter's allowance.

Changes:
- package.json: restore "./ai-path" export, ai-path/ in files,
  sentinel-ai bin; bump to 2.8.0
- ai-path/connect.js: gate at step 1 - no V2Ray and no admin-usable
  WireGuard -> auto-download V2Ray (no admin needed); if still unusable,
  throw ENVIRONMENT_NOT_READY (nextAction run_setup) before any chain
  work; skipped for dryRun
- ai-path/environment.js: setup() now actually installs - downloads
  V2Ray (SHA256-verified) via the root setup script when no usable
  binary exists, re-detects, reports installed: true; opt out with
  { autoInstall: false }
- setup.js: export setupV2Ray/setupWireGuard/setup; main() only runs on
  direct execution (was running npm-install/MSI side effects on import)
- ci.yml: tarball gate now imports every subpath export
  (ai-path/consumer/operator) from the packed install
- docs in same diff: ai-path/README.md (setup() API,
  ENVIRONMENT_NOT_READY, lifecycle), ai-path/FAILURES.md (D8, D9),
  CHANGELOG.md (v2.8.0 entry)

Verified: all edited files import cleanly; npm pack + tarball install
with --ignore-scripts resolves blue-js-sdk/ai-path (46 exports),
/consumer, /operator.
@Sentinel-Bluebuilder Sentinel-Bluebuilder merged commit ccf1f3a into master Jun 12, 2026
2 checks passed
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