@runfile-ai/schemas 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +163 -0
  3. package/dist/canonical.d.ts +32 -0
  4. package/dist/canonical.d.ts.map +1 -0
  5. package/dist/canonical.js +46 -0
  6. package/dist/canonical.js.map +1 -0
  7. package/dist/control-mapping.d.ts +85 -0
  8. package/dist/control-mapping.d.ts.map +1 -0
  9. package/dist/control-mapping.js +31 -0
  10. package/dist/control-mapping.js.map +1 -0
  11. package/dist/event.d.ts +866 -0
  12. package/dist/event.d.ts.map +1 -0
  13. package/dist/event.js +289 -0
  14. package/dist/event.js.map +1 -0
  15. package/dist/evidence.d.ts +955 -0
  16. package/dist/evidence.d.ts.map +1 -0
  17. package/dist/evidence.js +31 -0
  18. package/dist/evidence.js.map +1 -0
  19. package/dist/index.d.ts +8 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +8 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/ingest.d.ts +1595 -0
  24. package/dist/ingest.d.ts.map +1 -0
  25. package/dist/ingest.js +177 -0
  26. package/dist/ingest.js.map +1 -0
  27. package/dist/manifest.d.ts +110 -0
  28. package/dist/manifest.d.ts.map +1 -0
  29. package/dist/manifest.js +46 -0
  30. package/dist/manifest.js.map +1 -0
  31. package/dist/vault.d.ts +459 -0
  32. package/dist/vault.d.ts.map +1 -0
  33. package/dist/vault.js +188 -0
  34. package/dist/vault.js.map +1 -0
  35. package/generated/json-schema/control_mapping.json +107 -0
  36. package/generated/json-schema/event.json +600 -0
  37. package/generated/json-schema/evidence.json +721 -0
  38. package/generated/json-schema/ingest.json +800 -0
  39. package/generated/json-schema/manifest.json +148 -0
  40. package/generated/json-schema/vault.json +468 -0
  41. package/package.json +59 -0
