简介
为机器对机器支付添加信任拦截层,基于 Valiron SDK 实时评估交易对手风险,支持熔断降级与审计追踪
原始描述
Intercept and authorize outgoing machine-to-machine payments (x402 or similar) using @valiron/sdk trust decisions on the counterparty agent before payment ex...
通过你的 Agent 添加
安装目录:valiron-payment-interceptor/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
Valiron Payment Interceptor 是一款面向 AI 代理间支付场景的信任拦截中间件,核心定位是在资金流出前执行实时风险决策。开发者需在支付网关或钱包层嵌入该拦截器,通过调用 @valiron/sdk 完成以下流程:
- 身份提取:从支付请求中解析交易对手标识(优先
counterpartyAgentId,支持钱包地址回退) - 信任评估:调用
checkAgent()快速决策或getAgentProfile()获取完整画像 - 策略执行:依据预置决策矩阵(
references/decision-policy.md)映射为四种动作:prod:正常放行prod_throttled:降额限流放行sandbox:仅允许沙箱链路sandbox_only:拒绝支付
- 额度管控:叠加
references/spend-controls.md中的单笔下限、日累计、速率限制 - 熔断与降级:高敏感支付强制
fail-closed,低敏感场景可配置fail-open-guarded并设严格兜底额度 - 审计留痕:按
references/audit-events.md记录决策原因、金额、结果
针对 x402 等支付协议,拦截器在「创建支付承诺」之前完成信任校验,避免不可逆的资金冻结。
显著优点
- 确定性决策:禁止依赖 LLM 自由输出做支付授权,全部采用结构化策略匹配
- 双轨评估:支持快速路径(毫秒级)与完整画像路径(含定价信号)按需切换
- 协议原生:深度适配 x402 挑战-响应流程,无需改动支付层核心逻辑
- 可观测性强:内置审计事件 schema,便于对接 SIEM 与合规报表
潜在局限
- 外部依赖:核心功能依赖 Valiron 云服务可用性,需配置熔断兜底
- Node 生态锁定:仅官方支持 Node.js,其他运行时需自行适配
- 配置复杂度高:决策矩阵、额度规则、熔断模式需多文件协同管理
- 信号黑箱:
getAgentProfile返回的定价/风险信号为 Valiron 内部模型输出,缺乏可解释性细节
适合人群
- 构建 AI 代理支付钱包、MCP 工具网关的开发者
- 需为 B2B 机器支付添加「事前风控」的企业风控团队
- 探索 x402 协议落地的 Web3 基础设施项目
常规风险
- 密钥泄露:
VALIRON_API_KEY若暴露在客户端或日志,可能导致配额盗刷 - 降级误配置:将高敏感支付设为
fail-open可能造成资金损失 - 策略漂移:决策矩阵版本未与代码版本同步,导致预期外放行
技能正文
name: valiron-payment-interceptor description: Intercept and authorize outgoing machine-to-machine payments (x402 or similar) using @valiron/sdk trust decisions on the counterparty agent before payment execution. Use when implementing payment middleware, wallet spend guards, policy engines, trust-based allow/deny/throttle decisions, fail-open/fail-closed behavior, and auditable transaction risk controls.
Valiron Payment Interceptor
Add a trust gate in front of outgoing agent payments.
Runtime requirements
Declare and validate runtime prerequisites before enabling the interceptor:
- Node.js runtime compatible with your app and
@valiron/sdk. - Installed dependencies:
@valiron/sdk- Your payment rail package(s) (x402 or equivalent) used by the host app.
- Required configuration/credentials (via secret manager or env vars):
VALIRON_API_KEY(or equivalent Valiron credential)VALIRON_BASE_URL(if using non-default endpoint)VALIRON_TIMEOUT_MS(optional, with safe default)
- Policy/config inputs:
- Decision policy JSON (route-to-action matrix)
- Spend limit defaults and per-route overrides
Fail startup (or fail closed for payment endpoints) when required credentials/config are missing.
Workflow
- Extract counterparty identity from the payment request.
- Prefer
counterpartyAgentId. - Support wallet fallback with
getWalletProfile(wallet).
- Prefer
- Evaluate trust with Valiron.
- Fast path:
checkAgent(agentId). - Full path:
getAgentProfile(agentId)when you need reasons/signals, pricing, or audit details.
- Fast path:
- Apply deterministic decision policy from
references/decision-policy.md. - Enforce spend controls from
references/spend-controls.md. - If allowed, continue to payment initiation (x402 challenge creation or equivalent flow).
- If blocked/restricted, return explicit denial/degrade reason.
- Log outcome using
references/audit-events.md.
Decision model
Map route decisions to payment actions:
prod: allow payment under normal limits.prod_throttled: allow with reduced caps/rate limits.sandbox: allow only test/sandbox payment rail (or deny prod transfer).sandbox_only: deny outgoing payment.
Never authorize payment using free-form model output alone.
x402-specific sequencing
For x402-protected purchases or settlement-like flows:
- Trust-check counterparty identity.
- Evaluate route + spend policy.
- If denied, abort before creating payment commitment.
- If allowed, generate/send x402 payment payload.
- Record authorization decision + amount + result.
Outage and fallback
Use endpoint-class fallback from references/fallback-modes.md:
- High-risk payment actions:
fail-closed. - Low-risk/test actions: optional
fail-open-guardedwith strict caps.
Keep fallback mode explicit and versioned.
Use bundled resources
- Runtime + credential checklist:
references/runtime-requirements.md - Decision matrix:
references/decision-policy.md - Spend/risk controls:
references/spend-controls.md - Fallback guidance:
references/fallback-modes.md - Audit schema:
references/audit-events.md - Error handling:
references/error-handling.md - Interceptor template:
assets/payment-interceptor.ts - Policy validator:
scripts/validate-payment-policy.mjs
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。