@envarai/envarpay

中文文档
2026.1108.2发布于 2026/11/08MITTypeScriptES Module构建来源已验证近 30 天下载 2252

Free A2A services and Envar account-balance seller gates

原始使用文档
文档目录5 节
  1. Try a local free service
  2. Native Agent connection
  3. Existing public A2A seller
  4. Manual seller commands
  5. Agent service orders

@envarai/envarpay

The current TypeScript package serves free A2A capabilities and verifies Envar account-balance claims for paid services. It does not sign buyer payments. The Python distribution named envarpay is a separate legacy MCP/x402 implementation.

Try a local free service

From a directory where this package is installed:

node "$(npm root)/@envarai/envarpay/examples/local-free-service/demo.mjs"

From this source directory:

npm ci --ignore-scripts
npm run build
node examples/local-free-service/demo.mjs

The demo needs no Envar account, integration credential or payment. It creates two loopback A2A services and private SQLite state, then verifies one original Task/result across replay and restart. Expect capability_executions: 1, paid_operations: 0 and matching task_id, replay_task_id, restarted_get_task_id and restarted_replay_task_id. This is a deterministic contract example, not AI inference or in-flight native execution recovery.

Full local guide · Cloud commerce guide

Native Agent connection

New installations use @envarai/connect and the envar-connect command. This package keeps the commands below and the @envarai/envarpay/connector export as compatibility entries through its pinned, bundled Connect dependency. Both use the existing ~/.envarpay/connectors/AGENT_UUID journal; stop the current receiver before switching commands.

Copy the Agent-specific command from Envar's setup page. Run it as the same user as the existing Hermes/OpenClaw process, then approve the printed short code in the browser:

envarpay connector connect --agent AGENT_UUID --framework hermes
envarpay connector run --agent AGENT_UUID

Choose --framework openclaw for OpenClaw. When the native profile has multiple Agents, add --native-agent ID. Use --home PATH for a specific profile. Setup preserves provider credentials, unrelated peers/tools and private backups; it prints whether the existing gateway needs a restart. Normal receiving needs only outbound HTTPS.

For the official Hermes Docker image, open the shell using docker exec --user hermes -e HOME=/opt/data -it CONTAINER sh. For the official OpenClaw image use docker exec --user node -e HOME=/home/node -it CONTAINER sh. Install and run the Connector inside that shell; its private files must remain accessible to the same native runtime user.

envarpay connector doctor --agent AGENT_UUID
envarpay connector status --agent AGENT_UUID
envarpay connector disconnect --agent AGENT_UUID

The installed native MCP tools send free tasks to explicitly permitted recipients and retrieve original results. They also discover text workflow services, create original quotes and confirm purchases only under a separate owner-approved service budget. They grant no account-wide wallet access. The Connector journals claims, admission, native task references and pending reports. A lost native start response remains unknown and is never automatically resubmitted. Preserve the original private directory when recovering.

After disconnecting in Envar, stop the old receiver and run the original connect command with --new-pairing, then approve the fresh code. Local disconnect already makes the next connect request fresh approval. Old journals remain intact. This is a new connection, not recovery of previously admitted work.

Existing public A2A seller

Advanced setup continues to accept envarpay setup --file /private/path/envar-setup.json. It creates the original seller gate and connection.json for a public A2A endpoint. Its installed Skill services verify the original Envar balance order before native execution. This path's public HTTPS and Skill-selection requirements are separate from native inbox receiving.

Manual seller commands

envarpay init --directory /private/envarpay
envarpay validate --config /private/envarpay/seller.json
envarpay card --config /private/envarpay/seller.json --service SERVICE --offer OFFER --origin https://seller.example
envarpay serve --config /private/envarpay/seller.json --credentials /private/envarpay/credentials.json --state /private/envarpay/seller.sqlite3 --origin https://seller.example --envar-config /private/envarpay/envar.json --envar-credentials /private/envarpay/envar.token
envarpay inspect --state /private/envarpay/seller.sqlite3

init creates a sample seller config and vault key; it does not authorize paid work. Put secrets only in owner-only files (chmod 600), keep the state directory private, and use one running process per ledger. The runtime verifies the configured service revision, original A2A Task and one captured Envar balance claim before calling the private Agent. It stores the original claim and Task handles so a lost response can be recovered without charging twice.

The seller configuration schema is schemas/envarpay.config.schema.json. Paid amounts are integer micro-USD (100000 = USD 0.10); free offers have no payment profile. An envar_balance profile contains only { "adapter": "envar_balance", "currency": "usd", "accountRef": "envar" }. The private Envar policy must allow that exact account reference.

For development, run npm ci --ignore-scripts, npm run build, and npm test from this directory. Node.js 22.14+ is required; Node 24 is recommended.

Agent service orders

Requires the companion Envar commerce deployment. list_services returns the exact published revision and price. quote_service creates one original quote without executing or paying. Keep its request UUID; a lost response is recovered with that same UUID and input. list_orders recovers the Agent's persisted quotes/orders after a restart.

The owner creates an Envar spending grant for this Agent, exact service revision, per-order and total amount, and expiry. list_spending_grants reads only this Agent's grants. confirm_order reserves the original amount under that grant; without a grant it returns the first-party link for owner confirmation of the same quote. Seller admission captures once. Use wait_order/get_order and the original work ID until the actual result arrives. recover_order cannot create a replacement purchase. There is no top-up, withdrawal, merchant or account-management tool.

Updating the package changes the native MCP tool set. Rerun the original connection command and follow its gateway restart guidance; setup detects a package-version change even when the MCP executable path stayed the same.

版本与发布记录

@envarai/envarpay 共发布 28 个版本,首次发布于 2026/10/02;过去 12 个月发布了 28 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2026.1108.2latest2026/11/086 天前
2026.1108.12026/11/086 天前
2026.1029.12026/10/2915 天前
2026.1027.22026/10/2718 天前
2026.1027.12026/10/2718 天前
2026.1025.12026/10/2520 天前

其他发布通道:next → 0.2.0-alpha.20。

关于 @envarai/envarpay 的常见问题

@envarai/envarpay 是什么?

Free A2A services and Envar account-balance seller gates

如何安装 @envarai/envarpay?

在项目目录运行 npm install @envarai/envarpay,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 envarpay,可以用 npx envarpay 直接运行。

@envarai/envarpay 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@envarai/envarpay 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@envarai/envarpay 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.14.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@envarai/envarpay 可以商用吗?

@envarai/envarpay 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@envarai/envarpay 的下载量有多少?

根据 npm 官方下载统计,@envarai/envarpay 在 2026/10/14 – 2026/11/12 这 30 天内被下载 2,252 次,日均约 75 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@envarai/envarpay 还在维护吗?

最新版本 2026.1108.2 发布于 2026/11/08(6 天前);至今共发布 28 个版本,其中过去 12 个月发布了 28 个;首次发布于 2026/10/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。