@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,107 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2019-09/schema#",
3
+ "title": "control_mapping",
4
+ "description": "Runfile control_mapping schemas. Source: src/control-mapping.ts (Zod). Do not edit by hand.",
5
+ "$ref": "#/definitions/_RunfileBundle",
6
+ "definitions": {
7
+ "ControlMapping": {
8
+ "type": "object",
9
+ "properties": {
10
+ "mapping_version": {
11
+ "type": "string",
12
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
13
+ },
14
+ "framework": {
15
+ "type": "string"
16
+ },
17
+ "framework_version": {
18
+ "type": "string"
19
+ },
20
+ "published_at": {
21
+ "type": "string",
22
+ "format": "date-time"
23
+ },
24
+ "controls": {
25
+ "type": "array",
26
+ "items": {
27
+ "type": "object",
28
+ "properties": {
29
+ "control_id": {
30
+ "type": "string"
31
+ },
32
+ "title": {
33
+ "type": "string"
34
+ },
35
+ "description": {
36
+ "type": "string"
37
+ },
38
+ "regulatory_tags": {
39
+ "type": "array",
40
+ "items": {
41
+ "type": "string",
42
+ "pattern": "^[a-z0-9_]+$"
43
+ }
44
+ },
45
+ "predicates": {
46
+ "type": "array",
47
+ "items": {
48
+ "type": "object",
49
+ "properties": {
50
+ "kind": {
51
+ "type": "string",
52
+ "enum": [
53
+ "event_count",
54
+ "event_exists",
55
+ "event_absent",
56
+ "aggregate"
57
+ ]
58
+ },
59
+ "expression": {
60
+ "type": "string"
61
+ },
62
+ "threshold": {
63
+ "type": "number"
64
+ }
65
+ },
66
+ "required": [
67
+ "kind",
68
+ "expression"
69
+ ],
70
+ "additionalProperties": false
71
+ }
72
+ }
73
+ },
74
+ "required": [
75
+ "control_id",
76
+ "title",
77
+ "description",
78
+ "regulatory_tags",
79
+ "predicates"
80
+ ],
81
+ "additionalProperties": false
82
+ }
83
+ }
84
+ },
85
+ "required": [
86
+ "mapping_version",
87
+ "framework",
88
+ "framework_version",
89
+ "published_at",
90
+ "controls"
91
+ ],
92
+ "additionalProperties": false
93
+ },
94
+ "_RunfileBundle": {
95
+ "type": "object",
96
+ "properties": {
97
+ "ControlMapping": {
98
+ "$ref": "#/definitions/ControlMapping"
99
+ }
100
+ },
101
+ "required": [
102
+ "ControlMapping"
103
+ ],
104
+ "additionalProperties": false
105
+ }
106
+ }
107
+ }
@@ -0,0 +1,600 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2019-09/schema#",
3
+ "title": "event",
4
+ "description": "Runfile event schemas. Source: src/event.ts (Zod). Do not edit by hand.",
5
+ "$ref": "#/definitions/_RunfileBundle",
6
+ "definitions": {
7
+ "RunfileEvent": {
8
+ "type": "object",
9
+ "properties": {
10
+ "schema_version": {
11
+ "type": "string",
12
+ "pattern": "^\\d+\\.\\d+\\.\\d+$"
13
+ },
14
+ "event_id": {
15
+ "type": "string",
16
+ "pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
17
+ },
18
+ "tenant_id": {
19
+ "type": "string",
20
+ "pattern": "^tnt_[0-9a-z]{12}$"
21
+ },
22
+ "agent_run_id": {
23
+ "type": "string",
24
+ "pattern": "^run_[0-9A-HJKMNP-TV-Z]{26}$"
25
+ },
26
+ "parent_event_id": {
27
+ "anyOf": [
28
+ {
29
+ "$ref": "#/definitions/RunfileEvent/properties/event_id"
30
+ },
31
+ {
32
+ "type": "null"
33
+ }
34
+ ]
35
+ },
36
+ "captured_at": {
37
+ "type": "string",
38
+ "format": "date-time"
39
+ },
40
+ "received_at": {
41
+ "type": "string",
42
+ "format": "date-time"
43
+ },
44
+ "wall_clock_source": {
45
+ "type": "string",
46
+ "enum": [
47
+ "aws_time_sync",
48
+ "ntp",
49
+ "host_system",
50
+ "unknown"
51
+ ]
52
+ },
53
+ "sdk": {
54
+ "$ref": "#/definitions/SdkMetadata"
55
+ },
56
+ "actor": {
57
+ "$ref": "#/definitions/Actor"
58
+ },
59
+ "action": {
60
+ "$ref": "#/definitions/Action"
61
+ },
62
+ "subject": {
63
+ "$ref": "#/definitions/Subject"
64
+ },
65
+ "model_ref": {
66
+ "$ref": "#/definitions/ModelRef"
67
+ },
68
+ "decision": {
69
+ "$ref": "#/definitions/Decision"
70
+ },
71
+ "payload_ref": {
72
+ "$ref": "#/definitions/PayloadRef"
73
+ },
74
+ "redaction_policy_version": {
75
+ "$ref": "#/definitions/RunfileEvent/properties/schema_version"
76
+ },
77
+ "regulatory_scope_version": {
78
+ "$ref": "#/definitions/RunfileEvent/properties/schema_version"
79
+ },
80
+ "anomaly_flags": {
81
+ "type": "array",
82
+ "items": {
83
+ "$ref": "#/definitions/AnomalyFlag"
84
+ },
85
+ "maxItems": 32
86
+ },
87
+ "environment": {
88
+ "type": "string",
89
+ "enum": [
90
+ "production",
91
+ "staging",
92
+ "development"
93
+ ]
94
+ },
95
+ "labels": {
96
+ "type": "object",
97
+ "additionalProperties": {
98
+ "type": "string",
99
+ "maxLength": 128
100
+ },
101
+ "propertyNames": {
102
+ "pattern": "^[a-z][a-z0-9_]{0,31}$"
103
+ }
104
+ },
105
+ "prev_hash": {
106
+ "type": "string",
107
+ "pattern": "^sha256:[a-f0-9]{64}$"
108
+ },
109
+ "event_hash": {
110
+ "$ref": "#/definitions/RunfileEvent/properties/prev_hash"
111
+ },
112
+ "merkle_inclusion": {
113
+ "$ref": "#/definitions/MerkleInclusion"
114
+ }
115
+ },
116
+ "required": [
117
+ "schema_version",
118
+ "event_id",
119
+ "tenant_id",
120
+ "agent_run_id",
121
+ "parent_event_id",
122
+ "captured_at",
123
+ "received_at",
124
+ "wall_clock_source",
125
+ "sdk",
126
+ "actor",
127
+ "action",
128
+ "subject",
129
+ "redaction_policy_version",
130
+ "prev_hash",
131
+ "event_hash"
132
+ ],
133
+ "additionalProperties": false
134
+ },
135
+ "Actor": {
136
+ "type": "object",
137
+ "properties": {
138
+ "type": {
139
+ "type": "string",
140
+ "enum": [
141
+ "agent",
142
+ "human",
143
+ "tool",
144
+ "system"
145
+ ]
146
+ },
147
+ "agent_identity": {
148
+ "type": "string",
149
+ "pattern": "^did:[a-z][a-z0-9]*:[A-Za-z0-9._:-]+$",
150
+ "description": "DID-format identifier of the agent. Required when type=agent."
151
+ },
152
+ "human_principal": {
153
+ "type": "string",
154
+ "pattern": "^tok_[A-Za-z0-9]{16,64}$",
155
+ "description": "Vault token identifying the human principal."
156
+ },
157
+ "delegation_chain": {
158
+ "type": "array",
159
+ "items": {
160
+ "type": "string"
161
+ },
162
+ "maxItems": 16,
163
+ "default": []
164
+ },
165
+ "tool_id": {
166
+ "type": "string",
167
+ "pattern": "^tool:[a-z0-9_.-]+:[a-z0-9_.-]+$"
168
+ },
169
+ "tool_version_hash": {
170
+ "$ref": "#/definitions/RunfileEvent/properties/prev_hash"
171
+ }
172
+ },
173
+ "required": [
174
+ "type"
175
+ ],
176
+ "additionalProperties": false
177
+ },
178
+ "Action": {
179
+ "type": "object",
180
+ "properties": {
181
+ "kind": {
182
+ "type": "string",
183
+ "enum": [
184
+ "agent_run_start",
185
+ "agent_run_end",
186
+ "graph_node_enter",
187
+ "graph_node_exit",
188
+ "llm_call",
189
+ "tool_call",
190
+ "tool_result",
191
+ "state_read",
192
+ "state_write",
193
+ "decision",
194
+ "handoff",
195
+ "human_approval",
196
+ "human_input",
197
+ "policy_check",
198
+ "anomaly_flag",
199
+ "sdk_diagnostic"
200
+ ]
201
+ },
202
+ "name": {
203
+ "type": "string",
204
+ "maxLength": 256
205
+ },
206
+ "outcome": {
207
+ "type": "string",
208
+ "enum": [
209
+ "success",
210
+ "failure",
211
+ "partial",
212
+ "timeout",
213
+ "cancelled"
214
+ ]
215
+ },
216
+ "duration_ms": {
217
+ "type": "integer",
218
+ "minimum": 0
219
+ }
220
+ },
221
+ "required": [
222
+ "kind",
223
+ "name"
224
+ ],
225
+ "additionalProperties": false
226
+ },
227
+ "Subject": {
228
+ "type": "object",
229
+ "properties": {
230
+ "resource_urn": {
231
+ "type": "string",
232
+ "pattern": "^urn:[a-z0-9][a-z0-9-]{0,31}:.+$",
233
+ "maxLength": 512
234
+ },
235
+ "data_classification": {
236
+ "type": "string",
237
+ "enum": [
238
+ "public",
239
+ "internal",
240
+ "confidential",
241
+ "pii",
242
+ "phi",
243
+ "pci",
244
+ "fci"
245
+ ]
246
+ },
247
+ "regulatory_tags": {
248
+ "type": "array",
249
+ "items": {
250
+ "type": "string",
251
+ "pattern": "^[a-z0-9_]+$"
252
+ },
253
+ "maxItems": 32
254
+ }
255
+ },
256
+ "additionalProperties": false
257
+ },
258
+ "ModelRef": {
259
+ "type": "object",
260
+ "properties": {
261
+ "provider": {
262
+ "type": "string",
263
+ "enum": [
264
+ "anthropic",
265
+ "openai",
266
+ "google",
267
+ "aws_bedrock",
268
+ "azure_openai",
269
+ "ollama",
270
+ "self_hosted",
271
+ "other"
272
+ ]
273
+ },
274
+ "model_id": {
275
+ "type": "string",
276
+ "maxLength": 128
277
+ },
278
+ "model_version_hash": {
279
+ "$ref": "#/definitions/RunfileEvent/properties/prev_hash"
280
+ },
281
+ "system_prompt_hash": {
282
+ "$ref": "#/definitions/RunfileEvent/properties/prev_hash"
283
+ },
284
+ "tools_hash": {
285
+ "$ref": "#/definitions/RunfileEvent/properties/prev_hash"
286
+ },
287
+ "input_tokens": {
288
+ "type": "integer",
289
+ "minimum": 0
290
+ },
291
+ "output_tokens": {
292
+ "type": "integer",
293
+ "minimum": 0
294
+ },
295
+ "temperature": {
296
+ "type": "number",
297
+ "minimum": 0,
298
+ "maximum": 2
299
+ }
300
+ },
301
+ "required": [
302
+ "provider",
303
+ "model_id"
304
+ ],
305
+ "additionalProperties": false
306
+ },
307
+ "Decision": {
308
+ "type": "object",
309
+ "properties": {
310
+ "outcome": {
311
+ "type": "string",
312
+ "enum": [
313
+ "approved",
314
+ "denied",
315
+ "escalated",
316
+ "deferred",
317
+ "no_action",
318
+ "custom"
319
+ ]
320
+ },
321
+ "outcome_label": {
322
+ "type": "string",
323
+ "maxLength": 64
324
+ },
325
+ "confidence": {
326
+ "type": "number",
327
+ "minimum": 0,
328
+ "maximum": 1
329
+ },
330
+ "human_in_the_loop": {
331
+ "type": "boolean"
332
+ },
333
+ "policy_thresholds_crossed": {
334
+ "type": "array",
335
+ "items": {
336
+ "type": "string",
337
+ "maxLength": 64
338
+ },
339
+ "maxItems": 16
340
+ },
341
+ "reversed_by_event": {
342
+ "$ref": "#/definitions/RunfileEvent/properties/event_id"
343
+ }
344
+ },
345
+ "required": [
346
+ "outcome"
347
+ ],
348
+ "additionalProperties": false
349
+ },
350
+ "PayloadRef": {
351
+ "type": "object",
352
+ "properties": {
353
+ "s3_uri": {
354
+ "type": "string",
355
+ "pattern": "^s3:\\/\\/[a-z0-9.-]{3,63}\\/.+$",
356
+ "maxLength": 1024
357
+ },
358
+ "sha256": {
359
+ "$ref": "#/definitions/RunfileEvent/properties/prev_hash"
360
+ },
361
+ "size_bytes": {
362
+ "type": "integer",
363
+ "minimum": 0,
364
+ "maximum": 67108864
365
+ },
366
+ "encryption": {
367
+ "$ref": "#/definitions/PayloadEncryption"
368
+ },
369
+ "content_type": {
370
+ "type": "string",
371
+ "enum": [
372
+ "application/json",
373
+ "text/plain",
374
+ "application/vnd.runfile.llm-request+json",
375
+ "application/vnd.runfile.llm-response+json",
376
+ "application/vnd.runfile.tool-call+json",
377
+ "application/vnd.runfile.tool-result+json",
378
+ "application/vnd.runfile.state-snapshot+json"
379
+ ]
380
+ },
381
+ "redaction_applied": {
382
+ "$ref": "#/definitions/RedactionApplied"
383
+ }
384
+ },
385
+ "required": [
386
+ "s3_uri",
387
+ "sha256",
388
+ "size_bytes",
389
+ "encryption"
390
+ ],
391
+ "additionalProperties": false
392
+ },
393
+ "PayloadEncryption": {
394
+ "type": "object",
395
+ "properties": {
396
+ "algorithm": {
397
+ "type": "string",
398
+ "const": "aes-256-gcm"
399
+ },
400
+ "data_key_wrapped": {
401
+ "type": "string",
402
+ "maxLength": 4096
403
+ },
404
+ "kms_key_arn": {
405
+ "type": "string",
406
+ "pattern": "^arn:aws:kms:[a-z0-9-]+:[0-9]+:key\\/[a-f0-9-]+$"
407
+ }
408
+ },
409
+ "required": [
410
+ "algorithm",
411
+ "data_key_wrapped"
412
+ ],
413
+ "additionalProperties": false
414
+ },
415
+ "RedactionApplied": {
416
+ "type": "object",
417
+ "properties": {
418
+ "redacted_classes": {
419
+ "type": "array",
420
+ "items": {
421
+ "type": "string"
422
+ },
423
+ "maxItems": 32
424
+ },
425
+ "tokenized_classes": {
426
+ "type": "array",
427
+ "items": {
428
+ "type": "string"
429
+ },
430
+ "maxItems": 32
431
+ },
432
+ "classifier_version": {
433
+ "$ref": "#/definitions/RunfileEvent/properties/schema_version"
434
+ }
435
+ },
436
+ "additionalProperties": false
437
+ },
438
+ "AnomalyFlag": {
439
+ "type": "object",
440
+ "properties": {
441
+ "code": {
442
+ "type": "string",
443
+ "enum": [
444
+ "missing_ambient_context",
445
+ "chain_break",
446
+ "out_of_order_arrival",
447
+ "model_version_drift",
448
+ "unknown_agent_identity",
449
+ "data_classification_mismatch",
450
+ "policy_threshold_without_hitl",
451
+ "unauthorized_tool_invocation",
452
+ "redaction_policy_mismatch",
453
+ "schema_version_warning"
454
+ ]
455
+ },
456
+ "severity": {
457
+ "type": "string",
458
+ "enum": [
459
+ "info",
460
+ "warning",
461
+ "error",
462
+ "critical"
463
+ ]
464
+ },
465
+ "detail": {
466
+ "type": "string",
467
+ "maxLength": 1024
468
+ }
469
+ },
470
+ "required": [
471
+ "code",
472
+ "severity"
473
+ ],
474
+ "additionalProperties": false
475
+ },
476
+ "SdkMetadata": {
477
+ "type": "object",
478
+ "properties": {
479
+ "name": {
480
+ "type": "string",
481
+ "enum": [
482
+ "runfile-py",
483
+ "@runfile/sdk"
484
+ ]
485
+ },
486
+ "version": {
487
+ "type": "string",
488
+ "pattern": "^\\d+\\.\\d+\\.\\d+(-[a-z0-9.-]+)?$"
489
+ },
490
+ "framework": {
491
+ "type": "string",
492
+ "enum": [
493
+ "langgraph",
494
+ "langgraph_js",
495
+ "openai_agents",
496
+ "openai_agents_js",
497
+ "anthropic_claude",
498
+ "anthropic_claude_js",
499
+ "mastra",
500
+ "vercel_ai_sdk",
501
+ "mcp_client",
502
+ "otel_generic",
503
+ "manual"
504
+ ]
505
+ },
506
+ "framework_version": {
507
+ "$ref": "#/definitions/SdkMetadata/properties/version"
508
+ },
509
+ "host": {
510
+ "type": "string",
511
+ "maxLength": 256
512
+ }
513
+ },
514
+ "required": [
515
+ "name",
516
+ "version",
517
+ "framework"
518
+ ],
519
+ "additionalProperties": false
520
+ },
521
+ "MerkleInclusion": {
522
+ "type": "object",
523
+ "properties": {
524
+ "manifest_uri": {
525
+ "type": "string",
526
+ "pattern": "^s3:\\/\\/[a-z0-9.-]{3,63}\\/.+$"
527
+ },
528
+ "leaf_index": {
529
+ "type": "integer",
530
+ "minimum": 0
531
+ },
532
+ "merkle_root": {
533
+ "$ref": "#/definitions/RunfileEvent/properties/prev_hash"
534
+ }
535
+ },
536
+ "required": [
537
+ "manifest_uri",
538
+ "leaf_index",
539
+ "merkle_root"
540
+ ],
541
+ "additionalProperties": false
542
+ },
543
+ "_RunfileBundle": {
544
+ "type": "object",
545
+ "properties": {
546
+ "RunfileEvent": {
547
+ "$ref": "#/definitions/RunfileEvent"
548
+ },
549
+ "Actor": {
550
+ "$ref": "#/definitions/Actor"
551
+ },
552
+ "Action": {
553
+ "$ref": "#/definitions/Action"
554
+ },
555
+ "Subject": {
556
+ "$ref": "#/definitions/Subject"
557
+ },
558
+ "ModelRef": {
559
+ "$ref": "#/definitions/ModelRef"
560
+ },
561
+ "Decision": {
562
+ "$ref": "#/definitions/Decision"
563
+ },
564
+ "PayloadRef": {
565
+ "$ref": "#/definitions/PayloadRef"
566
+ },
567
+ "PayloadEncryption": {
568
+ "$ref": "#/definitions/PayloadEncryption"
569
+ },
570
+ "RedactionApplied": {
571
+ "$ref": "#/definitions/RedactionApplied"
572
+ },
573
+ "AnomalyFlag": {
574
+ "$ref": "#/definitions/AnomalyFlag"
575
+ },
576
+ "SdkMetadata": {
577
+ "$ref": "#/definitions/SdkMetadata"
578
+ },
579
+ "MerkleInclusion": {
580
+ "$ref": "#/definitions/MerkleInclusion"
581
+ }
582
+ },
583
+ "required": [
584
+ "RunfileEvent",
585
+ "Actor",
586
+ "Action",
587
+ "Subject",
588
+ "ModelRef",
589
+ "Decision",
590
+ "PayloadRef",
591
+ "PayloadEncryption",
592
+ "RedactionApplied",
593
+ "AnomalyFlag",
594
+ "SdkMetadata",
595
+ "MerkleInclusion"
596
+ ],
597
+ "additionalProperties": false
598
+ }
599
+ }
600
+ }