@aikdna/kdna-core 0.17.0 → 0.19.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 (38) hide show
  1. package/CHANGELOG.md +227 -64
  2. package/README.md +114 -77
  3. package/package.json +8 -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 +42 -3
  9. package/schema/consumption-plan.schema.json +428 -0
  10. package/schema/digest-evidence.schema.json +212 -0
  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 +7 -5
  15. package/schema/manifest.schema.json +70 -10
  16. package/schema/{payload-profile-v1.schema.json → payload-profile.schema.json} +30 -6
  17. package/schema/runtime-capsule.schema.json +116 -0
  18. package/src/asset-reader.js +106 -120
  19. package/src/{v1 → container}/index.js +566 -209
  20. package/src/container/index.mjs +20 -0
  21. package/src/container-dispatcher.js +10 -7
  22. package/src/crypto-profile.js +37 -107
  23. package/src/external-key-grant.js +41 -15
  24. package/src/index.js +11 -4
  25. package/src/index.mjs +143 -24
  26. package/src/loader-compatibility.js +59 -0
  27. package/src/loader.js +1 -1
  28. package/src/public-api.js +59 -163
  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 +9 -10
  33. package/src/runtime-capsule.js +529 -0
  34. package/src/runtime-contract.js +1882 -0
  35. package/src/types.d.ts +1127 -136
  36. package/src/workpack-pure.js +1 -1
  37. package/src/lint-pure.js +0 -430
  38. package/src/v1/index.mjs +0 -20
package/CHANGELOG.md CHANGED
@@ -1,6 +1,154 @@
1
1
  # Changelog
2
2
 
