@aikdna/kdna-core 0.15.0 → 0.15.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.
Files changed (2) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/package.json +2 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,107 @@
1
+ # Changelog
2
+
3
+ ## v0.15.1 (2026-06-27)
4
+ - Fix: package.json `files` array now includes `CHANGELOG.md`. The
5
+ v0.15.0 tarball was published without the changelog, leaving
6
+ consumers with no way to read release notes from `npm install`.
7
+ Adding it now is a no-op for code but resolves the docs gap.
8
+
9
+ ## v0.15.0 (2026-06-27)
10
+ - B2: scrypt password profile `kdna-password-protected-v1-scrypt` (ADR-007)
11
+ - encryptProtectedEntryScrypt / decryptProtectedEntryScrypt (zero new deps, Node crypto.scryptSync)
12
+ - AES-256-GCM + AES-256-KW envelope encryption, same CEK model as RFC-0008
13
+ - scrypt N=32768 r=8 p=1, 32B KEK, 16B random salt
14
+ - planLoad inferEntitlementProfile detects scrypt profile
15
+ - decrypt dispatch routes Argon2id vs scrypt by envelope profile field
16
+ - recovery slot deferred to v0.2; v0.1: single password slot
17
+ - B5: conformance:canonical npm script (threshold #8)
18
+
19
+ ## v0.14.0 (2026-06-25)
20
+ - B1: unified container dispatcher (readAsset — v1/v2/ dir → CanonicalAssetModel)
21
+ - B4: loadAuthorized decryption orchestration (opts.password, opts.decryptEntry)
22
+ - B4: encrypted payload detection in runValidate (backward compatible)
23
+ - B8: cross-language golden vectors (test-vectors/golden-vectors.js — 8/8)
24
+ - Wave 4: canonical conformance (conformance/canonical-conformance.mjs — 13/13)
25
+ - Wave 2.5: clear deprecated registry/domains.json private entries
26
+ - Wave 3a: CQ-T2/T3 symmetric compact rendering, scenario null consistency
27
+ - Add: engines.node >=18.0.0
28
+
29
+ ## v0.13.3 (2026-06-22)
30
+ - Fix: index profile includes max_tokens_hint
31
+ - Fix: compact profile falls back to full_statement for TBD placeholders
32
+
33
+ Packages: `@aikdna/kdna-core`
34
+
35
+ ## v0.13.2 (2026-06-21)
36
+
37
+ ### Fixed
38
+ - Compact boundary projection now correctly preserves `applies_when`, `does_not_apply_when`, and `failure_risk` fields across all load profiles. These axiom governance fields are required by `kdna-loader` for domain routing decisions and were being dropped in compact mode under certain manifest configurations.
39
+ - Cross-platform test stability: Node test glob patterns are now compatible with both macOS and Linux filesystem sort orders.
40
+ - Hash library compatibility: `@noble/hashes` replaces Node-only crypto for digest operations, maintaining Node 18 compatibility without native module binding requirements.
41
+
42
+ ### Changed
43
+ - Public API boundary hardened: `loadKDNA`, `loadKDNASync`, `inspectKDNA`, and `inspectKDNASync` now enforce the asset-first contract — callers must pass `.kdna` files or asset handles, not raw directory paths.
44
+ - Examples in README and inline docs reference the packaged `.kdna` path rather than source directories.
45
+ - First-run contract tightened: exported symbols, error codes, and validation gate names are now part of the stable API surface.
46
+
47
+ ---
48
+
49
+ ## v0.13.1 (2026-06-21)
50
+
51
+ ### Fixed
52
+ - **Compact boundary projection preserved.** The `planLoad` function and `loadAuthorized` shim now pass through the full axiom governance projection (applies_when, does_not_apply_when, failure_risk) even when the load contract is not present in the manifest. Prior versions could strip these fields under compact profile, breaking domain routing for `kdna-loader`.
53
+ - Digest matching now tolerates `sha256:` prefix in both `manifest_digest` and `payload_digest` checksums entries. Previously, a leading `sha256:` prefix was treated as part of the hex digest, causing false mismatches.
54
+
55
+ ### Changed
56
+ - Public API provenance and profile split clarified: `loadKDNA` / `loadKDNASync` are the stable entry points for runtime consumers. Lower-level `readV1Layout`, `runValidate`, and `planLoad` are exported for advanced tooling but carry no backward-compatibility guarantee.
57
+ - Access enum values normalized everywhere: `public`, `licensed`, `remote`. Legacy aliases (`open` → `public`, `protected` → `licensed`, `runtime` → `remote`) are mapped transparently with an info-level issue in the LoadPlan.
58
+ - `verifyAsset` / `verifyAssetSync`, `verifyDigest` / `verifyDigestSync`, and `verifySignature` / `verifySignatureSync` are now documented as the stable verification API surface.
59
+
60
+ ---
61
+
62
+ ## v0.13.0 (2026-06-19)
63
+
64
+ ### Added
65
+ - **Authorization LoadPlan contract.** The `planLoad(inputPath, opts)` function returns a structured LoadPlan before any judgment content is decrypted or emitted. The LoadPlan reports:
66
+ - `asset_id`, `asset_uid`, `title`, `version`, `judgment_version`
67
+ - `access` model (`public` | `licensed` | `remote`)
68
+ - `entitlement_profile` (`password`, `local_receipt`, `account`, `org`, `purchase_receipt`, `device_bound`)
69
+ - `state` (`ready` | `needs_password` | `needs_license` | `needs_account` | `needs_org_auth` | `expired_grace` | `offline_grace` | `denied` | `invalid` | `needs_runtime`)
70
+ - `required_action` (`load` | `enter_password` | `install_receipt` | `sign_in_or_activate` | `renew_entitlement` | `sync` | `contact_issuer` | `connect_runtime` | `block`)
71
+ - `can_load_now` boolean — the single decision point for product consumers
72
+ - `projection_policy` (`none` | `minimal` | `remote`)
73
+ - `checks` block with per-gate validation results
74
+ - `issues` array with structured error codes (`KDNA_FORMAT_INVALID`, `KDNA_INTEGRITY_DIGEST_FAILED`, `KDNA_AUTH_PASSWORD_REQUIRED`, `KDNA_AUTH_ENTITLEMENT_REQUIRED`, `KDNA_ACCESS_MODE_UNKNOWN`, etc.)
75
+ - `input_fingerprint` capturing the source digest, has-password signal, and entitlement status for cache keying
76
+ - `source.kind` and `source.path` indicating whether the input was a source directory or `.kdna` container
77
+ - **`loadAuthorized(inputPath, opts)`** — a higher-level loader that calls `planLoad` first and blocks load when `can_load_now` is false. Throws `KDNA_LOAD_NOT_AUTHORIZED` with the first issue's code. This is the recommended entry point for agent runtimes.
78
+ - **`loadV1(inputPath, opts)`** — renders judgment content into agent-ready prompt text. Supports profiles (`index`, `compact`, `scenario`, `full`) and output formats (`json`, `prompt`). The `prompt` format produces a flat text block suitable for agent context windows with proper axiom applicability rendering.
79
+ - **KDNA Core v1 inspect module.** `inspect(inputPath)` returns a content-neutral manifest summary including `asset_id`, `asset_uid`, `kdna_version`, `payload_encrypted`, `profile`, `load_contract_default_profile`, and signature count. Output is always JSON. Banned terms (`trusted`, `recommended`, `high_quality`, `officially_approved`) are enforced by an automatic assertion.
80
+ - **KDNA Core v1 validate module.** `validate(inputPath)` runs four independent gates:
81
+ 1. **Format gate:** required entries present (`mimetype`, `kdna.json`, `payload.kdnab`), mimetype content correct, lineage is an object not an array
82
+ 2. **Schema gate:** `kdna.json` against `manifest.schema.json` via AJV 2020-12
83
+ 3. **Payload gate:** `payload.kdnab` against `payload-profile-v1.schema.json`
84
+ 4. **Checksums gate:** when `checksums.json` is present, computed digests are compared against declared values for `kdna.json`, `payload.kdnab`, and the combined asset digest
85
+ - **KDNA Core v1 pack module.** `pack(sourceDir, outputPath)` produces a deterministic `.kdna` container: fixed DOS epoch timestamps, alphabetical entry order, mimetype first (STORED, method 0). Same source → byte-identical output.
86
+ - **KDNA Core v1 unpack module.** `unpack(inputPath, outputDir)` extracts a `.kdna` container to a directory with path-traversal protection.
87
+ - **Container security hardening.** ZIP reader enforces:
88
+ - Maximum container size (25 MiB), max entries (128), max entry size (5 MiB), max total uncompressed (12 MiB)
89
+ - Max compression ratio (100:1) to prevent zip bombs
90
+ - Max JSON depth (64), max array length (10,000), max string length (1 MiB)
91
+ - Entry name normalization (NFC Unicode, no backslash separators, no absolute paths, no `..` traversal)
92
+ - Duplicate entry rejection
93
+ - Symlink and device/special file rejection
94
+ - **Digest matching verification.** When `checksums.json` includes `manifest_digest`, `payload_digest`, or `asset_digest`, the validate module computes actual SHA-256 hashes and compares them. Mismatch produces a `KDNA_INTEGRITY_DIGEST_FAILED` issue.
95
+ - **Load contract validation.** When the manifest includes a `load_contract` block, it is validated against `load-contract.schema.json`. A missing load contract is not an error — it simply means no specialization.
96
+ - **Dual CJS/ESM exports.** `src/index.js` (CommonJS) and `src/index.mjs` (ES module) with matching `exports` map. The v1 module is also available at `@aikdna/kdna-core/v1`.
97
+ - **TypeScript declarations.** `src/types.d.ts` exports type definitions for the stable public API surface.
98
+
99
+ ### Changed
100
+ - **V1 is the only active format path.** The v2 reader (`readDataMapSync`, `readDataMap`) remains in the codebase for migration compatibility but is no longer the default path. All new integrations should use the v1 API: `inspect`, `validate`, `planLoad`, `loadAuthorized`.
101
+ - `validate` and `planLoad` reject v2 containers (`application/vnd.aikdna.kdna+zip`) with a format error.
102
+ - Access model normalized to the three-tier `public` | `licensed` | `remote` enum. The LoadPlan maps legacy values transparently with an info-level issue.
103
+ - Container format detection (`detectContainerFormat`) reads only the first central-directory entry to determine v1 vs v2, preventing malicious later entries from causing format confusion.
104
+
105
+ ### Removed
106
+ - Legacy v1 compatibility shims removed. v2 is the only legacy format and is handled through the existing `asset-reader.js` module.
107
+ - `readDataMapSync` / `readDataMap` deprecated for new use. Use `planLoad` + `loadV1` for runtime loading or `validate` + `inspect` for diagnostics.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikdna/kdna-core",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "KDNA Core library for validating, planning, and loading local .kdna judgment assets.",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -32,6 +32,7 @@
32
32
  "src/",
33
33
  "schema/",
34
34
  "README.md",
35
+ "CHANGELOG.md",
35
36
  "LICENSE",
36
37
  "NOTICE"
37
38
  ],