返回 CodeWhale
evidence-v1.schema.json
根目录 / pet / schema / evidence-v1.schema.json
1 {
2 "$schema": "https://json-schema.org/draft/2020-12/schema",
3 "$id": "urn:whalesong:evidence:v1",
4 "title": "Whalesong boundary evidence v1",
5 "description": "Metadata contract; validation is not source authentication. Runtime also enforces unique source/grant IDs, producer sequences and expiry ordering.",
6 "type": "object",
7 "properties": {
8 "format": {
9 "const": "whalesong.evidence/v1"
10 },
11 "name": {
12 "type": "string",
13 "minLength": 1,
14 "maxLength": 256,
15 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
16 },
17 "records": {
18 "type": "array",
19 "maxItems": 100000,
20 "items": {
21 "$ref": "#/$defs/observation"
22 }
23 },
24 "policy": {
25 "$ref": "#/$defs/policy"
26 },
27 "asOf": {
28 "type": "number",
29 "minimum": 0,
30 "maximum": 9007199254740991
31 }
32 },
33 "required": [
34 "format",
35 "name",
36 "records",
37 "policy",
38 "asOf"
39 ],
40 "additionalProperties": false,
41 "$defs": {
42 "observation": {
43 "type": "object",
44 "properties": {
45 "version": {
46 "const": 1
47 },
48 "id": {
49 "type": "string",
50 "minLength": 1,
51 "maxLength": 256,
52 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
53 },
54 "runId": {
55 "type": "string",
56 "minLength": 1,
57 "maxLength": 256,
58 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
59 },
60 "operationId": {
61 "type": "string",
62 "minLength": 1,
63 "maxLength": 256,
64 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
65 },
66 "sourceId": {
67 "type": "string",
68 "minLength": 1,
69 "maxLength": 256,
70 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
71 },
72 "epoch": {
73 "type": "string",
74 "minLength": 1,
75 "maxLength": 256,
76 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
77 },
78 "sequence": {
79 "type": "integer",
80 "minimum": 1,
81 "maximum": 9007199254740991
82 },
83 "time": {
84 "type": "object",
85 "properties": {
86 "wallMs": {
87 "type": "number",
88 "minimum": 0,
89 "maximum": 9007199254740991
90 },
91 "clockId": {
92 "type": "string",
93 "minLength": 1,
94 "maxLength": 256,
95 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
96 },
97 "monotonicMs": {
98 "type": "number",
99 "minimum": 0,
100 "maximum": 9007199254740991
101 },
102 "taskMs": {
103 "type": "number",
104 "minimum": 0,
105 "maximum": 9007199254740991
106 },
107 "uncertaintyMs": {
108 "type": "number",
109 "minimum": 0,
110 "maximum": 9007199254740991
111 }
112 },
113 "required": [
114 "wallMs"
115 ],
116 "additionalProperties": false
117 },
118 "receivedAt": {
119 "type": "number",
120 "minimum": 0,
121 "maximum": 9007199254740991
122 },
123 "subject": {
124 "type": "object",
125 "properties": {
126 "agentId": {
127 "type": "string",
128 "minLength": 1,
129 "maxLength": 256,
130 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
131 },
132 "sandboxId": {
133 "type": "string",
134 "minLength": 1,
135 "maxLength": 256,
136 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
137 },
138 "isolationGroup": {
139 "type": "string",
140 "minLength": 1,
141 "maxLength": 256,
142 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
143 }
144 },
145 "required": [
146 "agentId"
147 ],
148 "additionalProperties": false
149 },
150 "stage": {
151 "enum": [
152 "intent",
153 "dispatch",
154 "runtime",
155 "effect",
156 "control"
157 ]
158 },
159 "surface": {
160 "enum": [
161 "model-api",
162 "http",
163 "mcp",
164 "git",
165 "filesystem",
166 "process",
167 "sandbox",
168 "dns",
169 "socket",
170 "message",
171 "database",
172 "artifact",
173 "browser",
174 "clipboard",
175 "other"
176 ]
177 },
178 "action": {
179 "type": "string",
180 "minLength": 1,
181 "maxLength": 128,
182 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
183 },
184 "effect": {
185 "enum": [
186 "read",
187 "write",
188 "delete",
189 "execute",
190 "publish",
191 "send",
192 "receive",
193 "connect",
194 "grant",
195 "revoke",
196 "none",
197 "unknown"
198 ]
199 },
200 "status": {
201 "enum": [
202 "started",
203 "completed",
204 "error",
205 "unknown"
206 ]
207 },
208 "target": {
209 "type": "object",
210 "properties": {
211 "id": {
212 "type": "string",
213 "minLength": 1,
214 "maxLength": 256,
215 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
216 },
217 "kind": {
218 "type": "string",
219 "minLength": 1,
220 "maxLength": 64,
221 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
222 },
223 "version": {
224 "type": "string",
225 "minLength": 1,
226 "maxLength": 256,
227 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
228 },
229 "boundary": {
230 "enum": [
231 "local",
232 "external",
233 "unknown"
234 ]
235 }
236 },
237 "required": [
238 "id",
239 "kind"
240 ],
241 "additionalProperties": false
242 },
243 "actionDigest": {
244 "type": "string",
245 "minLength": 1,
246 "maxLength": 256,
247 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
248 },
249 "authority": {
250 "type": "object",
251 "properties": {
252 "grantId": {
253 "type": "string",
254 "minLength": 1,
255 "maxLength": 256,
256 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
257 },
258 "claimed": {
259 "type": "boolean"
260 }
261 },
262 "required": [],
263 "additionalProperties": false
264 },
265 "correlation": {
266 "type": "object",
267 "properties": {
268 "sessionId": {
269 "type": "string",
270 "minLength": 1,
271 "maxLength": 256,
272 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
273 },
274 "requestId": {
275 "type": "string",
276 "minLength": 1,
277 "maxLength": 256,
278 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
279 },
280 "parentOperationId": {
281 "type": "string",
282 "minLength": 1,
283 "maxLength": 256,
284 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
285 },
286 "messageId": {
287 "type": "string",
288 "minLength": 1,
289 "maxLength": 256,
290 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
291 }
292 },
293 "required": [],
294 "additionalProperties": false
295 },
296 "facts": {
297 "type": "object",
298 "maxProperties": 48,
299 "propertyNames": {
300 "allOf": [
301 {
302 "type": "string",
303 "minLength": 1,
304 "maxLength": 80,
305 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
306 },
307 {
308 "not": {
309 "enum": [
310 "__proto__",
311 "prototype",
312 "constructor"
313 ]
314 }
315 }
316 ]
317 },
318 "additionalProperties": {
319 "anyOf": [
320 {
321 "type": "string",
322 "minLength": 1,
323 "maxLength": 512,
324 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
325 },
326 {
327 "type": "number",
328 "minimum": -9007199254740991,
329 "maximum": 9007199254740991
330 },
331 {
332 "type": [
333 "boolean",
334 "null"
335 ]
336 }
337 ]
338 }
339 }
340 },
341 "required": [
342 "version",
343 "id",
344 "runId",
345 "sourceId",
346 "epoch",
347 "sequence",
348 "time",
349 "subject",
350 "stage",
351 "surface",
352 "action",
353 "effect",
354 "status"
355 ],
356 "additionalProperties": false
357 },
358 "source": {
359 "type": "object",
360 "properties": {
361 "id": {
362 "type": "string",
363 "minLength": 1,
364 "maxLength": 256,
365 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
366 },
367 "stages": {
368 "type": "array",
369 "items": {
370 "enum": [
371 "intent",
372 "dispatch",
373 "runtime",
374 "effect",
375 "control"
376 ]
377 },
378 "minItems": 1,
379 "maxItems": 256,
380 "uniqueItems": true
381 },
382 "surfaces": {
383 "type": "array",
384 "items": {
385 "enum": [
386 "model-api",
387 "http",
388 "mcp",
389 "git",
390 "filesystem",
391 "process",
392 "sandbox",
393 "dns",
394 "socket",
395 "message",
396 "database",
397 "artifact",
398 "browser",
399 "clipboard",
400 "other"
401 ]
402 },
403 "minItems": 1,
404 "maxItems": 256,
405 "uniqueItems": true
406 },
407 "runIds": {
408 "type": "array",
409 "items": {
410 "type": "string",
411 "minLength": 1,
412 "maxLength": 256,
413 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
414 },
415 "minItems": 1,
416 "maxItems": 256,
417 "uniqueItems": true
418 },
419 "sandboxIds": {
420 "type": "array",
421 "items": {
422 "type": "string",
423 "minLength": 1,
424 "maxLength": 256,
425 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
426 },
427 "minItems": 1,
428 "maxItems": 256,
429 "uniqueItems": true
430 },
431 "isolationGroups": {
432 "type": "array",
433 "items": {
434 "type": "string",
435 "minLength": 1,
436 "maxLength": 256,
437 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
438 },
439 "minItems": 1,
440 "maxItems": 256,
441 "uniqueItems": true
442 },
443 "heartbeatMs": {
444 "type": "number",
445 "minimum": 1,
446 "maximum": 9007199254740991
447 },
448 "description": {
449 "type": "string",
450 "minLength": 1,
451 "maxLength": 256,
452 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
453 }
454 },
455 "required": [
456 "id",
457 "stages",
458 "surfaces",
459 "runIds",
460 "heartbeatMs"
461 ],
462 "additionalProperties": false
463 },
464 "grant": {
465 "type": "object",
466 "properties": {
467 "id": {
468 "type": "string",
469 "minLength": 1,
470 "maxLength": 256,
471 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
472 },
473 "runIds": {
474 "type": "array",
475 "items": {
476 "type": "string",
477 "minLength": 1,
478 "maxLength": 256,
479 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
480 },
481 "minItems": 1,
482 "maxItems": 256,
483 "uniqueItems": true
484 },
485 "sandboxIds": {
486 "type": "array",
487 "items": {
488 "type": "string",
489 "minLength": 1,
490 "maxLength": 256,
491 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
492 },
493 "minItems": 1,
494 "maxItems": 256,
495 "uniqueItems": true
496 },
497 "targetIds": {
498 "type": "array",
499 "items": {
500 "type": "string",
501 "minLength": 1,
502 "maxLength": 256,
503 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
504 },
505 "minItems": 1,
506 "maxItems": 256,
507 "uniqueItems": true
508 },
509 "actions": {
510 "type": "array",
511 "items": {
512 "type": "string",
513 "minLength": 1,
514 "maxLength": 256,
515 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
516 },
517 "minItems": 1,
518 "maxItems": 256,
519 "uniqueItems": true
520 },
521 "effects": {
522 "type": "array",
523 "items": {
524 "enum": [
525 "read",
526 "write",
527 "delete",
528 "execute",
529 "publish",
530 "send",
531 "receive",
532 "connect",
533 "grant",
534 "revoke",
535 "none",
536 "unknown"
537 ]
538 },
539 "minItems": 1,
540 "maxItems": 256,
541 "uniqueItems": true
542 },
543 "notBefore": {
544 "type": "number",
545 "minimum": 0,
546 "maximum": 9007199254740991
547 },
548 "expiresAt": {
549 "type": "number",
550 "minimum": 0,
551 "maximum": 9007199254740991
552 },
553 "actionDigest": {
554 "type": "string",
555 "minLength": 1,
556 "maxLength": 256,
557 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
558 }
559 },
560 "required": [
561 "id",
562 "runIds",
563 "sandboxIds",
564 "targetIds",
565 "actions",
566 "effects",
567 "notBefore",
568 "expiresAt"
569 ],
570 "additionalProperties": false
571 },
572 "policy": {
573 "type": "object",
574 "properties": {
575 "version": {
576 "const": 1
577 },
578 "id": {
579 "type": "string",
580 "minLength": 1,
581 "maxLength": 256,
582 "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
583 },
584 "sources": {
585 "type": "array",
586 "items": {
587 "$ref": "#/$defs/source"
588 },
589 "minItems": 0,
590 "maxItems": 256,
591 "uniqueItems": true
592 },
593 "grants": {
594 "type": "array",
595 "items": {
596 "$ref": "#/$defs/grant"
597 },
598 "minItems": 0,
599 "maxItems": 2048,
600 "uniqueItems": true
601 },
602 "expectedSurfaces": {
603 "type": "array",
604 "items": {
605 "enum": [
606 "model-api",
607 "http",
608 "mcp",
609 "git",
610 "filesystem",
611 "process",
612 "sandbox",
613 "dns",
614 "socket",
615 "message",
616 "database",
617 "artifact",
618 "browser",
619 "clipboard",
620 "other"
621 ]
622 },
623 "minItems": 0,
624 "maxItems": 256,
625 "uniqueItems": true
626 },
627 "forbiddenCrossGroup": {
628 "type": "boolean"
629 }
630 },
631 "required": [
632 "version",
633 "id",
634 "sources",
635 "grants",
636 "expectedSurfaces",
637 "forbiddenCrossGroup"
638 ],
639 "additionalProperties": false
640 }
641 }
642 }
643
643 lines JSON