{
  "asyncapi": "3.1.0",
  "id": "urn:waraps.decentralized-swarm",
  "info": {
    "title": "WARA-PS Decentralized Swarm MQTT Extension",
    "version": "1.1.1",
    "description": "An extension for autonomous Swarm membership, leadership, formation and task delegation.\n\n**Scope**\n- Adds the Swarm topics.\n- Extends the shared AvailableSensors enum in waraps-api-declarations.json with the Swarm sensor names.\n- Does not change any other declarations or task execution contracts.\n\n**Publishing**\n- The Swarm Leader publishes the Swarm Roster, Leader Signal, Formation State and Formation Reference on change and every sensor interval.\n- These sensors use QoS 1. Consumers must not depend on retain.\n- The latest sensor message is the current state. The Swarm Unit heartbeat indicates liveness.\n\n**Subscriptions**\n- Every agent with Swarm intent subscribes to the Swarm Unit topics, its own topics and its mates' sensor/position.\n- Only the elected Swarm Leader also subscribes to the peer wildcards +/heartbeat, +/sensor/swarm_membership, +/sensor_info and +/direct_execution_info. It does so while it leads and drops them when it stops leading.\n\n**Leader liveness**\n- Members detect a dead leader when the Swarm Unit sensors leader, members and reference are all stale for the liveness timeout."
  },
  "defaultContentType": "application/json",
  "servers": {
    "localhost": {
      "host": "localhost:{port}",
      "protocol": "mqtt",
      "protocolVersion": "3.1.1+",
      "description": "Development MQTT broker",
      "variables": {
        "port": {
          "enum": [
            "1882",
            "1883"
          ],
          "default": "1883",
          "description": "The port used for connecting to the locally hosted MQTT broker"
        }
      },
      "security": []
    },
    "production": {
      "host": "broker.waraps.org:{port}",
      "protocol": "mqtt",
      "protocolVersion": "3.1.1+",
      "description": "Production MQTT broker",
      "variables": {
        "port": {
          "enum": [
            "8883"
          ],
          "default": "8883",
          "description": "The port used for connecting to the production MQTT broker"
        }
      },
      "security": [
        {
          "$ref": "#/components/securitySchemes/tls"
        }
      ]
    }
  },
  "channels": {
    "admissionCommand": {
      "address": "{agent-base-topic}/exec/command",
      "description": "An applicant requests admission with command admission-request. No membership is granted by this message.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "request": {
          "$ref": "#/components/messages/AdmissionRequest"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "admissionResponse": {
      "address": "{agent-base-topic}/exec/response",
      "description": "The elected Swarm Leader invites or explicitly rejects an applicant using the WARA-PS execution response envelope.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "invite": {
          "$ref": "#/components/messages/AdmissionInvite"
        },
        "reject": {
          "$ref": "#/components/messages/AdmissionReject"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "electionCandidate": {
      "address": "{agent-base-topic}/sensor/election",
      "description": "A live member announces its election round and agent ID on the Swarm Unit sensor.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "candidate": {
          "$ref": "#/components/messages/ElectionCandidate"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "electionResult": {
      "address": "{agent-base-topic}/sensor/election",
      "description": "The converged election result on the Swarm Unit sensor. The live candidate with the lexicographically highest agent-id wins.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "result": {
          "$ref": "#/components/messages/ElectionResult"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "roster": {
      "address": "{agent-base-topic}/sensor/members",
      "description": "The elected Swarm Leader publishes the current Swarm Roster on change and every sensor interval. Members subscribe to it for their live set and departures, and a new leader seeds its roster from the last one it received.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmSensorMqttSettings"
      },
      "messages": {
        "roster": {
          "$ref": "#/components/messages/SwarmRoster"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "leaderSignal": {
      "address": "{agent-base-topic}/sensor/leader",
      "description": "Every agent with Swarm intent subscribes to this topic; a leader yields to a higher-ID rival's Leader Signal, and members use its staleness to detect a dead leader. The Swarm Unit Leader Signal names the current Swarm Leader directly, including the leader's base topic and the start of the current leadership interval. It is published on change and every sensor interval.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmSensorMqttSettings"
      },
      "messages": {
        "leader": {
          "$ref": "#/components/messages/LeaderSignal"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "formationCommand": {
      "address": "{agent-base-topic}/exec/command",
      "description": "An external caller submits a standard start-task envelope named set-formation. Only the elected Swarm Leader accepts and applies valid tasks; Formation State command-id is the task-uuid.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "command": {
          "$ref": "#/components/messages/SetFormationTaskCommand"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "formationResponse": {
      "address": "{agent-base-topic}/exec/response",
      "description": "The elected Swarm Leader acknowledges or rejects a set-formation task on the Swarm Unit execution boundary using the standard task response.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "response": {
          "$ref": "#/components/messages/WaraTaskResponse"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "formationFeedback": {
      "address": "{agent-base-topic}/exec/feedback",
      "description": "The elected Swarm Leader reports set-formation progress as running until Formation State is published, then finished; invalid requests report failed with a reason.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "feedback": {
          "$ref": "#/components/messages/WaraTaskFeedback"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "formationState": {
      "address": "{agent-base-topic}/sensor/formation",
      "description": "The elected Swarm Leader publishes the current Formation State on change and every sensor interval.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmSensorMqttSettings"
      },
      "messages": {
        "state": {
          "$ref": "#/components/messages/FormationState"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "formationReference": {
      "address": "{agent-base-topic}/sensor/reference",
      "description": "Every agent with Swarm intent subscribes to this topic; a leader yields to a higher-ID rival's reference. The elected Swarm Leader publishes the anchor Formation Reference used by members to compute formation targets on change and every sensor interval.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmSensorMqttSettings"
      },
      "messages": {
        "reference": {
          "$ref": "#/components/messages/FormationReference"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "taskIngress": {
      "address": "{agent-base-topic}/exec/command",
      "description": "A commander submits the direct WARA-PS move-to or search-area command with command start-task; the elected Swarm Leader queues valid tasks in receipt order and conducts one Delegation Round at a time. The default limit is 100 pending tasks; active and assigned tasks do not count. Distinct ingress beyond capacity fails on the Swarm Unit response and feedback boundaries without evicting accepted work.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "command": {
          "$ref": "#/components/messages/WaraMoveToCommand"
        },
        "searchArea": {
          "$ref": "#/components/messages/WaraSearchAreaCommand"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "taskAnnouncement": {
      "address": "{agent-base-topic}/sensor/task/{task-id}/announce",
      "description": "The elected Swarm Leader announces the oldest pending ingress task to eligible members for bidding. A member bids the distance to the task's destination: the waypoint of a move-to, or the first waypoint of a search-area route. A Sub-Task of a Parent search-area is announced as a start-task command that carries only its own part of the area in params.area (every other parameter, loop included, is the Parent Task's, and loop applies to each Agent's part), so a member bids the distance to the first waypoint of that part's route. The parts are announced one after another in route order, from the end the whole route starts at; a re-bid of a refused part announces the same part again. The next round waits until the selected executor processes its assignment and accepts execution or reports failure; Flight Tasks may execute concurrently after acknowledgement.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "announcement": {
          "$ref": "#/components/messages/TaskAnnouncement"
        }
      },
      "parameters": {
        "task-id": {
          "$ref": "#/components/parameters/task-id"
        },
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "taskBid": {
      "address": "{agent-base-topic}/sensor/task/{task-id}/bid",
      "description": "An available member submits at most one local cost bid for the announced task.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "bid": {
          "$ref": "#/components/messages/TaskBid"
        }
      },
      "parameters": {
        "task-id": {
          "$ref": "#/components/parameters/task-id"
        },
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "taskAssignment": {
      "address": "{agent-base-topic}/task/{task-id}/assignment",
      "description": "For tasks admitted to a Delegation Round, the elected Swarm Leader announces the selected executor or a correlated delegation failure on a separate internal topic never reachable as exec/command. An abort during bid collection closes the round with failure reason 'task aborted by commander' so bidders release their reservations. Ingress rejected before queue admission is reported on exec/response and exec/feedback instead. The failure-reason is one of no-bid (status no-bid), missing executor topic, executor acknowledgement timeout, executor refused, or task aborted by commander. An assigned round remains active until the executor's lifecycle response or feedback acknowledges assignment processing. For a Sub-Task of a Parent Task, a winner that refuses (terminal feedback before it accepted the Sub-Task into planning) or never accepts is reported as a failed assignment (executor refused, or executor acknowledgement timeout) that stays on its topic, and the leader re-bids that Sub-Task once under a new task-id; only the executor's feedback counts as its acceptance of a Sub-Task.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "assignment": {
          "$ref": "#/components/messages/TaskAssignment"
        }
      },
      "parameters": {
        "task-id": {
          "$ref": "#/components/parameters/task-id"
        },
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "parentTaskDecision": {
      "address": "{agent-base-topic}/task/{task-id}/decision",
      "description": "For a Parent Task (a move-to with params.agent-count above 1), where task-id is the Parent Task's uuid. After every Sub-Task has been assigned and its executor has accepted it into planning, the elected Swarm Leader publishes decision commit, which releases every held Sub-Task of the Parent Task at once. If the Parent Round fails, it publishes decision release instead, and every Agent holding a Sub-Task of that Parent Task drops it and reports it aborted. Nothing flies before the commit. If a Sub-Task's winner refuses or never accepts it, the leader re-bids that Sub-Task once under a new task-id; the failed Sub-Task keeps its failed assignment. If the replacement also fails or finds no bidder, the leader publishes release and fails the Parent Task, with the replacement's failure reason (insufficient-agents when nobody bid). After the commit, a Sub-Task that fails is replaced once the same way, a new Sub-Task re-run from the start whose executor holds it in planning until the leader publishes decision commit again; the failed Sub-Task keeps its failed record and a finished Sub-Task is never replaced. A held Sub-Task that hears neither within twice N times the sum of the bid window and the acknowledgement timeout plus one more acknowledgement timeout, N being the agent-count announced with it, releases itself. A leader lost before the commit leaves held Sub-Tasks that release themselves the same way; the new leader does not adopt them.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "decision": {
          "$ref": "#/components/messages/ParentTaskDecision"
        }
      },
      "parameters": {
        "task-id": {
          "$ref": "#/components/parameters/task-id"
        },
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "taskResponse": {
      "address": "{agent-base-topic}/exec/response",
      "description": "The Swarm Leader relays the selected executor's official WARA-PS task response on the Swarm Unit's own execution boundary. A pending-capacity rejection is response failed with fail-reason 'pending task capacity exceeded'. A command received while the newly elected Swarm Leader is warming up (one liveness window after it took over) is not queued: it is response failed with fail-reason 'leader warming up'. A pause, continue, or enough signal received before assignment is rejected with fail-reason 'signal not applicable before assignment' and no terminal task feedback. Correlation identifiers are preserved. A task that fails after queue admission is relayed as response failed with the delegation failure-reason (no-bid, missing executor topic, executor acknowledgement timeout, executor refused, or task aborted by commander); ingress with an invalid task payload fails with 'invalid task payload'. A Swarm Move (move-to with params.swarm true) is refused with response failed and fail-reason 'no formation' when the formation is none, or 'task-already-running' when another Swarm Move is active; delegated move-to tasks are unaffected. A task whose params.agent-count is invalid, or combined with params.swarm true, fails with fail-reason 'invalid-agent-count'; a task type that gives an agent-count above one no meaning fails with 'agent-count-unsupported'; an agent-count above the Swarm roster size fails with 'insufficient-agents'; a search-area whose agent-count is above the number of lawnmower tracks its area holds fails with 'area-too-small'. These are refused before bidding and before the task takes a pending-queue place. A Parent Task whose leader was lost after its Commit is failed by the new Swarm Leader as response failed with fail-reason 'leader lost', under the Parent Task's task-uuid and the com-uuid it answers; the new leader first aborts the Parent Task's Sub-Tasks, which it finds in the members' direct_execution_info, and it adopts or resumes none of them.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "response": {
          "$ref": "#/components/messages/WaraTaskResponse"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "taskSignal": {
      "address": "{agent-base-topic}/task/{task-id}/signal",
      "description": "A member hands a signal for a task it accepted as ingress to the elected Swarm Leader. Signals for assigned tasks are forwarded to the selected executor on its internal task-command topic. An abort removes a queued task immediately; pause, continue, and enough before assignment receive a failed response and are not retained for later execution. A signal for a Parent Task (a move-to with params.agent-count above 1) acts on every Sub-Task of it that is still alive, the leader forwarding it to each executor under that Sub-Task's task-uuid and a new com-uuid: abort aborts every Sub-Task and ends the Parent Task aborted, pause and continue apply to every running one so the Parent Task is paused only when every unfinished, non-superseded Sub-Task is paused (a failed Sub-Task that has been replaced is superseded), and enough finishes every Sub-Task and with them the Parent Task. A Sub-Task that has already ended is left alone. A signal sent to a single Sub-Task's task-uuid, to the leader or to its executor, is rejected with a failed response with fail-reason 'inactive task' and changes nothing. Before the Parent Task's commit, the rules for a task not yet assigned apply to it: abort closes the allocation, releases every held Sub-Task and ends the Parent Task aborted, and pause, continue and enough receive a failed response with fail-reason 'signal not applicable before assignment'.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "signal": {
          "$ref": "#/components/messages/SwarmTaskSignal"
        }
      },
      "parameters": {
        "task-id": {
          "$ref": "#/components/parameters/task-id"
        },
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "taskFeedback": {
      "address": "{agent-base-topic}/exec/feedback",
      "description": "The Swarm Leader relays the selected executor's official WARA-PS task feedback on the Swarm Unit's own execution boundary. A pending-capacity rejection is also reported with status failed, fail-reason 'pending task capacity exceeded', and the original task and command identifiers. A command received during Leader Warm-up is likewise reported with status failed and fail-reason 'leader warming up'. Aborting a queued task publishes the established aborted feedback without announcing or assigning it. A refused Swarm Move is likewise reported with status failed and fail-reason 'no formation' or 'task-already-running'. A refused agent-count is likewise reported with status failed and fail-reason 'invalid-agent-count', 'agent-count-unsupported', 'insufficient-agents' or 'area-too-small'.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "feedback": {
          "$ref": "#/components/messages/WaraTaskFeedback"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "memberTaskIngress": {
      "address": "{agent-base-topic}/exec/command",
      "description": "A move-to or search-area sent to an admitted member is handed unchanged to the Swarm Unit for delegation, including an optional boolean params.swarm (see SwarmFlag). If the member observes no Swarm Leader, it immediately fails the command on this member's execution boundary with fail-reason 'no swarm leader'. A move-to with params.swarm true (a Swarm Move, flown by the Swarm Leader for the whole Swarm) is also failed on this member's execution boundary, mirroring the Swarm Unit, with fail-reason 'no formation' when the formation is none, or 'task-already-running' when another Swarm Move is active. A command with an invalid params.agent-count, or one combined with params.swarm true, is failed on this member's execution boundary with fail-reason 'invalid-agent-count', one with an agent-count above one for a task type that gives it no meaning with 'agent-count-unsupported', and one asking for more Agents than the Swarm roster holds, or above one on a standalone or not-yet-admitted Agent, with 'insufficient-agents', and a search-area asking for more Agents than its area has lawnmower tracks with 'area-too-small'; none is handed to the Swarm Unit.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "command": {
          "$ref": "#/components/messages/WaraMoveToCommand"
        },
        "searchArea": {
          "$ref": "#/components/messages/WaraSearchAreaCommand"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "memberTaskSignal": {
      "address": "{agent-base-topic}/exec/command",
      "description": "A signal-task for a task previously handed to the Swarm Unit is sent to the addressed member, which forwards it to the Swarm Unit's task-specific signal topic.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "signal": {
          "$ref": "#/components/messages/WaraTaskSignal"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "executorTaskCommand": {
      "address": "{agent-base-topic}/exec/command",
      "description": "The selected executor receives the task assignment or forwarded signal on its own exec/command. The Swarm Leader sets the command's sender to its own agent-id and leaves every other field unchanged. An admitted member flies a start-task, or applies a signal-task, whose sender is the elected Swarm Leader's agent-id locally; it hands any other sender's start-task to the Swarm Unit as member task ingress, and handles any other sender's signal-task as a direct signal, so an assignment is never rebroadcast as new ingress. The sender is any non-empty string; a command without a sender is ingress. A start-task still needs the executor's matching bid reservation and otherwise fails with 'inactive task', whoever published it; a signal-task from any publisher whose sender equals the elected Swarm Leader's agent-id is applied as a forwarded signal, because the bus does not authenticate publishers. A command naming another agent-id is ignored. The executor fails a command on its own execution boundary with fail-reason 'parsing error', 'invalid task payload', 'task-already-running', 'inactive task' or 'unsupported signal'.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "startTask": {
          "$ref": "#/components/messages/WaraMoveToCommand"
        },
        "searchArea": {
          "$ref": "#/components/messages/WaraSearchAreaCommand"
        },
        "signal": {
          "$ref": "#/components/messages/WaraTaskSignal"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "memberTaskResponse": {
      "address": "{agent-base-topic}/exec/response",
      "description": "The addressed member mirrors the Swarm Unit's task response on its own execution boundary unless it is the selected executor, which already publishes its lifecycle there.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "response": {
          "$ref": "#/components/messages/WaraTaskResponse"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "memberTaskFeedback": {
      "address": "{agent-base-topic}/exec/feedback",
      "description": "The addressed member mirrors the Swarm Unit's task feedback on its own execution boundary unless it is the selected executor, which already publishes its lifecycle there.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "feedback": {
          "$ref": "#/components/messages/WaraTaskFeedback"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "swarmIntentCommand": {
      "address": "{agent-base-topic}/exec/command",
      "description": "An operator submits a standard start-task envelope whose task name is set-swarm-intent to the Agent's own exec/command. A non-empty swarm-id founds or joins that Swarm; an empty swarm-id is a graceful Departure.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "command": {
          "$ref": "#/components/messages/SetSwarmIntentCommand"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "swarmIntentResponse": {
      "address": "{agent-base-topic}/exec/response",
      "description": "The Agent answers its set-swarm-intent task on its own execution boundary using the standard task response correlated by task-uuid. A failed response explains immediate intent rejection; accepted tasks report running.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "response": {
          "$ref": "#/components/messages/SetSwarmIntentResponse"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "swarmIntentFeedback": {
      "address": "{agent-base-topic}/exec/feedback",
      "description": "The Agent reports set-swarm-intent progress on its own execution boundary, correlated by task-uuid. Feedback is running while Applicant and finishes when the founder wins Election, the joiner appears in the authoritative Roster, or Departure clears its Swarm Membership Sensor. Admission rejection reports failed and preserves fail-reason.",
      "bindings": {
        "$ref": "#/components/channelBindings/SwarmMqttSettings"
      },
      "messages": {
        "feedback": {
          "$ref": "#/components/messages/SetSwarmIntentFeedback"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "agentSwarmMembership": {
      "address": "{agent-base-topic}/sensor/swarm_membership",
      "description": "The Agent's current Swarm intent and role, published as a sensor. Only the elected Swarm Leader subscribes to this topic across all agents (peer wildcard +/sensor/swarm_membership); members do not. Members may mix vehicle types (air, ground, surface), so the wildcard also matches the vehicle-type level. The shared AvailableSensors enum includes swarm_membership for Agent sensor_info declarations.",
      "bindings": {
        "$ref": "#/components/channelBindings/PresenceMqttSettings"
      },
      "messages": {
        "membership": {
          "$ref": "#/components/messages/SwarmMembershipSensor"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "agentSensorInfo": {
      "address": "{agent-base-topic}/sensor_info",
      "description": "The Agent declares position, speed, course, heading, energy_level, waypoints and swarm_membership. The leader reads it through the peer wildcard +/sensor_info to judge admission eligibility. Members may mix vehicle types (air, ground, surface).",
      "bindings": {
        "$ref": "#/components/channelBindings/PresenceMqttSettings"
      },
      "messages": {
        "sensorInfo": {
          "$ref": "#/components/messages/SwarmSensorInfo"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "agentDirectExecutionInfo": {
      "address": "{agent-base-topic}/direct_execution_info",
      "description": "The Agent publishes the tasks it supports, with their signals, in tasks-available, and lists its executing tasks in tasks-executing with task-status (planning, running or paused) and, except while planning, task-ttf; an idle Agent publishes an empty list. The message is also published immediately when an executing task is added, removed or changes status. A Sub-Task lists its parent-task-uuid and parent-com-uuid. Only the elected Swarm Leader subscribes to it across all agents (peer wildcard +/direct_execution_info) to build the Swarm Unit's tasks-executing; members do not.",
      "bindings": {
        "$ref": "#/components/channelBindings/PresenceMqttSettings"
      },
      "messages": {
        "directExecutionInfo": {
          "$ref": "#/components/messages/AgentDirectExecutionInfo"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "swarmUnitHeartbeat": {
      "address": "{agent-base-topic}/heartbeat",
      "description": "The elected Swarm Leader publishes the Swarm Unit's virtual WARA-PS identity: agent-type virtual, agent-model swarm-unit-v1, agent-uuid equal to the swarm-id, levels sensor and direct execution. Its freshness is the Swarm Unit's liveness.",
      "bindings": {
        "$ref": "#/components/channelBindings/PresenceMqttSettings"
      },
      "messages": {
        "heartbeat": {
          "$ref": "./waraps-api-declarations.json#/components/messages/HeartbeatMessage"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "swarmUnitSensorInfo": {
      "address": "{agent-base-topic}/sensor_info",
      "description": "The elected Swarm Leader declares the Swarm Unit sensors election, members, formation, reference and task. The leader sensor is published but not declared.",
      "bindings": {
        "$ref": "#/components/channelBindings/PresenceMqttSettings"
      },
      "messages": {
        "sensorInfo": {
          "$ref": "#/components/messages/SwarmSensorInfo"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    },
    "swarmUnitDirectExecutionInfo": {
      "address": "{agent-base-topic}/direct_execution_info",
      "description": "The elected Swarm Leader publishes the tasks the Swarm Unit can do, which depend on the tasks its current members support. tasks-executing is required and lists every member's executing tasks (the leader's own included), taken from each member's own direct_execution_info, which the leader subscribes to while it leads, with that member's real task-name, task-status and task-ttf (a member not yet heard after a leadership change lists nothing until it is) plus the Swarm Unit's own set-swarm-intent, each item carrying task-name, task-uuid, task-status, optional task-ttf and a required agent naming the member that runs it; the agent field is a swarm-only exception to the WARA-PS spec.",
      "bindings": {
        "$ref": "#/components/channelBindings/PresenceMqttSettings"
      },
      "messages": {
        "directExecutionInfo": {
          "$ref": "#/components/messages/SwarmDirectExecutionInfo"
        }
      },
      "parameters": {
        "agent-base-topic": {
          "$ref": "#/components/parameters/agent-base-topic"
        }
      }
    }
  },
  "operations": {
    "sendAdmissionCommand": {
      "action": "send",
      "title": "Sends admission command",
      "channel": {
        "$ref": "#/channels/admissionCommand"
      },
      "summary": "Sends admission command (role: applicant)",
      "tags": [
        {
          "name": "applicant"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/admissionCommand/messages/request"
        }
      ]
    },
    "receiveAdmissionCommand": {
      "action": "receive",
      "title": "Receives admission command",
      "channel": {
        "$ref": "#/channels/admissionCommand"
      },
      "summary": "Receives admission command (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/admissionCommand/messages/request"
        }
      ]
    },
    "sendAdmissionResponse": {
      "action": "send",
      "title": "Sends admission response",
      "channel": {
        "$ref": "#/channels/admissionResponse"
      },
      "summary": "Sends admission response (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/admissionResponse/messages/invite"
        },
        {
          "$ref": "#/channels/admissionResponse/messages/reject"
        }
      ]
    },
    "receiveAdmissionResponse": {
      "action": "receive",
      "title": "Receives admission response",
      "channel": {
        "$ref": "#/channels/admissionResponse"
      },
      "summary": "Receives admission response (role: applicant)",
      "tags": [
        {
          "name": "applicant"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/admissionResponse/messages/invite"
        },
        {
          "$ref": "#/channels/admissionResponse/messages/reject"
        }
      ]
    },
    "sendElectionCandidate": {
      "action": "send",
      "title": "Sends election candidate",
      "channel": {
        "$ref": "#/channels/electionCandidate"
      },
      "summary": "Sends election candidate (role: member)",
      "tags": [
        {
          "name": "member"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/electionCandidate/messages/candidate"
        }
      ]
    },
    "receiveElectionCandidate": {
      "action": "receive",
      "title": "Receives election candidate",
      "channel": {
        "$ref": "#/channels/electionCandidate"
      },
      "summary": "Receives election candidate (role: member)",
      "tags": [
        {
          "name": "member"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/electionCandidate/messages/candidate"
        }
      ]
    },
    "sendElectionResult": {
      "action": "send",
      "title": "Sends election result",
      "channel": {
        "$ref": "#/channels/electionResult"
      },
      "summary": "Sends election result (role: member)",
      "tags": [
        {
          "name": "member"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/electionResult/messages/result"
        }
      ]
    },
    "receiveElectionResult": {
      "action": "receive",
      "title": "Receives election result",
      "channel": {
        "$ref": "#/channels/electionResult"
      },
      "summary": "Receives election result (role: member)",
      "tags": [
        {
          "name": "member"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/electionResult/messages/result"
        }
      ]
    },
    "sendRoster": {
      "action": "send",
      "title": "Sends roster",
      "channel": {
        "$ref": "#/channels/roster"
      },
      "summary": "Sends roster (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/roster/messages/roster"
        }
      ]
    },
    "receiveRoster": {
      "action": "receive",
      "title": "Receives roster",
      "channel": {
        "$ref": "#/channels/roster"
      },
      "summary": "Receives roster (role: member)",
      "tags": [
        {
          "name": "member"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/roster/messages/roster"
        }
      ]
    },
    "sendLeaderSignal": {
      "action": "send",
      "title": "Sends leader signal",
      "channel": {
        "$ref": "#/channels/leaderSignal"
      },
      "summary": "Sends leader signal (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/leaderSignal/messages/leader"
        }
      ]
    },
    "receiveLeaderSignal": {
      "action": "receive",
      "title": "Receives leader signal",
      "channel": {
        "$ref": "#/channels/leaderSignal"
      },
      "summary": "Receives leader signal (role: member)",
      "tags": [
        {
          "name": "member"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/leaderSignal/messages/leader"
        }
      ]
    },
    "receiveFormationCommand": {
      "action": "receive",
      "title": "Receives formation command",
      "channel": {
        "$ref": "#/channels/formationCommand"
      },
      "summary": "Receives formation command (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/formationCommand/messages/command"
        }
      ]
    },
    "sendFormationResponse": {
      "action": "send",
      "title": "Sends formation response",
      "channel": {
        "$ref": "#/channels/formationResponse"
      },
      "summary": "Sends formation response (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/formationResponse/messages/response"
        }
      ]
    },
    "sendFormationFeedback": {
      "action": "send",
      "title": "Sends formation feedback",
      "channel": {
        "$ref": "#/channels/formationFeedback"
      },
      "summary": "Sends formation feedback (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/formationFeedback/messages/feedback"
        }
      ]
    },
    "sendFormationState": {
      "action": "send",
      "title": "Sends formation state",
      "channel": {
        "$ref": "#/channels/formationState"
      },
      "summary": "Sends formation state (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/formationState/messages/state"
        }
      ]
    },
    "receiveFormationState": {
      "action": "receive",
      "title": "Receives formation state",
      "channel": {
        "$ref": "#/channels/formationState"
      },
      "summary": "Receives formation state (role: member)",
      "tags": [
        {
          "name": "member"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/formationState/messages/state"
        }
      ]
    },
    "sendFormationReference": {
      "action": "send",
      "title": "Sends formation reference",
      "channel": {
        "$ref": "#/channels/formationReference"
      },
      "summary": "Sends formation reference (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/formationReference/messages/reference"
        }
      ]
    },
    "receiveFormationReference": {
      "action": "receive",
      "title": "Receives formation reference",
      "channel": {
        "$ref": "#/channels/formationReference"
      },
      "summary": "Receives formation reference (role: member)",
      "tags": [
        {
          "name": "member"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/formationReference/messages/reference"
        }
      ]
    },
    "receiveTaskIngress": {
      "action": "receive",
      "title": "Receives task ingress",
      "channel": {
        "$ref": "#/channels/taskIngress"
      },
      "summary": "Receives task ingress (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/taskIngress/messages/command"
        },
        {
          "$ref": "#/channels/taskIngress/messages/searchArea"
        }
      ]
    },
    "sendTaskAnnouncement": {
      "action": "send",
      "title": "Sends task announcement",
      "channel": {
        "$ref": "#/channels/taskAnnouncement"
      },
      "summary": "Sends task announcement (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/taskAnnouncement/messages/announcement"
        }
      ]
    },
    "receiveTaskAnnouncement": {
      "action": "receive",
      "title": "Receives task announcement",
      "channel": {
        "$ref": "#/channels/taskAnnouncement"
      },
      "summary": "Receives task announcement (role: member)",
      "tags": [
        {
          "name": "member"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/taskAnnouncement/messages/announcement"
        }
      ]
    },
    "sendTaskBid": {
      "action": "send",
      "title": "Sends task bid",
      "channel": {
        "$ref": "#/channels/taskBid"
      },
      "summary": "Sends task bid (role: member)",
      "tags": [
        {
          "name": "member"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/taskBid/messages/bid"
        }
      ]
    },
    "receiveTaskBid": {
      "action": "receive",
      "title": "Receives task bid",
      "channel": {
        "$ref": "#/channels/taskBid"
      },
      "summary": "Receives task bid (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/taskBid/messages/bid"
        }
      ]
    },
    "sendTaskAssignment": {
      "action": "send",
      "title": "Sends task assignment",
      "channel": {
        "$ref": "#/channels/taskAssignment"
      },
      "summary": "Sends task assignment (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/taskAssignment/messages/assignment"
        }
      ]
    },
    "receiveTaskAssignment": {
      "action": "receive",
      "title": "Receives task assignment",
      "channel": {
        "$ref": "#/channels/taskAssignment"
      },
      "summary": "Receives task assignment (role: member)",
      "tags": [
        {
          "name": "member"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/taskAssignment/messages/assignment"
        }
      ]
    },
    "sendParentTaskDecision": {
      "action": "send",
      "title": "Sends parent task decision",
      "channel": {
        "$ref": "#/channels/parentTaskDecision"
      },
      "summary": "Sends the commit or release of a Parent Task's held Sub-Tasks (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/parentTaskDecision/messages/decision"
        }
      ]
    },
    "receiveParentTaskDecision": {
      "action": "receive",
      "title": "Receives parent task decision",
      "channel": {
        "$ref": "#/channels/parentTaskDecision"
      },
      "summary": "Receives the commit or release of a Parent Task's held Sub-Tasks (role: member)",
      "tags": [
        {
          "name": "member"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/parentTaskDecision/messages/decision"
        }
      ]
    },
    "sendTaskResponse": {
      "action": "send",
      "title": "Sends task response",
      "channel": {
        "$ref": "#/channels/taskResponse"
      },
      "summary": "Sends task response (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/taskResponse/messages/response"
        }
      ]
    },
    "sendTaskFeedback": {
      "action": "send",
      "title": "Sends task feedback",
      "channel": {
        "$ref": "#/channels/taskFeedback"
      },
      "summary": "Sends task feedback (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/taskFeedback/messages/feedback"
        }
      ]
    },
    "sendTaskSignal": {
      "action": "send",
      "title": "Sends task signal",
      "channel": {
        "$ref": "#/channels/taskSignal"
      },
      "summary": "Sends task signal (role: member)",
      "tags": [
        {
          "name": "member"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/taskSignal/messages/signal"
        }
      ]
    },
    "receiveTaskSignal": {
      "action": "receive",
      "title": "Receives task signal",
      "channel": {
        "$ref": "#/channels/taskSignal"
      },
      "summary": "Receives task signal (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/taskSignal/messages/signal"
        }
      ]
    },
    "receiveMemberTaskIngress": {
      "action": "receive",
      "title": "Receives member task ingress",
      "channel": {
        "$ref": "#/channels/memberTaskIngress"
      },
      "summary": "Receives member task ingress (role: member)",
      "tags": [
        {
          "name": "member"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/memberTaskIngress/messages/command"
        },
        {
          "$ref": "#/channels/memberTaskIngress/messages/searchArea"
        }
      ]
    },
    "receiveMemberTaskSignal": {
      "action": "receive",
      "title": "Receives member task signal",
      "channel": {
        "$ref": "#/channels/memberTaskSignal"
      },
      "summary": "Receives member task signal (role: member)",
      "tags": [
        {
          "name": "member"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/memberTaskSignal/messages/signal"
        }
      ]
    },
    "receiveExecutorTaskCommand": {
      "action": "receive",
      "title": "Receives executor task command",
      "channel": {
        "$ref": "#/channels/executorTaskCommand"
      },
      "summary": "Receives executor task command (role: executor)",
      "tags": [
        {
          "name": "executor"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/executorTaskCommand/messages/startTask"
        },
        {
          "$ref": "#/channels/executorTaskCommand/messages/searchArea"
        },
        {
          "$ref": "#/channels/executorTaskCommand/messages/signal"
        }
      ]
    },
    "sendMemberTaskResponse": {
      "action": "send",
      "title": "Sends member task response",
      "channel": {
        "$ref": "#/channels/memberTaskResponse"
      },
      "summary": "Sends member task response (role: member)",
      "tags": [
        {
          "name": "member"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/memberTaskResponse/messages/response"
        }
      ]
    },
    "sendMemberTaskFeedback": {
      "action": "send",
      "title": "Sends member task feedback",
      "channel": {
        "$ref": "#/channels/memberTaskFeedback"
      },
      "summary": "Sends member task feedback (role: member)",
      "tags": [
        {
          "name": "member"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/memberTaskFeedback/messages/feedback"
        }
      ]
    },
    "receiveSwarmIntentCommand": {
      "action": "receive",
      "title": "Receives swarm intent command",
      "channel": {
        "$ref": "#/channels/swarmIntentCommand"
      },
      "summary": "Receives swarm intent command (role: agent)",
      "tags": [
        {
          "name": "agent"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/swarmIntentCommand/messages/command"
        }
      ]
    },
    "sendSwarmIntentResponse": {
      "action": "send",
      "title": "Sends swarm intent response",
      "channel": {
        "$ref": "#/channels/swarmIntentResponse"
      },
      "summary": "Sends swarm intent response (role: agent)",
      "tags": [
        {
          "name": "agent"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/swarmIntentResponse/messages/response"
        }
      ]
    },
    "sendSwarmIntentFeedback": {
      "action": "send",
      "title": "Sends swarm intent feedback",
      "channel": {
        "$ref": "#/channels/swarmIntentFeedback"
      },
      "summary": "Sends swarm intent feedback (role: agent)",
      "tags": [
        {
          "name": "agent"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/swarmIntentFeedback/messages/feedback"
        }
      ]
    },
    "sendAgentSwarmMembership": {
      "action": "send",
      "title": "Sends agent swarm membership",
      "channel": {
        "$ref": "#/channels/agentSwarmMembership"
      },
      "summary": "Sends agent swarm membership (role: agent)",
      "tags": [
        {
          "name": "agent"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/agentSwarmMembership/messages/membership"
        }
      ]
    },
    "receiveAgentSwarmMembership": {
      "action": "receive",
      "title": "Receives agent swarm membership",
      "channel": {
        "$ref": "#/channels/agentSwarmMembership"
      },
      "summary": "Receives agent swarm membership (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/agentSwarmMembership/messages/membership"
        }
      ]
    },
    "sendAgentSensorInfo": {
      "action": "send",
      "title": "Sends agent sensor info",
      "channel": {
        "$ref": "#/channels/agentSensorInfo"
      },
      "summary": "Sends agent sensor info (role: agent)",
      "tags": [
        {
          "name": "agent"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/agentSensorInfo/messages/sensorInfo"
        }
      ]
    },
    "receiveAgentSensorInfo": {
      "action": "receive",
      "title": "Receives agent sensor info",
      "channel": {
        "$ref": "#/channels/agentSensorInfo"
      },
      "summary": "Receives agent sensor info (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/agentSensorInfo/messages/sensorInfo"
        }
      ]
    },
    "sendAgentDirectExecutionInfo": {
      "action": "send",
      "title": "Sends agent direct execution info",
      "channel": {
        "$ref": "#/channels/agentDirectExecutionInfo"
      },
      "summary": "Sends agent direct execution info (role: agent)",
      "tags": [
        {
          "name": "agent"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/agentDirectExecutionInfo/messages/directExecutionInfo"
        }
      ]
    },
    "receiveAgentDirectExecutionInfo": {
      "action": "receive",
      "title": "Receives agent direct execution info",
      "channel": {
        "$ref": "#/channels/agentDirectExecutionInfo"
      },
      "summary": "Receives agent direct execution info (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/agentDirectExecutionInfo/messages/directExecutionInfo"
        }
      ]
    },
    "sendSwarmUnitHeartbeat": {
      "action": "send",
      "title": "Sends swarm unit heartbeat",
      "channel": {
        "$ref": "#/channels/swarmUnitHeartbeat"
      },
      "summary": "Sends swarm unit heartbeat (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/swarmUnitHeartbeat/messages/heartbeat"
        }
      ]
    },
    "receiveSwarmUnitHeartbeat": {
      "action": "receive",
      "title": "Receives swarm unit heartbeat",
      "channel": {
        "$ref": "#/channels/swarmUnitHeartbeat"
      },
      "summary": "Receives swarm unit heartbeat (role: member)",
      "tags": [
        {
          "name": "member"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/swarmUnitHeartbeat/messages/heartbeat"
        }
      ]
    },
    "sendSwarmUnitSensorInfo": {
      "action": "send",
      "title": "Sends swarm unit sensor info",
      "channel": {
        "$ref": "#/channels/swarmUnitSensorInfo"
      },
      "summary": "Sends swarm unit sensor info (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/swarmUnitSensorInfo/messages/sensorInfo"
        }
      ]
    },
    "sendSwarmUnitDirectExecutionInfo": {
      "action": "send",
      "title": "Sends swarm unit direct execution info",
      "channel": {
        "$ref": "#/channels/swarmUnitDirectExecutionInfo"
      },
      "summary": "Sends swarm unit direct execution info (role: leader)",
      "tags": [
        {
          "name": "leader"
        }
      ],
      "messages": [
        {
          "$ref": "#/channels/swarmUnitDirectExecutionInfo/messages/directExecutionInfo"
        }
      ]
    }
  },
  "components": {
    "securitySchemes": {
      "tls": {
        "type": "X509",
        "x-securityScheme": "tls",
        "description": "TLS client certificate for secure connection"
      }
    },
    "parameters": {
      "task-id": {
        "description": "UUID of the task (task-uuid) that the topic belongs to. Format: UUID.",
        "examples": [
          "1a2b3c4d-5e6f-4789-9abc-def012345678"
        ]
      },
      "agent-base-topic": {
        "description": "Full WARA-PS AgentBaseTopic of the addressed unit: {organization}/{category}/{domain}/{real_sim}/{agent_name}, see the AgentBaseTopic schema in waraps-api-declarations.json. For Swarm Unit channels it is the Swarm Unit's own topic, waraps/unit/virtual/{real_sim}/Swarm-{swarm-id}, where the Swarm Unit's agent-uuid equals the swarm-id; for member channels it is that member's topic."
      }
    },
    "channelBindings": {
      "SwarmMqttSettings": {
        "mqtt": {
          "qos": 1,
          "retain": false
        }
      },
      "PresenceMqttSettings": {
        "mqtt": {
          "qos": 0,
          "retain": false
        }
      },
      "SwarmSensorMqttSettings": {
        "mqtt": {
          "qos": 1
        }
      }
    },
    "messages": {
      "AdmissionRequest": {
        "payload": {
          "$ref": "#/components/schemas/AdmissionRequest"
        }
      },
      "AdmissionInvite": {
        "payload": {
          "$ref": "#/components/schemas/AdmissionInvite"
        }
      },
      "AdmissionReject": {
        "payload": {
          "$ref": "#/components/schemas/AdmissionReject"
        }
      },
      "ElectionCandidate": {
        "payload": {
          "$ref": "#/components/schemas/ElectionCandidate"
        }
      },
      "ElectionResult": {
        "payload": {
          "$ref": "#/components/schemas/ElectionResult"
        }
      },
      "SwarmRoster": {
        "payload": {
          "$ref": "#/components/schemas/SwarmRoster"
        }
      },
      "LeaderSignal": {
        "payload": {
          "$ref": "#/components/schemas/LeaderSignal"
        }
      },
      "SetFormationTaskCommand": {
        "payload": {
          "$ref": "#/components/schemas/SetFormationTaskCommand"
        }
      },
      "FormationState": {
        "payload": {
          "$ref": "#/components/schemas/FormationState"
        }
      },
      "FormationReference": {
        "payload": {
          "$ref": "#/components/schemas/FormationReference"
        }
      },
      "WaraMoveToCommand": {
        "payload": {
          "$ref": "#/components/schemas/WaraMoveToCommand"
        }
      },
      "WaraSearchAreaCommand": {
        "payload": {
          "$ref": "#/components/schemas/WaraSearchAreaCommand"
        }
      },
      "TaskAnnouncement": {
        "payload": {
          "$ref": "#/components/schemas/TaskAnnouncement"
        },
        "examples": [
          {
            "name": "Sub-Task announcement",
            "summary": "The first Sub-Task of a Parent Task with agent-count 2",
            "payload": {
              "swarm-id": "2d5082f9-3dca-498c-9157-f152456f9179",
              "task-id": "7d1c2b3a-4e5f-4a69-8b7c-0d1e2f3a4b5c",
              "leader-id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
              "parent-task-id": "1a2b3c4d-5e6f-4789-9abc-def012345678",
              "agent-count": 2,
              "command": {
                "com-uuid": "9c8b7a6f-5e4d-4c3b-9a19-8f7e6d5c4b3a",
                "task-uuid": "7d1c2b3a-4e5f-4a69-8b7c-0d1e2f3a4b5c",
                "parent-task-uuid": "1a2b3c4d-5e6f-4789-9abc-def012345678",
                "parent-com-uuid": "5f3e2c1a-8b7d-4e6f-9a1b-2c3d4e5f6789",
                "command": "start-task",
                "execution-unit": "Swarm-2d5082f9-3dca-498c-9157-f152456f9179",
                "sender": "commander",
                "task": {
                  "name": "move-to",
                  "params": {
                    "waypoint": {
                      "latitude": 57.7611363,
                      "longitude": 16.6805011,
                      "altitude": 47.81
                    },
                    "speed": "standard",
                    "agent-count": 2
                  }
                }
              }
            }
          }
        ]
      },
      "TaskBid": {
        "payload": {
          "$ref": "#/components/schemas/TaskBid"
        }
      },
      "TaskAssignment": {
        "payload": {
          "$ref": "#/components/schemas/TaskAssignment"
        }
      },
      "ParentTaskDecision": {
        "payload": {
          "$ref": "#/components/schemas/ParentTaskDecision"
        },
        "examples": [
          {
            "name": "Commit",
            "summary": "Every Sub-Task is held; the held Sub-Tasks are released to run",
            "payload": {
              "swarm-id": "2d5082f9-3dca-498c-9157-f152456f9179",
              "parent-task-id": "1a2b3c4d-5e6f-4789-9abc-def012345678",
              "leader-id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
              "decision": "commit"
            }
          },
          {
            "name": "Release",
            "summary": "The Parent Round failed; every held Sub-Task is dropped",
            "payload": {
              "swarm-id": "2d5082f9-3dca-498c-9157-f152456f9179",
              "parent-task-id": "1a2b3c4d-5e6f-4789-9abc-def012345678",
              "leader-id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
              "decision": "release"
            }
          }
        ]
      },
      "WaraTaskResponse": {
        "payload": {
          "$ref": "#/components/schemas/WaraTaskResponse"
        },
        "examples": [
          {
            "name": "Parent Task running",
            "summary": "Relayed on the first accepted Sub-Task, listing the Sub-Tasks created so far",
            "payload": {
              "agent-uuid": "2d5082f9-3dca-498c-9157-f152456f9179",
              "com-uuid": "5f3e2c1a-8b7d-4e6f-9a1b-2c3d4e5f6789",
              "task-uuid": "1a2b3c4d-5e6f-4789-9abc-def012345678",
              "response": "running",
              "sub-task-uuids": [
                "7d1c2b3a-4e5f-4a69-8b7c-0d1e2f3a4b5c",
                "8e2d3c4b-5f60-4b7a-9c8d-1e2f3a4b5c6d"
              ]
            }
          },
          {
            "name": "Parent Task failed",
            "summary": "Too few Agents for agent-count",
            "payload": {
              "agent-uuid": "2d5082f9-3dca-498c-9157-f152456f9179",
              "com-uuid": "5f3e2c1a-8b7d-4e6f-9a1b-2c3d4e5f6789",
              "task-uuid": "1a2b3c4d-5e6f-4789-9abc-def012345678",
              "response": "failed",
              "response-to": "5f3e2c1a-8b7d-4e6f-9a1b-2c3d4e5f6789",
              "fail-reason": "insufficient-agents"
            }
          },
          {
            "name": "Parent Task failed on a Sub-Task",
            "summary": "A replacement Sub-Task failed too; failed-sub-task-uuid names it",
            "payload": {
              "agent-uuid": "2d5082f9-3dca-498c-9157-f152456f9179",
              "com-uuid": "5f3e2c1a-8b7d-4e6f-9a1b-2c3d4e5f6789",
              "task-uuid": "1a2b3c4d-5e6f-4789-9abc-def012345678",
              "response": "failed",
              "response-to": "5f3e2c1a-8b7d-4e6f-9a1b-2c3d4e5f6789",
              "fail-reason": "executor refused",
              "sub-task-uuids": [
                "7d1c2b3a-4e5f-4a69-8b7c-0d1e2f3a4b5c",
                "8e2d3c4b-5f60-4b7a-9c8d-1e2f3a4b5c6d"
              ],
              "failed-sub-task-uuid": "8e2d3c4b-5f60-4b7a-9c8d-1e2f3a4b5c6d"
            }
          }
        ]
      },
      "WaraTaskFeedback": {
        "payload": {
          "$ref": "#/components/schemas/WaraTaskFeedback"
        }
      },
      "TaskIngressCapacityFailureResponse": {
        "payload": {
          "$ref": "#/components/schemas/TaskIngressCapacityFailureResponse"
        }
      },
      "TaskIngressCapacityFailureFeedback": {
        "payload": {
          "$ref": "#/components/schemas/TaskIngressCapacityFailureFeedback"
        }
      },
      "TaskIngressWarmUpFailureResponse": {
        "payload": {
          "$ref": "#/components/schemas/TaskIngressWarmUpFailureResponse"
        }
      },
      "TaskIngressWarmUpFailureFeedback": {
        "payload": {
          "$ref": "#/components/schemas/TaskIngressWarmUpFailureFeedback"
        }
      },
      "WaraTaskSignal": {
        "payload": {
          "$ref": "#/components/schemas/WaraTaskSignal"
        }
      },
      "SwarmTaskSignal": {
        "payload": {
          "$ref": "#/components/schemas/SwarmTaskSignal"
        }
      },
      "SetSwarmIntentCommand": {
        "name": "set-swarm-intent",
        "title": "Set swarm intent",
        "summary": "Found, join or leave a Swarm at runtime",
        "description": "Command that sets or clears the addressed Agent's Swarm intent without restarting it. Sent as a standard start-task to the Agent's own exec/command. A non-empty swarm-id founds the Swarm (the Agent is its first Election candidate) or joins it if it exists; there is no separate create or join command. An empty swarm-id is a graceful Departure. The Agent answers once on exec/response, then reports progress on exec/feedback. The task has no signals and is listed in tasks-executing until it finishes or fails, with task-ttf omitted during planning and set to -1 while running.",
        "contentType": "application/json",
        "payload": {
          "$ref": "#/components/schemas/SetSwarmIntentCommand"
        },
        "examples": [
          {
            "name": "Found or join a Swarm",
            "summary": "A non-empty swarm-id sets the intent; the Agent then applies for Admission",
            "payload": {
              "com-uuid": "5f3e2c1a-8b7d-4e6f-9a1b-2c3d4e5f6789",
              "task-uuid": "1a2b3c4d-5e6f-4789-9abc-def012345678",
              "command": "start-task",
              "execution-unit": "SimUSV1",
              "sender": "operator",
              "task": {
                "name": "set-swarm-intent",
                "params": {
                  "swarm-id": "2d5082f9-3dca-498c-9157-f152456f9179"
                }
              }
            }
          },
          {
            "name": "Found a named Swarm",
            "summary": "swarm-name is only used when founding; later leaders carry it on the roster",
            "payload": {
              "com-uuid": "5f3e2c1a-8b7d-4e6f-9a1b-2c3d4e5f6789",
              "task-uuid": "1a2b3c4d-5e6f-4789-9abc-def012345678",
              "command": "start-task",
              "execution-unit": "SimUSV1",
              "sender": "operator",
              "task": {
                "name": "set-swarm-intent",
                "params": {
                  "swarm-id": "2d5082f9-3dca-498c-9157-f152456f9179",
                  "swarm-name": "Harbour patrol"
                }
              }
            }
          },
          {
            "name": "Leave the Swarm (Departure)",
            "summary": "An empty swarm-id clears the intent and republishes the membership sensor at once",
            "payload": {
              "com-uuid": "5f3e2c1a-8b7d-4e6f-9a1b-2c3d4e5f6789",
              "task-uuid": "1a2b3c4d-5e6f-4789-9abc-def012345678",
              "command": "start-task",
              "execution-unit": "SimUSV1",
              "sender": "operator",
              "task": {
                "name": "set-swarm-intent",
                "params": {
                  "swarm-id": ""
                }
              }
            }
          }
        ]
      },
      "SetSwarmIntentResponse": {
        "name": "response",
        "title": "Set swarm intent response",
        "summary": "Immediate answer to set-swarm-intent",
        "description": "Exactly one standard task response per set-swarm-intent, correlated by task-uuid. running means the intent was accepted; the outcome follows as feedback. failed means the intent was rejected immediately and carries fail-reason: 'invalid swarm-id' when swarm-id is neither a UUID nor empty (or execution-unit does not match the Agent), and 'swarm intent already set for swarm <id>' when the Agent already holds intent for a different Swarm (leave it first with an empty swarm-id). Repeating the same swarm-id is accepted and keeps the current state.",
        "contentType": "application/json",
        "payload": {
          "$ref": "#/components/schemas/WaraTaskResponse"
        },
        "examples": [
          {
            "name": "Accepted, now running",
            "summary": "Intent accepted",
            "payload": {
              "agent-uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
              "com-uuid": "5f3e2c1a-8b7d-4e6f-9a1b-2c3d4e5f6789",
              "task-uuid": "1a2b3c4d-5e6f-4789-9abc-def012345678",
              "response": "running"
            }
          },
          {
            "name": "Rejected, invalid swarm-id",
            "summary": "swarm-id is not a UUID",
            "payload": {
              "agent-uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
              "com-uuid": "5f3e2c1a-8b7d-4e6f-9a1b-2c3d4e5f6789",
              "task-uuid": "1a2b3c4d-5e6f-4789-9abc-def012345678",
              "response": "failed",
              "response-to": "5f3e2c1a-8b7d-4e6f-9a1b-2c3d4e5f6789",
              "fail-reason": "invalid swarm-id"
            }
          },
          {
            "name": "Rejected, other Swarm",
            "summary": "The Agent already holds intent for another Swarm",
            "payload": {
              "agent-uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
              "com-uuid": "5f3e2c1a-8b7d-4e6f-9a1b-2c3d4e5f6789",
              "task-uuid": "1a2b3c4d-5e6f-4789-9abc-def012345678",
              "response": "failed",
              "response-to": "5f3e2c1a-8b7d-4e6f-9a1b-2c3d4e5f6789",
              "fail-reason": "swarm intent already set for swarm 7c9e6679-7425-40de-944b-e07fc1f90ae7"
            }
          }
        ]
      },
      "SetSwarmIntentFeedback": {
        "name": "feedback",
        "title": "Set swarm intent feedback",
        "summary": "Progress of set-swarm-intent",
        "description": "Task feedback for an accepted set-swarm-intent, correlated by task-uuid. running while the Agent is an Applicant. finished when the founder wins Election, when the joiner appears in the authoritative Swarm Roster, or when a Departure has cleared the Swarm Membership Sensor. failed when Admission is rejected; the leader's fail-reason is preserved. While executing the task is listed in tasks-executing as planning, then running, with task-ttf -1.",
        "contentType": "application/json",
        "payload": {
          "$ref": "#/components/schemas/WaraTaskFeedback"
        },
        "examples": [
          {
            "name": "Applying for Admission",
            "summary": "The Agent holds intent and waits for the Swarm Leader",
            "payload": {
              "agent-uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
              "com-uuid": "5f3e2c1a-8b7d-4e6f-9a1b-2c3d4e5f6789",
              "task-uuid": "1a2b3c4d-5e6f-4789-9abc-def012345678",
              "status": "running"
            }
          },
          {
            "name": "Admitted",
            "summary": "The Agent is in the Swarm Roster",
            "payload": {
              "agent-uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
              "com-uuid": "5f3e2c1a-8b7d-4e6f-9a1b-2c3d4e5f6789",
              "task-uuid": "1a2b3c4d-5e6f-4789-9abc-def012345678",
              "status": "finished"
            }
          },
          {
            "name": "Admission rejected",
            "summary": "The Swarm Leader rejected the application",
            "payload": {
              "agent-uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
              "com-uuid": "5f3e2c1a-8b7d-4e6f-9a1b-2c3d4e5f6789",
              "task-uuid": "1a2b3c4d-5e6f-4789-9abc-def012345678",
              "status": "failed",
              "fail-reason": "missing-position-sensor"
            }
          }
        ]
      },
      "SwarmMembershipSensor": {
        "payload": {
          "$ref": "#/components/schemas/SwarmMembershipSensor"
        }
      },
      "SwarmSensorInfo": {
        "payload": {
          "$ref": "#/components/schemas/SwarmSensorInfo"
        }
      },
      "SwarmDirectExecutionInfo": {
        "payload": {
          "$ref": "#/components/schemas/SwarmDirectExecutionInfo"
        }
      },
      "AgentDirectExecutionInfo": {
        "payload": {
          "$ref": "#/components/schemas/AgentDirectExecutionInfo"
        }
      }
    },
    "schemas": {
      "AgentId": {
        "type": "string",
        "format": "uuid"
      },
      "SwarmId": {
        "type": "string",
        "format": "uuid"
      },
      "TaskId": {
        "type": "string",
        "format": "uuid"
      },
      "AgentBaseTopic": {
        "type": "string",
        "description": "The exact WARA-PS AgentBaseTopic used to reach one member's standard declarations, sensors, and task execution topics."
      },
      "AgentSensorName": {
        "type": "string",
        "enum": [
          "position",
          "speed",
          "heading",
          "course",
          "battery_status",
          "energy_level",
          "waypoints",
          "control_system_version",
          "cargo",
          "armable",
          "mode",
          "state",
          "ip_address",
          "videoserver_url",
          "swarm_membership",
          "election",
          "members",
          "formation",
          "reference",
          "task"
        ]
      },
      "SwarmSensorInfo": {
        "type": "object",
        "required": [
          "sensor-data-provided",
          "name",
          "rate",
          "stamp",
          "type"
        ],
        "properties": {
          "sensor-data-provided": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentSensorName"
            }
          },
          "name": {
            "type": "string"
          },
          "rate": {
            "type": "number"
          },
          "stamp": {
            "type": "number"
          },
          "type": {
            "const": "SensorInfo"
          }
        }
      },
      "AgentDirectExecutionInfo": {
        "type": "object",
        "required": [
          "tasks-available",
          "tasks-executing",
          "name",
          "rate",
          "stamp",
          "type"
        ],
        "properties": {
          "tasks-available": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "$ref": "./waraps-api-declarations.json#/components/schemas/AvailableTasks"
                },
                "signals": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "$abort",
                      "$enough",
                      "$pause",
                      "$continue"
                    ]
                  }
                }
              }
            }
          },
          "tasks-executing": {
            "type": "array",
            "description": "The tasks this Agent executes. Same item shape as the WARA-PS Direct Execution Info (declarations spec), plus the swarm-only parent-task-uuid and parent-com-uuid on a Sub-Task. Validating tasks are not listed; finished, aborted and failed tasks are removed. Empty when no task executes.",
            "items": {
              "allOf": [
                {
                  "$ref": "./waraps-api-declarations.json#/components/schemas/ExecutingTask"
                },
                {
                  "type": "object",
                  "properties": {
                    "parent-task-uuid": {
                      "$ref": "#/components/schemas/TaskId",
                      "description": "Only on a Sub-Task: the uuid of its Parent Task. Always given together with parent-com-uuid. A new Swarm Leader reads it from the members' own declarations to find the committed Sub-Tasks a lost leader left behind. Swarm-only field, not part of the WARA-PS spec."
                    },
                    "parent-com-uuid": {
                      "$ref": "#/components/schemas/TaskId",
                      "description": "Only on a Sub-Task: the com-uuid of the command its Parent Task answers. Swarm-only field, not part of the WARA-PS spec."
                    }
                  }
                }
              ]
            }
          },
          "name": {
            "type": "string"
          },
          "rate": {
            "type": "number"
          },
          "stamp": {
            "type": "number"
          },
          "type": {
            "const": "DirectExecutionInfo"
          }
        }
      },
      "SwarmDirectExecutionInfo": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AgentDirectExecutionInfo"
          },
          {
            "type": "object",
            "properties": {
              "tasks-executing": {
                "description": "Every member's executing tasks, the leader's own included, plus the Swarm Unit's own set-swarm-intent. Same item shape as a member's own Direct Execution Info plus a required agent field naming the member that runs the task; the agent field is a swarm-only exception to the WARA-PS spec. Validating tasks are not listed; finished, aborted and failed tasks are removed. Empty when no task executes.",
                "items": {
                  "type": "object",
                  "required": [
                    "agent"
                  ],
                  "properties": {
                    "agent": {
                      "$ref": "#/components/schemas/AgentId",
                      "description": "ID of the member that runs the task; for the Swarm Unit's own set-swarm-intent, the leader; for a Swarm Move (move-to with params.swarm true), the Swarm Unit itself, listed once with the leader's remaining flight time as task-ttf, then -1 while the Swarm re-forms. Swarm-only field, not part of the WARA-PS spec."
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "SwarmMembershipSensor": {
        "type": "object",
        "required": [
          "swarm-id",
          "role"
        ],
        "properties": {
          "swarm-id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ]
          },
          "role": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "leader",
                  "member"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "swarm-name": {
            "type": "string",
            "maxLength": 64,
            "description": "Optional human-readable Swarm name, present while the Agent holds intent for a named Swarm."
          }
        }
      },
      "GeoPoint": {
        "type": "object",
        "required": [
          "latitude",
          "longitude",
          "altitude"
        ],
        "properties": {
          "latitude": {
            "type": "number"
          },
          "longitude": {
            "type": "number"
          },
          "altitude": {
            "type": "number"
          }
        }
      },
      "AdmissionRequest": {
        "type": "object",
        "required": [
          "com-uuid",
          "command",
          "execution-unit",
          "sender",
          "swarm-id",
          "agent-id",
          "agent-base-topic"
        ],
        "properties": {
          "com-uuid": {
            "type": "string",
            "format": "uuid"
          },
          "command": {
            "const": "admission-request"
          },
          "execution-unit": {
            "type": "string"
          },
          "sender": {
            "$ref": "#/components/schemas/AgentId"
          },
          "swarm-id": {
            "$ref": "#/components/schemas/SwarmId"
          },
          "agent-id": {
            "$ref": "#/components/schemas/AgentId"
          },
          "agent-base-topic": {
            "$ref": "#/components/schemas/AgentBaseTopic"
          }
        }
      },
      "AdmissionInvite": {
        "type": "object",
        "required": [
          "agent-uuid",
          "com-uuid",
          "response-to",
          "response",
          "swarm-id",
          "agent-id",
          "agent-base-topic",
          "leader-id"
        ],
        "properties": {
          "agent-uuid": {
            "$ref": "#/components/schemas/AgentId"
          },
          "com-uuid": {
            "type": "string",
            "format": "uuid"
          },
          "response-to": {
            "type": "string",
            "format": "uuid"
          },
          "response": {
            "const": "invite"
          },
          "swarm-id": {
            "$ref": "#/components/schemas/SwarmId"
          },
          "agent-id": {
            "$ref": "#/components/schemas/AgentId"
          },
          "agent-base-topic": {
            "$ref": "#/components/schemas/AgentBaseTopic"
          },
          "leader-id": {
            "$ref": "#/components/schemas/AgentId"
          }
        }
      },
      "AdmissionReject": {
        "type": "object",
        "required": [
          "agent-uuid",
          "com-uuid",
          "response-to",
          "response",
          "swarm-id",
          "agent-id",
          "fail-reason"
        ],
        "properties": {
          "agent-uuid": {
            "$ref": "#/components/schemas/AgentId"
          },
          "com-uuid": {
            "type": "string",
            "format": "uuid"
          },
          "response-to": {
            "type": "string",
            "format": "uuid"
          },
          "response": {
            "const": "reject"
          },
          "swarm-id": {
            "$ref": "#/components/schemas/SwarmId"
          },
          "agent-id": {
            "$ref": "#/components/schemas/AgentId"
          },
          "fail-reason": {
            "type": "string",
            "description": "Machine-readable rejection code such as missing-position-sensor or missing-energy_level-sensor."
          }
        }
      },
      "ElectionCandidate": {
        "type": "object",
        "required": [
          "swarm-id",
          "agent-id",
          "election-round"
        ],
        "properties": {
          "swarm-id": {
            "$ref": "#/components/schemas/SwarmId"
          },
          "agent-id": {
            "$ref": "#/components/schemas/AgentId"
          },
          "election-round": {
            "type": "integer",
            "minimum": 1
          },
          "can-lead": {
            "type": "boolean"
          }
        }
      },
      "ElectionResult": {
        "type": "object",
        "required": [
          "swarm-id",
          "leader-id",
          "election-round"
        ],
        "properties": {
          "swarm-id": {
            "$ref": "#/components/schemas/SwarmId"
          },
          "leader-id": {
            "$ref": "#/components/schemas/AgentId"
          },
          "election-round": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "RosterEntry": {
        "type": "object",
        "required": [
          "agent-id",
          "agent-base-topic",
          "role"
        ],
        "properties": {
          "agent-id": {
            "$ref": "#/components/schemas/AgentId"
          },
          "agent-base-topic": {
            "$ref": "#/components/schemas/AgentBaseTopic"
          },
          "role": {
            "type": "string",
            "enum": [
              "leader",
              "member"
            ]
          }
        }
      },
      "SwarmRoster": {
        "type": "object",
        "required": [
          "swarm-id",
          "leader-id",
          "members"
        ],
        "properties": {
          "swarm-id": {
            "$ref": "#/components/schemas/SwarmId"
          },
          "leader-id": {
            "$ref": "#/components/schemas/AgentId"
          },
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RosterEntry"
            }
          },
          "swarm-name": {
            "type": "string",
            "maxLength": 64,
            "description": "Optional human-readable Swarm name, set by the founding set-swarm-intent task."
          }
        }
      },
      "LeaderSignal": {
        "type": "object",
        "required": [
          "leader-id",
          "leader-base-topic",
          "since"
        ],
        "properties": {
          "leader-id": {
            "$ref": "#/components/schemas/AgentId"
          },
          "leader-base-topic": {
            "$ref": "#/components/schemas/AgentBaseTopic"
          },
          "since": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SetFormationTaskCommand": {
        "type": "object",
        "required": [
          "task"
        ],
        "allOf": [
          {
            "$ref": "./waraps-api-tasks.json#/components/schemas/StartTaskBase"
          }
        ],
        "properties": {
          "task": {
            "type": "object",
            "required": [
              "name",
              "params"
            ],
            "properties": {
              "name": {
                "const": "set-formation"
              },
              "params": {
                "type": "object",
                "required": [
                  "type"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "cube",
                      "none"
                    ]
                  },
                  "spacing-m": {
                    "type": "number",
                    "minimum": 30,
                    "maximum": 1000
                  },
                  "swarm": {
                    "$ref": "#/components/schemas/SwarmFlag"
                  },
                  "agent-count": {
                    "$ref": "#/components/schemas/AgentCount"
                  }
                },
                "allOf": [
                  {
                    "if": {
                      "properties": {
                        "type": {
                          "const": "cube"
                        }
                      }
                    },
                    "then": {
                      "required": [
                        "spacing-m"
                      ]
                    }
                  }
                ]
              }
            }
          }
        }
      },
      "FormationState": {
        "type": "object",
        "required": [
          "swarm-id",
          "command-id",
          "type",
          "leader-id",
          "applied-at"
        ],
        "properties": {
          "swarm-id": {
            "$ref": "#/components/schemas/SwarmId"
          },
          "command-id": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TaskId"
              },
              {
                "const": "default"
              }
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "cube",
              "none"
            ]
          },
          "spacing-m": {
            "type": "number",
            "minimum": 30,
            "maximum": 1000
          },
          "leader-id": {
            "$ref": "#/components/schemas/AgentId"
          },
          "applied-at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "type": {
                  "const": "cube"
                }
              }
            },
            "then": {
              "required": [
                "spacing-m"
              ]
            }
          }
        ]
      },
      "FormationReference": {
        "type": "object",
        "required": [
          "swarm-id",
          "leader-id",
          "position",
          "published-at"
        ],
        "properties": {
          "swarm-id": {
            "$ref": "#/components/schemas/SwarmId"
          },
          "leader-id": {
            "$ref": "#/components/schemas/AgentId"
          },
          "position": {
            "allOf": [
              {
                "$ref": "#/components/schemas/GeoPoint"
              }
            ],
            "description": "The swarm anchor position: the leader's current position while on station, or its last on-station position while detached."
          },
          "speed": {
            "type": "number",
            "minimum": 0,
            "description": "Optional. The leader's current speed in metres per second. Members fly their Formation Slot at this speed so the Swarm keeps the pace of the leader's move; absent or 0 lets a member fly at its own speed."
          },
          "published-at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SwarmFlag": {
        "type": "boolean",
        "default": false,
        "description": "Optional params.swarm, which may be present on any task. Each task name decides what it means; a task with no Swarm meaning ignores it. Absent or false behaves as if the flag did not exist. A non-boolean value fails the task as 'invalid task payload' on exec/response. When a member hands a task to the Swarm Unit it forwards params.swarm unchanged."
      },
      "AgentCount": {
        "type": "integer",
        "minimum": 1,
        "default": 1,
        "description": "Optional params.agent-count, which may be present on any task: how many Agents the task asks for. Absent behaves as 1. A value that is not an integer of at least 1, or one combined with params.swarm true, fails the task with fail-reason 'invalid-agent-count'. Unlike params.swarm, which a task with no Swarm meaning ignores, a task name that gives an agent-count above one no meaning fails with 'agent-count-unsupported'. A value above the Swarm roster size, or above 1 on a standalone Agent, fails with 'insufficient-agents'. A move-to with a value above 1 runs as a Parent Task with that many Sub-Tasks (see taskAnnouncement and parentTaskDecision); a search-area with a value above 1 is split into that many parts of about equal lawnmower route length, one Sub-Task per part (see taskAnnouncement), and fails with 'area-too-small' when its area holds fewer lawnmower tracks than that."
      },
      "WaraMoveToCommand": {
        "allOf": [
          {
            "$ref": "./waraps-api-tasks.json#/components/schemas/MoveToPayload"
          },
          {
            "type": "object",
            "properties": {
              "task": {
                "type": "object",
                "properties": {
                  "params": {
                    "type": "object",
                    "properties": {
                      "swarm": {
                        "$ref": "#/components/schemas/SwarmFlag"
                      },
                      "agent-count": {
                        "$ref": "#/components/schemas/AgentCount"
                      }
                    }
                  }
                }
              },
              "parent-task-uuid": {
                "$ref": "#/components/schemas/TaskId",
                "description": "Only on a Sub-Task command, announced to members and sent to its executor: the uuid of the Parent Task it belongs to. The command is the Parent Task's with a new com-uuid and task-uuid; params, agent-count included, are unchanged. An executor that receives it holds the Sub-Task in planning, flying nothing, until the Parent Task's commit."
              },
              "parent-com-uuid": {
                "$ref": "#/components/schemas/TaskId",
                "description": "Only on a Sub-Task command, with parent-task-uuid: the com-uuid of the command the Parent Task answers. The executor declares it with the Sub-Task in its direct_execution_info, so a new Swarm Leader can report the Parent Task failed under that command."
              }
            }
          }
        ]
      },
      "WaraSearchAreaCommand": {
        "allOf": [
          {
            "$ref": "./waraps-api-tasks.json#/components/schemas/SearchAreaPayload"
          },
          {
            "type": "object",
            "properties": {
              "task": {
                "type": "object",
                "properties": {
                  "params": {
                    "type": "object",
                    "properties": {
                      "swarm": {
                        "$ref": "#/components/schemas/SwarmFlag"
                      },
                      "agent-count": {
                        "$ref": "#/components/schemas/AgentCount"
                      }
                    }
                  }
                }
              },
              "parent-task-uuid": {
                "$ref": "#/components/schemas/TaskId",
                "description": "Only on a Sub-Task command: the uuid of its Parent Task. The command has a new com-uuid and task-uuid, params.area contains only this Sub-Task's partition, and the other parameters are unchanged. The executor holds the Sub-Task in planning until the Parent Task's commit."
              },
              "parent-com-uuid": {
                "$ref": "#/components/schemas/TaskId",
                "description": "Only on a Sub-Task command, with parent-task-uuid: the com-uuid of the command the Parent Task answers. The executor declares it with the Sub-Task in its direct_execution_info so a new Swarm Leader can correlate the Parent Task's failure."
              }
            }
          }
        ]
      },
      "WaraTaskResponse": {
        "allOf": [
          {
            "$ref": "./waraps-api-tasks.json#/components/schemas/TaskResponsePayload"
          },
          {
            "type": "object",
            "properties": {
              "sub-task-uuids": {
                "$ref": "#/components/schemas/SubTaskUuids"
              },
              "failed-sub-task-uuid": {
                "$ref": "#/components/schemas/FailedSubTaskUuid"
              }
            }
          }
        ]
      },
      "SubTaskUuids": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/TaskId"
        },
        "description": "On a Parent Task's response and feedback (a move-to with params.agent-count above 1): the task-uuid of each Sub-Task the leader has created so far. Each Sub-Task reports its own status and results under its own task-uuid on the same Swarm Unit exec/response and exec/feedback, and is listed in tasks-executing with its executor in agent. The Parent Task's feedback status is planning while its Sub-Tasks are bid and held, running once every Sub-Task is accepted and running, paused only when every unfinished, non-superseded Sub-Task is paused, and finished when every non-superseded Sub-Task has finished (a failed Sub-Task that has been replaced is superseded by its replacement; it stays listed here for reporting); its response is running on the first accepted Sub-Task and finished with the last. A Sub-Task of a Parent Task counts as arrived within 30 m horizontally, the avoidance clearance distance, instead of 1 m."
      },
      "WaraTaskFeedback": {
        "allOf": [
          {
            "$ref": "./waraps-api-tasks.json#/components/schemas/TaskFeedbackPayload"
          },
          {
            "type": "object",
            "properties": {
              "sub-task-uuids": {
                "$ref": "#/components/schemas/SubTaskUuids"
              },
              "failed-sub-task-uuid": {
                "$ref": "#/components/schemas/FailedSubTaskUuid"
              }
            }
          }
        ]
      },
      "FailedSubTaskUuid": {
        "$ref": "#/components/schemas/TaskId",
        "description": "On a failed Parent Task's response and feedback: the task-uuid of the Sub-Task that caused the failure. A Sub-Task failing while held, before the commit, is replaced once in the same way, and its replacement failing too fails the Parent Task naming the replacement. A Sub-Task failing after the commit is replaced once by a new Sub-Task, which stays running the Parent Task; if the replacement's delegation fails (e.g. fail-reason insufficient-agents; the uuid names the Sub-Task it was to replace) or the replacement fails while executing (its own fail-reason, naming the replacement), the leader aborts every Sub-Task that has not finished and fails the Parent Task. The Parent Task stays running while a replacement is bid, and sub-task-uuids then lists the failed Sub-Task and its replacement."
      },
      "WaraTaskSignal": {
        "$ref": "./waraps-api-tasks.json#/components/schemas/TaskSignalPayload"
      },
      "TaskAnnouncement": {
        "type": "object",
        "required": [
          "swarm-id",
          "task-id",
          "command",
          "leader-id"
        ],
        "properties": {
          "swarm-id": {
            "$ref": "#/components/schemas/SwarmId"
          },
          "task-id": {
            "$ref": "#/components/schemas/TaskId"
          },
          "command": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/WaraMoveToCommand"
              },
              {
                "$ref": "#/components/schemas/WaraSearchAreaCommand"
              }
            ]
          },
          "leader-id": {
            "$ref": "#/components/schemas/AgentId"
          },
          "parent-task-id": {
            "$ref": "#/components/schemas/TaskId",
            "description": "Present when the announced task is a Sub-Task: the uuid of its Parent Task."
          },
          "agent-count": {
            "$ref": "#/components/schemas/AgentCount",
            "description": "Present with parent-task-id: the Parent Task's agent-count N, from which a bidder derives its reservation expiry and a winner its hold timeout."
          }
        }
      },
      "TaskBid": {
        "type": "object",
        "required": [
          "swarm-id",
          "task-id",
          "agent-id",
          "cost"
        ],
        "properties": {
          "swarm-id": {
            "$ref": "#/components/schemas/SwarmId"
          },
          "task-id": {
            "$ref": "#/components/schemas/TaskId"
          },
          "agent-id": {
            "$ref": "#/components/schemas/AgentId"
          },
          "cost": {
            "type": "number",
            "minimum": 0
          },
          "estimated-distance": {
            "type": "number",
            "minimum": 0
          }
        }
      },
      "ParentTaskDecision": {
        "type": "object",
        "required": [
          "swarm-id",
          "parent-task-id",
          "leader-id",
          "decision"
        ],
        "properties": {
          "swarm-id": {
            "$ref": "#/components/schemas/SwarmId"
          },
          "parent-task-id": {
            "$ref": "#/components/schemas/TaskId",
            "description": "The Parent Task's uuid; equals the task-id in the topic."
          },
          "leader-id": {
            "$ref": "#/components/schemas/AgentId"
          },
          "decision": {
            "type": "string",
            "enum": [
              "commit",
              "release"
            ],
            "description": "commit lets every held Sub-Task of the Parent Task run; release drops every one of them."
          }
        }
      },
      "TaskAssignment": {
        "type": "object",
        "required": [
          "swarm-id",
          "task-id",
          "leader-id",
          "status"
        ],
        "properties": {
          "swarm-id": {
            "$ref": "#/components/schemas/SwarmId"
          },
          "task-id": {
            "$ref": "#/components/schemas/TaskId"
          },
          "leader-id": {
            "$ref": "#/components/schemas/AgentId"
          },
          "executor-id": {
            "$ref": "#/components/schemas/AgentId"
          },
          "status": {
            "type": "string",
            "enum": [
              "assigned",
              "no-bid",
              "failed"
            ]
          },
          "failure-reason": {
            "type": "string",
            "enum": [
              "no-bid",
              "missing executor topic",
              "executor acknowledgement timeout",
              "executor refused",
              "task aborted by commander"
            ],
            "description": "Present when status is no-bid or failed."
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "status": {
                  "const": "assigned"
                }
              }
            },
            "then": {
              "required": [
                "executor-id"
              ]
            }
          },
          {
            "if": {
              "properties": {
                "status": {
                  "enum": [
                    "no-bid",
                    "failed"
                  ]
                }
              }
            },
            "then": {
              "required": [
                "failure-reason"
              ]
            }
          }
        ]
      },
      "TaskIngressCapacityFailureResponse": {
        "type": "object",
        "required": [
          "agent-uuid",
          "com-uuid",
          "response-to",
          "task-uuid",
          "response",
          "fail-reason"
        ],
        "properties": {
          "agent-uuid": {
            "$ref": "#/components/schemas/AgentId"
          },
          "com-uuid": {
            "type": "string",
            "format": "uuid",
            "description": "The original command correlation."
          },
          "response-to": {
            "type": "string",
            "format": "uuid",
            "description": "Equal to the original com-uuid."
          },
          "task-uuid": {
            "$ref": "#/components/schemas/TaskId"
          },
          "response": {
            "const": "failed"
          },
          "fail-reason": {
            "const": "pending task capacity exceeded"
          }
        }
      },
      "TaskIngressWarmUpFailureResponse": {
        "type": "object",
        "required": [
          "agent-uuid",
          "com-uuid",
          "response-to",
          "task-uuid",
          "response",
          "fail-reason"
        ],
        "properties": {
          "agent-uuid": {
            "$ref": "#/components/schemas/AgentId"
          },
          "com-uuid": {
            "type": "string",
            "format": "uuid",
            "description": "The original command correlation."
          },
          "response-to": {
            "type": "string",
            "format": "uuid",
            "description": "Equal to the original com-uuid."
          },
          "task-uuid": {
            "$ref": "#/components/schemas/TaskId"
          },
          "response": {
            "const": "failed"
          },
          "fail-reason": {
            "const": "leader warming up"
          }
        }
      },
      "TaskIngressCapacityFailureFeedback": {
        "type": "object",
        "required": [
          "agent-uuid",
          "com-uuid",
          "task-uuid",
          "status",
          "fail-reason"
        ],
        "properties": {
          "agent-uuid": {
            "$ref": "#/components/schemas/AgentId"
          },
          "com-uuid": {
            "type": "string",
            "format": "uuid",
            "description": "The original command correlation."
          },
          "task-uuid": {
            "$ref": "#/components/schemas/TaskId"
          },
          "status": {
            "const": "failed"
          },
          "fail-reason": {
            "const": "pending task capacity exceeded"
          }
        }
      },
      "TaskIngressWarmUpFailureFeedback": {
        "type": "object",
        "required": [
          "agent-uuid",
          "com-uuid",
          "task-uuid",
          "status",
          "fail-reason"
        ],
        "properties": {
          "agent-uuid": {
            "$ref": "#/components/schemas/AgentId"
          },
          "com-uuid": {
            "type": "string",
            "format": "uuid",
            "description": "The original command correlation."
          },
          "task-uuid": {
            "$ref": "#/components/schemas/TaskId"
          },
          "status": {
            "const": "failed"
          },
          "fail-reason": {
            "const": "leader warming up"
          }
        }
      },
      "SwarmTaskSignal": {
        "type": "object",
        "required": [
          "swarm-id",
          "task-id",
          "signal"
        ],
        "properties": {
          "swarm-id": {
            "$ref": "#/components/schemas/SwarmId"
          },
          "task-id": {
            "$ref": "#/components/schemas/TaskId"
          },
          "signal": {
            "$ref": "#/components/schemas/WaraTaskSignal"
          }
        }
      },
      "SetSwarmIntentCommand": {
        "type": "object",
        "description": "Standard start-task envelope (StartTaskBase) whose task is set-swarm-intent, sent to the Agent's own exec/command. execution-unit must name the addressed Agent.",
        "required": [
          "task"
        ],
        "allOf": [
          {
            "$ref": "./waraps-api-tasks.json#/components/schemas/StartTaskBase"
          }
        ],
        "properties": {
          "task": {
            "type": "object",
            "description": "The set-swarm-intent task. It has no signals and no natural end.",
            "required": [
              "name",
              "params"
            ],
            "properties": {
              "name": {
                "const": "set-swarm-intent",
                "description": "Task name."
              },
              "params": {
                "type": "object",
                "description": "Which Swarm the Agent should hold intent for.",
                "required": [
                  "swarm-id"
                ],
                "properties": {
                  "swarm-id": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/SwarmId"
                      },
                      {
                        "type": "string",
                        "maxLength": 0
                      }
                    ],
                    "description": "UUID of the Swarm to found or join; an empty string clears the intent (a graceful Departure). An Agent that already holds intent for a different Swarm rejects the task until it has left it.",
                    "examples": [
                      "2d5082f9-3dca-498c-9157-f152456f9179",
                      ""
                    ]
                  },
                  "swarm-name": {
                    "type": "string",
                    "maxLength": 64,
                    "description": "Optional human-readable Swarm name, at most 64 characters. Used when founding the Swarm; later leaders carry it on the roster. Ignored for a Departure.",
                    "examples": [
                      "Harbour patrol"
                    ]
                  },
                  "swarm": {
                    "$ref": "#/components/schemas/SwarmFlag"
                  },
                  "agent-count": {
                    "$ref": "#/components/schemas/AgentCount"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "x-swarm-sensor-interval-seconds": 1,
  "x-upstream-waraps-v1.1.0": {
    "declarations": {
      "heartbeat": "./waraps-api-declarations.json#/components/messages/HeartbeatMessage",
      "sensor-info": "./waraps-api-declarations.json#/components/messages/SensorInfoMessage",
      "direct-execution-info": "./waraps-api-declarations.json#/components/messages/DirectExecutionInfoMessage"
    },
    "sensors": {
      "position": "./waraps-api-sensors.json#/components/messages/PositionSensorMessage",
      "energy-level": "./waraps-api-sensors.json#/components/messages/EnergyLevelSensorMessage"
    },
    "task-execution": {
      "move-to": "./waraps-api-tasks.json#/components/messages/MoveToTaskMessage",
      "response": "./waraps-api-tasks.json#/components/messages/TaskResponseMessage",
      "feedback": "./waraps-api-tasks.json#/components/messages/TaskFeedbackMessage",
      "signal": "./waraps-api-tasks.json#/components/messages/SignalMessage"
    }
  }
}
