@aikdna/kdna-core 0.13.0 → 0.13.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/package.json +1 -1
  2. package/src/v1/index.js +34 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikdna/kdna-core",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
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",
package/src/v1/index.js CHANGED
@@ -1560,7 +1560,29 @@ function loadV1Unsafe(inputPath, opts = {}) {
1560
1560
  }
1561
1561
  }
1562
1562
 
1563
- const result = { status: 'loaded', profile, asset_id: m.asset_id, title: m.title };
1563
+ function availableProfiles() {
1564
+ const profiles = [];
1565
+ const core = payload.core || {};
1566
+ const hasJudgment = (core.axioms && core.axioms.length > 0)
1567
+ || (core.boundaries && core.boundaries.length > 0)
1568
+ || (payload.patterns && payload.patterns.length > 0)
1569
+ || (payload.reasoning && ((payload.reasoning.self_checks && payload.reasoning.self_checks.length > 0) || (payload.reasoning.failure_modes && payload.reasoning.failure_modes.length > 0)));
1570
+ profiles.push('index');
1571
+ if (hasJudgment) profiles.push('compact');
1572
+ if (payload.scenarios && payload.scenarios.length > 0) profiles.push('scenario');
1573
+ profiles.push('full');
1574
+ return profiles;
1575
+ }
1576
+
1577
+ const profiles = availableProfiles();
1578
+ const result = {
1579
+ status: 'loaded',
1580
+ profile,
1581
+ profile_available: profiles.includes(profile),
1582
+ available_profiles: profiles,
1583
+ asset_id: m.asset_id,
1584
+ title: m.title,
1585
+ };
1564
1586
 
1565
1587
  if (profile === 'index') {
1566
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 || {}) : [] };
@@ -1578,9 +1600,10 @@ function loadV1Unsafe(inputPath, opts = {}) {
1578
1600
  result.max_tokens_hint = m.load_contract.profiles.compact.max_tokens_hint;
1579
1601
  }
1580
1602
  } else if (profile === 'scenario') {
1581
- result.content = { note: 'scenario profile: no scenarios present in minimal example, returning compact fallback' };
1582
1603
  if (payload.scenarios && payload.scenarios.length > 0) {
1583
1604
  result.content = { scenarios: payload.scenarios };
1605
+ } else {
1606
+ result.content = null;
1584
1607
  }
1585
1608
  } else if (profile === 'full') {
1586
1609
  result.content = { manifest: m, payload };
@@ -1590,6 +1613,15 @@ function loadV1Unsafe(inputPath, opts = {}) {
1590
1613
 
1591
1614
  if (as === 'prompt') {
1592
1615
  const c = result.content;
1616
+ if (c === null) {
1617
+ return {
1618
+ status: result.status,
1619
+ profile: result.profile,
1620
+ profile_available: false,
1621
+ available_profiles: result.available_profiles,
1622
+ text: `KDNA Judgment Asset: ${result.title || 'untitled'}\nAsset ID: ${result.asset_id || 'unknown'}\nProfile: ${result.profile}\n\nProfile "${result.profile}" is not available for this asset. Available profiles: ${result.available_profiles.join(', ')}`,
1623
+ };
1624
+ }
1593
1625
  let text = 'KDNA Judgment Asset: ' + (result.title || 'untitled') + '\n';
1594
1626
  text += 'Asset ID: ' + (result.asset_id || 'unknown') + '\n';
1595
1627
  text += 'Profile: ' + result.profile + '\n';