ALL

For reading and verification only. You may not copy, use, modify or redistribute this code. Full notice on the main page.

contracts/schemas/common.schema.json

SHA-256: ed88637eaedd2a79c02ce0b00cbd789061660929c045477e1faf687c95786fdf
208 lines · 4480 bytes · View on GitHub

1{
2 "$schema": "https://json-schema.org/draft/2020-12/schema",
3 "$id": "https://all-mcp.fyi/contracts/v2/common.schema.json",
4 "title": "Shared definitions of the ALL 2.0 contracts. Every pattern equals the matching key of contracts/policy.json (the contract test suite pins it).",
5 "$defs": {
6 "epoch_s": {
7 "type": "integer",
8 "minimum": 1,
9 "maximum": 4102444800
10 },
11 "epoch_ms": {
12 "type": "integer",
13 "minimum": 1,
14 "maximum": 8640000000000000
15 },
16 "count": {
17 "type": "integer",
18 "minimum": 0,
19 "maximum": 9007199254740991
20 },
21 "device_id": {
22 "type": "string",
23 "pattern": "^[a-f0-9]{32}$"
24 },
25 "label": {
26 "type": "string",
27 "pattern": "^[a-z2-7]{20}$"
28 },
29 "fqdn": {
30 "type": "string",
31 "maxLength": 253,
32 "pattern": "^[a-z2-7]{20}\\.(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,63}$"
33 },
34 "dns_host": {
35 "type": "string",
36 "maxLength": 253,
37 "pattern": "^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,63}$"
38 },
39 "acme_name": {
40 "type": "string",
41 "maxLength": 253,
42 "pattern": "^_acme-challenge\\.[a-z2-7]{20}\\.(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z]{2,63}$"
43 },
44 "node_id": {
45 "type": "string",
46 "pattern": "^[a-z0-9]{1,16}$"
47 },
48 "stream_id": {
49 "type": "string",
50 "pattern": "^[0-9a-f]{32}$"
51 },
52 "attach_secret": {
53 "type": "string",
54 "pattern": "^[A-Za-z0-9_-]{43}$"
55 },
56 "nonce": {
57 "type": "string",
58 "pattern": "^[A-Za-z0-9_-]{22,64}$"
59 },
60 "jti": {
61 "type": "string",
62 "pattern": "^[A-Za-z0-9_-]{16,128}$"
63 },
64 "kid": {
65 "type": "string",
66 "pattern": "^[A-Za-z0-9._-]{1,128}$"
67 },
68 "sha256_b64url": {
69 "type": "string",
70 "pattern": "^[A-Za-z0-9_-]{43}$"
71 },
72 "reservation_id": {
73 "type": "string",
74 "pattern": "^[0-9a-f]{32}$"
75 },
76 "ip": {
77 "type": "string",
78 "format": "ip"
79 },
80 "reason_word": {
81 "type": "string",
82 "pattern": "^[a-z_]{1,48}$"
83 },
84 "jwt": {
85 "type": "string",
86 "maxLength": 65552,
87 "pattern": "^[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+$"
88 },
89 "error_code": {
90 "type": "string",
91 "enum": [
92 "bad_hello",
93 "bad_command",
94 "unsupported_version",
95 "bad_proof",
96 "auth",
97 "clock_skew",
98 "unknown_stream",
99 "bad_attach",
100 "license_inactive",
101 "device_revoked",
102 "paused",
103 "busy",
104 "control_unavailable",
105 "line_too_long"
106 ]
107 },
108 "close_reason": {
109 "type": "string",
110 "enum": [
111 "replaced",
112 "revoked",
113 "expired",
114 "released",
115 "killed",
116 "paused",
117 "drain",
118 "idle",
119 "protocol",
120 "shutdown"
121 ]
122 },
123 "source_class": {
124 "type": "string",
125 "enum": [
126 "openai",
127 "hint",
128 "anon"
129 ]
130 },
131 "authorize_status": {
132 "type": "string",
133 "enum": [
134 "active",
135 "gated",
136 "paused"
137 ]
138 },
139 "budget_class": {
140 "type": "string",
141 "enum": [
142 "paid",
143 "trial",
144 "flex"
145 ]
146 },
147 "public_jwk": {
148 "type": "object",
149 "required": [
150 "kty",
151 "crv",
152 "x"
153 ],
154 "additionalProperties": false,
155 "properties": {
156 "kty": {
157 "const": "OKP"
158 },
159 "crv": {
160 "const": "Ed25519"
161 },
162 "x": {
163 "type": "string",
164 "pattern": "^[A-Za-z0-9_-]{43}$"
165 }
166 }
167 },
168 "node": {
169 "type": "object",
170 "required": [
171 "id",
172 "host",
173 "port"
174 ],
175 "additionalProperties": false,
176 "properties": {
177 "id": {
178 "$ref": "#/$defs/node_id"
179 },
180 "host": {
181 "$ref": "#/$defs/dns_host"
182 },
183 "port": {
184 "type": "integer",
185 "minimum": 1,
186 "maximum": 65535
187 },
188 "pins": {
189 "type": "array",
190 "minItems": 1,
191 "maxItems": 4,
192 "uniqueItems": true,
193 "items": {
194 "$ref": "#/$defs/sha256_b64url"
195 }
196 }
197 }
198 },
199 "nodes": {
200 "type": "array",
201 "minItems": 1,
202 "maxItems": 8,
203 "items": {
204 "$ref": "#/$defs/node"
205 }
206 }
207 }
208}