{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agentparley.ai/migrate/agent-export.schema.json",
  "title": "Agent Export v1: agent.json",
  "description": "The manifest at the root of an Agent Export zip. Fields not listed here are ignored. Full format: https://agentparley.ai/migrate/format",
  "type": "object",
  "required": ["format", "formatVersion", "name"],
  "properties": {
    "format": { "const": "agent-export" },
    "formatVersion": { "const": 1 },
    "name": { "type": "string", "minLength": 1, "maxLength": 200, "description": "The agent's name. 1 to 200 characters after trimming." },
    "description": { "type": "string", "description": "What the agent does. Longer than 1,000 characters is cut to 1,000 with a warning." },
    "source": {
      "type": "object",
      "properties": {
        "app": { "type": "string", "maxLength": 50 },
        "appVersion": { "type": "string", "maxLength": 50 },
        "exportedAt": { "type": "string", "maxLength": 50, "description": "ISO-8601 time." }
      }
    },
    "schedules": {
      "type": "array",
      "maxItems": 50,
      "items": {
        "type": "object",
        "required": ["name", "prompt", "cron"],
        "properties": {
          "name": { "type": "string", "minLength": 1, "maxLength": 200 },
          "prompt": { "type": "string", "minLength": 1, "maxLength": 20000 },
          "cron": { "type": "string", "pattern": "^\\S+(\\s+\\S+){4}$", "description": "A cron expression with exactly 5 fields." },
          "timeZone": { "type": "string", "description": "An IANA time zone id, for example Europe/Copenhagen." }
        }
      }
    },
    "heartbeat": {
      "type": "object",
      "required": ["everyMinutes", "prompt"],
      "properties": {
        "everyMinutes": { "type": "integer", "minimum": 5, "maximum": 1440 },
        "prompt": { "type": "string", "minLength": 1, "maxLength": 20000 },
        "activeFrom": { "type": "string", "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$", "description": "HH:mm. Give both activeFrom and activeTo, or neither." },
        "activeTo": { "type": "string", "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$", "description": "HH:mm. Give both activeFrom and activeTo, or neither." }
      },
      "dependentRequired": { "activeFrom": ["activeTo"], "activeTo": ["activeFrom"] }
    },
    "hints": {
      "type": "object",
      "description": "Shown to the person as 'Not imported'. Never imported.",
      "properties": {
        "model": { "type": "string", "maxLength": 200 },
        "channels": { "type": "array", "maxItems": 20, "items": { "type": "string", "maxLength": 200 } },
        "emoji": { "type": "string", "maxLength": 16 }
      }
    },
    "notes": { "type": "string", "maxLength": 4000, "description": "Shown to the person as 'From the exporter'." }
  }
}
