@aikdna/kdna-core 0.15.12 → 0.17.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,65 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.17.0 (2026-07-14)
4
+
5
+ ### Added
6
+
7
+ - Structurally validate optional payload `worldview`, ordered `value_order`,
8
+ and `judgment_role`, then preserve their declared values in the compact
9
+ Runtime Capsule instead of silently dropping them. Compact prompt projection
10
+ renders worldview, value order, and the standard role fields `acts_as`,
11
+ `does_not_act_as`, and `responsibility`; role extension fields remain
12
+ available in the JSON Capsule without an unsupported prompt claim.
13
+ - Add a synthetic Golden Single-Asset Core fixture. It proves schema,
14
+ validation, content-neutral inspect, and exact compact projection only; it
15
+ does not claim author quality, task applicability, model consumption, or
16
+ conformance.
17
+
18
+ ### Changed
19
+
20
+ - Make Runtime `creator` provenance optional. When it is declared,
21
+ `creator.name` remains required and non-empty; when provenance is unavailable,
22
+ producers omit the block instead of inventing an anonymous or `Unknown`
23
+ identity. This does not weaken authoring-source identity rules or turn
24
+ provenance into a trust claim.
25
+ - Keep canonical and packaged Runtime manifest/payload schemas aligned with the
26
+ creator and scoped-judgment contracts.
27
+
28
+ ### Fixed
29
+
30
+ - Make ecosystem truth validation fail closed when a live component has
31
+ neither package/artifact evidence nor a verifiable repository checkout,
32
+ instead of silently accepting missing external evidence.
33
+ - Derive web-package readiness expectations from the declared current Core
34
+ version rather than a stale hard-coded release number.
35
+
36
+ ## v0.16.0 (2026-07-13)
37
+
38
+ ### Added
39
+
40
+ - RFC-0019 external account/device key grants, schemas, deterministic golden
41
+ and negative fixtures, and JS/Swift parity vectors.
42
+ - JS Core helpers for external envelope encryption, per-device grant issuance,
43
+ signature/binding verification, in-memory decryption, and explicit zeroization.
44
+ - LoadPlan accepts only a runtime-verified external entitlement for account/org
45
+ assets; structurally similar status objects no longer authorize loading.
46
+ - Reject authoring source directories at the public runtime API boundary;
47
+ `planLoad`, `load`, `loadAsset`, and `loadAuthorized` now require a packaged
48
+ `.kdna` file, including resolver-provided dependencies.
49
+ - Regenerate authorization conformance fixtures from packaged assets and keep
50
+ source directories available only to authoring operations such as inspect,
51
+ validate, pack, and unpack.
52
+ - Remove stale public format-generation wording and local coordination-path
53
+ assumptions from protocol documentation and public audit scripts.
54
+ - Make release readiness fail for dirty inputs or when the selected version
55
+ tag does not point to the current commit.
56
+
57
+ ### Security
58
+
59
+ - Account/device envelopes never fall back to the password profile.
60
+ - Revoked, expired, tampered, digest/version/account/device mismatches fail
61
+ closed before Runtime Capsule projection.
62
+
3
63
  ## v0.15.12 (2026-07-12)
4
64
 
5
65
  **Single-format refactor + CBOR wire contract + Runtime Capsule.**
