tpmkms 9.5.0 → 9.5.1-beta.10

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 (83) hide show
  1. package/common/animals.instance.json +21 -61
  2. package/common/asking.js +106 -104
  3. package/common/can.instance.json +17 -0
  4. package/common/can.js +188 -0
  5. package/common/characters.js +5 -5
  6. package/common/colors.instance.json +38 -10
  7. package/common/comparable.instance.json +2 -2
  8. package/common/concept.test.json +54 -40
  9. package/common/conjunction.js +13 -5
  10. package/common/crew.instance.json +71 -85
  11. package/common/crew.js +1 -1
  12. package/common/crew.test.json +4148 -3324
  13. package/common/currency.js +1 -1
  14. package/common/dates.instance.json +87 -3
  15. package/common/dialogues.js +12 -9
  16. package/common/dimension.instance.json +9 -9
  17. package/common/dimension.js +4 -4
  18. package/common/edible.instance.json +79 -23
  19. package/common/emotions.instance.json +29 -7
  20. package/common/emotions.js +1 -1
  21. package/common/emotions.test.json +242 -174
  22. package/common/english_helpers.js +336 -0
  23. package/common/errors.js +3 -3
  24. package/common/evaluate.js +2 -2
  25. package/common/events.js +8 -8
  26. package/common/fastfood.instance.json +205 -553
  27. package/common/fastfood.js +4 -4
  28. package/common/formulas.instance.json +1 -1
  29. package/common/formulas.js +1 -1
  30. package/common/gdefaults.js +58 -9
  31. package/common/help.js +3 -3
  32. package/common/helpers/concept.js +1 -1
  33. package/common/helpers/conjunction.js +54 -44
  34. package/common/helpers/dateTimeSelectors.js +2 -2
  35. package/common/helpers/dialogues.js +1 -1
  36. package/common/helpers/formulas.js +13 -11
  37. package/common/helpers/menus.js +12 -12
  38. package/common/helpers/meta.js +9 -9
  39. package/common/helpers/properties.js +158 -55
  40. package/common/helpers.js +135 -46
  41. package/common/hierarchy.js +3 -3
  42. package/common/kirk.instance.json +1 -1
  43. package/common/latin.instance.json +2 -2
  44. package/common/latin.js +4 -4
  45. package/common/length.instance.json +2 -2
  46. package/common/listener.js +1 -1
  47. package/common/math.instance.json +28 -28
  48. package/common/math.js +47 -46
  49. package/common/menus.instance.json +3 -3
  50. package/common/menus.js +1 -1
  51. package/common/meta.js +76 -60
  52. package/common/nameable.js +7 -7
  53. package/common/ordering.instance.json +85 -19
  54. package/common/ordering.js +1 -1
  55. package/common/ordering.test.json +786 -298
  56. package/common/people.instance.json +59 -56
  57. package/common/people.js +6 -4
  58. package/common/people.test.json +4135 -3606
  59. package/common/pipboy.instance.json +72 -16
  60. package/common/pipboy.js +2 -3
  61. package/common/pokemon.instance.json +8 -8
  62. package/common/pokemon.js +1 -1
  63. package/common/pressure.instance.json +2 -2
  64. package/common/properties.instance.json +1 -1
  65. package/common/properties.js +22 -4
  66. package/common/reminders.instance.json +4 -4
  67. package/common/reminders.js +3 -3
  68. package/common/reports.instance.json +3 -3
  69. package/common/reports.js +18 -16
  70. package/common/scorekeeper.js +6 -6
  71. package/common/sdefaults.js +22 -2
  72. package/common/spock.instance.json +1 -1
  73. package/common/stgame.js +1 -1
  74. package/common/stm.js +4 -4
  75. package/common/tell.js +1 -1
  76. package/common/temperature.instance.json +2 -2
  77. package/common/tester.js +3 -3
  78. package/common/time.js +3 -3
  79. package/common/tokenize.js +5 -2
  80. package/common/weight.instance.json +2 -2
  81. package/common/wp.instance.json +136 -8
  82. package/common/wp.js +4 -4
  83. package/package.json +6 -2
@@ -1,5 +1,5 @@
1
1
  const { flatten, knowledgeModule, where, debug } = require('./runtime').theprogrammablemind
