BotCommandResult bot.command-result@1

Generated at from openvibe-contracts v0.97.0 and openvibe-sdk v0.26.0.

Version
1.0.0
Owner
bot
Visibility
first-party
Status
active
Compatibility
backward
Decision
ADR-043
Schema
https://openvibe.network/contracts/bot/command-result.v1.json

bot.command-result@1: the command_result frame OpenVibe.Bot answers a bot.command@1 with on the operator WebSocket (server/realtime.js). result: ack or nack (the device answered; reason is its fault code, latency_ms the round trip), refused (the gate refused it; code is Bot's refusal code such as bot.estop_latched, bot.cooldown or bot.device_offline, and reason says why), expired (no answer before the deadline) or pending (the same id is still in flight). cached is true when a repeated id is answered from the first result.

Fields

FieldTypeRequiredDescriptionConstraints
vconstyes
  • = 1
seqintegeryes
  • minimum 0
tsintegeryes
  • minimum 0
typeconstyes
  • = "command_result"
idstringyes
  • minLength 1
  • maxLength 64
resultenumyes
  • one of "ack", "nack", "refused", "expired", "pending"
reasonstring | null
codestring
  • pattern ^bot\.[a-z_]+$
latency_msinteger
  • minimum 0
cachedboolean

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: ack
{
  "v": 1,
  "seq": 13,
  "ts": 1759600000013,
  "type": "command_result",
  "id": "op-7",
  "result": "ack",
  "reason": null,
  "latency_ms": 42
}
Valid: cached-pending
{
  "v": 1,
  "seq": 15,
  "ts": 1759600000015,
  "type": "command_result",
  "id": "op-9",
  "result": "pending",
  "cached": true
}
Valid: refused
{
  "v": 1,
  "seq": 14,
  "ts": 1759600000014,
  "type": "command_result",
  "id": "op-8",
  "result": "refused",
  "code": "bot.estop_latched",
  "reason": "the e-stop is latched; only the owner can clear it"
}
Rejected: no-id
{
  "v": 1,
  "seq": 17,
  "ts": 1759600000017,
  "type": "command_result",
  "result": "ack"
}
Rejected: unknown-result
{
  "v": 1,
  "seq": 16,
  "ts": 1759600000016,
  "type": "command_result",
  "id": "op-7",
  "result": "ok"
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('bot.command-result@1', value);   // { valid, errors: [{ path, message }] }