agent-doc-system 0.0.0-stage → 1.0.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 (117) hide show
  1. package/INSTALL_FOR_AGENTS.md +60 -0
  2. package/LICENSE +21 -0
  3. package/README.md +151 -2
  4. package/adapters/cache.mjs +27 -0
  5. package/adapters/contract-consumers.mjs +56 -0
  6. package/adapters/database.mjs +116 -0
  7. package/adapters/deploy-config.mjs +34 -0
  8. package/adapters/dockerfile.mjs +26 -0
  9. package/adapters/events.mjs +145 -0
  10. package/adapters/generic.mjs +86 -0
  11. package/adapters/github-actions.mjs +106 -0
  12. package/adapters/go.mjs +91 -0
  13. package/adapters/graphql.mjs +28 -0
  14. package/adapters/index.mjs +55 -0
  15. package/adapters/node.mjs +118 -0
  16. package/adapters/object-store.mjs +64 -0
  17. package/adapters/oidc.mjs +56 -0
  18. package/adapters/openapi.mjs +50 -0
  19. package/adapters/pnpm.mjs +42 -0
  20. package/adapters/protobuf.mjs +35 -0
  21. package/adapters/registry.mjs +27 -0
  22. package/adapters/resource-client.mjs +61 -0
  23. package/adapters/turborepo.mjs +135 -0
  24. package/adapters/typescript.mjs +85 -0
  25. package/adapters/wrangler.mjs +206 -0
  26. package/bin/agentdoc.mjs +478 -0
  27. package/bin/usage.txt +26 -0
  28. package/core/acceptances.mjs +69 -0
  29. package/core/audit.mjs +407 -0
  30. package/core/authority/classes.mjs +39 -0
  31. package/core/authority/engine.mjs +243 -0
  32. package/core/authority/facts.mjs +41 -0
  33. package/core/codes.mjs +119 -0
  34. package/core/compile.mjs +881 -0
  35. package/core/contracts.mjs +121 -0
  36. package/core/derive.mjs +102 -0
  37. package/core/descriptors.mjs +486 -0
  38. package/core/determinism.mjs +95 -0
  39. package/core/discover.mjs +147 -0
  40. package/core/facts.mjs +53 -0
  41. package/core/fsx.mjs +342 -0
  42. package/core/graph.mjs +260 -0
  43. package/core/impact.mjs +175 -0
  44. package/core/indexes.mjs +165 -0
  45. package/core/jsonschema.mjs +298 -0
  46. package/core/observations.mjs +129 -0
  47. package/core/provenance.mjs +83 -0
  48. package/core/query.mjs +384 -0
  49. package/core/relations.mjs +286 -0
  50. package/core/scaffold.mjs +322 -0
  51. package/core/secrets.mjs +92 -0
  52. package/core/sourcescan.mjs +88 -0
  53. package/core/toml.mjs +163 -0
  54. package/core/yaml.mjs +475 -0
  55. package/docs/ADAPTERS.md +172 -0
  56. package/docs/AUTHORITY.md +260 -0
  57. package/docs/CI.md +136 -0
  58. package/docs/COMPARISON-KODA.md +164 -0
  59. package/docs/EVALS.md +166 -0
  60. package/docs/MIGRATION.md +193 -0
  61. package/docs/PROVENANCE.md +133 -0
  62. package/docs/QUERY.md +180 -0
  63. package/docs/SPEC.md +339 -0
  64. package/docs/VERIFICATION.md +28 -0
  65. package/docs/ci/generic-ci.sh +28 -0
  66. package/docs/ci/github-actions.yml +35 -0
  67. package/evals/harness.mjs +426 -0
  68. package/evals/scenarios/fixture-a-01-change-api.json +9 -0
  69. package/evals/scenarios/fixture-a-02-change-db.json +9 -0
  70. package/evals/scenarios/fixture-a-03-enforce-constraint.json +9 -0
  71. package/evals/scenarios/fixture-b-01-change-proto.json +9 -0
  72. package/evals/scenarios/fixture-b-02-change-write-path.json +9 -0
  73. package/evals/scenarios/fixture-b-03-change-shared-lib.json +9 -0
  74. package/evals/scenarios/fixture-b-04-journey.json +9 -0
  75. package/evals/scenarios/fixture-c-01-mixed-runtime-edge.json +19 -0
  76. package/evals/scenarios/fixture-c-02-stale-doc-contradiction.json +9 -0
  77. package/evals/scenarios/fixture-c-03-shared-vocabulary.json +9 -0
  78. package/evals/scenarios/fixture-c-04-contract-change.json +9 -0
  79. package/evals/scenarios/koda-01-modify-api-consumer.json +26 -0
  80. package/evals/scenarios/koda-02-change-db-schema.json +20 -0
  81. package/evals/scenarios/koda-03-change-auth.json +21 -0
  82. package/evals/scenarios/koda-04-add-event-producer.json +19 -0
  83. package/evals/scenarios/koda-05-modify-worker-binding.json +25 -0
  84. package/evals/scenarios/koda-06-change-cross-component-endpoint.json +22 -0
  85. package/evals/scenarios/koda-07-change-shared-package.json +16 -0
  86. package/evals/scenarios/koda-08-change-runtime-cron.json +23 -0
  87. package/evals/scenarios/koda-09-debug-production-mismatch.json +26 -0
  88. package/evals/thresholds.json +11 -0
  89. package/package.json +46 -4
  90. package/schemas/api.schema.json +84 -0
  91. package/schemas/common.schema.json +107 -0
  92. package/schemas/component.schema.json +40 -0
  93. package/schemas/config.schema.json +685 -0
  94. package/schemas/domain.schema.json +14 -0
  95. package/schemas/graph.schema.json +1084 -0
  96. package/schemas/journeys.schema.json +47 -0
  97. package/schemas/observation.schema.json +143 -0
  98. package/schemas/resource.schema.json +28 -0
  99. package/schemas/system.schema.json +26 -0
  100. package/skills/agent-doc-system/SKILL.md +113 -0
  101. package/skills/agent-doc-system/references/authority-and-conflicts.md +70 -0
  102. package/skills/agent-doc-system/references/cli.md +89 -0
  103. package/skills/agent-doc-system/references/create-migrate.md +101 -0
  104. package/skills/agent-doc-system/references/maintenance.md +52 -0
  105. package/templates/ADR.md +26 -0
  106. package/templates/ARCHITECTURE.md +19 -0
  107. package/templates/CONSTRAINTS.md +17 -0
  108. package/templates/PRODUCT.md +17 -0
  109. package/templates/api.yaml +10 -0
  110. package/templates/ci.yml +31 -0
  111. package/templates/component.yaml +14 -0
  112. package/templates/domain.yaml +6 -0
  113. package/templates/journey.yaml +7 -0
  114. package/templates/observation.yaml +19 -0
  115. package/templates/resource.yaml +8 -0
  116. package/templates/system.yaml +10 -0
  117. package/templates/warning-acceptance.yaml +14 -0