package/README.md CHANGED
@@ -64,6 +64,12 @@ if (capsule.type !== 'kdna.context.capsule') {
64
64
  → Agent/runtime context
65
65
  ```
66
66
 
67
+ The default compact Capsule preserves the asset's scoped judgment context:
68
+ `highest_question`, `worldview`, ordered `value_order`, `judgment_role`,
69
+ applicability-aware axioms, boundaries, self-checks, failure modes, and a
70
+ bounded pattern set. Core copies the three optional scoped fields without
71
+ trimming, reordering, or treating them as facts, policy, or quality evidence.
72
+
67
73
  For authoring and test fixtures, `pack()` can turn a local working folder into
68
74
  a `.kdna` file before validation:
69
75
 
@@ -97,6 +103,18 @@ A `.kdna` asset contains:
97
103
  encryption envelope in the same entry; authorized plaintext is decrypted in
98
104
  memory and projected into the Runtime Capsule.
99
105
 
106
+ ### Account/device external grants
107
+
108
+ RFC-0019 licensed assets can keep the encrypted container publicly available
109
+ while an issuer grants independent account/device access. `authorizeExternalKeyGrant()`
110
+ verifies the issuer signature, lease, revocation state, account, device, asset
111
+ UID/version/digest, and encrypted entry before returning a branded entitlement
112
+ and in-memory decrypt hook. A plain `{status: "active"}` object is not accepted.
113
+
114
+ Device private keys belong in the platform SecretStore. The returned session
115
+ must be disposed after loading; Agent-facing callers should receive only the
116
+ Runtime Capsule. Account grants never fall back to the password profile.
117
+
100
118
  ## Load Profiles
101
119
 
102
120
  `loadAuthorized()` supports:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikdna/kdna-core",
3
- "version": "0.15.12",
3
+ "version": "0.17.0",
4
4
  "description": "KDNA Core library for validating, planning, and loading local .kdna judgment assets.",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://kdna.ai/specs/kdna-envelope-external-grant-v1.schema.json",
4
+ "title": "KDNA external grant envelope v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["profile", "alg", "cek_derivation", "key_ref", "issuer_key_id", "entry_path", "plaintext_digest", "iv", "tag", "ciphertext"],
8
+ "properties": {
9
+ "profile": { "const": "kdna-envelope-external-grant-v1" },
10
+ "alg": { "const": "A256GCM" },
11
+ "cek_derivation": { "const": "HKDF-SHA256" },
12
+ "key_ref": { "type": "string", "minLength": 1, "maxLength": 256 },
13
+ "issuer_key_id": { "type": "string", "minLength": 1, "maxLength": 128 },
14
+ "entry_path": { "type": "string", "pattern": "^[^/].*[^/]$|^[^/]$", "maxLength": 256 },
15
+ "plaintext_digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
16
+ "iv": { "type": "string", "pattern": "^[A-Za-z0-9_-]{16}$" },
17
+ "tag": { "type": "string", "pattern": "^[A-Za-z0-9_-]{22}$" },
18
+ "ciphertext": { "type": "string", "minLength": 1, "pattern": "^[A-Za-z0-9_-]+$" }
19
+ }
20
+ }
@@ -0,0 +1,54 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://kdna.ai/specs/kdna-key-grant-v1.schema.json",
4
+ "title": "KDNA account/device external key grant v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["profile", "grant_id", "issuer", "signing_key_id", "entitlement_id", "account_id", "device_id", "device_public_key", "device_signing_public_key", "asset", "issued_at", "refresh_after", "offline_grace_until", "expires_at", "status", "status_version", "wrap", "signature"],
8
+ "properties": {
9
+ "profile": { "const": "kdna-key-grant-v1" },
10
+ "grant_id": { "$ref": "#/$defs/id" },
11
+ "issuer": { "type": "string", "format": "uri", "maxLength": 256 },
12
+ "signing_key_id": { "$ref": "#/$defs/id" },
13
+ "entitlement_id": { "$ref": "#/$defs/id" },
14
+ "account_id": { "$ref": "#/$defs/id" },
15
+ "device_id": { "$ref": "#/$defs/id" },
16
+ "device_public_key": { "type": "string", "pattern": "^x25519:[A-Za-z0-9_-]{43}$" },
17
+ "device_signing_public_key": { "type": "string", "pattern": "^ed25519:[A-Za-z0-9_-]{43}$" },
18
+ "asset": {
19
+ "type": "object", "additionalProperties": false,
20
+ "required": ["asset_id", "asset_uid", "version", "digest", "entry_path", "ciphertext_digest", "key_ref", "issuer_key_id"],
21
+ "properties": {
22
+ "asset_id": { "type": "string", "minLength": 1, "maxLength": 256 },
23
+ "asset_uid": { "type": "string", "minLength": 1, "maxLength": 512 },
24
+ "version": { "type": "string", "minLength": 1, "maxLength": 128 },
25
+ "digest": { "$ref": "#/$defs/digest" },
26
+ "entry_path": { "type": "string", "minLength": 1, "maxLength": 256 },
27
+ "ciphertext_digest": { "$ref": "#/$defs/digest" },
28
+ "key_ref": { "type": "string", "minLength": 1, "maxLength": 256 },
29
+ "issuer_key_id": { "$ref": "#/$defs/id" }
30
+ }
31
+ },
32
+ "issued_at": { "type": "string", "format": "date-time" },
33
+ "refresh_after": { "type": "string", "format": "date-time" },
34
+ "offline_grace_until": { "type": "string", "format": "date-time" },
35
+ "expires_at": { "type": "string", "format": "date-time" },
36
+ "status": { "enum": ["active", "revoked", "expired"] },
37
+ "status_version": { "type": "integer", "minimum": 1 },
38
+ "wrap": {
39
+ "type": "object", "additionalProperties": false,
40
+ "required": ["alg", "ephemeral_public_key", "salt", "wrapped_cek"],
41
+ "properties": {
42
+ "alg": { "const": "X25519-HKDF-SHA256+A256KW" },
43
+ "ephemeral_public_key": { "type": "string", "pattern": "^x25519:[A-Za-z0-9_-]{43}$" },
44
+ "salt": { "type": "string", "pattern": "^[A-Za-z0-9_-]{22}$" },
45
+ "wrapped_cek": { "type": "string", "pattern": "^[A-Za-z0-9_-]{54}$" }
46
+ }
47
+ },
48
+ "signature": { "type": "string", "pattern": "^ed25519:[A-Za-z0-9_-]{86}$" }
49
+ },
50
+ "$defs": {
51
+ "id": { "type": "string", "pattern": "^[A-Za-z0-9._:@/-]{1,256}$" },
52
+ "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
53
+ }
54
+ }
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://github.com/aikdna/kdna/schema/load-plan.schema.json",
4
4
  "title": "KDNA LoadPlan v1",
5
- "description": "Machine-readable pre-load authorization and runtime planning result for KDNA Core v1 assets.",
5
+ "description": "Machine-readable pre-load authorization and runtime planning result for packaged KDNA assets.",
6
6
  "type": "object",
7
7
  "required": [
8
8
  "kdna_version",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://github.com/aikdna/kdna/schema/manifest.schema.json",
4
- "title": "KDNA Manifest v2",
5
- "description": "Schema for kdna.json, the public metadata layer of a .kdna container.",
4
+ "title": "KDNA Manifest",
5
+ "description": "Schema for kdna.json, the public metadata layer of a .kdna container (kdna_version 1.0).",
6
6
  "type": "object",
7
7
  "required": [
8
8
  "kdna_version",
@@ -14,7 +14,6 @@
14
14
  "judgment_version",
15
15
  "created_at",
16
16
  "updated_at",
17
- "creator",
18
17
  "compatibility",
19
18
  "payload"
20
19
  ],
@@ -22,7 +21,7 @@
22
21
  "properties": {
23
22
  "kdna_version": {
24
23
  "type": "string",
25
- "description": "KDNA Asset Container wire discriminator.",
24
+ "description": "KDNA container version this manifest conforms to.",
26
25
  "enum": ["1.0"]
27
26
  },
28
27
  "asset_id": {
@@ -78,7 +77,7 @@
78
77
  "description": "Kind of creator identity represented by this record."
79
78
  }
80
79
  },
81
- "description": "Who produced the asset. Provenance only; not a trust claim."
80
+ "description": "Optional record of who produced the asset. Provenance only; not a trust claim. Omit it when creator provenance is unavailable rather than inventing an identity."
82
81
  },
83
82
  "compatibility": {
84
83
  "type": "object",
@@ -21,6 +21,31 @@
21
21
  "type": "string",
22
22
  "description": "The single most important question this judgment system answers."
23
23
  },
24
+ "worldview": {
25
+ "type": "array",
26
+ "items": { "type": "string" },
27
+ "description": "Scoped assumptions used at qualitative judgment forks; not general facts or deterministic policy."
28
+ },
29
+ "value_order": {
30
+ "type": "array",
31
+ "items": { "type": "string" },
32
+ "description": "Ordered qualitative priorities, highest priority first."
33
+ },
34
+ "judgment_role": {
35
+ "type": "object",
36
+ "additionalProperties": true,
37
+ "properties": {
38
+ "acts_as": { "type": "string" },
39
+ "does_not_act_as": {
40
+ "oneOf": [
41
+ { "type": "string" },
42
+ { "type": "array", "items": { "type": "string" } }
43
+ ]
44
+ },
45
+ "responsibility": { "type": "string" }
46
+ },
47
+ "description": "The authority this asset exercises and the responsibilities explicitly outside it."
48
+ },
24
49
  "axioms": {
25
50
  "type": "array",
26
51
  "description": "The list of axioms. Phase 1 accepts an empty array."