3
- ## v0.17.0 (2026-07-14)
3
+ ## Unreleased
4
+
5
+ ### Added
6
+
7
+ - Add the separate `@aikdna/kdna-core/remote-runtime` package subpath for a
8
+ deployer-controlled, single packaged remote asset. It validates and loads one
9
+ immutable byte snapshot into a fixed full JSON Runtime Capsule while the
10
+ package-root consumer loaders continue to return
11
+ `KDNA_AUTH_REMOTE_RUNTIME_REQUIRED`.
12
+
13
+ ## 0.19.0 (2026-07-16)
14
+
15
+ ### Fixed
16
+
17
+ - Enforce `compatibility.min_loader_version` as a strict `x.y.z` loader package
18
+ coordinate across inspect, validate, default verification, LoadPlan, and
19
+ load. Requirements above Core `0.19.0` now fail closed with
20
+ `KDNA_LOADER_VERSION_UNSUPPORTED` before projection; malformed coordinates
21
+ remain schema failures, and arbitrary-size components compare without
22
+ numeric overflow.
23
+
24
+ - Require the manifest encryption profile and compatibility coordinate to
25
+ identify a supported contract, and reject a missing, unknown, or
26
+ envelope-mismatched `profile_version` before decryption.
27
+ - Bind encrypted payloads to a required manifest encryption declaration and
28
+ the sole supported `payload.kdnab` entry instead of accepting a missing or
29
+ unrelated encrypted-entry list.
30
+ - Keep the canonical JudgmentTrace schema's blocked Runtime negotiation codes
31
+ identical to the Runtime implementation, TypeScript declarations, and
32
+ conformance fixtures.
33
+ - Accept only `reasoning.self_check` in judgment payloads and fail closed on
34
+ the deprecated plural field or malformed entries.
35
+ - Preserve each validated self-check string or structured question exactly in
36
+ compact Runtime Capsule projection instead of silently dropping or changing
37
+ its shape.
38
+ - Keep the canonical and packaged payload schemas byte-for-byte identical, and
39
+ regenerate the committed CBOR and authorization conformance fixtures with
40
+ matching checksums and digest evidence.
41
+
42
+ ## 0.18.0 (2026-07-15)
43
+
44
+ ### Added
45
+
46
+ - Introduce experimental Runtime Capsule and Host-contract candidates. These
47
+ candidates and their one-way adapter were superseded by the sole stable,
48
+ responsibility-named contracts; they are not supported aliases.
49
+ - Add digest-evidence schemas, RFC 8785 JCS delivery hashing, independent
50
+ expected A/C/E comparisons, digest-specific mismatch codes, and committed
51
+ A/C/E/P conformance goldens.
52
+ - Add committed negotiation, Plan/P recomputation, terminal Trace,
53
+ exact-budget, source-directory block, required-null, and cross-document
54
+ tamper vectors for ConsumptionPlan, Agent Host, and JudgmentTrace.
55
+ - Bind Trace elapsed evidence to the correlated Host receipt, make
56
+ unobserved finite limits propagate to an honest `not_observed` overall
57
+ comparison, and record Host-side P mismatch as a correlated pre-execution
58
+ rejection instead of an impossible terminal state.
59
+ - Expose ConsumptionPlan, Agent Host, budget-evidence, and JudgmentTrace
60
+ builders and validators from CJS, ESM, and TypeScript.
61
+ - Add a dedicated pre-Host budget-blocked Trace builder and validator. They
62
+ preserve projected A/C/E/P, profile, and exact character evidence without
63
+ exposing an over-budget Host request; calls within budget fail closed.
64
+ - Add a bounded runtime-contract JSON parser that rejects duplicate
65
+ decoded keys, invalid UTF-8 and Unicode, BOMs, hostile-key prototype
66
+ mutation, non-finite numbers, and trailing or non-RFC JSON input before
67
+ Agent Host object validation.
68
+
69
+ ### Changed
70
+
71
+ - Converge the compatibility names `inspectKDNA`, `validateKDNA`, and
72
+ `loadKDNA` on the current unversioned Runtime implementation. Validation now
73
+ returns the current five format/schema/payload/checksum/load-contract gates,
74
+ and loading returns a Runtime Capsule; the old source-tree validation and
75
+ `{domain, context}` result shapes are no longer synthesized for current
76
+ assets.
77
+ - Make CJS, ESM, and TypeScript declarations expose the same compatibility
78
+ names and current return contracts.
79
+ - Accept `.kdna` bytes in memory across current inspect, validate, LoadPlan,
80
+ and load paths. Buffer verification does not extract or materialize the
81
+ asset on disk.
82
+ - Read packaged file paths once at load entry so LoadPlan authorization and
83
+ Runtime Capsule projection use the same immutable bytes. The default load
84
+ result is a Runtime Capsule, matching explicit `as: "json"`.
85
+ - Make `composeKDNA` fail closed with
86
+ `KDNA_COMPOSE_PROTOCOL_UNAVAILABLE` until current Cluster/Capsule
87
+ composition semantics are defined; it no longer returns a misleading empty
88
+ composition.
89
+ - Identify `schema/manifest.schema.json` as the sole Runtime manifest schema.
90
+ The older `schema/kdna-manifest.json` remains only for explicit legacy-source
91
+ migration. Runtime `language` remains valid and `creator` provenance remains
92
+ optional, while an explicitly declared creator still requires a non-empty
93
+ name.
94
+
95
+ ### Fixed
96
+
97
+ - Restrict Core publication to canonical `core/<package-version>` published-release
98
+ events, require the exact version tag to identify the workflow commit, and
99
+ make already-published versions idempotent only when registry `gitHead` and
100
+ artifact integrity and SHA-1 shasum match the current release evidence. Only
101
+ npm's structured, exact-version `No match found` response is treated as an
102
+ unpublished version; missing packages, authorization/registry errors,
103
+ missing identity, malformed digests, or a different artifact fail closed
104
+ instead of being treated as a successful duplicate.
105
+ - Report an unavailable GitHub Release lookup as an explicit non-gating
106
+ `SKIP`, rather than wrapping the skipped observation in a misleading
107
+ readiness `PASS`. Remove unused downstream repository checkouts from the
108
+ Core publish job.
109
+ - Make the ESM root and TypeScript declarations expose every existing CJS
110
+ public value, including the crypto, external-grant, Work Pack, composition,
111
+ container, and semver helpers. Permanent source and packed-install checks now
112
+ block entrypoint drift.
113
+ - Model the complete Argon2id password-KDF descriptor and require a machine
114
+ fingerprint when the unified decrypt API receives a legacy or profile-unknown
115
+ envelope. Package tests now isolate every npm operation from the user cache
116
+ and keep pack caches separate from a provably empty offline-install cache.
117
+ Third-party dependency fixtures are packed from script-free temporary copies,
118
+ so package-manager lifecycle behavior cannot introduce network or build-tool
119
+ dependencies into the offline release gate.
120
+ - Require a non-null independently trusted Plan digest throughout the strict
121
+ ConsumptionPlan / Agent Host chain, snapshot hostile validation contexts without invoking
122
+ accessors, and keep pre-Host budget enforcement unavailable as a public
123
+ bypass option.
124
+ - Require matched Host receipts to correlate sender, Host-recomputed, echoed,
125
+ and actual Capsule delivery digests. Trace construction now requires an
126
+ explicit trusted delivery observation when no receipt exists, distinguishing
127
+ `not_delivered` from `not_observed` without inferring either from a request.
128
+ - Check internal C/E declarations and canonical/legacy alias agreement before
129
+ independent expected values, so external matches cannot hide conflicting
130
+ asset declarations.
131
+ - Validate Runtime Capsule builder inputs and outputs against packaged schemas
132
+ and cross-field success invariants.
133
+ - Fail closed when access metadata is unknown or internally inconsistent.
134
+ - Compute E directly from Runtime manifest and payload bytes when checksums are
135
+ absent, share the same pure E implementation across checksum build and
136
+ verification, and reject builder inputs that disagree with their manifest
137
+ or digest evidence.
138
+ - Sort canonical content-tree and signing entry paths by UTF-8 bytes while
139
+ retaining the existing UTF-16 JSON object-key order. U+E000/U+10000 vectors
140
+ freeze the distinction.
141
+
142
+ - Make stable verification fail closed on malformed CBOR, invalid current
143
+ manifests, checksum mismatches, and forbidden legacy plaintext containers,
144
+ while preserving whole-file `asset_digest`, canonical `content_digest`, and
145
+ existing expected-digest/signature hooks.
146
+ - Make direct `createKdnaAssetReader().loadProfile*` return the current Runtime
147
+ Capsule instead of silently returning `domain: null`; legacy `readDataMap*`
148
+ now fails explicitly rather than pretending current payloads are old source
149
+ files.
150
+
151
+ ## 0.17.0 (2026-07-14)
4
152
 
