@aikdna/kdna-core 0.17.0 → 0.18.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/CHANGELOG.md +131 -2
- package/README.md +145 -2
- package/package.json +3 -2
- package/schema/agent-host-2-receipt.schema.json +206 -0
- package/schema/agent-host-2-request.schema.json +135 -0
- package/schema/agent-host-capabilities-1.schema.json +40 -0
- package/schema/checksums.schema.json +40 -1
- package/schema/consumption-plan-1.schema.json +280 -0
- package/schema/digest-evidence.schema.json +123 -0
- package/schema/judgment-trace-1.schema.json +748 -0
- package/schema/load-plan.schema.json +2 -2
- package/schema/runtime-capsule-1.schema.json +68 -0
- package/schema/runtime-capsule-2.schema.json +140 -0
- package/src/asset-reader.js +100 -120
- package/src/capsule-v2.js +687 -0
- package/src/container-dispatcher.js +4 -1
- package/src/execution-contract-v1.js +1850 -0
- package/src/index.js +4 -0
- package/src/index.mjs +136 -21
- package/src/lint-pure.js +6 -3
- package/src/public-api.js +59 -163
- package/src/runtime-api.js +5 -6
- package/src/types.d.ts +1181 -113
- package/src/v1/index.js +225 -55
- package/src/v1/index.mjs +1 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/aikdna/kdna/specs/agent-host-2-request.schema.json",
|
|
4
|
+
"title": "KDNA Agent Host 2 Request",
|
|
5
|
+
"description": "Strict Host 2 request carrying one exact Runtime Capsule 2, its Plan correlation, detached delivery digest P, projection/result contracts, and enforceable limits.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"protocol",
|
|
9
|
+
"request_id",
|
|
10
|
+
"plan_ref",
|
|
11
|
+
"runtime_contract",
|
|
12
|
+
"projection_contract",
|
|
13
|
+
"result_contract",
|
|
14
|
+
"budget",
|
|
15
|
+
"constraints",
|
|
16
|
+
"phase",
|
|
17
|
+
"task",
|
|
18
|
+
"authority",
|
|
19
|
+
"asset",
|
|
20
|
+
"capsule"
|
|
21
|
+
],
|
|
22
|
+
"additionalProperties": false,
|
|
23
|
+
"properties": {
|
|
24
|
+
"protocol": { "const": "kdna.agent-host/2" },
|
|
25
|
+
"request_id": { "type": "string", "pattern": "^host_[0-9a-f]{24}$" },
|
|
26
|
+
"plan_ref": { "$ref": "#/$defs/planRef" },
|
|
27
|
+
"runtime_contract": { "$ref": "#/$defs/runtimeContract" },
|
|
28
|
+
"projection_contract": { "$ref": "#/$defs/projectionContract" },
|
|
29
|
+
"result_contract": { "$ref": "#/$defs/resultContract" },
|
|
30
|
+
"budget": { "$ref": "#/$defs/budget" },
|
|
31
|
+
"constraints": { "$ref": "#/$defs/constraints" },
|
|
32
|
+
"phase": { "const": "single_judgment" },
|
|
33
|
+
"task": { "$ref": "#/$defs/task" },
|
|
34
|
+
"authority": { "$ref": "#/$defs/authority" },
|
|
35
|
+
"asset": { "$ref": "#/$defs/asset" },
|
|
36
|
+
"capsule": {
|
|
37
|
+
"$ref": "https://github.com/aikdna/kdna/specs/runtime-capsule-2.schema.json"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"$defs": {
|
|
41
|
+
"sha256": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"pattern": "^sha256:[0-9a-f]{64}$"
|
|
44
|
+
},
|
|
45
|
+
"assetId": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"pattern": "^[a-zA-Z][a-zA-Z0-9_-]*(:[a-zA-Z0-9_.-]+)+$"
|
|
48
|
+
},
|
|
49
|
+
"semver": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+([+-].+)?$"
|
|
52
|
+
},
|
|
53
|
+
"planRef": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"required": ["plan_id", "plan_digest_profile", "plan_digest"],
|
|
56
|
+
"additionalProperties": false,
|
|
57
|
+
"properties": {
|
|
58
|
+
"plan_id": { "type": "string", "pattern": "^plan_[0-9a-f]{16}$" },
|
|
59
|
+
"plan_digest_profile": { "const": "kdna-consumption-plan-jcs-v1" },
|
|
60
|
+
"plan_digest": { "$ref": "#/$defs/sha256" }
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"runtimeContract": {
|
|
64
|
+
"type": "object",
|
|
65
|
+
"required": ["capsule_version", "capsule_digest_profile", "capsule_delivery_digest"],
|
|
66
|
+
"additionalProperties": false,
|
|
67
|
+
"properties": {
|
|
68
|
+
"capsule_version": { "const": "2.0" },
|
|
69
|
+
"capsule_digest_profile": { "const": "kdna-capsule-jcs-v1" },
|
|
70
|
+
"capsule_delivery_digest": { "$ref": "#/$defs/sha256" }
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"projectionContract": {
|
|
74
|
+
"type": "object",
|
|
75
|
+
"required": ["profile", "required_digest_profile", "require_packaged_asset"],
|
|
76
|
+
"additionalProperties": false,
|
|
77
|
+
"properties": {
|
|
78
|
+
"profile": { "enum": ["index", "compact", "scenario", "full"] },
|
|
79
|
+
"required_digest_profile": { "const": "kdna-capsule-digests-v1" },
|
|
80
|
+
"require_packaged_asset": { "const": true }
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"resultContract": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"required": ["shape"],
|
|
86
|
+
"additionalProperties": false,
|
|
87
|
+
"properties": {
|
|
88
|
+
"shape": { "const": "structured_judgment" }
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"budget": {
|
|
92
|
+
"$ref": "https://github.com/aikdna/kdna/specs/consumption-plan-1.schema.json#/$defs/budget"
|
|
93
|
+
},
|
|
94
|
+
"constraints": {
|
|
95
|
+
"$ref": "https://github.com/aikdna/kdna/specs/consumption-plan-1.schema.json#/$defs/constraints"
|
|
96
|
+
},
|
|
97
|
+
"task": {
|
|
98
|
+
"$ref": "https://github.com/aikdna/kdna/specs/consumption-plan-1.schema.json#/$defs/task"
|
|
99
|
+
},
|
|
100
|
+
"authority": {
|
|
101
|
+
"type": "object",
|
|
102
|
+
"required": ["asset_id", "role", "final_decision"],
|
|
103
|
+
"additionalProperties": false,
|
|
104
|
+
"properties": {
|
|
105
|
+
"asset_id": { "$ref": "#/$defs/assetId" },
|
|
106
|
+
"role": { "const": "primary" },
|
|
107
|
+
"final_decision": { "const": true }
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"asset": {
|
|
111
|
+
"type": "object",
|
|
112
|
+
"required": [
|
|
113
|
+
"asset_id",
|
|
114
|
+
"asset_uid",
|
|
115
|
+
"version",
|
|
116
|
+
"judgment_version",
|
|
117
|
+
"access",
|
|
118
|
+
"role",
|
|
119
|
+
"expected_digests"
|
|
120
|
+
],
|
|
121
|
+
"additionalProperties": false,
|
|
122
|
+
"properties": {
|
|
123
|
+
"asset_id": { "$ref": "#/$defs/assetId" },
|
|
124
|
+
"asset_uid": { "type": "string", "format": "uri" },
|
|
125
|
+
"version": { "$ref": "#/$defs/semver" },
|
|
126
|
+
"judgment_version": { "$ref": "#/$defs/semver" },
|
|
127
|
+
"access": { "enum": ["public", "licensed", "remote"] },
|
|
128
|
+
"role": { "const": "primary" },
|
|
129
|
+
"expected_digests": {
|
|
130
|
+
"$ref": "https://github.com/aikdna/kdna/specs/consumption-plan-1.schema.json#/$defs/expectedDigests"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/aikdna/kdna/specs/agent-host-capabilities-1.schema.json",
|
|
4
|
+
"title": "KDNA Agent Host Capability Descriptor 1.0",
|
|
5
|
+
"description": "Orthogonal capabilities observed before Plan 1.0 execution. Supported execution pairs are decided by the execution contract verifier, not inferred as a cartesian product by this schema.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"type",
|
|
9
|
+
"version",
|
|
10
|
+
"capability_basis",
|
|
11
|
+
"host_protocols",
|
|
12
|
+
"capsule_versions",
|
|
13
|
+
"capsule_digest_profiles"
|
|
14
|
+
],
|
|
15
|
+
"additionalProperties": false,
|
|
16
|
+
"properties": {
|
|
17
|
+
"type": { "const": "kdna.agent-host.capabilities" },
|
|
18
|
+
"version": { "const": "1.0" },
|
|
19
|
+
"capability_basis": {
|
|
20
|
+
"enum": ["registered_descriptor", "legacy_assumption"]
|
|
21
|
+
},
|
|
22
|
+
"host_protocols": {
|
|
23
|
+
"type": "array",
|
|
24
|
+
"minItems": 1,
|
|
25
|
+
"uniqueItems": true,
|
|
26
|
+
"items": { "enum": ["kdna.agent-host/2", "kdna.agent-host/1"] }
|
|
27
|
+
},
|
|
28
|
+
"capsule_versions": {
|
|
29
|
+
"type": "array",
|
|
30
|
+
"minItems": 1,
|
|
31
|
+
"uniqueItems": true,
|
|
32
|
+
"items": { "enum": ["2.0", "1.0"] }
|
|
33
|
+
},
|
|
34
|
+
"capsule_digest_profiles": {
|
|
35
|
+
"type": "array",
|
|
36
|
+
"uniqueItems": true,
|
|
37
|
+
"items": { "const": "kdna-capsule-jcs-v1" }
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -16,7 +16,41 @@
|
|
|
16
16
|
"pattern": "^[a-f0-9]{64}$"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
|
+
"allOf": [
|
|
20
|
+
{
|
|
21
|
+
"if": {
|
|
22
|
+
"anyOf": [
|
|
23
|
+
{ "required": ["digest_profile"] },
|
|
24
|
+
{ "required": ["covered_entries"] }
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"then": {
|
|
28
|
+
"required": [
|
|
29
|
+
"digest_profile",
|
|
30
|
+
"covered_entries",
|
|
31
|
+
"manifest_digest",
|
|
32
|
+
"payload_digest",
|
|
33
|
+
"entry_set_digest"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
],
|
|
19
38
|
"properties": {
|
|
39
|
+
"digest_profile": {
|
|
40
|
+
"const": "kdna-runtime-entry-set-v1",
|
|
41
|
+
"description": "Algorithm and coverage profile for entry_set_digest."
|
|
42
|
+
},
|
|
43
|
+
"covered_entries": {
|
|
44
|
+
"type": "array",
|
|
45
|
+
"description": "Ordered entries covered by kdna-runtime-entry-set-v1.",
|
|
46
|
+
"prefixItems": [
|
|
47
|
+
{ "const": "kdna.json" },
|
|
48
|
+
{ "const": "payload.kdnab" }
|
|
49
|
+
],
|
|
50
|
+
"items": false,
|
|
51
|
+
"minItems": 2,
|
|
52
|
+
"maxItems": 2
|
|
53
|
+
},
|
|
20
54
|
"algorithm": {
|
|
21
55
|
"type": "string",
|
|
22
56
|
"description": "Hash algorithm. Phase 1 uses sha256.",
|
|
@@ -31,7 +65,12 @@
|
|
|
31
65
|
"$ref": "#/$defs/sha256Digest"
|
|
32
66
|
},
|
|
33
67
|
"asset_digest": {
|
|
34
|
-
"
|
|
68
|
+
"deprecated": true,
|
|
69
|
+
"description": "Deprecated v1 alias of entry_set_digest. This is not the final .kdna file digest.",
|
|
70
|
+
"$ref": "#/$defs/sha256Digest"
|
|
71
|
+
},
|
|
72
|
+
"entry_set_digest": {
|
|
73
|
+
"description": "Digest of the protected runtime entry set, combined deterministically from kdna.json and payload.kdnab entry digests.",
|
|
35
74
|
"$ref": "#/$defs/sha256Digest"
|
|
36
75
|
},
|
|
37
76
|
"entries": {
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/aikdna/kdna/specs/consumption-plan-1.schema.json",
|
|
4
|
+
"title": "KDNA ConsumptionPlan 1.0",
|
|
5
|
+
"description": "Strict opt-in single-asset plan for Capsule 2 delivery to Agent Host 2. Plan 0.9 remains the default Capsule 1 / Host 1 contract.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"type",
|
|
9
|
+
"plan_version",
|
|
10
|
+
"plan_id",
|
|
11
|
+
"created_at",
|
|
12
|
+
"mode",
|
|
13
|
+
"task",
|
|
14
|
+
"asset_ref",
|
|
15
|
+
"projection_request",
|
|
16
|
+
"host_request",
|
|
17
|
+
"result_request",
|
|
18
|
+
"budget",
|
|
19
|
+
"constraints",
|
|
20
|
+
"trace_policy",
|
|
21
|
+
"integrity"
|
|
22
|
+
],
|
|
23
|
+
"additionalProperties": false,
|
|
24
|
+
"properties": {
|
|
25
|
+
"type": { "const": "kdna.consumption.plan" },
|
|
26
|
+
"plan_version": { "const": "1.0.0" },
|
|
27
|
+
"plan_id": { "type": "string", "pattern": "^plan_[0-9a-f]{16}$" },
|
|
28
|
+
"created_at": { "type": "string", "format": "date-time" },
|
|
29
|
+
"mode": { "const": "single" },
|
|
30
|
+
"task": { "$ref": "#/$defs/task" },
|
|
31
|
+
"asset_ref": { "$ref": "#/$defs/assetRef" },
|
|
32
|
+
"projection_request": { "$ref": "#/$defs/projectionRequest" },
|
|
33
|
+
"host_request": { "$ref": "#/$defs/hostRequest" },
|
|
34
|
+
"result_request": { "$ref": "#/$defs/resultRequest" },
|
|
35
|
+
"budget": { "$ref": "#/$defs/budget" },
|
|
36
|
+
"constraints": { "$ref": "#/$defs/constraints" },
|
|
37
|
+
"trace_policy": { "$ref": "#/$defs/tracePolicy" },
|
|
38
|
+
"integrity": { "$ref": "#/$defs/integrity" }
|
|
39
|
+
},
|
|
40
|
+
"$defs": {
|
|
41
|
+
"sha256": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"pattern": "^sha256:[0-9a-f]{64}$"
|
|
44
|
+
},
|
|
45
|
+
"semver": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+([+-].+)?$"
|
|
48
|
+
},
|
|
49
|
+
"assetId": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"pattern": "^[a-zA-Z][a-zA-Z0-9_-]*(:[a-zA-Z0-9_.-]+)+$"
|
|
52
|
+
},
|
|
53
|
+
"task": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"required": ["summary", "task_family", "context"],
|
|
56
|
+
"additionalProperties": false,
|
|
57
|
+
"properties": {
|
|
58
|
+
"summary": { "type": "string", "minLength": 1, "maxLength": 500 },
|
|
59
|
+
"task_family": { "type": ["string", "null"], "minLength": 1 },
|
|
60
|
+
"context": true
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"expectedDigest": {
|
|
64
|
+
"type": "object",
|
|
65
|
+
"required": ["value", "basis", "source", "comparison"],
|
|
66
|
+
"additionalProperties": false,
|
|
67
|
+
"properties": {
|
|
68
|
+
"value": { "$ref": "#/$defs/sha256" },
|
|
69
|
+
"basis": { "type": "string" },
|
|
70
|
+
"source": {
|
|
71
|
+
"enum": [
|
|
72
|
+
"caller",
|
|
73
|
+
"registry",
|
|
74
|
+
"install_receipt",
|
|
75
|
+
"lockfile",
|
|
76
|
+
"kdna.json.content_digest",
|
|
77
|
+
"checksums.json.entry_set_digest",
|
|
78
|
+
"checksums.json.asset_digest"
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
"comparison": { "enum": ["matched", "not_compared"] }
|
|
82
|
+
},
|
|
83
|
+
"allOf": [
|
|
84
|
+
{
|
|
85
|
+
"if": {
|
|
86
|
+
"properties": { "source": { "const": "caller" } },
|
|
87
|
+
"required": ["source"]
|
|
88
|
+
},
|
|
89
|
+
"then": { "properties": { "comparison": { "const": "not_compared" } } },
|
|
90
|
+
"else": { "properties": { "comparison": { "const": "matched" } } }
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
"assetRef": {
|
|
95
|
+
"type": "object",
|
|
96
|
+
"required": [
|
|
97
|
+
"asset_id",
|
|
98
|
+
"asset_uid",
|
|
99
|
+
"version",
|
|
100
|
+
"judgment_version",
|
|
101
|
+
"access",
|
|
102
|
+
"expected_digests"
|
|
103
|
+
],
|
|
104
|
+
"additionalProperties": false,
|
|
105
|
+
"properties": {
|
|
106
|
+
"asset_id": { "$ref": "#/$defs/assetId" },
|
|
107
|
+
"asset_uid": { "type": "string", "format": "uri" },
|
|
108
|
+
"version": { "$ref": "#/$defs/semver" },
|
|
109
|
+
"judgment_version": { "$ref": "#/$defs/semver" },
|
|
110
|
+
"access": { "enum": ["public", "licensed", "remote"] },
|
|
111
|
+
"expected_digests": { "$ref": "#/$defs/expectedDigests" }
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"expectedDigests": {
|
|
115
|
+
"type": "object",
|
|
116
|
+
"required": ["asset", "content", "runtime_entry_set"],
|
|
117
|
+
"additionalProperties": false,
|
|
118
|
+
"properties": {
|
|
119
|
+
"asset": {
|
|
120
|
+
"oneOf": [
|
|
121
|
+
{
|
|
122
|
+
"allOf": [
|
|
123
|
+
{ "$ref": "#/$defs/expectedDigest" },
|
|
124
|
+
{
|
|
125
|
+
"properties": {
|
|
126
|
+
"basis": { "const": "kdna-container-bytes-v1" },
|
|
127
|
+
"source": {
|
|
128
|
+
"enum": ["caller", "registry", "install_receipt", "lockfile"]
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
{ "type": "null" }
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
"content": {
|
|
138
|
+
"oneOf": [
|
|
139
|
+
{
|
|
140
|
+
"allOf": [
|
|
141
|
+
{ "$ref": "#/$defs/expectedDigest" },
|
|
142
|
+
{
|
|
143
|
+
"properties": {
|
|
144
|
+
"basis": { "const": "kdna-content-tree-v1" },
|
|
145
|
+
"source": {
|
|
146
|
+
"enum": [
|
|
147
|
+
"caller",
|
|
148
|
+
"registry",
|
|
149
|
+
"install_receipt",
|
|
150
|
+
"lockfile",
|
|
151
|
+
"kdna.json.content_digest"
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
{ "type": "null" }
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
"runtime_entry_set": {
|
|
162
|
+
"oneOf": [
|
|
163
|
+
{
|
|
164
|
+
"allOf": [
|
|
165
|
+
{ "$ref": "#/$defs/expectedDigest" },
|
|
166
|
+
{
|
|
167
|
+
"properties": {
|
|
168
|
+
"basis": { "const": "kdna-runtime-entry-set-v1" },
|
|
169
|
+
"source": {
|
|
170
|
+
"enum": [
|
|
171
|
+
"caller",
|
|
172
|
+
"registry",
|
|
173
|
+
"install_receipt",
|
|
174
|
+
"lockfile",
|
|
175
|
+
"checksums.json.entry_set_digest",
|
|
176
|
+
"checksums.json.asset_digest"
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
{ "type": "null" }
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
"projectionRequest": {
|
|
189
|
+
"type": "object",
|
|
190
|
+
"required": [
|
|
191
|
+
"profile",
|
|
192
|
+
"accepted_capsule_versions",
|
|
193
|
+
"required_digest_profile",
|
|
194
|
+
"require_packaged_asset"
|
|
195
|
+
],
|
|
196
|
+
"additionalProperties": false,
|
|
197
|
+
"properties": {
|
|
198
|
+
"profile": { "enum": ["index", "compact", "scenario", "full"] },
|
|
199
|
+
"accepted_capsule_versions": {
|
|
200
|
+
"type": "array",
|
|
201
|
+
"prefixItems": [{ "const": "2.0" }],
|
|
202
|
+
"minItems": 1,
|
|
203
|
+
"maxItems": 1
|
|
204
|
+
},
|
|
205
|
+
"required_digest_profile": { "const": "kdna-capsule-digests-v1" },
|
|
206
|
+
"require_packaged_asset": { "const": true }
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
"hostRequest": {
|
|
210
|
+
"type": "object",
|
|
211
|
+
"required": ["accepted_protocols"],
|
|
212
|
+
"additionalProperties": false,
|
|
213
|
+
"properties": {
|
|
214
|
+
"accepted_protocols": {
|
|
215
|
+
"type": "array",
|
|
216
|
+
"prefixItems": [{ "const": "kdna.agent-host/2" }],
|
|
217
|
+
"minItems": 1,
|
|
218
|
+
"maxItems": 1
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
"resultRequest": {
|
|
223
|
+
"type": "object",
|
|
224
|
+
"required": ["shape"],
|
|
225
|
+
"additionalProperties": false,
|
|
226
|
+
"properties": {
|
|
227
|
+
"shape": { "const": "structured_judgment" }
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
"budget": {
|
|
231
|
+
"type": "object",
|
|
232
|
+
"required": [
|
|
233
|
+
"max_projection_chars",
|
|
234
|
+
"max_task_chars",
|
|
235
|
+
"deadline_ms",
|
|
236
|
+
"max_tokens",
|
|
237
|
+
"max_model_calls"
|
|
238
|
+
],
|
|
239
|
+
"additionalProperties": false,
|
|
240
|
+
"properties": {
|
|
241
|
+
"max_projection_chars": { "type": "integer", "minimum": 0 },
|
|
242
|
+
"max_task_chars": { "type": "integer", "minimum": 0 },
|
|
243
|
+
"deadline_ms": { "type": "integer", "minimum": 1 },
|
|
244
|
+
"max_tokens": {
|
|
245
|
+
"oneOf": [{ "type": "integer", "minimum": 0 }, { "type": "null" }]
|
|
246
|
+
},
|
|
247
|
+
"max_model_calls": {
|
|
248
|
+
"oneOf": [{ "type": "integer", "minimum": 0 }, { "type": "null" }]
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
"constraints": {
|
|
253
|
+
"type": "object",
|
|
254
|
+
"required": ["enforce_before_host", "reject_on_exceed"],
|
|
255
|
+
"additionalProperties": false,
|
|
256
|
+
"properties": {
|
|
257
|
+
"enforce_before_host": { "const": true },
|
|
258
|
+
"reject_on_exceed": { "const": true }
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
"tracePolicy": {
|
|
262
|
+
"type": "object",
|
|
263
|
+
"required": ["emit", "storage"],
|
|
264
|
+
"additionalProperties": false,
|
|
265
|
+
"properties": {
|
|
266
|
+
"emit": { "const": true },
|
|
267
|
+
"storage": { "enum": ["ephemeral", "session", "persistent"] }
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
"integrity": {
|
|
271
|
+
"type": "object",
|
|
272
|
+
"required": ["profile", "plan_digest"],
|
|
273
|
+
"additionalProperties": false,
|
|
274
|
+
"properties": {
|
|
275
|
+
"profile": { "const": "kdna-consumption-plan-jcs-v1" },
|
|
276
|
+
"plan_digest": { "$ref": "#/$defs/sha256" }
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/aikdna/kdna/specs/digest-evidence.schema.json",
|
|
4
|
+
"title": "KDNA Digest Evidence",
|
|
5
|
+
"description": "Observed A/C/E digest values, their fixed bases, and factual comparison evidence.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["profile", "asset", "content", "runtime_entry_set"],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"profile": { "const": "kdna-capsule-digests-v1" },
|
|
11
|
+
"asset": {
|
|
12
|
+
"allOf": [
|
|
13
|
+
{ "$ref": "#/$defs/digest" },
|
|
14
|
+
{ "properties": { "basis": { "const": "kdna-container-bytes-v1" } } }
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"content": {
|
|
18
|
+
"allOf": [
|
|
19
|
+
{ "$ref": "#/$defs/digest" },
|
|
20
|
+
{ "properties": { "basis": { "const": "kdna-content-tree-v1" } } }
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"runtime_entry_set": {
|
|
24
|
+
"allOf": [
|
|
25
|
+
{ "$ref": "#/$defs/digest" },
|
|
26
|
+
{ "properties": { "basis": { "const": "kdna-runtime-entry-set-v1" } } }
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"$defs": {
|
|
31
|
+
"sha256": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"pattern": "^sha256:[0-9a-f]{64}$"
|
|
34
|
+
},
|
|
35
|
+
"comparisonSource": {
|
|
36
|
+
"enum": [
|
|
37
|
+
"caller",
|
|
38
|
+
"registry",
|
|
39
|
+
"install_receipt",
|
|
40
|
+
"lockfile",
|
|
41
|
+
"kdna.json.content_digest",
|
|
42
|
+
"kdna.json.authoring.content_digest",
|
|
43
|
+
"checksums.json.entry_set_digest",
|
|
44
|
+
"checksums.json.asset_digest"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"comparison": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"required": ["state", "against", "expected", "source"],
|
|
50
|
+
"additionalProperties": false,
|
|
51
|
+
"properties": {
|
|
52
|
+
"state": {
|
|
53
|
+
"enum": ["matched", "mismatched", "not_compared", "unavailable"]
|
|
54
|
+
},
|
|
55
|
+
"against": {
|
|
56
|
+
"type": ["string", "null"],
|
|
57
|
+
"enum": ["external_expected", "manifest_declaration", "checksum_declaration", null]
|
|
58
|
+
},
|
|
59
|
+
"expected": {
|
|
60
|
+
"oneOf": [{ "$ref": "#/$defs/sha256" }, { "type": "null" }]
|
|
61
|
+
},
|
|
62
|
+
"source": {
|
|
63
|
+
"oneOf": [{ "$ref": "#/$defs/comparisonSource" }, { "type": "null" }]
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"allOf": [
|
|
67
|
+
{
|
|
68
|
+
"if": {
|
|
69
|
+
"properties": { "state": { "enum": ["matched", "mismatched"] } },
|
|
70
|
+
"required": ["state"]
|
|
71
|
+
},
|
|
72
|
+
"then": {
|
|
73
|
+
"properties": {
|
|
74
|
+
"against": { "type": "string" },
|
|
75
|
+
"expected": { "$ref": "#/$defs/sha256" },
|
|
76
|
+
"source": { "$ref": "#/$defs/comparisonSource" }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"if": {
|
|
82
|
+
"properties": { "state": { "enum": ["not_compared", "unavailable"] } },
|
|
83
|
+
"required": ["state"]
|
|
84
|
+
},
|
|
85
|
+
"then": {
|
|
86
|
+
"properties": {
|
|
87
|
+
"against": { "type": "null" },
|
|
88
|
+
"expected": { "type": "null" },
|
|
89
|
+
"source": { "type": "null" }
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
"digest": {
|
|
96
|
+
"type": "object",
|
|
97
|
+
"required": ["value", "basis", "comparison"],
|
|
98
|
+
"additionalProperties": false,
|
|
99
|
+
"properties": {
|
|
100
|
+
"value": {
|
|
101
|
+
"oneOf": [{ "$ref": "#/$defs/sha256" }, { "type": "null" }]
|
|
102
|
+
},
|
|
103
|
+
"basis": { "type": "string" },
|
|
104
|
+
"comparison": { "$ref": "#/$defs/comparison" }
|
|
105
|
+
},
|
|
106
|
+
"allOf": [
|
|
107
|
+
{
|
|
108
|
+
"if": {
|
|
109
|
+
"properties": {
|
|
110
|
+
"comparison": {
|
|
111
|
+
"properties": { "state": { "const": "unavailable" } },
|
|
112
|
+
"required": ["state"]
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"required": ["comparison"]
|
|
116
|
+
},
|
|
117
|
+
"then": { "properties": { "value": { "type": "null" } } },
|
|
118
|
+
"else": { "properties": { "value": { "$ref": "#/$defs/sha256" } } }
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|