@aikdna/kdna-core 0.18.0 → 0.20.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 (44) hide show
  1. package/CHANGELOG.md +136 -94
  2. package/README.md +109 -215
  3. package/package.json +7 -2
  4. package/schema/agent-host-capabilities.schema.json +62 -0
  5. package/schema/agent-host-receipt.schema.json +371 -0
  6. package/schema/agent-host-request.schema.json +223 -0
  7. package/schema/{bundle-profile-v1.schema.json → bundle-profile.schema.json} +9 -5
  8. package/schema/checksums.schema.json +8 -8
  9. package/schema/consumption-plan.schema.json +428 -0
  10. package/schema/digest-evidence.schema.json +115 -26
  11. package/schema/{kdna-envelope-external-grant-v1.schema.json → external-grant-envelope.schema.json} +17 -4
  12. package/schema/{kdna-key-grant-v1.schema.json → external-key-grant.schema.json} +39 -7
  13. package/schema/judgment-trace.schema.json +1251 -0
  14. package/schema/load-plan.schema.json +5 -3
  15. package/schema/manifest.schema.json +78 -10
  16. package/schema/{payload-profile-v1.schema.json → payload-profile.schema.json} +30 -6
  17. package/schema/{runtime-capsule-2.schema.json → runtime-capsule.schema.json} +7 -33
  18. package/src/asset-reader.js +8 -2
  19. package/src/{v1 → container}/index.js +385 -198
  20. package/src/container/index.mjs +20 -0
  21. package/src/container-dispatcher.js +6 -6
  22. package/src/crypto-profile.js +37 -107
  23. package/src/external-key-grant.js +41 -15
  24. package/src/index.js +11 -8
  25. package/src/index.mjs +49 -45
  26. package/src/loader-compatibility.js +59 -0
  27. package/src/loader.js +1 -1
  28. package/src/public-api.js +5 -5
  29. package/src/remote-runtime.d.ts +13 -0
  30. package/src/remote-runtime.js +27 -0
  31. package/src/remote-runtime.mjs +3 -0
  32. package/src/runtime-api.js +5 -5
  33. package/src/{capsule-v2.js → runtime-capsule.js} +95 -254
  34. package/src/{execution-contract-v1.js → runtime-contract.js} +184 -152
  35. package/src/types.d.ts +200 -278
  36. package/src/workpack-pure.js +1 -1
  37. package/schema/agent-host-2-receipt.schema.json +0 -206
  38. package/schema/agent-host-2-request.schema.json +0 -135
  39. package/schema/agent-host-capabilities-1.schema.json +0 -40
  40. package/schema/consumption-plan-1.schema.json +0 -280
  41. package/schema/judgment-trace-1.schema.json +0 -748
  42. package/schema/runtime-capsule-1.schema.json +0 -68
  43. package/src/lint-pure.js +0 -433
  44. package/src/v1/index.mjs +0 -21
@@ -9,7 +9,7 @@
9
9
  const fs = require('fs');
10
10
  const path = require('path');
11
11
 
12
- // ── Embedded Work Pack Schema v0.1 ──────────────────────────────────
12
+ // ── Embedded Work Pack Schema 0.1 ──────────────────────────────────
13
13
  // Self-contained schema with resolved $refs for zero-dependency validation.
14
14
 
