ekms 9.6.3 → 9.7.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 (84) hide show
  1. package/common/actions.instance.json +2771 -15
  2. package/common/actions.js +116 -8
  3. package/common/actions.test.json +79138 -384
  4. package/common/angle.instance.json +138 -834
  5. package/common/angle.test.json +172 -127
  6. package/common/animals.instance.json +260 -0
  7. package/common/articles.js +1 -2
  8. package/common/avatar.test.json +173 -33
  9. package/common/can.instance.json +40 -0
  10. package/common/colors.instance.json +308 -0
  11. package/common/comparable.instance.json +120 -0
  12. package/common/compass.instance.json +63 -18
  13. package/common/concept.js +2 -1
  14. package/common/conjunction.js +11 -17
  15. package/common/control.js +42 -0
  16. package/common/control.test.json +2 -0
  17. package/common/crew.instance.json +520 -0
  18. package/common/dates.instance.json +184 -0
  19. package/common/dialogues.js +3 -3
  20. package/common/dimension.instance.json +264 -69
  21. package/common/dimension.js +5 -5
  22. package/common/dimension.test.json +545 -441
  23. package/common/drone.instance.json +15927 -2638
  24. package/common/drone.js +359 -71
  25. package/common/drone.test.json +587651 -44132
  26. package/common/drone_v1.instance.json +492 -59
  27. package/common/drone_v1.js +9 -9
  28. package/common/edible.instance.json +696 -0
  29. package/common/emotions.instance.json +20 -0
  30. package/common/evaluate.js +1 -1
  31. package/common/fastfood.instance.json +1310 -216
  32. package/common/fastfood.js +1 -1
  33. package/common/formulas.instance.json +20 -5
  34. package/common/formulas.js +1 -1
  35. package/common/gdefaults.js +32 -5
  36. package/common/help.test.json +23 -3
  37. package/common/helpers/conjunction.js +2 -0
  38. package/common/helpers/formulas.js +6 -0
  39. package/common/helpers/properties.js +9 -7
  40. package/common/helpers.js +11 -6
  41. package/common/hierarchy.js +2 -0
  42. package/common/kirk.instance.json +20 -0
  43. package/common/length.instance.json +1117 -5708
  44. package/common/length.test.json +29761 -12488
  45. package/common/logging.js +41 -0
  46. package/common/logging.test.json +2 -0
  47. package/common/math.instance.json +30 -12
  48. package/common/math.js +6 -5
  49. package/common/menus.instance.json +140 -35
  50. package/common/meta.js +1 -1
  51. package/common/nameable.js +7 -9
  52. package/common/nameable.test.json +252 -150
  53. package/common/ordering.instance.json +40 -0
  54. package/common/ordinals.js +51 -5
  55. package/common/people.instance.json +160 -0
  56. package/common/pipboy.instance.json +396 -85
  57. package/common/pipboy.js +1 -1
  58. package/common/pokemon.instance.json +260 -0
  59. package/common/pressure.instance.json +108 -370
  60. package/common/properties.instance.json +20 -0
  61. package/common/properties.js +5 -4
  62. package/common/properties.test.json +2754 -2142
  63. package/common/rates.instance.json +1 -1
  64. package/common/rates.js +3 -3
  65. package/common/rates.test.json +6914 -2428
  66. package/common/reminders.js +1 -1
  67. package/common/reports.instance.json +49 -176
  68. package/common/reports.js +2 -2
  69. package/common/scorekeeper.js +1 -1
  70. package/common/sdefaults.js +18 -5
  71. package/common/spock.instance.json +20 -0
  72. package/common/stm.js +115 -53
  73. package/common/stm.test.json +2670 -54
  74. package/common/temperature.instance.json +709 -2284
  75. package/common/time.instance.json +14333 -2220
  76. package/common/time.js +48 -2
  77. package/common/time.test.json +13239 -0
  78. package/common/tokenize.js +2 -0
  79. package/common/ui.instance.json +20 -5
  80. package/common/ui.js +1 -1
  81. package/common/weight.instance.json +621 -1886
  82. package/common/wp.instance.json +336 -70
  83. package/main.js +4 -0
  84. package/package.json +11 -5
