@aikdna/kdna-core 0.11.1 → 0.12.1

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2025-2026 AIKDNA Contributors
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,9 @@
1
+ KDNA
2
+ Copyright 2026 KDNA contributors
3
+
4
+ This product includes software developed by the KDNA Team
5
+ (https://github.com/aikdna).
6
+
7
+ KDNA Documentation and examples are licensed under CC BY 4.0 unless
8
+ otherwise noted. Code, including validators and package metadata, is
9
+ licensed under Apache-2.0.
package/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # @aikdna/kdna-core
2
2
 
3
- Core library for loading, validating, linting, rendering, composing, and directly reading KDNA `.kdna` cognition assets. It has zero npm runtime dependencies.
3
+ Core library for KDNA judgment assets.
4
+
5
+ KDNA Core v1 defines the official `.kdna` source/container contract used by
6
+ the CLI, Studio export, skills, MCP integrations, and downstream agent
7
+ runtimes.
4
8
 
5
9
  ## Installation
6
10
 
@@ -8,187 +12,92 @@ Core library for loading, validating, linting, rendering, composing, and directl
8
12
  npm install @aikdna/kdna-core
9
13
  ```
10
14
 
11
- ## Preferred public API
12
-
13
- Third-party adapters should start with the stable asset-first API. These
14
- functions accept a `.kdna` file path, bytes, or an already opened asset and do
15
- not require persistent extraction.
15
+ If you need full JSON Schema validation through Ajv, also install:
16
16
 
17
- ```js
18
- const {
19
- inspectKDNA,
20
- validateKDNA,
21
- loadKDNA,
22
- renderForAgent,
23
- verifyAsset,
24
- verifyDigest,
25
- verifySignature,
26
- matchDomain,
27
- composeKDNA
28
- } = require('@aikdna/kdna-core');
29
-
30
- const info = await inspectKDNA('./writing.kdna');
31
- const validation = await validateKDNA('./writing.kdna');
32
- const loaded = await loadKDNA('./writing.kdna', { profile: 'compact' });
33
- const promptContext = await renderForAgent('./writing.kdna');
34
-
35
- await verifyAsset('./writing.kdna', {
36
- asset_digest: info.asset_digest,
37
- requireSignature: true
38
- });
39
- await verifyDigest('./writing.kdna', info.asset_digest);
40
- await verifySignature('./writing.kdna');
41
-
42
- const matches = await matchDomain('Review this writing draft', ['./writing.kdna']);
43
- const composed = await composeKDNA(['./writing.kdna', './agent_safety.kdna'], {
44
- input: 'Review this public release note for safety and writing quality'
45
- });
17
+ ```bash
18
+ npm install ajv ajv-formats
46
19
  ```
47
20
 
48
- Stable entry points:
49
-
50
- | Function | Purpose |
51
- | --- | --- |
52
- | `openKDNA()` | Open a `.kdna` file or bytes as an immutable asset. |
53
- | `inspectKDNA()` | Return manifest, entries, access, quality, risk, and digests. |
54
- | `validateKDNA()` | Run asset, lint, schema, and cross-file validation. |
55
- | `loadKDNA()` | Load index/compact/scenario/full profiles directly from `.kdna`. |
56
- | `renderForAgent()` | Render a loaded asset into agent prompt context. |
57
- | `verifyAsset()` | Run full asset verification: digest, content digest, signature, and trust metadata. |
58
- | `verifyDigest()` | Check whole-file `asset_digest`. |
59
- | `verifySignature()` | Require Ed25519 signature verification. |
60
- | `matchDomain()` | Rank candidate assets for a task string. |
61
- | `composeKDNA()` | Compose multiple assets with attribution and conflict reporting. |
21
+ ## KDNA Core v1 API
62
22
 
63
- ## Lower-level usage
23
+ Use the `./v1` entrypoint for current KDNA Core v1 tooling:
64
24
 
65
25
  ```js
66
26
  const {
67
- createKdnaAssetReader,
68
- lintDomain,
69
- validateDomainSchema,
70
- validateCrossFile
71
- } = require('@aikdna/kdna-core');
72
-
73
- // Validate a domain
74
- const dataMap = {
75
- 'KDNA_Core.json': { meta: { domain: 'my_domain' }, axioms: [...] },
76
- 'KDNA_Patterns.json': { meta: { domain: 'my_domain' }, self_check: [...] }
77
- };
78
-
79
- const lintResult = lintDomain(dataMap);
80
- const schemaResult = validateDomainSchema(dataMap, schemas);
81
- const crossResult = validateCrossFile(dataMap);
82
- ```
83
-
84
- ## API
85
-
86
- ### `createKdnaAssetReader()`
87
-
88
- Direct `.kdna` container reader. The reader opens ZIP-backed `.kdna` assets without persistent extraction and exposes:
89
-
90
- - `open(pathOrBytes)`
91
- - `listEntries(asset)`
92
- - `readEntry(asset, entryName)`
93
- - `readJson(asset, entryName)`
94
- - `readManifest(asset)`
95
- - `readDataMap(asset)`
96
- - `contentDigest(asset)`
97
- - `verify(asset, { asset_digest?, content_digest?, requireSignature? })`
98
- - `loadProfile(asset, "index" | "compact" | "scenario" | "full", options?)`
99
-
100
- Example:
101
-
102
- ```js
103
- const { createKdnaAssetReader } = require('@aikdna/kdna-core');
104
-
105
- const reader = createKdnaAssetReader();
106
- const asset = await reader.open('./writing.kdna');
107
- const manifest = await reader.readManifest(asset);
108
- const trust = await reader.verify(asset, { requireSignature: true });
109
- const loaded = await reader.loadProfile(asset, 'compact');
110
- ```
111
-
112
- The asset reader treats extraction caches as implementation details. The `.kdna` file remains the identity, install, verification, and loading object.
113
-
114
- Licensed assets can list encrypted JSON entries in `kdna.json`:
115
-
116
- ```json
117
- {
118
- "access": "licensed",
119
- "encryption": {
120
- "profile": "kdna-licensed-entry-v1",
121
- "encrypted_entries": ["KDNA_Core.json", "KDNA_Patterns.json"]
122
- }
27
+ inspect,
28
+ validate,
29
+ pack,
30
+ unpack,
31
+ loadV1,
32
+ buildChecksumsV1
33
+ } = require('@aikdna/kdna-core/v1');
34
+
35
+ const validation = validate('./asset.kdna');
36
+ if (!validation.overall_valid) {
37
+ throw new Error(validation.problems.join('\n'));
123
38
  }
124
- ```
125
-
126
- The reader never writes decrypted entries to disk. Callers provide an in-memory
127
- `decryptEntry` hook when they have already validated license activation:
128
-
129
- ```js
130
- const { createLicensedDecryptEntry } = require('@aikdna/kdna-core');
131
39
 
132
- const decryptEntry = createLicensedDecryptEntry({
133
- licenseKey: activation.license_key,
134
- machineFingerprint: activation.machine_fingerprint
40
+ const compact = loadV1('./asset.kdna', {
41
+ profile: 'compact',
42
+ as: 'prompt'
135
43
  });
136
-
137
- const loaded = await reader.loadProfile(asset, 'compact', { decryptEntry });
138
44
  ```
139
45
 
140
- The profile uses AES-256-GCM over each protected entry and derives the entry key
141
- from the license key plus machine fingerprint using `scrypt-sha256`. This is a
142
- runtime primitive, not a license activation system; callers must validate license
143
- status before passing a decrypt hook to the reader.
144
-
145
- ### `lintDomain(dataMap)`
146
- Structural linting — checks required files, field presence, unique IDs, yes/no answerable self-checks, cross-file references, and flags potentially vague axioms.
147
-
148
- Returns `{ errors: string[], warnings: string[] }`.
149
-
150
- ### `validateDomainSchema(dataMap, schemaMap)`
151
- JSON Schema validation against published schemas (KDNA_Core, KDNA_Patterns, KDNA_Scenarios, KDNA_Cases, KDNA_Reasoning, KDNA_Evolution).
46
+ ## Supported Runtime Flow
152
47
 
153
- Returns `{ errors: string[], warnings: string[] }`.
154
-
155
- ### `validateCrossFile(dataMap)`
156
- Cross-file consistency checks — ensures references between domain files are valid.
157
-
158
- Returns `{ errors: string[], warnings: string[] }`.
159
-
160
- ### `renderDomain(dataMap, options?)`
161
- Renders domain files into a structured context block using a standard template. The rendered context preserves the domain's structure as distinct, named sections suitable for agent system prompts.
48
+ ```text
49
+ v1 source directory
50
+ buildChecksumsV1
51
+ pack
52
+ → validate
53
+ loadV1
54
+ → agent/runtime context
55
+ ```
162
56
 
163
- ## Compose API (9 functions)
57
+ ## v1 Source Directory
164
58
 
165
- Multi-domain composition load multiple KDNA domains, classify which should activate for a given input, detect conflicts, and merge their judgment into a single agent context.
59
+ A v1 source directory contains:
166
60
 
167
- ### Context Composition
61
+ - `mimetype`
62
+ - `kdna.json`
63
+ - `payload.kdnab`
64
+ - `checksums.json`
168
65
 
169
- - **`composeContext(domains, options?)`** — Merge multiple loaded domains into a single context string. Conflicting axioms or banned terms from different domains are both included; the agent must report the conflict rather than silently resolve it.
66
+ ## v1 Container
170
67
 
171
- - **`composeContextWithAttribution(domains, options?)`** — Same as `composeContext`, but every axiom, misunderstanding, banned term, and self-check is prefixed with its origin domain (e.g., `[writing:axiom.axiom_problem_not_prose]`). Returns `{ context, attributionMap }`.
68
+ A v1 `.kdna` container is a zip package of the same files. `validate()` checks:
172
69
 
173
- - **`loadAndCompose(dataMaps, options?)`** — Convenience function: loads each domain from file data maps, classifies signals against input, then composes the active domains. Returns `{ domains, context, activeIndices }`.
70
+ - format
71
+ - manifest schema
72
+ - payload parseability
73
+ - checksum consistency
74
+ - load-profile contract
174
75
 
175
- ### Signal Classification
76
+ ## Load Profiles
176
77
 
177
- - **`classifySignals(input, domains)`** — Match user input against each domain's `trigger_signals`. Returns indices of matching domains. Domains with no signals defined are treated as primary (always active).
78
+ `loadV1()` supports:
178
79
 
179
- - **`classifySignalsAcrossDomains(input, domainEntries)`** — Full diagnostic version of signal classification. Returns `{ selected, excluded }` with reasons (`signal_match`, `required`, `blocked by does_not_apply_when`, `no signal match`).
80
+ - `index`
81
+ - `compact`
82
+ - `scenario`
83
+ - `full`
180
84
 
181
- ### Cluster Operations
85
+ Output formats:
182
86
 
183
- - **`loadCluster(clusterManifestPath, domainLoader)`** — Load a cluster manifest (`kdna.cluster.json`) and resolve each domain via the provided loader function. Returns `{ manifest, domains, errors }`.
87
+ - `json`
88
+ - `prompt`
184
89
 
185
- - **`detectDomainConflicts(domains)`** — Detect conflicts between loaded domains in a cluster. Currently checks for: (1) banned term collisions across domains, (2) contradictory stances (simple negation heuristic). Returns array of conflict objects with `type`, `domains`, and `description`.
90
+ ## Boundary
186
91
 
187
- - **`generateClusterTrace({ input, loadedDomains, activeDomains, conflicts })`** — Generate a judgment trace record for a cluster operation. Returns `{ input, timestamp, loaded_domains, active_domains, active_count, domains_excluded, conflicts }`.
92
+ KDNA Core v1 is content-neutral. It does not recommend assets, assign quality
93
+ badges, run a marketplace, or define a public registry. Future signature,
94
+ encryption, licensing, and entitlement work is gated outside the current v1
95
+ baseline.
188
96
 
189
- ### Utilities
97
+ ## Legacy API
190
98
 
191
- - **`composeChecks(domains)`** Merge self-check items from multiple domains into a single checklist. Each item is prefixed with its domain name so overlaps are visible.
99
+ The package root still exports compatibility APIs for older KDNA paths. New
100
+ tooling should prefer `@aikdna/kdna-core/v1`.
192
101
 
193
102
  ## License
194
103
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikdna/kdna-core",
3
- "version": "0.11.1",
3
+ "version": "0.12.1",
4
4
  "description": "KDNA core library — load, validate, lint, and render KDNA domain judgment assets. Supports KDNA Container format (payload.kdnab via CBOR).",
5
5
  "type": "commonjs",
6
6
  "main": "src/index.js",
@@ -21,12 +21,15 @@
21
21
  },
