{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://go-sip.local/contracts/proposals/task-discovery-v0.3-proposal.schema.json", "title": "Project-local event-cursor Dispatcher task pages; external compatibility unverified", "oneOf": [ {"$ref": "#/$defs/page_response"}, {"$ref": "#/$defs/error_response"} ], "$defs": { "dispatcher_id": { "type": "string", "format": "uuid", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" }, "cursor": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,19})$", "$comment": "Canonical decimal uint64 event ID per Dispatcher; semantic parsing enforces the uint64 maximum. Never derived from task_id or expires." }, "task": { "type": "object", "additionalProperties": false, "required": ["task_id", "tenant_id", "tenant_key", "status", "task_revision"], "properties": { "task_id": {"type": "string", "pattern": "^[A-Za-z0-9_-]{1,128}$"}, "tenant_id": {"type": "string", "minLength": 1, "maxLength": 128}, "tenant_key": {"type": "string", "minLength": 1, "maxLength": 196, "$comment": "Also enforce UTF-8 byte limit and tenant_id mapping in business logic."}, "status": {"enum": ["running", "paused", "stopped", "finished", "removed"]}, "task_revision": {"type": "integer", "minimum": 1} }, "$comment": "Removed tombstones retain original task and tenant identity indefinitely. No per-item event_id or queue location." }, "page_response": { "type": "object", "additionalProperties": false, "required": ["schema_version", "dispatcher_id", "next_cursor", "tasks"], "properties": { "schema_version": {"const": "task-discovery.v0.3-proposal"}, "dispatcher_id": {"$ref": "#/$defs/dispatcher_id"}, "next_cursor": {"$ref": "#/$defs/cursor"}, "tasks": {"type": "array", "maxItems": 256, "items": {"$ref": "#/$defs/task"}} }, "$comment": "Initial and later pages share one shape. A nonempty page advances after to its last returned event; an empty page repeats after and signals caught up. Server guarantees ascending complete event positions; client cannot verify ordering inside a page without per-item IDs." }, "error_response": { "type": "object", "additionalProperties": false, "required": ["schema_version", "resource", "error"], "properties": { "schema_version": {"const": "task-discovery.v0.3-proposal"}, "resource": {"const": "error"}, "error": { "type": "object", "additionalProperties": false, "required": ["code", "message"], "properties": { "code": {"enum": ["invalid_cursor", "unauthorized", "dispatcher_not_authorized", "service_unavailable"]}, "message": {"type": "string", "minLength": 1, "maxLength": 256} } } } } } }