{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/signo-fi/json-schema/signo-fi-intent-request-schema.json",
  "title": "IntentRequest",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/signo-fi-openapi.yaml#/components/schemas/IntentRequest",
  "type": "object",
  "required": [
    "prompt",
    "wallets"
  ],
  "properties": {
    "prompt": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000,
      "description": "The desired outcome in plain English."
    },
    "wallets": {
      "type": "array",
      "minItems": 1,
      "description": "The wallets in play — at least one.",
      "items": {
        "$ref": "#/$defs/Wallet"
      }
    },
    "balances": {
      "type": "array",
      "description": "Optional pre-fetched holdings. Omit and Signo fetches them.",
      "items": {
        "$ref": "#/$defs/Balance"
      }
    },
    "page_context": {
      "type": "object",
      "description": "Descriptive page facts; partner identity and existing scope policy are derived from the authenticated tenant. Not a permissions override.",
      "required": [
        "surface"
      ],
      "additionalProperties": false,
      "properties": {
        "surface": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "chain": {
          "type": "string",
          "minLength": 1,
          "maxLength": 40
        },
        "market": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "position": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "asset": {
          "type": "string",
          "minLength": 1,
          "maxLength": 80
        }
      }
    },
    "messages": {
      "type": "array",
      "maxItems": 100,
      "description": "Prior turns, oldest first; the current message belongs in `prompt`.\nThe server formats role labels and keeps the newest history within\n6000 characters. Only user turns can confirm a recipient or spender\naddress. Takes precedence over `conversation_context`, including an\nempty array. Invalid structured history is rejected, not ignored.\n",
      "items": {
        "type": "object",
        "required": [
          "role",
          "content"
        ],
        "additionalProperties": false,
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "user",
              "assistant"
            ]
          },
          "content": {
            "type": "string",
            "maxLength": 64000
          }
        }
      }
    },
    "conversation_context": {
      "type": "string",
      "description": "Legacy descriptive context. Addresses here do not count as typed by\nthe user; paste the address in the current `prompt`, or migrate to\n`messages`. Ignored when `messages` is supplied.\n\nPrior turns of the conversation, for multi-turn planning: the prior turns\nnewline-joined, one turn per line, each line `User: <text>` or\n`Signo: <text>`, most recent last, ~8 turns max. The current message goes\nin `prompt`, never in this block.\n\nLonger than 6000 characters is accepted, not rejected: the server keeps\nthe NEWEST end and drops whole turns off the front until it fits, so send\nwhat you have rather than truncating it yourself. If you do trim, trim\nthe OLDEST turns — a client that cuts the newest end throws away the part\nthe planner most needs.\n"
    },
    "clarify_follow_up": {
      "type": "boolean",
      "description": "Set `true` when re-sending after the user picked a clarification option.\nThe re-send pattern: `prompt` = the original prompt + `\"\\n\\n\"` + the\nplain-text answer block `Clarification — <question>: <picked label>`.\nThe flag makes the planner acknowledge the answer and continue planning —\nit never re-raises the same clarification.\n"
    },
    "options": {
      "type": "object",
      "description": "Coarse run options. Raw model ids are never exposed.",
      "properties": {
        "stream": {
          "type": "boolean",
          "description": "Stream the build as SSE (equivalent to `Accept: text/event-stream`)."
        },
        "tier": {
          "type": "string",
          "enum": [
            "fast",
            "quality"
          ],
          "description": "Coarse latency/quality preference."
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false,
  "$defs": {
    "Balance": {
      "type": "object",
      "description": "Pre-fetched holdings for a wallet so the planner sizes without a lookup.",
      "required": [
        "address",
        "chain"
      ],
      "properties": {
        "address": {
          "type": "string"
        },
        "chain": {
          "type": "string"
        },
        "eth_balance": {
          "type": "number"
        },
        "usdc_balance": {
          "type": "number"
        },
        "stable_usd": {
          "type": "number"
        },
        "total_usd": {
          "type": "number"
        },
        "tokens": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TokenBalance"
          }
        }
      },
      "additionalProperties": true
    },
    "TokenBalance": {
      "type": "object",
      "required": [
        "symbol",
        "amount"
      ],
      "properties": {
        "symbol": {
          "type": "string"
        },
        "amount": {
          "type": "number",
          "description": "Token-denominated amount (not wei)."
        },
        "usd_value": {
          "type": "number"
        },
        "chain": {
          "type": "string",
          "description": "Per-token chain, so summed-across-chains balances aren't mis-attributed."
        }
      },
      "additionalProperties": true
    },
    "Wallet": {
      "type": "object",
      "description": "A wallet in play. The planner prefers these for sourcing and destinations.",
      "required": [
        "address",
        "chain"
      ],
      "properties": {
        "address": {
          "type": "string",
          "description": "EVM 0x address or Solana base58 address (never lower-cased)."
        },
        "chain": {
          "type": "string",
          "description": "Chain key, e.g. ethereum, base, arbitrum, optimism, polygon, solana."
        },
        "label": {
          "type": "string",
          "description": "Optional human label surfaced in reasoning."
        },
        "balances": {
          "type": "object",
          "description": "Optional token-unit balance hints for this exact wallet and chain,\nkeyed by symbol or token address. Callers normally supply addresses\nand chains only; Signo reads the input balances needed for /plan.\nWallet-sized \"max\", including Pendle PT/YT exits, is refreshed from\nchain even when a hint is supplied. A failed required read returns\n503 balance_unavailable; a confirmed zero Pendle holding returns\n400 invalid_intents with an intents.N.amount issue. Compilation\nuses targeted reads rather than repeating /intent portfolio scans.\nChained consumers use preceding proceeds; protocol-sized amounts\nretain their existing sizing behavior.\n",
          "additionalProperties": {
            "type": "number"
          }
        }
      },
      "additionalProperties": true
    }
  }
}