| {
|
| "$schema": "https://json-schema.org/draft/2020-12/schema",
|
| "$id": "https://github.com/LucioLiu/handoff-protocol/contracts/dispatch-receipt.schema.json",
|
| "title": "Dispatch receipt",
|
| "type": "object",
|
| "additionalProperties": false,
|
| "required": [
|
| "handoff_id",
|
| "recipient_id",
|
| "timestamp",
|
| "status",
|
| "requested_mode"
|
| ],
|
| "properties": {
|
| "handoff_id": {"type": "string", "minLength": 1},
|
| "contract_id": {"type": "string", "minLength": 1},
|
| "dispatch_id": {"type": "string", "minLength": 1},
|
| "recipient_id": {"type": "string", "minLength": 1},
|
| "timestamp": {"type": "string", "format": "date-time"},
|
| "status": {"enum": ["accepted", "undelivered"]},
|
| "requested_mode": {
|
| "description": "Requested host execution container, not a persistence claim.",
|
| "enum": ["bounded_subagent", "independent_task"]
|
| },
|
| "effective_mode": {
|
| "description": "Actual host execution container. Durable file writes do not change bounded_subagent into independent_task.",
|
| "enum": ["bounded_subagent", "independent_task"]
|
| },
|
| "task_id": {"type": "string", "minLength": 1},
|
| "workspace_receipt": {
|
| "type": "object",
|
| "additionalProperties": false,
|
| "required": ["root_id", "resolved_path", "resolution_evidence"],
|
| "properties": {
|
| "root_id": {"type": "string", "minLength": 1},
|
| "resolved_path": {"type": "string", "minLength": 1},
|
| "resolution_evidence": {"type": "string", "minLength": 1}
|
| }
|
| },
|
| "degraded_from": {"const": "independent_task"},
|
| "degradation_reason": {"type": "string", "minLength": 1},
|
| "provider": {"type": "object", "minProperties": 1},
|
| "reason": {"type": "string", "minLength": 1}
|
| },
|
| "allOf": [
|
| {
|
| "if": {
|
| "properties": {"status": {"const": "accepted"}},
|
| "required": ["status"]
|
| },
|
| "then": {
|
| "required": ["dispatch_id", "effective_mode", "provider"],
|
| "not": {"required": ["reason"]},
|
| "oneOf": [
|
| {
|
| "properties": {
|
| "requested_mode": {"const": "bounded_subagent"},
|
| "effective_mode": {"const": "bounded_subagent"}
|
| },
|
| "required": ["requested_mode", "effective_mode"],
|
| "not": {
|
| "anyOf": [
|
| {"required": ["task_id"]},
|
| {"required": ["workspace_receipt"]},
|
| {"required": ["degraded_from"]},
|
| {"required": ["degradation_reason"]}
|
| ]
|
| }
|
| },
|
| {
|
| "properties": {
|
| "requested_mode": {"const": "independent_task"},
|
| "effective_mode": {"const": "independent_task"}
|
| },
|
| "required": [
|
| "requested_mode",
|
| "effective_mode",
|
| "contract_id",
|
| "task_id",
|
| "workspace_receipt"
|
| ],
|
| "not": {
|
| "anyOf": [
|
| {"required": ["degraded_from"]},
|
| {"required": ["degradation_reason"]}
|
| ]
|
| }
|
| },
|
| {
|
| "properties": {
|
| "requested_mode": {"const": "independent_task"},
|
| "effective_mode": {"const": "bounded_subagent"},
|
| "degraded_from": {"const": "independent_task"}
|
| },
|
| "required": [
|
| "requested_mode",
|
| "effective_mode",
|
| "contract_id",
|
| "degraded_from",
|
| "degradation_reason"
|
| ],
|
| "not": {
|
| "anyOf": [
|
| {"required": ["task_id"]},
|
| {"required": ["workspace_receipt"]}
|
| ]
|
| }
|
| }
|
| ]
|
| }
|
| },
|
| {
|
| "if": {
|
| "properties": {"status": {"const": "undelivered"}},
|
| "required": ["status"]
|
| },
|
| "then": {
|
| "required": ["reason"],
|
| "not": {
|
| "anyOf": [
|
| {"required": ["dispatch_id"]},
|
| {"required": ["task_id"]},
|
| {"required": ["provider"]},
|
| {"required": ["effective_mode"]},
|
| {"required": ["workspace_receipt"]},
|
| {"required": ["degraded_from"]},
|
| {"required": ["degradation_reason"]}
|
| ]
|
| }
|
| }
|
| }
|
| ]
|
| }
|
|
|