22
22
  "types": "src/types.d.ts",
23
23
  "scripts": {
24
- "test": "node --test test/*.test.js && node -e \"const m = require('./src/index.js'); console.log('kdna-core exports:', Object.keys(m).join(', '));\""
24
+ "test": "node ../../scripts/run-node-tests.js test/*.test.js && node -e \"const m = require('./src/index.js'); console.log('kdna-core exports:', Object.keys(m).join(', '));\"",
25
+ "prepublishOnly": "npm --prefix ../.. run ecosystem-gate"
25
26
  },
26
27
  "files": [
27
28
  "src/",
28
29
  "schema/",
29
- "README.md"
30
+ "README.md",
31
+ "LICENSE",
32
+ "NOTICE"
30
33
  ],
31
34
  "keywords": [
32
35
  "kdna",
@@ -54,7 +57,7 @@
54
57
  }
55
58
  },
56
59
  "dependencies": {
57
- "@noble/hashes": "^2.2.0",
60
+ "@noble/hashes": "^1.8.0",
58
61
  "cbor-x": "^1.6.4"
59
62
  }
60
63
  }
@@ -0,0 +1,119 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/aikdna/kdna/schema/load-plan.schema.json",
4
+ "title": "KDNA LoadPlan v1",
5
+ "description": "Machine-readable pre-load authorization and runtime planning result for KDNA Core v1 assets.",
6
+ "type": "object",
7
+ "required": [
8
+ "kdna_version",
9
+ "asset",
10
+ "access",
11
+ "access_alias",
12
+ "entitlement_profile",
13
+ "state",
14
+ "required_action",
15
+ "can_load_now",
16
+ "projection_policy",
17
+ "checks",
18
+ "issues",
19
+ "source"
20
+ ],
21
+ "additionalProperties": false,
22
+ "properties": {
23
+ "kdna_version": { "type": ["string", "null"] },
24
+ "asset": {
25
+ "type": "object",
26
+ "required": ["asset_id", "asset_uid", "title", "version", "judgment_version"],
27
+ "additionalProperties": false,
28
+ "properties": {
29
+ "asset_id": { "type": ["string", "null"] },
30
+ "asset_uid": { "type": ["string", "null"] },
31
+ "title": { "type": ["string", "null"] },
32
+ "version": { "type": ["string", "null"] },
33
+ "judgment_version": { "type": ["string", "null"] }
34
+ }
35
+ },
36
+ "access": {
37
+ "type": ["string", "null"],
38
+ "enum": ["public", "licensed", "remote", null]
39
+ },
40
+ "access_alias": { "type": ["string", "null"] },
41
+ "entitlement_profile": { "type": ["string", "null"] },
42
+ "state": {
43
+ "type": "string",
44
+ "enum": [
45
+ "ready",
46
+ "needs_password",
47
+ "needs_license",
48
+ "needs_account",
49
+ "needs_org_auth",
50
+ "needs_runtime",
51
+ "offline_grace",
52
+ "expired",
53
+ "revoked",
54
+ "invalid"
55
+ ]
56
+ },
57
+ "required_action": {
58
+ "type": "string",
59
+ "enum": [
60
+ "none",
61
+ "load",
62
+ "enter_password",
63
+ "install_receipt",
64
+ "sign_in_or_activate",
65
+ "sync",
66
+ "connect_runtime",
67
+ "migrate_legacy",
68
+ "block"
69
+ ]
70
+ },
71
+ "can_load_now": { "type": "boolean" },
72
+ "projection_policy": {
73
+ "type": "string",
74
+ "enum": ["minimal", "remote", "none"]
75
+ },
76
+ "checks": {
77
+ "type": "object",
78
+ "required": [
79
+ "format_valid",
80
+ "schema_valid",
81
+ "payload_valid",
82
+ "checksums_valid",
83
+ "load_contract_valid",
84
+ "overall_valid"
85
+ ],
86
+ "additionalProperties": false,
87
+ "properties": {
88
+ "format_valid": { "type": "boolean" },
89
+ "schema_valid": { "type": "boolean" },
90
+ "payload_valid": { "type": "boolean" },
91
+ "checksums_valid": { "type": "boolean" },
92
+ "load_contract_valid": { "type": "boolean" },
93
+ "overall_valid": { "type": "boolean" }
94
+ }
95
+ },
96
+ "issues": {
97
+ "type": "array",
98
+ "items": {
99
+ "type": "object",
100
+ "required": ["code", "severity", "message"],
101
+ "additionalProperties": false,
102
+ "properties": {
103
+ "code": { "type": "string", "pattern": "^KDNA_[A-Z0-9_]+$" },
104
+ "severity": { "type": "string", "enum": ["info", "warning", "blocking"] },
105
+ "message": { "type": "string" }
106
+ }
107
+ }
108
+ },
109
+ "source": {
110
+ "type": "object",
111
+ "required": ["kind", "path"],
112
+ "additionalProperties": false,
113
+ "properties": {
114
+ "kind": { "type": ["string", "null"], "enum": ["dir", "file", null] },
115
+ "path": { "type": "string" }
116
+ }
117
+ }
118
+ }
119
+ }