tpmkms_4wp 9.1.1 → 9.2.0-beta.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.
Files changed (54) hide show
  1. package/common/animals.instance.json +13 -0
  2. package/common/articles.js +3 -0
  3. package/common/asking.test.json +193 -72
  4. package/common/avatar.js +0 -6
  5. package/common/colors.instance.json +42 -0
  6. package/common/comparable.instance.json +3 -0
  7. package/common/comparable.js +6 -0
  8. package/common/concept.js +1 -1
  9. package/common/crew.instance.json +26 -39
  10. package/common/crew.js +0 -7
  11. package/common/dialogues.js +2 -1
  12. package/common/dimension.instance.json +1 -0
  13. package/common/edible.instance.json +92 -0
  14. package/common/emotions.instance.json +1 -0
  15. package/common/events.js +3 -3
  16. package/common/events.test.json +107 -36
  17. package/common/fastfood.instance.json +1053 -12554
  18. package/common/fastfood.js +2 -1
  19. package/common/formulas.instance.json +1 -0
  20. package/common/formulas.js +3 -1
  21. package/common/formulas.test.json +643 -711
  22. package/common/helpers/concept.js +6 -2
  23. package/common/helpers/dialogues.js +1 -1
  24. package/common/helpers/menus.js +154 -0
  25. package/common/helpers.js +16 -0
  26. package/common/kirk.instance.json +1 -0
  27. package/common/length.instance.json +15 -0
  28. package/common/math.instance.json +1 -0
  29. package/common/menus.instance.json +10097 -0
  30. package/common/menus.js +260 -0
  31. package/common/menus.test.json +26163 -0
  32. package/common/negation.js +5 -0
  33. package/common/ordering.instance.json +2 -0
  34. package/common/people.instance.json +96 -8
  35. package/common/pipboy.instance.json +105 -123
  36. package/common/pipboy.js +0 -7
  37. package/common/pokemon.instance.json +13 -8
  38. package/common/pressure.instance.json +4 -0
  39. package/common/properties.instance.json +1 -0
  40. package/common/properties.js +1 -0
  41. package/common/reports.instance.json +18 -23
  42. package/common/reports.js +12 -3
  43. package/common/sdefaults.js +28 -3
  44. package/common/spock.instance.json +1 -0
  45. package/common/stm.js +2 -1
  46. package/common/temperature.instance.json +4 -0
  47. package/common/tester.js +24 -2
  48. package/common/ui.instance.json +446 -0
  49. package/common/ui.js +9 -4
  50. package/common/ui.test.json +6794 -0
  51. package/common/weight.instance.json +14 -0
  52. package/common/wp.instance.json +6262 -2
  53. package/main.js +2 -0
  54. package/package.json +8 -3
@@ -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.associations = []
10
+ }
11
+
12
+ addAssociation(association) {
13
+ this.globals.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
- context: defaultContextCheck(),
45
- },
69
+ context: defaultContextCheck(),
70
+ },
46
71
  },
47
72
  })
@@ -1567,6 +1567,7 @@
1567
1567
  "level": 2,
1568
1568
  "context_index": 1,
1569
1569
  "topLevel": true,
1570
+ "context_id": 2,
1570
1571
  "touchedBy": [
1571
1572
  "spock#call2"
1572
1573
  ]
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.unshift(concept)
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
  ]
@@ -7761,6 +7764,7 @@
7761
7764
  "level": 1,
7762
7765
  "context_index": 1,
7763
7766
  "topLevel": true,
7767
+ "context_id": 2,
7764
7768
  "touchedBy": [
7765
7769
  "temperature#call2"
7766
7770
  ]
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
  })
@@ -29,6 +29,46 @@
29
29
  "article",
30
30
  false
31
31
  ],
