{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tenjin-sh/json-schema/tenjin-sh-router-lookup-response-schema.json",
  "title": "RouterLookupResponse",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tenjin-sh-openapi.json#/components/schemas/RouterLookupResponse",
  "type": "object",
  "properties": {
    "schemaVersion": {
      "type": "number",
      "const": 1
    },
    "routerVersion": {
      "type": "string",
      "minLength": 1
    },
    "honored": {
      "maxItems": 16,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 32
      }
    },
    "settingsHash": {
      "type": "string",
      "pattern": "^sha256:[0-9a-f]{64}$"
    },
    "decision": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "const": "execute"
            },
            "capabilityId": {
              "type": "string",
              "minLength": 1
            },
            "category": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "provider": {
              "type": "string",
              "minLength": 1
            },
            "label": {
              "type": "string",
              "minLength": 1,
              "maxLength": 32
            },
            "capabilityDescription": {
              "type": "string",
              "minLength": 1
            },
            "providerPriceAtomic": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "contract": {
              "type": "object",
              "properties": {
                "request": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "method": {
                      "type": "string",
                      "minLength": 1
                    },
                    "headers": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "body": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "url",
                    "method",
                    "headers"
                  ],
                  "additionalProperties": false
                },
                "arguments": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                },
                "resultSchema": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              },
              "required": [
                "request",
                "arguments"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "action",
            "capabilityId",
            "category",
            "provider",
            "capabilityDescription",
            "providerPriceAtomic",
            "contract"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "const": "spec"
            },
            "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)$"
            },
            "spec": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "capabilityId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "provider": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 32
                    },
                    "holds": {
                      "type": "object",
                      "properties": {
                        "WebSearch": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "WebFetch": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        }
                      },
                      "additionalProperties": false
                    },
                    "output": {
                      "type": "string",
                      "enum": [
                        "json",
                        "text",
                        "media"
                      ]
                    },
                    "description": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 500
                    },
                    "priceAtomic": {
                      "type": "string",
                      "pattern": "^[0-9]+$"
                    },
                    "priceVaries": {
                      "type": "boolean"
                    },
                    "maxAmountAtomic": {
                      "type": "string",
                      "pattern": "^[0-9]+$"
                    },
                    "payTo": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "network": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    },
                    "asset": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "request": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string",
                          "enum": [
                            "GET",
                            "POST"
                          ]
                        },
                        "url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "fields": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "type": "string",
                            "enum": [
                              "path",
                              "query",
                              "body"
                            ]
                          }
                        },
                        "location": {
                          "type": "string",
                          "enum": [
                            "query",
                            "body"
                          ]
                        },
                        "headers": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64
                          },
                          "additionalProperties": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1024
                          }
                        }
                      },
                      "required": [
                        "method",
                        "url",
                        "fields",
                        "location"
                      ],
                      "additionalProperties": false
                    },
                    "input": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "pinned": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "returns": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "returnsExample": {},
                    "resultSchema": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "outputSchema": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "job": {
                      "type": "object",
                      "properties": {
                        "pollUrl": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "field": {
                                  "type": "string",
                                  "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$"
                                },
                                "header": {
                                  "type": "string",
                                  "pattern": "^[A-Za-z0-9-]{1,64}$"
                                }
                              },
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "fixed": {
                                  "type": "string",
                                  "format": "uri"
                                }
                              },
                              "required": [
                                "fixed"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        },
                        "completeUrl": {
                          "type": "object",
                          "properties": {
                            "fixed": {
                              "type": "string",
                              "format": "uri"
                            }
                          },
                          "required": [
                            "fixed"
                          ],
                          "additionalProperties": false
                        },
                        "pollMethod": {
                          "type": "string",
                          "enum": [
                            "GET",
                            "POST"
                          ]
                        },
                        "pollBody": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$"
                          },
                          "additionalProperties": {}
                        },
                        "running": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "httpStatus": {
                                  "minItems": 1,
                                  "maxItems": 8,
                                  "type": "array",
                                  "items": {
                                    "type": "integer",
                                    "minimum": 200,
                                    "maximum": 299
                                  }
                                }
                              },
                              "required": [
                                "httpStatus"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "field": {
                                  "type": "string",
                                  "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$"
                                },
                                "values": {
                                  "minItems": 1,
                                  "maxItems": 8,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 64
                                  }
                                }
                              },
                              "required": [
                                "field",
                                "values"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        },
                        "failed": {
                          "type": "object",
                          "properties": {
                            "field": {
                              "type": "string",
                              "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$"
                            },
                            "values": {
                              "minItems": 1,
                              "maxItems": 8,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              }
                            }
                          },
                          "required": [
                            "field",
                            "values"
                          ],
                          "additionalProperties": false
                        },
                        "everyS": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 30
                        },
                        "maxWaitS": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 600
                        },
                        "keepH": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 48
                        },
                        "always": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "pollUrl",
                        "pollMethod",
                        "running",
                        "everyS",
                        "maxWaitS",
                        "keepH"
                      ],
                      "additionalProperties": false
                    },
                    "takes": {
                      "type": "object",
                      "properties": {
                        "max": {
                          "type": "integer",
                          "minimum": 2,
                          "maximum": 5
                        }
                      },
                      "required": [
                        "max"
                      ],
                      "additionalProperties": false
                    },
                    "requires": {
                      "minItems": 1,
                      "maxItems": 16,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_-]{0,31}$"
                      }
                    },
                    "timeoutS": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 120
                    },
                    "maxBytes": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 209715200
                    }
                  },
                  "required": [
                    "capabilityId",
                    "provider",
                    "description",
                    "priceAtomic",
                    "priceVaries",
                    "maxAmountAtomic",
                    "payTo",
                    "network",
                    "asset",
                    "request",
                    "input",
                    "pinned"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "capabilityId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "provider": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 32
                    },
                    "holds": {
                      "type": "object",
                      "properties": {
                        "WebSearch": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "WebFetch": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        }
                      },
                      "additionalProperties": false
                    },
                    "output": {
                      "type": "string",
                      "enum": [
                        "json",
                        "text",
                        "media"
                      ]
                    },
                    "description": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 500
                    },
                    "source": {
                      "type": "string",
                      "pattern": "^[a-z0-9][a-z0-9-]{0,47}$"
                    },
                    "mcp": {
                      "type": "object",
                      "properties": {
                        "tool": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$"
                        },
                        "args": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "result": {
                          "type": "string",
                          "enum": [
                            "structured",
                            "json-text",
                            "content"
                          ]
                        },
                        "next": {
                          "type": "object",
                          "properties": {
                            "when": {
                              "type": "object",
                              "properties": {
                                "path": {
                                  "type": "string",
                                  "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}(?:\\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$"
                                },
                                "values": {
                                  "minItems": 1,
                                  "maxItems": 8,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 64
                                  }
                                }
                              },
                              "required": [
                                "path",
                                "values"
                              ],
                              "additionalProperties": false
                            },
                            "poll": {
                              "type": "object",
                              "properties": {
                                "tool": {
                                  "type": "string",
                                  "pattern": "^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$"
                                },
                                "args": {
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string"
                                  },
                                  "additionalProperties": {}
                                },
                                "result": {
                                  "type": "string",
                                  "enum": [
                                    "structured",
                                    "json-text",
                                    "content"
                                  ]
                                },
                                "running": {
                                  "type": "object",
                                  "properties": {
                                    "path": {
                                      "type": "string",
                                      "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}(?:\\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$"
                                    },
                                    "values": {
                                      "minItems": 1,
                                      "maxItems": 8,
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 64
                                      }
                                    }
                                  },
                                  "required": [
                                    "path",
                                    "values"
                                  ],
                                  "additionalProperties": false
                                },
                                "failed": {
                                  "type": "object",
                                  "properties": {
                                    "path": {
                                      "type": "string",
                                      "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}(?:\\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$"
                                    },
                                    "values": {
                                      "minItems": 1,
                                      "maxItems": 8,
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 64
                                      }
                                    }
                                  },
                                  "required": [
                                    "path",
                                    "values"
                                  ],
                                  "additionalProperties": false
                                },
                                "everyS": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 30
                                },
                                "maxWaitS": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 600
                                }
                              },
                              "required": [
                                "tool",
                                "args",
                                "result",
                                "running",
                                "everyS",
                                "maxWaitS"
                              ],
                              "additionalProperties": false
                            },
                            "tool": {
                              "type": "string",
                              "pattern": "^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$"
                            },
                            "args": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            },
                            "result": {
                              "type": "string",
                              "enum": [
                                "structured",
                                "json-text",
                                "content"
                              ]
                            }
                          },
                          "required": [
                            "tool",
                            "args",
                            "result"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "tool",
                        "args",
                        "result"
                      ],
                      "additionalProperties": false
                    },
                    "input": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "pinned": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "returns": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "resultSchema": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "outputSchema": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "requires": {
                      "minItems": 1,
                      "maxItems": 16,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_-]{0,31}$"
                      }
                    }
                  },
                  "required": [
                    "capabilityId",
                    "provider",
                    "description",
                    "source",
                    "mcp",
                    "input",
                    "pinned",
                    "requires"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "hint": {
              "type": "string",
              "minLength": 1
            }
          },
          "required": [
            "action",
            "id",
            "spec"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "const": "discovered"
            },
            "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)$"
            },
            "candidate": {
              "type": "object",
              "properties": {
                "source": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 32
                },
                "provider": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "method": {
                  "type": "string",
                  "enum": [
                    "GET",
                    "POST"
                  ]
                },
                "description": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 300
                },
                "providerPriceAtomic": {
                  "type": "string",
                  "pattern": "^[0-9]+$"
                },
                "network": {
                  "type": "string",
                  "minLength": 1
                },
                "payTo": {
                  "type": "string",
                  "minLength": 1
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "type": "string",
                      "enum": [
                        "body",
                        "query"
                      ]
                    },
                    "schema": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    }
                  },
                  "required": [
                    "location",
                    "schema"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "source",
                "provider",
                "url",
                "method",
                "description",
                "providerPriceAtomic",
                "network",
                "payTo",
                "input"
              ],
              "additionalProperties": false
            },
            "hint": {
              "type": "string",
              "minLength": 1
            },
            "specs": {
              "minItems": 1,
              "maxItems": 8,
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "capabilityId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "provider": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 32
                  },
                  "holds": {
                    "type": "object",
                    "properties": {
                      "WebSearch": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "WebFetch": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      }
                    },
                    "additionalProperties": false
                  },
                  "output": {
                    "type": "string",
                    "enum": [
                      "json",
                      "text",
                      "media"
                    ]
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "priceAtomic": {
                    "type": "string",
                    "pattern": "^[0-9]+$"
                  },
                  "priceVaries": {
                    "type": "boolean"
                  },
                  "maxAmountAtomic": {
                    "type": "string",
                    "pattern": "^[0-9]+$"
                  },
                  "payTo": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "network": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "asset": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "request": {
                    "type": "object",
                    "properties": {
                      "method": {
                        "type": "string",
                        "enum": [
                          "GET",
                          "POST"
                        ]
                      },
                      "url": {
                        "type": "string",
                        "format": "uri"
                      },
                      "fields": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "type": "string",
                          "enum": [
                            "path",
                            "query",
                            "body"
                          ]
                        }
                      },
                      "location": {
                        "type": "string",
                        "enum": [
                          "query",
                          "body"
                        ]
                      },
                      "headers": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        "additionalProperties": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1024
                        }
                      }
                    },
                    "required": [
                      "method",
                      "url",
                      "fields",
                      "location"
                    ],
                    "additionalProperties": false
                  },
                  "input": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "pinned": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "returns": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "returnsExample": {},
                  "resultSchema": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "outputSchema": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "job": {
                    "type": "object",
                    "properties": {
                      "pollUrl": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "field": {
                                "type": "string",
                                "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$"
                              },
                              "header": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9-]{1,64}$"
                              }
                            },
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "fixed": {
                                "type": "string",
                                "format": "uri"
                              }
                            },
                            "required": [
                              "fixed"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "completeUrl": {
                        "type": "object",
                        "properties": {
                          "fixed": {
                            "type": "string",
                            "format": "uri"
                          }
                        },
                        "required": [
                          "fixed"
                        ],
                        "additionalProperties": false
                      },
                      "pollMethod": {
                        "type": "string",
                        "enum": [
                          "GET",
                          "POST"
                        ]
                      },
                      "pollBody": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$"
                        },
                        "additionalProperties": {}
                      },
                      "running": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "httpStatus": {
                                "minItems": 1,
                                "maxItems": 8,
                                "type": "array",
                                "items": {
                                  "type": "integer",
                                  "minimum": 200,
                                  "maximum": 299
                                }
                              }
                            },
                            "required": [
                              "httpStatus"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "field": {
                                "type": "string",
                                "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$"
                              },
                              "values": {
                                "minItems": 1,
                                "maxItems": 8,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                }
                              }
                            },
                            "required": [
                              "field",
                              "values"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "failed": {
                        "type": "object",
                        "properties": {
                          "field": {
                            "type": "string",
                            "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$"
                          },
                          "values": {
                            "minItems": 1,
                            "maxItems": 8,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            }
                          }
                        },
                        "required": [
                          "field",
                          "values"
                        ],
                        "additionalProperties": false
                      },
                      "everyS": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 30
                      },
                      "maxWaitS": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 600
                      },
                      "keepH": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 48
                      },
                      "always": {
                        "type": "boolean",
                        "const": true
                      }
                    },
                    "required": [
                      "pollUrl",
                      "pollMethod",
                      "running",
                      "everyS",
                      "maxWaitS",
                      "keepH"
                    ],
                    "additionalProperties": false
                  },
                  "takes": {
                    "type": "object",
                    "properties": {
                      "max": {
                        "type": "integer",
                        "minimum": 2,
                        "maximum": 5
                      }
                    },
                    "required": [
                      "max"
                    ],
                    "additionalProperties": false
                  },
                  "requires": {
                    "minItems": 1,
                    "maxItems": 16,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_-]{0,31}$"
                    }
                  },
                  "timeoutS": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 120
                  },
                  "maxBytes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 209715200
                  },
                  "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)$"
                  }
                },
                "required": [
                  "capabilityId",
                  "provider",
                  "description",
                  "priceAtomic",
                  "priceVaries",
                  "maxAmountAtomic",
                  "payTo",
                  "network",
                  "asset",
                  "request",
                  "input",
                  "pinned",
                  "id"
                ],
                "additionalProperties": false
              }
            },
            "choices": {
              "type": "object",
              "properties": {
                "group": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 40
                },
                "default": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 32
                },
                "input": {
                  "minItems": 1,
                  "maxItems": 8,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "options": {
                  "minItems": 2,
                  "maxItems": 4,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "key": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 32
                      },
                      "label": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      "strength": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "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)$"
                      }
                    },
                    "required": [
                      "key",
                      "label",
                      "strength",
                      "id"
                    ],
                    "additionalProperties": false
                  }
                },
                "all": {
                  "type": "object",
                  "properties": {
                    "totalAtomic": {
                      "type": "string",
                      "pattern": "^[0-9]+$"
                    }
                  },
                  "required": [
                    "totalAtomic"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "group",
                "default",
                "input",
                "options",
                "all"
              ],
              "additionalProperties": false
            },
            "bound": {
              "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",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {}
                }
              },
              "required": [
                "id",
                "input"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "action",
            "id",
            "candidate",
            "hint"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "const": "native"
            },
            "reason": {
              "type": "string"
            },
            "diagnostics": {
              "type": "object",
              "properties": {
                "reasonCode": {
                  "type": "string",
                  "enum": [
                    "native_sufficient",
                    "gate_unresolved",
                    "gate_unclear",
                    "unresolved_intent",
                    "classifier_failure",
                    "capability_unresolved",
                    "fee_required",
                    "spec_missing",
                    "no_capability_configured",
                    "no_page_capability",
                    "contract_too_large",
                    "source_unresolved",
                    "ambiguous_sources",
                    "missing_required_argument",
                    "invalid_argument_selection",
                    "selection_limit_exceeded",
                    "argument_set_invalid",
                    "argument_set_unresolved",
                    "list_member_unresolved"
                  ]
                },
                "stage": {
                  "type": "string",
                  "enum": [
                    "gate",
                    "target",
                    "capability",
                    "bind",
                    "contract",
                    "classifier"
                  ]
                },
                "missing": {
                  "maxItems": 60,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "nextAction": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "reasonCode",
                "stage",
                "missing",
                "nextAction"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "action",
            "reason",
            "diagnostics"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "const": "needs_input"
            },
            "reason": {
              "type": "string"
            },
            "diagnostics": {
              "type": "object",
              "properties": {
                "reasonCode": {
                  "type": "string",
                  "enum": [
                    "native_sufficient",
                    "gate_unresolved",
                    "gate_unclear",
                    "unresolved_intent",
                    "classifier_failure",
                    "capability_unresolved",
                    "fee_required",
                    "spec_missing",
                    "no_capability_configured",
                    "no_page_capability",
                    "contract_too_large",
                    "source_unresolved",
                    "ambiguous_sources",
                    "missing_required_argument",
                    "invalid_argument_selection",
                    "selection_limit_exceeded",
                    "argument_set_invalid",
                    "argument_set_unresolved",
                    "list_member_unresolved"
                  ]
                },
                "stage": {
                  "type": "string",
                  "enum": [
                    "gate",
                    "target",
                    "capability",
                    "bind",
                    "contract",
                    "classifier"
                  ]
                },
                "missing": {
                  "maxItems": 60,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "nextAction": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "reasonCode",
                "stage",
                "missing",
                "nextAction"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "action",
            "reason",
            "diagnostics"
          ],
          "additionalProperties": false
        }
      ]
    },
    "note": {
      "type": "string"
    },
    "jev": {
      "type": "object",
      "properties": {
        "calls": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "latencyMs": {
          "type": "number",
          "minimum": 0
        }
      },
      "required": [
        "calls",
        "latencyMs"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "schemaVersion",
    "routerVersion",
    "decision",
    "jev"
  ],
  "additionalProperties": false
}