Skip to content

Commit 1ded941

Browse files
author
Your Name
committed
feat: add translate v1.0.0 request + receipt schemas (A2A + Swarm + x402)
1 parent ab8bbed commit 1ded941

File tree

2 files changed

+394
-0
lines changed

2 files changed

+394
-0
lines changed
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{
2+
"$id": "https://commandlayer.org/schemas/v1.0.0/commons/translate/receipts/translate.receipt.schema.json",
3+
"$schema": "https://json-schema.org/draft/2020-12/schema",
4+
"title": "translate.receipt",
5+
"description": "Receipt for translate requests, extending the CommandLayer base receipt structure with translation-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 translate 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": "translate" },
26+
"version": { "const": "1.0.0" }
27+
},
28+
"required": ["verb", "version"]
29+
}
30+
]
31+
},
32+
"result": {
33+
"description": "Translation result payload when status = 'success'.",
34+
"type": "object",
35+
"additionalProperties": false,
36+
"properties": {
37+
"translated_content": {
38+
"description": "The translated output content.",
39+
"type": "string",
40+
"minLength": 1,
41+
"maxLength": 500000
42+
},
43+
"source_locale": {
44+
"description": "Effective source language used by the agent (detected or taken from the request).",
45+
"type": "string",
46+
"minLength": 2,
47+
"maxLength": 32
48+
},
49+
"target_locale": {
50+
"description": "Target language of the translated content.",
51+
"type": "string",
52+
"minLength": 2,
53+
"maxLength": 32
54+
},
55+
"domain": {
56+
"description": "Domain or subject area applied (if any).",
57+
"type": "string",
58+
"maxLength": 64
59+
},
60+
"formality": {
61+
"description": "Formality actually applied.",
62+
"type": "string",
63+
"enum": ["default", "formal", "informal"]
64+
},
65+
"glossary_applied": {
66+
"description": "Whether a glossary was applied.",
67+
"type": "boolean"
68+
},
69+
"warnings": {
70+
"description": "Non-fatal warnings about the translation (e.g., glossary conflicts, untranslatable segments).",
71+
"type": "array",
72+
"items": {
73+
"type": "string",
74+
"minLength": 1,
75+
"maxLength": 1024
76+
}
77+
},
78+
"source_hash": {
79+
"description": "Optional hash of the input content (e.g., sha256 hex).",
80+
"type": "string",
81+
"minLength": 32,
82+
"maxLength": 128
83+
},
84+
"model_name": {
85+
"description": "Identifier for the model or engine used, if applicable.",
86+
"type": "string",
87+
"maxLength": 256
88+
}
89+
},
90+
"required": ["translated_content", "target_locale"]
91+
},
92+
"usage": {
93+
"description": "Optional resource usage metrics for this invocation.",
94+
"type": "object",
95+
"additionalProperties": false,
96+
"properties": {
97+
"input_tokens": {
98+
"description": "Number of input tokens consumed.",
99+
"type": "integer",
100+
"minimum": 0
101+
},
102+
"output_tokens": {
103+
"description": "Number of output tokens produced.",
104+
"type": "integer",
105+
"minimum": 0
106+
},
107+
"total_tokens": {
108+
"description": "Total tokens used (input + output), if available.",
109+
"type": "integer",
110+
"minimum": 0
111+
},
112+
"cost_usd": {
113+
"description": "Optional cost for this call in USD (or equivalent fiat), if known.",
114+
"type": "number",
115+
"minimum": 0
116+
},
117+
"latency_ms": {
118+
"description": "Observed end-to-end latency for this invocation in milliseconds.",
119+
"type": "integer",
120+
"minimum": 0
121+
}
122+
}
123+
}
124+
},
125+
"required": ["x402", "trace", "status", "result"]
126+
}
127+
]
128+
}
Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
{
2+
"$id": "https://commandlayer.org/schemas/v1.0.0/commons/translate/requests/translate.request.schema.json",
3+
"$schema": "https://json-schema.org/draft/2020-12/schema",
4+
"title": "translate.request",
5+
"description": "Request to translate content from a source language to a target language with explicit limits, A2A-style channel metadata, optional auth, delegation, and context for multi-agent flows.",
6+
"type": "object",
7+
"additionalProperties": false,
8+
9+
"properties": {
10+
"x402": {
11+
"description": "x402 envelope describing the verb, version, and optional routing metadata.",
12+
"allOf": [
13+
{
14+
"$ref": "https://commandlayer.org/schemas/v1.0.0/_shared/x402.schema.json"
15+
},
16+
{
17+
"type": "object",
18+
"additionalProperties": false,
19+
"properties": {
20+
"verb": { "const": "translate" },
21+
"version": { "const": "1.0.0" }
22+
},
23+
"required": ["verb", "version"]
24+
}
25+
]
26+
},
27+
28+
"actor": {
29+
"description": "Logical caller (wallet, ENS name, application, or agent identifier).",
30+
"type": "string",
31+
"minLength": 1,
32+
"maxLength": 256
33+
},
34+
35+
"limits": {
36+
"description": "Guardrails for output size and latency.",
37+
"type": "object",
38+
"additionalProperties": false,
39+
"properties": {
40+
"max_output_tokens": {
41+
"description": "Maximum tokens in the translated output.",
42+
"type": "integer",
43+
"minimum": 1,
44+
"maximum": 32768
45+
},
46+
"max_chars": {
47+
"description": "Maximum characters in the translated output.",
48+
"type": "integer",
49+
"minimum": 1,
50+
"maximum": 500000
51+
},
52+
"max_latency_ms": {
53+
"description": "Optional upper bound on end-to-end latency in milliseconds.",
54+
"type": "integer",
55+
"minimum": 1,
56+
"maximum": 600000
57+
}
58+
},
59+
"required": ["max_output_tokens"]
60+
},
61+
62+
"input": {
63+
"description": "Content to translate and language details.",
64+
"type": "object",
65+
"additionalProperties": false,
66+
"properties": {
67+
"content": {
68+
"description": "Raw text or markup to translate.",
69+
"type": "string",
70+
"minLength": 1,
71+
"maxLength": 250000
72+
},
73+
"source_locale": {
74+
"description": "IETF BCP 47 language tag for the source content (e.g., en-US). If omitted, the agent MAY auto-detect.",
75+
"type": "string",
76+
"minLength": 2,
77+
"maxLength": 32
78+
},
79+
"target_locale": {
80+
"description": "IETF BCP 47 language tag for the desired output language (e.g., es-ES).",
81+
"type": "string",
82+
"minLength": 2,
83+
"maxLength": 32
84+
},
85+
"domain": {
86+
"description": "Domain or subject area (e.g., legal, medical, technical, marketing).",
87+
"type": "string",
88+
"maxLength": 64
89+
},
90+
"formality": {
91+
"description": "Formality preference for the translation.",
92+
"type": "string",
93+
"enum": ["default", "formal", "informal"]
94+
},
95+
"preserve_formatting": {
96+
"description": "Whether the agent should preserve formatting (line breaks, markdown, HTML tags) as much as possible.",
97+
"type": "boolean"
98+
},
99+
"glossary": {
100+
"description": "Optional glossary of term-level mappings that SHOULD be honored.",
101+
"type": "array",
102+
"items": {
103+
"type": "object",
104+
"additionalProperties": false,
105+
"properties": {
106+
"source_term": {
107+
"description": "Term in the source language.",
108+
"type": "string",
109+
"minLength": 1,
110+
"maxLength": 256
111+
},
112+
"target_term": {
113+
"description": "Desired translation for this term in the target language.",
114+
"type": "string",
115+
"minLength": 1,
116+
"maxLength": 256
117+
}
118+
},
119+
"required": ["source_term", "target_term"]
120+
}
121+
},
122+
"tone": {
123+
"description": "Tone hint such as 'neutral', 'friendly', 'serious', 'marketing'.",
124+
"type": "string",
125+
"maxLength": 64
126+
}
127+
},
128+
"required": ["content", "target_locale"]
129+
},
130+
131+
"channel": {
132+
"description": "A2A-style channel configuration describing how this request is transported.",
133+
"type": "object",
134+
"additionalProperties": false,
135+
"properties": {
136+
"protocol": {
137+
"description": "Underlying transport protocol.",
138+
"type": "string",
139+
"enum": ["https", "http", "websocket", "sse", "json-rpc", "queue"]
140+
},
141+
"input_modalities": {
142+
"description": "Modalities used for the request payload.",
143+
"type": "array",
144+
"items": {
145+
"type": "string",
146+
"enum": ["text", "markdown", "html", "json"]
147+
},
148+
"minItems": 1
149+
},
150+
"output_modalities": {
151+
"description": "Modalities expected in the response.",
152+
"type": "array",
153+
"items": {
154+
"type": "string",
155+
"enum": ["text", "markdown", "html", "json"]
156+
},
157+
"minItems": 1
158+
},
159+
"endpoint": {
160+
"description": "Concrete endpoint URI for this invocation (e.g., HTTPS URL, JSON-RPC endpoint).",
161+
"type": "string",
162+
"minLength": 1,
163+
"maxLength": 2048
164+
}
165+
},
166+
"required": ["protocol", "input_modalities", "output_modalities"]
167+
},
168+
169+
"auth": {
170+
"description": "Authentication metadata. Concrete credentials are implementation-specific and MUST NOT be logged in full.",
171+
"type": "object",
172+
"additionalProperties": false,
173+
"properties": {
174+
"scheme": {
175+
"description": "Auth scheme (e.g., none, api_key, oauth2, signed_message).",
176+
"type": "string",
177+
"enum": ["none", "api_key", "oauth2", "signed_message"]
178+
},
179+
"api_key_id": {
180+
"description": "Optional opaque identifier for the API key used.",
181+
"type": "string",
182+
"maxLength": 256
183+
},
184+
"oauth2_client_id": {
185+
"description": "Optional OAuth2 client identifier.",
186+
"type": "string",
187+
"maxLength": 256
188+
},
189+
"actor_wallet": {
190+
"description": "Optional EVM wallet address associated with this request.",
191+
"type": "string",
192+
"pattern": "^0x[a-fA-F0-9]{40}$"
193+
},
194+
"signature": {
195+
"description": "Optional detached signature (e.g., EIP-191) proving possession or intent.",
196+
"type": "string",
197+
"maxLength": 4096
198+
}
199+
}
200+
},
201+
202+
"delegation": {
203+
"description": "Swarm-style delegation policy for multi-agent flows (e.g., handoff to domain-specific translators or reviewers).",
204+
"type": "object",
205+
"additionalProperties": false,
206+
"properties": {
207+
"allowed": {
208+
"description": "Whether the agent is allowed to hand off or delegate this request.",
209+
"type": "boolean"
210+
},
211+
"targets": {
212+
"description": "Preferred downstream agents (e.g., ENS names or canonical identifiers).",
213+
"type": "array",
214+
"items": {
215+
"type": "string",
216+
"minLength": 1,
217+
"maxLength": 256
218+
}
219+
},
220+
"policy": {
221+
"description": "Delegation policy.",
222+
"type": "string",
223+
"enum": ["auto", "manual", "none"]
224+
},
225+
"reason": {
226+
"description": "Human-readable reason or intent for allowing delegation.",
227+
"type": "string",
228+
"maxLength": 1024
229+
}
230+
}
231+
},
232+
233+
"context": {
234+
"description": "Optional conversation or workflow context for multi-step or multi-agent interactions.",
235+
"type": "object",
236+
"additionalProperties": false,
237+
"properties": {
238+
"conversation_id": {
239+
"description": "Logical conversation identifier.",
240+
"type": "string",
241+
"maxLength": 256
242+
},
243+
"parent_task_id": {
244+
"description": "Identifier of the parent task, if this request is part of a larger workflow.",
245+
"type": "string",
246+
"maxLength": 256
247+
},
248+
"thread": {
249+
"description": "Minimal structured history; format is intentionally implementation-defined.",
250+
"type": "array",
251+
"items": {
252+
"type": "object"
253+
}
254+
}
255+
}
256+
},
257+
258+
"metadata": {
259+
"description": "Non-normative metadata for routing, billing, or analytics. MUST NOT change the core semantics of the request.",
260+
"type": "object",
261+
"additionalProperties": true
262+
}
263+
},
264+
265+
"required": ["x402", "actor", "limits", "input", "channel"]
266+
}

0 commit comments

Comments
 (0)