|
| 1 | +{ |
| 2 | + "$id": "https://commandlayer.org/schemas/v1.0.0/commons/explain/receipts/explain.receipt.schema.json", |
| 3 | + "$schema": "https://json-schema.org/draft/2020-12/schema", |
| 4 | + "title": "explain.receipt", |
| 5 | + "description": "Receipt for explain requests, extending the CommandLayer base receipt structure with explanation-specific result and usage fields.", |
| 6 | + "type": "object", |
| 7 | + "allOf": [ |
| 8 | + { |
| 9 | + "$ref": "https://commandlayer.org/schemas/v1.0.0/_shared/receipt.base.schema.json" |
| 10 | + }, |
| 11 | + { |
| 12 | + "type": "object", |
| 13 | + "additionalProperties": false, |
| 14 | + "properties": { |
| 15 | + "x402": { |
| 16 | + "description": "x402 envelope describing the explain verb and version for this receipt.", |
| 17 | + "allOf": [ |
| 18 | + { |
| 19 | + "$ref": "https://commandlayer.org/schemas/v1.0.0/_shared/x402.schema.json" |
| 20 | + }, |
| 21 | + { |
| 22 | + "type": "object", |
| 23 | + "additionalProperties": false, |
| 24 | + "properties": { |
| 25 | + "verb": { "const": "explain" }, |
| 26 | + "version": { "const": "1.0.0" } |
| 27 | + }, |
| 28 | + "required": ["verb", "version"] |
| 29 | + } |
| 30 | + ] |
| 31 | + }, |
| 32 | + "result": { |
| 33 | + "description": "Explanation result payload when status = 'ok' or 'partial'.", |
| 34 | + "type": "object", |
| 35 | + "additionalProperties": false, |
| 36 | + "properties": { |
| 37 | + "explanation": { |
| 38 | + "description": "The explanation content.", |
| 39 | + "type": "string", |
| 40 | + "minLength": 1, |
| 41 | + "maxLength": 500000 |
| 42 | + }, |
| 43 | + "format": { |
| 44 | + "description": "Format of the explanation.", |
| 45 | + "type": "string", |
| 46 | + "enum": ["text", "markdown", "html", "json", "other"] |
| 47 | + }, |
| 48 | + "audience": { |
| 49 | + "description": "Effective audience the agent targeted.", |
| 50 | + "type": "string", |
| 51 | + "maxLength": 64 |
| 52 | + }, |
| 53 | + "depth": { |
| 54 | + "description": "Depth actually applied.", |
| 55 | + "type": "string", |
| 56 | + "enum": ["overview", "detailed", "deep_dive"] |
| 57 | + }, |
| 58 | + "includes_limitations": { |
| 59 | + "description": "Whether the explanation explicitly calls out limitations or uncertainties.", |
| 60 | + "type": "boolean" |
| 61 | + }, |
| 62 | + "evidence_referenced": { |
| 63 | + "description": "Whether the explanation explicitly referenced evidence or sources.", |
| 64 | + "type": "boolean" |
| 65 | + }, |
| 66 | + "evidence_summary": { |
| 67 | + "description": "Short summary of the evidence the explanation was grounded in, if applicable.", |
| 68 | + "type": "string", |
| 69 | + "maxLength": 2000 |
| 70 | + }, |
| 71 | + "source_hash": { |
| 72 | + "description": "Optional hash of the evidence or subject content (e.g., sha256 hex).", |
| 73 | + "type": "string", |
| 74 | + "minLength": 32, |
| 75 | + "maxLength": 128 |
| 76 | + }, |
| 77 | + "confidence": { |
| 78 | + "description": "Optional numeric confidence estimate for the explanation.", |
| 79 | + "type": "number", |
| 80 | + "minimum": 0, |
| 81 | + "maximum": 1 |
| 82 | + }, |
| 83 | + "warnings": { |
| 84 | + "description": "Non-fatal warnings about the explanation (e.g., partial logs, missing features).", |
| 85 | + "type": "array", |
| 86 | + "items": { |
| 87 | + "type": "string", |
| 88 | + "minLength": 1, |
| 89 | + "maxLength": 1024 |
| 90 | + } |
| 91 | + }, |
| 92 | + "model_name": { |
| 93 | + "description": "Identifier for the model or engine used, if applicable.", |
| 94 | + "type": "string", |
| 95 | + "maxLength": 256 |
| 96 | + } |
| 97 | + }, |
| 98 | + "required": ["explanation"] |
| 99 | + }, |
| 100 | + "usage": { |
| 101 | + "description": "Optional resource usage metrics for this invocation.", |
| 102 | + "type": "object", |
| 103 | + "additionalProperties": false, |
| 104 | + "properties": { |
| 105 | + "input_tokens": { |
| 106 | + "description": "Number of input tokens consumed.", |
| 107 | + "type": "integer", |
| 108 | + "minimum": 0 |
| 109 | + }, |
| 110 | + "output_tokens": { |
| 111 | + "description": "Number of output tokens produced.", |
| 112 | + "type": "integer", |
| 113 | + "minimum": 0 |
| 114 | + }, |
| 115 | + "total_tokens": { |
| 116 | + "description": "Total tokens used (input + output), if available.", |
| 117 | + "type": "integer", |
| 118 | + "minimum": 0 |
| 119 | + }, |
| 120 | + "cost_usd": { |
| 121 | + "description": "Optional cost for this call in USD (or equivalent fiat), if known.", |
| 122 | + "type": "number", |
| 123 | + "minimum": 0 |
| 124 | + }, |
| 125 | + "latency_ms": { |
| 126 | + "description": "Observed end-to-end latency for this invocation in milliseconds.", |
| 127 | + "type": "integer", |
| 128 | + "minimum": 0 |
| 129 | + } |
| 130 | + } |
| 131 | + } |
| 132 | + }, |
| 133 | + "required": ["x402", "trace", "status", "result"] |
| 134 | + } |
| 135 | + ] |
| 136 | +} |
0 commit comments