32
+ [
33
+ "ascending",
34
+ "hierarchyAble",
35
+ false
36
+ ],
37
+ [
38
+ "ascending",
39
+ "isEdee",
40
+ false
41
+ ],
42
+ [
43
+ "ascending",
44
+ "isEder",
45
+ false
46
+ ],
47
+ [
48
+ "ascending",
49
+ "object",
50
+ false
51
+ ],
52
+ [
53
+ "ascending",
54
+ "property",
55
+ false
56
+ ],
57
+ [
58
+ "ascending",
59
+ "queryable",
60
+ false
61
+ ],
62
+ [
63
+ "ascending",
64
+ "sort_ordering",
65
+ false
66
+ ],
67
+ [
68
+ "ascending",
69
+ "theAble",
70
+ false
71
+ ],
32
72
  [
33
73
  "between",
34
74
  "preposition",
@@ -49,6 +89,11 @@
49
89
  "verb",
50
90
  false
51
91
  ],
92
+ [
93
+ "comparable",
94
+ "theAble",
95
+ false
96
+ ],
52
97
  [
53
98
  "concept",
54
99
  "queryable",
@@ -59,11 +104,56 @@
59
104
  "theAble",
60
105
  false
61
106
  ],
107
+ [
108
+ "condition",
109
+ "condition",
110
+ false
111
+ ],
62
112
  [
63
113
  "countable",
64
114
  "hierarchyAble",
65
115
  false
66
116
  ],
117
+ [
118
+ "descending",
119
+ "hierarchyAble",
120
+ false
121
+ ],
122
+ [
123
+ "descending",
124
+ "isEdee",
125
+ false
126
+ ],
127
+ [
128
+ "descending",
129
+ "isEder",
130
+ false
131
+ ],
132
+ [
133
+ "descending",
134
+ "object",
135
+ false
136
+ ],
137
+ [
138
+ "descending",
139
+ "property",
140
+ false
141
+ ],
142
+ [
143
+ "descending",
144
+ "queryable",
145
+ false
146
+ ],
147
+ [
148
+ "descending",
149
+ "sort_ordering",
150
+ false
151
+ ],
152
+ [
153
+ "descending",
154
+ "theAble",
155
+ false
156
+ ],
67
157
  [
68
158
  "direction",
69
159
  "direction",
@@ -74,6 +164,16 @@
74
164
  "queryable",
75
165
  false
76
166
  ],
167
+ [
168
+ "divideByExpression",
169
+ "mathematicalExpression",
170
+ false
171
+ ],
172
+ [
173
+ "divideByOperator",
174
+ "mathematical_operator",
175
+ false
176
+ ],
77
177
  [
78
178
  "doubleQuote",
79
179
  "queryable",
@@ -119,6 +219,11 @@
119
219
  "queryable",
120
220
  false
121
221
  ],
222
+ [
223
+ "highest",
224
+ "condition",
225
+ false
226
+ ],
122
227
  [
123
228
  "ifAble",
124
229
  "ifAble",
@@ -139,6 +244,16 @@
139
244
  "verb",
140
245
  false
141
246
  ],
247
+ [
248
+ "isEdee",
249
+ "isEdee",
250
+ false
251
+ ],
252
+ [
253
+ "isEder",
254
+ "isEder",
255
+ false
256
+ ],
142
257
  [
143
258
  "isQuery",
144
259
  "verb",
@@ -179,11 +294,126 @@
179
294
  "action",
180
295
  false
181
296
  ],
