关于 WHP Standing
WHP Standing 是用于自主 AI Agent 的中间件,在执行操作前检查其权限和来源依据是否充分。它会阻止未经授权的状态变更,同时允许被动读取操作不受阻拦。
主要功能
- 01阻止缺少权限或来源依据的状态变更
- 02无需抛错即可检查决策
- 03强制执行有时限的权限窗口
- 04阻止无界循环和递归
- 05允许被动读取而不拦截
适用场景
- 01在 Agent 写入数据库前进行防护
- 02阻止未经授权的文件删除
- 03检查工具调用被拦截的原因
- 04限制 Agent 的重复或递归操作
MCP 相关
README 介绍了中间件和网络评估服务,但没有说明该项目是 MCP 服务或描述 MCP 连接方式。
配置
远程服务无需本地安装。选择你使用的客户端,复制配置或使用一键安装。
https://standing-guard-service.lovable.app/mcpclaude mcp add --transport http wheelerhubbell-whp-standing https://standing-guard-service.lovable.app/mcp{"mcpServers":{"wheelerhubbell-whp-standing":{"type":"http","url":"https://standing-guard-service.lovable.app/mcp"}}}在 Cursor 中打开{"servers":{"wheelerhubbell-whp-standing":{"type":"http","url":"https://standing-guard-service.lovable.app/mcp"}}}在 VS Code 中打开{"mcpServers":{"wheelerhubbell-whp-standing":{"type":"http","url":"https://standing-guard-service.lovable.app/mcp"}}}{"mcpServers":{"wheelerhubbell-whp-standing":{"serverUrl":"https://standing-guard-service.lovable.app/mcp"}}}命令在终端中运行;JSON 粘贴到对应客户端的 MCP 配置后重启。需要授权的服务会在首次连接时提示登录。
工具
3此工具无需参数。
详细介绍
@wheelerhubbell/whp-standing-client
面向自主 AI Agent 的故障关闭式认知立场中间件。
受权威守恒原则约束:$A(c) \le P(c)$(权威不得超过来源依据)。
Standing 可检测并阻止连贯替换——即 AI Agent 悄然将分配的任务替换为相近任务($q \to q^*$),围绕替换后的任务进行连贯推理,并执行未经授权的状态变更。
📚 案例研究与理论
- 连贯替换(v1.1): 对命题完整性的理论阐述,以及系统为何会在推理出错之前失效。
- Mata 诉 Avianca 认知尸检: 受控的法证分析,展示 Agent 即使引用的来源 100% 经核实,也会因回答了错误的问题($Q_0 \to Q_1$)而失败。
⚡ 1 行中间件集成
安装此软件包:
npm install @wheelerhubbell/whp-standing-client
在工具执行之前立即调用 guardAction:
import { guardAction } from '@wheelerhubbell/whp-standing-client';
// Before any agent tool runs:
await guardAction(toolCall, {
standing: executionContext.standing
});
// Proceed only if standing is warranted
return await tool.execute(toolCall.arguments);
如果 Agent 尝试执行状态变更操作(删除文件、写入数据库、变更 API),但没有可归因的上游授权或来源依据,guardAction 会在越过边界之前抛出 StandingViolationError。
🔍 可观测性:evaluateStanding
如需检查但不抛出异常:
import { evaluateStanding } from '@wheelerhubbell/whp-standing-client';
const decision = await evaluateStanding(toolCall, context);
if (!decision.allowed) {
console.warn(`Blocked [${decision.code}]: ${decision.message}`);
return decision;
}
诊断决策对象
{
"allowed": false,
"code": "MISSING_UPSTREAM_PROVENANCE",
"actionId": "call_8cb2f1",
"toolName": "delete_database_table",
"required": ["authority", "provenance"],
"observed": {
"toolName": "delete_database_table",
"arguments": { "table": "users" },
"missing": ["provenance", "authority"]
},
"message": "Tool execution blocked for 'delete_database_table': no attributable upstream authorization or provenance."
}
🛡️ 核心语义
- 默认故障关闭: 任何缺少有效来源依据或授权的状态变更操作都会被拒绝。
- 授权窗口: 由
valid_until时间戳限定。 - 循环与递归限制: 在 Agent 循环无界时停止执行(
executionCount > maxExecutionCount)。 - 读取操作零开销: 被动读取操作无需阻塞即可执行。
🌐 可验证的网络验证
在线服务为普通 x402 Agent 提供了简洁的入口:POST /v1/evaluate,接受 subject、claim 和可选的 provenance,在 Base 上以 1.00 USDC 定价(x402 v2)。它会返回一条签名评估记录。该记录不是密封的 Standing Mark。Mark 通过 POST /v1/evaluations 签发,该接口接受符合已发布合约的签名提交。
使用官方 x402 客户端的示例(需要使用你自己的已注资钱包并设置支出限额;目前尚未通过在线服务进行端到端验证):
import { x402Client, wrapFetchWithPayment } from '@x402/fetch';
import { registerExactEvmScheme } from '@x402/evm/exact/client';
import { privateKeyToAccount } from 'viem/accounts';
const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const fetchWithPayment = wrapFetchWithPayment(fetch, client);
const res = await fetchWithPayment('https://api.wheelerhubbellpublishing.com/v1/evaluate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
subject: 'agent-session-42',
claim: 'Agent executed system mutation',
provenance: { source: 'user-intent', authority: 'admin' }
})
});
console.log(await res.json());
请先通过 GET /v1/contract 查看支付条款。此软件包中的 StandingClient 类目前尚不能签名或付款。
- 在线服务: https://api.wheelerhubbellpublishing.com
- 发现: /.well-known/x402
- 协议: x402-v2 / Base Network
许可证
MIT © Wheeler Hubbell Publishing
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。