OceanAltOceanAlt

標準貢獻 · 可復現

x402 合規一致性規範 v0.1

給 Agent 支付(x402 / MCP)結算前合規的一套機讀契約:每一種合規判決對應一個穩定 reason_code、一個 signal_class、一條 retry 規則。1:1 對齊線上真實的 11 道閘,可對免費端點復現。

當前狀態

端點【今天就返回】 reason_code / signal_class / retry / retry_hint(HTTP 狀態碼仍是 200/403/409)。 451/-4510 的換碼 = 提議中、尚未上線(換 HTTP 狀態碼是破壞性變更,須版本協商)。

1 · 信號類別與 retry 規則

signal_class含義retry
ok已放行not_applicable
payment額度/預算(可補足)retryable_after_funding
regulatory確定性合規 FAIL(制裁/混幣/吊銷/重放)non_retryable
authorization歸因/授權/白名單/憑證retry_after_authorization
uncertain篩查不可得/不確定policy_dependent_backoff
client_error請求格式錯誤retry_after_fix

要點:預算拒絕、合規拒絕、臨時基礎設施故障對自主客戶端可能看起來一樣,但各需不同處理。按類別標準化 retry,既防靜默放行(silent PASS),也防無限重試循環(LangChain/AutoGen/CrewAI)。

2 · reason_code 分類(對齊真實 11 道閘)

reason_codesignal_classretry來自
kya_unattributedauthorizationretry_after_authorizationKYA
mandate_revokedauthorizationnon_retryableKYA/Revoked
kya_proof_missingauthorizationretry_after_authorizationKYA/Proof
kyc_requiredauthorizationretry_after_authorizationKYA/KYC
invalid_inputclient_errorretry_after_fixInput
over_per_tx_limitpaymentretryable_after_fundingFirewall/Limit
over_daily_limitpaymentretryable_after_fundingFirewall/Velocity
payee_not_allowlistedauthorizationretry_after_authorizationFirewall/Allowlist
mandate_intent_mismatchauthorizationretry_after_authorizationMandate
sanctioned_or_high_risk_payeeregulatorynon_retryableScreening/AML
behavioral_anomalyuncertainpolicy_dependent_backoffBehavior/Anomaly
replay_detectedauthorizationnon_retryableMandate/Replay
clearoknot_applicableallow
elevated_risk_payeeuncertainpolicy_dependent_backoffscreening: review
screening_unavailableuncertainpolicy_dependent_backoffscreening unavailable
idempotency_key_invalidclient_errorretry_after_fixPOST /api/pay: malformed Idempotency-Key (400)
idempotency_key_reusedclient_errorretry_after_fixPOST /api/pay: Idempotency-Key reused with a different body (422)
idempotency_request_in_progressuncertainpolicy_dependent_backoffPOST /api/pay: original request with this Idempotency-Key still running (409)
key_scope_deniedauthorizationretry_after_authorizationAPI key restricted to other scopes by its holder (403)
key_ip_deniedauthorizationretry_after_authorizationAPI key restricted to an IP allowlist by its holder; this request came from elsewhere (403)

單一事實源:lib/conformance.ts + lib/gates.ts。

3 · 可復現測試向量(對免費端點)

① 制裁地址 → regulatory / non_retryable

curl "https://oceanalt.com/api/risk?addr=0x8589427373D6D84E98730D7795D8f6f8731FDA16"
# → verdict:"risky", reason_code:"sanctioned_or_high_risk_payee", signal_class:"regulatory", retry:"non_retryable"

② 乾淨地址 → ok / not_applicable

curl "https://oceanalt.com/api/risk?addr=0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
# → verdict:"clear", reason_code:"clear", signal_class:"ok", retry:"not_applicable"

出處與不聲稱:reason_code 與 retry 由線上網關(/api/pay、/api/x402/decision、/api/risk)產出,本頁與機讀 JSON 同源生成。多傳輸(stdio/SSE/streamable)的線路觀測與 451/-4510 換碼尚未實現,列為提議、待實現後再以可復現向量貢獻,絕不作前瞻聲稱。合規篩查 ≠ 完整/持牌 AML 合規;clear/allow ≠ 絕對安全。