297
+ [
298
+ "lowest",
299
+ "condition",
300
+ false
301
+ ],
302
+ [
303
+ "mathematical",
304
+ "hierarchyAble",
305
+ false
306
+ ],
307
+ [
308
+ "mathematical",
309
+ "isEdee",
310
+ false
311
+ ],
312
+ [
313
+ "mathematical",
314
+ "isEder",
315
+ false
316
+ ],
317
+ [
318
+ "mathematical",
319
+ "object",
320
+ false
321
+ ],
322
+ [
323
+ "mathematical",
324
+ "operator_modifier",
325
+ false
326
+ ],
327
+ [
328
+ "mathematical",
329
+ "property",
330
+ false
331
+ ],
332
+ [
333
+ "mathematical",
334
+ "queryable",
335
+ false
336
+ ],
337
+ [
338
+ "mathematical",
339
+ "theAble",
340
+ false
341
+ ],
342
+ [
343
+ "mathematicalExpression",
344
+ "concept",
345
+ false
346
+ ],
347
+ [
348
+ "mathematicalExpression",
349
+ "number",
350
+ false
351
+ ],
352
+ [
353
+ "mathematical_operator",
354
+ "adjective",
355
+ true
356
+ ],
357
+ [
358
+ "mathematical_operator",
359
+ "concept",
360
+ false
361
+ ],
362
+ [
363
+ "mathematical_operator",
364
+ "hierarchyAble",
365
+ false
366
+ ],
367
+ [
368
+ "mathematical_operator",
369
+ "isEdee",
370
+ false
371
+ ],
372
+ [
373
+ "mathematical_operator",
374
+ "isEder",
375
+ false
376
+ ],
377
+ [
378
+ "mathematical_operator",
379
+ "object",
380
+ false
381
+ ],
382
+ [
383
+ "mathematical_operator",
384
+ "operator",
385
+ false
386
+ ],
387
+ [
388
+ "mathematical_operator",
389
+ "property",
390
+ false
391
+ ],
392
+ [
393
+ "mathematical_operator",
394
+ "queryable",
395
+ false
396
+ ],
397
+ [
398
+ "mathematical_operator",
399
+ "theAble",
400
+ false
401
+ ],
182
402
  [
183
403
  "memorable",
184
404
  "theAble",
185
405
  false
186
406
  ],
407
+ [
408
+ "minusExpression",
409
+ "mathematicalExpression",
410
+ false
411
+ ],
412
+ [
413
+ "minusOperator",
414
+ "mathematical_operator",
415
+ false
416
+ ],
187
417
  [
188
418
  "modifies",
189
419
  "verb",
@@ -234,6 +464,51 @@
234
464
  "theAble",
235
465
  false
236
466
  ],
467
+ [
468
+ "operator",
469
+ "concept",
470
+ false
471
+ ],
472
+ [
473
+ "operator",
474
+ "hierarchyAble",
475
+ false
476
+ ],
477
+ [
478
+ "operator",
479
+ "isEdee",
480
+ false
481
+ ],
482
+ [
483
+ "operator",
484
+ "isEder",
485
+ false
486
+ ],
487
+ [
488
+ "operator",
489
+ "object",
490
+ false
491
+ ],
492
+ [
493
+ "operator",
494
+ "property",
495
+ false
496
+ ],
497
+ [
498
+ "operator",
499
+ "queryable",
500
+ false
501
+ ],
502
+ [
503
+ "operator",
504
+ "theAble",
505
+ false
506
+ ],
507
+ [
508
+ "operator_modifier",
509
+ "adjective",
510
+ false
511
+ ],
237
512
  [
238
513
  "orAble",
239
514
  "ifAble",
@@ -249,6 +524,51 @@
249
524
  "theAble",
250
525
  false
251
526
  ],
527
+ [
528
+ "ordering",
529
+ "concept",
530
+ false
531
+ ],
532
+ [
533
+ "ordering",
534
+ "hierarchyAble",
535
+ false
536
+ ],
537
+ [
538
+ "ordering",
539
+ "isEdee",
540
+ false
541
+ ],
542
+ [
543
+ "ordering",
544
+ "isEder",
545
+ false
546
+ ],
547
+ [
548
+ "ordering",
549
+ "object",
550
+ false
551
+ ],
552
+ [
553
+ "ordering",
554
+ "property",
555
+ false
556
+ ],
557
+ [
558
+ "ordering",
559
+ "queryable",
560
+ false
561
+ ],
562
+ [
563
+ "ordering",
564
+ "theAble",
565
+ false
566
+ ],
567
+ [
568
+ "ordering_modifier",
569
+ "adjective",
570
+ false
571
+ ],
252
572
  [
253
573
  "ordinal",
254
574
  "listable",
@@ -259,6 +579,16 @@
259
579
  "adjective",
260
580
  false
261
581
  ],