5
153
  ### Added
6
154
 
@@ -33,7 +181,7 @@
33
181
  - Derive web-package readiness expectations from the declared current Core
34
182
  version rather than a stale hard-coded release number.
35
183
 
36
- ## v0.16.0 (2026-07-13)
184
+ ## 0.16.0 (2026-07-13)
37
185
 
38
186
  ### Added
39
187
 
@@ -60,29 +208,30 @@
60
208
  - Revoked, expired, tampered, digest/version/account/device mismatches fail
61
209
  closed before Runtime Capsule projection.
62
210
 
63
- ## v0.15.12 (2026-07-12)
211
+ ## 0.15.12 (2026-07-12)
64
212
 
65
213
  **Single-format refactor + CBOR wire contract + Runtime Capsule.**
66
214
 
67
215
  ### Breaking changes
68
216
 
69
- - `MIMETYPE_V1`, `MIMETYPE_V2`, `MIMETYPE_LEGACY`, `isV1SourceDir`, `isV2SourceDir`
70
- removed from public API. Use `MIMETYPE`, `isKdnaSourceDir`, `detectContainerFormat`.
217
+ - Remove generation-qualified mimetype constants and source-directory helpers
218
+ from the public API. Use `MIMETYPE`, `isKdnaSourceDir`, and
219
+ `detectContainerFormat`.
71
220
  - `detectContainerFormat` returns only `"kdna"` or `null`.
72
- - `kdna_version: "2.0"` is no longer accepted. Only `"1.0"`.
221
+ - Remove the parallel legacy container discriminator. The current contract is
222
+ now represented solely by `format_version`.
73
223
  - `payload.encoding` accepts only `"cbor"`. JSON payload bytes are rejected;
