hachure 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.
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "hachure",
3
+ "version": "0.1.0",
4
+ "description": "Hachure — canonical distribution of the open trust format: normative JSON schemas, conformance test vectors, and spec constants.",
5
+ "type": "module",
6
+ "main": "./index.mjs",
7
+ "exports": {
8
+ ".": "./index.mjs",
9
+ "./schemas/*.json": "./schemas/*.json",
10
+ "./conformance/*.json": "./conformance/*.json"
11
+ },
12
+ "files": [
13
+ "schemas",
14
+ "conformance",
15
+ "index.mjs",
16
+ "README.md",
17
+ "status-function.md",
18
+ "interop-in-toto.md"
19
+ ],
20
+ "scripts": {
21
+ "test": "node --test test/index.test.mjs"
22
+ },
23
+ "keywords": [
24
+ "trust",
25
+ "format",
26
+ "spec",
27
+ "conformance",
28
+ "hachure"
29
+ ],
30
+ "license": "MIT",
31
+ "publishConfig": {
32
+ "access": "public"
33
+ }
34
+ }
@@ -0,0 +1,82 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://kontourai.io/schemas/surface/claim.schema.json",
4
+ "title": "Kontour Surface Claim",
5
+ "type": "object",
6
+ "required": ["id", "subjectType", "subjectId", "surface", "claimType", "fieldOrBehavior", "value", "createdAt", "updatedAt"],
7
+ "properties": {
8
+ "id": { "type": "string" },
9
+ "subjectType": { "type": "string" },
10
+ "subjectId": { "type": "string" },
11
+ "surface": { "type": "string" },
12
+ "claimType": { "type": "string" },
13
+ "fieldOrBehavior": { "type": "string" },
14
+ "value": {},
15
+ "status": { "enum": ["unknown", "proposed", "assumed", "verified", "stale", "disputed", "superseded", "rejected"] },
16
+ "createdAt": { "type": "string", "format": "date-time" },
17
+ "updatedAt": { "type": "string", "format": "date-time" },
18
+ "impactLevel": { "enum": ["low", "medium", "high", "critical"] },
19
+ "materiality": { "enum": ["low", "medium", "high"] },
20
+ "currentIntegrityRef": { "type": "string" },
21
+ "currentIntegrityAnchor": { "$ref": "#/$defs/integrityAnchor" },
22
+ "verificationPolicyId": { "type": "string" },
23
+ "confidenceBasis": { "type": "object" },
24
+ "subjectAliases": {
25
+ "type": "array",
26
+ "items": {
27
+ "type": "object",
28
+ "required": ["subjectType", "subjectId"],
29
+ "properties": {
30
+ "subjectType": { "type": "string" },
31
+ "subjectId": { "type": "string" }
32
+ },
33
+ "additionalProperties": false
34
+ }
35
+ },
36
+ "derivedFrom": {
37
+ "type": "array",
38
+ "items": { "type": "string" }
39
+ },
40
+ "derivationEdges": {
41
+ "type": "array",
42
+ "items": {
43
+ "type": "object",
44
+ "required": ["inputClaimId"],
45
+ "properties": {
46
+ "inputClaimId": { "type": "string" },
47
+ "method": { "enum": ["sum", "max", "min", "model", "rule-application", "copy", "normalization", "manual"] },
48
+ "role": { "type": "string" },
49
+ "supportStrength": { "enum": ["weak", "moderate", "strong"] },
50
+ "rationale": { "type": "string" },
51
+ "metadata": { "type": "object" }
52
+ },
53
+ "additionalProperties": false
54
+ }
55
+ },
56
+ "qualifiers": {
57
+ "type": "object",
58
+ "additionalProperties": { "type": "string" }
59
+ },
60
+ "metadata": { "type": "object" }
61
+ },
62
+ "$defs": {
63
+ "integrityAnchor": {
64
+ "type": "object",
65
+ "required": ["id", "kind", "algorithm", "value", "sourceRef"],
66
+ "properties": {
67
+ "id": { "type": "string" },
68
+ "kind": { "enum": ["hash", "signature", "transparency_log", "timestamp", "external_ref", "other"] },
69
+ "algorithm": { "type": "string" },
70
+ "value": { "type": "string" },
71
+ "sourceRef": { "type": "string" },
72
+ "observedAt": { "type": "string", "format": "date-time" },
73
+ "verificationStatus": { "enum": ["unverified", "verified", "failed", "not_applicable"] },
74
+ "verifiedAt": { "type": "string", "format": "date-time" },
75
+ "verifiedBy": { "type": "string" },
76
+ "metadata": { "type": "object" }
77
+ },
78
+ "additionalProperties": false
79
+ }
80
+ },
81
+ "additionalProperties": false
82
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://kontourai.io/schemas/surface/derivation-rule.schema.json",
4
+ "title": "Surface DerivationRule",
5
+ "description": "A named, versioned rule composing existing claims into a derived boolean answer (ADR 0003 §5).",
6
+ "type": "object",
7
+ "required": ["id", "version", "name", "target", "requirements", "combinator"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "id": { "type": "string" },
11
+ "version": { "type": "string" },
12
+ "name": { "type": "string" },
13
+ "target": { "$ref": "#/$defs/canonicalClaimTarget" },
14
+ "requirements": {
15
+ "type": "array",
16
+ "items": { "$ref": "#/$defs/derivationRequirement" }
17
+ },
18
+ "combinator": { "enum": ["all", "any"] }
19
+ },
20
+ "$defs": {
21
+ "canonicalClaimTarget": {
22
+ "type": "object",
23
+ "required": ["subjectType", "subjectId", "fieldOrBehavior"],
24
+ "additionalProperties": false,
25
+ "properties": {
26
+ "subjectType": { "type": "string" },
27
+ "subjectId": { "type": "string" },
28
+ "fieldOrBehavior": { "type": "string" },
29
+ "qualifiers": {
30
+ "type": "object",
31
+ "additionalProperties": { "type": "string" }
32
+ }
33
+ }
34
+ },
35
+ "derivationRequirement": {
36
+ "type": "object",
37
+ "required": ["target", "acceptedStatuses"],
38
+ "additionalProperties": false,
39
+ "properties": {
40
+ "target": { "$ref": "#/$defs/canonicalClaimTarget" },
41
+ "acceptedStatuses": {
42
+ "type": "array",
43
+ "items": { "enum": ["unknown", "proposed", "assumed", "verified", "stale", "disputed", "superseded", "rejected"] }
44
+ },
45
+ "predicate": {
46
+ "type": "object",
47
+ "required": ["op"],
48
+ "additionalProperties": false,
49
+ "properties": {
50
+ "op": { "enum": ["eq", "neq", "gt", "gte", "lt", "lte", "in", "exists"] },
51
+ "value": {}
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://kontourai.io/schemas/surface/evidence.schema.json",
4
+ "title": "Kontour Surface Evidence",
5
+ "type": "object",
6
+ "required": ["id", "claimId", "evidenceType", "method", "sourceRef", "excerptOrSummary", "observedAt", "collectedBy"],
7
+ "properties": {
8
+ "id": { "type": "string" },
9
+ "claimId": { "type": "string" },
10
+ "supportStrength": {
11
+ "enum": ["cited", "entails"],
12
+ "description": "Evidence-to-Claim support strength. Omitted means entails for legacy claimId producers; cited means reference/context only and does not satisfy policy support."
13
+ },
14
+ "evidenceType": {
15
+ "enum": ["source_excerpt", "test_output", "human_attestation", "attestation", "calculation_trace", "document_citation", "crawl_observation", "policy_rule"]
16
+ },
17
+ "method": {
18
+ "enum": ["observation", "extraction", "validation", "corroboration", "attestation", "auditability", "anchoring", "monitoring"]
19
+ },
20
+ "sourceRef": { "type": "string" },
21
+ "sourceLocator": { "type": "string" },
22
+ "excerptOrSummary": { "type": "string" },
23
+ "observedAt": { "type": "string", "format": "date-time" },
24
+ "collectedBy": { "type": "string" },
25
+ "integrityRef": { "type": "string" },
26
+ "integrityAnchor": { "$ref": "#/$defs/integrityAnchor" },
27
+ "metadata": { "type": "object" }
28
+ },
29
+ "$defs": {
30
+ "integrityAnchor": {
31
+ "type": "object",
32
+ "required": ["id", "kind", "algorithm", "value", "sourceRef"],
33
+ "properties": {
34
+ "id": { "type": "string" },
35
+ "kind": { "enum": ["hash", "signature", "transparency_log", "timestamp", "external_ref", "other"] },
36
+ "algorithm": { "type": "string" },
37
+ "value": { "type": "string" },
38
+ "sourceRef": { "type": "string" },
39
+ "observedAt": { "type": "string", "format": "date-time" },
40
+ "verificationStatus": { "enum": ["unverified", "verified", "failed", "not_applicable"] },
41
+ "verifiedAt": { "type": "string", "format": "date-time" },
42
+ "verifiedBy": { "type": "string" },
43
+ "metadata": { "type": "object" }
44
+ },
45
+ "additionalProperties": false
46
+ }
47
+ },
48
+ "additionalProperties": false
49
+ }
@@ -0,0 +1,76 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://kontourai.io/schemas/surface/inquiry-record.schema.json",
4
+ "title": "Surface InquiryRecord",
5
+ "description": "Append-only record capturing the resolution of an Inquiry against a TrustBundle (ADR 0003 §6).",
6
+ "type": "object",
7
+ "required": ["id", "inquiry", "outcome", "resolutionPath", "inputSnapshot", "statusFunctionVersion", "resolvedAt"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "id": { "type": "string" },
11
+ "inquiry": { "$ref": "#/$defs/inquiry" },
12
+ "outcome": { "enum": ["matched", "derived", "unsupported"] },
13
+ "resolutionPath": {
14
+ "type": "object",
15
+ "required": ["claimIds"],
16
+ "additionalProperties": false,
17
+ "properties": {
18
+ "claimIds": { "type": "array", "items": { "type": "string" } },
19
+ "ruleId": { "type": "string" },
20
+ "ruleVersion": { "type": "string" }
21
+ }
22
+ },
23
+ "answer": {
24
+ "type": "object",
25
+ "required": ["value", "status"],
26
+ "additionalProperties": false,
27
+ "properties": {
28
+ "value": {},
29
+ "status": { "enum": ["unknown", "proposed", "assumed", "verified", "stale", "disputed", "superseded", "rejected"] }
30
+ }
31
+ },
32
+ "inputSnapshot": {
33
+ "type": "array",
34
+ "items": {
35
+ "type": "object",
36
+ "required": ["claimId", "status"],
37
+ "additionalProperties": false,
38
+ "properties": {
39
+ "claimId": { "type": "string" },
40
+ "status": { "enum": ["unknown", "proposed", "assumed", "verified", "stale", "disputed", "superseded", "rejected"] }
41
+ }
42
+ }
43
+ },
44
+ "statusFunctionVersion": { "type": "string" },
45
+ "resolvedAt": { "type": "string", "format": "date-time" }
46
+ },
47
+ "$defs": {
48
+ "canonicalClaimTarget": {
49
+ "type": "object",
50
+ "required": ["subjectType", "subjectId", "fieldOrBehavior"],
51
+ "additionalProperties": false,
52
+ "properties": {
53
+ "subjectType": { "type": "string" },
54
+ "subjectId": { "type": "string" },
55
+ "fieldOrBehavior": { "type": "string" },
56
+ "qualifiers": {
57
+ "type": "object",
58
+ "additionalProperties": { "type": "string" }
59
+ }
60
+ }
61
+ },
62
+ "inquiry": {
63
+ "type": "object",
64
+ "required": ["id", "question", "askedBy", "askedAt"],
65
+ "additionalProperties": false,
66
+ "properties": {
67
+ "id": { "type": "string" },
68
+ "question": { "type": "string" },
69
+ "target": { "$ref": "#/$defs/canonicalClaimTarget" },
70
+ "askedBy": { "type": "string" },
71
+ "askedAt": { "type": "string", "format": "date-time" },
72
+ "metadata": { "type": "object" }
73
+ }
74
+ }
75
+ }
76
+ }
@@ -0,0 +1,180 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://kontourai.io/schemas/surface/trust-bundle.schema.json",
4
+ "title": "Surface TrustBundle",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schemaVersion", "source", "claims", "evidence", "policies", "events"],
8
+ "properties": {
9
+ "schemaVersion": { "enum": [2, 3] },
10
+ "source": { "type": "string" },
11
+ "claims": {
12
+ "type": "array",
13
+ "items": { "$ref": "claim.schema.json" }
14
+ },
15
+ "evidence": {
16
+ "type": "array",
17
+ "items": { "$ref": "evidence.schema.json" }
18
+ },
19
+ "policies": {
20
+ "type": "array",
21
+ "items": { "type": "object" }
22
+ },
23
+ "events": {
24
+ "type": "array",
25
+ "items": { "type": "object" }
26
+ },
27
+ "identityLinks": {
28
+ "type": "array",
29
+ "items": {
30
+ "type": "object",
31
+ "required": ["subjects"],
32
+ "properties": {
33
+ "subjects": {
34
+ "type": "array",
35
+ "minItems": 2,
36
+ "items": {
37
+ "type": "object",
38
+ "required": ["subjectType", "subjectId"],
39
+ "properties": {
40
+ "subjectType": { "type": "string" },
41
+ "subjectId": { "type": "string" }
42
+ },
43
+ "additionalProperties": false
44
+ }
45
+ },
46
+ "reason": { "type": "string" },
47
+ "attestedBy": { "type": "string" }
48
+ },
49
+ "additionalProperties": false
50
+ }
51
+ },
52
+ "claimGroups": {
53
+ "type": "array",
54
+ "items": { "$ref": "#/$defs/claimGroup" }
55
+ },
56
+ "authorityTrace": {
57
+ "type": "array",
58
+ "items": { "$ref": "#/$defs/authorityTrace" }
59
+ }
60
+ },
61
+ "$defs": {
62
+ "subjectRef": {
63
+ "type": "object",
64
+ "required": ["subjectType", "subjectId"],
65
+ "properties": {
66
+ "subjectType": { "type": "string" },
67
+ "subjectId": { "type": "string" }
68
+ },
69
+ "additionalProperties": false
70
+ },
71
+ "authorityTrace": {
72
+ "type": "object",
73
+ "required": ["id", "subject", "actorRef", "authorityType", "authorityRef", "sourceRef", "observedAt"],
74
+ "properties": {
75
+ "id": { "type": "string" },
76
+ "subject": { "$ref": "#/$defs/subjectRef" },
77
+ "actorRef": { "type": "string" },
78
+ "authorityType": { "enum": ["role", "permission", "credential", "system", "organization", "policy", "other"] },
79
+ "authorityRef": { "type": "string" },
80
+ "sourceRef": { "type": "string" },
81
+ "observedAt": { "type": "string", "format": "date-time" },
82
+ "evidenceIds": { "type": "array", "items": { "type": "string" } },
83
+ "claimIds": { "type": "array", "items": { "type": "string" } },
84
+ "validFrom": { "type": "string", "format": "date-time" },
85
+ "validUntil": { "type": "string", "format": "date-time" },
86
+ "revokedAt": { "type": "string", "format": "date-time" },
87
+ "integrityRef": { "type": "string" },
88
+ "integrityAnchor": { "$ref": "#/$defs/integrityAnchor" },
89
+ "metadata": { "type": "object" }
90
+ },
91
+ "additionalProperties": false
92
+ },
93
+ "integrityAnchor": {
94
+ "type": "object",
95
+ "required": ["id", "kind", "algorithm", "value", "sourceRef"],
96
+ "properties": {
97
+ "id": { "type": "string" },
98
+ "kind": { "enum": ["hash", "signature", "transparency_log", "timestamp", "external_ref", "other"] },
99
+ "algorithm": { "type": "string" },
100
+ "value": { "type": "string" },
101
+ "sourceRef": { "type": "string" },
102
+ "observedAt": { "type": "string", "format": "date-time" },
103
+ "verificationStatus": { "enum": ["unverified", "verified", "failed", "not_applicable"] },
104
+ "verifiedAt": { "type": "string", "format": "date-time" },
105
+ "verifiedBy": { "type": "string" },
106
+ "metadata": { "type": "object" }
107
+ },
108
+ "additionalProperties": false
109
+ },
110
+ "claimGroup": {
111
+ "type": "object",
112
+ "required": ["id", "title", "kind"],
113
+ "properties": {
114
+ "id": { "type": "string" },
115
+ "title": { "type": "string" },
116
+ "kind": { "enum": ["claimGroup", "framework", "requirement-set"] },
117
+ "description": { "type": "string" },
118
+ "claimIds": { "type": "array", "items": { "type": "string" } },
119
+ "requirements": {
120
+ "type": "array",
121
+ "items": { "$ref": "#/$defs/claimRequirement" }
122
+ },
123
+ "rollupPolicy": {
124
+ "type": "object",
125
+ "required": ["mode"],
126
+ "properties": {
127
+ "mode": { "enum": ["all-required", "any-required"] },
128
+ "requiredRequirementIds": { "type": "array", "items": { "type": "string" } },
129
+ "optionalRequirementIds": { "type": "array", "items": { "type": "string" } }
130
+ },
131
+ "additionalProperties": false
132
+ },
133
+ "metadata": { "type": "object" }
134
+ },
135
+ "additionalProperties": false
136
+ },
137
+ "claimRequirement": {
138
+ "type": "object",
139
+ "required": ["id", "title", "claimIds"],
140
+ "properties": {
141
+ "id": { "type": "string" },
142
+ "title": { "type": "string" },
143
+ "claimIds": { "type": "array", "items": { "type": "string" } },
144
+ "required": { "type": "boolean" },
145
+ "severity": { "enum": ["low", "medium", "high", "critical"] },
146
+ "validationStrategy": { "$ref": "#/$defs/validationStrategy" },
147
+ "metadata": { "type": "object" }
148
+ },
149
+ "additionalProperties": false
150
+ },
151
+ "validationStrategy": {
152
+ "type": "object",
153
+ "properties": {
154
+ "requiredEvidence": {
155
+ "type": "array",
156
+ "items": { "enum": ["source_excerpt", "test_output", "human_attestation", "attestation", "calculation_trace", "document_citation", "crawl_observation", "policy_rule"] }
157
+ },
158
+ "requiredMethods": {
159
+ "type": "array",
160
+ "items": { "enum": ["observation", "extraction", "validation", "corroboration", "attestation", "auditability", "anchoring", "monitoring"] }
161
+ },
162
+ "requiresCorroboration": { "type": "boolean" },
163
+ "acceptanceCriteria": { "type": "array", "items": { "type": "string" } },
164
+ "reviewAuthority": { "type": "string" },
165
+ "notes": { "type": "string" },
166
+ "metadata": { "type": "object" }
167
+ },
168
+ "additionalProperties": false
169
+ }
170
+ },
171
+ "not": {
172
+ "anyOf": [
173
+ { "required": ["id"] },
174
+ { "required": ["generatedAt"] },
175
+ { "required": ["summary"] },
176
+ { "required": ["transparencyGaps"] },
177
+ { "required": ["evidenceRequirementsByClaimId"] }
178
+ ]
179
+ }
180
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://kontourai.io/schemas/surface/verification-event.schema.json",
4
+ "title": "Kontour Surface Verification Event",
5
+ "type": "object",
6
+ "required": ["id", "claimId", "status", "actor", "method", "evidenceIds", "createdAt"],
7
+ "properties": {
8
+ "id": { "type": "string" },
9
+ "claimId": { "type": "string" },
10
+ "status": { "enum": ["unknown", "proposed", "assumed", "verified", "stale", "disputed", "superseded", "rejected"] },
11
+ "actor": { "type": "string" },
12
+ "method": { "type": "string" },
13
+ "evidenceIds": { "type": "array", "items": { "type": "string" } },
14
+ "createdAt": { "type": "string", "format": "date-time" },
15
+ "verifiedAt": { "type": "string", "format": "date-time" },
16
+ "notes": { "type": "string" },
17
+ "resolvesDispute": {
18
+ "description": "ADR 0003 §8: marks this event as an authority-weighted dispute-resolution decision.",
19
+ "type": "boolean",
20
+ "enum": [true]
21
+ },
22
+ "authorityRef": {
23
+ "description": "ADR 0003 §8: the AuthorityTrace.authorityRef the deciding actor invokes.",
24
+ "type": "string"
25
+ }
26
+ },
27
+ "additionalProperties": false
28
+ }
@@ -0,0 +1,65 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://kontourai.io/schemas/surface/verification-policy.schema.json",
4
+ "title": "Kontour Surface Verification Policy",
5
+ "type": "object",
6
+ "required": ["id", "claimType", "requiredEvidence", "acceptanceCriteria", "reviewAuthority", "validityRule", "stalenessTriggers", "conflictRules", "impactLevel"],
7
+ "properties": {
8
+ "id": { "type": "string" },
9
+ "claimType": { "type": "string" },
10
+ "parentType": { "type": "string" },
11
+ "requiredEvidence": {
12
+ "type": "array",
13
+ "items": { "enum": ["source_excerpt", "test_output", "human_attestation", "calculation_trace", "document_citation", "crawl_observation", "policy_rule"] }
14
+ },
15
+ "requiredMethods": {
16
+ "type": "array",
17
+ "items": { "enum": ["observation", "extraction", "validation", "corroboration", "attestation", "auditability", "anchoring", "monitoring"] }
18
+ },
19
+ "requiresCorroboration": { "type": "boolean" },
20
+ "acceptanceCriteria": { "type": "array", "items": { "type": "string" } },
21
+ "reviewAuthority": { "type": "string" },
22
+ "validityRule": {
23
+ "type": "object",
24
+ "required": ["kind"],
25
+ "properties": {
26
+ "kind": { "enum": ["duration", "commit", "historical", "manual"] },
27
+ "durationDays": { "type": "number" }
28
+ },
29
+ "additionalProperties": false
30
+ },
31
+ "stalenessTriggers": { "type": "array", "items": { "type": "string" } },
32
+ "conflictRules": { "type": "array", "items": { "type": "string" } },
33
+ "impactLevel": { "enum": ["low", "medium", "high", "critical"] },
34
+ "incompatibleValues": {
35
+ "type": "array",
36
+ "items": {
37
+ "type": "object",
38
+ "required": ["values"],
39
+ "properties": {
40
+ "values": { "type": "array", "minItems": 2, "maxItems": 2 },
41
+ "message": { "type": "string" }
42
+ },
43
+ "additionalProperties": false
44
+ }
45
+ },
46
+ "incompatibleStatuses": {
47
+ "type": "array",
48
+ "items": {
49
+ "type": "object",
50
+ "required": ["statuses"],
51
+ "properties": {
52
+ "statuses": {
53
+ "type": "array",
54
+ "minItems": 2,
55
+ "maxItems": 2,
56
+ "items": { "enum": ["unknown", "proposed", "assumed", "verified", "stale", "disputed", "superseded", "rejected"] }
57
+ },
58
+ "message": { "type": "string" }
59
+ },
60
+ "additionalProperties": false
61
+ }
62
+ }
63
+ },
64
+ "additionalProperties": false
65
+ }