@@ -0,0 +1,721 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2019-09/schema#",
3
+ "title": "evidence",
4
+ "description": "Runfile evidence schemas. Source: src/evidence.ts (Zod). Do not edit by hand.",
5
+ "$ref": "#/definitions/_RunfileBundle",
6
+ "definitions": {
7
+ "EvidenceBundle": {
8
+ "type": "object",
9
+ "properties": {
10
+ "bundle_version": {
11
+ "type": "string",
12
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
13
+ },
14
+ "bundle_id": {
15
+ "type": "string",
16
+ "pattern": "^bun_[0-9A-HJKMNP-TV-Z]{26}$"
17
+ },
18
+ "generated_at": {
19
+ "type": "string",
20
+ "format": "date-time"
21
+ },
22
+ "tenant_id": {
23
+ "type": "string",
24
+ "pattern": "^tnt_[0-9a-z]{12}$"
25
+ },
26
+ "engagement_id": {
27
+ "type": "string",
28
+ "pattern": "^eng_[0-9A-HJKMNP-TV-Z]{26}$"
29
+ },
30
+ "period": {
31
+ "type": "object",
32
+ "properties": {
33
+ "from": {
34
+ "type": "string",
35
+ "format": "date-time"
36
+ },
37
+ "to": {
38
+ "type": "string",
39
+ "format": "date-time"
40
+ }
41
+ },
42
+ "required": [
43
+ "from",
44
+ "to"
45
+ ],
46
+ "additionalProperties": false
47
+ },
48
+ "events": {
49
+ "type": "array",
50
+ "items": {
51
+ "type": "object",
52
+ "properties": {
53
+ "schema_version": {
54
+ "type": "string",
55
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
56
+ },
57
+ "event_id": {
58
+ "type": "string",
59
+ "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
60
+ },
61
+ "tenant_id": {
62
+ "type": "string",
63
+ "pattern": "^tnt_[0-9a-z]{12}$"
64
+ },
65
+ "agent_run_id": {
66
+ "type": "string",
67
+ "pattern": "^run_[0-9A-HJKMNP-TV-Z]{26}$"
68
+ },
69
+ "parent_event_id": {
70
+ "anyOf": [
71
+ {
72
+ "$ref": "#/definitions/EvidenceBundle/properties/events/items/properties/event_id"
73
+ },
74
+ {
75
+ "type": "null"
76
+ }
77
+ ]
78
+ },
79
+ "captured_at": {
80
+ "type": "string",
81
+ "format": "date-time"
82
+ },
83
+ "received_at": {
84
+ "type": "string",
85
+ "format": "date-time"
86
+ },
87
+ "wall_clock_source": {
88
+ "type": "string",
89
+ "enum": [
90
+ "aws_time_sync",
91
+ "ntp",
92
+ "host_system",
93
+ "unknown"
94
+ ]
95
+ },
96
+ "sdk": {
97
+ "type": "object",
98
+ "properties": {
99
+ "name": {
100
+ "type": "string",
101
+ "enum": [
102
+ "runfile-py",
103
+ "@runfile/sdk"
104
+ ]
105
+ },
106
+ "version": {
107
+ "type": "string",
108
+ "pattern": "^\\d+\\.\\d+\\.\\d+(-[a-z0-9.-]+)?$"
109
+ },
110
+ "framework": {
111
+ "type": "string",
112
+ "enum": [
113
+ "langgraph",
114
+ "langgraph_js",
115
+ "openai_agents",
116
+ "openai_agents_js",
117
+ "anthropic_claude",
118
+ "anthropic_claude_js",
119
+ "mastra",
120
+ "vercel_ai_sdk",
121
+ "mcp_client",
122
+ "otel_generic",
123
+ "manual"
124
+ ]
125
+ },
126
+ "framework_version": {
127
+ "$ref": "#/definitions/EvidenceBundle/properties/events/items/properties/sdk/properties/version"
128
+ },
129
+ "host": {
130
+ "type": "string",
131
+ "maxLength": 256
132
+ }
133
+ },
134
+ "required": [
135
+ "name",
136
+ "version",
137
+ "framework"
138
+ ],
139
+ "additionalProperties": false
140
+ },
141
+ "actor": {
142
+ "type": "object",
143
+ "properties": {
144
+ "type": {
145
+ "type": "string",
146
+ "enum": [
147
+ "agent",
148
+ "human",
149
+ "tool",
150
+ "system"
151
+ ]
152
+ },
153
+ "agent_identity": {
154
+ "type": "string",
155
+ "pattern": "^did:[a-z][a-z0-9]*:[A-Za-z0-9._:-]+$",
156
+ "description": "DID-format identifier of the agent. Required when type=agent."
157
+ },
158
+ "human_principal": {
159
+ "type": "string",
160
+ "pattern": "^tok_[A-Za-z0-9]{16,64}$",
161
+ "description": "Vault token identifying the human principal."
162
+ },
163
+ "delegation_chain": {
164
+ "type": "array",
165
+ "items": {
166
+ "type": "string"
167
+ },
168
+ "maxItems": 16,
169
+ "default": []
170
+ },
171
+ "tool_id": {
172
+ "type": "string",
173
+ "pattern": "^tool:[a-z0-9_.-]+:[a-z0-9_.-]+$"
174
+ },
175
+ "tool_version_hash": {
176
+ "type": "string",
177
+ "pattern": "^sha256:[a-f0-9]{64}$"
178
+ }
179
+ },
180
+ "required": [
181
+ "type"
182
+ ],
183
+ "additionalProperties": false
184
+ },
185
+ "action": {
186
+ "type": "object",
187
+ "properties": {
188
+ "kind": {
189
+ "type": "string",
190
+ "enum": [
191
+ "agent_run_start",
192
+ "agent_run_end",
193
+ "graph_node_enter",
194
+ "graph_node_exit",
195
+ "llm_call",
196
+ "tool_call",
197
+ "tool_result",
198
+ "state_read",
199
+ "state_write",
200
+ "decision",
201
+ "handoff",
202
+ "human_approval",
203
+ "human_input",
204
+ "policy_check",
205
+ "anomaly_flag",
206
+ "sdk_diagnostic"
207
+ ]
208
+ },
209
+ "name": {
210
+ "type": "string",
211
+ "maxLength": 256
212
+ },
213
+ "outcome": {
214
+ "type": "string",
215
+ "enum": [
216
+ "success",
217
+ "failure",
218
+ "partial",
219
+ "timeout",
220
+ "cancelled"
221
+ ]
222
+ },
223
+ "duration_ms": {
224
+ "type": "integer",
225
+ "minimum": 0
226
+ }
227
+ },
228
+ "required": [
229
+ "kind",
230
+ "name"
231
+ ],
232
+ "additionalProperties": false
233
+ },
234
+ "subject": {
235
+ "type": "object",
236
+ "properties": {
237
+ "resource_urn": {
238
+ "type": "string",
239
+ "pattern": "^urn:[a-z0-9][a-z0-9-]{0,31}:.+$",
240
+ "maxLength": 512
241
+ },
242
+ "data_classification": {
243
+ "type": "string",
244
+ "enum": [
245
+ "public",
246
+ "internal",
247
+ "confidential",
248
+ "pii",
249
+ "phi",
250
+ "pci",
251
+ "fci"
252
+ ]
253
+ },
254
+ "regulatory_tags": {
255
+ "type": "array",
256
+ "items": {
257
+ "type": "string",
258
+ "pattern": "^[a-z0-9_]+$"
259
+ },
260
+ "maxItems": 32
261
+ }
262
+ },
263
+ "additionalProperties": false
264
+ },
265
+ "model_ref": {
266
+ "type": "object",
267
+ "properties": {
268
+ "provider": {
269
+ "type": "string",
270
+ "enum": [
271
+ "anthropic",
272
+ "openai",
273
+ "google",
274
+ "aws_bedrock",
275
+ "azure_openai",
276
+ "ollama",
277
+ "self_hosted",
278
+ "other"
279
+ ]
280
+ },
281
+ "model_id": {
282
+ "type": "string",
283
+ "maxLength": 128
284
+ },
285
+ "model_version_hash": {
286
+ "$ref": "#/definitions/EvidenceBundle/properties/events/items/properties/actor/properties/tool_version_hash"
287
+ },
288
+ "system_prompt_hash": {
289
+ "$ref": "#/definitions/EvidenceBundle/properties/events/items/properties/actor/properties/tool_version_hash"
290
+ },
291
+ "tools_hash": {
292
+ "$ref": "#/definitions/EvidenceBundle/properties/events/items/properties/actor/properties/tool_version_hash"
293
+ },
294
+ "input_tokens": {
295
+ "type": "integer",
296
+ "minimum": 0
297
+ },
298
+ "output_tokens": {
299
+ "type": "integer",
300
+ "minimum": 0
301
+ },
302
+ "temperature": {
303
+ "type": "number",
304
+ "minimum": 0,
305
+ "maximum": 2
306
+ }
307
+ },
308
+ "required": [
309
+ "provider",
310
+ "model_id"
311
+ ],
312
+ "additionalProperties": false
313
+ },
314
+ "decision": {
315
+ "type": "object",
316
+ "properties": {
317
+ "outcome": {
318
+ "type": "string",
319
+ "enum": [
320
+ "approved",
321
+ "denied",
322
+ "escalated",
323
+ "deferred",
324
+ "no_action",
325
+ "custom"
326
+ ]
327
+ },
328
+ "outcome_label": {
329
+ "type": "string",
330
+ "maxLength": 64
331
+ },
332
+ "confidence": {
333
+ "type": "number",
334
+ "minimum": 0,
335
+ "maximum": 1
336
+ },
337
+ "human_in_the_loop": {
338
+ "type": "boolean"
339
+ },
340
+ "policy_thresholds_crossed": {
341
+ "type": "array",
342
+ "items": {
343
+ "type": "string",
344
+ "maxLength": 64
345
+ },
346
+ "maxItems": 16
347
+ },
348
+ "reversed_by_event": {
349
+ "$ref": "#/definitions/EvidenceBundle/properties/events/items/properties/event_id"
350
+ }
351
+ },
352
+ "required": [
353
+ "outcome"
354
+ ],
355
+ "additionalProperties": false
356
+ },
357
+ "payload_ref": {
358
+ "type": "object",
359
+ "properties": {
360
+ "s3_uri": {
361
+ "type": "string",
362
+ "pattern": "^s3:\\/\\/[a-z0-9.-]{3,63}\\/.+$",
363
+ "maxLength": 1024
364
+ },
365
+ "sha256": {
366
+ "$ref": "#/definitions/EvidenceBundle/properties/events/items/properties/actor/properties/tool_version_hash"
367
+ },
368
+ "size_bytes": {
369
+ "type": "integer",
370
+ "minimum": 0,
371
+ "maximum": 67108864
372
+ },
373
+ "encryption": {
374
+ "type": "object",
375
+ "properties": {
376
+ "algorithm": {
377
+ "type": "string",
378
+ "const": "aes-256-gcm"
379
+ },
380
+ "data_key_wrapped": {
381
+ "type": "string",
382
+ "maxLength": 4096
383
+ },
384
+ "kms_key_arn": {
385
+ "type": "string",
386
+ "pattern": "^arn:aws:kms:[a-z0-9-]+:[0-9]+:key\\/[a-f0-9-]+$"
387
+ }
388
+ },
389
+ "required": [
390
+ "algorithm",
391
+ "data_key_wrapped"
392
+ ],
393
+ "additionalProperties": false
394
+ },
395
+ "content_type": {
396
+ "type": "string",
397
+ "enum": [
398
+ "application/json",
399
+ "text/plain",
400
+ "application/vnd.runfile.llm-request+json",
401
+ "application/vnd.runfile.llm-response+json",
402
+ "application/vnd.runfile.tool-call+json",
403
+ "application/vnd.runfile.tool-result+json",
404
+ "application/vnd.runfile.state-snapshot+json"
405
+ ]
406
+ },
407
+ "redaction_applied": {
408
+ "type": "object",
409
+ "properties": {
410
+ "redacted_classes": {
411
+ "type": "array",
412
+ "items": {
413
+ "type": "string"
414
+ },
415
+ "maxItems": 32
416
+ },
417
+ "tokenized_classes": {
418
+ "type": "array",
419
+ "items": {
420
+ "type": "string"
421
+ },
422
+ "maxItems": 32
423
+ },
424
+ "classifier_version": {
425
+ "$ref": "#/definitions/EvidenceBundle/properties/events/items/properties/schema_version"
426
+ }
427
+ },
428
+ "additionalProperties": false
429
+ }
430
+ },
431
+ "required": [
432
+ "s3_uri",
433
+ "sha256",
434
+ "size_bytes",
435
+ "encryption"
436
+ ],
437
+ "additionalProperties": false
438
+ },
439
+ "redaction_policy_version": {
440
+ "$ref": "#/definitions/EvidenceBundle/properties/events/items/properties/schema_version"
441
+ },
442
+ "regulatory_scope_version": {
443
+ "$ref": "#/definitions/EvidenceBundle/properties/events/items/properties/schema_version"
444
+ },
445
+ "anomaly_flags": {
446
+ "type": "array",
447
+ "items": {
448
+ "type": "object",
449
+ "properties": {
450
+ "code": {
451
+ "type": "string",
452
+ "enum": [
453
+ "missing_ambient_context",
454
+ "chain_break",
455
+ "out_of_order_arrival",
456
+ "model_version_drift",
457
+ "unknown_agent_identity",
458
+ "data_classification_mismatch",
459
+ "policy_threshold_without_hitl",
460
+ "unauthorized_tool_invocation",
461
+ "redaction_policy_mismatch",
462
+ "schema_version_warning"
463
+ ]
464
+ },
465
+ "severity": {
466
+ "type": "string",
467
+ "enum": [
468
+ "info",
469
+ "warning",
470
+ "error",
471
+ "critical"
472
+ ]
473
+ },
474
+ "detail": {
475
+ "type": "string",
476
+ "maxLength": 1024
477
+ }
478
+ },
479
+ "required": [
480
+ "code",
481
+ "severity"
482
+ ],
483
+ "additionalProperties": false
484
+ },
485
+ "maxItems": 32
486
+ },
487
+ "environment": {
488
+ "type": "string",
489
+ "enum": [
490
+ "production",
491
+ "staging",
492
+ "development"
493
+ ]
494
+ },
495
+ "labels": {
496
+ "type": "object",
497
+ "additionalProperties": {
498
+ "type": "string",
499
+ "maxLength": 128
500
+ },
501
+ "propertyNames": {
502
+ "pattern": "^[a-z][a-z0-9_]{0,31}$"
503
+ }
504
+ },
505
+ "prev_hash": {
506
+ "$ref": "#/definitions/EvidenceBundle/properties/events/items/properties/actor/properties/tool_version_hash"
507
+ },
508
+ "event_hash": {
509
+ "$ref": "#/definitions/EvidenceBundle/properties/events/items/properties/actor/properties/tool_version_hash"
510
+ },
511
+ "merkle_inclusion": {
512
+ "type": "object",
513
+ "properties": {
514
+ "manifest_uri": {
515
+ "type": "string",
516
+ "pattern": "^s3:\\/\\/[a-z0-9.-]{3,63}\\/.+$"
517
+ },
518
+ "leaf_index": {
519
+ "type": "integer",
520
+ "minimum": 0
521
+ },
522
+ "merkle_root": {
523
+ "$ref": "#/definitions/EvidenceBundle/properties/events/items/properties/actor/properties/tool_version_hash"
524
+ }
525
+ },
526
+ "required": [
527
+ "manifest_uri",
528
+ "leaf_index",
529
+ "merkle_root"
530
+ ],
531
+ "additionalProperties": false
532
+ }
533
+ },
534
+ "required": [
535
+ "schema_version",
536
+ "event_id",
537
+ "tenant_id",
538
+ "agent_run_id",
539
+ "parent_event_id",
540
+ "captured_at",
541
+ "received_at",
542
+ "wall_clock_source",
543
+ "sdk",
544
+ "actor",
545
+ "action",
546
+ "subject",
547
+ "redaction_policy_version",
548
+ "prev_hash",
549
+ "event_hash"
550
+ ],
551
+ "additionalProperties": false
552
+ }
553
+ },
554
+ "manifests": {
555
+ "type": "array",
556
+ "items": {
557
+ "type": "object",
558
+ "properties": {
559
+ "manifest_version": {
560
+ "type": "string",
561
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
562
+ },
563
+ "schema_version": {
564
+ "$ref": "#/definitions/EvidenceBundle/properties/manifests/items/properties/manifest_version"
565
+ },
566
+ "tenant_id": {
567
+ "type": "string",
568
+ "pattern": "^tnt_[0-9a-z]{12}$"
569
+ },
570
+ "day_utc": {
571
+ "type": "string",
572
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
573
+ },
574
+ "built_at": {
575
+ "type": "string",
576
+ "format": "date-time"
577
+ },
578
+ "leaf_count": {
579
+ "type": "integer",
580
+ "minimum": 0
581
+ },
582
+ "merkle_root": {
583
+ "type": "string",
584
+ "pattern": "^sha256:[a-f0-9]{64}$"
585
+ },
586
+ "prev_manifest_root": {
587
+ "anyOf": [
588
+ {
589
+ "$ref": "#/definitions/EvidenceBundle/properties/manifests/items/properties/merkle_root"
590
+ },
591
+ {
592
+ "type": "null"
593
+ }
594
+ ]
595
+ },
596
+ "leaves": {
597
+ "type": "array",
598
+ "items": {
599
+ "type": "object",
600
+ "properties": {
601
+ "event_id": {
602
+ "type": "string",
603
+ "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
604
+ },
605
+ "event_hash": {
606
+ "$ref": "#/definitions/EvidenceBundle/properties/manifests/items/properties/merkle_root"
607
+ },
608
+ "leaf_index": {
609
+ "type": "integer",
610
+ "minimum": 0
611
+ }
612
+ },
613
+ "required": [
614
+ "event_id",
615
+ "event_hash",
616
+ "leaf_index"
617
+ ],
618
+ "additionalProperties": false
619
+ }
620
+ },
621
+ "kms_signature": {
622
+ "type": "object",
623
+ "properties": {
624
+ "kms_key_arn": {
625
+ "type": "string"
626
+ },
627
+ "signing_algorithm": {
628
+ "type": "string"
629
+ },
630
+ "signature_base64": {
631
+ "type": "string"
632
+ }
633
+ },
634
+ "required": [
635
+ "kms_key_arn",
636
+ "signing_algorithm",
637
+ "signature_base64"
638
+ ],
639
+ "additionalProperties": false
640
+ },
641
+ "attestation_document": {
642
+ "type": [
643
+ "string",
644
+ "null"
645
+ ]
646
+ },
647
+ "rekor_entry": {
648
+ "type": "object",
649
+ "properties": {
650
+ "log_index": {
651
+ "type": "integer",
652
+ "minimum": 0
653
+ },
654
+ "log_id": {
655
+ "type": "string"
656
+ },
657
+ "inclusion_proof": {
658
+ "type": "string"
659
+ }
660
+ },
661
+ "required": [
662
+ "log_index",
663
+ "log_id",
664
+ "inclusion_proof"
665
+ ],
666
+ "additionalProperties": false
667
+ }
668
+ },
669
+ "required": [
670
+ "manifest_version",
671
+ "schema_version",
672
+ "tenant_id",
673
+ "day_utc",
674
+ "built_at",
675
+ "leaf_count",
676
+ "merkle_root",
677
+ "prev_manifest_root",
678
+ "leaves",
679
+ "kms_signature",
680
+ "attestation_document"
681
+ ],
682
+ "additionalProperties": false
683
+ }
684
+ },
685
+ "schema_versions_used": {
686
+ "type": "array",
687
+ "items": {
688
+ "$ref": "#/definitions/EvidenceBundle/properties/bundle_version"
689
+ }
690
+ },
691
+ "notes": {
692
+ "type": "string",
693
+ "maxLength": 8192
694
+ }
695
+ },
696
+ "required": [
697
+ "bundle_version",
698
+ "bundle_id",
699
+ "generated_at",
700
+ "tenant_id",
701
+ "period",
702
+ "events",
703
+ "manifests",
704
+ "schema_versions_used"
705
+ ],
706
+ "additionalProperties": false
707
+ },
708
+ "_RunfileBundle": {
709
+ "type": "object",
710
+ "properties": {
711
+ "EvidenceBundle": {
712
+ "$ref": "#/definitions/EvidenceBundle"
713
+ }
714
+ },
715
+ "required": [
716
+ "EvidenceBundle"
717
+ ],
718
+ "additionalProperties": false
719
+ }
720
+ }
721
+ }