74
224
  there is no production JSON fallback.
75
- - Version-qualified public APIs (`V1_REQUIRED_DIR_ENTRIES`, `readV1Layout`,
76
- `buildChecksumsV1`, `loadV1`, and the `./v1` export) are removed. Use the
77
- unversioned APIs below.
78
- - `kdna load --as=json` now returns Runtime Capsule format
79
- (`type: "kdna.context.capsule"`) instead of raw `{status, content}`.
225
+ - Version-qualified public APIs and the generation-qualified subpath export
226
+ are removed. Use the stable APIs below.
227
+ - `kdna load --as=json` returns a Runtime Capsule instead of raw
228
+ `{status, content}`.
80
229
 
81
230
  ### Added
82
231
 
83
232
  - `REQUIRED_DIR_ENTRIES`, `readLayout`, `buildChecksums`, `load`, and
84
233
  `loadAsset` are the sole public container/loading APIs.
85
- - `buildCapsule(loadResult, v1, profile, opts)` — wraps load output as
234
+ - `buildCapsule(loadResult, pre-cutover, profile, opts)` — wraps load output as
86
235
  `kdna.context.capsule` per `specs/runtime-capsule.md`.
87
236
  - `parsePayloadEntry` — strict CBOR decoding for `payload.kdnab`.
88
237
 
@@ -90,27 +239,27 @@
90
239
 
91
240
  - Producer/consumer encoding alignment: `dev-pack.js`, `studio.js` write CBOR;
92
241
  validation and loading decode CBOR, including encrypted envelopes.
93
- - `loadV1Unsafe` extends/deps processing occurs before Capsule wrapping (Story 12 fix).
242
+ - `loadAssetUnsafe` extends/deps processing occurs before Capsule wrapping (Story 12 fix).
94
243
  - All test fixtures converted to CBOR; golden files regenerated.
95
244
 
96
- ## v0.15.11 (2026-07-03)
245
+ ## 0.15.11 (2026-07-03)
97
246
 
98
- **Fix**: repair Core v1 container dispatcher module resolution in the
247
+ **Fix**: repair Core container dispatcher module resolution in the
99
248
  published package layout.
100
249
 
101
250
  - Corrects internal `src/container-dispatcher.js` imports so the dispatcher can
102
- load sibling `asset-reader` and `v1` modules after npm packaging.
103
- - Loads v1 JSON schemas through package-relative static imports before falling
251
+ load sibling `asset-reader` and container modules after npm packaging.
252
+ - Load Runtime schemas through package-relative static imports before falling
104
253
  back to disk discovery, so bundled server environments do not look for
105
254
  KDNA schemas in the host application directory.
106
- - Adds regression coverage for loading a v1 source asset through the dispatcher
255
+ - Add regression coverage for loading a source asset through the dispatcher
107
256
  from the package `src/` layout and for validating from a non-repository cwd.
108
257
  - Fix webpack bundler warning: use `eval('require')` for ajv meta-schema import
109
258
  so webpack does not try to statically resolve the JSON file at build time.
110
259
 
111
260
  No public API changes.
112
261
 
113
- ## v0.15.10 (2026-06-30)
262
+ ## 0.15.10 (2026-06-30)
114
263
 
115
264
  **API**: export `parseSemver`, `compareSemver`, `satisfies` from public module.
116
265
 
@@ -125,9 +274,9 @@ a parallel copy.
125
274
 
126
275
  No breaking changes. Purely additive.
127
276
 
128
- ## v0.15.9 (2026-06-28)
277
+ ## 0.15.9 (2026-06-28)
129
278
 
