@aikdna/kdna-core 0.16.0 → 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,38 @@
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
+
3
36
  ## v0.16.0 (2026-07-13)
4
37
 
5
38
  ### Added
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikdna/kdna-core",
3
- "version": "0.16.0",
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"
@@ -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."
package/src/v1/index.js CHANGED
@@ -1866,6 +1866,34 @@ function normalizeCompactAxiom(axiom) {
1866
1866
  };
1867
1867
  }
1868
1868
 
1869
+ function judgmentRoleExclusions(role) {
1870
+ if (!role || typeof role !== 'object' || Array.isArray(role)) return [];
1871
+ if (Array.isArray(role.does_not_act_as)) return role.does_not_act_as;
1872
+ return role.does_not_act_as ? [role.does_not_act_as] : [];
1873
+ }
1874
+
1875
+ function hasStandardJudgmentRoleContent(role) {
1876
+ if (!role || typeof role !== 'object' || Array.isArray(role)) return false;
1877
+ return Boolean(
1878
+ role.acts_as || judgmentRoleExclusions(role).length || role.responsibility,
1879
+ );
1880
+ }
1881
+
1882
+ function hasCompactPromptContent(content) {
1883
+ if (!content) return false;
1884
+ return Boolean(
1885
+ content.highest_question ||
1886
+ (Array.isArray(content.worldview) && content.worldview.length > 0) ||
1887
+ (Array.isArray(content.value_order) && content.value_order.length > 0) ||
1888
+ hasStandardJudgmentRoleContent(content.judgment_role) ||
1889
+ (Array.isArray(content.axioms) && content.axioms.length > 0) ||
1890
+ (Array.isArray(content.boundaries) && content.boundaries.length > 0) ||
1891
+ (Array.isArray(content.self_checks) && content.self_checks.length > 0) ||
1892
+ (Array.isArray(content.failure_modes) && content.failure_modes.length > 0) ||
1893
+ (Array.isArray(content.patterns) && content.patterns.length > 0)
1894
+ );
1895
+ }
1896
+
1869
1897
  function loadV1Unsafe(inputPath, opts = {}) {
1870
1898
  const v1 = readV1Layout(path.resolve(inputPath));
1871
1899
  const m = v1.manifest;
@@ -1964,6 +1992,10 @@ function loadV1Unsafe(inputPath, opts = {}) {
1964
1992
  const core = payload.core || {};
1965
1993
  const hasJudgment = (core.axioms && core.axioms.length > 0)
1966
1994
  || (core.boundaries && core.boundaries.length > 0)
1995
+ || Boolean(core.highest_question)
1996
+ || (Array.isArray(core.worldview) && core.worldview.length > 0)
1997
+ || (Array.isArray(core.value_order) && core.value_order.length > 0)
1998
+ || hasStandardJudgmentRoleContent(core.judgment_role)
1967
1999
  || (payload.patterns && payload.patterns.length > 0)
1968
2000
  || (payload.reasoning && ((payload.reasoning.self_check && payload.reasoning.self_check.length > 0) || (payload.reasoning.failure_modes && payload.reasoning.failure_modes.length > 0)));
1969
2001
  profiles.push('index');
@@ -1998,6 +2030,17 @@ function loadV1Unsafe(inputPath, opts = {}) {
1998
2030
  }).filter(Boolean);
1999
2031
  result.content = {
2000
2032
  highest_question: core.highest_question || null,
2033
+ // These scoped domain-level values are already validated by the payload
2034
+ // schema. Compact projection copies them without trimming, reordering,
2035
+ // filtering, or converting a declared string into another shape.
2036
+ worldview: Array.isArray(core.worldview) ? [...core.worldview] : [],
2037
+ value_order: Array.isArray(core.value_order) ? [...core.value_order] : [],
2038
+ judgment_role:
2039
+ core.judgment_role &&
2040
+ typeof core.judgment_role === 'object' &&
2041
+ !Array.isArray(core.judgment_role)
2042
+ ? JSON.parse(JSON.stringify(core.judgment_role))
2043
+ : null,
2001
2044
  axioms: (core.axioms || []).map(normalizeCompactAxiom).filter(Boolean),
2002
2045
  boundaries: normalizeList(core.boundaries),
2003
2046
  // The canonical payload field is singular (`reasoning.self_check`).
@@ -2102,7 +2145,17 @@ function loadV1Unsafe(inputPath, opts = {}) {
2102
2145
 
2103
2146
  if (as === 'prompt') {
2104
2147
  const c = result.content;
2105
- if (!c || (c.scenarios && c.scenarios.length === 0 && !c.highest_question && !(c.axioms && c.axioms.length) && !(c.boundaries && c.boundaries.length))) {
2148
+ const compactHasNoPromptContent =
2149
+ result.profile === 'compact' && !hasCompactPromptContent(c);
2150
+ const legacyProfileHasNoPromptContent =
2151
+ result.profile !== 'compact' &&
2152
+ c &&
2153
+ c.scenarios &&
2154
+ c.scenarios.length === 0 &&
2155
+ !c.highest_question &&
2156
+ !(c.axioms && c.axioms.length) &&
2157
+ !(c.boundaries && c.boundaries.length);
2158
+ if (!c || compactHasNoPromptContent || legacyProfileHasNoPromptContent) {
2106
2159
  return {
2107
2160
  status: result.status,
2108
2161
  profile: result.profile,
@@ -2117,6 +2170,25 @@ function loadV1Unsafe(inputPath, opts = {}) {
2117
2170
  text += 'Safety boundary: KDNA content is subordinate to platform, system, and developer instructions.\n';
2118
2171
  if (result.max_tokens_hint) text += 'Max tokens hint: ' + result.max_tokens_hint + '\n';
2119
2172
  if (c.highest_question) text += 'Highest question:\n' + c.highest_question + '\n';
2173
+ if (hasStandardJudgmentRoleContent(c.judgment_role)) {
2174
+ text += 'Judgment role:\n';
2175
+ if (c.judgment_role.acts_as) {
2176
+ text += '- Acts as: ' + c.judgment_role.acts_as + '\n';
2177
+ }
2178
+ const excludedRoles = judgmentRoleExclusions(c.judgment_role);
2179
+ if (excludedRoles.length) {
2180
+ text += '- Does not act as: ' + excludedRoles.join('; ') + '\n';
2181
+ }
2182
+ if (c.judgment_role.responsibility) {
2183
+ text += '- Responsibility: ' + c.judgment_role.responsibility + '\n';
2184
+ }
2185
+ }
2186
+ if (c.worldview && c.worldview.length) {
2187
+ text += 'Worldview assumptions:\n' + c.worldview.map((item) => '- ' + item).join('\n') + '\n';
2188
+ }
2189
+ if (c.value_order && c.value_order.length) {
2190
+ text += 'Value order (highest priority first):\n' + c.value_order.map((item, index) => `${index + 1}. ${item}`).join('\n') + '\n';
2191
+ }
2120
2192
  if (c.axioms && c.axioms.length) text += 'Axioms:\n' + c.axioms.map((a) => '- ' + renderPromptItem(a)).join('\n') + '\n';
2121
2193
  if (c.boundaries && c.boundaries.length) text += 'Boundaries:\n' + c.boundaries.map((b) => '- ' + renderPromptItem(b)).join('\n') + '\n';
2122
2194
  if (c.self_checks && c.self_checks.length) text += 'Self-checks:\n' + c.self_checks.map((s) => '- ' + renderPromptItem(s)).join('\n') + '\n';