Skip to content

Commit 56c0960

Browse files
author
Your Name
committed
feat: add convert v1.0.0 request + receipt schemas
1 parent 57b129a commit 56c0960

2 files changed

Lines changed: 450 additions & 0 deletions

File tree

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
{
2+
"$id": "https://commandlayer.org/schemas/v1.0.0/commons/convert/receipts/convert.receipt.schema.json",
3+
"$schema": "https://json-schema.org/draft/2020-12/schema",
4+
"title": "convert.receipt",
5+
"description": "Receipt for convert requests, extending the CommandLayer base receipt structure with conversion-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 convert 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": "convert" },
26+
"version": { "const": "1.0.0" }
27+
},
28+
"required": ["verb", "version"]
29+
}
30+
]
31+
},
32+
"result": {
33+
"description": "Conversion result payload when status = 'ok' or 'partial'.",
34+
"type": "object",
35+
"additionalProperties": false,
36+
"properties": {
37+
"output": {
38+
"description": "Converted content or serialized data.",
39+
"type": "string",
40+
"minLength": 1,
41+
"maxLength": 500000
42+
},
43+
"from_format": {
44+
"description": "Effective source format used by the agent.",
45+
"type": "string",
46+
"maxLength": 64
47+
},
48+
"to_format": {
49+
"description": "Target format/representation that was produced.",
50+
"type": "string",
51+
"maxLength": 64
52+
},
53+
"from_schema_uri": {
54+
"description": "Source schema URI used by the agent, if any.",
55+
"type": "string",
56+
"maxLength": 2048
57+
},
58+
"to_schema_uri": {
59+
"description": "Target schema URI used for validation, if any.",
60+
"type": "string",
61+
"maxLength": 2048
62+
},
63+
"lossy": {
64+
"description": "Whether the conversion was lossy.",
65+
"type": "boolean"
66+
},
67+
"validation": {
68+
"description": "Validation outcome for the converted data.",
69+
"type": "object",
70+
"additionalProperties": false,
71+
"properties": {
72+
"valid": {
73+
"description": "Whether the converted output passed validation against the target schema, if provided.",
74+
"type": "boolean"
75+
},
76+
"errors": {
77+
"description": "Validation errors if validation failed or was partial.",
78+
"type": "array",
79+
"items": {
80+
"type": "string",
81+
"minLength": 1,
82+
"maxLength": 1024
83+
}
84+
}
85+
}
86+
},
87+
"warnings": {
88+
"description": "Non-fatal warnings about the conversion (e.g., truncated fields, defaulted values).",
89+
"type": "array",
90+
"items": {
91+
"type": "string",
92+
"minLength": 1,
93+
"maxLength": 1024
94+
}
95+
},
96+
"source_hash": {
97+
"description": "Optional hash of the input content (e.g., sha256 hex).",
98+
"type": "string",
99+
"minLength": 32,
100+
"maxLength": 128
101+
},
102+
"model_name": {
103+
"description": "Identifier for the model or engine used, if applicable.",
104+
"type": "string",
105+
"maxLength": 256
106+
}
107+
},
108+
"required": ["output", "to_format"]
109+
},
110+
"usage": {
111+
"description": "Optional resource usage metrics for this invocation.",
112+
"type": "object",
113+
"additionalProperties": false,
114+
"properties": {
115+
"input_tokens": {
116+
"description": "Number of input tokens consumed (if LLM-based).",
117+
"type": "integer",
118+
"minimum": 0
119+
},
120+
"output_tokens": {
121+
"description": "Number of output tokens produced.",
122+
"type": "integer",
123+
"minimum": 0
124+
},
125+
"total_tokens": {
126+
"description": "Total tokens used (input + output), if available.",
127+
"type": "integer",
128+
"minimum": 0
129+
},
130+
"cost_usd": {
131+
"description": "Optional cost for this call in USD (or equivalent fiat), if known.",
132+
"type": "number",
133+
"minimum": 0
134+
},
135+
"latency_ms": {
136+
"description": "Observed end-to-end latency for this invocation in milliseconds.",
137+
"type": "integer",
138+
"minimum": 0
139+
}
140+
}
141+
}
142+
},
143+
"required": ["x402", "trace", "status", "result"]
144+
}
145+
]
146+
}

0 commit comments

Comments
 (0)