130
- Story 12 — Asset inheritance (`extends` field, RFC #148 v2.x Phase 3).
279
+ Story 12 — Asset inheritance (`extends` field, RFC #148 later pre-cutover.x Phase 3).
131
280
 
132
281
  - **`extends` field in `manifest.schema.json`**: assets may declare
133
282
  `extends: "@scope/name@^1.0.0"` (string) or `extends: { name, version }`
@@ -137,9 +286,9 @@ Story 12 — Asset inheritance (`extends` field, RFC #148 v2.x Phase 3).
137
286
  and the manifest declares `extends`, `planLoad` resolves the base asset and
138
287
  records `extends_chain` in the plan output. Non-blocking — missing base
139
288
  emits a WARNING issue, not a blocking error.
140
- - **`loadAuthorized` passes `extends_chain`** from the plan to `loadV1Unsafe`
289
+ - **`loadAuthorized` passes `extends_chain`** from the plan to `loadAssetUnsafe`
141
290
  so the inheritance merge is applied at load time.
142
- - **`loadV1Unsafe` inheritance merge**: when `extendsChain` is non-empty, the
291
+ - **`loadAssetUnsafe` inheritance merge**: when `extendsChain` is non-empty, the
143
292
  base asset's content is loaded and merged with the child's content. Merge
144
293
  rules: child axioms override parent axioms with the same `id`; parent axioms
145
294
  not in child are inherited; same for boundaries (by `scope` text);
@@ -148,9 +297,9 @@ Story 12 — Asset inheritance (`extends` field, RFC #148 v2.x Phase 3).
148
297
  to load output when inheritance is applied.
149
298
  - Blocks Story 13 (trust levels) per Section 6 sequencing.
150
299
 
151
- ## v0.15.8 (2026-06-28)
300
+ ## 0.15.8 (2026-06-28)
152
301
 
153
- Story 11 — RAG namespace isolation (RFC #148 v2.x Phase 3).
302
+ Story 11 — RAG namespace isolation (RFC #148 later pre-cutover.x Phase 3).
154
303
 
155
304
  - **`rag_namespace`** field added to each entry in `resolved_dependencies`.
156
305
  Format: `name@version` (or bare `name` when version is absent). Provides a
@@ -166,7 +315,7 @@ Story 11 — RAG namespace isolation (RFC #148 v2.x Phase 3).
166
315
  - No breaking changes to existing single-asset load output or to
167
316
  `resolved_dependencies` shape (fields are additive only).
168
317
 
169
- ## v0.15.7 (2026-06-28)
318
+ ## 0.15.7 (2026-06-28)
170
319
 
171
320
  Story 6 — dependencies runtime. Supports semver-matching local/registry dependency resolution and topological sort-based loading order.
172
321
 
@@ -174,27 +323,28 @@ Story 6 — dependencies runtime. Supports semver-matching local/registry depend
174
323
  - **Topological Sorting Resolver**: Added a robust, pure post-order DFS topological sorter with circular cycle, missing dependency, and version range mismatch checks.
175
324
  - **Topological Prompt Composition**: Enabled recursive, multi-domain prompt composition and flat topological JSON return inside `loadAuthorized`.
176
325
 
326
+ ## 0.15.6 (2026-06-28)
177
327
 
178
- ## v0.15.6 (2026-06-28)
179
-
180
- Story 5 — Bundle payload type. Bumps KDNA manifest format schema to v2, introduces bundle-profile-v1 payload profile, and starts KDNA v1 format deprecation window.
328
+ Story 5 — Bundle payload type. This historical release introduced the bundle
329
+ payload profile while the project was still using removed generation-labelled
330
+ container vocabulary.
181
331
 
182
332
  - **Bundle asset_type support:** added `"bundle"` to `asset_type` enum and `VALID_ASSET_TYPE` check.
183
- - **V2 Schema support:** bumped manifest schema version to v2.0, supporting `kdna_version` as `"2.0"`.
184
- - **Bundle profile support:** added `bundle-profile-v1` payload profile and validator.
185
-
333
+ - **Schema support:** added the then-current bundle manifest shape. The sole
334
+ current Runtime schema has since replaced it.
335
+ - **Bundle profile support:** added `kdna.payload.bundle` payload profile and validator.
186
336
 
187
- ## v0.15.5 (2026-06-28)
337
+ ## 0.15.5 (2026-06-28)
188
338
 
189
339
  Phase 12 audit follow-up. Closes 3 issues filed against this
190
340
  repo (#145, #146, #147).
191
341
 
192
342
  - **#145** The `compilePatterns` output for `misunderstanding`
193
- cards was already preserved (the v1 round-trip fix in 0.15.4
343
+ cards was already preserved (the container round-trip fix in 0.15.4
194
344
  carried `failure_risk` / `applies_when` / `does_not_apply_when`).
195
345
  The audit confirmed the fix is in place. No code change required;
196
346
  this entry documents the verification.
197
- - **#146** `cardsFromV1Payload` (in the studio-cli consumer) now
347
+ - **#146** The Studio CLI payload-card projection now
198
348
  infers a `type` for `payload.patterns` entries that omit it,
199
349
  by inspecting the field set. Misunderstandings (which have
200
350
  `wrong` + `correct`), terms (have `term` + `definition`),
@@ -212,7 +362,7 @@ repo (#145, #146, #147).
212
362
  warn producers/verifiers that any new exclusion MUST be added
213
363
  to both paths in the same change.
214
364
 
215
- ## v0.15.4 (2026-06-28)
365
+ ## 0.15.4 (2026-06-28)
216
366
 
217
367
  Audit follow-ups (2026-06-28 round-trip verification). This release
218
368
  keeps the canonicalisation paths in sync across producers (studio-cli
@@ -230,17 +380,19 @@ signature generated by one tool is accepted by every other.
230
380
  for the list of fields the signing payload excludes. Documented
231
381
  in `docs/CANONICALIZATION.md`.
232
382
 
233
- ## v0.15.3 (2026-06-27)
383
+ ## 0.15.3 (2026-06-27)
384
+
234
385
  - Fix (PC-2, real): `renderPromptItem` now actually ships the
235
- boundary card branch. The previous v0.15.2 release (ee20c5e)
386
+ boundary card branch. The previous 0.15.2 release (ee20c5e)
236
387
  bumped package.json and added a CHANGELOG entry but did NOT
237
- include the source change to `src/v1/index.js`. This release
388
+ include the source change to `src/container/index.js`. This release
238
389
  re-bundles the fix that landed in 46047fb (PC-1/PC-4 cleanup).
239
390
  Verified end-to-end: `kdna-studio card add boundary` with
240
391
  non-empty `scope` + `out_of_scope` → `kdna load` now prints
241
392
  `in scope: X; out of scope: Y` instead of the UUID `id`.
242
393
 
243
- ## v0.15.2 (2026-06-27)
394
+ ## 0.15.2 (2026-06-27)
395
+
244
396
  - Fix (PC-2): `renderPromptItem` now renders boundary cards as
245
397
  `in scope: X; out of scope: Y; exceptions: ...` instead of
246
398
  falling through to the UUID `id`. The previous behavior made
@@ -251,24 +403,27 @@ signature generated by one tool is accepted by every other.
251
403
  matches returns `(unrendered card: <type>)` instead of the
252
404
  UUID `id`, so any unrecognized card shape is visible.
253
405
 
254
- ## v0.15.1 (2026-06-27)
406
+ ## 0.15.1 (2026-06-27)
407
+
255
408
  - Fix: package.json `files` array now includes `CHANGELOG.md`. The
256
- v0.15.0 tarball was published without the changelog, leaving
409
+ 0.15.0 tarball was published without the changelog, leaving
257
410
  consumers with no way to read release notes from `npm install`.
258
411
  Adding it now is a no-op for code but resolves the docs gap.
259
412
 
260
- ## v0.15.0 (2026-06-27)
261
- - B2: scrypt password profile `kdna-password-protected-v1-scrypt` (ADR-007)
413
+ ## 0.15.0 (2026-06-27)
414
+
415
+ - B2: scrypt password profile `kdna.encryption.password.scrypt` (ADR-007)
262
416
  - encryptProtectedEntryScrypt / decryptProtectedEntryScrypt (zero new deps, Node crypto.scryptSync)
263
417
  - AES-256-GCM + AES-256-KW envelope encryption, same CEK model as RFC-0008
264
418
  - scrypt N=32768 r=8 p=1, 32B KEK, 16B random salt
265
419
  - planLoad inferEntitlementProfile detects scrypt profile
266
420
  - decrypt dispatch routes Argon2id vs scrypt by envelope profile field
267
- - recovery slot deferred to v0.2; v0.1: single password slot
421
+ - recovery slot deferred to 0.2; 0.1: single password slot
268
422
  - B5: conformance:canonical npm script (threshold #8)
269
423
 
270
- ## v0.14.0 (2026-06-25)
271
- - B1: unified container dispatcher (readAsset — v1/v2/ dir → CanonicalAssetModel)
424
+ ## 0.14.0 (2026-06-25)
425
+
426
+ - B1: unified container dispatcher (readAsset — pre-cutover/later pre-cutover/ dir → CanonicalAssetModel)
272
427
  - B4: loadAuthorized decryption orchestration (opts.password, opts.decryptEntry)
273
428
  - B4: encrypted payload detection in runValidate (backward compatible)
274
429
  - B8: cross-language golden vectors (test-vectors/golden-vectors.js — 8/8)
@@ -277,42 +432,48 @@ signature generated by one tool is accepted by every other.
277
432
  - Wave 3a: CQ-T2/T3 symmetric compact rendering, scenario null consistency
278
433
  - Add: engines.node >=18.0.0
279
434
 
280
- ## v0.13.3 (2026-06-22)
435
+ ## 0.13.3 (2026-06-22)
436
+
281
437
  - Fix: index profile includes max_tokens_hint
282
438
  - Fix: compact profile falls back to full_statement for TBD placeholders
283
439
 
284
440
  Packages: `@aikdna/kdna-core`
285
441
 
286
- ## v0.13.2 (2026-06-21)
442
+ ## 0.13.2 (2026-06-21)
287
443
 
288
444
  ### Fixed
445
+
289
446
  - 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.
290
447
  - Cross-platform test stability: Node test glob patterns are now compatible with both macOS and Linux filesystem sort orders.
291
448
  - Hash library compatibility: `@noble/hashes` replaces Node-only crypto for digest operations, maintaining Node 18 compatibility without native module binding requirements.
292
449
 
293
450
  ### Changed
451
+
294
452
  - 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.
295
453
  - Examples in README and inline docs reference the packaged `.kdna` path rather than source directories.
296
454
  - First-run contract tightened: exported symbols, error codes, and validation gate names are now part of the stable API surface.
297
455
 
298
456
  ---
299
457
 
300
- ## v0.13.1 (2026-06-21)
458
+ ## 0.13.1 (2026-06-21)
301
459
 
302
460
  ### Fixed
461
+
303
462
  - **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`.
304
463
  - 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.
305
464
 
306
465
  ### Changed
307
- - 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.
466
+
467
+ - Public API provenance and profile split clarified: `loadKDNA` / `loadKDNASync` are the stable entry points for runtime consumers. Lower-level `generation-qualified layout reader`, `runValidate`, and `planLoad` are exported for advanced tooling but carry no backward-compatibility guarantee.
308
468
  - 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.
309
469
  - `verifyAsset` / `verifyAssetSync`, `verifyDigest` / `verifyDigestSync`, and `verifySignature` / `verifySignatureSync` are now documented as the stable verification API surface.
310
470
 
311
471
  ---
312
472
 
313
- ## v0.13.0 (2026-06-19)
473
+ ## 0.13.0 (2026-06-19)
314
474
 
315
475
  ### Added
476
+
316
477
  - **Authorization LoadPlan contract.** The `planLoad(inputPath, opts)` function returns a structured LoadPlan before any judgment content is decrypted or emitted. The LoadPlan reports:
317
478
  - `asset_id`, `asset_uid`, `title`, `version`, `judgment_version`
318
479
  - `access` model (`public` | `licensed` | `remote`)
@@ -326,15 +487,15 @@ Packages: `@aikdna/kdna-core`
326
487
  - `input_fingerprint` capturing the source digest, has-password signal, and entitlement status for cache keying
327
488
  - `source.kind` and `source.path` indicating whether the input was a source directory or `.kdna` container
328
489
  - **`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.
329
- - **`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.
330
- - **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.
331
- - **KDNA Core v1 validate module.** `validate(inputPath)` runs four independent gates:
490
+ - **`loadAsset(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.
491
+ - **KDNA Core 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.
492
+ - **KDNA Core validate module.** `validate(inputPath)` runs four independent gates:
332
493
  1. **Format gate:** required entries present (`mimetype`, `kdna.json`, `payload.kdnab`), mimetype content correct, lineage is an object not an array
333
494
  2. **Schema gate:** `kdna.json` against `manifest.schema.json` via AJV 2020-12
334
- 3. **Payload gate:** `payload.kdnab` against `payload-profile-v1.schema.json`
495
+ 3. **Payload gate:** `payload.kdnab` against `payload-profile.schema.json`
335
496
  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
336
- - **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.
337
- - **KDNA Core v1 unpack module.** `unpack(inputPath, outputDir)` extracts a `.kdna` container to a directory with path-traversal protection.
497
+ - **KDNA Core pack module.** `pack(sourceDir, outputPath)` produces a canonical-order `.kdna` container: fixed DOS epoch timestamps, alphabetical entry order, mimetype first (STORED, method 0). Package bytes are reproducible with one pinned packer toolchain and compressor; DEFLATE output may differ across compressors or zlib versions.
498
+ - **KDNA Core unpack module.** `unpack(inputPath, outputDir)` extracts a `.kdna` container to a directory with path-traversal protection.
338
499
  - **Container security hardening.** ZIP reader enforces:
339
500
  - Maximum container size (25 MiB), max entries (128), max entry size (5 MiB), max total uncompressed (12 MiB)
340
501
  - Max compression ratio (100:1) to prevent zip bombs
@@ -344,15 +505,17 @@ Packages: `@aikdna/kdna-core`
344
505
  - Symlink and device/special file rejection
345
506
  - **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.
346
507
  - **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.
347
- - **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`.
508
+ - **Dual CJS/ESM exports.** `src/index.js` (CommonJS) and `src/index.mjs` (ES module) with matching `exports` map. The pre-cutover module is also available at `@aikdna/kdna-core/pre-cutover`.
348
509
  - **TypeScript declarations.** `src/types.d.ts` exports type definitions for the stable public API surface.
349
510
 
350
511
  ### Changed
351
- - **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`.
352
- - `validate` and `planLoad` reject v2 containers (`application/vnd.aikdna.kdna+zip`) with a format error.
512
+
513
+ - **Pre-cutover is the only active format path.** The later pre-cutover reader (`readDataMapSync`, `readDataMap`) remains in the codebase for migration compatibility but is no longer the default path. All new integrations should use the pre-cutover API: `inspect`, `validate`, `planLoad`, `loadAuthorized`.
514
+ - `validate` and `planLoad` reject later pre-cutover containers (`application/vnd.aikdna.kdna+zip`) with a format error.
353
515
  - Access model normalized to the three-tier `public` | `licensed` | `remote` enum. The LoadPlan maps legacy values transparently with an info-level issue.
354
- - Container format detection (`detectContainerFormat`) reads only the first central-directory entry to determine v1 vs v2, preventing malicious later entries from causing format confusion.
516
+ - Container format detection (`detectContainerFormat`) reads only the first central-directory entry to determine pre-cutover vs later pre-cutover, preventing malicious later entries from causing format confusion.
355
517
 
356
518
  ### Removed
357
- - Legacy v1 compatibility shims removed. v2 is the only legacy format and is handled through the existing `asset-reader.js` module.
358
- - `readDataMapSync` / `readDataMap` deprecated for new use. Use `planLoad` + `loadV1` for runtime loading or `validate` + `inspect` for diagnostics.
519
+
520
+ - Legacy pre-cutover compatibility shims removed. later pre-cutover is the only legacy format and is handled through the existing `asset-reader.js` module.
521
+ - `readDataMapSync` / `readDataMap` deprecated for new use. Use `planLoad` + `loadAsset` for runtime loading or `validate` + `inspect` for diagnostics.