# ATEL Wallet 契约模型源 v2.0

本文件是状态、错误和公共领域 schema 的 Markdown 生成源。运行 docs/build-docs.mjs 生成对应 JSON 和页面；生成物不得单独修改。所有状态与准入记录均为拟议规格，不代表运行验证。公共业务规则与事务说明见 08；每次修订须运行契约反例及跨文件一致性检查。

```json
{
  "version": "2.0.0",
  "stateMachines": {
    "title": "ATEL Wallet 状态与迁移规格",
    "version": "2.0.0",
    "status": "proposed-not-implemented",
    "machines": [
      {
        "object": "Task",
        "field": "task.status",
        "requirementIds": [
          "B6-01",
          "B7-01"
        ],
        "initial": "requirement_registered",
        "states": [
          {
            "key": "requirement_registered",
            "label": "已登记需求"
          },
          {
            "key": "checking",
            "label": "核对中"
          },
          {
            "key": "needs_info",
            "label": "待补资料"
          },
          {
            "key": "needs_revision",
            "label": "待修正"
          },
          {
            "key": "needs_confirmation",
            "label": "需用户确认"
          },
          {
            "key": "ready",
            "label": "待执行"
          },
          {
            "key": "executing",
            "label": "执行中"
          },
          {
            "key": "action_required",
            "label": "待用户接手"
          },
          {
            "key": "pending_verification",
            "label": "付款确认中"
          },
          {
            "key": "completed",
            "label": "已完成"
          },
          {
            "key": "blocked",
            "label": "已阻断",
            "executionTerminal": true
          },
          {
            "key": "cancelled",
            "label": "已取消"
          },
          {
            "key": "handoff",
            "label": "待人工处理"
          },
          {
            "key": "correction_required",
            "label": "结果需纠正"
          },
          {
            "key": "failed",
            "label": "已失败",
            "executionTerminal": true
          }
        ],
        "transitions": [
          {
            "from": "requirement_registered",
            "to": "checking",
            "on": "plan_submitted",
            "guard": "购买委托第二步：任务有已登记需求且需求基准形成时间早于方案提交时间；支付委托不经过本状态，创建后直接为核对中"
          },
          {
            "from": "requirement_registered",
            "to": "cancelled",
            "on": "user_cancel",
            "guard": "未提交方案，无外部可用凭据或在途付款"
          },
          {
            "from": "requirement_registered",
            "to": "blocked",
            "on": "denied",
            "guard": "实时禁止"
          },
          {
            "from": "checking",
            "to": "needs_info",
            "on": "material_insufficient",
            "guard": "无法核验必要字段；Vault 路径下读取请求失败或超时（会话失效、页面读不出、站点来源不符、摘要不一致）时同样进入，nextAction=provide_info，提示重新进入结账页再上报"
          },
          {
            "from": "checking",
            "to": "needs_revision",
            "on": "mismatch",
            "guard": "修正轮数小于2"
          },
          {
            "from": "checking",
            "to": "needs_confirmation",
            "on": "confirmation_required",
            "guard": "范围超限或歧义，此时尚无报价；只写待确认记录，不写一次性额度与基础腿预占（批准时才写）"
          },
          {
            "from": "needs_revision",
            "to": "needs_confirmation",
            "on": "confirmation_required",
            "guard": "范围超限或歧义，此时尚无报价；只写待确认记录，不写一次性额度与基础腿预占（批准时才写）"
          },
          {
            "from": "checking",
            "to": "ready",
            "on": "check_passed",
            "guard": "有效核对凭据"
          },
          {
            "from": "needs_info",
            "to": "checking",
            "on": "resubmitted",
            "guard": "新资料／方案或用户签署"
          },
          {
            "from": "needs_revision",
            "to": "checking",
            "on": "resubmitted",
            "guard": "新资料／方案或用户签署"
          },
          {
            "from": "needs_confirmation",
            "to": "checking",
            "on": "resubmitted",
            "guard": "新资料／方案或用户签署"
          },
          {
            "from": "ready",
            "to": "executing",
            "on": "dispatch_committed",
            "guard": "gate 的消费事务 C2 提交成功：许可 consuming→consumed，同事务创建凭据尝试（preparing）与付款（confirming）；这是与撤权竞争的线性化点"
          },
          {
            "from": "checking",
            "to": "blocked",
            "on": "denied",
            "guard": "实时禁止"
          },
          {
            "from": "ready",
            "to": "blocked",
            "on": "denied",
            "guard": "实时禁止"
          },
          {
            "from": "executing",
            "to": "action_required",
            "on": "handoff_created",
            "guard": "本阶段允许交还；包括 Vault 回报 site_blocks_automation（自动建 user_checkout 交接，同事务付款按 definitive_failure 关闭并释放预占）"
          },
          {
            "from": "action_required",
            "to": "pending_verification",
            "on": "user_finished_or_deadline",
            "guard": "先查原单；按钮不证明付款；触发源含 Vault 回调 order_evidence 到达、用户回到页面、交接到期"
          },
          {
            "from": "executing",
            "to": "pending_verification",
            "on": "result_unknown",
            "guard": "保留占用；Vault 路径下填写尝试转 pending_verification（requested 或 filled 超时无法确认，或 submitted 超过 300 秒无订单页证据）时同样进入"
          },
          {
            "from": "action_required",
            "to": "pending_verification",
            "on": "result_unknown",
            "guard": "保留占用"
          },
          {
            "from": "checking",
            "to": "completed",
            "on": "free_resource_fulfilled",
            "guard": "fetchMode=atel_fetch 的支付委托，资源请求直接返回 2xx、没有收到 402；未建付款行、无预占、无外发凭据"
          },
          {
            "from": "executing",
            "to": "completed",
            "on": "goal_verified",
            "guard": "付款已确认 succeeded，或用户预先允许的跨店部分成功；无未结执行或未知资金；父子目标按 allowPartial 聚合"
          },
          {
            "from": "pending_verification",
            "to": "completed",
            "on": "goal_verified",
            "guard": "付款已确认 succeeded，或用户预先允许的跨店部分成功；无未结执行或未知资金；父子目标按 allowPartial 聚合"
          },
          {
            "from": "pending_verification",
            "to": "checking",
            "on": "verified_not_submitted",
            "guard": "确认未扣款、无在途、旧能力不可用且 cancelStatus 非 requested；按当前权限重新核对"
          },
          {
            "from": "pending_verification",
            "to": "handoff",
            "on": "max_wait_exceeded",
            "guard": "超过72小时仅升级人工，不释放"
          },
          {
            "from": "handoff",
            "to": "pending_verification",
            "on": "new_verified_source",
            "guard": "重新查原动作"
          },
          {
            "from": "completed",
            "to": "correction_required",
            "on": "new_financial_correction",
            "guard": "迟到付款／重组等新事实"
          },
          {
            "from": "cancelled",
            "to": "correction_required",
            "on": "new_financial_correction",
            "guard": "迟到付款／重组等新事实"
          },
          {
            "from": "correction_required",
            "to": "pending_verification",
            "on": "reconcile",
            "guard": "追加事件保留历史"
          },
          {
            "from": "checking",
            "to": "cancelled",
            "on": "user_cancel",
            "guard": "未提交且无外部可用凭据或在途付款"
          },
          {
            "from": "needs_info",
            "to": "cancelled",
            "on": "user_cancel",
            "guard": "未提交且无外部可用凭据或在途付款"
          },
          {
            "from": "needs_revision",
            "to": "cancelled",
            "on": "user_cancel",
            "guard": "未提交且无外部可用凭据或在途付款"
          },
          {
            "from": "needs_confirmation",
            "to": "cancelled",
            "on": "user_cancel",
            "guard": "未提交且无外部可用凭据或在途付款"
          },
          {
            "from": "ready",
            "to": "cancelled",
            "on": "user_cancel",
            "guard": "未提交且无外部可用凭据或在途付款"
          },
          {
            "from": "requirement_registered",
            "to": "cancelled",
            "on": "wait_timeout",
            "guard": "等待状态 72 小时无进展（无新资料、新方案或用户操作），且无外部可用凭据或在途付款；原因 wait_timeout，通知用户与 Agent，释放占用与同一购买防重"
          },
          {
            "from": "needs_info",
            "to": "cancelled",
            "on": "wait_timeout",
            "guard": "等待状态 72 小时无进展（无新资料、新方案或用户操作），且无外部可用凭据或在途付款；原因 wait_timeout，通知用户与 Agent，释放占用与同一购买防重"
          },
          {
            "from": "needs_revision",
            "to": "cancelled",
            "on": "wait_timeout",
            "guard": "等待状态 72 小时无进展（无新资料、新方案或用户操作），且无外部可用凭据或在途付款；原因 wait_timeout，通知用户与 Agent，释放占用与同一购买防重"
          },
          {
            "from": "needs_confirmation",
            "to": "cancelled",
            "on": "wait_timeout",
            "guard": "等待状态 72 小时无进展（无新资料、新方案或用户操作），且无外部可用凭据或在途付款；原因 wait_timeout，通知用户与 Agent，释放占用与同一购买防重"
          },
          {
            "to": "blocked",
            "on": "denied",
            "guard": "当前安全限制拒绝；仅当无结果未知或在途执行；否则进入 pending_verification，停止新动作；Vault 尝试处于 requested 或 filled 且清空请求尚未确认，算在途",
            "from": "executing"
          },
          {
            "to": "blocked",
            "on": "denied",
            "guard": "当前安全限制拒绝；仅当无结果未知或在途执行；否则进入 pending_verification，停止新动作；Vault 尝试处于 requested 或 filled 且清空请求尚未确认，算在途",
            "from": "action_required"
          },
          {
            "to": "blocked",
            "on": "denied",
            "guard": "当前安全限制拒绝；仅当无结果未知或在途执行；否则进入 pending_verification，停止新动作",
            "from": "needs_info"
          },
          {
            "to": "blocked",
            "on": "denied",
            "guard": "当前安全限制拒绝；仅当无结果未知或在途执行；否则进入 pending_verification，停止新动作",
            "from": "needs_revision"
          },
          {
            "to": "blocked",
            "on": "denied",
            "guard": "当前安全限制拒绝；仅当无结果未知或在途执行；否则进入 pending_verification，停止新动作",
            "from": "needs_confirmation"
          },
          {
            "to": "needs_info",
            "on": "new_information_required",
            "guard": "保留已完成步骤；无在途/资金未知，所需资料只能由获准来源补充",
            "from": "ready"
          },
          {
            "to": "needs_info",
            "on": "new_information_required",
            "guard": "保留已完成步骤；无在途/资金未知，所需资料只能由获准来源补充",
            "from": "executing"
          },
          {
            "to": "action_required",
            "on": "handoff_created",
            "guard": "manual_checkout；已持久化可用交接与预算占用，记录首次 execution_entered 与 human_intervention",
            "from": "ready"
          },
          {
            "to": "checking",
            "on": "quote_or_plan_changed",
            "guard": "旧许可失效且确认未提交；按当前版本重新核对；包括 Vault 路径下最新摘要与许可摘要不一致（尚未外发，不增加 attempt_no）",
            "from": "ready"
          },
          {
            "to": "failed",
            "on": "goal_unachievable",
            "guard": "明确不可达成且无未知或仍可执行步骤；已知资金事实保留；按父子目标聚合",
            "from": "checking"
          },
          {
            "to": "failed",
            "on": "goal_unachievable",
            "guard": "明确不可达成且无未知或仍可执行步骤；已知资金事实保留；按父子目标聚合",
            "from": "needs_info"
          },
          {
            "to": "failed",
            "on": "goal_unachievable",
            "guard": "明确不可达成且无未知或仍可执行步骤；已知资金事实保留；按父子目标聚合",
            "from": "needs_revision"
          },
          {
            "to": "failed",
            "on": "goal_unachievable",
            "guard": "明确不可达成且无未知或仍可执行步骤；已知资金事实保留；按父子目标聚合",
            "from": "needs_confirmation"
          },
          {
            "to": "failed",
            "on": "goal_unachievable",
            "guard": "明确不可达成且无未知或仍可执行步骤；已知资金事实保留；按父子目标聚合",
            "from": "ready"
          },
          {
            "to": "failed",
            "on": "goal_unachievable",
            "guard": "明确不可达成且无未知或仍可执行步骤；已知资金事实保留；按父子目标聚合；包括付款 retryable=false 失败（declined 且无替代方式、spend_reverted、尝试次数耗尽）",
            "from": "executing"
          },
          {
            "to": "failed",
            "on": "goal_unachievable",
            "guard": "明确不可达成且无未知或仍可执行步骤；已知资金事实保留；按父子目标聚合",
            "from": "pending_verification"
          },
          {
            "to": "pending_verification",
            "on": "cancel_requested_or_inflight",
            "guard": "已存在外部能力或在途付款；保留事实与未结占用，停止新业务动作",
            "from": "ready"
          },
          {
            "to": "pending_verification",
            "on": "cancel_requested_or_inflight",
            "guard": "已存在外部能力或在途付款；保留事实与未结占用，停止新业务动作",
            "from": "executing"
          },
          {
            "to": "pending_verification",
            "on": "cancel_requested_or_inflight",
            "guard": "已存在外部能力或在途付款；保留事实与未结占用，停止新业务动作",
            "from": "action_required"
          },
          {
            "to": "pending_verification",
            "on": "cancel_requested_or_inflight",
            "guard": "已存在外部能力或在途付款；保留事实与未结占用，停止新业务动作",
            "from": "needs_info"
          },
          {
            "to": "pending_verification",
            "on": "cancel_requested_or_inflight",
            "guard": "已存在外部能力或在途付款；保留事实与未结占用，停止新业务动作",
            "from": "needs_revision"
          },
          {
            "to": "pending_verification",
            "on": "cancel_requested_or_inflight",
            "guard": "已存在外部能力或在途付款；保留事实与未结占用，停止新业务动作",
            "from": "needs_confirmation"
          },
          {
            "to": "cancelled",
            "on": "cancel_resolved",
            "guard": "cancelStatus=resolved；付款前取消；旧能力不可用，无在途付款；原任务未先完成",
            "from": "executing"
          },
          {
            "to": "cancelled",
            "on": "cancel_resolved",
            "guard": "cancelStatus=resolved；付款前取消；旧能力不可用，无在途付款；原任务未先完成",
            "from": "action_required"
          },
          {
            "to": "cancelled",
            "on": "cancel_resolved",
            "guard": "cancelStatus=resolved；付款前取消；旧能力不可用，无在途付款；原任务未先完成",
            "from": "pending_verification"
          },
          {
            "to": "cancelled",
            "on": "cancel_resolved",
            "guard": "cancelStatus=resolved；付款前取消；旧能力不可用，无在途付款；原任务未先完成",
            "from": "handoff"
          },
          {
            "to": "correction_required",
            "on": "contradictory_new_fact",
            "guard": "迟到资金事实追加；不能用终态忽略扣款",
            "from": "blocked"
          },
          {
            "to": "correction_required",
            "on": "contradictory_new_fact",
            "guard": "迟到资金事实追加；不能用终态忽略扣款",
            "from": "failed"
          },
          {
            "from": "ready",
            "to": "needs_confirmation",
            "on": "gate_confirmation_required",
            "guard": "放行评估返回 need_confirmation（over_limit、new_merchant_first_order、user_action_required、recurring_plan）；此刻无许可、无预占"
          },
          {
            "from": "needs_confirmation",
            "to": "ready",
            "on": "confirmation_approved",
            "guard": "单笔批准成功；意图凭据仍有效，需求、方案与授权版本和一次性额度绑定一致，报价未过期；批准时写一次性额度并预占基础腿"
          },
          {
            "from": "needs_confirmation",
            "to": "checking",
            "on": "confirmation_stale",
            "guard": "一次性额度或确认过期、报价上涨或除金额外的字段变化、版本变化、授权版本变化；仅降价且其他条件不变时不失效；释放预占，必要时旧意图凭据失效"
          },
          {
            "from": "executing",
            "to": "checking",
            "on": "vault_page_changed",
            "guard": "付款失败事件带 retryable=true 且 cause 为 vault_not_filled 或 vault_cleared，尝试次数小于 3：Vault 在未填卡时回报 checkout_mismatch、blocked（字段、门控、frame 类）、expired，或已清空卡字段的 cleared（summary_changed、permit_expired）；不适用于 submitted 之后；方案版本加 1，旧意图凭据失效，自动重读结账页（每任务最多 3 次）"
          },
          {
            "from": "executing",
            "to": "ready",
            "on": "payment_failed_retryable",
            "guard": "付款失败事件带 retryable=true 且 cause 为 signature_expired_unused、authorization_canceled 或 declined（declined 时授权内另有可用付款方式），尝试次数小于 3；释放预占后重新放行评估"
          },
          {
            "from": "executing",
            "to": "action_required",
            "on": "user_action_needed",
            "guard": "Vault 回报 blocked（cvv_not_provided、card_unavailable）或 user_verification_required（3DS）；前者付款已失败并释放，后者付款保持 confirming 并建本人验证交接"
          },
          {
            "from": "action_required",
            "to": "checking",
            "on": "user_action_completed",
            "guard": "起因是安全码未提供或卡不可用；用户补充安全码、换卡或点击已处理（只触发重新核对，不证明付款）；旧尝试已关闭，重新核对后重新放行，尝试次数加 1"
          },
          {
            "from": "pending_verification",
            "to": "blocked",
            "on": "denied_resolved",
            "guard": "授权已暂停、撤销、到期或被冻结，且已确认未扣款无在途（Vault 已回报 cleared 的 stop_spend，或 x402 授权已取消并确认）；释放占用"
          }
        ],
        "note": "completed 表示付款已确认成功（completed/full），或用户预先允许的跨店部分成功（completed/partial）；付款成功后的订单与履约不在钱包范围。取消只在付款前。failed/blocked 结束新业务执行，已知资金事实保留。late fact 允许纠正，不恢复旧许可。 Vault 路径与 x402 失败路径的迁移读付款失败事件（带 cause、retryable）而不直接读 Vault 回调。",
        "eventPolicy": "已鉴权并归一的来源事实；重复事件幂等，未列迁移拒绝并进入核实队列。不可用旧通知覆盖新事实。"
      },
      {
        "object": "Payment",
        "field": "payment.status",
        "requirementIds": [
          "B6-01"
        ],
        "initial": "none",
        "states": [
          {
            "key": "none",
            "label": "未发起"
          },
          {
            "key": "confirming",
            "label": "付款确认中"
          },
          {
            "key": "succeeded",
            "label": "付款成功"
          },
          {
            "key": "failed",
            "label": "付款失败"
          }
        ],
        "transitions": [
          {
            "from": "none",
            "to": "confirming",
            "on": "dispatch_committed",
            "guard": "金融日志已持久化；付款行在 gate 消费事务 C2 内创建且初始即为 confirming，none 只是没有付款行时接口返回的虚值"
          },
          {
            "from": "confirming",
            "to": "succeeded",
            "on": "settlement_verified",
            "guard": "权威通道事实，或链上事实达到本付款确认策略要求的级别（finalized_v1 需 finalized；small_safe_v1 safe 即可）"
          },
          {
            "from": "confirming",
            "to": "failed",
            "on": "definitive_failure",
            "guard": "已确认无扣款及无在途；Vault 路径含未提交前的 vault_not_filled、vault_cleared、stop_spend 与订单页明确 declined，x402 含 signature_expired_unused、authorization_canceled、spend_reverted；submitted 之后只等订单页证据或 72 小时转人工，不得判失败"
          },
          {
            "from": "succeeded",
            "to": "confirming",
            "on": "reorg_detected",
            "guard": "链上重组：保留原历史并追加补偿，沿原交易重新核实"
          },
          {
            "from": "failed",
            "to": "confirming",
            "on": "contradictory_new_fact",
            "guard": "迟到事实需核实，只查询原交易，不重付"
          }
        ],
        "note": "付款最终结果只有 succeeded 与 failed；confirming 是过程状态，只查询原交易，不重付，超时不转为失败。退款到账另记 Refund 记录；资金冻结用 fundsAvailability，不改写历史付款。 付款在放行许可被消费的事务内创建，直接进入 confirming。",
        "eventPolicy": "已鉴权并归一的来源事实；重复事件幂等，未列迁移拒绝并进入核实队列。不可用旧通知覆盖新事实。"
      },
      {
        "object": "CredentialIssuance",
        "field": "credential.status",
        "requirementIds": [
          "B5-09",
          "B6-02"
        ],
        "initial": "preparing",
        "states": [
          {
            "key": "preparing",
            "label": "准备中"
          },
          {
            "key": "issuing_unknown",
            "label": "签发待核实"
          },
          {
            "key": "ready",
            "label": "可使用"
          },
          {
            "key": "auth_required",
            "label": "待认证"
          },
          {
            "key": "used",
            "label": "已使用",
            "terminal": true
          },
          {
            "key": "deactivating",
            "label": "停用中"
          },
          {
            "key": "closed",
            "label": "已关闭"
          }
        ],
        "transitions": [
          {
            "from": "preparing",
            "to": "ready",
            "on": "issued",
            "guard": "确认唯一渠道引用"
          },
          {
            "from": "preparing",
            "to": "issuing_unknown",
            "on": "issue_timeout",
            "guard": "不能新发"
          },
          {
            "from": "issuing_unknown",
            "to": "ready",
            "on": "issuance_found",
            "guard": "查询原尝试"
          },
          {
            "from": "preparing",
            "to": "closed",
            "on": "definitively_not_issued",
            "guard": "确认无外部能力"
          },
          {
            "from": "issuing_unknown",
            "to": "closed",
            "on": "definitively_not_issued",
            "guard": "确认无外部能力"
          },
          {
            "from": "ready",
            "to": "auth_required",
            "on": "authentication_requested",
            "guard": "渠道事实"
          },
          {
            "from": "auth_required",
            "to": "ready",
            "on": "authentication_completed",
            "guard": "渠道事实"
          },
          {
            "from": "ready",
            "to": "used",
            "on": "payment_created",
            "guard": "关联同一 Payment；不是结算成功"
          },
          {
            "from": "auth_required",
            "to": "used",
            "on": "payment_created",
            "guard": "关联同一 Payment；不是结算成功"
          },
          {
            "from": "deactivating",
            "to": "used",
            "on": "payment_created",
            "guard": "关联同一 Payment；不是结算成功"
          },
          {
            "from": "ready",
            "to": "deactivating",
            "on": "revoke_or_expire",
            "guard": "请求停用并查询原付款"
          },
          {
            "from": "auth_required",
            "to": "deactivating",
            "on": "revoke_or_expire",
            "guard": "请求停用并查询原付款"
          },
          {
            "from": "deactivating",
            "to": "closed",
            "on": "closed_unused",
            "guard": "确认不可用且无在途付款"
          },
          {
            "to": "used",
            "on": "verified_late_use",
            "guard": "权威事实证明原凭据已用；追加纠正与原付款、必要账务补偿，不重新签发",
            "from": "closed"
          }
        ],
        "note": "",
        "eventPolicy": "已鉴权并归一的来源事实；重复事件幂等，未列迁移拒绝并进入核实队列。不可用旧通知覆盖新事实。"
      },
      {
        "object": "SpendingMandate",
        "field": "mandate.status",
        "requirementIds": [
          "B1-07",
          "X1-01",
          "X1-02",
          "X1-04"
        ],
        "initial": "draft",
        "states": [
          {
            "key": "draft",
            "label": "待签署"
          },
          {
            "key": "activation_pending",
            "label": "待权限生效"
          },
          {
            "key": "active",
            "label": "生效"
          },
          {
            "key": "paused",
            "label": "暂停"
          },
          {
            "key": "revoked",
            "label": "已撤销",
            "terminal": true
          },
          {
            "key": "expired",
            "label": "已到期",
            "terminal": true
          }
        ],
        "transitions": [
          {
            "from": "activation_pending",
            "to": "active",
            "on": "capabilities_confirmed",
            "guard": "所选executionModes全部已准入；链上按安装确认策略验证；manual_checkout仅验证交接能力；版本/epoch/期限当前有效"
          },
          {
            "from": "activation_pending",
            "to": "paused",
            "on": "pause_or_security_freeze",
            "guard": "版本与 epoch 递增"
          },
          {
            "from": "active",
            "to": "paused",
            "on": "pause_or_security_freeze",
            "guard": "版本与 epoch 递增"
          },
          {
            "from": "paused",
            "to": "activation_pending",
            "on": "user_resume",
            "guard": "新签署；安全事件凭据已轮换"
          },
          {
            "from": "activation_pending",
            "to": "revoked",
            "on": "revoke",
            "guard": "原子停止签发与消费，外部清理另记"
          },
          {
            "from": "active",
            "to": "revoked",
            "on": "revoke",
            "guard": "原子停止签发与消费，外部清理另记"
          },
          {
            "from": "paused",
            "to": "revoked",
            "on": "revoke",
            "guard": "原子停止签发与消费，外部清理另记"
          },
          {
            "from": "activation_pending",
            "to": "expired",
            "on": "deadline",
            "guard": "不释放在途"
          },
          {
            "from": "active",
            "to": "expired",
            "on": "deadline",
            "guard": "不释放在途"
          },
          {
            "from": "paused",
            "to": "expired",
            "on": "deadline",
            "guard": "不释放在途"
          },
          {
            "from": "active",
            "to": "activation_pending",
            "on": "renew_before_expiry",
            "guard": "签署新版本并保留 budgetContinuityId"
          },
          {
            "to": "activation_pending",
            "on": "signed",
            "guard": "用户新鲜passkey；同资产唯一；发signed与activation_requested，不发activated",
            "from": "draft"
          },
          {
            "to": "expired",
            "on": "draft_deadline",
            "guard": "24小时未签署，归档或清理草稿",
            "from": "draft"
          },
          {
            "to": "activation_pending",
            "on": "authority_changed",
            "guard": "新签署版本；本地收紧立即阻断旧许可，新权限验证前不执行",
            "from": "active"
          }
        ],
        "note": "expired 后续期建立新 mandateId，不能回 active。撤销即进入 revoked，不设“撤销中”状态；渠道停用与在途清理进度属于风险视图（X1-02 的 exposureComponents 与 revocationCleanupStatus），独立于权限状态。",
        "eventPolicy": "已鉴权并归一的来源事实；重复事件幂等，未列迁移拒绝并进入核实队列。不可用旧通知覆盖新事实。"
      },
      {
        "object": "AgentConnection",
        "field": "connection.status",
        "requirementIds": [
          "B1-02",
          "B1-03",
          "X1-07"
        ],
        "initial": "pending",
        "states": [
          {
            "key": "pending",
            "label": "待确认"
          },
          {
            "key": "connected",
            "label": "已连接"
          },
          {
            "key": "disconnected",
            "label": "已断开",
            "terminal": true
          }
        ],
        "transitions": [
          {
            "from": "pending",
            "to": "connected",
            "on": "user_confirmed",
            "guard": "有效一次性绑定与 passkey"
          },
          {
            "from": "pending",
            "to": "disconnected",
            "on": "expired_or_rejected",
            "guard": "绑定超时或用户拒绝"
          },
          {
            "from": "connected",
            "to": "disconnected",
            "on": "disconnect",
            "guard": "用户会话＋近期验证，或 Agent 令牌自证；令牌失效并撤权；在途核验独立"
          }
        ],
        "note": "",
        "eventPolicy": "已鉴权并归一的来源事实；重复事件幂等，未列迁移拒绝并进入核实队列。不可用旧通知覆盖新事实。"
      },
      {
        "object": "IntentCertificate",
        "field": "intentCheck.status",
        "requirementIds": [
          "B4-01",
          "B4-04"
        ],
        "initial": "checking",
        "states": [
          {
            "key": "checking",
            "label": "核对中"
          },
          {
            "key": "needs_info",
            "label": "待补资料"
          },
          {
            "key": "needs_revision",
            "label": "待修正"
          },
          {
            "key": "needs_confirmation",
            "label": "需澄清"
          },
          {
            "key": "verified",
            "label": "已核对"
          },
          {
            "key": "invalidated",
            "label": "已失效",
            "terminal": true
          }
        ],
        "transitions": [
          {
            "from": "checking",
            "to": "needs_info",
            "on": "missing_material",
            "guard": "必要材料缺失"
          },
          {
            "from": "checking",
            "to": "needs_revision",
            "on": "mismatch",
            "guard": "可修正"
          },
          {
            "from": "checking",
            "to": "needs_confirmation",
            "on": "ambiguous",
            "guard": "不能自行推断"
          },
          {
            "from": "needs_info",
            "to": "checking",
            "on": "resubmission",
            "guard": "核对新版本"
          },
          {
            "from": "needs_revision",
            "to": "checking",
            "on": "resubmission",
            "guard": "核对新版本"
          },
          {
            "from": "needs_confirmation",
            "to": "checking",
            "on": "resubmission",
            "guard": "核对新版本"
          },
          {
            "from": "checking",
            "to": "verified",
            "on": "check_passed",
            "guard": "来源标记且规则通过"
          },
          {
            "from": "verified",
            "to": "invalidated",
            "on": "changed_or_expired",
            "guard": "需求／方案／材料／授权版本变化；建立新证书"
          }
        ],
        "note": "",
        "eventPolicy": "已鉴权并归一的来源事实；重复事件幂等，未列迁移拒绝并进入核实队列。不可用旧通知覆盖新事实。"
      },
      {
        "object": "Refund",
        "field": "refund.status",
        "requirementIds": [
          "B7-05"
        ],
        "initial": "received",
        "states": [
          {
            "key": "received",
            "label": "退款到账"
          },
          {
            "key": "returned",
            "label": "退款退回"
          }
        ],
        "transitions": [
          {
            "from": "received",
            "to": "returned",
            "on": "provider_returned",
            "guard": "追加 refund_reversal 并通知，不自动再退"
          },
          {
            "from": "returned",
            "to": "received",
            "on": "return_reversed",
            "guard": "同一退款新的权威修订"
          }
        ],
        "note": "ATEL 不办理退款申请；只在付款渠道上看到资金退回时记一笔退款到账，每笔一个实例。partial 是支付上的汇总显示，不是单笔状态。",
        "eventPolicy": "已鉴权并归一的来源事实；重复事件幂等，未列迁移拒绝并进入核实队列。不可用旧通知覆盖新事实。"
      },
      {
        "object": "EvidenceCheckpoint",
        "field": "anchor.status",
        "requirementIds": [
          "X3-08"
        ],
        "initial": "none",
        "states": [
          {
            "key": "none",
            "label": "未提交"
          },
          {
            "key": "submitting",
            "label": "提交中"
          },
          {
            "key": "included",
            "label": "已收录"
          },
          {
            "key": "safe",
            "label": "safe"
          },
          {
            "key": "confirmed",
            "label": "最终确认"
          },
          {
            "key": "failed",
            "label": "失败待重试"
          },
          {
            "key": "reorg_pending",
            "label": "重组待核实"
          }
        ],
        "transitions": [
          {
            "from": "none",
            "to": "submitting",
            "on": "submit",
            "guard": "同检查点可幂等重试"
          },
          {
            "from": "failed",
            "to": "submitting",
            "on": "submit",
            "guard": "同检查点可幂等重试"
          },
          {
            "from": "submitting",
            "to": "included",
            "on": "receipt_found",
            "guard": "校验原链与交易"
          },
          {
            "from": "included",
            "to": "safe",
            "on": "safe_verified",
            "guard": "可信来源"
          },
          {
            "from": "included",
            "to": "confirmed",
            "on": "finalized_verified",
            "guard": "校验 blockHash 与 finalized"
          },
          {
            "from": "safe",
            "to": "confirmed",
            "on": "finalized_verified",
            "guard": "校验 blockHash 与 finalized"
          },
          {
            "from": "submitting",
            "to": "failed",
            "on": "submission_failed",
            "guard": "不影响业务交易"
          },
          {
            "from": "included",
            "to": "reorg_pending",
            "on": "reorg_detected",
            "guard": "原包不变，追加回执"
          },
          {
            "from": "safe",
            "to": "reorg_pending",
            "on": "reorg_detected",
            "guard": "原包不变，追加回执"
          },
          {
            "from": "confirmed",
            "to": "reorg_pending",
            "on": "reorg_detected",
            "guard": "原包不变，追加回执"
          },
          {
            "from": "reorg_pending",
            "to": "submitting",
            "on": "resubmit_after_reconcile",
            "guard": "核查原锚定无重复冲突"
          }
        ],
        "note": "",
        "eventPolicy": "已鉴权并归一的来源事实；重复事件幂等，未列迁移拒绝并进入核实队列。不可用旧通知覆盖新事实。"
      },
      {
        "object": "OneTimeGrant",
        "field": "grant.status",
        "requirementIds": [
          "B5-02"
        ],
        "initial": "awaiting_chain",
        "states": [
          {
            "key": "awaiting_chain",
            "label": "待链上权限"
          },
          {
            "key": "ready",
            "label": "可使用"
          },
          {
            "key": "consumed",
            "label": "已消费"
          },
          {
            "key": "inflight_unknown",
            "label": "在途待核实"
          },
          {
            "key": "invalidated",
            "label": "已失效",
            "terminal": true
          },
          {
            "key": "expired",
            "label": "已到期",
            "terminal": true
          }
        ],
        "transitions": [
          {
            "from": "awaiting_chain",
            "to": "ready",
            "on": "capability_confirmed",
            "guard": "预算已预占且未到期；链上所需证明已确认，或manual_checkout无需新链上能力"
          },
          {
            "from": "ready",
            "to": "consumed",
            "on": "permit_consumed",
            "guard": "B5-04 原子版本与参数复核"
          },
          {
            "from": "consumed",
            "to": "inflight_unknown",
            "on": "dispatch_unknown",
            "guard": "不释放或再批"
          },
          {
            "from": "inflight_unknown",
            "to": "consumed",
            "on": "fact_reconciled",
            "guard": "保留已消费标记，释放仅未结部分"
          },
          {
            "from": "awaiting_chain",
            "to": "invalidated",
            "on": "authority_or_quote_changed",
            "guard": "消费前失效并核对外部风险"
          },
          {
            "from": "ready",
            "to": "invalidated",
            "on": "authority_or_quote_changed",
            "guard": "消费前失效并核对外部风险"
          },
          {
            "from": "awaiting_chain",
            "to": "expired",
            "on": "deadline",
            "guard": "最早的30分钟／报价／授权／自然周期边界"
          },
          {
            "from": "ready",
            "to": "expired",
            "on": "deadline",
            "guard": "最早的30分钟／报价／授权／自然周期边界"
          }
        ],
        "note": "awaiting_chain仅表示待所需能力；无需链上安装时创建事务内完成capability_confirmed到ready。confirmedAt起30分钟不延长（放行时另签10分钟动作许可）；退款不重新激活。",
        "eventPolicy": "已鉴权并归一的来源事实；重复事件幂等，未列迁移拒绝并进入核实队列。不可用旧通知覆盖新事实。"
      },
      {
        "object": "HandoffAttempt",
        "field": "handoff.status",
        "requirementIds": [
          "E3-03",
          "E4-02",
          "E4-04"
        ],
        "initial": "awaiting_user",
        "states": [
          {
            "key": "awaiting_user",
            "label": "待用户付款"
          },
          {
            "key": "closing",
            "label": "核实关闭"
          },
          {
            "key": "pending_verification",
            "label": "待核实"
          },
          {
            "key": "paid",
            "label": "已付款"
          },
          {
            "key": "closed_unpaid",
            "label": "已关闭未付款"
          },
          {
            "key": "correction_required",
            "label": "迟到结果需核实"
          }
        ],
        "transitions": [
          {
            "from": "awaiting_user",
            "to": "closing",
            "on": "deadline_or_cancel",
            "guard": "请求关闭外部支付会话"
          },
          {
            "from": "awaiting_user",
            "to": "pending_verification",
            "on": "clicked_or_unknown",
            "guard": "用户按钮不确认为付款"
          },
          {
            "from": "closing",
            "to": "pending_verification",
            "on": "clicked_or_unknown",
            "guard": "用户按钮不确认为付款"
          },
          {
            "from": "awaiting_user",
            "to": "paid",
            "on": "payment_verified",
            "guard": "归属原单且权威资金事实；差异单独记录"
          },
          {
            "from": "closing",
            "to": "paid",
            "on": "payment_verified",
            "guard": "归属原单且权威资金事实；差异单独记录"
          },
          {
            "from": "pending_verification",
            "to": "paid",
            "on": "payment_verified",
            "guard": "归属原单且权威资金事实；差异单独记录"
          },
          {
            "from": "closing",
            "to": "closed_unpaid",
            "on": "closed_unpaid_verified",
            "guard": "会话不可再支付且无在途"
          },
          {
            "from": "pending_verification",
            "to": "closed_unpaid",
            "on": "closed_unpaid_verified",
            "guard": "会话不可再支付且无在途"
          },
          {
            "from": "closed_unpaid",
            "to": "correction_required",
            "on": "late_payment_fact",
            "guard": "追加实际资金事实"
          },
          {
            "from": "correction_required",
            "to": "paid",
            "on": "reconciled_paid",
            "guard": "真实记账并提示差异"
          }
        ],
        "note": "",
        "eventPolicy": "已鉴权并归一的来源事实；重复事件幂等，未列迁移拒绝并进入核实队列。不可用旧通知覆盖新事实。"
      },
      {
        "object": "ActionPermit",
        "field": "permit.status",
        "requirementIds": [
          "B5-04"
        ],
        "initial": "issuing",
        "states": [
          {
            "key": "issuing",
            "label": "签发中"
          },
          {
            "key": "issued",
            "label": "已签发"
          },
          {
            "key": "consuming",
            "label": "消费中"
          },
          {
            "key": "consumed",
            "label": "已消费",
            "terminal": true
          },
          {
            "key": "invalidated",
            "label": "已失效",
            "terminal": true
          },
          {
            "key": "expired",
            "label": "已到期",
            "terminal": true
          },
          {
            "key": "issue_failed",
            "label": "签发失败",
            "terminal": true
          }
        ],
        "transitions": [
          {
            "from": "issuing",
            "to": "issued",
            "on": "issue_confirmed",
            "guard": "ATEL 或密钥服务返回签名，验签通过且 paramsHash 一致，行仍为 issuing；回填签名后有效期取两者较小"
          },
          {
            "from": "issuing",
            "to": "issue_failed",
            "on": "issue_rejected",
            "guard": "ATEL 明确拒绝，或同键查询得出无此许可且超过 120 秒；释放预占，动作记录转 resolved（not_dispatched）"
          },
          {
            "from": "issued",
            "to": "consuming",
            "on": "consume_started",
            "guard": "C1：持授权行锁，签名、有效期、执行器、paramsHash（用 actual 重算）、意图凭据、授权版本与撤权版本、预算、专项额度全部复核通过"
          },
          {
            "from": "consuming",
            "to": "consumed",
            "on": "consume_confirmed",
            "guard": "C2：持授权行锁，重读授权状态、撤权版本与限制版本仍与签发时一致，ATEL 已确认消费；同事务创建凭据尝试与付款，任务进入执行中"
          },
          {
            "from": "issuing",
            "to": "invalidated",
            "on": "version_or_restriction_changed",
            "guard": "撤权、暂停、冻结、取消或版本变化，在授权行锁内同事务作废；消费前的变更使 C2 落空"
          },
          {
            "from": "issued",
            "to": "invalidated",
            "on": "version_or_restriction_changed",
            "guard": "撤权、暂停、冻结、取消或版本变化，在授权行锁内同事务作废；消费前的变更使 C2 落空"
          },
          {
            "from": "consuming",
            "to": "invalidated",
            "on": "version_or_restriction_changed",
            "guard": "撤权、暂停、冻结、取消或版本变化，在授权行锁内同事务作废；消费前的变更使 C2 落空"
          },
          {
            "from": "consuming",
            "to": "invalidated",
            "on": "consume_rejected",
            "guard": "ATEL 明确拒绝（已被别处消费、已过期、已被撤销）；释放预占"
          },
          {
            "from": "issued",
            "to": "expired",
            "on": "deadline",
            "guard": "未消费且达到最早期限"
          },
          {
            "from": "consuming",
            "to": "expired",
            "on": "consume_abandoned",
            "guard": "到许可有效期仍未拿到 ATEL 的确认；释放预占并进入孤儿检查"
          }
        ],
        "note": "签发与消费各分两段并落库：issuing 与 consuming 是 ATEL 调用期间的中间状态，调用不在事务与行锁内；consumed 之后外部结果由 ActionAttempt／Payment 处理，不通过重新激活 permit 重试。ATEL 状态不明时不外发，恢复统一按 actionAttemptId 查询或同键重放。",
        "eventPolicy": "已鉴权并归一的来源事实；重复事件幂等，未列迁移拒绝并进入核实队列。不可用旧通知覆盖新事实。"
      },
      {
        "object": "VaultFillAttempt",
        "field": "vaultFill.status",
        "requirementIds": [
          "B5-04",
          "E1-01",
          "E1-02",
          "E1-03",
          "E1-04"
        ],
        "initial": "requested",
        "states": [
          {
            "key": "requested",
            "label": "已请求 Vault 代填"
          },
          {
            "key": "filled",
            "label": "已填卡"
          },
          {
            "key": "submitted",
            "label": "已提交，等待网站结果"
          },
          {
            "key": "cleared",
            "label": "页面变化，已清空卡字段",
            "terminal": true
          },
          {
            "key": "mismatch",
            "label": "结账页面与许可不一致",
            "terminal": true
          },
          {
            "key": "blocked",
            "label": "Vault 拒绝填写",
            "terminal": true
          },
          {
            "key": "expired",
            "label": "许可到期未填写",
            "terminal": true
          },
          {
            "key": "result_recorded",
            "label": "网站结果已关联",
            "terminal": true
          },
          {
            "key": "pending_verification",
            "label": "结果待核实"
          }
        ],
        "transitions": [
          {
            "from": "requested",
            "to": "filled",
            "on": "vault_filled",
            "guard": "Vault 复核页面摘要与动作许可一致且域名完整匹配"
          },
          {
            "from": "requested",
            "to": "mismatch",
            "on": "checkout_mismatch",
            "guard": "页面摘要或域名与许可不一致；Vault 未填卡，付款按 definitive_failure 关闭（vault_not_filled），任务回到核对"
          },
          {
            "from": "requested",
            "to": "blocked",
            "on": "vault_blocked",
            "guard": "按 blockReason 分流：卡不可用、字段未获准、Vault 自身门控拒绝、支付框不在许可内、网站拦截自动填写、用户未输入安全码；付款 vault_not_filled 失败，任务按原因回核对或待用户接手"
          },
          {
            "from": "requested",
            "to": "expired",
            "on": "permit_expired",
            "guard": "动作许可到期且确认未填写"
          },
          {
            "from": "requested",
            "to": "blocked",
            "on": "clear_request_before_fill",
            "guard": "停止花钱：Vault 收到清空请求时尚未填写，回报 blockReason=stop_spend"
          },
          {
            "from": "filled",
            "to": "cleared",
            "on": "clear_requested_ack",
            "guard": "停止花钱：Vault 收到清空请求并清空卡字段，原因 stop_spend"
          },
          {
            "from": "filled",
            "to": "cleared",
            "on": "summary_changed",
            "guard": "提交前页面摘要变化，Vault 已清空卡字段；付款 vault_cleared 失败，任务回到核对"
          },
          {
            "from": "filled",
            "to": "submitted",
            "on": "submit_observed",
            "guard": "Vault 插件观察到 Agent 点击提交（表单 submit 事件、登记的提交按钮点击或跳转到登记的确认页地址），回调带 submittedVia；插件不执行点击"
          },
          {
            "from": "filled",
            "to": "pending_verification",
            "on": "outcome_unknown",
            "guard": "页面无响应、超时或 Agent 掉线，提交与否不明；许可到期后超过 120 秒且 getFillStatus 不可达"
          },
          {
            "from": "submitted",
            "to": "result_recorded",
            "on": "order_evidence_linked",
            "guard": "订单页、确认邮件或支付方结果已关联原任务"
          },
          {
            "from": "submitted",
            "to": "pending_verification",
            "on": "outcome_unknown",
            "guard": "超过 300 秒没有可信结果来源（订单页证据）"
          },
          {
            "from": "pending_verification",
            "to": "result_recorded",
            "on": "order_evidence_linked",
            "guard": "取得可信结果并关联原任务"
          },
          {
            "from": "pending_verification",
            "to": "cleared",
            "on": "not_submitted_verified",
            "guard": "确认网站未下单且无在途付款"
          },
          {
            "from": "requested",
            "to": "pending_verification",
            "on": "outcome_unknown",
            "guard": "超过许可到期时间 120 秒仍无回调且 getFillStatus 不可达；保留占用，不重复填卡"
          },
          {
            "from": "filled",
            "to": "cleared",
            "on": "permit_expired_cleared",
            "guard": "Agent 超过许可期没有点击提交，Vault 本地定时清空并回调 cleared（reason=permit_expired）；付款 vault_cleared 失败，任务回到核对"
          },
          {
            "from": "submitted",
            "to": "submitted",
            "on": "user_verification",
            "guard": "回调 user_verification_required（3DS 等本人验证）；状态不变，付款保持 confirming，任务转待用户接手"
          }
        ],
        "note": "同一结账在 filled、submitted、pending_verification 期间不得再次请求代填；前台“已填卡，等待网站结果”对应 Task.executing 且本对象为 filled 或 submitted。 提交由 Agent 点击，Vault 只观察；未提交前的 mismatch、blocked、cleared 使付款按 definitive_failure 关闭，submitted 之后只等订单页证据。cleared 的 reason 为 summary_changed、stop_spend、permit_expired、other。",
        "eventPolicy": "仅接受 Vault 已鉴权回调与 Wallet 已归一的结果事实；重复事件幂等，未列迁移拒绝并进入核实队列。"
      },
      {
        "object": "IntentRecord",
        "field": "intent_record.status",
        "requirementIds": [
          "B2-03",
          "B5-02"
        ],
        "initial": "recognized",
        "states": [
          {
            "key": "recognized",
            "label": "已识别（待策略判定）"
          },
          {
            "key": "passed",
            "label": "已通过（L1 足够）"
          },
          {
            "key": "awaiting_confirmation",
            "label": "待用户确认（升 L2）"
          },
          {
            "key": "confirmed",
            "label": "用户已确认（L2）"
          },
          {
            "key": "rejected",
            "label": "用户否决",
            "terminal": true
          },
          {
            "key": "blocked",
            "label": "已拦下",
            "terminal": true
          },
          {
            "key": "expired",
            "label": "确认已过期",
            "terminal": true
          },
          {
            "key": "superseded",
            "label": "已被新版本取代",
            "terminal": true
          }
        ],
        "transitions": [
          {
            "from": "recognized",
            "to": "passed",
            "on": "policy_pass",
            "guard": "整体保障达到策略要求，非降级，无冲突与更宽推断"
          },
          {
            "from": "recognized",
            "to": "awaiting_confirmation",
            "on": "policy_need_l2",
            "guard": "冲突、更宽推断、必填低置信、超额、高风险品类、含自动续费、新商家首单或模型降级任一成立"
          },
          {
            "from": "recognized",
            "to": "blocked",
            "on": "policy_block",
            "guard": "策略表判定拦下"
          },
          {
            "from": "awaiting_confirmation",
            "to": "confirmed",
            "on": "user_confirmed",
            "guard": "用户本人在确认页逐项选择并提交；合并单笔确认时同一次 passkey 通过"
          },
          {
            "from": "awaiting_confirmation",
            "to": "rejected",
            "on": "user_rejected",
            "guard": "用户否决整份意图"
          },
          {
            "from": "awaiting_confirmation",
            "to": "expired",
            "on": "confirmation_timeout",
            "guard": "确认链接到期未提交（独立确认 24 小时；合并单笔确认时 30 分钟）"
          },
          {
            "from": "recognized",
            "to": "superseded",
            "on": "new_version",
            "guard": "同一任务已生成更高版本的意图"
          },
          {
            "from": "passed",
            "to": "superseded",
            "on": "new_version",
            "guard": "补缺项、用户改口或确认生成更高版本；旧意图凭据与放行许可随之失效"
          },
          {
            "from": "awaiting_confirmation",
            "to": "superseded",
            "on": "new_version",
            "guard": "Agent 重新登记生成更高版本"
          },
          {
            "from": "confirmed",
            "to": "superseded",
            "on": "new_version",
            "guard": "用户改口或补缺项生成更高版本；旧意图凭据与放行许可随之失效"
          }
        ],
        "note": "提交安全层的结果在 intent_record.submit_state（pending／accepted／rejected）记录，不改变本状态机；降级时 policy_need_l2 必然成立。",
        "eventPolicy": "已鉴权并归一的来源事实；重复事件幂等，未列迁移拒绝并进入核实队列。不可用旧通知覆盖新事实。"
      }
    ]
  },
  "errorCodes": {
    "title": "ATEL Wallet 错误码与状态型返回（拟议）",
    "version": "2.0.0",
    "status": "proposed-not-implemented",
    "envelope": {
      "requestId": "string",
      "error": {
        "code": "string",
        "message": "string",
        "retryable": "boolean",
        "issues": "[{field,code,message}]",
        "taskId": "string|null (optional)",
        "retryAfterSeconds": "integer>=0 (optional)",
        "nextAction": "none|wait|user_confirm|user_action|provide_info (optional)",
        "details": "object (optional)"
      }
    },
    "codes": [
      {
        "code": "ERR_AUTH_INVALID",
        "http": 401,
        "meaning": "连接或授权失效",
        "agentAction": "停止新动作，提示用户在钱包重新连接或授权",
        "retryable": false,
        "requirementIds": [
          "B1-03",
          "X1-02"
        ]
      },
      {
        "code": "ERR_OBJECT_FORBIDDEN",
        "http": 403,
        "meaning": "访问或操作不属于本用户的对象",
        "agentAction": "不重试；不得据返回推断对象是否存在",
        "retryable": false,
        "requirementIds": [
          "B5-05"
        ]
      },
      {
        "code": "ERR_MANDATE_PAUSED",
        "http": 403,
        "meaning": "授权已暂停",
        "agentAction": "告知用户在钱包恢复授权",
        "retryable": false,
        "requirementIds": [
          "X1-01"
        ]
      },
      {
        "code": "ERR_APP_SUSPENDED",
        "http": 403,
        "meaning": "Agent 应用已被暂停",
        "agentAction": "停止资金类请求，可查询已有任务",
        "retryable": false,
        "requirementIds": [
          "O1-07",
          "O1-16"
        ]
      },
      {
        "code": "ERR_SPEC_MISMATCH",
        "http": 422,
        "meaning": "规格、数量、金额、币种或收款方与需求冲突",
        "agentAction": "按 details.conflicts 修正方案后重新提交，最多自动修正 2 轮",
        "retryable": true,
        "requirementIds": [
          "B4-01",
          "B4-02"
        ]
      },
      {
        "code": "ERR_BUDGET_EXCEEDED",
        "http": 422,
        "meaning": "超出单笔或周期预算（含在途占用）；链上本周期剩余更小时 details.limitedBy 为 chain_period，details.resetsAt 为本周期结束时间",
        "agentAction": "调整方案，或引导用户打开确认链接追加授权",
        "retryable": false,
        "requirementIds": [
          "B5-02",
          "X1-05"
        ]
      },
      {
        "code": "ERR_QUOTE_EXPIRED",
        "http": 409,
        "meaning": "报价过期或已变化",
        "agentAction": "等待系统重取报价或重新提交方案",
        "retryable": true,
        "requirementIds": [
          "B4-06"
        ]
      },
      {
        "code": "ERR_DUPLICATE_REQUEST",
        "http": 409,
        "meaning": "同一幂等键内容不同；同键请求仍在处理；内部环节同一业务已在进行",
        "agentAction": "同键仍在处理时按 Retry-After 稍后重试；不得换键重发；查询 details.taskId 的当前状态，不新建购买",
        "retryable": false,
        "requirementIds": [
          "B2-06"
        ]
      },
      {
        "code": "ERR_PERMIT_USED",
        "http": 409,
        "meaning": "动作许可已被使用",
        "agentAction": "查询原执行记录",
        "retryable": false,
        "requirementIds": [
          "B5-04"
        ]
      },
      {
        "code": "ERR_PERMIT_EXPIRED",
        "http": 409,
        "meaning": "动作许可已到期",
        "agentAction": "系统先查原动作是否已提交；未提交时重新检查后续接",
        "retryable": true,
        "requirementIds": [
          "B5-04"
        ]
      },
      {
        "code": "ERR_INVENTORY_CONFLICT",
        "http": 409,
        "meaning": "库存不足或档期失效",
        "agentAction": "重新选择商品或档期",
        "retryable": true,
        "requirementIds": []
      },
      {
        "code": "ERR_INFO_REQUIRED",
        "http": 422,
        "meaning": "缺少办理所需资料",
        "agentAction": "按 details.requiredInfo 补齐；需用户提供的引导用户到资料页",
        "retryable": true,
        "requirementIds": [
          "B2-05",
          "B3-02"
        ]
      },
      {
        "code": "ERR_SENSITIVE_INFO_NOT_ALLOWED",
        "http": 422,
        "meaning": "该资料不允许经 Agent 提交",
        "agentAction": "不得再提交同一项；把 userPageUrl 交给用户，由用户在 ATEL 页面自行填写",
        "retryable": false,
        "requirementIds": [
          "B2-04"
        ]
      },
      {
        "code": "ERR_CONFIRMATION_REQUIRED",
        "http": 403,
        "meaning": "超出授权范围或需澄清，需要用户在 ATEL 页面确认",
        "agentAction": "把 details.confirmUrl 交给用户，按建议间隔查询任务状态",
        "retryable": false,
        "requirementIds": [
          "B4-03",
          "B5-02"
        ]
      },
      {
        "code": "ERR_PATH_UNAVAILABLE",
        "http": 422,
        "meaning": "没有可用执行路径或不在可售地区",
        "agentAction": "告知用户该商家／场景暂不支持",
        "retryable": false,
        "requirementIds": [
          "E2-06"
        ]
      },
      {
        "code": "ERR_SITE_BLOCKED",
        "http": 422,
        "meaning": "目标网站拦截自动化",
        "agentAction": "告知原因；不尝试绕过",
        "retryable": false,
        "requirementIds": [
          "E3-03",
          "E4-02",
          "E4-04"
        ]
      },
      {
        "code": "ERR_CHANNEL_DECLINED",
        "http": 402,
        "meaning": "支付通道明确拒绝",
        "agentAction": "可换用户授权范围内的其他支付方式重试",
        "retryable": true,
        "requirementIds": [
          "B5-01",
          "B6-01"
        ]
      },
      {
        "code": "ERR_REGION_RESTRICTED",
        "http": 451,
        "meaning": "当前地区不提供该功能",
        "agentAction": "不重试",
        "retryable": false,
        "requirementIds": [
          "X4-14"
        ]
      },
      {
        "code": "ERR_CONNECTOR_UNAVAILABLE",
        "http": 503,
        "meaning": "商家、平台连接器或 ATEL 安全底层暂不可用；放行许可签发或消费期间不可用时 details.permitStatus 为 issuing 或 consuming",
        "agentAction": "按 retryAfterSeconds 退避后重试",
        "retryable": true,
        "requirementIds": [
          "B5-03",
          "B5-04"
        ]
      },
      {
        "code": "ERR_PAIRING_PENDING",
        "http": 409,
        "meaning": "原发起者证明有效但用户尚未确认",
        "retryable": true,
        "agentAction": "按错误说明处理，不重复外部资金动作",
        "requirementIds": []
      },
      {
        "code": "ERR_MANDATE_EXISTS",
        "http": 409,
        "meaning": "同连接同资产已有未终止授权",
        "retryable": false,
        "agentAction": "按错误说明处理，不重复外部资金动作",
        "requirementIds": []
      },
      {
        "code": "ERR_OTP_INVALID",
        "http": 401,
        "meaning": "验证码错误或已过期；连错 5 次转 429 并锁 15 分钟",
        "retryable": true,
        "agentAction": "重新获取验证码",
        "requirementIds": [
          "B1-01"
        ]
      },
      {
        "code": "ERR_ASSERTION_INVALID",
        "http": 401,
        "meaning": "passkey 断言校验失败、ceremony 已用或过期",
        "retryable": true,
        "agentAction": "重新发起 passkey 验证",
        "requirementIds": [
          "X4-07"
        ]
      },
      {
        "code": "ERR_PASSKEY_COOLING",
        "http": 403,
        "meaning": "该 passkey 处于冷静期，暂不能签署",
        "retryable": true,
        "agentAction": "冷静期结束后再签，或改用已登记的其他设备",
        "requirementIds": [
          "B1-07"
        ]
      },
      {
        "code": "ERR_LINK_EXPIRED",
        "http": 410,
        "meaning": "邀请、连接请求、确认或核验链接已失效",
        "retryable": true,
        "agentAction": "重新发起",
        "requirementIds": [
          "B1-03"
        ]
      },
      {
        "code": "ERR_INTERNAL",
        "http": 500,
        "meaning": "服务内部错误；资金类请求先用原幂等键查原结果，不新建",
        "retryable": true,
        "agentAction": "用原幂等键重试",
        "requirementIds": []
      },
      {
        "code": "ERR_REQUEST_INVALID",
        "http": 400,
        "meaning": "请求格式无效；issues[].code 含 actual_required、checkout_session_invalid、api_version_unsupported、digest_version_unsupported",
        "retryable": false,
        "agentAction": "按错误说明处理，不重复外部资金动作",
        "requirementIds": []
      },
      {
        "code": "ERR_RATE_LIMITED",
        "http": 429,
        "meaning": "速率限制，按retryAfterSeconds退避",
        "retryable": true,
        "agentAction": "按错误说明处理，不重复外部资金动作",
        "requirementIds": []
      },
      {
        "code": "ERR_VERSION_CONFLICT",
        "http": 409,
        "meaning": "版本不匹配，需重新读取",
        "retryable": false,
        "agentAction": "按错误说明处理，不重复外部资金动作",
        "requirementIds": []
      },
      {
        "code": "ERR_VAULT_UNAVAILABLE",
        "http": 503,
        "meaning": "ATEL Vault 或其浏览器插件暂不可用；用户尚未关联 Vault 档案时 details.reason 为 vault_profile_not_linked",
        "agentAction": "按 retryAfterSeconds 退避后在原任务重试；不改用其他方式填卡",
        "retryable": true,
        "requirementIds": [
          "E1-01",
          "E1-02",
          "E1-03",
          "E1-04"
        ]
      },
      {
        "code": "ERR_CHECKOUT_MISMATCH",
        "http": 409,
        "meaning": "结账页面摘要或域名与动作许可不一致，Vault 未填卡或已清空卡字段；付款已按未扣款关闭，任务回到核对后重新放行",
        "agentAction": "不要自行改价或继续提交；按 details.observed 修正后在原任务重新核对",
        "retryable": true,
        "requirementIds": [
          "B5-01",
          "B5-03",
          "E1-01",
          "E1-02",
          "E1-03",
          "E1-04"
        ]
      },
      {
        "code": "ERR_SITE_NOT_ADAPTED",
        "http": 422,
        "meaning": "网站不在 Vault 已适配站点清单内，不能代填",
        "agentAction": "告知用户可自己结账；ATEL 仍可核对与记账",
        "retryable": false,
        "requirementIds": [
          "B3-01",
          "E1-01",
          "E1-02",
          "E1-03",
          "E1-04",
          "E2-02"
        ]
      },
      {
        "code": "ERR_SANDBOX_ONLY",
        "http": 403,
        "meaning": "参考 Agent 或沙盒凭据不能访问生产资金接口",
        "agentAction": "先登记自己的应用并取得生产凭据",
        "retryable": false,
        "requirementIds": [
          "O1-12",
          "O1-13"
        ]
      },
      {
        "code": "ERR_PROFILE_CONFIRMATION_REQUIRED",
        "http": 422,
        "meaning": "偏好条目尚未由本人明确确认",
        "agentAction": "请本人在设置页或本单提示确认",
        "retryable": false,
        "requirementIds": [
          "X4-18"
        ]
      }
    ],
    "statusResults": [
      {
        "code": "PENDING_VERIFICATION",
        "http": 202,
        "meaning": "付款确认中：已提交或超时，系统正在沿原交易查询",
        "agentAction": "不得重新发起付款；按建议间隔查询",
        "requirementIds": [
          "X2-01"
        ]
      },
      {
        "code": "ACTION_REQUIRED",
        "http": 202,
        "meaning": "需渠道认证、补资料或用户接手（如在商家结账页付款）",
        "agentAction": "把 actionUrl 交给用户，完成后原任务继续",
        "requirementIds": [
          "B1-08",
          "B7-01"
        ]
      }
    ]
  },
  "domainSchemas": {
    "AssetRef": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "chainId": {
          "type": "string",
          "pattern": "^eip155:[1-9][0-9]*$"
        },
        "tokenAddress": {
          "type": "string",
          "pattern": "^0x[0-9a-f]{40}$"
        }
      },
      "required": [
        "chainId",
        "tokenAddress"
      ]
    },
    "Money": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "amount": {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "maxLength": 78
            },
            "currency": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          "required": [
            "amount",
            "currency"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "amount": {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "maxLength": 78
            },
            "currency": {
              "type": "string",
              "const": "USDC"
            },
            "assetRef": {
              "$ref": "#/components/schemas/AssetRef"
            }
          },
          "required": [
            "amount",
            "currency",
            "assetRef"
          ]
        }
      ]
    },
    "SignedMoney": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "amount": {
              "type": "string",
              "pattern": "^(0|-?[1-9][0-9]*)$",
              "maxLength": 79
            },
            "currency": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            }
          },
          "required": [
            "amount",
            "currency"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "amount": {
              "type": "string",
              "pattern": "^(0|-?[1-9][0-9]*)$",
              "maxLength": 79
            },
            "currency": {
              "type": "string",
              "const": "USDC"
            },
            "assetRef": {
              "$ref": "#/components/schemas/AssetRef"
            }
          },
          "required": [
            "amount",
            "currency",
            "assetRef"
          ]
        }
      ]
    },
    "AuthorityContext": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "authorityKind": {
          "const": "personal_spend",
          "type": "string"
        },
        "userId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "connectionId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "appId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "mandateId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "mandateVersion": {
          "type": "integer",
          "minimum": 0
        },
        "revocationEpoch": {
          "type": "integer",
          "minimum": 0
        },
        "executionMode": {
          "type": "string",
          "enum": [
            "automatic",
            "manual_checkout"
          ]
        }
      },
      "required": [
        "authorityKind",
        "userId",
        "connectionId",
        "appId",
        "mandateId",
        "mandateVersion",
        "revocationEpoch",
        "executionMode"
      ]
    },
    "OrderReadCapability": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "sourcePath": {
          "type": "string",
          "enum": [
            "ucp_agent_webhook",
            "buyer_on_demand",
            "provider_api"
          ]
        },
        "backgroundRead": {
          "type": "boolean"
        },
        "subscriptionVerified": {
          "type": "boolean"
        },
        "credentialRef": {
          "type": [
            "string",
            "null"
          ]
        },
        "scope": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "orderAttribution": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "lastVerifiedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "revokedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      },
      "required": [
        "sourcePath",
        "backgroundRead",
        "subscriptionVerified",
        "credentialRef",
        "scope",
        "orderAttribution",
        "lastVerifiedAt",
        "revokedAt"
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "sourcePath": {
                "enum": [
                  "ucp_agent_webhook",
                  "buyer_on_demand"
                ]
              }
            }
          },
          "then": {
            "properties": {
              "backgroundRead": {
                "const": false
              }
            }
          }
        }
      ],
      "description": "订单读取能力：只用于核实订单页或接口是否显示“已付款”，作为付款凭证来源；不跟踪订单状态。"
    },
    "FeePolicy": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "feePolicyId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "version": {
          "type": "integer",
          "minimum": 0
        },
        "operations": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "deploy": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "payer": {
                  "type": "string",
                  "enum": [
                    "user_native",
                    "sponsor"
                  ]
                },
                "chainId": {
                  "type": "string",
                  "pattern": "^eip155:[1-9][0-9]*$"
                },
                "nativeAsset": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "maxFeePerAction": {
                  "type": "string",
                  "pattern": "^(0|[1-9][0-9]*)$",
                  "maxLength": 78
                },
                "lifetimeFeeCap": {
                  "type": "string",
                  "pattern": "^(0|[1-9][0-9]*)$",
                  "maxLength": 78
                },
                "quoteExpiresAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "providerRef": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "failureAction": {
                  "type": "string",
                  "enum": [
                    "block_and_prompt",
                    "block_and_wait"
                  ]
                }
              },
              "required": [
                "payer",
                "chainId",
                "nativeAsset",
                "maxFeePerAction",
                "lifetimeFeeCap",
                "quoteExpiresAt",
                "providerRef",
                "failureAction"
              ]
            },
            "install": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "payer": {
                  "type": "string",
                  "enum": [
                    "user_native",
                    "sponsor"
                  ]
                },
                "chainId": {
                  "type": "string",
                  "pattern": "^eip155:[1-9][0-9]*$"
                },
                "nativeAsset": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "maxFeePerAction": {
                  "type": "string",
                  "pattern": "^(0|[1-9][0-9]*)$",
                  "maxLength": 78
                },
                "lifetimeFeeCap": {
                  "type": "string",
                  "pattern": "^(0|[1-9][0-9]*)$",
                  "maxLength": 78
                },
                "quoteExpiresAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "providerRef": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "failureAction": {
                  "type": "string",
                  "enum": [
                    "block_and_prompt",
                    "block_and_wait"
                  ]
                }
              },
              "required": [
                "payer",
                "chainId",
                "nativeAsset",
                "maxFeePerAction",
                "lifetimeFeeCap",
                "quoteExpiresAt",
                "providerRef",
                "failureAction"
              ]
            },
            "pay": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "payer": {
                  "type": "string",
                  "enum": [
                    "user_native",
                    "sponsor"
                  ]
                },
                "chainId": {
                  "type": "string",
                  "pattern": "^eip155:[1-9][0-9]*$"
                },
                "nativeAsset": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "maxFeePerAction": {
                  "type": "string",
                  "pattern": "^(0|[1-9][0-9]*)$",
                  "maxLength": 78
                },
                "lifetimeFeeCap": {
                  "type": "string",
                  "pattern": "^(0|[1-9][0-9]*)$",
                  "maxLength": 78
                },
                "quoteExpiresAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "providerRef": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "failureAction": {
                  "type": "string",
                  "enum": [
                    "block_and_prompt",
                    "block_and_wait"
                  ]
                }
              },
              "required": [
                "payer",
                "chainId",
                "nativeAsset",
                "maxFeePerAction",
                "lifetimeFeeCap",
                "quoteExpiresAt",
                "providerRef",
                "failureAction"
              ]
            },
            "revoke": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "payer": {
                  "type": "string",
                  "enum": [
                    "user_native",
                    "sponsor"
                  ]
                },
                "chainId": {
                  "type": "string",
                  "pattern": "^eip155:[1-9][0-9]*$"
                },
                "nativeAsset": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "maxFeePerAction": {
                  "type": "string",
                  "pattern": "^(0|[1-9][0-9]*)$",
                  "maxLength": 78
                },
                "lifetimeFeeCap": {
                  "type": "string",
                  "pattern": "^(0|[1-9][0-9]*)$",
                  "maxLength": 78
                },
                "quoteExpiresAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "providerRef": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "failureAction": {
                  "type": "string",
                  "enum": [
                    "block_and_prompt",
                    "block_and_wait"
                  ]
                }
              },
              "required": [
                "payer",
                "chainId",
                "nativeAsset",
                "maxFeePerAction",
                "lifetimeFeeCap",
                "quoteExpiresAt",
                "providerRef",
                "failureAction"
              ]
            },
            "recover": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "payer": {
                  "type": "string",
                  "enum": [
                    "user_native",
                    "sponsor"
                  ]
                },
                "chainId": {
                  "type": "string",
                  "pattern": "^eip155:[1-9][0-9]*$"
                },
                "nativeAsset": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "maxFeePerAction": {
                  "type": "string",
                  "pattern": "^(0|[1-9][0-9]*)$",
                  "maxLength": 78
                },
                "lifetimeFeeCap": {
                  "type": "string",
                  "pattern": "^(0|[1-9][0-9]*)$",
                  "maxLength": 78
                },
                "quoteExpiresAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "providerRef": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "failureAction": {
                  "type": "string",
                  "enum": [
                    "block_and_prompt",
                    "block_and_wait"
                  ]
                }
              },
              "required": [
                "payer",
                "chainId",
                "nativeAsset",
                "maxFeePerAction",
                "lifetimeFeeCap",
                "quoteExpiresAt",
                "providerRef",
                "failureAction"
              ]
            },
            "exit": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "payer": {
                  "type": "string",
                  "enum": [
                    "user_native",
                    "sponsor"
                  ]
                },
                "chainId": {
                  "type": "string",
                  "pattern": "^eip155:[1-9][0-9]*$"
                },
                "nativeAsset": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "maxFeePerAction": {
                  "type": "string",
                  "pattern": "^(0|[1-9][0-9]*)$",
                  "maxLength": 78
                },
                "lifetimeFeeCap": {
                  "type": "string",
                  "pattern": "^(0|[1-9][0-9]*)$",
                  "maxLength": 78
                },
                "quoteExpiresAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "providerRef": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "failureAction": {
                  "type": "string",
                  "enum": [
                    "block_and_prompt",
                    "block_and_wait"
                  ]
                }
              },
              "required": [
                "payer",
                "chainId",
                "nativeAsset",
                "maxFeePerAction",
                "lifetimeFeeCap",
                "quoteExpiresAt",
                "providerRef",
                "failureAction"
              ]
            }
          },
          "required": [
            "deploy",
            "install",
            "pay",
            "revoke",
            "recover",
            "exit"
          ]
        },
        "bundlerRef": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "backupSubmissionRef": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "evidenceRefs": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "minItems": 1
        }
      },
      "required": [
        "feePolicyId",
        "version",
        "operations",
        "bundlerRef",
        "backupSubmissionRef",
        "evidenceRefs"
      ]
    },
    "TaskMetricEvent": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "eventId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "schemaVersion": {
              "type": "integer",
              "const": 1
            },
            "taskId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "rootTaskId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "occurredAt": {
              "type": "string",
              "format": "date-time"
            },
            "recordedAt": {
              "type": "string",
              "format": "date-time"
            },
            "eventType": {
              "const": "task.execution_entered",
              "type": "string"
            },
            "payload": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "trigger": {
                  "type": "string",
                  "enum": [
                    "automatic_dispatch",
                    "manual_handoff"
                  ]
                },
                "executionMode": {
                  "type": "string",
                  "enum": [
                    "automatic",
                    "manual_checkout"
                  ]
                },
                "sourceRef": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                }
              },
              "required": [
                "trigger",
                "executionMode",
                "sourceRef"
              ]
            },
            "isDrill": {
              "type": "boolean",
              "const": false,
              "default": false,
              "description": "用户演练不进入任务指标事件流；历史事件须关联任务过滤"
            }
          },
          "required": [
            "eventId",
            "schemaVersion",
            "taskId",
            "rootTaskId",
            "occurredAt",
            "recordedAt",
            "eventType",
            "payload"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "eventId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "schemaVersion": {
              "type": "integer",
              "const": 1
            },
            "taskId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "rootTaskId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "occurredAt": {
              "type": "string",
              "format": "date-time"
            },
            "recordedAt": {
              "type": "string",
              "format": "date-time"
            },
            "eventType": {
              "const": "task.human_intervention",
              "type": "string"
            },
            "payload": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "reason": {
                  "type": "string",
                  "enum": [
                    "one_time_grant",
                    "provide_info",
                    "clarification",
                    "authentication",
                    "manual_checkout",
                    "operator_exception"
                  ]
                },
                "actorType": {
                  "type": "string",
                  "enum": [
                    "user",
                    "operator"
                  ]
                },
                "sourceRef": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                }
              },
              "required": [
                "reason",
                "actorType",
                "sourceRef"
              ]
            },
            "isDrill": {
              "type": "boolean",
              "const": false,
              "default": false,
              "description": "用户演练不进入任务指标事件流；历史事件须关联任务过滤"
            }
          },
          "required": [
            "eventId",
            "schemaVersion",
            "taskId",
            "rootTaskId",
            "occurredAt",
            "recordedAt",
            "eventType",
            "payload"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "eventId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "schemaVersion": {
              "type": "integer",
              "const": 1
            },
            "taskId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "rootTaskId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "occurredAt": {
              "type": "string",
              "format": "date-time"
            },
            "recordedAt": {
              "type": "string",
              "format": "date-time"
            },
            "eventType": {
              "const": "task.outcome_corrected",
              "type": "string"
            },
            "payload": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "priorOutcomeEventId": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "reason": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "sourceRef": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                }
              },
              "required": [
                "priorOutcomeEventId",
                "reason",
                "sourceRef"
              ]
            },
            "isDrill": {
              "type": "boolean",
              "const": false,
              "default": false,
              "description": "用户演练不进入任务指标事件流；历史事件须关联任务过滤"
            }
          },
          "required": [
            "eventId",
            "schemaVersion",
            "taskId",
            "rootTaskId",
            "occurredAt",
            "recordedAt",
            "eventType",
            "payload"
          ]
        }
      ]
    },
    "MetricsSnapshot": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "metricVersion": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "cohortStart": {
          "type": "string",
          "format": "date-time"
        },
        "cohortEnd": {
          "type": "string",
          "format": "date-time"
        },
        "timezone": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "snapshotAt": {
          "type": "string",
          "format": "date-time"
        },
        "sourceWatermark": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "revision": {
          "type": "integer",
          "minimum": 0
        },
        "N": {
          "type": "integer",
          "minimum": 0
        },
        "C": {
          "type": "integer",
          "minimum": 0
        },
        "A": {
          "type": "integer",
          "minimum": 0
        },
        "U": {
          "type": "integer",
          "minimum": 0
        },
        "C_partial": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": [
        "metricVersion",
        "cohortStart",
        "cohortEnd",
        "timezone",
        "snapshotAt",
        "sourceWatermark",
        "revision",
        "N",
        "C",
        "A",
        "U",
        "C_partial"
      ]
    },
    "AdmissionRecord": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "gateId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "phase": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "ownerRole": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "namedOwner": {
          "type": [
            "string",
            "null"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "unverified",
            "sandbox_verified",
            "production_approved",
            "suspended"
          ]
        },
        "provider": {
          "type": [
            "string",
            "null"
          ]
        },
        "account": {
          "type": [
            "string",
            "null"
          ]
        },
        "region": {
          "type": [
            "string",
            "null"
          ]
        },
        "version": {
          "type": [
            "string",
            "null"
          ]
        },
        "requiredEvidence": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "disabledBehavior": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "evidenceRefs": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "verifiedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "validUntil": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "approvedBy": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "gateId",
        "phase",
        "ownerRole",
        "namedOwner",
        "status",
        "provider",
        "account",
        "region",
        "version",
        "requiredEvidence",
        "disabledBehavior",
        "evidenceRefs",
        "verifiedAt",
        "validUntil",
        "approvedBy"
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "status": {
                "const": "production_approved"
              }
            }
          },
          "then": {
            "properties": {
              "namedOwner": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "provider": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "account": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "region": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "version": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "approvedBy": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "evidenceRefs": {
                "minItems": 1
              },
              "verifiedAt": {
                "type": "string",
                "format": "date-time"
              },
              "validUntil": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      ]
    },
    "IntentCertificatePayload": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "intentCertId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "taskId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "authorityContext": {
          "$ref": "#/components/schemas/AuthorityContext"
        },
        "requirementVersion": {
          "type": "integer",
          "minimum": 0
        },
        "planVersion": {
          "type": "integer",
          "minimum": 0
        },
        "materialHash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "checksHash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "sourceLevel": {
          "enum": [
            "agent_reported",
            "user_confirmed"
          ]
        },
        "ruleSetVersion": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "issuedAt": {
          "type": "string",
          "format": "date-time"
        },
        "verdict": {
          "type": "string",
          "enum": [
            "pass",
            "ask_user",
            "block"
          ]
        },
        "evidenceSummary": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "checkFieldSources": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "enum": [
              "user_words",
              "user_confirmed",
              "agent_reported",
              "page_read",
              "category_template",
              "user_profile"
            ]
          }
        }
      },
      "required": [
        "intentCertId",
        "taskId",
        "authorityContext",
        "requirementVersion",
        "planVersion",
        "materialHash",
        "checksHash",
        "sourceLevel",
        "ruleSetVersion",
        "issuedAt"
      ],
      "description": "Wallet 独立意图校验模块的结论经 AtelSecurityPort 提交后，由 ATEL 安全层记录并签发；verdict 为 pass／ask_user／block，ruleSetVersion 为 Wallet 校验规则版本，ATEL 只接收并记录，不运行 Wallet 业务规则。"
    },
    "ActionPermitPayload": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "permitId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "taskId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "authorityContext": {
          "$ref": "#/components/schemas/AuthorityContext"
        },
        "intentCertId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "requirementVersion": {
          "type": "integer",
          "minimum": 0
        },
        "planVersion": {
          "type": "integer",
          "minimum": 0
        },
        "action": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "executorId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "paramsHash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "grantId": {
          "type": [
            "string",
            "null"
          ]
        },
        "issuedAt": {
          "type": "string",
          "format": "date-time"
        },
        "expiresAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "permitId",
        "taskId",
        "authorityContext",
        "intentCertId",
        "requirementVersion",
        "planVersion",
        "action",
        "executorId",
        "paramsHash",
        "grantId",
        "issuedAt",
        "expiresAt"
      ]
    },
    "PaymentResult": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "paymentId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "taskId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "status": {
          "enum": [
            "none",
            "confirming",
            "succeeded",
            "failed"
          ]
        },
        "amount": {
          "$ref": "#/components/schemas/Money"
        },
        "fundsAvailability": {
          "enum": [
            "available",
            "frozen",
            "unknown"
          ]
        },
        "refundSummary": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "state": {
              "enum": [
                "none",
                "partial",
                "full"
              ]
            },
            "netRefunded": {
              "$ref": "#/components/schemas/Money"
            }
          },
          "required": [
            "state",
            "netRefunded"
          ]
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "paymentId",
        "taskId",
        "status",
        "amount",
        "fundsAvailability",
        "refundSummary",
        "updatedAt"
      ]
    },
    "CompletionCriteria": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "payment_succeeded",
        "paid_resource_request",
        null
      ],
      "description": "完成判据：付款已确认成功（payment_succeeded），或按次付费请求已付（paid_resource_request）；未确定路径时可为 null。订单与履约不是判据。"
    },
    "CompletionKind": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "full",
        "partial",
        null
      ],
      "description": "完成程度；completed 为 full 或已获同意的 partial，其他状态为 null。"
    },
    "EvidenceToolCall": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "seq": {
          "type": "integer",
          "minimum": 0
        },
        "caller": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "tool": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "argsSummary": {
          "type": "string",
          "maxLength": 512
        },
        "resultSummary": {
          "type": "string",
          "maxLength": 512
        },
        "gate": {
          "type": "string",
          "enum": [
            "not_required",
            "allowed",
            "asked_user",
            "denied"
          ]
        },
        "at": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "seq",
        "caller",
        "tool",
        "argsSummary",
        "resultSummary",
        "gate",
        "at"
      ]
    },
    "EvidenceGateDecision": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "seq": {
          "type": "integer",
          "minimum": 0
        },
        "decision": {
          "type": "string",
          "enum": [
            "allow",
            "ask_user",
            "deny",
            "auto_fix"
          ]
        },
        "reason": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "rule": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "seq",
        "decision",
        "reason",
        "rule"
      ]
    },
    "EvidenceReceipt": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "seq": {
          "type": "integer",
          "minimum": 0
        },
        "source": {
          "type": "string",
          "enum": [
            "merchant_page",
            "merchant_email",
            "protocol_response",
            "provider_receipt",
            "chain"
          ]
        },
        "orderId": {
          "type": [
            "string",
            "null"
          ]
        },
        "amount": {
          "oneOf": [
            {
              "$ref": "#/components/schemas/Money"
            },
            {
              "type": "null"
            }
          ]
        },
        "paymentRef": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "seq",
        "source",
        "orderId",
        "amount",
        "paymentRef"
      ]
    },
    "EvidencePurchaseDelegation": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": "string",
          "const": "purchase"
        },
        "baseline": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "items": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 256
                  },
                  "spec": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string"
                    }
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1
                  }
                },
                "required": [
                  "name",
                  "spec",
                  "quantity"
                ]
              },
              "minItems": 1
            },
            "maxTotal": {
              "$ref": "#/components/schemas/Money"
            },
            "fieldSources": {
              "type": "object",
              "additionalProperties": {
                "type": "string",
                "enum": [
                  "user_words",
                  "user_confirmed",
                  "agent_reported",
                  "page_read",
                  "category_template"
                ]
              }
            }
          },
          "required": [
            "items",
            "maxTotal",
            "fieldSources"
          ]
        },
        "quote": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "summaryHash": {
              "type": "string",
              "pattern": "^sha256:[0-9a-f…]{2,64}$"
            },
            "total": {
              "$ref": "#/components/schemas/Money"
            },
            "source": {
              "type": "string",
              "enum": [
                "api",
                "protocol",
                "page"
              ]
            }
          },
          "required": [
            "summaryHash",
            "total",
            "source"
          ]
        },
        "correctionRounds": {
          "type": "integer",
          "minimum": 0,
          "maximum": 2
        }
      },
      "required": [
        "type",
        "baseline",
        "quote",
        "correctionRounds"
      ]
    },
    "EvidencePaymentDelegation": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": "string",
          "const": "payment"
        },
        "payee": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "ref": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "domainOrAddress": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          "required": [
            "ref",
            "domainOrAddress"
          ]
        },
        "amount": {
          "$ref": "#/components/schemas/Money"
        },
        "asset": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "network": {
          "type": [
            "string",
            "null"
          ]
        },
        "originRef": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "limitCheck": {
          "type": "string",
          "enum": [
            "within_limit",
            "over_limit_confirmed"
          ]
        }
      },
      "required": [
        "type",
        "payee",
        "amount",
        "asset",
        "network",
        "originRef",
        "limitCheck"
      ]
    },
    "EvidenceApiSegment": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "kind": {
          "type": "string",
          "const": "api"
        },
        "endpoint": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "requestHashes": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f…]{2,64}$"
          }
        },
        "responseRefs": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        }
      },
      "required": [
        "kind",
        "endpoint",
        "requestHashes",
        "responseRefs"
      ]
    },
    "EvidenceProtocolSegment": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "kind": {
          "type": "string",
          "const": "protocol"
        },
        "protocol": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "adapterVersion": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "capabilityProfileRef": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "mappedFields": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "field": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "source": {
                "type": "string",
                "enum": [
                  "merchant",
                  "atel",
                  "user"
                ]
              }
            },
            "required": [
              "field",
              "source"
            ]
          }
        }
      },
      "required": [
        "kind",
        "protocol",
        "adapterVersion",
        "capabilityProfileRef",
        "mappedFields"
      ]
    },
    "EvidencePluginSegment": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "kind": {
          "type": "string",
          "const": "plugin"
        },
        "site": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "pageReads": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "seq": {
                "type": "integer",
                "minimum": 0
              },
              "summaryHash": {
                "type": "string",
                "pattern": "^sha256:[0-9a-f…]{2,64}$"
              },
              "fields": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "verdict": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              }
            },
            "required": [
              "seq",
              "summaryHash",
              "fields",
              "verdict"
            ]
          },
          "minItems": 1
        },
        "fill": {
          "oneOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "permitRef": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "vaultRecordRef": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "fieldClasses": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 256
                  },
                  "minItems": 1
                },
                "card": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "brand": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 256
                    },
                    "last4": {
                      "type": "string",
                      "pattern": "^[0-9]{4}$"
                    }
                  },
                  "required": [
                    "brand",
                    "last4"
                  ]
                },
                "preFillSummaryHash": {
                  "type": "string",
                  "pattern": "^sha256:[0-9a-f…]{2,64}$"
                }
              },
              "required": [
                "permitRef",
                "vaultRecordRef",
                "fieldClasses",
                "card",
                "preFillSummaryHash"
              ]
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "kind",
        "site",
        "pageReads",
        "fill"
      ]
    },
    "EvidenceScriptSegment": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "kind": {
          "type": "string",
          "const": "script"
        },
        "sessionRef": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "recipeVersion": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "steps": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "seq": {
                "type": "integer",
                "minimum": 0
              },
              "element": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "action": {
                "type": "string",
                "enum": [
                  "click",
                  "type",
                  "select",
                  "submit"
                ]
              },
              "inputClass": {
                "type": "string",
                "enum": [
                  "plain",
                  "vault_placeholder",
                  "redacted",
                  "none"
                ]
              },
              "beforeHash": {
                "type": "string",
                "pattern": "^sha256:[0-9a-f…]{2,64}$"
              },
              "afterHash": {
                "type": "string",
                "pattern": "^sha256:[0-9a-f…]{2,64}$"
              },
              "screenshotRef": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "expected": {
                "type": "string",
                "maxLength": 512
              },
              "deviation": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "permitRef": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              }
            },
            "required": [
              "seq",
              "element",
              "action",
              "inputClass",
              "beforeHash",
              "afterHash",
              "screenshotRef",
              "expected",
              "deviation",
              "permitRef"
            ]
          },
          "minItems": 1
        },
        "handovers": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "from": {
                "type": "string",
                "enum": [
                  "atel",
                  "user"
                ]
              },
              "to": {
                "type": "string",
                "enum": [
                  "atel",
                  "user"
                ]
              },
              "startedAt": {
                "type": "string",
                "format": "date-time"
              },
              "endedAt": {
                "oneOf": [
                  {
                    "type": "string",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "from",
              "to",
              "startedAt",
              "endedAt"
            ]
          }
        }
      },
      "required": [
        "kind",
        "sessionRef",
        "recipeVersion",
        "steps",
        "handovers"
      ]
    },
    "EvidencePack": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "packId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "taskId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "scope": {
          "type": "string",
          "const": "user"
        },
        "purpose": {
          "type": "string",
          "enum": [
            "self_keep",
            "after_sales",
            "third_party_check",
            "card_issuer"
          ]
        },
        "delegation": {
          "oneOf": [
            {
              "$ref": "#/components/schemas/EvidencePurchaseDelegation"
            },
            {
              "$ref": "#/components/schemas/EvidencePaymentDelegation"
            }
          ]
        },
        "segments": {
          "type": "array",
          "items": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/EvidenceApiSegment"
              },
              {
                "$ref": "#/components/schemas/EvidenceProtocolSegment"
              },
              {
                "$ref": "#/components/schemas/EvidencePluginSegment"
              },
              {
                "$ref": "#/components/schemas/EvidenceScriptSegment"
              }
            ]
          },
          "minItems": 1
        },
        "toolCalls": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/EvidenceToolCall"
          }
        },
        "gateDecisions": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/EvidenceGateDecision"
          }
        },
        "receipts": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/EvidenceReceipt"
          }
        },
        "checkpoint": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "checkpointId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "merkleRoot": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            "anchoredAt": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "checkpointId",
            "merkleRoot",
            "anchoredAt"
          ]
        },
        "signature": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "withheld": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          }
        },
        "issuerCase": {
          "type": "string",
          "enum": [
            "amount_mismatch",
            "duplicate_charge",
            "not_as_ordered",
            "not_received"
          ]
        },
        "noticeVersion": {
          "type": "string",
          "minLength": 1
        },
        "submissionNotice": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "packId",
        "taskId",
        "scope",
        "purpose",
        "delegation",
        "segments",
        "toolCalls",
        "gateDecisions",
        "receipts",
        "checkpoint",
        "signature",
        "withheld"
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "purpose": {
                "const": "card_issuer"
              }
            },
            "required": [
              "purpose"
            ]
          },
          "then": {
            "required": [
              "issuerCase",
              "noticeVersion",
              "submissionNotice"
            ]
          },
          "else": {
            "not": {
              "anyOf": [
                {
                  "required": [
                    "issuerCase"
                  ]
                },
                {
                  "required": [
                    "noticeVersion"
                  ]
                },
                {
                  "required": [
                    "submissionNotice"
                  ]
                }
              ]
            }
          }
        }
      ]
    },
    "ProofExportRequest": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "format": {
          "type": "string",
          "enum": [
            "pdf",
            "csv",
            "json"
          ],
          "default": "pdf"
        },
        "purpose": {
          "type": "string",
          "enum": [
            "self",
            "platform",
            "third_party",
            "card_issuer"
          ],
          "default": "self"
        },
        "issuerCase": {
          "type": "string",
          "enum": [
            "amount_mismatch",
            "duplicate_charge",
            "not_as_ordered",
            "not_received"
          ]
        }
      },
      "required": [],
      "allOf": [
        {
          "if": {
            "required": [
              "purpose"
            ],
            "properties": {
              "purpose": {
                "const": "card_issuer"
              }
            }
          },
          "then": {
            "required": [
              "issuerCase"
            ]
          },
          "else": {
            "not": {
              "required": [
                "issuerCase"
              ]
            }
          }
        }
      ]
    },
    "ProofExportResult": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "exportId": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "type": "string",
          "enum": [
            "queued"
          ]
        },
        "proofId": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "exportId",
        "status",
        "proofId"
      ]
    },
    "DrillOfferRequest": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "connectionId": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "connectionId"
      ]
    },
    "DrillOfferResult": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "offerId": {
          "type": "string",
          "minLength": 1
        },
        "decisionUrl": {
          "type": "string",
          "format": "uri"
        },
        "expiresAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "offerId",
        "decisionUrl",
        "expiresAt"
      ]
    },
    "DrillDecisionRequest": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "accepted": {
          "type": "boolean"
        }
      },
      "required": [
        "accepted"
      ]
    },
    "DrillDecisionResult": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "accepted": {
              "const": false,
              "type": "boolean"
            }
          },
          "required": [
            "accepted"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "accepted": {
              "const": true,
              "type": "boolean"
            },
            "taskId": {
              "type": "string",
              "minLength": 1
            }
          },
          "required": [
            "accepted",
            "taskId"
          ]
        }
      ]
    },
    "DrillConfirmRequest": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "decision": {
          "type": "string",
          "enum": [
            "approve",
            "reject"
          ]
        }
      },
      "required": [
        "decision"
      ]
    },
    "DrillTaskResult": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "taskId": {
          "type": "string",
          "minLength": 1
        },
        "isDrill": {
          "type": "boolean",
          "const": true
        },
        "status": {
          "type": "string",
          "enum": [
            "completed",
            "cancelled"
          ]
        }
      },
      "required": [
        "taskId",
        "isDrill",
        "status"
      ]
    },
    "DrillDeleteResult": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "taskId": {
          "type": "string",
          "minLength": 1
        },
        "deleted": {
          "type": "boolean",
          "const": true
        }
      },
      "required": [
        "taskId",
        "deleted"
      ]
    },
    "InterceptionSummary": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "periodStart": {
          "type": "string",
          "format": "date-time"
        },
        "periodEnd": {
          "type": "string",
          "format": "date-time"
        },
        "total": {
          "type": "integer",
          "minimum": 0
        },
        "mismatchCount": {
          "type": "integer",
          "minimum": 0
        },
        "overBudgetCount": {
          "type": "integer",
          "minimum": 0
        },
        "visible": {
          "type": "boolean"
        },
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "taskId": {
                "type": "string",
                "minLength": 1
              },
              "planVersion": {
                "type": "integer",
                "minimum": 0
              },
              "category": {
                "type": "string",
                "enum": [
                  "mismatch",
                  "over_budget"
                ]
              },
              "occurredAt": {
                "type": "string",
                "format": "date-time"
              },
              "checkUrl": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "taskId",
              "planVersion",
              "category",
              "occurredAt",
              "checkUrl"
            ]
          }
        }
      },
      "required": [
        "periodStart",
        "periodEnd",
        "total",
        "mismatchCount",
        "overBudgetCount",
        "visible",
        "items"
      ]
    },
    "WeeklyDigestPreference": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "weeklyDigestEnabled": {
          "type": "boolean",
          "default": true
        },
        "channels": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "in_app",
              "email"
            ]
          },
          "default": [
            "in_app",
            "email"
          ]
        }
      },
      "required": [
        "weeklyDigestEnabled",
        "channels"
      ]
    },
    "MissingVariantResult": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "needs_info"
          ]
        },
        "nextAction": {
          "type": "string",
          "enum": [
            "provide_info"
          ]
        },
        "missingFields": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "clarification": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "recipient": {
              "type": "string",
              "enum": [
                "agent"
              ]
            },
            "prompt": {
              "type": "string",
              "minLength": 1
            }
          },
          "required": [
            "recipient",
            "prompt"
          ]
        },
        "requirementChecks": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "field": {
                "type": "string",
                "minLength": 1
              },
              "requirement": {
                "type": "null"
              },
              "result": {
                "type": "string",
                "enum": [
                  "insufficient"
                ]
              },
              "reason": {
                "type": "string",
                "enum": [
                  "required_variant_missing"
                ]
              }
            },
            "required": [
              "field",
              "requirement",
              "result",
              "reason"
            ]
          }
        }
      },
      "required": [
        "status",
        "nextAction",
        "missingFields",
        "clarification",
        "requirementChecks"
      ]
    },
    "PreferenceValue": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "size": {
              "type": "string",
              "minLength": 1,
              "maxLength": 32
            },
            "sizeSystem": {
              "type": "string",
              "minLength": 1,
              "maxLength": 32
            }
          },
          "required": [
            "size",
            "sizeSystem"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "items": {
              "type": "array",
              "minItems": 1,
              "maxItems": 20,
              "uniqueItems": true,
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 128
              }
            }
          },
          "required": [
            "items"
          ]
        }
      ]
    },
    "PreferenceEntry": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "entryRef": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "categoryId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "kind": {
          "type": "string",
          "enum": [
            "size",
            "excluded_substitutions"
          ]
        },
        "value": {
          "$ref": "#/components/schemas/PreferenceValue"
        },
        "version": {
          "type": "integer",
          "minimum": 1
        },
        "confirmedAt": {
          "type": "string",
          "format": "date-time"
        },
        "confirmationSource": {
          "type": "string",
          "enum": [
            "settings",
            "payment_success",
            "clarification"
          ]
        }
      },
      "required": [
        "entryRef",
        "categoryId",
        "kind",
        "value",
        "version",
        "confirmedAt",
        "confirmationSource"
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "kind": {
                "const": "size"
              }
            }
          },
          "then": {
            "properties": {
              "value": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "size": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 32
                  },
                  "sizeSystem": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 32
                  }
                },
                "required": [
                  "size",
                  "sizeSystem"
                ]
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "kind": {
                "const": "excluded_substitutions"
              }
            }
          },
          "then": {
            "properties": {
              "value": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "items": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 20,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  }
                },
                "required": [
                  "items"
                ]
              }
            }
          }
        }
      ]
    },
    "PreferenceCreateRequest": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "categoryId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "kind": {
          "type": "string",
          "enum": [
            "size",
            "excluded_substitutions"
          ]
        },
        "value": {
          "$ref": "#/components/schemas/PreferenceValue"
        },
        "confirmed": {
          "type": "boolean",
          "const": true
        }
      },
      "required": [
        "categoryId",
        "kind",
        "value",
        "confirmed"
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "kind": {
                "const": "size"
              }
            }
          },
          "then": {
            "properties": {
              "value": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "size": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 32
                  },
                  "sizeSystem": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 32
                  }
                },
                "required": [
                  "size",
                  "sizeSystem"
                ]
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "kind": {
                "const": "excluded_substitutions"
              }
            }
          },
          "then": {
            "properties": {
              "value": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "items": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 20,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  }
                },
                "required": [
                  "items"
                ]
              }
            }
          }
        }
      ]
    },
    "PreferenceUpdateRequest": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "value": {
          "$ref": "#/components/schemas/PreferenceValue"
        },
        "expectedVersion": {
          "type": "integer",
          "minimum": 1
        },
        "confirmed": {
          "type": "boolean",
          "const": true
        }
      },
      "required": [
        "value",
        "expectedVersion",
        "confirmed"
      ]
    },
    "PreferenceListResult": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/PreferenceEntry"
          }
        },
        "nextCursor": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "items",
        "nextCursor"
      ]
    },
    "PreferenceDeleteResult": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "entryRef": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "status": {
          "type": "string",
          "enum": [
            "deleted"
          ]
        }
      },
      "required": [
        "entryRef",
        "status"
      ]
    },
    "PreferenceSaveOffer": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "offerRef": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "categoryId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "kind": {
          "type": "string",
          "enum": [
            "size"
          ]
        },
        "value": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "size": {
              "type": "string",
              "minLength": 1,
              "maxLength": 32
            },
            "sizeSystem": {
              "type": "string",
              "minLength": 1,
              "maxLength": 32
            }
          },
          "required": [
            "size",
            "sizeSystem"
          ]
        },
        "expectedVersion": {
          "type": "integer",
          "minimum": 0
        },
        "expiresAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "offerRef",
        "categoryId",
        "kind",
        "value",
        "expectedVersion",
        "expiresAt"
      ]
    },
    "PreferenceOfferResult": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "offer": {
          "oneOf": [
            {
              "$ref": "#/components/schemas/PreferenceSaveOffer"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "offer"
      ]
    },
    "PreferenceConfirmRequest": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "offerRef": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "confirmed": {
          "type": "boolean",
          "const": true
        }
      },
      "required": [
        "offerRef",
        "confirmed"
      ]
    },
    "RequirementFieldOrigin": {
      "type": "string",
      "enum": [
        "user_confirmed",
        "wallet_mandate",
        "agent_reported",
        "page_read",
        "category_template",
        "user_profile"
      ]
    },
    "ProfileCheckSource": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "category": {
          "type": "string",
          "enum": [
            "user_profile"
          ]
        },
        "entryRef": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "entryVersion": {
          "type": "integer",
          "minimum": 1
        },
        "confirmedAt": {
          "type": "string",
          "format": "date-time"
        },
        "fetchedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "category",
        "entryRef",
        "entryVersion",
        "confirmedAt",
        "fetchedAt"
      ]
    },
    "ProfileRequiredInfoItem": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "key": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "state": {
          "type": "string",
          "enum": [
            "available"
          ]
        },
        "provideVia": {
          "type": "array",
          "maxItems": 0
        },
        "label": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "profileEntry": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "entryRef": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "categoryId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "kind": {
              "type": "string",
              "enum": [
                "size",
                "excluded_substitutions"
              ]
            },
            "value": {
              "$ref": "#/components/schemas/PreferenceValue"
            },
            "version": {
              "type": "integer",
              "minimum": 1
            },
            "confirmedAt": {
              "type": "string",
              "format": "date-time"
            }
          },
          "required": [
            "entryRef",
            "categoryId",
            "kind",
            "value",
            "version",
            "confirmedAt"
          ]
        },
        "source": {
          "type": "string",
          "enum": [
            "user_profile"
          ]
        }
      },
      "required": [
        "key",
        "state",
        "provideVia",
        "label",
        "profileEntry",
        "source"
      ]
    },
    "ProfileClarificationContext": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "reason": {
          "type": "string",
          "enum": [
            "profile_conflict"
          ]
        },
        "profileContext": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "entryRef": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "entryVersion": {
              "type": "integer",
              "minimum": 1
            },
            "categoryId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "kind": {
              "type": "string",
              "enum": [
                "size",
                "excluded_substitutions"
              ]
            }
          },
          "required": [
            "entryRef",
            "entryVersion",
            "categoryId",
            "kind"
          ]
        }
      },
      "required": [
        "reason",
        "profileContext"
      ]
    },
    "ProfileClarificationAnswer": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "field": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "value": {
          "$ref": "#/components/schemas/PreferenceValue"
        },
        "rememberForFuture": {
          "type": "boolean",
          "default": false
        },
        "expectedProfileVersion": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "field",
        "value"
      ],
      "allOf": [
        {
          "if": {
            "required": [
              "rememberForFuture"
            ],
            "properties": {
              "rememberForFuture": {
                "const": true
              }
            }
          },
          "then": {
            "required": [
              "expectedProfileVersion"
            ]
          }
        }
      ]
    },
    "ProfileSaveStatus": {
      "type": "string",
      "enum": [
        "not_requested",
        "pending",
        "saved",
        "version_conflict",
        "unavailable"
      ]
    },
    "BuyRightGroup": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "executionMode": {
          "type": "string",
          "enum": [
            "automatic",
            "manual_checkout",
            "unknown"
          ]
        },
        "categoryId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "planCount": {
          "type": "integer",
          "minimum": 0
        },
        "displayState": {
          "type": "string",
          "enum": [
            "count_only",
            "metrics"
          ]
        },
        "firstPassRate": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "averageCorrectionRounds": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 2
        },
        "askUserRate": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "requirementCompleteness": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        }
      },
      "required": [
        "executionMode",
        "categoryId",
        "planCount",
        "displayState",
        "firstPassRate",
        "averageCorrectionRounds",
        "askUserRate",
        "requirementCompleteness"
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "displayState": {
                "const": "count_only"
              }
            }
          },
          "then": {
            "properties": {
              "firstPassRate": {
                "type": "null"
              },
              "averageCorrectionRounds": {
                "type": "null"
              },
              "askUserRate": {
                "type": "null"
              },
              "requirementCompleteness": {
                "type": "null"
              }
            }
          },
          "else": {
            "properties": {
              "firstPassRate": {
                "type": "number"
              },
              "averageCorrectionRounds": {
                "type": "number"
              },
              "askUserRate": {
                "type": "number"
              },
              "planCount": {
                "minimum": 1
              }
            }
          }
        }
      ]
    },
    "BuyRightSummary": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "from": {
          "type": "string",
          "format": "date-time"
        },
        "to": {
          "type": "string",
          "format": "date-time"
        },
        "asOf": {
          "type": "string",
          "format": "date-time"
        },
        "metricVersion": {
          "const": "buy-right-v1",
          "type": "string"
        },
        "thresholdVersion": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "minSampleSize": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1
        },
        "groups": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/BuyRightGroup"
          }
        }
      },
      "required": [
        "from",
        "to",
        "asOf",
        "metricVersion",
        "thresholdVersion",
        "minSampleSize",
        "groups"
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "minSampleSize": {
                "type": "null"
              }
            }
          },
          "then": {
            "properties": {
              "groups": {
                "items": {
                  "properties": {
                    "displayState": {
                      "const": "count_only"
                    }
                  }
                }
              }
            }
          }
        }
      ],
      "description": "P2；按组与服务端门槛比较，低于门槛四指标须为 null；跨字段大小关系由服务端与 TC 验证。只含聚合，无用户与交易内容。"
    },
    "BuyRightPlanList": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "asOf": {
          "type": "string",
          "format": "date-time"
        },
        "items": {
          "type": "array",
          "maxItems": 100,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "taskId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "initialPlanVersion": {
                "type": "integer",
                "minimum": 0
              },
              "checkUrl": {
                "type": "string",
                "pattern": "^#personal/activity/[^/]+/check$"
              }
            },
            "required": [
              "taskId",
              "initialPlanVersion",
              "checkUrl"
            ]
          }
        },
        "nextCursor": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "asOf",
        "items",
        "nextCursor"
      ]
    },
    "LimitPeriod": {
      "type": "string",
      "enum": [
        "day",
        "week",
        "month"
      ]
    },
    "LimitDimension": {
      "type": "string",
      "enum": [
        "per_txn",
        "agent_total",
        "channel",
        "payment_channel",
        "card"
      ]
    },
    "LimitRule": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "limitId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "dimension": {
          "$ref": "#/components/schemas/LimitDimension"
        },
        "subjectRef": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 256
        },
        "period": {
          "anyOf": [
            {
              "$ref": "#/components/schemas/LimitPeriod"
            },
            {
              "type": "null"
            }
          ]
        },
        "limit": {
          "$ref": "#/components/schemas/Money"
        }
      },
      "required": [
        "limitId",
        "dimension",
        "subjectRef",
        "period",
        "limit"
      ],
      "description": "P1；subjectRef：channel 为渠道标识，payment_channel 为 vault_card／onchain_usdc，card 为卡引用，per_txn 与 agent_total 为 null；period：per_txn 为 null。一笔付款须同时满足所有适用维度，任一超出进入单笔确认；台账按维度分别占用、释放、回补，币种分行不相加。"
    },
    "LimitUsage": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "limitId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "dimension": {
          "$ref": "#/components/schemas/LimitDimension"
        },
        "period": {
          "anyOf": [
            {
              "$ref": "#/components/schemas/LimitPeriod"
            },
            {
              "type": "null"
            }
          ]
        },
        "available": {
          "$ref": "#/components/schemas/Money"
        },
        "reserved": {
          "$ref": "#/components/schemas/Money"
        },
        "spent": {
          "$ref": "#/components/schemas/Money"
        },
        "periodEndsAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "tightest": {
          "type": "boolean"
        }
      },
      "required": [
        "limitId",
        "dimension",
        "period",
        "available",
        "reserved",
        "spent",
        "periodEndsAt",
        "tightest"
      ],
      "description": "P1；首页与 Agent 卡片只显示 tightest=true 的一项，详情逐项列出。"
    },
    "ShoppingPreference": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "minProductStars": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 1,
          "maximum": 5
        },
        "minMerchantRating": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 5
        },
        "preferHighRated": {
          "type": "boolean"
        }
      },
      "required": [
        "minProductStars",
        "minMerchantRating",
        "preferHighRated"
      ],
      "description": "P1；随委托传给 Agent 作挑选参考，不拦截、不参与放行、不影响额度；记录写“用户偏好已传给 Agent”。"
    },
    "CategoryTemplate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "templateId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "category": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "scenario": {
          "type": "string",
          "enum": [
            "purchase",
            "payment"
          ]
        },
        "requiredFields": {
          "type": "array",
          "maxItems": 20,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          }
        },
        "version": {
          "type": "integer",
          "minimum": 1
        },
        "status": {
          "type": "string",
          "enum": [
            "draft",
            "published",
            "retired"
          ]
        }
      },
      "required": [
        "templateId",
        "category",
        "scenario",
        "requiredFields",
        "version",
        "status"
      ],
      "description": "P1；按场景与品类的预填模板，由 ATEL 运营维护；必填项缺失时请 Agent 向用户补问。"
    },
    "IntentCheckVerdict": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "taskId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "scenario": {
          "type": "string",
          "enum": [
            "purchase",
            "payment"
          ]
        },
        "verdict": {
          "type": "string",
          "enum": [
            "pass",
            "ask_user",
            "block"
          ]
        },
        "ruleStage": {
          "type": "string",
          "enum": [
            "rule_intercept",
            "scenario_check"
          ]
        },
        "failedLimitIds": {
          "type": "array",
          "maxItems": 20,
          "items": {
            "type": "string"
          }
        },
        "evidenceSummary": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "fieldSources": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "enum": [
              "user_words",
              "user_confirmed",
              "agent_reported",
              "page_read",
              "category_template",
              "user_profile"
            ]
          }
        },
        "ruleSetVersion": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "autoFixRound": {
          "type": "integer",
          "minimum": 0,
          "maximum": 2
        }
      },
      "required": [
        "taskId",
        "scenario",
        "verdict",
        "ruleStage",
        "evidenceSummary",
        "fieldSources",
        "ruleSetVersion",
        "autoFixRound"
      ],
      "description": "P1；Wallet 意图校验模块经 AtelSecurityPort 提交 ATEL 安全层的结论；规则放行，AI 只能拦或问，不能放宽权限；自动修正最多 2 轮。"
    },
    "AssuranceLevel": {
      "type": "string",
      "enum": [
        "L0",
        "L1",
        "L2"
      ],
      "description": "P1；意图保障等级：L0 只有 Agent 说法；L1 ATEL 从原话独立识别且与 Agent 一致；L2 用户在 ATEL 页面确认。整体取各字段最低。"
    },
    "IntentReconciliationResult": {
      "type": "string",
      "enum": [
        "agree",
        "conflict",
        "agent_inferred",
        "agent_wider",
        "atel_added"
      ],
      "description": "P1；交叉比对结果：一致／冲突（以原话为准）／Agent 推断（更严，不算用户要求）／Agent 更宽（不接受）／原话有 Agent 漏报（ATEL 补）。"
    },
    "IntentFieldOrigin": {
      "type": "string",
      "enum": [
        "agent_reported",
        "atel_extracted",
        "user_confirmed",
        "category_template",
        "page_read",
        "wallet_mandate",
        "user_profile"
      ],
      "description": "P1；意图字段来源，由服务端判定；user_profile 为 P2。"
    },
    "IntentField": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        },
        "value": {
          "type": [
            "string",
            "number",
            "boolean",
            "null"
          ]
        },
        "normalized": {
          "type": [
            "string",
            "number",
            "boolean",
            "null"
          ]
        },
        "origin": {
          "$ref": "#/components/schemas/IntentFieldOrigin"
        },
        "assurance": {
          "$ref": "#/components/schemas/AssuranceLevel"
        },
        "confidence": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "evidenceSpan": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "start": {
                  "type": "integer",
                  "minimum": 0
                },
                "end": {
                  "type": "integer",
                  "minimum": 0
                },
                "text": {
                  "type": "string",
                  "maxLength": 200
                }
              },
              "required": [
                "start",
                "end",
                "text"
              ]
            }
          ]
        },
        "reconciliation": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/components/schemas/IntentReconciliationResult"
            }
          ]
        }
      },
      "required": [
        "name",
        "value",
        "normalized",
        "origin",
        "assurance",
        "confidence",
        "evidenceSpan",
        "reconciliation"
      ],
      "description": "P1；意图对象中的一个字段：原值、归一化值、来源、保障、置信度与原话依据。"
    },
    "Intent": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "intentId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        },
        "taskId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "version": {
          "type": "integer",
          "minimum": 1
        },
        "category": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        },
        "fields": {
          "type": "array",
          "maxItems": 40,
          "items": {
            "$ref": "#/components/schemas/IntentField"
          }
        },
        "assuranceLevel": {
          "$ref": "#/components/schemas/AssuranceLevel"
        },
        "riskScore": {
          "type": "number",
          "minimum": 0,
          "maximum": 100
        },
        "gaps": {
          "type": "array",
          "maxItems": 40,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "field": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "question": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512
              },
              "options": {
                "type": "array",
                "maxItems": 20,
                "items": {
                  "type": "string",
                  "maxLength": 128
                }
              }
            },
            "required": [
              "field",
              "question",
              "options"
            ]
          }
        },
        "constraints": {
          "type": "object",
          "additionalProperties": true
        },
        "utteranceCommitment": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            }
          ]
        },
        "modelRef": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "provider": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                },
                "model": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "version": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 64
                }
              },
              "required": [
                "provider",
                "model",
                "version"
              ]
            }
          ]
        },
        "promptVersion": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        },
        "ontologyVersion": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        },
        "policyVersion": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "intentId",
        "taskId",
        "version",
        "category",
        "fields",
        "assuranceLevel",
        "riskScore",
        "gaps",
        "constraints",
        "utteranceCommitment",
        "modelRef",
        "promptVersion",
        "ontologyVersion",
        "policyVersion",
        "createdAt"
      ],
      "description": "P1；企业级意图识别输出的意图对象。整体 assuranceLevel 取各字段最低；规范化（JCS）后 SHA-256 得 intentHash，Wallet 服务密钥签名后经 AtelSecurityPort.submitIntent 交安全层；降级时 modelRef 为 null 且 assuranceLevel 最高 L0。"
    },
    "PurchaseIntentRegisterRequest": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "category": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        },
        "userUtterance": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2000
        },
        "context": {
          "type": "array",
          "maxItems": 8,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "role": {
                "type": "string",
                "enum": [
                  "user",
                  "agent"
                ]
              },
              "text": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1000
              }
            },
            "required": [
              "role",
              "text"
            ]
          }
        },
        "productRef": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2048
        },
        "merchantRef": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "variant": {
          "type": "object",
          "additionalProperties": {
            "type": [
              "string",
              "number",
              "boolean"
            ]
          }
        },
        "quantity": {
          "type": "integer",
          "minimum": 1,
          "maximum": 20
        },
        "maxTotal": {
          "$ref": "#/components/schemas/Money"
        },
        "delivery": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "infoRef": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "latestDate": {
              "type": "string",
              "format": "date"
            }
          },
          "required": [
            "infoRef",
            "latestDate"
          ]
        },
        "substitution": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "allowMerchantSwap": {
              "type": "boolean"
            },
            "allowedVariants": {
              "type": "array",
              "maxItems": 20,
              "items": {
                "type": "string",
                "maxLength": 128
              }
            },
            "preferLowest": {
              "type": "boolean"
            }
          },
          "required": [
            "allowMerchantSwap",
            "allowedVariants",
            "preferLowest"
          ]
        },
        "allowSubscription": {
          "type": "boolean",
          "const": false
        },
        "allowPartial": {
          "type": "boolean"
        },
        "callbackUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "taskId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "changeReason": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        }
      },
      "required": [
        "category",
        "userUtterance",
        "maxTotal"
      ],
      "description": "P1；登记购买需求（选品前）。userUtterance 必填（≤2000 字，逐字原话）；context 最多 8 条且只作理解；Idempotency-Key 在请求头。"
    },
    "PurchaseIntentRegisterResult": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "taskId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "type": {
          "type": "string",
          "const": "purchase"
        },
        "status": {
          "type": "string",
          "const": "requirement_registered"
        },
        "requirementVersion": {
          "type": "integer",
          "minimum": 1
        },
        "requirementRegisteredAt": {
          "type": "string",
          "format": "date-time"
        },
        "gaps": {
          "type": "array",
          "maxItems": 40,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "field": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "question": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512
              },
              "options": {
                "type": "array",
                "maxItems": 20,
                "items": {
                  "type": "string",
                  "maxLength": 128
                }
              }
            },
            "required": [
              "field",
              "question",
              "options"
            ]
          }
        },
        "constraints": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "template": {
              "type": "object",
              "additionalProperties": true
            },
            "shoppingPreference": {
              "type": [
                "object",
                "null"
              ],
              "additionalProperties": true
            }
          },
          "required": [
            "template",
            "shoppingPreference"
          ]
        },
        "requiredInfo": {
          "type": "array",
          "maxItems": 40,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              "state": {
                "type": "string",
                "enum": [
                  "available",
                  "missing",
                  "may_require_user"
                ]
              },
              "provideVia": {
                "type": "array",
                "maxItems": 5,
                "items": {
                  "type": "string",
                  "maxLength": 64
                }
              }
            },
            "required": [
              "key",
              "state",
              "provideVia"
            ]
          }
        },
        "assuranceLevel": {
          "$ref": "#/components/schemas/AssuranceLevel"
        },
        "intentRef": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "intentHash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "intentVersion": {
          "type": "integer",
          "minimum": 1
        },
        "intentConfirmationUrl": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "format": "uri"
            }
          ]
        },
        "reconciliation": {
          "type": "array",
          "maxItems": 40,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "field": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              "agentValue": {
                "type": [
                  "string",
                  "number",
                  "boolean",
                  "null"
                ]
              },
              "atelValue": {
                "type": [
                  "string",
                  "number",
                  "boolean",
                  "null"
                ]
              },
              "result": {
                "$ref": "#/components/schemas/IntentReconciliationResult"
              },
              "assurance": {
                "$ref": "#/components/schemas/AssuranceLevel"
              },
              "evidenceSpan": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "start": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "end": {
                        "type": "integer",
                        "minimum": 0
                      },
                      "text": {
                        "type": "string",
                        "maxLength": 200
                      }
                    },
                    "required": [
                      "start",
                      "end",
                      "text"
                    ]
                  }
                ]
              }
            },
            "required": [
              "field",
              "agentValue",
              "atelValue",
              "result",
              "assurance"
            ]
          }
        },
        "degraded": {
          "type": "boolean"
        },
        "pollAfterSeconds": {
          "type": "integer",
          "const": 15
        }
      },
      "required": [
        "taskId",
        "type",
        "status",
        "requirementVersion",
        "requirementRegisteredAt",
        "gaps",
        "constraints",
        "requiredInfo",
        "assuranceLevel",
        "intentRef",
        "intentHash",
        "intentVersion",
        "intentConfirmationUrl",
        "reconciliation",
        "degraded",
        "pollAfterSeconds"
      ],
      "description": "P1；登记响应：需求基准 v1 与意图识别结果。degraded 为 true（模型超时或不可用）时 assuranceLevel 最高 L0 且 intentConfirmationUrl 必有值；assuranceLevel 为 L0 且需要确认时同样必有 intentConfirmationUrl。",
      "allOf": [
        {
          "if": {
            "properties": {
              "degraded": {
                "const": true
              }
            },
            "required": [
              "degraded"
            ]
          },
          "then": {
            "properties": {
              "assuranceLevel": {
                "const": "L0"
              },
              "intentConfirmationUrl": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      ]
    }
  }
}
```
