tpmkms_4wp 9.1.1-beta.3 → 9.1.1-beta.31
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/common/animals.instance.json +13 -0
- package/common/articles.js +1 -0
- package/common/asking.test.json +193 -72
- package/common/colors.instance.json +14 -0
- package/common/comparable.instance.json +3 -0
- package/common/concept.js +1 -1
- package/common/crew.instance.json +26 -0
- package/common/dialogues.js +2 -1
- package/common/dimension.instance.json +1 -0
- package/common/edible.instance.json +36 -0
- package/common/emotions.instance.json +1 -0
- package/common/events.js +3 -3
- package/common/events.test.json +107 -36
- package/common/fastfood.instance.json +2322 -13547
- package/common/fastfood.js +2 -1
- package/common/formulas.instance.json +1 -0
- package/common/formulas.js +3 -1
- package/common/formulas.test.json +643 -711
- package/common/helpers/concept.js +6 -2
- package/common/helpers/dialogues.js +1 -1
- package/common/helpers/menus.js +154 -0
- package/common/helpers.js +16 -0
- package/common/kirk.instance.json +1 -0
- package/common/length.instance.json +15 -0
- package/common/math.instance.json +1 -0
- package/common/menus.instance.json +10096 -1
- package/common/menus.js +207 -8
- package/common/menus.test.json +26162 -1
- package/common/ordering.instance.json +2 -0
- package/common/people.instance.json +156 -8
- package/common/pipboy.instance.json +49 -1
- package/common/pokemon.instance.json +13 -8
- package/common/pressure.instance.json +4 -0
- package/common/properties.instance.json +1 -0
- package/common/reports.instance.json +18 -23
- package/common/reports.js +12 -3
- package/common/sdefaults.js +28 -3
- package/common/spock.instance.json +1 -0
- package/common/stm.js +2 -1
- package/common/temperature.instance.json +4 -112
- package/common/tester.js +24 -2
- package/common/ui.instance.json +446 -0
- package/common/ui.js +9 -4
- package/common/ui.test.json +6794 -0
- package/common/weight.instance.json +14 -0
- package/common/wp.instance.json +6118 -2
- package/package.json +3 -2
package/common/sdefaults.js
CHANGED
@@ -1,7 +1,19 @@
|
|
1
|
-
const { flatten, knowledgeModule, where } = require('./runtime').theprogrammablemind
|
1
|
+
const { flatten, knowledgeModule, where, debug } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const sdefaults_tests = require('./sdefaults.test.json')
|
4
4
|
|
5
|
+
class API {
|
6
|
+
initialize(args) {
|
7
|
+
const { globals } = args
|
8
|
+
this.globals = globals
|
9
|
+
this.globals.server.associations = []
|
10
|
+
}
|
11
|
+
|
12
|
+
addAssociation(association) {
|
13
|
+
this.globals.server.associations.push(association)
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
5
17
|
const config = {
|
6
18
|
name: 'sdefaults',
|
7
19
|
semantics: [
|
@@ -29,11 +41,24 @@ const config = {
|
|
29
41
|
context.isResponse
|
30
42
|
}
|
31
43
|
},
|
44
|
+
{
|
45
|
+
notes: 'set the global associations',
|
46
|
+
where: where(),
|
47
|
+
priority: -1,
|
48
|
+
match: ({context}) => context.marker == 'controlBetween' || context.marker == 'controlEnd',
|
49
|
+
apply: async ({context, objects, api, _continue}) => {
|
50
|
+
for (const association of context.previous?.associations || []) {
|
51
|
+
api.addAssociation(association)
|
52
|
+
}
|
53
|
+
_continue()
|
54
|
+
}
|
55
|
+
},
|
32
56
|
],
|
33
57
|
};
|
34
58
|
|
35
59
|
knowledgeModule({
|
36
60
|
config,
|
61
|
+
api: () => new API(),
|
37
62
|
|
38
63
|
module,
|
39
64
|
description: 'defaults for semantics',
|
@@ -41,7 +66,7 @@ knowledgeModule({
|
|
41
66
|
name: './sdefaults.test.json',
|
42
67
|
contents: sdefaults_tests,
|
43
68
|
checks: {
|
44
|
-
|
45
|
-
|
69
|
+
context: defaultContextCheck(),
|
70
|
+
},
|
46
71
|
},
|
47
72
|
})
|
package/common/stm.js
CHANGED
@@ -14,6 +14,7 @@ class API {
|
|
14
14
|
this._objects.mentioned = []
|
15
15
|
this._objects.variables = {}
|
16
16
|
this.idCounter = 0
|
17
|
+
this.maximumMentioned = 50
|
17
18
|
}
|
18
19
|
|
19
20
|
getId() {
|
@@ -65,7 +66,7 @@ class API {
|
|
65
66
|
concept.stm.id = this.getId()
|
66
67
|
}
|
67
68
|
frameOfReference.mentioned = (frameOfReference.mentioned || []).filter( (context) => context.stm && context.stm.id != concept.stm.id )
|
68
|
-
frameOfReference.mentioned.
|
69
|
+
helpers.unshiftL(frameOfReference.mentioned, concept, this.maximumMentioned)
|
69
70
|
}
|
70
71
|
|
71
72
|
mentions({ context, frameOfReference, useHierarchy=true, all, condition = (() => true) } = {}) {
|
@@ -1163,6 +1163,7 @@
|
|
1163
1163
|
"level": 2,
|
1164
1164
|
"context_index": 1,
|
1165
1165
|
"topLevel": true,
|
1166
|
+
"context_id": 2,
|
1166
1167
|
"touchedBy": [
|
1167
1168
|
"temperature#call2"
|
1168
1169
|
]
|
@@ -2858,6 +2859,7 @@
|
|
2858
2859
|
"level": 2,
|
2859
2860
|
"context_index": 1,
|
2860
2861
|
"topLevel": true,
|
2862
|
+
"context_id": 2,
|
2861
2863
|
"touchedBy": [
|
2862
2864
|
"temperature#call2"
|
2863
2865
|
]
|
@@ -5213,6 +5215,7 @@
|
|
5213
5215
|
"level": 1,
|
5214
5216
|
"context_index": 1,
|
5215
5217
|
"topLevel": true,
|
5218
|
+
"context_id": 2,
|
5216
5219
|
"touchedBy": [
|
5217
5220
|
"temperature#call2"
|
5218
5221
|
]
|
@@ -5260,36 +5263,6 @@
|
|
5260
5263
|
0
|
5261
5264
|
]
|
5262
5265
|
],
|
5263
|
-
[
|
5264
|
-
[
|
5265
|
-
"celcius",
|
5266
|
-
0
|
5267
|
-
],
|
5268
|
-
[
|
5269
|
-
"divideByOperator",
|
5270
|
-
0
|
5271
|
-
],
|
5272
|
-
[
|
5273
|
-
"equals",
|
5274
|
-
0
|
5275
|
-
],
|
5276
|
-
[
|
5277
|
-
"fahrenheit",
|
5278
|
-
0
|
5279
|
-
],
|
5280
|
-
[
|
5281
|
-
"integer",
|
5282
|
-
0
|
5283
|
-
],
|
5284
|
-
[
|
5285
|
-
"plusOperator",
|
5286
|
-
0
|
5287
|
-
],
|
5288
|
-
[
|
5289
|
-
"timesOperator",
|
5290
|
-
0
|
5291
|
-
]
|
5292
|
-
],
|
5293
5266
|
[
|
5294
5267
|
[
|
5295
5268
|
"celcius",
|
@@ -7791,6 +7764,7 @@
|
|
7791
7764
|
"level": 1,
|
7792
7765
|
"context_index": 1,
|
7793
7766
|
"topLevel": true,
|
7767
|
+
"context_id": 2,
|
7794
7768
|
"touchedBy": [
|
7795
7769
|
"temperature#call2"
|
7796
7770
|
]
|
@@ -7978,32 +7952,6 @@
|
|
7978
7952
|
0
|
7979
7953
|
]
|
7980
7954
|
],
|
7981
|
-
[
|
7982
|
-
[
|
7983
|
-
"celcius",
|
7984
|
-
0
|
7985
|
-
],
|
7986
|
-
[
|
7987
|
-
"divideByOperator",
|
7988
|
-
0
|
7989
|
-
],
|
7990
|
-
[
|
7991
|
-
"equals",
|
7992
|
-
0
|
7993
|
-
],
|
7994
|
-
[
|
7995
|
-
"integer",
|
7996
|
-
0
|
7997
|
-
],
|
7998
|
-
[
|
7999
|
-
"plusOperator",
|
8000
|
-
0
|
8001
|
-
],
|
8002
|
-
[
|
8003
|
-
"timesOperator",
|
8004
|
-
0
|
8005
|
-
]
|
8006
|
-
],
|
8007
7955
|
[
|
8008
7956
|
[
|
8009
7957
|
"celcius",
|
@@ -9480,36 +9428,6 @@
|
|
9480
9428
|
0
|
9481
9429
|
]
|
9482
9430
|
],
|
9483
|
-
[
|
9484
|
-
[
|
9485
|
-
"celcius",
|
9486
|
-
0
|
9487
|
-
],
|
9488
|
-
[
|
9489
|
-
"divideByOperator",
|
9490
|
-
0
|
9491
|
-
],
|
9492
|
-
[
|
9493
|
-
"equals",
|
9494
|
-
0
|
9495
|
-
],
|
9496
|
-
[
|
9497
|
-
"fahrenheit",
|
9498
|
-
0
|
9499
|
-
],
|
9500
|
-
[
|
9501
|
-
"integer",
|
9502
|
-
0
|
9503
|
-
],
|
9504
|
-
[
|
9505
|
-
"plusOperator",
|
9506
|
-
0
|
9507
|
-
],
|
9508
|
-
[
|
9509
|
-
"timesOperator",
|
9510
|
-
0
|
9511
|
-
]
|
9512
|
-
],
|
9513
9431
|
[
|
9514
9432
|
[
|
9515
9433
|
"celcius",
|
@@ -9664,32 +9582,6 @@
|
|
9664
9582
|
0
|
9665
9583
|
]
|
9666
9584
|
],
|
9667
|
-
[
|
9668
|
-
[
|
9669
|
-
"celcius",
|
9670
|
-
0
|
9671
|
-
],
|
9672
|
-
[
|
9673
|
-
"divideByOperator",
|
9674
|
-
0
|
9675
|
-
],
|
9676
|
-
[
|
9677
|
-
"equals",
|
9678
|
-
0
|
9679
|
-
],
|
9680
|
-
[
|
9681
|
-
"integer",
|
9682
|
-
0
|
9683
|
-
],
|
9684
|
-
[
|
9685
|
-
"plusOperator",
|
9686
|
-
0
|
9687
|
-
],
|
9688
|
-
[
|
9689
|
-
"timesOperator",
|
9690
|
-
0
|
9691
|
-
]
|
9692
|
-
],
|
9693
9585
|
[
|
9694
9586
|
[
|
9695
9587
|
"celcius",
|
package/common/tester.js
CHANGED
@@ -3,13 +3,20 @@ const { defaultContextCheck } = require('./helpers')
|
|
3
3
|
const tester_tests = require('./tester.test.json')
|
4
4
|
const ArgumentParser = require('argparse').ArgumentParser
|
5
5
|
|
6
|
+
const testModuleNameFn = () => {
|
7
|
+
const parser = new ArgumentParser({ description: 'Get test module name' })
|
8
|
+
parser.add_argument('-tmn', '--testModuleName', { help: 'List of module to run the tests from' })
|
9
|
+
const [args, unknown] = parser.parse_known_args()
|
10
|
+
return args.testModuleName
|
11
|
+
}
|
12
|
+
const testModuleName = testModuleNameFn()
|
13
|
+
|
6
14
|
const parser = new ArgumentParser({
|
7
15
|
description: 'Test modules together'
|
8
16
|
})
|
9
17
|
|
10
18
|
parser.add_argument('-m', '--modules', { help: 'List of modules to load' })
|
11
19
|
const [args, unknown] = parser.parse_known_args()
|
12
|
-
|
13
20
|
process.argv = [process.argv[0], process.argv[1], ...unknown]
|
14
21
|
|
15
22
|
const createConfig = async () => {
|
@@ -29,12 +36,26 @@ const createConfig = async () => {
|
|
29
36
|
global.theprogrammablemind = {
|
30
37
|
loadForTesting: {}
|
31
38
|
}
|
39
|
+
|
32
40
|
const includes = args.modules.split(',').map((module) => {
|
33
41
|
global.theprogrammablemind.loadForTesting[module] = true
|
34
42
|
const km = require(`./${module}`)
|
35
43
|
return km
|
36
44
|
})
|
37
45
|
|
46
|
+
const fixtures = async (args) => {
|
47
|
+
const { config, kms, apis } = args;
|
48
|
+
if (kms[testModuleName].testConfig?.fixtures) {
|
49
|
+
const fixtures = kms.menus.testConfig?.fixtures
|
50
|
+
kms.menus.testConfig.fixtures = null
|
51
|
+
const testModuleApi = apis(testModuleName)
|
52
|
+
const objects = testModuleApi._objects
|
53
|
+
args.objects = objects
|
54
|
+
await fixtures({ ...args, objects, api: testModuleApi })
|
55
|
+
kms.menus.testConfig.fixtures = fixtures
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
38
59
|
knowledgeModule({
|
39
60
|
config: { name: 'tester' },
|
40
61
|
includes,
|
@@ -43,6 +64,7 @@ knowledgeModule({
|
|
43
64
|
description: 'Testing modules loaded together',
|
44
65
|
test: {
|
45
66
|
name: './tester.test.json',
|
46
|
-
contents: tester_tests
|
67
|
+
contents: tester_tests,
|
68
|
+
fixtures,
|
47
69
|
},
|
48
70
|
})
|