@aikdna/kdna-core 0.1.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/package.json +44 -0
- package/schema/KDNA_Cases.schema.json +51 -0
- package/schema/KDNA_Cluster.schema.json +53 -0
- package/schema/KDNA_Core.schema.json +102 -0
- package/schema/KDNA_Evolution.schema.json +76 -0
- package/schema/KDNA_Patterns.schema.json +71 -0
- package/schema/KDNA_Reasoning.schema.json +56 -0
- package/schema/KDNA_Scenarios.schema.json +81 -0
- package/schema/kdna-file.schema.json +262 -0
- package/src/index.js +14 -0
- package/src/index.mjs +17 -0
- package/src/lint-pure.js +197 -0
- package/src/loader.js +263 -0
- package/src/render.js +111 -0
- package/src/types.d.ts +254 -0
- package/src/validate-pure.js +131 -0
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aikdna/kdna-core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "KDNA core library — pure logic for loading, validating, linting, and rendering KDNA domain cognition packages. Zero Node.js dependencies.",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"main": "src/index.js",
|
|
7
|
+
"module": "src/index.mjs",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./src/index.mjs",
|
|
11
|
+
"require": "./src/index.js",
|
|
12
|
+
"types": "./src/types.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json",
|
|
15
|
+
"./schema/*": "./schema/*"
|
|
16
|
+
},
|
|
17
|
+
"types": "src/types.d.ts",
|
|
18
|
+
"files": [
|
|
19
|
+
"src/",
|
|
20
|
+
"schema/"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"kdna",
|
|
24
|
+
"kdna-core",
|
|
25
|
+
"ai-agent",
|
|
26
|
+
"domain-cognition",
|
|
27
|
+
"knowledge-dna"
|
|
28
|
+
],
|
|
29
|
+
"license": "Apache-2.0",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/knowledge-dna/KDNA.git",
|
|
33
|
+
"directory": "packages/kdna-core"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://aikdna.com",
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"ajv": "^8.17.1",
|
|
38
|
+
"ajv-formats": "^3.0.1"
|
|
39
|
+
},
|
|
40
|
+
"peerDependenciesMeta": {
|
|
41
|
+
"ajv": { "optional": true },
|
|
42
|
+
"ajv-formats": { "optional": true }
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "KDNA_Cases",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": [
|
|
6
|
+
"meta",
|
|
7
|
+
"cases"
|
|
8
|
+
],
|
|
9
|
+
"properties": {
|
|
10
|
+
"meta": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"required": [
|
|
13
|
+
"version",
|
|
14
|
+
"domain",
|
|
15
|
+
"created",
|
|
16
|
+
"purpose",
|
|
17
|
+
"load_condition"
|
|
18
|
+
],
|
|
19
|
+
"properties": {
|
|
20
|
+
"version": { "type": "string" },
|
|
21
|
+
"domain": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
|
|
22
|
+
"created": { "type": "string" },
|
|
23
|
+
"purpose": { "type": "string" },
|
|
24
|
+
"load_condition": { "type": "string" }
|
|
25
|
+
},
|
|
26
|
+
"additionalProperties": true
|
|
27
|
+
},
|
|
28
|
+
"cases": {
|
|
29
|
+
"type": "array",
|
|
30
|
+
"items": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"required": ["id", "title"],
|
|
33
|
+
"properties": {
|
|
34
|
+
"id": { "type": "string" },
|
|
35
|
+
"scene_id": { "type": "string" },
|
|
36
|
+
"title": { "type": "string" },
|
|
37
|
+
"context": { "type": "string" },
|
|
38
|
+
"what_happened": { "type": "string" },
|
|
39
|
+
"what_was_learned": { "type": "string" },
|
|
40
|
+
"structural_pattern": { "type": "string" },
|
|
41
|
+
"narrative": { "type": "string" },
|
|
42
|
+
"outcome": { "type": "string" },
|
|
43
|
+
"kdna_analysis": { "type": "string" },
|
|
44
|
+
"modern_parallel": { "type": "string" },
|
|
45
|
+
"axiom": { "type": "string" }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"additionalProperties": true
|
|
51
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://aikdna.com/schema/KDNA_Cluster.schema.json",
|
|
4
|
+
"title": "KDNA Cluster Manifest",
|
|
5
|
+
"description": "Defines a composable group of KDNA packages that work together as a judgment system.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["name", "version", "packages"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"name": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Cluster identifier in lowercase snake_case."
|
|
12
|
+
},
|
|
13
|
+
"version": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "Semantic version of this cluster."
|
|
16
|
+
},
|
|
17
|
+
"purpose": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "What complex domain task this cluster addresses."
|
|
20
|
+
},
|
|
21
|
+
"packages": {
|
|
22
|
+
"type": "array",
|
|
23
|
+
"description": "KDNA packages that form this cluster.",
|
|
24
|
+
"minItems": 2,
|
|
25
|
+
"items": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"required": ["id", "role"],
|
|
28
|
+
"properties": {
|
|
29
|
+
"id": { "type": "string" },
|
|
30
|
+
"role": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"enum": ["primary", "advisor", "constraint", "critic"]
|
|
33
|
+
},
|
|
34
|
+
"use_when": {
|
|
35
|
+
"type": "array",
|
|
36
|
+
"items": { "type": "string" },
|
|
37
|
+
"description": "Keywords or conditions that trigger this package."
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"composition_rules": {
|
|
43
|
+
"type": "array",
|
|
44
|
+
"items": { "type": "string" },
|
|
45
|
+
"description": "Rules governing how packages in this cluster interact."
|
|
46
|
+
},
|
|
47
|
+
"routing_questions": {
|
|
48
|
+
"type": "array",
|
|
49
|
+
"items": { "type": "string" },
|
|
50
|
+
"description": "Questions that help the router select the right primary and advisors."
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "KDNA_Core",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": [
|
|
6
|
+
"meta",
|
|
7
|
+
"axioms",
|
|
8
|
+
"ontology",
|
|
9
|
+
"frameworks",
|
|
10
|
+
"core_structure",
|
|
11
|
+
"stances"
|
|
12
|
+
],
|
|
13
|
+
"properties": {
|
|
14
|
+
"meta": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"required": [
|
|
17
|
+
"version",
|
|
18
|
+
"domain",
|
|
19
|
+
"created",
|
|
20
|
+
"purpose",
|
|
21
|
+
"load_condition"
|
|
22
|
+
],
|
|
23
|
+
"properties": {
|
|
24
|
+
"version": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
"domain": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"pattern": "^[a-z][a-z0-9_]*$"
|
|
30
|
+
},
|
|
31
|
+
"created": {
|
|
32
|
+
"type": "string"
|
|
33
|
+
},
|
|
34
|
+
"purpose": {
|
|
35
|
+
"type": "string"
|
|
36
|
+
},
|
|
37
|
+
"load_condition": {
|
|
38
|
+
"type": "string"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"additionalProperties": true
|
|
42
|
+
},
|
|
43
|
+
"axioms": {
|
|
44
|
+
"type": "array",
|
|
45
|
+
"items": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"required": [
|
|
48
|
+
"id",
|
|
49
|
+
"one_sentence",
|
|
50
|
+
"full_statement",
|
|
51
|
+
"why"
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"ontology": {
|
|
56
|
+
"type": "array",
|
|
57
|
+
"items": {
|
|
58
|
+
"type": "object",
|
|
59
|
+
"required": [
|
|
60
|
+
"id",
|
|
61
|
+
"one_sentence",
|
|
62
|
+
"essence",
|
|
63
|
+
"boundary",
|
|
64
|
+
"trigger_signal"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"frameworks": {
|
|
69
|
+
"type": "array",
|
|
70
|
+
"items": {
|
|
71
|
+
"type": "object",
|
|
72
|
+
"required": [
|
|
73
|
+
"id",
|
|
74
|
+
"name",
|
|
75
|
+
"when_to_use",
|
|
76
|
+
"steps"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"core_structure": {
|
|
81
|
+
"type": "array",
|
|
82
|
+
"items": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"required": [
|
|
85
|
+
"from",
|
|
86
|
+
"to",
|
|
87
|
+
"via"
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"stances": {
|
|
92
|
+
"type": "array",
|
|
93
|
+
"items": {
|
|
94
|
+
"anyOf": [
|
|
95
|
+
{ "type": "string" },
|
|
96
|
+
{ "type": "object", "required": ["stance"] }
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"additionalProperties": true
|
|
102
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "KDNA_Evolution",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["meta"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"meta": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"required": [
|
|
10
|
+
"version",
|
|
11
|
+
"domain",
|
|
12
|
+
"created",
|
|
13
|
+
"purpose",
|
|
14
|
+
"load_condition"
|
|
15
|
+
],
|
|
16
|
+
"properties": {
|
|
17
|
+
"version": { "type": "string" },
|
|
18
|
+
"domain": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
|
|
19
|
+
"created": { "type": "string" },
|
|
20
|
+
"purpose": { "type": "string" },
|
|
21
|
+
"load_condition": { "type": "string" }
|
|
22
|
+
},
|
|
23
|
+
"additionalProperties": true
|
|
24
|
+
},
|
|
25
|
+
"maturity_stages": {
|
|
26
|
+
"type": "array",
|
|
27
|
+
"items": {
|
|
28
|
+
"type": "object"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"stages": {
|
|
32
|
+
"type": "array",
|
|
33
|
+
"items": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"required": ["id", "name", "description", "indicators"],
|
|
36
|
+
"properties": {
|
|
37
|
+
"id": { "type": "string" },
|
|
38
|
+
"name": { "type": "string" },
|
|
39
|
+
"description": { "type": "string" },
|
|
40
|
+
"indicators": {
|
|
41
|
+
"type": "array",
|
|
42
|
+
"items": { "type": "string" }
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"evolution_layers": {
|
|
48
|
+
"type": "array",
|
|
49
|
+
"items": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"required": ["id", "name", "capability", "from_stage", "to_stage"],
|
|
52
|
+
"properties": {
|
|
53
|
+
"id": { "type": "string" },
|
|
54
|
+
"name": { "type": "string" },
|
|
55
|
+
"capability": { "type": "string" },
|
|
56
|
+
"from_stage": { "type": "string" },
|
|
57
|
+
"to_stage": { "type": "string" }
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"measurement": {
|
|
62
|
+
"type": "array",
|
|
63
|
+
"items": {
|
|
64
|
+
"type": "object",
|
|
65
|
+
"required": ["id", "what", "how", "threshold"],
|
|
66
|
+
"properties": {
|
|
67
|
+
"id": { "type": "string" },
|
|
68
|
+
"what": { "type": "string" },
|
|
69
|
+
"how": { "type": "string" },
|
|
70
|
+
"threshold": { "type": "string" }
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"additionalProperties": true
|
|
76
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "KDNA_Patterns",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": [
|
|
6
|
+
"meta",
|
|
7
|
+
"terminology",
|
|
8
|
+
"misunderstandings",
|
|
9
|
+
"self_check"
|
|
10
|
+
],
|
|
11
|
+
"properties": {
|
|
12
|
+
"meta": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"required": [
|
|
15
|
+
"version",
|
|
16
|
+
"domain",
|
|
17
|
+
"created",
|
|
18
|
+
"purpose",
|
|
19
|
+
"load_condition"
|
|
20
|
+
],
|
|
21
|
+
"properties": {
|
|
22
|
+
"version": {
|
|
23
|
+
"type": "string"
|
|
24
|
+
},
|
|
25
|
+
"domain": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"pattern": "^[a-z][a-z0-9_]*$"
|
|
28
|
+
},
|
|
29
|
+
"created": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
},
|
|
32
|
+
"purpose": {
|
|
33
|
+
"type": "string"
|
|
34
|
+
},
|
|
35
|
+
"load_condition": {
|
|
36
|
+
"type": "string"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"additionalProperties": true
|
|
40
|
+
},
|
|
41
|
+
"terminology": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"minProperties": 1,
|
|
44
|
+
"properties": {
|
|
45
|
+
"standard_terms": { "type": "array" },
|
|
46
|
+
"preferred_terms": { "type": "array" },
|
|
47
|
+
"banned_terms": { "type": "array" }
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"misunderstandings": {
|
|
51
|
+
"type": "array",
|
|
52
|
+
"items": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"required": [
|
|
55
|
+
"id",
|
|
56
|
+
"wrong",
|
|
57
|
+
"correct",
|
|
58
|
+
"key_distinction",
|
|
59
|
+
"why"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"self_check": {
|
|
64
|
+
"type": "array",
|
|
65
|
+
"items": {
|
|
66
|
+
"type": "string"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"additionalProperties": true
|
|
71
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "KDNA_Reasoning",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["meta"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"meta": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"required": [
|
|
10
|
+
"version",
|
|
11
|
+
"domain",
|
|
12
|
+
"created",
|
|
13
|
+
"purpose",
|
|
14
|
+
"load_condition"
|
|
15
|
+
],
|
|
16
|
+
"properties": {
|
|
17
|
+
"version": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"domain": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"pattern": "^[a-z][a-z0-9_]*$"
|
|
23
|
+
},
|
|
24
|
+
"created": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
"purpose": {
|
|
28
|
+
"type": "string"
|
|
29
|
+
},
|
|
30
|
+
"load_condition": {
|
|
31
|
+
"type": "string"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"additionalProperties": true
|
|
35
|
+
},
|
|
36
|
+
"reasoning": {
|
|
37
|
+
"type": "array",
|
|
38
|
+
"items": {
|
|
39
|
+
"type": "object"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"reasoning_chains": {
|
|
43
|
+
"type": "array",
|
|
44
|
+
"items": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"required": [
|
|
47
|
+
"id",
|
|
48
|
+
"one_sentence",
|
|
49
|
+
"logic",
|
|
50
|
+
"so_what"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"additionalProperties": true
|
|
56
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "KDNA_Scenarios",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["meta"],
|
|
6
|
+
"properties": {
|
|
7
|
+
"meta": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"required": [
|
|
10
|
+
"version",
|
|
11
|
+
"domain",
|
|
12
|
+
"created",
|
|
13
|
+
"purpose",
|
|
14
|
+
"load_condition"
|
|
15
|
+
],
|
|
16
|
+
"properties": {
|
|
17
|
+
"version": { "type": "string" },
|
|
18
|
+
"domain": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
|
|
19
|
+
"created": { "type": "string" },
|
|
20
|
+
"purpose": { "type": "string" },
|
|
21
|
+
"load_condition": { "type": "string" }
|
|
22
|
+
},
|
|
23
|
+
"additionalProperties": true
|
|
24
|
+
},
|
|
25
|
+
"scenarios": {
|
|
26
|
+
"type": "array",
|
|
27
|
+
"items": {
|
|
28
|
+
"type": "object"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"scenes": {
|
|
32
|
+
"type": "array",
|
|
33
|
+
"items": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"required": ["id", "name", "trigger_signal"],
|
|
36
|
+
"properties": {
|
|
37
|
+
"id": { "type": "string" },
|
|
38
|
+
"name": { "type": "string" },
|
|
39
|
+
"trigger_signal": { "type": "string" },
|
|
40
|
+
"sub_scenarios": {
|
|
41
|
+
"type": "array",
|
|
42
|
+
"items": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"required": ["id", "trap_belief", "three_questions", "action_template", "expected_result"],
|
|
45
|
+
"properties": {
|
|
46
|
+
"id": { "type": "string" },
|
|
47
|
+
"trap_belief": { "type": "string" },
|
|
48
|
+
"three_questions": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"required": ["belief", "state", "need"],
|
|
51
|
+
"properties": {
|
|
52
|
+
"belief": { "type": "string" },
|
|
53
|
+
"state": { "type": "string" },
|
|
54
|
+
"need": { "type": "string" }
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"action_template": {
|
|
58
|
+
"type": "array",
|
|
59
|
+
"items": { "type": "string" }
|
|
60
|
+
},
|
|
61
|
+
"replace": {
|
|
62
|
+
"type": "array",
|
|
63
|
+
"items": {
|
|
64
|
+
"type": "object",
|
|
65
|
+
"required": ["avoid", "use"],
|
|
66
|
+
"properties": {
|
|
67
|
+
"avoid": { "type": "string" },
|
|
68
|
+
"use": { "type": "string" }
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"expected_result": { "type": "string" }
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"additionalProperties": true
|
|
81
|
+
}
|