@@ -0,0 +1,41 @@
1
+ const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
+ const tests = require('./logging.test.json')
3
+
4
+ class API {
5
+ initialize({ objects }) {
6
+ this.objects = objects
7
+ this.objects.messages = []
8
+ }
9
+
10
+ async log(message) {
11
+ if (this.args.isProcess || this.args.isTest) {
12
+ if (typeof message == 'function') {
13
+ message = await message()
14
+ }
15
+ this.objects.messages.push(message)
16
+ }
17
+ }
18
+ }
19
+
20
+ function initializer({config}) {
21
+ config.addArgs(({kms, e, toList}) => ({
22
+ testLog: (message) => kms.logging.api.log(message)
23
+ }))
24
+ }
25
+
26
+ knowledgeModule({
27
+ config: { name: 'logging' },
28
+ initializer,
29
+ api: () => new API(),
30
+ module,
31
+ description: 'Used for logging to help with testing',
32
+ test: {
33
+ name: './logging.test.json',
34
+ contents: tests,
35
+ checks: {
36
+ objects: [
37
+ { path: ['messages'] },
38
+ ],
39
+ }
40
+ },
41
+ })
@@ -0,0 +1,2 @@
1
+ [
2
+ ]
@@ -6,10 +6,10 @@
6
6
  "operators": [
7
7
  "([mathematicalExpression])",
8
8
  "([mathematical_operator])",
9
- "(([number|]) [plusOperator] ([number|]))",
10
- "(([number|]) [minusOperator] ([number|]))",
11
- "(([number|]) [timesOperator] ([number|]))",
12
- "(([number|]) [divideByOperator|] ([number|]))",
9
+ "((number/* || mathematicalExpression/*) [plusOperator] (number/* || mathematicalExpression/*))",
10
+ "((number/* || mathematicalExpression/*) [minusOperator] (number/* || mathematicalExpression/*))",
11
+ "((number/* || mathematicalExpression/*) [timesOperator] (number/* || mathematicalExpression/*))",
12
+ "((number/* || mathematicalExpression/*) [divideByOperator|] (number/* || mathematicalExpression/*))",
13
13
  "([plusExpression|])",
14
14
  "([minusExpression|])",
15
15
  "([timesExpression|])",
@@ -27,8 +27,7 @@
27
27
  {
28
28
  "id": "mathematicalExpression",
29
29
  "isA": [
30
- "concept",
31
- "number"
30
+ "concept"
32
31
  ]
33
32
  },
34
33
  {
@@ -350,6 +349,16 @@
350
349
  "hierarchyAble",
351
350
  false
352
351
  ],
352
+ [
353
+ "deletable",
354
+ "deletable",
355
+ false
356
+ ],
357
+ [
358
+ "delete",
359
+ "verb",
360
+ false
361
+ ],
353
362
  [
354
363
  "descending",
355
364
  "hierarchyAble",
@@ -630,6 +639,11 @@
630
639
  "thisAble",
631
640
  false
632
641
  ],
642
+ [
643
+ "memorable",
644
+ "deletable",
645
+ false
646
+ ],
633
647
  [
634
648
  "memorable",
635
649
  "theAble",
@@ -835,6 +849,11 @@
835
849
  "theAble",
836
850
  false
837
851
  ],
852
+ [
853
+ "recall",
854
+ "verb",
855
+ false
856
+ ],
838
857
  [
839
858
  "remember",
840
859
  "verb",
@@ -1359,10 +1378,10 @@
1359
1378
  "operators": [
1360
1379
  "([mathematicalExpression])",
1361
1380
  "([mathematical_operator])",
1362
- "(([number|]) [plusOperator] ([number|]))",
1363
- "(([number|]) [minusOperator] ([number|]))",
1364
- "(([number|]) [timesOperator] ([number|]))",
1365
- "(([number|]) [divideByOperator|] ([number|]))",
1381
+ "((number/* || mathematicalExpression/*) [plusOperator] (number/* || mathematicalExpression/*))",
1382
+ "((number/* || mathematicalExpression/*) [minusOperator] (number/* || mathematicalExpression/*))",
1383
+ "((number/* || mathematicalExpression/*) [timesOperator] (number/* || mathematicalExpression/*))",
1384
+ "((number/* || mathematicalExpression/*) [divideByOperator|] (number/* || mathematicalExpression/*))",
1366
1385
  "([plusExpression|])",
1367
1386
  "([minusExpression|])",
1368
1387
  "([timesExpression|])",
@@ -1380,8 +1399,7 @@
1380
1399
  {
1381
1400
  "id": "mathematicalExpression",
1382
1401
  "isA": [
1383
- "concept",
1384
- "number"
1402
+ "concept"
1385
1403
  ]
1386
1404
  },
1387
1405
  {
package/common/math.js CHANGED
@@ -76,10 +76,10 @@ const config = {
76
76
  operators: [
77
77
  "([mathematicalExpression])",
78
78
  "([mathematical_operator])",
79
- "(([number|]) [plusOperator] ([number|]))",
80
- "(([number|]) [minusOperator] ([number|]))",
81
- "(([number|]) [timesOperator] ([number|]))",
82
- "(([number|]) [divideByOperator|] ([number|]))",
79
+ "((number/* || mathematicalExpression/*) [plusOperator] (number/* || mathematicalExpression/*))",
80
+ "((number/* || mathematicalExpression/*) [minusOperator] (number/* || mathematicalExpression/*))",
81
+ "((number/* || mathematicalExpression/*) [timesOperator] (number/* || mathematicalExpression/*))",
82
+ "((number/* || mathematicalExpression/*) [divideByOperator|] (number/* || mathematicalExpression/*))",
83
83
  "([plusExpression|])",
84
84
  "([minusExpression|])",
85
85
  "([timesExpression|])",
@@ -91,7 +91,8 @@ const config = {
91
91
  {
92
92
  id: "mathematicalExpression",
93
93
  // isA: ['queryable', 'theAble'],
94
- isA: ['concept', 'number'],
94
+ //isA: ['concept', 'number'],
95
+ isA: ['concept'],
95
96
  },
96
97
  {
97
98
  id: "mathematical_operator",
@@ -207,6 +207,16 @@
207
207
  "hierarchyAble",
208
208
  false
209
209
  ],
210
+ [
211
+ "deletable",
212
+ "deletable",
213
+ false
214
+ ],
215
+ [
216
+ "delete",
217
+ "verb",
218
+ false
219
+ ],
210
220
  [
211
221
  "descending",
212
222
  "hierarchyAble",
@@ -517,11 +527,6 @@
517
527
  "concept",
518
528
  false
519
529
  ],
520
- [
521
- "mathematicalExpression",
522
- "number",
523
- false
524
- ],
525
530
  [
526
531
  "mathematical_operator",
527
532
  "adjective",
@@ -617,6 +622,11 @@
617
622
  "thisAble",
618
623
  false
619
624
  ],
625
+ [
626
+ "memorable",
627
+ "deletable",
628
+ false
629
+ ],
620
630
  [
621
631
  "memorable",
622
632
  "theAble",
@@ -917,6 +927,11 @@
917
927
  "theAble",
918
928
  false
919
929
  ],
930
+ [
931
+ "recall",
932
+ "verb",
933
+ false
934
+ ],
920
935
  [
921
936
  "remember",
922
937
  "verb",
@@ -1546,6 +1561,16 @@
1546
1561
  "hierarchyAble",
1547
1562
  false
1548
1563
  ],
1564
+ [
1565
+ "deletable",
1566
+ "deletable",
1567
+ false
1568
+ ],
1569
+ [
1570
+ "delete",
1571
+ "verb",
1572
+ false
1573
+ ],
1549
1574
  [
1550
1575
  "descending",
1551
1576
  "hierarchyAble",
@@ -1856,11 +1881,6 @@
1856
1881
  "concept",
1857
1882
  false
1858
1883
  ],
1859
- [
1860
- "mathematicalExpression",
1861
- "number",
1862
- false
1863
- ],
1864
1884
  [
1865
1885
  "mathematical_operator",
1866
1886
  "adjective",
@@ -1956,6 +1976,11 @@
1956
1976
  "thisAble",
1957
1977
  false
1958
1978
  ],
1979
+ [
1980
+ "memorable",
1981
+ "deletable",
1982
+ false
1983
+ ],
1959
1984
  [
1960
1985
  "memorable",
1961
1986
  "theAble",
@@ -2256,6 +2281,11 @@
2256
2281
  "theAble",
2257
2282
  false
2258
2283
  ],
2284
+ [
2285
+ "recall",
2286
+ "verb",
2287
+ false
2288
+ ],
2259
2289
  [
2260
2290
  "remember",
2261
2291
  "verb",
@@ -3069,6 +3099,16 @@
3069
3099
  "hierarchyAble",
3070
3100
  false
3071
3101
  ],
3102
+ [
3103
+ "deletable",
3104
+ "deletable",
3105
+ false
3106
+ ],
3107
+ [
3108
+ "delete",
3109
+ "verb",
3110
+ false
3111
+ ],
3072
3112
  [
3073
3113
  "descending",
3074
3114
  "hierarchyAble",
@@ -3379,11 +3419,6 @@
3379
3419
  "concept",
3380
3420
  false
3381
3421
  ],
3382
- [
3383
- "mathematicalExpression",
3384
- "number",
3385
- false
3386
- ],
3387
3422
  [
3388
3423
  "mathematical_operator",
3389
3424
  "adjective",
@@ -3479,6 +3514,11 @@
3479
3514
  "thisAble",
3480
3515
  false
3481
3516
  ],
3517
+ [
3518
+ "memorable",
3519
+ "deletable",
3520
+ false
3521
+ ],
3482
3522
  [
3483
3523
  "memorable",
3484
3524
  "theAble",
@@ -3824,6 +3864,11 @@
3824
3864
  "theAble",
3825
3865
  false
3826
3866
  ],
3867
+ [
3868
+ "recall",
3869
+ "verb",
3870
+ false
3871
+ ],
3827
3872
  [
3828
3873
  "remember",
3829
3874
  "verb",
@@ -4637,6 +4682,16 @@
4637
4682
  "hierarchyAble",
4638
4683
  false
4639
4684
  ],
4685
+ [
4686
+ "deletable",
4687
+ "deletable",
4688
+ false
4689
+ ],
4690
+ [
4691
+ "delete",
4692
+ "verb",
4693
+ false
4694
+ ],
4640
4695
  [
4641
4696
  "descending",
4642
4697
  "hierarchyAble",
@@ -4992,11 +5047,6 @@
4992
5047
  "concept",
4993
5048
  false
4994
5049
  ],
4995
- [
4996
- "mathematicalExpression",
4997
- "number",
4998
- false
4999
- ],
5000
5050
  [
5001
5051
  "mathematical_operator",
5002
5052
  "adjective",
@@ -5092,6 +5142,11 @@
5092
5142
  "thisAble",
5093
5143
  false
5094
5144
  ],
5145
+ [
5146
+ "memorable",
5147
+ "deletable",
5148
+ false
5149
+ ],
5095
5150
  [
5096
5151
  "memorable",
5097
5152
  "theAble",
@@ -5437,6 +5492,11 @@
5437
5492
  "theAble",
5438
5493
  false
5439
5494
  ],
5495
+ [
5496
+ "recall",
5497
+ "verb",
5498
+ false
5499
+ ],
5440
5500
  [
5441
5501
  "remember",
5442
5502
  "verb",
@@ -6161,6 +6221,16 @@
6161
6221
  "hierarchyAble",
6162
6222
  false
6163
6223
  ],
6224
+ [
6225
+ "deletable",
6226
+ "deletable",
6227
+ false
6228
+ ],
6229
+ [
6230
+ "delete",
6231
+ "verb",
6232
+ false
6233
+ ],
6164
6234
  [
6165
6235
  "descending",
6166
6236
  "hierarchyAble",
@@ -6521,11 +6591,6 @@
6521
6591
  "concept",
6522
6592
  false
6523
6593
  ],
6524
- [
6525
- "mathematicalExpression",
6526
- "number",
6527
- false
6528
- ],
6529
6594
  [
6530
6595
  "mathematical_operator",
6531
6596
  "adjective",
@@ -6621,6 +6686,11 @@
6621
6686
  "thisAble",
6622
6687
  false
6623
6688
  ],
6689
+ [
6690
+ "memorable",
6691
+ "deletable",
6692
+ false
6693
+ ],
6624
6694
  [
6625
6695
  "memorable",
6626
6696
  "theAble",
@@ -7021,6 +7091,11 @@
7021
7091
  "theAble",
7022
7092
  false
7023
7093
  ],
7094
+ [
7095
+ "recall",
7096
+ "verb",
7097
+ false
7098
+ ],
7024
7099
  [
7025
7100
  "remember",
7026
7101
  "verb",
@@ -8148,6 +8223,16 @@
8148
8223
  "hierarchyAble",
8149
8224
  false
8150
8225
  ],
8226
+ [
8227
+ "deletable",
8228
+ "deletable",
8229
+ false
8230
+ ],
8231
+ [
8232
+ "delete",
8233
+ "verb",
8234
+ false
8235
+ ],
8151
8236
  [
8152
8237
  "descending",
8153
8238
  "hierarchyAble",
@@ -8508,11 +8593,6 @@
8508
8593
  "concept",
8509
8594
  false
8510
8595
  ],
8511
- [
8512
- "mathematicalExpression",
8513
- "number",
8514
- false
8515
- ],
8516
8596
  [
8517
8597
  "mathematical_operator",
8518
8598
  "adjective",
@@ -8608,6 +8688,11 @@
8608
8688
  "thisAble",
8609
8689
  false
8610
8690
  ],
8691
+ [
8692
+ "memorable",
8693
+ "deletable",
8694
+ false
8695
+ ],
8611
8696
  [
8612
8697
  "memorable",
8613
8698
  "theAble",
@@ -9018,6 +9103,11 @@
9018
9103
  "theAble",
9019
9104
  false
9020
9105
  ],
9106
+ [
9107
+ "recall",
9108
+ "verb",
9109
+ false
9110
+ ],
9021
9111
  [
9022
9112
  "remember",
9023
9113
  "verb",
@@ -9599,6 +9689,16 @@
9599
9689
  "hierarchyAble",
9600
9690
  false
9601
9691
  ],
9692
+ [
9693
+ "deletable",
9694
+ "deletable",
9695
+ false
9696
+ ],
9697
+ [
9698
+ "delete",
9699
+ "verb",
9700
+ false
9701
+ ],
9602
9702
  [
9603
9703
  "descending",
9604
9704
  "hierarchyAble",
@@ -9959,11 +10059,6 @@
9959
10059
  "concept",
9960
10060
  false
9961
10061
  ],
9962
- [
9963
- "mathematicalExpression",
9964
- "number",
9965
- false
9966
- ],
9967
10062
  [
9968
10063
  "mathematical_operator",
9969
10064
  "adjective",
@@ -10059,6 +10154,11 @@
10059
10154
  "thisAble",
10060
10155
  false
10061
10156
  ],
10157
+ [
10158
+ "memorable",
10159
+ "deletable",
10160
+ false
10161
+ ],
10062
10162
  [
10063
10163
  "memorable",
10064
10164
  "theAble",
@@ -10469,6 +10569,11 @@
10469
10569
  "theAble",
10470
10570
  false
10471
10571
  ],
10572
+ [
10573
+ "recall",
10574
+ "verb",
10575
+ false
10576
+ ],
10472
10577
  [
10473
10578
  "remember",
10474
10579
  "verb",
package/common/meta.js CHANGED
@@ -254,7 +254,7 @@ const config = {
254
254
  valuesPrime.push(valuePrime)
255
255
  }
256
256
  }
257
- response = { marker: 'list', truthValue: valuesPrime.length > 0, value: unflatten(valuesPrime, context.flatten || []) }
257
+ response = { marker: 'list', listable: true, truthValue: valuesPrime.length > 0, value: unflatten(valuesPrime, context.flatten || []) }
258
258
  } else {
259
259
  const toPrime = toPrimes[0][0]
260
260
  response = toPrime.evalue
@@ -19,12 +19,12 @@ class API {
19
19
  context.namespaced.nameable ??= {}
20
20
  context.namespaced.nameable.names ??= []
21
21
  context.namespaced.nameable.names.push(name)
22
- this.args.config.addWord(name, { id: context.marker, initial: `{ value: "${name}", pullFromContext: true, nameable_named: true }` })
22
+ this.args.config.addWord(name, { id: context.marker, initial: `{ value: "${name}", pullFromContext: true, nameable_named: true, instance: ${context.instance ? 'true' : 'false'} }` })
23
23
  }
24
24
 
25
25
  // used by mongo km
26
26
  get(type, name) {
27
- return this.args.kms.stm.api.mentions({
27
+ return this.args.kms.stm.api.recall({
28
28
  context: type,
29
29
  condition: (context) => {
30
30
  if (context.namespaced?.nameable && context.namespaced.nameable.names) {
@@ -54,16 +54,16 @@ class API {
54
54
  setCurrent(name) {
55
55
  const context = this.objects.named[name]
56
56
  if (context) {
57
- this.args.km('stm').api.mentioned({ context })
57
+ this.args.km('stm').api.remember({ context })
58
58
  }
59
59
  }
60
60
  }
61
61
 
62
62
  function initializer({config}) {
63
- config.addArgs(({kms, mentioned}) => {
63
+ config.addArgs(({kms, remember}) => {
64
64
  return {
65
- mentioned: (args) => {
66
- mentioned(args)
65
+ remember: (args) => {
66
+ remember(args)
67
67
  if (args.name) {
68
68
  kms.nameable.api.setName(args.context, args.name)
69
69
  }
@@ -124,8 +124,6 @@ const config = {
124
124
  `,
125
125
  // generatorp: async ({context, g, gs}) => `call ${await g(context.nameable)} ${await gs(context.name)}`,
126
126
  semantic: async ({config, context, api, e, verbatim, g}) => {
127
- // TODO find report being referred to
128
- // debugger
129
127
  const nameable = (await e(context.nameable))?.evalue
130
128
  if (!nameable) {
131
129
  verbatim(`${await g(context.nameable)} is not known`)
@@ -158,7 +156,7 @@ const config = {
158
156
  semantics: [
159
157
  {
160
158
  where: where(),
161
- match: ({context}) => context.marker == 'mentions' && context.evaluate && context.args.context.nameable_named,
159
+ match: ({context}) => context.marker == 'mentions' && context.evaluate && context.args?.context?.nameable_named,
162
160
  apply: async ({callId, _continue, toList, context, kms, e, log, retry}) => {
163
161
  context.args.condition ??= () => true
164
162
  const oldCondition = context.args.condition