15
15
  const WORK_PACK_SCHEMA = {
@@ -1,206 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://github.com/aikdna/kdna/specs/agent-host-2-receipt.schema.json",
4
- "title": "KDNA Agent Host 2 Correlated Response Receipt",
5
- "description": "Host 2 correlated response envelope. A matched runtime_receipt proves only that the Host boundary accepted the exact Capsule 2 value. A mismatched runtime_receipt proves that the Host rejected the request before provider execution. Neither proves semantic consumption or conformance.",
6
- "type": "object",
7
- "required": ["protocol", "request_id", "runtime_receipt", "outcome"],
8
- "additionalProperties": false,
9
- "properties": {
10
- "protocol": { "const": "kdna.agent-host/2" },
11
- "request_id": { "type": "string", "pattern": "^host_[0-9a-f]{24}$" },
12
- "runtime_receipt": { "$ref": "#/$defs/runtimeReceipt" },
13
- "outcome": {
14
- "oneOf": [{ "$ref": "#/$defs/outcome" }, { "type": "null" }]
15
- }
16
- },
17
- "allOf": [
18
- {
19
- "if": {
20
- "properties": {
21
- "runtime_receipt": {
22
- "properties": { "provider_execution_status": { "const": "completed" } },
23
- "required": ["provider_execution_status"]
24
- }
25
- },
26
- "required": ["runtime_receipt"]
27
- },
28
- "then": { "properties": { "outcome": { "$ref": "#/$defs/outcome" } } },
29
- "else": { "properties": { "outcome": { "type": "null" } } }
30
- }
31
- ],
32
- "$defs": {
33
- "sha256": {
34
- "type": "string",
35
- "pattern": "^sha256:[0-9a-f]{64}$"
36
- },
37
- "runtimeReceipt": {
38
- "type": "object",
39
- "required": [
40
- "type",
41
- "receipt_version",
42
- "capsule_version",
43
- "capsule_digest_profile",
44
- "sender_capsule_delivery_digest",
45
- "host_recomputed_capsule_delivery_digest",
46
- "echoed_capsule_delivery_digest",
47
- "capsule_delivery_comparison",
48
- "capsule_schema_validation",
49
- "asset_id_correlation",
50
- "provider_execution_status",
51
- "usage",
52
- "semantic_consumption",
53
- "model_identity"
54
- ],
55
- "additionalProperties": false,
56
- "properties": {
57
- "type": { "const": "kdna.agent-host.runtime-receipt" },
58
- "receipt_version": { "const": "1.0.0" },
59
- "capsule_version": { "const": "2.0" },
60
- "capsule_digest_profile": { "const": "kdna-capsule-jcs-v1" },
61
- "sender_capsule_delivery_digest": { "$ref": "#/$defs/sha256" },
62
- "host_recomputed_capsule_delivery_digest": { "$ref": "#/$defs/sha256" },
63
- "echoed_capsule_delivery_digest": { "$ref": "#/$defs/sha256" },
64
- "capsule_delivery_comparison": { "enum": ["matched", "mismatched"] },
65
- "capsule_schema_validation": { "const": "passed" },
66
- "asset_id_correlation": { "const": "matched" },
67
- "provider_execution_status": {
68
- "enum": ["completed", "not_started", "failed", "cancelled", "timed_out"]
69
- },
70
- "usage": { "$ref": "#/$defs/observedUsage" },
71
- "semantic_consumption": { "$ref": "#/$defs/semanticConsumption" },
72
- "model_identity": { "$ref": "#/$defs/modelIdentity" }
73
- },
74
- "allOf": [
75
- {
76
- "if": {
77
- "properties": { "capsule_delivery_comparison": { "const": "matched" } },
78
- "required": ["capsule_delivery_comparison"]
79
- },
80
- "then": {
81
- "properties": {
82
- "provider_execution_status": {
83
- "enum": ["completed", "failed", "cancelled", "timed_out"]
84
- }
85
- }
86
- },
87
- "else": {
88
- "properties": {
89
- "provider_execution_status": { "const": "not_started" },
90
- "usage": {
91
- "properties": {
92
- "tokens_used": { "type": "null" },
93
- "model_calls": { "type": "null" },
94
- "basis": { "const": "not_observed" }
95
- }
96
- },
97
- "model_identity": {
98
- "properties": {
99
- "value": { "type": "null" },
100
- "basis": { "const": "not_observed" }
101
- }
102
- }
103
- }
104
- }
105
- }
106
- ]
107
- },
108
- "semanticConsumption": {
109
- "type": "object",
110
- "required": ["state", "basis"],
111
- "additionalProperties": false,
112
- "properties": {
113
- "state": { "const": "not_observed" },
114
- "basis": { "type": "null" }
115
- }
116
- },
117
- "observedUsage": {
118
- "type": "object",
119
- "required": ["elapsed_ms", "elapsed_basis", "tokens_used", "model_calls", "basis"],
120
- "additionalProperties": false,
121
- "properties": {
122
- "elapsed_ms": { "type": "integer", "minimum": 0 },
123
- "elapsed_basis": { "const": "host_monotonic" },
124
- "tokens_used": {
125
- "oneOf": [{ "type": "integer", "minimum": 0 }, { "type": "null" }]
126
- },
127
- "model_calls": {
128
- "oneOf": [{ "type": "integer", "minimum": 0 }, { "type": "null" }]
129
- },
130
- "basis": { "enum": ["host_reported", "not_observed"] }
131
- },
132
- "allOf": [
133
- {
134
- "if": {
135
- "properties": { "basis": { "const": "host_reported" } },
136
- "required": ["basis"]
137
- },
138
- "then": {
139
- "properties": {
140
- "tokens_used": { "type": "integer", "minimum": 0 },
141
- "model_calls": { "type": "integer", "minimum": 0 }
142
- }
143
- },
144
- "else": {
145
- "properties": {
146
- "tokens_used": { "type": "null" },
147
- "model_calls": { "type": "null" }
148
- }
149
- }
150
- }
151
- ]
152
- },
153
- "modelIdentity": {
154
- "type": "object",
155
- "required": ["value", "basis"],
156
- "additionalProperties": false,
157
- "properties": {
158
- "value": { "type": ["string", "null"], "minLength": 1 },
159
- "basis": { "enum": ["host_reported", "not_observed"] }
160
- },
161
- "allOf": [
162
- {
163
- "if": {
164
- "properties": { "basis": { "const": "host_reported" } },
165
- "required": ["basis"]
166
- },
167
- "then": { "properties": { "value": { "type": "string", "minLength": 1 } } },
168
- "else": { "properties": { "value": { "type": "null" } } }
169
- }
170
- ]
171
- },
172
- "outcome": {
173
- "type": "object",
174
- "required": ["judgment", "usage"],
175
- "additionalProperties": false,
176
- "properties": {
177
- "judgment": { "$ref": "#/$defs/judgment" },
178
- "usage": {
179
- "oneOf": [{ "$ref": "#/$defs/usage" }, { "type": "null" }]
180
- }
181
- }
182
- },
183
- "judgment": {
184
- "type": "object",
185
- "required": ["answer", "reasoning", "confidence"],
186
- "additionalProperties": false,
187
- "properties": {
188
- "answer": { "type": "string", "minLength": 1 },
189
- "reasoning": {
190
- "type": "array",
191
- "items": { "type": "string" }
192
- },
193
- "confidence": { "type": ["string", "null"], "minLength": 1 }
194
- }
195
- },
196
- "usage": {
197
- "type": "object",
198
- "required": ["tokens_used", "model_calls"],
199
- "additionalProperties": false,
200
- "properties": {
201
- "tokens_used": { "type": "integer", "minimum": 0 },
202
- "model_calls": { "type": "integer", "minimum": 0 }
203
- }
204
- }
205
- }
206
- }
@@ -1,135 +0,0 @@
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
- }
@@ -1,40 +0,0 @@
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
- }
@@ -1,280 +0,0 @@
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
- }