582
+ [
583
+ "plusExpression",
584
+ "mathematicalExpression",
585
+ false
586
+ ],
587
+ [
588
+ "plusOperator",
589
+ "mathematical_operator",
590
+ false
591
+ ],
262
592
  [
263
593
  "preposition",
264
594
  "preposition",
@@ -334,6 +664,101 @@
334
664
  "verb",
335
665
  false
336
666
  ],
667
+ [
668
+ "sort",
669
+ "hierarchyAble",
670
+ false
671
+ ],
672
+ [
673
+ "sort",
674
+ "isEdee",
675
+ false
676
+ ],
677
+ [
678
+ "sort",
679
+ "isEder",
680
+ false
681
+ ],
682
+ [
683
+ "sort",
684
+ "object",
685
+ false
686
+ ],
687
+ [
688
+ "sort",
689
+ "ordering_modifier",
690
+ false
691
+ ],
692
+ [
693
+ "sort",
694
+ "property",
695
+ false
696
+ ],
697
+ [
698
+ "sort",
699
+ "queryable",
700
+ false
701
+ ],
702
+ [
703
+ "sort",
704
+ "theAble",
705
+ false
706
+ ],
707
+ [
708
+ "sortOrdering",
709
+ "adjective",
710
+ false
711
+ ],
712
+ [
713
+ "sort_ordering",
714
+ "adjective",
715
+ true
716
+ ],
717
+ [
718
+ "sort_ordering",
719
+ "concept",
720
+ false
721
+ ],
722
+ [
723
+ "sort_ordering",
724
+ "hierarchyAble",
725
+ false
726
+ ],
727
+ [
728
+ "sort_ordering",
729
+ "isEdee",
730
+ false
731
+ ],
732
+ [
733
+ "sort_ordering",
734
+ "isEder",
735
+ false
736
+ ],
737
+ [
738
+ "sort_ordering",
739
+ "object",
740
+ false
741
+ ],
742
+ [
743
+ "sort_ordering",
744
+ "ordering",
745
+ false
746
+ ],
747
+ [
748
+ "sort_ordering",
749
+ "property",
750
+ false
751
+ ],
752
+ [
753
+ "sort_ordering",
754
+ "queryable",
755
+ false
756
+ ],
757
+ [
758
+ "sort_ordering",
759
+ "theAble",
760
+ false
761
+ ],
337
762
  [
338
763
  "stm_before",
339
764
  "adjective",
@@ -379,6 +804,16 @@
379
804
  "queryable",
380
805
  false
381
806
  ],
807
+ [
808
+ "timesExpression",
809
+ "mathematicalExpression",
810
+ false
811
+ ],
812
+ [
813
+ "timesOperator",
814
+ "mathematical_operator",
815
+ false
816
+ ],
382
817
  [
383
818
  "to",
384
819
  "preposition",
@@ -439,10 +874,20 @@
439
874
  "object",
440
875
  false
441
876
  ],
877
+ [
878
+ "x",
879
+ "number",
880
+ false
881
+ ],
442
882
  [
443
883
  "xfx",
444
884
  "queryable",
445
885
  false
886
+ ],
887
+ [
888
+ "y",
889
+ "number",
890
+ false
446
891
  ]
447
892
  ],
448
893
  "metadata": {
@@ -522,6 +967,7 @@
522
967
  "level": 1,
523
968
  "context_index": 1,
524
969
  "topLevel": true,
970
+ "context_id": 2,
525
971
  "touchedBy": [
526
972
  "ui#call2"
527
973
  ]