{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agentcall.smartycode.com/schemas/agentcall-card-0.1.schema.json",
  "title": "AgentCall Agent Card ingest profile (0.1) - public NFC/photo profile",
  "description": "Public AgentCall 0.1 NFC/photo profile generated from canonical contracts. Only the reviewed dependency closure is published; see the release manifest and /ext/agentcall-agui/0.1 for negotiation and semantic validation duties.",
  "type": "object",
  "required": [
    "name",
    "supportedInterfaces",
    "capabilities"
  ],
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "description": {
      "type": "string",
      "maxLength": 2048
    },
    "iconUrl": {
      "type": "string",
      "maxLength": 2048,
      "pattern": "^https?://",
      "description": "Optional standard A2A agent identity image. HTTP is allowed only so local-development fixtures can validate; clients enforce HTTPS, hostile-media fetch limits, decoding bounds, and local caching."
    },
    "version": {
      "type": "string",
      "maxLength": 64
    },
    "provider": {
      "type": "object",
      "properties": {
        "organization": {
          "type": "string",
          "maxLength": 128
        },
        "url": {
          "type": "string",
          "maxLength": 2048,
          "pattern": "^https?://"
        }
      }
    },
    "supportedInterfaces": {
      "type": "array",
      "minItems": 1,
      "maxItems": 8,
      "items": {
        "type": "object",
        "required": [
          "url",
          "protocolBinding"
        ],
        "properties": {
          "url": {
            "type": "string",
            "maxLength": 2048,
            "pattern": "^https?://"
          },
          "protocolBinding": {
            "type": "string",
            "maxLength": 64,
            "description": "JSONRPC, GRPC, HTTP+JSON, or a custom binding; bounded string because A2A 1.0 permits custom bindings and AgentCall does not consume these interfaces."
          },
          "protocolVersion": {
            "type": "string",
            "maxLength": 32,
            "pattern": "^1\\.",
            "description": "Per-interface in A2A 1.0 (the top-level field was removed); when present it must be a 1.x version."
          }
        }
      }
    },
    "capabilities": {
      "type": "object",
      "required": [
        "extensions"
      ],
      "properties": {
        "extensions": {
          "type": "array",
          "minItems": 1,
          "maxItems": 16,
          "items": {
            "type": "object",
            "required": [
              "uri"
            ],
            "properties": {
              "uri": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "description": {
                "type": "string",
                "maxLength": 512
              },
              "required": {
                "type": "boolean"
              },
              "params": {
                "type": "object"
              }
            },
            "allOf": [
              {
                "if": {
                  "properties": {
                    "uri": {
                      "enum": [
                        "https://agentcall.smartycode.com/ext/agentcall-agui/0.1",
                        "https://agentcall.invalid/ext/agentcall-agui/0.1"
                      ]
                    }
                  },
                  "required": [
                    "uri"
                  ]
                },
                "then": {
                  "required": [
                    "params"
                  ],
                  "properties": {
                    "params": {
                      "$ref": "#/$defs/agentcallParams"
                    }
                  }
                }
              }
            ]
          },
          "contains": {
            "type": "object",
            "required": [
              "uri",
              "params"
            ],
            "properties": {
              "uri": {
                "enum": [
                  "https://agentcall.smartycode.com/ext/agentcall-agui/0.1",
                  "https://agentcall.invalid/ext/agentcall-agui/0.1"
                ]
              },
              "params": {
                "$ref": "#/$defs/agentcallParams"
              }
            }
          },
          "maxContains": 1
        }
      }
    },
    "securitySchemes": {
      "type": "object",
      "maxProperties": 8,
      "propertyNames": {
        "maxLength": 64
      },
      "additionalProperties": {
        "type": "object",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "enum": [
              "oauth2",
              "http",
              "apiKey",
              "openIdConnect"
            ]
          },
          "scheme": {
            "type": "string",
            "maxLength": 32
          },
          "openIdConnectUrl": {
            "type": "string",
            "maxLength": 2048,
            "pattern": "^https://"
          },
          "flows": {
            "type": "object",
            "properties": {
              "authorizationCode": {
                "type": "object",
                "required": [
                  "authorizationUrl",
                  "tokenUrl"
                ],
                "properties": {
                  "authorizationUrl": {
                    "type": "string",
                    "maxLength": 2048,
                    "pattern": "^https://"
                  },
                  "tokenUrl": {
                    "type": "string",
                    "maxLength": 2048,
                    "pattern": "^https://"
                  },
                  "refreshUrl": {
                    "type": "string",
                    "maxLength": 2048,
                    "pattern": "^https://"
                  },
                  "scopes": {
                    "type": "object",
                    "maxProperties": 32,
                    "propertyNames": {
                      "maxLength": 128
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 256
                    }
                  }
                }
              }
            },
            "description": "Auth endpoints are https unconditionally: no local-development exception for authorization."
          }
        }
      }
    },
    "security": {
      "type": "array",
      "maxItems": 8,
      "items": {
        "type": "object",
        "maxProperties": 4,
        "additionalProperties": {
          "type": "array",
          "maxItems": 32,
          "items": {
            "type": "string",
            "maxLength": 128
          }
        }
      }
    },
    "signatures": {
      "type": "array",
      "maxItems": 4,
      "items": {
        "type": "object"
      },
      "description": "Tolerated shallowly; JWS provenance never substitutes for TLS or authorization (TM-1.7)."
    }
  },
  "$defs": {
    "agentcallParams": {
      "type": "object",
      "required": [
        "schemaVersion",
        "agui"
      ],
      "properties": {
        "schemaVersion": {
          "const": "0.1"
        },
        "agui": {
          "type": "object",
          "required": [
            "url",
            "transport"
          ],
          "properties": {
            "url": {
              "type": "string",
              "maxLength": 2048,
              "pattern": "^https?://"
            },
            "transport": {
              "enum": [
                "websocket",
                "webrtc"
              ]
            },
            "session": {
              "type": "object",
              "properties": {
                "resume": {
                  "type": "boolean"
                },
                "replay": {
                  "type": "boolean"
                }
              }
            },
            "webrtc": {
              "type": "object",
              "required": [
                "profile",
                "audio",
                "events"
              ],
              "properties": {
                "profile": {
                  "const": "agentcall-webrtc-0.1"
                },
                "audio": {
                  "type": "object",
                  "required": [
                    "codec",
                    "clockRateHz",
                    "channels",
                    "direction"
                  ],
                  "properties": {
                    "codec": {
                      "const": "opus"
                    },
                    "clockRateHz": {
                      "const": 48000
                    },
                    "channels": {
                      "enum": [
                        1,
                        2
                      ]
                    },
                    "direction": {
                      "const": "sendrecv"
                    }
                  }
                },
                "events": {
                  "type": "object",
                  "required": [
                    "transport",
                    "label",
                    "protocol",
                    "ordered"
                  ],
                  "properties": {
                    "transport": {
                      "const": "datachannel"
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 64
                    },
                    "protocol": {
                      "type": "string",
                      "maxLength": 64
                    },
                    "ordered": {
                      "const": true
                    }
                  }
                },
                "supportsExplicitTurns": {
                  "const": true,
                  "description": "Optional additive capability. When true, the agent supports correlated audio.turn.start/commit/cancel control while preserving automatic ordinary-call turn detection."
                }
              },
              "allOf": [
                {
                  "if": {
                    "properties": {
                      "profile": {
                        "const": "agentcall-webrtc-0.1"
                      }
                    },
                    "required": [
                      "profile"
                    ]
                  },
                  "then": {
                    "properties": {
                      "events": {
                        "properties": {
                          "protocol": {
                            "const": "agentcall-agui-dc-0.1"
                          }
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        },
        "voice": {
          "type": "object",
          "required": [
            "owner"
          ],
          "properties": {
            "owner": {
              "enum": [
                "client",
                "agent",
                "provider"
              ]
            },
            "hints": {
              "type": "array",
              "maxItems": 8,
              "items": {
                "type": "string",
                "maxLength": 128
              }
            }
          }
        },
        "physicalObservations": {
          "type": "object",
          "required": [
            "accepted",
            "agentRequests"
          ],
          "properties": {
            "accepted": {
              "type": "array",
              "maxItems": 2,
              "uniqueItems": true,
              "items": {
                "enum": [
                  "nfc",
                  "photo"
                ]
              }
            },
            "agentRequests": {
              "type": "array",
              "maxItems": 2,
              "uniqueItems": true,
              "items": {
                "enum": [
                  "nfc",
                  "photo"
                ]
              }
            }
          },
          "allOf": [
            {
              "if": {
                "properties": {
                  "agentRequests": {
                    "contains": {
                      "const": "nfc"
                    }
                  }
                },
                "required": [
                  "agentRequests"
                ]
              },
              "then": {
                "properties": {
                  "accepted": {
                    "contains": {
                      "const": "nfc"
                    }
                  }
                },
                "required": [
                  "accepted"
                ]
              }
            },
            {
              "if": {
                "properties": {
                  "agentRequests": {
                    "contains": {
                      "const": "photo"
                    }
                  }
                },
                "required": [
                  "agentRequests"
                ]
              },
              "then": {
                "properties": {
                  "accepted": {
                    "contains": {
                      "const": "photo"
                    }
                  }
                },
                "required": [
                  "accepted"
                ]
              }
            }
          ]
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "agui": {
                "properties": {
                  "transport": {
                    "const": "webrtc"
                  }
                },
                "required": [
                  "transport"
                ]
              }
            }
          },
          "then": {
            "properties": {
              "agui": {
                "required": [
                  "webrtc"
                ]
              },
              "voice": {
                "properties": {
                  "owner": {
                    "const": "agent"
                  }
                },
                "required": [
                  "owner"
                ]
              }
            },
            "required": [
              "voice"
            ]
          }
        },
        {
          "if": {
            "required": [
              "physicalObservations"
            ],
            "properties": {
              "physicalObservations": {
                "anyOf": [
                  {
                    "required": [
                      "accepted"
                    ],
                    "properties": {
                      "accepted": {
                        "minItems": 1
                      }
                    }
                  },
                  {
                    "required": [
                      "agentRequests"
                    ],
                    "properties": {
                      "agentRequests": {
                        "minItems": 1
                      }
                    }
                  }
                ]
              }
            }
          },
          "then": {
            "properties": {
              "agui": {
                "anyOf": [
                  {
                    "properties": {
                      "transport": {
                        "const": "websocket"
                      }
                    }
                  },
                  {
                    "properties": {
                      "transport": {
                        "const": "webrtc"
                      },
                      "webrtc": {
                        "properties": {
                          "profile": {
                            "const": "agentcall-webrtc-0.1"
                          }
                        },
                        "required": [
                          "profile"
                        ]
                      }
                    },
                    "required": [
                      "webrtc"
                    ]
                  }
                ]
              }
            }
          }
        }
      ]
    }
  }
}
