BotJobDispatchResult bot.job-dispatch-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-034
- Schema
https://openvibe.network/contracts/bot/job-dispatch-result.v1.json
bot.job-dispatch-result@1: what OpenVibe.Bot answers OpenVibe.Run's bot.job.dispatch calls (server/api/v1.js and server/jobs/index.js). POST /api/v1/jobs is 201 { job, sent }: `job` is Bot's run_jobs record and `sent` says whether the `job` frame went out on the device link now (false while the paired Node is away; it is resent on every reconnect until the Node acks it). POST /api/v1/jobs/:id/cancel is 200 { job, sent } with the same shape: `sent` says whether a `job_cancel` frame went out. GET /api/v1/jobs/:id is 200 { job, stdout }: the record plus the last 1 MiB of the job's captured stdout, or null when the Node sent none. The record's `state` follows the run_jobs lifecycle queued -> placed (the Node acked) -> running (job_started) -> one end state, and its `job` field is the platform.job@1 body Run dispatched, stored and resent verbatim. A refused dispatch answers a problem instead (422 bot.invalid_job, 404 bot.device_not_found, 409 bot.class_unadvertised, 409 bot.job_id_reused), never this contract.
Fields
This schema has no named fields.
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: dispatched
{
"job": {
"id": "job_01JAB2C3D4E5F6G7H8J9K0MNPQ",
"node_id": "dev_01J8Z4M2Q0R7T9YV3K6N8P1W2X",
"class": "function",
"state": "queued",
"project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPR",
"subject": "user:usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
"provider": null,
"cancel_requested": false,
"fault_code": null,
"sent_at": 1759500000000,
"started_ms": null,
"finished_at": null,
"exit_reason": null,
"exit_code": null,
"wall_ms": null,
"usage_read": 0,
"result": null,
"job": {
"id": "job_01JAB2C3D4E5F6G7H8J9K0MNPQ",
"class": "function",
"artifact": {
"name": "thumbnail",
"version": "1.2.0"
},
"args": {
"width": 320
},
"ttl_ms": 60000,
"limits": {
"wall_ms": 30000,
"cpu_ms": 30000,
"mem_bytes": 268435456
},
"net": "deny"
},
"created_at": 1759500000000,
"updated_at": 1759500000000
},
"sent": true
}Valid: state-with-stdout
{
"job": {
"id": "job_01JAB2C3D4E5F6G7H8J9K0MNPQ",
"node_id": "dev_01J8Z4M2Q0R7T9YV3K6N8P1W2X",
"class": "function",
"state": "succeeded",
"project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPR",
"subject": "user:usr_01JAB2C3D4E5F6G7H8J9K0MNPQ",
"provider": null,
"cancel_requested": false,
"fault_code": null,
"sent_at": 1759500000000,
"started_ms": 1759500001200,
"finished_at": 1759500004700,
"exit_reason": "exited",
"exit_code": 0,
"wall_ms": 3500,
"usage_read": 4,
"result": {
"width": 320
},
"job": {
"id": "job_01JAB2C3D4E5F6G7H8J9K0MNPQ",
"class": "function",
"artifact": {
"name": "thumbnail",
"version": "1.2.0"
},
"args": {
"width": 320
},
"ttl_ms": 60000,
"limits": {
"wall_ms": 30000,
"cpu_ms": 30000,
"mem_bytes": 268435456
},
"net": "deny"
},
"created_at": 1759500000000,
"updated_at": 1759500004700
},
"stdout": {
"text": "wrote thumbnail.png\n",
"first_seq": 1,
"last_seq": 2,
"truncated": false
}
}Valid: state-without-stdout
{
"job": {
"id": "job_01JAB2C3D4E5F6G7H8J9K0MNPS",
"node_id": "dev_01J8Z4M2Q0R7T9YV3K6N8P1W2X",
"class": "code",
"state": "cancelled",
"project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPR",
"subject": null,
"provider": null,
"cancel_requested": true,
"fault_code": null,
"sent_at": 1759500000000,
"started_ms": null,
"finished_at": null,
"exit_reason": null,
"exit_code": null,
"wall_ms": null,
"usage_read": 0,
"result": null,
"job": {
"id": "job_01JAB2C3D4E5F6G7H8J9K0MNPS",
"class": "code",
"artifact": {
"name": "transcode",
"version": "0.4.1"
},
"args": {
"format": "webm"
},
"ttl_ms": 120000,
"limits": {
"wall_ms": 90000,
"cpu_ms": 90000,
"mem_bytes": 536870912
},
"net": "public"
},
"created_at": 1759500000000,
"updated_at": 1759500000900
},
"stdout": null
}Rejected: not-an-answer
{
"job": {
"id": "job_01JAB2C3D4E5F6G7H8J9K0MNPQ",
"node_id": "dev_01J8Z4M2Q0R7T9YV3K6N8P1W2X",
"class": "function",
"state": "queued",
"project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPR",
"subject": null,
"provider": null,
"cancel_requested": false,
"fault_code": null,
"sent_at": 1759500000000,
"started_ms": null,
"finished_at": null,
"exit_reason": null,
"exit_code": null,
"wall_ms": null,
"usage_read": 0,
"result": null,
"job": {
"id": "job_01JAB2C3D4E5F6G7H8J9K0MNPQ",
"class": "function",
"artifact": {
"name": "thumbnail",
"version": "1.2.0"
},
"args": {},
"ttl_ms": 60000,
"limits": {
"wall_ms": 30000,
"cpu_ms": 30000,
"mem_bytes": 268435456
}
},
"created_at": 1759500000000,
"updated_at": 1759500000000
}
}Rejected: unknown-state
{
"job": {
"id": "job_01JAB2C3D4E5F6G7H8J9K0MNPQ",
"node_id": "dev_01J8Z4M2Q0R7T9YV3K6N8P1W2X",
"class": "function",
"state": "done",
"project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPR",
"subject": null,
"provider": null,
"cancel_requested": false,
"fault_code": null,
"sent_at": 1759500000000,
"started_ms": 1759500001200,
"finished_at": 1759500004700,
"exit_reason": "exited",
"exit_code": 0,
"wall_ms": 3500,
"usage_read": 4,
"result": null,
"job": {
"id": "job_01JAB2C3D4E5F6G7H8J9K0MNPQ",
"class": "function",
"artifact": {
"name": "thumbnail",
"version": "1.2.0"
},
"args": {},
"ttl_ms": 60000,
"limits": {
"wall_ms": 30000,
"cpu_ms": 30000,
"mem_bytes": 268435456
}
},
"created_at": 1759500000000,
"updated_at": 1759500004700
},
"sent": true
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('bot.job-dispatch-result@1', value); // { valid, errors: [{ path, message }] }