@aikdna/kdna-core 0.13.1 → 0.13.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikdna/kdna-core",
3
- "version": "0.13.1",
3
+ "version": "0.13.3",
4
4
  "description": "KDNA Core library for validating, planning, and loading local .kdna judgment assets.",
5
5
  "type": "commonjs",
6
6
  "main": "src/index.js",
@@ -22,7 +22,8 @@
22
22
  "types": "src/types.d.ts",
23
23
  "scripts": {
24
24
  "test": "node ../../scripts/run-node-tests.js test/*.test.js && node -e \"const m = require('./src/index.js'); console.log('kdna-core exports:', Object.keys(m).join(', '));\"",
25
- "prepublishOnly": "npm --prefix ../.. run ecosystem-gate"
25
+ "prepublishOnly": "npm run release:check && npm --prefix ../.. run ecosystem-gate",
26
+ "release:check": "node scripts/check-release-readiness.js"
26
27
  },
27
28
  "files": [
28
29
  "src/",
@@ -58,6 +59,8 @@
58
59
  },
59
60
  "dependencies": {
60
61
  "@noble/hashes": "^1.8.0",
61
- "cbor-x": "^1.6.4"
62
+ "cbor-x": "^1.6.4",
63
+ "ajv": "^8.20.0",
64
+ "ajv-formats": "^3.0.1"
62
65
  }
63
- }
66
+ }
@@ -14,10 +14,10 @@
14
14
  "required_action",
15
15
  "can_load_now",
16
16
  "projection_policy",
17
- "input_fingerprint",
18
17
  "checks",
19
18
  "issues",
20
- "source"
19
+ "source",
20
+ "input_fingerprint"
21
21
  ],
22
22
  "additionalProperties": false,
23
23
  "properties": {
@@ -51,7 +51,9 @@
51
51
  "needs_runtime",
52
52
  "offline_grace",
53
53
  "expired",
54
+ "expired_grace",
54
55
  "revoked",
56
+ "denied",
55
57
  "invalid"
56
58
  ]
57
59
  },
@@ -66,6 +68,8 @@
66
68
  "sync",
67
69
  "connect_runtime",
68
70
  "migrate_legacy",
71
+ "renew_entitlement",
72
+ "contact_issuer",
69
73
  "block"
70
74
  ]
71
75
  },
@@ -74,10 +78,6 @@
74
78
  "type": "string",
75
79
  "enum": ["minimal", "remote", "none"]
76
80
  },
77
- "input_fingerprint": {
78
- "type": ["string", "null"],
79
- "pattern": "^sha256:[a-f0-9]{64}$"
80
- },
81
81
  "checks": {
82
82
  "type": "object",
83
83
  "required": [
@@ -111,6 +111,16 @@
111
111
  }
112
112
  }
113
113
  },
114
+ "input_fingerprint": {
115
+ "type": ["object", "null"],
116
+ "required": ["source_fingerprint", "has_password_input", "entitlement_input"],
117
+ "additionalProperties": false,
118
+ "properties": {
119
+ "source_fingerprint": { "type": ["string", "null"] },
120
+ "has_password_input": { "type": "boolean" },
121
+ "entitlement_input": { "type": ["string", "null"] }
122
+ }
123
+ },
114
124
  "source": {
115
125
  "type": "object",
116
126
  "required": ["kind", "path"],
package/src/v1/index.js CHANGED
@@ -670,7 +670,7 @@ function runValidate(v1) {
670
670
  if (!validators) {
671
671
  result.schema_valid = false;
672
672
  problems.push(
673
- 'schema: ajv not available (install ajv + ajv-formats in the consumer env to enable JSON-Schema validation)',
673
+ 'schema: ajv not available. KDNA Core v1 requires ajv and ajv-formats for JSON-Schema validation. Run: npm install ajv ajv-formats (or: npm install -g ajv ajv-formats for global CLI users)',
674
674
  );
675
675
  return finalizeValidate(result, problems);
676
676
  }
@@ -1510,11 +1510,12 @@ function normalizeCompactAxiom(axiom) {
1510
1510
  if (!axiom || typeof axiom !== 'object') return null;
1511
1511
  const statement = axiom.statement || axiom.one_sentence || axiom.full_statement || axiom.id || null;
1512
1512
  if (!statement) return null;
1513
+ const oneSentence = (axiom.one_sentence && !String(axiom.one_sentence).startsWith('<TBD')) ? axiom.one_sentence : (typeof axiom.full_statement === 'string' && axiom.full_statement.length > 0 ? axiom.full_statement.substring(0, 120) + (axiom.full_statement.length > 120 ? '…' : '') : statement);
1513
1514
  return {
1514
1515
  type: 'axiom_applicability',
1515
1516
  id: axiom.id || null,
1516
1517
  statement,
1517
- one_sentence: axiom.one_sentence || statement,
1518
+ one_sentence: oneSentence,
1518
1519
  applies_when: normalizeTextList(axiom.applies_when),
1519
1520
  does_not_apply_when: normalizeTextList(axiom.does_not_apply_when),
1520
1521
  failure_risk: axiom.failure_risk || null,
@@ -1585,7 +1586,11 @@ function loadV1Unsafe(inputPath, opts = {}) {
1585
1586
  };
1586
1587
 
1587
1588
  if (profile === 'index') {
1588
- result.content = { asset_id: m.asset_id, asset_uid: m.asset_uid, title: m.title, version: m.version, judgment_version: m.judgment_version, asset_type: m.asset_type, summary: m.summary || null, language: m.language || null, keywords: m.keywords || [], profiles_available: m.load_contract ? Object.keys(m.load_contract.profiles || {}) : [] };
1589
+ let maxTokensHint = undefined;
1590
+ if (m.load_contract && m.load_contract.profiles && m.load_contract.profiles.compact && m.load_contract.profiles.compact.max_tokens_hint) {
1591
+ maxTokensHint = m.load_contract.profiles.compact.max_tokens_hint;
1592
+ }
1593
+ result.content = { asset_id: m.asset_id, asset_uid: m.asset_uid, title: m.title, version: m.version, judgment_version: m.judgment_version, asset_type: m.asset_type, summary: m.summary || null, language: m.language || null, keywords: m.keywords || [], profiles_available: m.load_contract ? Object.keys(m.load_contract.profiles || {}) : [], max_tokens_hint: maxTokensHint };
1589
1594
  } else if (profile === 'compact') {
1590
1595
  const core = payload.core || {};
1591
1596
  result.content = {