@@ -0,0 +1,1084 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "agentdoc.dev/schema/graph.schema.json",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": [
7
+ "schemaVersion",
8
+ "source",
9
+ "compiler",
10
+ "entities",
11
+ "relations",
12
+ "interfaces",
13
+ "externalDependencies",
14
+ "capabilities",
15
+ "verification",
16
+ "journeys",
17
+ "gates",
18
+ "contracts",
19
+ "assertions",
20
+ "conflicts",
21
+ "observations",
22
+ "provenance",
23
+ "diagnostics"
24
+ ],
25
+ "properties": {
26
+ "schemaVersion": {
27
+ "const": "agentdoc.dev/graph/v1"
28
+ },
29
+ "source": {
30
+ "type": "object",
31
+ "additionalProperties": false,
32
+ "required": [
33
+ "commit",
34
+ "dirty",
35
+ "inputHash"
36
+ ],
37
+ "properties": {
38
+ "commit": {
39
+ "type": "string",
40
+ "pattern": "^[0-9a-f]{7,40}$"
41
+ },
42
+ "dirty": {
43
+ "type": "boolean"
44
+ },
45
+ "inputHash": {
46
+ "type": "string",
47
+ "pattern": "^sha256:[0-9a-f]{64}$"
48
+ }
49
+ }
50
+ },
51
+ "compiler": {
52
+ "type": "object",
53
+ "additionalProperties": false,
54
+ "required": [
55
+ "name",
56
+ "version",
57
+ "adapters"
58
+ ],
59
+ "properties": {
60
+ "name": {
61
+ "const": "agentdoc-compiler"
62
+ },
63
+ "version": {
64
+ "type": "string",
65
+ "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
66
+ },
67
+ "adapters": {
68
+ "type": "array",
69
+ "items": {
70
+ "type": "object",
71
+ "additionalProperties": false,
72
+ "required": [
73
+ "name",
74
+ "version"
75
+ ],
76
+ "properties": {
77
+ "name": {
78
+ "type": "string",
79
+ "pattern": "^[a-z][a-z0-9-]*$"
80
+ },
81
+ "version": {
82
+ "type": "string",
83
+ "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }
89
+ },
90
+ "entities": {
91
+ "type": "array",
92
+ "items": {
93
+ "type": "object",
94
+ "additionalProperties": false,
95
+ "required": [
96
+ "ref",
97
+ "kind",
98
+ "name",
99
+ "entity",
100
+ "source",
101
+ "sourcePaths"
102
+ ],
103
+ "properties": {
104
+ "ref": {
105
+ "type": "string",
106
+ "pattern": "^(domain|system|component|api|resource):[a-z0-9][a-z0-9-]*/[a-z0-9]+(?:-[a-z0-9]+)*$"
107
+ },
108
+ "kind": {
109
+ "enum": [
110
+ "Domain",
111
+ "System",
112
+ "Component",
113
+ "API",
114
+ "Resource"
115
+ ]
116
+ },
117
+ "name": {
118
+ "type": "string"
119
+ },
120
+ "entity": {
121
+ "type": "object"
122
+ },
123
+ "source": {
124
+ "const": "authored"
125
+ },
126
+ "sourcePaths": {
127
+ "type": "array",
128
+ "minItems": 1,
129
+ "items": {
130
+ "type": "string"
131
+ }
132
+ },
133
+ "derived": {
134
+ "type": "object"
135
+ }
136
+ }
137
+ }
138
+ },
139
+ "relations": {
140
+ "type": "array",
141
+ "items": {
142
+ "type": "object",
143
+ "additionalProperties": false,
144
+ "required": [
145
+ "type",
146
+ "sourceRef",
147
+ "targetRef",
148
+ "evidenceClass",
149
+ "attributes",
150
+ "provenanceIds"
151
+ ],
152
+ "properties": {
153
+ "type": {
154
+ "$ref": "#/$defs/relationType"
155
+ },
156
+ "sourceRef": {
157
+ "type": "string"
158
+ },
159
+ "targetRef": {
160
+ "type": "string"
161
+ },
162
+ "evidenceClass": {
163
+ "$ref": "#/$defs/evidenceClass"
164
+ },
165
+ "attributes": {
166
+ "type": "object"
167
+ },
168
+ "provenanceIds": {
169
+ "type": "array",
170
+ "minItems": 1,
171
+ "uniqueItems": true,
172
+ "items": {
173
+ "type": "string"
174
+ }
175
+ }
176
+ }
177
+ }
178
+ },
179
+ "interfaces": {
180
+ "type": "object",
181
+ "additionalProperties": false,
182
+ "required": [
183
+ "events"
184
+ ],
185
+ "properties": {
186
+ "events": {
187
+ "type": "array",
188
+ "items": {
189
+ "type": "object",
190
+ "additionalProperties": false,
191
+ "required": [
192
+ "pattern",
193
+ "producers",
194
+ "consumers",
195
+ "contract",
196
+ "provenanceIds",
197
+ "resolution"
198
+ ],
199
+ "properties": {
200
+ "pattern": {
201
+ "type": "string",
202
+ "minLength": 1,
203
+ "maxLength": 200
204
+ },
205
+ "producers": {
206
+ "type": "array",
207
+ "uniqueItems": true,
208
+ "items": {
209
+ "type": "string"
210
+ }
211
+ },
212
+ "consumers": {
213
+ "type": "array",
214
+ "uniqueItems": true,
215
+ "items": {
216
+ "type": "string"
217
+ }
218
+ },
219
+ "contract": {
220
+ "type": "object",
221
+ "additionalProperties": false,
222
+ "required": [
223
+ "format",
224
+ "ref"
225
+ ],
226
+ "properties": {
227
+ "format": {
228
+ "enum": [
229
+ "code",
230
+ "asyncapi",
231
+ "declared-catalog"
232
+ ]
233
+ },
234
+ "ref": {
235
+ "type": "string"
236
+ }
237
+ }
238
+ },
239
+ "provenanceIds": {
240
+ "type": "array",
241
+ "minItems": 1,
242
+ "items": {
243
+ "type": "string"
244
+ }
245
+ },
246
+ "resolution": {
247
+ "enum": [
248
+ "resolved",
249
+ "unresolved"
250
+ ]
251
+ }
252
+ }
253
+ }
254
+ }
255
+ }
256
+ },
257
+ "externalDependencies": {
258
+ "type": "array",
259
+ "items": {
260
+ "type": "object",
261
+ "additionalProperties": false,
262
+ "required": [
263
+ "componentRef",
264
+ "name",
265
+ "role",
266
+ "mechanism",
267
+ "evidenceClass",
268
+ "provenanceIds"
269
+ ],
270
+ "properties": {
271
+ "componentRef": {
272
+ "type": "string"
273
+ },
274
+ "name": {
275
+ "type": "string",
276
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
277
+ },
278
+ "role": {
279
+ "type": "string",
280
+ "minLength": 1,
281
+ "maxLength": 200
282
+ },
283
+ "mechanism": {
284
+ "enum": [
285
+ "sdk",
286
+ "http",
287
+ "smtp",
288
+ "webhook",
289
+ "platform-binding",
290
+ "file",
291
+ "unknown"
292
+ ]
293
+ },
294
+ "evidenceClass": {
295
+ "$ref": "#/$defs/evidenceClass"
296
+ },
297
+ "provenanceIds": {
298
+ "type": "array",
299
+ "minItems": 1,
300
+ "items": {
301
+ "type": "string"
302
+ }
303
+ }
304
+ }
305
+ }
306
+ },
307
+ "capabilities": {
308
+ "type": "array",
309
+ "items": {
310
+ "type": "object",
311
+ "additionalProperties": false,
312
+ "required": [
313
+ "componentRef",
314
+ "name",
315
+ "evidenceClass",
316
+ "provenanceIds"
317
+ ],
318
+ "properties": {
319
+ "componentRef": {
320
+ "type": "string"
321
+ },
322
+ "name": {
323
+ "type": "string",
324
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
325
+ },
326
+ "evidenceClass": {
327
+ "$ref": "#/$defs/evidenceClass"
328
+ },
329
+ "provenanceIds": {
330
+ "type": "array",
331
+ "minItems": 1,
332
+ "items": {
333
+ "type": "string"
334
+ }
335
+ }
336
+ }
337
+ }
338
+ },
339
+ "verification": {
340
+ "type": "array",
341
+ "items": {
342
+ "type": "object",
343
+ "additionalProperties": false,
344
+ "required": [
345
+ "id",
346
+ "componentRefs",
347
+ "tier",
348
+ "command",
349
+ "provenanceIds"
350
+ ],
351
+ "properties": {
352
+ "id": {
353
+ "type": "string"
354
+ },
355
+ "componentRefs": {
356
+ "type": "array",
357
+ "minItems": 1,
358
+ "items": {
359
+ "type": "string"
360
+ }
361
+ },
362
+ "tier": {
363
+ "enum": [
364
+ "unit",
365
+ "integration",
366
+ "contract",
367
+ "e2e",
368
+ "static",
369
+ "build"
370
+ ]
371
+ },
372
+ "command": {
373
+ "type": "string",
374
+ "minLength": 1,
375
+ "maxLength": 600
376
+ },
377
+ "configPaths": {
378
+ "type": "array",
379
+ "items": {
380
+ "type": "string"
381
+ }
382
+ },
383
+ "provenanceIds": {
384
+ "type": "array",
385
+ "minItems": 1,
386
+ "items": {
387
+ "type": "string"
388
+ }
389
+ }
390
+ }
391
+ }
392
+ },
393
+ "journeys": {
394
+ "type": "array",
395
+ "items": {
396
+ "type": "object",
397
+ "additionalProperties": false,
398
+ "required": [
399
+ "id",
400
+ "description",
401
+ "components",
402
+ "provenanceIds"
403
+ ],
404
+ "properties": {
405
+ "id": {
406
+ "type": "string"
407
+ },
408
+ "description": {
409
+ "type": "string"
410
+ },
411
+ "components": {
412
+ "type": "array",
413
+ "minItems": 2,
414
+ "items": {
415
+ "type": "string"
416
+ }
417
+ },
418
+ "notes": {
419
+ "type": "string"
420
+ },
421
+ "provenanceIds": {
422
+ "type": "array",
423
+ "minItems": 1,
424
+ "items": {
425
+ "type": "string"
426
+ }
427
+ }
428
+ }
429
+ }
430
+ },
431
+ "gates": {
432
+ "description": "Repository-scoped verification gates that name no single component. Recorded once, not duplicated per component.",
433
+ "type": "array",
434
+ "items": {
435
+ "type": "object",
436
+ "additionalProperties": false,
437
+ "required": [
438
+ "id",
439
+ "tier",
440
+ "command",
441
+ "provenanceIds"
442
+ ],
443
+ "properties": {
444
+ "id": {
445
+ "type": "string"
446
+ },
447
+ "tier": {
448
+ "enum": [
449
+ "unit",
450
+ "integration",
451
+ "contract",
452
+ "e2e",
453
+ "static",
454
+ "build"
455
+ ]
456
+ },
457
+ "command": {
458
+ "type": "string"
459
+ },
460
+ "configPaths": {
461
+ "type": "array",
462
+ "items": {
463
+ "type": "string"
464
+ }
465
+ },
466
+ "provenanceIds": {
467
+ "type": "array",
468
+ "minItems": 1,
469
+ "items": {
470
+ "type": "string"
471
+ }
472
+ }
473
+ }
474
+ }
475
+ },
476
+ "contracts": {
477
+ "description": "A pointer into the canonical contract plus the operation inventory an agent needs to locate a handler. The contract itself is never duplicated here.",
478
+ "type": "array",
479
+ "items": {
480
+ "type": "object",
481
+ "additionalProperties": false,
482
+ "required": [
483
+ "apiRef",
484
+ "ref",
485
+ "provenanceIds"
486
+ ],
487
+ "properties": {
488
+ "apiRef": {
489
+ "type": "string"
490
+ },
491
+ "ref": {
492
+ "type": "string"
493
+ },
494
+ "title": {
495
+ "type": "string"
496
+ },
497
+ "operations": {
498
+ "type": "array",
499
+ "items": {
500
+ "type": "object",
501
+ "additionalProperties": false,
502
+ "required": [
503
+ "method",
504
+ "route"
505
+ ],
506
+ "properties": {
507
+ "method": {
508
+ "type": "string"
509
+ },
510
+ "route": {
511
+ "type": "string"
512
+ },
513
+ "operationId": {
514
+ "type": [
515
+ "string",
516
+ "null"
517
+ ]
518
+ }
519
+ }
520
+ }
521
+ },
522
+ "methods": {
523
+ "type": "array",
524
+ "items": {
525
+ "type": "object",
526
+ "additionalProperties": false,
527
+ "required": [
528
+ "service",
529
+ "method",
530
+ "request"
531
+ ],
532
+ "properties": {
533
+ "service": {
534
+ "type": "string"
535
+ },
536
+ "method": {
537
+ "type": "string"
538
+ },
539
+ "request": {
540
+ "type": "string"
541
+ },
542
+ "streaming": {
543
+ "type": "boolean"
544
+ }
545
+ }
546
+ }
547
+ },
548
+ "types": {
549
+ "type": "array",
550
+ "items": {
551
+ "type": "string"
552
+ }
553
+ },
554
+ "queries": {
555
+ "type": "array",
556
+ "items": {
557
+ "type": "string"
558
+ }
559
+ },
560
+ "packages": {
561
+ "type": "array",
562
+ "items": {
563
+ "type": "string"
564
+ }
565
+ },
566
+ "standard": {
567
+ "type": "string"
568
+ },
569
+ "discoveryPath": {
570
+ "type": "string"
571
+ },
572
+ "services": {
573
+ "type": "integer"
574
+ },
575
+ "consumers": {
576
+ "type": "array",
577
+ "items": {
578
+ "type": "string"
579
+ }
580
+ },
581
+ "provenanceIds": {
582
+ "type": "array",
583
+ "items": {
584
+ "type": "string"
585
+ }
586
+ }
587
+ }
588
+ }
589
+ },
590
+ "assertions": {
591
+ "description": "Every claim that more than one evidence class could make about the same subject key. Unambiguous claims are not duplicated here; they live on entities and interfaces. Multiple assertions on the same (subject,key) with different values are a conflict, never a silent reconciliation.",
592
+ "type": "array",
593
+ "items": {
594
+ "type": "object",
595
+ "additionalProperties": false,
596
+ "required": [
597
+ "id",
598
+ "subject",
599
+ "key",
600
+ "value",
601
+ "evidenceClass",
602
+ "confidence",
603
+ "status",
604
+ "provenanceIds"
605
+ ],
606
+ "properties": {
607
+ "id": {
608
+ "type": "string"
609
+ },
610
+ "subject": {
611
+ "type": "string"
612
+ },
613
+ "key": {
614
+ "type": "string"
615
+ },
616
+ "value": {},
617
+ "evidenceClass": {
618
+ "$ref": "#/$defs/evidenceClass"
619
+ },
620
+ "confidence": {
621
+ "enum": [
622
+ "direct",
623
+ "deterministic",
624
+ "declared",
625
+ "reviewed",
626
+ "candidate"
627
+ ]
628
+ },
629
+ "status": {
630
+ "enum": [
631
+ "elected",
632
+ "contradicted",
633
+ "unresolved",
634
+ "candidate",
635
+ "superseded"
636
+ ]
637
+ },
638
+ "semantics": {
639
+ "type": "string"
640
+ },
641
+ "observed": {
642
+ "$ref": "#/$defs/observation"
643
+ },
644
+ "review": {
645
+ "$ref": "#/$defs/review"
646
+ },
647
+ "provenanceIds": {
648
+ "type": "array",
649
+ "minItems": 1,
650
+ "items": {
651
+ "type": "string"
652
+ }
653
+ }
654
+ }
655
+ }
656
+ },
657
+ "conflicts": {
658
+ "type": "array",
659
+ "items": {
660
+ "type": "object",
661
+ "additionalProperties": false,
662
+ "required": [
663
+ "id",
664
+ "subject",
665
+ "key",
666
+ "kind",
667
+ "status",
668
+ "assertionIds",
669
+ "election",
670
+ "provenanceIds"
671
+ ],
672
+ "properties": {
673
+ "id": {
674
+ "type": "string"
675
+ },
676
+ "subject": {
677
+ "type": "string"
678
+ },
679
+ "key": {
680
+ "type": "string"
681
+ },
682
+ "kind": {
683
+ "enum": [
684
+ "contradiction",
685
+ "staleness",
686
+ "supersession",
687
+ "ambiguity",
688
+ "reviewed-divergence"
689
+ ]
690
+ },
691
+ "status": {
692
+ "enum": [
693
+ "unresolved",
694
+ "resolved",
695
+ "accepted"
696
+ ]
697
+ },
698
+ "detail": {
699
+ "type": "string",
700
+ "maxLength": 600
701
+ },
702
+ "assertionIds": {
703
+ "type": "array",
704
+ "minItems": 1,
705
+ "uniqueItems": true,
706
+ "items": {
707
+ "type": "string"
708
+ }
709
+ },
710
+ "election": {
711
+ "type": "object",
712
+ "additionalProperties": false,
713
+ "required": [
714
+ "electedAssertionId",
715
+ "basis",
716
+ "ruleId"
717
+ ],
718
+ "properties": {
719
+ "electedAssertionId": {
720
+ "type": [
721
+ "string",
722
+ "null"
723
+ ]
724
+ },
725
+ "basis": {
726
+ "enum": [
727
+ "authority-rule",
728
+ "superset",
729
+ "recency",
730
+ "reviewed-override",
731
+ "none"
732
+ ]
733
+ },
734
+ "ruleId": {
735
+ "type": "string"
736
+ },
737
+ "rationale": {
738
+ "type": "string",
739
+ "maxLength": 400
740
+ },
741
+ "reviewWhen": {
742
+ "description": "The governing authority rule's re-examination condition. Null when no rule governs the key, which is a real state: the fact stayed unresolved.",
743
+ "type": [
744
+ "string",
745
+ "null"
746
+ ]
747
+ },
748
+ "contradictedAssertionIds": {
749
+ "type": "array",
750
+ "items": {
751
+ "type": "string"
752
+ }
753
+ }
754
+ }
755
+ },
756
+ "acceptance": {
757
+ "$ref": "common.json#/$defs/warningAcceptance"
758
+ },
759
+ "provenanceIds": {
760
+ "type": "array",
761
+ "minItems": 1,
762
+ "items": {
763
+ "type": "string"
764
+ }
765
+ }
766
+ }
767
+ }
768
+ },
769
+ "observations": {
770
+ "type": "array",
771
+ "items": {
772
+ "type": "object",
773
+ "additionalProperties": false,
774
+ "required": [
775
+ "id",
776
+ "environment",
777
+ "sourceSystem",
778
+ "collector",
779
+ "capturedAt",
780
+ "maxAgeDays",
781
+ "evidenceBundle",
782
+ "facts",
783
+ "provenanceIds"
784
+ ],
785
+ "properties": {
786
+ "id": {
787
+ "type": "string"
788
+ },
789
+ "name": {
790
+ "type": "string"
791
+ },
792
+ "description": {
793
+ "type": "string"
794
+ },
795
+ "environment": {
796
+ "type": "string"
797
+ },
798
+ "sourceSystem": {
799
+ "type": "string"
800
+ },
801
+ "collector": {
802
+ "type": "string"
803
+ },
804
+ "capturedAt": {
805
+ "type": "string"
806
+ },
807
+ "maxAgeDays": {
808
+ "type": "integer"
809
+ },
810
+ "evidenceBundle": {
811
+ "type": "string"
812
+ },
813
+ "supersedes": {
814
+ "type": [
815
+ "string",
816
+ "null"
817
+ ]
818
+ },
819
+ "facts": {
820
+ "type": "array",
821
+ "minItems": 1,
822
+ "items": {
823
+ "type": "object",
824
+ "additionalProperties": false,
825
+ "required": [
826
+ "id",
827
+ "subject",
828
+ "key",
829
+ "value",
830
+ "assertionId"
831
+ ],
832
+ "properties": {
833
+ "id": {
834
+ "type": "string"
835
+ },
836
+ "subject": {
837
+ "type": "string"
838
+ },
839
+ "key": {
840
+ "type": "string"
841
+ },
842
+ "value": {},
843
+ "semantics": {
844
+ "type": "string"
845
+ },
846
+ "assertionId": {
847
+ "type": "string"
848
+ },
849
+ "observedRefs": {
850
+ "type": "array",
851
+ "items": {
852
+ "type": "string"
853
+ }
854
+ }
855
+ }
856
+ }
857
+ },
858
+ "provenanceIds": {
859
+ "type": "array",
860
+ "minItems": 1,
861
+ "items": {
862
+ "type": "string"
863
+ }
864
+ }
865
+ }
866
+ }
867
+ },
868
+ "provenance": {
869
+ "type": "array",
870
+ "items": {
871
+ "type": "object",
872
+ "additionalProperties": false,
873
+ "required": [
874
+ "id",
875
+ "class",
876
+ "path",
877
+ "extractor",
878
+ "contentHash",
879
+ "subjects"
880
+ ],
881
+ "properties": {
882
+ "id": {
883
+ "type": "string"
884
+ },
885
+ "class": {
886
+ "enum": [
887
+ "declared",
888
+ "observed",
889
+ "validated",
890
+ "runtime",
891
+ "standard",
892
+ "reviewed"
893
+ ]
894
+ },
895
+ "path": {
896
+ "type": "string"
897
+ },
898
+ "extractor": {
899
+ "type": "object",
900
+ "additionalProperties": false,
901
+ "required": [
902
+ "name",
903
+ "version"
904
+ ],
905
+ "properties": {
906
+ "name": {
907
+ "type": "string",
908
+ "pattern": "^[a-z][a-z0-9-]*$"
909
+ },
910
+ "version": {
911
+ "type": "string"
912
+ }
913
+ }
914
+ },
915
+ "location": {
916
+ "type": "object",
917
+ "additionalProperties": false,
918
+ "properties": {
919
+ "jsonPointer": {
920
+ "type": "string"
921
+ },
922
+ "lineStart": {
923
+ "type": "integer",
924
+ "minimum": 1
925
+ },
926
+ "lineEnd": {
927
+ "type": "integer",
928
+ "minimum": 1
929
+ }
930
+ }
931
+ },
932
+ "contentHash": {
933
+ "type": "string",
934
+ "pattern": "^sha256:[0-9a-f]{64}$"
935
+ },
936
+ "subjects": {
937
+ "type": "array",
938
+ "minItems": 1,
939
+ "uniqueItems": true,
940
+ "items": {
941
+ "type": "string"
942
+ }
943
+ }
944
+ }
945
+ }
946
+ },
947
+ "diagnostics": {
948
+ "type": "array",
949
+ "items": {
950
+ "type": "object",
951
+ "additionalProperties": false,
952
+ "required": [
953
+ "severity",
954
+ "code",
955
+ "message"
956
+ ],
957
+ "properties": {
958
+ "severity": {
959
+ "enum": [
960
+ "error",
961
+ "warning"
962
+ ]
963
+ },
964
+ "code": {
965
+ "type": "string"
966
+ },
967
+ "message": {
968
+ "type": "string"
969
+ },
970
+ "subject": {
971
+ "type": "string"
972
+ },
973
+ "acceptance": {
974
+ "$ref": "common.json#/$defs/warningAcceptance"
975
+ },
976
+ "paths": {
977
+ "type": "array",
978
+ "items": {
979
+ "type": "string"
980
+ }
981
+ },
982
+ "refs": {
983
+ "type": "array",
984
+ "items": {
985
+ "type": "string"
986
+ }
987
+ }
988
+ }
989
+ }
990
+ }
991
+ },
992
+ "$defs": {
993
+ "relationType": {
994
+ "type": "string",
995
+ "enum": [
996
+ "partOf",
997
+ "hasPart",
998
+ "providesApi",
999
+ "apiProvidedBy",
1000
+ "consumesApi",
1001
+ "apiConsumedBy",
1002
+ "buildDependsOn",
1003
+ "buildDependencyOf",
1004
+ "testDependsOn",
1005
+ "testDependencyOf",
1006
+ "runtimeCalls",
1007
+ "runtimeCalledBy",
1008
+ "usesResource",
1009
+ "resourceUsedBy",
1010
+ "schedules",
1011
+ "scheduledBy"
1012
+ ]
1013
+ },
1014
+ "evidenceClass": {
1015
+ "type": "string",
1016
+ "enum": [
1017
+ "AUTHORED",
1018
+ "DERIVED",
1019
+ "OBSERVED_RUNTIME",
1020
+ "EXTERNAL_STANDARD",
1021
+ "REVIEWED_OVERRIDE",
1022
+ "UNRESOLVED"
1023
+ ]
1024
+ },
1025
+ "observation": {
1026
+ "type": "object",
1027
+ "additionalProperties": false,
1028
+ "required": [
1029
+ "at",
1030
+ "environment",
1031
+ "sourceSystem",
1032
+ "collector",
1033
+ "evidenceBundle",
1034
+ "retrievalMethod"
1035
+ ],
1036
+ "properties": {
1037
+ "at": {
1038
+ "type": "string"
1039
+ },
1040
+ "environment": {
1041
+ "type": "string"
1042
+ },
1043
+ "sourceSystem": {
1044
+ "type": "string"
1045
+ },
1046
+ "collector": {
1047
+ "type": "string"
1048
+ },
1049
+ "evidenceBundle": {
1050
+ "type": "string"
1051
+ },
1052
+ "retrievalMethod": {
1053
+ "type": "string"
1054
+ },
1055
+ "supersedes": {
1056
+ "type": [
1057
+ "string",
1058
+ "null"
1059
+ ]
1060
+ }
1061
+ }
1062
+ },
1063
+ "review": {
1064
+ "type": "object",
1065
+ "additionalProperties": false,
1066
+ "required": [
1067
+ "reason",
1068
+ "reviewWhen"
1069
+ ],
1070
+ "description": "Review provenance for an interpreted fact. The reviewer and the date are not typed in: they are the commit that changed the configuration carrying this record, which is stronger evidence than a string in a data file.",
1071
+ "properties": {
1072
+ "reason": {
1073
+ "$ref": "common.json#/$defs/rationale"
1074
+ },
1075
+ "reviewWhen": {
1076
+ "$ref": "common.json#/$defs/rationale"
1077
+ },
1078
+ "evidence": {
1079
+ "$ref": "common.json#/$defs/evidence"
1080
+ }
1081
+ }
1082
+ }
1083
+ }
1084
+ }