2
- const { defaultContextCheck } = require('./helpers')
2
+ const { defaultContextCheck, concats } = require('./helpers')
3
3
  const sdefaults_tests = require('./sdefaults.test.json')
4
4
 
5
5
  class API {
@@ -18,12 +18,32 @@ const config = {
18
18
  name: 'sdefaults',
19
19
  semantics: [
20
20
  {
21
- notes: 'flatten',
21
+ notes: 'flatten listable',
22
22
  where: where(),
23
23
  priority: -1,
24
24
  // match: ({context}) => context.flatten || context.listable && context.value[0].flatten,
25
25
  match: ({context}) => context.flatten || context.listable && context.value.some((value) => value.flatten),
26
26
  // match: ({context}) => context.flatten || context.listable || (Array.isArray(context.value) && context.value.some((value) => value.flatten)),
27
+ apply: async ({config, km, context, s}) => {
28
+ const [flats, wf] = flatten(['list'], context)
29
+ const evalues = []
30
+ for (const flat of flats) {
31
+ const result = await s({ ...flat, flatten: false })
32
+ if (result.evalue) {
33
+ evalues.push(result.evalue)
34
+ }
35
+ }
36
+ if (evalues.length > 0) {
37
+ context.evalue = concats(evalues)
38
+ context.isResponse = true
39
+ }
40
+ }
41
+ },
42
+ {
43
+ notes: 'flatten relation',
44
+ where: where(),
45
+ priority: -1,
46
+ match: ({context}) => context.flatten && context.relation,
27
47
  apply: async ({config, km, context, s}) => {
28
48
  const [flats, wf] = flatten(['list'], context)
29
49
  for (const flat of flats) {
@@ -1666,7 +1666,7 @@
1666
1666
  "dead": true,
1667
1667
  "range": {
1668
1668
  "start": 0,
1669
- "end": 12
1669
+ "end": 2
1670
1670
  },
1671
1671
  "types": [
1672
1672
  "self"
package/common/stgame.js CHANGED
@@ -63,7 +63,7 @@ class SpockAPI {
63
63
  }
64
64
  }
65
65
 
66
- const createCharactersHelper = async () => {
66
+ async function createCharactersHelper() {
67
67
  const characters = await createCharacters()
68
68
  const kirk = await createKirk()
69
69
  const spock = await createSpock()
package/common/stm.js CHANGED
@@ -74,7 +74,7 @@ class API {
74
74
 
75
75
  const findPrevious = !!context.stm_previous
76
76
  const forAll = []
77
- const addForAll = (context) => {
77
+ function addForAll(context) {
78
78
  if (!forAll.find( (c) => c.stm.id == context.stm.id)) {
79
79
  forAll.push(context)
80
80
  }
@@ -189,8 +189,8 @@ const config = {
189
189
  ],
190
190
  words: {
191
191
  literals: {
192
- "m1": [{"id": "memorable", development: true, "initial": "{ value: 'm1' }" }],
193
- "m2": [{"id": "memorable", development: true, "initial": "{ value: 'm2' }" }],
192
+ "m1": [{"id": "memorable", scope: "testing", "initial": "{ value: 'm1' }" }],
193
+ "m2": [{"id": "memorable", scope: "testing", "initial": "{ value: 'm2' }" }],
194
194
  },
195
195
  },
196
196
  bridges: [
@@ -247,7 +247,7 @@ const config = {
247
247
  ],
248
248
  }
249
249
 
250
- const initializer = ({config}) => {
250
+ function initializer({config}) {
251
251
  config.addArgs(({kms}) => ({
252
252
  mentioned: (args) => {
253
253
  kms.stm.api.mentioned(args)
package/common/tell.js CHANGED
@@ -98,7 +98,7 @@ const config = {
98
98
  ],
99
99
  };
100
100
 
101
- const initializer = ({config, isModule}) => {
101
+ function initializer({config, isModule}) {
102
102
  if (!isModule) {
103
103
  config.addSemantic({
104
104
  match: ({context, hierarchy}) => context.happening && hierarchy.isA(context.marker, 'event'),
@@ -1112,7 +1112,7 @@
1112
1112
  "word": "temperature",
1113
1113
  "range": {
1114
1114
  "start": 0,
1115
- "end": 25
1115
+ "end": 10
1116
1116
  },
1117
1117
  "dead": true,
1118
1118
  "types": [
@@ -2719,7 +2719,7 @@
2719
2719
  "text": "celcius fahrenheit and kelvin",
2720
2720
  "range": {
2721
2721
  "start": 0,
2722
- "end": 53
2722
+ "end": 28
2723
2723
  },
2724
2724
  "types": [
2725
2725
  "list",
package/common/tester.js CHANGED
@@ -2,7 +2,7 @@ const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
2
  const tester_tests = require('./tester.test.json')
3
3
  const ArgumentParser = require('argparse').ArgumentParser
4
4
 
5
- const testModuleNameFn = () => {
5
+ function testModuleNameFn() {
6
6
  const parser = new ArgumentParser({ description: 'Get test module name' })
7
7
  parser.add_argument('-tmn', '--testModuleName', { help: 'List of module to run the tests from' })
8
8
  const [args, unknown] = parser.parse_known_args()
@@ -18,7 +18,7 @@ parser.add_argument('-m', '--modules', { help: 'List of modules to load' })
18
18
  const [args, unknown] = parser.parse_known_args()
19
19
  process.argv = [process.argv[0], process.argv[1], ...unknown]
20
20
 
21
- const createConfig = async () => {
21
+ async function createConfig() {
22
22
  const config = new Config({ name: 'tester' })
23
23
  global.theprogrammablemind = {
24
24
  loadForTesting: {}
@@ -42,7 +42,7 @@ const includes = args.modules.split(',').map((module) => {
42
42
  return km
43
43
  })
44
44
 
45
- const fixtures = async (args) => {
45
+ async function fixtures(args) {
46
46
  const { config, kms, apis } = args;
47
47
  if (kms[testModuleName].testConfig?.fixtures) {
48
48
  const fixtures = kms.menus.testConfig?.fixtures
package/common/time.js CHANGED
@@ -6,7 +6,7 @@ const numbers = require('./numbers')
6
6
  const helpers = require('./helpers')
7
7
  const time_tests = require('./time.test.json')
8
8
 
9
- const pad = (v, l) => {
9
+ function pad(v, l) {
10
10
  const s = String(v)
11
11
  const n = l - s.length
12
12
  return "0".repeat(n) + s
@@ -141,7 +141,7 @@ const config = {
141
141
  where: where(),
142
142
  match: ({context}) => context.marker == 'time' && context.evalue && context.format == 24,
143
143
  apply: ({g, context}) => {
144
- const pad = (num, size) => {
144
+ function pad(num, size) {
145
145
  num = num.toString();
146
146
  while (num.length < size) num = "0" + num;
147
147
  return num;
@@ -187,7 +187,7 @@ const config = {
187
187
  ],
188
188
  };
189
189
 
190
- const initializer = ({api, config, objects, kms, isModule}) => {
190
+ function initializer({api, config, objects, kms, isModule}) {
191
191
  if (!isModule) {
192
192
  kms.time.api.newDate = () => new Date("December 25, 1995 1:59:58 pm" )
193
193
  }
@@ -44,7 +44,7 @@ const config = {
44
44
  },
45
45
  };
46
46
 
47
- const initializer = ({objects, config, isModule}) => {
47
+ function initializer({objects, config, isModule}) {
48
48
  config.addArgs(
49
49
  ({addPattern}) => ({
50
50
  addSuffix: (suffix) => {
@@ -69,7 +69,10 @@ knowledgeModule( {
69
69
  name: './tokenize.test.json',
70
70
  contents: tokenize_tests,
71
71
  checks: {
72
- context: [defaultContextCheck()],
72
+ context: [
73
+ defaultContextCheck({ marker: 'unknown', exported: true, extra: ['marker', 'text', 'value'] }),
74
+ defaultContextCheck(),
75
+ ],
73
76
  },
74
77
  },
75
78
  })
@@ -2510,7 +2510,7 @@
2510
2510
  "word": "weight",
2511
2511
  "range": {
2512
2512
  "start": 0,
2513
- "end": 20
2513
+ "end": 5
2514
2514
  },
2515
2515
  "dead": true,
2516
2516
  "types": [
@@ -4464,7 +4464,7 @@
4464
4464
  "text": "kilograms grams pounds (troy ounces) ounces and tons",
4465
4465
  "range": {
4466
4466
  "start": 0,
4467
- "end": 71
4467
+ "end": 51
4468
4468
  },
4469
4469
  "types": [
4470
4470
  "list",
@@ -27,6 +27,42 @@
27
27
  ],
28
28
  "associations": {
29
29
  "positive": [
30
+ {
31
+ "context": [
32
+ [
33
+ "style_wp",
34
+ 0
35
+ ],
36
+ [
37
+ "the",
38
+ 0
39
+ ],
40
+ [
41
+ "letter_wp",
42
+ 0
43
+ ],
44
+ [
45
+ "statefulElementInContext_wp",
46
+ 0
47
+ ],
48
+ [
49
+ "the",
50
+ 0
51
+ ],
52
+ [
53
+ "ordinal",
54
+ 1
55
+ ],
56
+ [
57
+ "paragraph_wp",
58
+ 0
59
+ ]
60
+ ],
61
+ "choose": {
62
+ "index": 0,
63
+ "increment": true
64
+ }
65
+ },
30
66
  {
31
67
  "context": [
32
68
  [
@@ -6541,7 +6577,7 @@
6541
6577
  "word": "words",
6542
6578
  "range": {
6543
6579
  "start": 0,
6544
- "end": 78
6580
+ "end": 4
6545
6581
  },
6546
6582
  "dead": true,
6547
6583
  "types": [
@@ -10321,7 +10357,7 @@
10321
10357
  "word": "characters",
10322
10358
  "range": {
10323
10359
  "start": 0,
10324
- "end": 68
10360
+ "end": 9
10325
10361
  },
10326
10362
  "dead": true,
10327
10363
  "types": [
@@ -13923,7 +13959,7 @@
13923
13959
  "word": "paragraphs",
13924
13960
  "range": {
13925
13961
  "start": 0,
13926
- "end": 82
13962
+ "end": 9
13927
13963
  },
13928
13964
  "dead": true,
13929
13965
  "types": [
@@ -17692,7 +17728,7 @@
17692
17728
  "word": "text",
17693
17729
  "range": {
17694
17730
  "start": 0,
17695
- "end": 24
17731
+ "end": 3
17696
17732
  },
17697
17733
  "dead": true,
17698
17734
  "types": [
@@ -24624,7 +24660,7 @@
24624
24660
  "text": "bold, italic, code, capitalize, lowercase and underline",
24625
24661
  "range": {
24626
24662
  "start": 0,
24627
- "end": 65
24663
+ "end": 54
24628
24664
  },
24629
24665
  "types": [
24630
24666
  "list",
@@ -24867,6 +24903,20 @@
24867
24903
  0
24868
24904
  ]
24869
24905
  ],
24906
+ [
24907
+ [
24908
+ "is",
24909
+ 0
24910
+ ],
24911
+ [
24912
+ "list",
24913
+ 1
24914
+ ],
24915
+ [
24916
+ "unknown",
24917
+ 0
24918
+ ]
24919
+ ],
24870
24920
  [
24871
24921
  [
24872
24922
  "is",
@@ -47982,7 +48032,7 @@
47982
48032
  "text": "uppercased, lowercased, capitalized, bolded, italicized and underlined",
47983
48033
  "range": {
47984
48034
  "start": 0,
47985
- "end": 88
48035
+ "end": 69
47986
48036
  },
47987
48037
  "types": [
47988
48038
  "capitalized_wp",
@@ -48257,6 +48307,20 @@
48257
48307
  0
48258
48308
  ]
48259
48309
  ],
48310
+ [
48311
+ [
48312
+ "is",
48313
+ 0
48314
+ ],
48315
+ [
48316
+ "list",
48317
+ 1
48318
+ ],
48319
+ [
48320
+ "unknown",
48321
+ 0
48322
+ ]
48323
+ ],
48260
48324
  [
48261
48325
  [
48262
48326
  "is",
@@ -53465,6 +53529,42 @@
53465
53529
  ],
53466
53530
  "associations": {
53467
53531
  "positive": [
53532
+ {
53533
+ "context": [
53534
+ [
53535
+ "style_wp",
53536
+ 0
53537
+ ],
53538
+ [
53539
+ "the",
53540
+ 0
53541
+ ],
53542
+ [
53543
+ "letter_wp",
53544
+ 0
53545
+ ],
53546
+ [
53547
+ "statefulElementInContext_wp",
53548
+ 0
53549
+ ],
53550
+ [
53551
+ "the",
53552
+ 0
53553
+ ],
53554
+ [
53555
+ "ordinal",
53556
+ 1
53557
+ ],
53558
+ [
53559
+ "paragraph_wp",
53560
+ 0
53561
+ ]
53562
+ ],
53563
+ "choose": {
53564
+ "index": 0,
53565
+ "increment": true
53566
+ }
53567
+ },
53468
53568
  {
53469
53569
  "context": [
53470
53570
  [
@@ -54155,10 +54255,10 @@
54155
54255
  ],
54156
54256
  "semantics": [
54157
54257
  {
54158
- "where": "/home/dev/code/theprogrammablemind/kms/common/wp.js:393"
54258
+ "where": "/home/dev/code/theprogrammablemind/kms/common/wp.js:395"
54159
54259
  },
54160
54260
  {
54161
- "where": "/home/dev/code/theprogrammablemind/kms/common/wp.js:402"
54261
+ "where": "/home/dev/code/theprogrammablemind/kms/common/wp.js:404"
54162
54262
  }
54163
54263
  ],
54164
54264
  "priorities": [
@@ -54931,6 +55031,34 @@
54931
55031
  0
54932
55032
  ]
54933
55033
  ],
55034
+ [
55035
+ [
55036
+ "is",
55037
+ 0
55038
+ ],
55039
+ [
55040
+ "list",
55041
+ 1
55042
+ ],
55043
+ [
55044
+ "unknown",
55045
+ 0
55046
+ ]
55047
+ ],
55048
+ [
55049
+ [
55050
+ "is",
55051
+ 0
55052
+ ],
55053
+ [
55054
+ "list",
55055
+ 1
55056
+ ],
55057
+ [
55058
+ "unknown",
55059
+ 0
55060
+ ]
55061
+ ],
54934
55062
  [
54935
55063
  [
54936
55064
  "is",
package/common/wp.js CHANGED
@@ -115,11 +115,11 @@ class API {
115
115
  }
116
116
  }
117
117
 
118
- const root = (id) => {
118
+ function root(id) {
119
119
  return id.split('_')[0]
120
120
  }
121
121
 
122
- const setUpdate = (isA, update, states) => {
122
+ function setUpdate(isA, update, states) {
123
123
  let color;
124
124
  const styles = []
125
125
  for (const state of states) {
@@ -146,10 +146,10 @@ const config = {
146
146
  name: 'wp',
147
147
  };
148
148
 
149
- const changeState = ({api, isA, context, toArray, element, state}) => {
149
+ function changeState({api, isA, context, toArray, element, state}) {
150
150
  let scope
151
151
 
152
- const getElement = (selector, update) => {
152
+ function getElement(selector, update) {
153
153
  const unit = root(selector.marker)
154
154
  const conditions = []
155
155
  let scope;
package/package.json CHANGED
@@ -162,6 +162,8 @@
162
162
  "common/asking.test.json",
163
163
  "common/avatar.js",
164
164
  "common/avatar.test.json",
165
+ "common/can.instance.json",
166
+ "common/can.js",
165
167
  "common/characters.js",
166
168
  "common/characters.test.json",
167
169
  "common/colors.instance.json",
@@ -200,6 +202,7 @@
200
202
  "common/emotions.instance.json",
201
203
  "common/emotions.js",
202
204
  "common/emotions.test.json",
205
+ "common/english_helpers.js",
203
206
  "common/errors.js",
204
207
  "common/errors.test.json",
205
208
  "common/evaluate.instance.json",
@@ -344,6 +347,7 @@
344
347
  "dependencies": {
345
348
  "argparse": "^2.0.1",
346
349
  "base-64": "^1.0.0",
350
+ "bluebird": "^3.7.2",
347
351
  "deep-equal": "^2.0.5",
348
352
  "lodash": "^4.17.21",
349
353
  "node-fetch": "^2.6.1",
@@ -352,8 +356,8 @@
352
356
  "scriptjs": "^2.5.9",
353
357
  "table": "^6.7.1",
354
358
  "uuid": "^9.0.0",
355
- "theprogrammablemind": "9.5.0"
359
+ "theprogrammablemind": "9.5.1-beta.10"
356
360
  },
357
- "version": "9.5.0",
361
+ "version": "9.5.1-beta.10",
358
362
  "license": "UNLICENSED"
359
363
  }