{
  "openapi": "3.1.0",
  "info": {
    "title": "402Mob local delegated buyer runtime",
    "version": "0.2.0",
    "description": "Owner-hosted loopback API. Not hosted at evidence.contact. text-statistics-v1 direct Work Tickets and prepared-artifact-v1 purchases on Base USDC. Input text must be valid Unicode and <=16000 UTF-8 bytes; compact JSON encoding of the input object must be <=30000 bytes. Additional semantic guards apply."
  },
  "servers": [
    {
      "url": "http://127.0.0.1:4031"
    }
  ],
  "security": [
    {
      "delegation": []
    }
  ],
  "paths": {
    "/healthz": {
      "get": {
        "operationId": "runtimeHealth",
        "security": [],
        "responses": {
          "200": {
            "description": "Health",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/status": {
      "get": {
        "operationId": "delegationStatus",
        "responses": {
          "200": {
            "description": "WalletStatus",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WalletStatus"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Wallet has not been created yet (wallet_not_created). Create it through the owner console.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/workers": {
      "get": {
        "operationId": "discoverRuntimeWorkers",
        "parameters": [
          {
            "in": "query",
            "name": "query",
            "schema": {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "default": "",
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 100000000
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Workers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Workers"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Wallet has not been created yet (wallet_not_created). Create it through the owner console.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/resources": {
      "get": {
        "operationId": "discoverRuntimeResources",
        "parameters": [
          {
            "in": "query",
            "name": "query",
            "schema": {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "default": "",
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 100000000
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "$schema": "https://json-schema.org/draft/2020-12/schema",
              "default": 20,
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Resources",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Resources"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Wallet has not been created yet (wallet_not_created). Create it through the owner console.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/resources/resolve-share": {
      "post": {
        "operationId": "inspectPaymentLink",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "maxLength": 2048
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "InspectedResource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InspectedResource"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Wallet has not been created yet (wallet_not_created). Create it through the owner console.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/resources/{merchantId}/{offerId}": {
      "get": {
        "operationId": "inspectRuntimeResource",
        "parameters": [
          {
            "in": "path",
            "name": "merchantId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "in": "path",
            "name": "offerId",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "InspectedResource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InspectedResource"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Wallet has not been created yet (wallet_not_created). Create it through the owner console.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks": {
      "post": {
        "operationId": "submitTask",
        "description": "Persist one UUID before submission. Supply merchantId unless the delegation fixes a seller. The selected merchant is retained with the task; reusing its UUID with changed input or merchant is rejected.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Task"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "TaskView",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskView"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Wallet has not been created yet (wallet_not_created). Create it through the owner console.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks/{id}": {
      "get": {
        "operationId": "taskStatus",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "TaskView",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskView"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Wallet has not been created yet (wallet_not_created). Create it through the owner console.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks/{id}/tick": {
      "post": {
        "operationId": "advanceTask",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "TaskView",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskView"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Wallet has not been created yet (wallet_not_created). Create it through the owner console.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "delegation": {
        "type": "http",
        "scheme": "bearer",
        "description": "Private token from wallet grant. Owner signing key is never supplied to this API."
      }
    },
    "schemas": {
      "Workers": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "merchant": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "payoutAddress": {
                      "type": "string",
                      "pattern": "^0x[0-9a-fA-F]{40}$"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "payoutAddress"
                  ],
                  "additionalProperties": false
                },
                "workerProfile": {
                  "type": "object",
                  "properties": {
                    "description": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000
                    },
                    "capabilities": {
                      "minItems": 1,
                      "maxItems": 10,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$"
                          },
                          "title": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "description": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000
                          },
                          "inputDescription": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000
                          },
                          "resultDescription": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000
                          },
                          "settlementModes": {
                            "minItems": 1,
                            "maxItems": 2,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "direct_prepayment",
                                "protected_inspection"
                              ]
                            },
                            "uniqueItems": true
                          },
                          "resultContentTypes": {
                            "minItems": 1,
                            "maxItems": 2,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "application/json",
                                "text/plain; charset=utf-8"
                              ]
                            }
                          }
                        },
                        "required": [
                          "id",
                          "title",
                          "description",
                          "inputDescription",
                          "resultDescription",
                          "resultContentTypes"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "availability": {
                      "type": "string",
                      "enum": [
                        "accepting",
                        "paused"
                      ]
                    },
                    "discoverable": {
                      "type": "boolean"
                    },
                    "merchantId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "revision": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "description",
                    "capabilities",
                    "availability",
                    "discoverable",
                    "merchantId",
                    "revision",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false
                },
                "workTicket": {
                  "type": "object",
                  "properties": {
                    "method": {
                      "type": "string",
                      "const": "POST"
                    },
                    "challengePath": {
                      "type": "string",
                      "const": "/v1/work-tickets/challenges"
                    },
                    "merchantId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "guide": {
                      "type": "string",
                      "const": "/work-tickets.md"
                    },
                    "paymentRequiredToCreate": {
                      "type": "boolean",
                      "const": false
                    },
                    "quoteRequired": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": [
                    "method",
                    "challengePath",
                    "merchantId",
                    "guide",
                    "paymentRequiredToCreate",
                    "quoteRequired"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "merchant",
                "workerProfile",
                "workTicket"
              ],
              "additionalProperties": false
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "Resources": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "merchant": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "name": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name"
                  ],
                  "additionalProperties": false
                },
                "offer": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "version": {
                      "type": "string",
                      "pattern": "^\\d+\\.\\d+\\.\\d+$"
                    },
                    "title": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "amountAtomic": {
                      "type": "string",
                      "pattern": "^[1-9][0-9]{0,11}$"
                    },
                    "contentType": {
                      "type": "string",
                      "enum": [
                        "application/json",
                        "text/plain; charset=utf-8",
                        "text/plain"
                      ]
                    },
                    "artifact": {
                      "type": "object",
                      "properties": {
                        "algorithm": {
                          "type": "string",
                          "const": "sha256-private-proof-v1"
                        },
                        "commitment": {
                          "type": "string",
                          "pattern": "^[a-f0-9]{64}$"
                        },
                        "sizeUpperBound": {
                          "type": "integer",
                          "minimum": 1024,
                          "maximum": 49152,
                          "multipleOf": 1024
                        }
                      },
                      "required": [
                        "algorithm",
                        "commitment",
                        "sizeUpperBound"
                      ],
                      "additionalProperties": false
                    },
                    "purchaseDecision": {
                      "type": "object",
                      "properties": {
                        "protocol": {
                          "type": "string",
                          "const": "402mob.purchase-decision.v1"
                        },
                        "intendedUse": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        "resultSchema": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "uri": {
                                  "type": "string",
                                  "maxLength": 2048,
                                  "format": "uri"
                                },
                                "version": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})$"
                                },
                                "sha256": {
                                  "type": "string",
                                  "pattern": "^[a-f0-9]{64}$"
                                }
                              },
                              "required": [
                                "uri",
                                "version",
                                "sha256"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "coverage": {
                          "type": "object",
                          "properties": {
                            "asOf": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            },
                            "from": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            },
                            "through": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            }
                          },
                          "required": [
                            "asOf"
                          ],
                          "additionalProperties": false
                        },
                        "limitations": {
                          "minItems": 1,
                          "maxItems": 8,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 300
                          }
                        },
                        "reuseTerms": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 3000
                        },
                        "publicSample": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1024
                        }
                      },
                      "required": [
                        "protocol",
                        "intendedUse",
                        "resultSchema",
                        "coverage",
                        "limitations",
                        "reuseTerms"
                      ],
                      "additionalProperties": false
                    },
                    "offerTermsHash": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    }
                  },
                  "required": [
                    "id",
                    "version",
                    "title",
                    "description",
                    "amountAtomic",
                    "contentType",
                    "artifact"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "merchant",
                "offer"
              ],
              "additionalProperties": false
            }
          },
          "nextCursor": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "items",
          "nextCursor"
        ],
        "additionalProperties": false
      },
      "InspectedResource": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "terms": {
            "type": "object",
            "properties": {
              "merchantId": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "offerId": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "version": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "payee": {
                "type": "string",
                "pattern": "^0x[0-9a-fA-F]{40}$"
              },
              "network": {
                "type": "string",
                "const": "eip155:8453"
              },
              "asset": {
                "type": "string",
                "pattern": "^0x[0-9a-fA-F]{40}$"
              },
              "amountAtomic": {
                "type": "string",
                "pattern": "^[1-9][0-9]{0,11}$"
              },
              "contentType": {
                "type": "string",
                "enum": [
                  "application/json",
                  "text/plain"
                ]
              },
              "artifact": {
                "type": "object",
                "properties": {
                  "algorithm": {
                    "type": "string",
                    "const": "sha256-private-proof-v1"
                  },
                  "commitment": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  "sizeUpperBound": {
                    "type": "integer",
                    "minimum": 1024,
                    "maximum": 49152,
                    "multipleOf": 1024
                  }
                },
                "required": [
                  "algorithm",
                  "commitment",
                  "sizeUpperBound"
                ],
                "additionalProperties": false
              },
              "purchaseDecision": {
                "type": "object",
                "properties": {
                  "protocol": {
                    "type": "string",
                    "const": "402mob.purchase-decision.v1"
                  },
                  "intendedUse": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "resultSchema": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "uri": {
                            "type": "string",
                            "maxLength": 2048,
                            "format": "uri"
                          },
                          "version": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})$"
                          },
                          "sha256": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          }
                        },
                        "required": [
                          "uri",
                          "version",
                          "sha256"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "coverage": {
                    "type": "object",
                    "properties": {
                      "asOf": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                      },
                      "from": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                      },
                      "through": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                      }
                    },
                    "required": [
                      "asOf"
                    ],
                    "additionalProperties": false
                  },
                  "limitations": {
                    "minItems": 1,
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 300
                    }
                  },
                  "reuseTerms": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 3000
                  },
                  "publicSample": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1024
                  }
                },
                "required": [
                  "protocol",
                  "intendedUse",
                  "resultSchema",
                  "coverage",
                  "limitations",
                  "reuseTerms"
                ],
                "additionalProperties": false
              },
              "offerTermsHash": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            },
            "required": [
              "merchantId",
              "offerId",
              "version",
              "title",
              "description",
              "payee",
              "network",
              "asset",
              "amountAtomic",
              "contentType",
              "artifact"
            ],
            "additionalProperties": false
          },
          "termsHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "sourceShareId": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          }
        },
        "required": [
          "terms",
          "termsHash"
        ],
        "additionalProperties": false
      },
      "Task": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "input": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string"
                  }
                },
                "required": [
                  "text"
                ],
                "additionalProperties": false
              },
              "maxPriceUSDC": {
                "type": "string",
                "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$"
              },
              "merchantId": {
                "description": "Choose the seller for this task. Required unless the delegation fixes a merchant.",
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              }
            },
            "required": [
              "id",
              "input",
              "maxPriceUSDC"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "prepared_artifact"
              },
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "merchantId": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "offerId": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "sourceShareId": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "termsHash": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "maxPriceUSDC": {
                "type": "string",
                "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$"
              }
            },
            "required": [
              "kind",
              "id",
              "merchantId",
              "offerId",
              "termsHash",
              "maxPriceUSDC"
            ],
            "additionalProperties": false
          }
        ]
      },
      "TaskView": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "kind": {
            "type": "string",
            "const": "prepared_artifact"
          },
          "offerId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "merchantId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "complete",
              "rejected",
              "needs_attention"
            ]
          },
          "stage": {
            "type": "string",
            "enum": [
              "create",
              "quote",
              "pay",
              "result",
              "receipt",
              "done"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "nextAt": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "ticketId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "operationId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "payment": {
            "type": "string",
            "enum": [
              "not_authorized",
              "reserved",
              "signed",
              "settled"
            ]
          },
          "transaction": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^0x[0-9a-fA-F]{64}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "receiptRecorded": {
            "type": "boolean"
          },
          "verdict": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "accepted",
                  "disputed"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "result": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          },
          "resultBase64": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 65536
              },
              {
                "type": "null"
              }
            ]
          },
          "resultHash": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "merchantId",
          "status",
          "stage",
          "error",
          "nextAt",
          "ticketId",
          "operationId",
          "payment",
          "transaction",
          "receiptRecorded",
          "verdict",
          "result",
          "resultBase64",
          "resultHash"
        ],
        "additionalProperties": false
      },
      "WalletStatus": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "address": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$"
          },
          "network": {
            "type": "string",
            "const": "eip155:8453"
          },
          "asset": {
            "type": "string",
            "const": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
          },
          "origin": {
            "type": "string"
          },
          "delegationId": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "policy": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "maxTotalUSDC": {
                    "type": "string",
                    "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$",
                    "description": "Total USDC allocated to this delegation."
                  },
                  "merchantId": {
                    "description": "Omit to let the agent choose a merchant for each task.",
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "payee": {
                    "description": "Omit to permit any recipient of a supported purchase.",
                    "type": "string",
                    "pattern": "^0x[0-9a-fA-F]{40}$"
                  },
                  "capability": {
                    "description": "Omit to allow any installed runtime capability.",
                    "type": "string",
                    "enum": [
                      "text-statistics-v1",
                      "prepared-artifact-v1"
                    ]
                  },
                  "maxPerPaymentUSDC": {
                    "description": "Omit to allow a payment up to the remaining allocation.",
                    "type": "string",
                    "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$"
                  },
                  "expiresAt": {
                    "description": "Omit for no delegation expiry. Owner revocation still applies.",
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  }
                },
                "required": [
                  "name",
                  "maxTotalUSDC"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "revoked": {
            "type": "boolean"
          },
          "reservedAtomic": {
            "type": "string",
            "pattern": "^\\d+$"
          },
          "spentAtomic": {
            "type": "string",
            "pattern": "^\\d+$"
          },
          "remainingAtomic": {
            "type": "string",
            "pattern": "^\\d+$"
          },
          "walletLimitUSDC": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$"
              },
              {
                "type": "null"
              }
            ]
          },
          "walletRemainingAtomic": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "policyAvailableAtomic": {
            "type": "string",
            "pattern": "^\\d+$"
          },
          "expired": {
            "type": "boolean"
          },
          "funding": {
            "type": "string"
          },
          "balanceAtomic": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d+$"
              },
              {
                "type": "null"
              }
            ]
          },
          "balanceObservedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "balanceError": {
            "type": [
              "string",
              "null"
            ]
          },
          "spendableAtomic": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d+$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "address",
          "network",
          "asset",
          "origin",
          "delegationId",
          "policy",
          "revoked",
          "reservedAtomic",
          "spentAtomic",
          "remainingAtomic",
          "walletLimitUSDC",
          "walletRemainingAtomic",
          "policyAvailableAtomic",
          "expired",
          "funding",
          "balanceAtomic",
          "balanceObservedAt",
          "balanceError",
          "spendableAtomic"
        ],
        "additionalProperties": false
      },
      "DelegationPolicy": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "maxTotalUSDC": {
            "type": "string",
            "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$",
            "description": "Total USDC allocated to this delegation."
          },
          "merchantId": {
            "description": "Omit to let the agent choose a merchant for each task.",
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "payee": {
            "description": "Omit to permit any recipient of a supported purchase.",
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$"
          },
          "capability": {
            "description": "Omit to allow any installed runtime capability.",
            "type": "string",
            "enum": [
              "text-statistics-v1",
              "prepared-artifact-v1"
            ]
          },
          "maxPerPaymentUSDC": {
            "description": "Omit to allow a payment up to the remaining allocation.",
            "type": "string",
            "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$"
          },
          "expiresAt": {
            "description": "Omit for no delegation expiry. Owner revocation still applies.",
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": [
          "name",
          "maxTotalUSDC"
        ],
        "additionalProperties": false
      },
      "TextStatistics": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "const": "text-statistics-v1"
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "utf8Bytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "codePoints": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "words": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "lines": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "version",
          "sha256",
          "utf8Bytes",
          "codePoints",
          "words",
          "lines"
        ],
        "additionalProperties": false
      },
      "Health": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "const": "ok"
          },
          "protocol": {
            "type": "string",
            "const": "402mob.local-runtime.v1"
          },
          "ready": {
            "type": "boolean",
            "description": "Wallet is initialized. Does not check funds, delegation or remote service availability."
          }
        },
        "required": [
          "status",
          "protocol",
          "ready"
        ],
        "additionalProperties": false
      },
      "Error": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      }
    }
  }
}
