{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://a2a-to-poppy.com/ext/poppy-bridge/v1/schema.json",
  "title": "Poppy bridge extension, v1",
  "description": "Shapes used by the A2A extension https://a2a-to-poppy.com/ext/poppy-bridge/v1. Each lives under $defs. Unknown fields are allowed everywhere: version 1 only ever adds fields.",
  "$defs": {
    "params": {
      "title": "Agent Card: capabilities.extensions[].params",
      "type": "object",
      "required": [
        "company"
      ],
      "properties": {
        "company": {
          "type": "string",
          "minLength": 1,
          "description": "The Company's organization.domain from its poppy.json. The bridge speaks for this Company and no other."
        },
        "poppyVersion": {
          "type": "string",
          "description": "protocol_version of the poppy.json the adapter read."
        },
        "issuer": {
          "type": "string",
          "format": "uri",
          "description": "The Company's OAuth issuer, when poppy.json names one."
        },
        "signIn": {
          "type": "boolean",
          "description": "false when the Company sets auth.disabled. Absent means sign-in follows the rest of the document."
        },
        "scopes": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Scope name to the sentence a User reads, copied from auth.scopes."
        },
        "scopeHints": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "properties": {
              "changes": {
                "type": "string",
                "enum": [
                  "none",
                  "reversible",
                  "irreversible"
                ]
              },
              "personal_data": {
                "type": "boolean"
              }
            }
          },
          "description": "Scope name to the Company's own hints, copied from auth.scope_hints."
        }
      }
    },
    "messageMetadata": {
      "title": "Message from the caller: message.metadata[<extension URI>]",
      "type": "object",
      "properties": {
        "author": {
          "type": "string",
          "enum": [
            "agent",
            "human"
          ],
          "default": "agent",
          "description": "Who wrote the words. human only for the User's own words, never a paraphrase."
        },
        "context": {
          "type": "object",
          "description": "Poppy message context (locale, time_zone, user_available, ...). Sticky: omitted fields keep their value, null clears one."
        }
      }
    },
    "taskMetadata": {
      "title": "Task from the adapter: task.metadata[<extension URI>]",
      "type": "object",
      "properties": {
        "responder": {
          "type": "string",
          "enum": [
            "agent",
            "human"
          ],
          "description": "Whether an AI or a live person is handling the Company side."
        },
        "handoff": {
          "type": "string",
          "enum": [
            "none",
            "pending"
          ],
          "description": "pending while the Company looks for a person to join."
        },
        "closed": {
          "type": "boolean",
          "description": "true once the conversation takes no more messages."
        },
        "author": {
          "type": "object",
          "required": [
            "type"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "agent",
                "human"
              ]
            },
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "image": {
              "type": "string"
            }
          },
          "description": "The Company's author for the reply, when a named person or persona wrote it."
        }
      }
    },
    "authRequired": {
      "title": "Data part of status.message when the task state is auth-required",
      "type": "object",
      "required": [
        "scope",
        "verification_uri",
        "user_code",
        "expires_in"
      ],
      "properties": {
        "scope": {
          "type": "string",
          "description": "Space-separated scopes the Company asked for."
        },
        "verification_uri": {
          "type": "string",
          "format": "uri",
          "description": "Where the person signs in. Its host is the Company's issuer or domain."
        },
        "verification_uri_complete": {
          "type": "string",
          "format": "uri"
        },
        "user_code": {
          "type": "string"
        },
        "expires_in": {
          "type": "number",
          "minimum": 0,
          "description": "Seconds until the link stops working."
        }
      },
      "not": {
        "required": [
          "device_code"
        ]
      }
    }
  }
}
