@aikdna/kdna-core 0.12.1 → 0.12.3

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/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # @aikdna/kdna-core
2
2
 
3
- Core library for KDNA judgment assets.
3
+ Core library for local `.kdna` judgment assets.
4
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.
5
+ KDNA Core v1 defines the `.kdna` file format, schemas, secure container
6
+ reader, LoadPlan contract, and runtime projection helpers used by the CLI,
7
+ Studio export, skills, MCP integrations, and downstream agent runtimes.
8
8
 
9
9
  ## Installation
10
10
 
@@ -26,9 +26,10 @@ Use the `./v1` entrypoint for current KDNA Core v1 tooling:
26
26
  const {
27
27
  inspect,
28
28
  validate,
29
+ planLoad,
30
+ loadAuthorized,
29
31
  pack,
30
32
  unpack,
31
- loadV1,
32
33
  buildChecksumsV1
33
34
  } = require('@aikdna/kdna-core/v1');
34
35
 
@@ -37,7 +38,12 @@ if (!validation.overall_valid) {
37
38
  throw new Error(validation.problems.join('\n'));
38
39
  }
39
40
 
40
- const compact = loadV1('./asset.kdna', {
41
+ const plan = planLoad('./asset.kdna');
42
+ if (plan.can_load_now !== true) {
43
+ throw new Error(`Asset is not loadable yet: ${plan.required_action}`);
44
+ }
45
+
46
+ const compact = loadAuthorized('./asset.kdna', {
41
47
  profile: 'compact',
42
48
  as: 'prompt'
43
49
  });
@@ -50,7 +56,8 @@ v1 source directory
50
56
  → buildChecksumsV1
51
57
  → pack
52
58
  → validate
53
- loadV1
59
+ planLoad
60
+ → loadAuthorized
54
61
  → agent/runtime context
55
62
  ```
56
63
 
@@ -75,7 +82,7 @@ A v1 `.kdna` container is a zip package of the same files. `validate()` checks:
75
82
 
76
83
  ## Load Profiles
77
84
 
78
- `loadV1()` supports:
85
+ `loadAuthorized()` supports:
79
86
 
80
87
  - `index`
81
88
  - `compact`
@@ -89,15 +96,14 @@ Output formats:
89
96
 
90
97
  ## Boundary
91
98
 
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.
99
+ KDNA Core v1 is content-neutral. It validates file structure and loadability;
100
+ it does not rank judgment quality or endorse specific assets.
96
101
 
97
102
  ## Legacy API
98
103
 
99
104
  The package root still exports compatibility APIs for older KDNA paths. New
100
- tooling should prefer `@aikdna/kdna-core/v1`.
105
+ tooling should prefer `@aikdna/kdna-core/v1` and the `planLoad` /
106
+ `loadAuthorized` path.
101
107
 
102
108
  ## License
103
109
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aikdna/kdna-core",
3
- "version": "0.12.1",
4
- "description": "KDNA core library load, validate, lint, and render KDNA domain judgment assets. Supports KDNA Container format (payload.kdnab via CBOR).",
3
+ "version": "0.12.3",
4
+ "description": "KDNA Core library for validating, planning, and loading local .kdna judgment assets.",
5
5
  "type": "commonjs",
6
6
  "main": "src/index.js",
7
7
  "module": "src/index.mjs",
@@ -35,7 +35,7 @@
35
35
  "kdna",
36
36
  "kdna-core",
37
37
  "ai-agent",
38
- "domain-cognition"
38
+ "judgment-assets"
39
39
  ],
40
40
  "license": "Apache-2.0",
41
41
  "repository": {
@@ -71,7 +71,12 @@
71
71
  "additionalProperties": true,
72
72
  "properties": {
73
73
  "name": { "type": "string", "minLength": 1 },
74
- "id": { "type": "string" }
74
+ "id": { "type": "string" },
75
+ "creator_type": {
76
+ "type": "string",
77
+ "enum": ["human", "agent", "tool", "organization"],
78
+ "description": "Kind of creator identity represented by this record."
79
+ }
75
80
  },
76
81
  "description": "Who produced the asset. Provenance only; not a trust claim."
77
82
  },
package/src/types.d.ts CHANGED
@@ -560,6 +560,7 @@ export function planLoad(inputPath: string, options?: { password?: string; hasPa
560
560
  export function buildChecksumsV1(sourceDir: string): KDNAV1Checksums;
561
561
  export function pack(sourceDir: string, outputPath: string): void;
562
562
  export function unpack(inputPath: string, outputDir: string): void;
563
+ export function loadAuthorized(inputPath: string, options?: { profile?: 'index' | 'compact' | 'scenario' | 'full' | string; as?: 'json' | 'prompt' | string }): Record<string, any>;
563
564
  export function loadV1(inputPath: string, options?: { profile?: 'index' | 'compact' | 'scenario' | 'full' | string; as?: 'json' | 'prompt' | string }): Record<string, any>;
564
565
  export const FORBIDDEN_OUTPUT_TERMS: readonly string[];
565
566
 
package/src/v1/index.js CHANGED
@@ -1374,6 +1374,12 @@ function loadV1(inputPath, opts = {}) {
1374
1374
  return loadAuthorized(inputPath, opts);
1375
1375
  }
1376
1376
 
1377
+ function normalizeTextList(value) {
1378
+ if (Array.isArray(value)) return value.filter((item) => typeof item === 'string' && item.trim()).map((item) => item.trim());
1379
+ if (typeof value === 'string' && value.trim()) return [value.trim()];
1380
+ return [];
1381
+ }
1382
+
1377
1383
  function normalizeCompactAxiom(axiom) {
1378
1384
  if (typeof axiom === 'string') {
1379
1385
  return {
@@ -1393,8 +1399,8 @@ function normalizeCompactAxiom(axiom) {
1393
1399
  id: axiom.id || null,
1394
1400
  statement,
1395
1401
  one_sentence: axiom.one_sentence || statement,
1396
- applies_when: Array.isArray(axiom.applies_when) ? axiom.applies_when : [],
1397
- does_not_apply_when: Array.isArray(axiom.does_not_apply_when) ? axiom.does_not_apply_when : [],
1402
+ applies_when: normalizeTextList(axiom.applies_when),
1403
+ does_not_apply_when: normalizeTextList(axiom.does_not_apply_when),
1398
1404
  failure_risk: axiom.failure_risk || null,
1399
1405
  };
1400
1406
  }