{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tenjin-sh/json-schema/tenjin-sh-router-request-schema.json",
  "title": "RouterRequest",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tenjin-sh-openapi.json#/components/schemas/RouterRequest",
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "schemaVersion": {
          "type": "number",
          "const": 1
        },
        "packet": {
          "type": "object",
          "properties": {
            "current": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "user",
                    "assistant"
                  ]
                },
                "text": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 16000,
                  "description": "This step's task: a person's prompt, a task from your loop, or one the agent wrote itself. A role or persona line names no task and usually comes back `gate_unclear`."
                },
                "quoted": {
                  "description": "Pasted or third-party text: evidence only, never the instruction.",
                  "maxItems": 8,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "maxLength": 16000
                  }
                }
              },
              "required": [
                "role",
                "text"
              ]
            },
            "history": {
              "maxItems": 6,
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "role": {
                    "type": "string",
                    "enum": [
                      "user",
                      "assistant"
                    ]
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 16000
                  }
                },
                "required": [
                  "role",
                  "text"
                ]
              },
              "description": "Up to 6 earlier messages: background only, never the instruction."
            },
            "literalUrls": {
              "maxItems": 8,
              "type": "array",
              "items": {
                "type": "string",
                "maxLength": 2000
              }
            },
            "ownUrls": {
              "maxItems": 8,
              "type": "array",
              "items": {
                "type": "string",
                "maxLength": 2000
              }
            },
            "historyStatus": {
              "type": "string",
              "enum": [
                "ok",
                "unavailable"
              ]
            },
            "pendingCall": {
              "description": "The search, fetch or question the agent is about to run.",
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "tool": {
                      "type": "string",
                      "const": "WebSearch"
                    },
                    "query": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4000
                    }
                  },
                  "required": [
                    "tool",
                    "query"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "tool": {
                      "type": "string",
                      "const": "WebFetch"
                    },
                    "url": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4000
                    }
                  },
                  "required": [
                    "tool",
                    "url"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "tool": {
                      "type": "string",
                      "const": "AskUserQuestion"
                    },
                    "question": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4000
                    }
                  },
                  "required": [
                    "tool",
                    "question"
                  ]
                }
              ]
            },
            "nativeOutcome": {
              "description": "How that free call fared, only when it fell short.",
              "type": "object",
              "properties": {
                "code": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 999
                },
                "bytes": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "error": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1000
                },
                "reason": {
                  "type": "string",
                  "enum": [
                    "no_main_content"
                  ]
                }
              }
            }
          },
          "required": [
            "current",
            "history",
            "literalUrls",
            "historyStatus"
          ]
        },
        "gateHint": {
          "type": "object",
          "properties": {
            "category": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "turnId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "lookupId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "required": [
            "category",
            "turnId",
            "lookupId"
          ]
        },
        "sessionId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "accepts": {
          "maxItems": 16,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          }
        },
        "budgetMs": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 5000
        },
        "harness": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_-]{0,31}$"
        },
        "improve": {
          "type": "boolean"
        },
        "settings": {
          "type": "object",
          "properties": {
            "version": {
              "type": "number",
              "const": 1
            },
            "hash": {
              "type": "string",
              "pattern": "^sha256:[0-9a-f]{64}$"
            },
            "policy": {
              "type": "object",
              "properties": {
                "block": {
                  "maxItems": 64,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "category",
                          "task",
                          "provider",
                          "seller",
                          "service",
                          "source"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      }
                    },
                    "required": [
                      "kind",
                      "id"
                    ],
                    "additionalProperties": false
                  }
                },
                "only": {
                  "maxItems": 32,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "scope": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "global"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "task"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "category"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "dimension": {
                        "type": "string",
                        "enum": [
                          "capability",
                          "provider",
                          "seller",
                          "service"
                        ]
                      },
                      "targets": {
                        "minItems": 1,
                        "maxItems": 16,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "category",
                                "task",
                                "provider",
                                "seller",
                                "service",
                                "source"
                              ]
                            },
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            }
                          },
                          "required": [
                            "kind",
                            "id"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "scope",
                      "dimension",
                      "targets"
                    ],
                    "additionalProperties": false
                  }
                },
                "prefer": {
                  "maxItems": 64,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "scope": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "global"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "task"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "category"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "targets": {
                        "minItems": 1,
                        "maxItems": 16,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "category",
                                "task",
                                "provider",
                                "seller",
                                "service",
                                "source"
                              ]
                            },
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            }
                          },
                          "required": [
                            "kind",
                            "id"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "scope",
                      "targets"
                    ],
                    "additionalProperties": false
                  }
                },
                "preferSpeed": {
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            },
            "replacement": {
              "type": "object",
              "properties": {
                "mode": {
                  "type": "string",
                  "enum": [
                    "off",
                    "when-routed"
                  ]
                },
                "providers": {
                  "minItems": 1,
                  "maxItems": 16,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "category",
                          "task",
                          "provider",
                          "seller",
                          "service",
                          "source"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      }
                    },
                    "required": [
                      "kind",
                      "id"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "mode"
              ],
              "additionalProperties": false
            },
            "sources": {
              "minItems": 1,
              "maxItems": 16,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            }
          },
          "required": [
            "version",
            "hash",
            "policy",
            "sources"
          ],
          "additionalProperties": false
        },
        "query": {
          "not": {}
        },
        "id": {
          "not": {}
        },
        "browse": {
          "not": {}
        },
        "tool": {
          "not": {}
        },
        "forget": {
          "not": {}
        },
        "warm": {
          "not": {}
        },
        "status": {
          "not": {}
        },
        "identities": {
          "not": {}
        },
        "refused": {
          "not": {}
        }
      },
      "required": [
        "schemaVersion",
        "packet"
      ]
    },
    {
      "type": "object",
      "properties": {
        "schemaVersion": {
          "type": "number",
          "const": 1
        },
        "query": {
          "type": "string",
          "minLength": 1,
          "maxLength": 8000,
          "description": "One line saying what to look up."
        },
        "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)$"
        },
        "gateHint": {
          "type": "object",
          "properties": {
            "category": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "turnId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "lookupId": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          },
          "required": [
            "category",
            "turnId",
            "lookupId"
          ]
        },
        "accepts": {
          "maxItems": 16,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          }
        },
        "harness": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_-]{0,31}$"
        },
        "improve": {
          "type": "boolean"
        },
        "settings": {
          "type": "object",
          "properties": {
            "version": {
              "type": "number",
              "const": 1
            },
            "hash": {
              "type": "string",
              "pattern": "^sha256:[0-9a-f]{64}$"
            },
            "policy": {
              "type": "object",
              "properties": {
                "block": {
                  "maxItems": 64,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "category",
                          "task",
                          "provider",
                          "seller",
                          "service",
                          "source"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      }
                    },
                    "required": [
                      "kind",
                      "id"
                    ],
                    "additionalProperties": false
                  }
                },
                "only": {
                  "maxItems": 32,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "scope": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "global"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "task"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "category"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "dimension": {
                        "type": "string",
                        "enum": [
                          "capability",
                          "provider",
                          "seller",
                          "service"
                        ]
                      },
                      "targets": {
                        "minItems": 1,
                        "maxItems": 16,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "category",
                                "task",
                                "provider",
                                "seller",
                                "service",
                                "source"
                              ]
                            },
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            }
                          },
                          "required": [
                            "kind",
                            "id"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "scope",
                      "dimension",
                      "targets"
                    ],
                    "additionalProperties": false
                  }
                },
                "prefer": {
                  "maxItems": 64,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "scope": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "global"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "task"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "category"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "targets": {
                        "minItems": 1,
                        "maxItems": 16,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "category",
                                "task",
                                "provider",
                                "seller",
                                "service",
                                "source"
                              ]
                            },
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            }
                          },
                          "required": [
                            "kind",
                            "id"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "scope",
                      "targets"
                    ],
                    "additionalProperties": false
                  }
                },
                "preferSpeed": {
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            },
            "replacement": {
              "type": "object",
              "properties": {
                "mode": {
                  "type": "string",
                  "enum": [
                    "off",
                    "when-routed"
                  ]
                },
                "providers": {
                  "minItems": 1,
                  "maxItems": 16,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "category",
                          "task",
                          "provider",
                          "seller",
                          "service",
                          "source"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      }
                    },
                    "required": [
                      "kind",
                      "id"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "mode"
              ],
              "additionalProperties": false
            },
            "sources": {
              "minItems": 1,
              "maxItems": 16,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            }
          },
          "required": [
            "version",
            "hash",
            "policy",
            "sources"
          ],
          "additionalProperties": false
        },
        "packet": {
          "not": {}
        },
        "browse": {
          "not": {}
        },
        "tool": {
          "not": {}
        },
        "forget": {
          "not": {}
        },
        "warm": {
          "not": {}
        },
        "status": {
          "not": {}
        },
        "identities": {
          "not": {}
        },
        "refused": {
          "not": {}
        }
      },
      "required": [
        "schemaVersion",
        "query"
      ]
    },
    {
      "type": "object",
      "properties": {
        "schemaVersion": {
          "type": "number",
          "const": 1
        },
        "browse": {
          "type": "string",
          "maxLength": 8000
        },
        "accepts": {
          "maxItems": 16,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          }
        },
        "harness": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_-]{0,31}$"
        },
        "settings": {
          "type": "object",
          "properties": {
            "version": {
              "type": "number",
              "const": 1
            },
            "hash": {
              "type": "string",
              "pattern": "^sha256:[0-9a-f]{64}$"
            },
            "policy": {
              "type": "object",
              "properties": {
                "block": {
                  "maxItems": 64,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "category",
                          "task",
                          "provider",
                          "seller",
                          "service",
                          "source"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      }
                    },
                    "required": [
                      "kind",
                      "id"
                    ],
                    "additionalProperties": false
                  }
                },
                "only": {
                  "maxItems": 32,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "scope": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "global"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "task"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "category"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "dimension": {
                        "type": "string",
                        "enum": [
                          "capability",
                          "provider",
                          "seller",
                          "service"
                        ]
                      },
                      "targets": {
                        "minItems": 1,
                        "maxItems": 16,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "category",
                                "task",
                                "provider",
                                "seller",
                                "service",
                                "source"
                              ]
                            },
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            }
                          },
                          "required": [
                            "kind",
                            "id"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "scope",
                      "dimension",
                      "targets"
                    ],
                    "additionalProperties": false
                  }
                },
                "prefer": {
                  "maxItems": 64,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "scope": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "global"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "task"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "category"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "targets": {
                        "minItems": 1,
                        "maxItems": 16,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "category",
                                "task",
                                "provider",
                                "seller",
                                "service",
                                "source"
                              ]
                            },
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            }
                          },
                          "required": [
                            "kind",
                            "id"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "scope",
                      "targets"
                    ],
                    "additionalProperties": false
                  }
                },
                "preferSpeed": {
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            },
            "replacement": {
              "type": "object",
              "properties": {
                "mode": {
                  "type": "string",
                  "enum": [
                    "off",
                    "when-routed"
                  ]
                },
                "providers": {
                  "minItems": 1,
                  "maxItems": 16,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "category",
                          "task",
                          "provider",
                          "seller",
                          "service",
                          "source"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      }
                    },
                    "required": [
                      "kind",
                      "id"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "mode"
              ],
              "additionalProperties": false
            },
            "sources": {
              "minItems": 1,
              "maxItems": 16,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            }
          },
          "required": [
            "version",
            "hash",
            "policy",
            "sources"
          ],
          "additionalProperties": false
        },
        "packet": {
          "not": {}
        },
        "query": {
          "not": {}
        },
        "id": {
          "not": {}
        },
        "tool": {
          "not": {}
        },
        "forget": {
          "not": {}
        },
        "warm": {
          "not": {}
        },
        "status": {
          "not": {}
        },
        "identities": {
          "not": {}
        },
        "refused": {
          "not": {}
        }
      },
      "required": [
        "schemaVersion",
        "browse"
      ]
    },
    {
      "type": "object",
      "properties": {
        "schemaVersion": {
          "type": "number",
          "const": 1
        },
        "tool": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "query": {
          "description": "With tool, binds the query to that free catalog service. Paid or unknown tool ids are refused.",
          "type": "string",
          "minLength": 1,
          "maxLength": 8000
        },
        "accepts": {
          "maxItems": 16,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          }
        },
        "harness": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_-]{0,31}$"
        },
        "settings": {
          "type": "object",
          "properties": {
            "version": {
              "type": "number",
              "const": 1
            },
            "hash": {
              "type": "string",
              "pattern": "^sha256:[0-9a-f]{64}$"
            },
            "policy": {
              "type": "object",
              "properties": {
                "block": {
                  "maxItems": 64,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "category",
                          "task",
                          "provider",
                          "seller",
                          "service",
                          "source"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      }
                    },
                    "required": [
                      "kind",
                      "id"
                    ],
                    "additionalProperties": false
                  }
                },
                "only": {
                  "maxItems": 32,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "scope": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "global"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "task"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "category"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "dimension": {
                        "type": "string",
                        "enum": [
                          "capability",
                          "provider",
                          "seller",
                          "service"
                        ]
                      },
                      "targets": {
                        "minItems": 1,
                        "maxItems": 16,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "category",
                                "task",
                                "provider",
                                "seller",
                                "service",
                                "source"
                              ]
                            },
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            }
                          },
                          "required": [
                            "kind",
                            "id"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "scope",
                      "dimension",
                      "targets"
                    ],
                    "additionalProperties": false
                  }
                },
                "prefer": {
                  "maxItems": 64,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "scope": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "global"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "task"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "category"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "targets": {
                        "minItems": 1,
                        "maxItems": 16,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "category",
                                "task",
                                "provider",
                                "seller",
                                "service",
                                "source"
                              ]
                            },
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            }
                          },
                          "required": [
                            "kind",
                            "id"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "scope",
                      "targets"
                    ],
                    "additionalProperties": false
                  }
                },
                "preferSpeed": {
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            },
            "replacement": {
              "type": "object",
              "properties": {
                "mode": {
                  "type": "string",
                  "enum": [
                    "off",
                    "when-routed"
                  ]
                },
                "providers": {
                  "minItems": 1,
                  "maxItems": 16,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "category",
                          "task",
                          "provider",
                          "seller",
                          "service",
                          "source"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      }
                    },
                    "required": [
                      "kind",
                      "id"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "mode"
              ],
              "additionalProperties": false
            },
            "sources": {
              "minItems": 1,
              "maxItems": 16,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            }
          },
          "required": [
            "version",
            "hash",
            "policy",
            "sources"
          ],
          "additionalProperties": false
        },
        "packet": {
          "not": {}
        },
        "id": {
          "not": {}
        },
        "browse": {
          "not": {}
        },
        "forget": {
          "not": {}
        },
        "warm": {
          "not": {}
        },
        "status": {
          "not": {}
        },
        "identities": {
          "not": {}
        },
        "refused": {
          "not": {}
        }
      },
      "required": [
        "schemaVersion",
        "tool"
      ]
    },
    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "schemaVersion": {
              "type": "number",
              "const": 1
            },
            "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)$"
            },
            "harness": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_-]{0,31}$"
            },
            "via": {
              "type": "string",
              "pattern": "^[a-z][a-z_]{0,31}$"
            },
            "status": {
              "type": "string",
              "enum": [
                "fulfilled",
                "unverified"
              ]
            },
            "httpStatus": {
              "type": "integer",
              "minimum": 100,
              "maximum": 599
            },
            "ms": {
              "type": "integer",
              "minimum": 0,
              "maximum": 600000
            },
            "result": {
              "type": "string",
              "enum": [
                "useful",
                "bad"
              ]
            }
          },
          "required": [
            "schemaVersion",
            "id",
            "status"
          ]
        },
        {
          "type": "object",
          "properties": {
            "schemaVersion": {
              "type": "number",
              "const": 1
            },
            "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)$"
            },
            "harness": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_-]{0,31}$"
            },
            "via": {
              "type": "string",
              "pattern": "^[a-z][a-z_]{0,31}$"
            },
            "status": {
              "type": "string",
              "enum": [
                "failed",
                "needs_approval",
                "running"
              ]
            },
            "httpStatus": {
              "type": "integer",
              "minimum": 100,
              "maximum": 599
            },
            "ms": {
              "type": "integer",
              "minimum": 0,
              "maximum": 600000
            }
          },
          "required": [
            "schemaVersion",
            "id",
            "status"
          ]
        },
        {
          "type": "object",
          "properties": {
            "schemaVersion": {
              "type": "number",
              "const": 1
            },
            "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)$"
            },
            "harness": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_-]{0,31}$"
            },
            "via": {
              "type": "string",
              "pattern": "^[a-z][a-z_]{0,31}$"
            },
            "status": {
              "type": "string",
              "const": "unpaid"
            },
            "reason": {
              "type": "string",
              "enum": [
                "input",
                "terms",
                "provider",
                "unreachable",
                "wallet"
              ]
            },
            "httpStatus": {
              "type": "integer",
              "minimum": 100,
              "maximum": 599
            },
            "ms": {
              "type": "integer",
              "minimum": 0,
              "maximum": 600000
            }
          },
          "required": [
            "schemaVersion",
            "id",
            "status",
            "reason"
          ]
        },
        {
          "type": "object",
          "properties": {
            "schemaVersion": {
              "type": "number",
              "const": 1
            },
            "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)$"
            },
            "harness": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_-]{0,31}$"
            },
            "via": {
              "type": "string",
              "pattern": "^[a-z][a-z_]{0,31}$"
            },
            "status": {
              "type": "string",
              "const": "chose_other"
            },
            "host": {
              "type": "string",
              "maxLength": 253,
              "format": "hostname",
              "pattern": "^(?=.{1,253}\\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\\.?$"
            }
          },
          "required": [
            "schemaVersion",
            "id",
            "status",
            "host"
          ]
        },
        {
          "type": "object",
          "properties": {
            "schemaVersion": {
              "type": "number",
              "const": 1
            },
            "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)$"
            },
            "harness": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_-]{0,31}$"
            },
            "via": {
              "type": "string",
              "pattern": "^[a-z][a-z_]{0,31}$"
            },
            "status": {
              "type": "string",
              "const": "ignored"
            },
            "reason": {
              "type": "string",
              "enum": [
                "expired",
                "native_after_offer"
              ]
            }
          },
          "required": [
            "schemaVersion",
            "id",
            "status",
            "reason"
          ]
        }
      ]
    },
    {
      "type": "object",
      "properties": {
        "schemaVersion": {
          "type": "number",
          "const": 1
        },
        "forget": {
          "type": "string",
          "const": "samples"
        },
        "packet": {
          "not": {}
        },
        "query": {
          "not": {}
        },
        "id": {
          "not": {}
        },
        "browse": {
          "not": {}
        },
        "tool": {
          "not": {}
        },
        "warm": {
          "not": {}
        },
        "status": {
          "not": {}
        },
        "identities": {
          "not": {}
        },
        "refused": {
          "not": {}
        }
      },
      "required": [
        "schemaVersion",
        "forget"
      ]
    },
    {
      "type": "object",
      "properties": {
        "schemaVersion": {
          "type": "number",
          "const": 1
        },
        "identities": {
          "type": "boolean",
          "const": true
        },
        "accepts": {
          "maxItems": 16,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          }
        },
        "harness": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_-]{0,31}$"
        },
        "packet": {
          "not": {}
        },
        "query": {
          "not": {}
        },
        "id": {
          "not": {}
        },
        "browse": {
          "not": {}
        },
        "tool": {
          "not": {}
        },
        "forget": {
          "not": {}
        },
        "warm": {
          "not": {}
        },
        "status": {
          "not": {}
        },
        "refused": {
          "not": {}
        }
      },
      "required": [
        "schemaVersion",
        "identities"
      ]
    },
    {
      "type": "object",
      "properties": {
        "schemaVersion": {
          "type": "number",
          "const": 1
        },
        "refused": {
          "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)$"
        },
        "accepts": {
          "maxItems": 16,
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32
          }
        },
        "harness": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9_-]{0,31}$"
        },
        "settings": {
          "type": "object",
          "properties": {
            "version": {
              "type": "number",
              "const": 1
            },
            "hash": {
              "type": "string",
              "pattern": "^sha256:[0-9a-f]{64}$"
            },
            "policy": {
              "type": "object",
              "properties": {
                "block": {
                  "maxItems": 64,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "category",
                          "task",
                          "provider",
                          "seller",
                          "service",
                          "source"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      }
                    },
                    "required": [
                      "kind",
                      "id"
                    ],
                    "additionalProperties": false
                  }
                },
                "only": {
                  "maxItems": 32,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "scope": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "global"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "task"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "category"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "dimension": {
                        "type": "string",
                        "enum": [
                          "capability",
                          "provider",
                          "seller",
                          "service"
                        ]
                      },
                      "targets": {
                        "minItems": 1,
                        "maxItems": 16,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "category",
                                "task",
                                "provider",
                                "seller",
                                "service",
                                "source"
                              ]
                            },
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            }
                          },
                          "required": [
                            "kind",
                            "id"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "scope",
                      "dimension",
                      "targets"
                    ],
                    "additionalProperties": false
                  }
                },
                "prefer": {
                  "maxItems": 64,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "scope": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "global"
                              }
                            },
                            "required": [
                              "kind"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "task"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "category"
                              },
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              }
                            },
                            "required": [
                              "kind",
                              "id"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "targets": {
                        "minItems": 1,
                        "maxItems": 16,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "category",
                                "task",
                                "provider",
                                "seller",
                                "service",
                                "source"
                              ]
                            },
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            }
                          },
                          "required": [
                            "kind",
                            "id"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "scope",
                      "targets"
                    ],
                    "additionalProperties": false
                  }
                },
                "preferSpeed": {
                  "type": "boolean"
                }
              },
              "additionalProperties": false
            },
            "replacement": {
              "type": "object",
              "properties": {
                "mode": {
                  "type": "string",
                  "enum": [
                    "off",
                    "when-routed"
                  ]
                },
                "providers": {
                  "minItems": 1,
                  "maxItems": 16,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "category",
                          "task",
                          "provider",
                          "seller",
                          "service",
                          "source"
                        ]
                      },
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      }
                    },
                    "required": [
                      "kind",
                      "id"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "mode"
              ],
              "additionalProperties": false
            },
            "sources": {
              "minItems": 1,
              "maxItems": 16,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            }
          },
          "required": [
            "version",
            "hash",
            "policy",
            "sources"
          ],
          "additionalProperties": false
        },
        "packet": {
          "not": {}
        },
        "query": {
          "not": {}
        },
        "id": {
          "not": {}
        },
        "browse": {
          "not": {}
        },
        "tool": {
          "not": {}
        },
        "forget": {
          "not": {}
        },
        "warm": {
          "not": {}
        },
        "status": {
          "not": {}
        },
        "identities": {
          "not": {}
        }
      },
      "required": [
        "schemaVersion",
        "refused"
      ]
    }
  ]
}