tpmkms_4wp 8.0.0-beta.20 → 8.0.0-beta.22

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 (70) hide show
  1. package/common/animals.instance.json +0 -88
  2. package/common/animals.js +2 -2
  3. package/common/avatar.js +2 -2
  4. package/common/characters.js +12 -16
  5. package/common/colors.instance.json +0 -344
  6. package/common/colors.js +2 -2
  7. package/common/comparable.js +2 -15
  8. package/common/concept.js +13 -10
  9. package/common/countable.js +5 -5
  10. package/common/crew.instance.json +0 -416
  11. package/common/crew.js +4 -4
  12. package/common/currency.js +7 -7
  13. package/common/dialogues.js +52 -121
  14. package/common/dimension.instance.json +4 -4
  15. package/common/dimension.js +12 -12
  16. package/common/dimension.test.json +242 -1248
  17. package/common/edible.instance.json +30 -134
  18. package/common/edible.js +2 -2
  19. package/common/emotions.instance.json +0 -60
  20. package/common/emotions.js +4 -4
  21. package/common/events.js +6 -6
  22. package/common/fastfood.instance.json +929 -1408
  23. package/common/fastfood.js +24 -24
  24. package/common/formulas.instance.json +6 -6
  25. package/common/formulas.js +12 -12
  26. package/common/gdefaults.js +13 -13
  27. package/common/help.js +4 -4
  28. package/common/helpers/concept.js +0 -1
  29. package/common/helpers/dialogues.js +2 -3
  30. package/common/helpers/properties.js +48 -58
  31. package/common/hierarchy.js +12 -16
  32. package/common/javascript.js +8 -8
  33. package/common/kirk.js +2 -2
  34. package/common/length.instance.json +0 -60
  35. package/common/length.js +2 -2
  36. package/common/math.instance.json +12 -12
  37. package/common/math.js +7 -7
  38. package/common/meta.js +22 -29
  39. package/common/negation.js +1 -1
  40. package/common/numbers.js +2 -2
  41. package/common/ordering.js +5 -5
  42. package/common/people.js +4 -5
  43. package/common/percentages.js +4 -4
  44. package/common/pipboy.instance.json +30 -154
  45. package/common/pipboy.js +29 -32
  46. package/common/pokemon.instance.json +0 -44
  47. package/common/pokemon.js +4 -4
  48. package/common/pos.js +1 -1
  49. package/common/pressure.js +2 -2
  50. package/common/properties.js +52 -125
  51. package/common/punctuation.js +2 -2
  52. package/common/reports.instance.json +1 -1
  53. package/common/reports.js +59 -76
  54. package/common/scorekeeper.js +13 -21
  55. package/common/sdefaults.js +5 -5
  56. package/common/sizeable.js +2 -2
  57. package/common/spock.js +2 -2
  58. package/common/stgame.js +13 -9
  59. package/common/stm.js +4 -4
  60. package/common/tell.js +10 -10
  61. package/common/temperature.instance.json +0 -60
  62. package/common/temperature.js +2 -2
  63. package/common/tester.js +2 -2
  64. package/common/testing.js +5 -5
  65. package/common/time.js +7 -7
  66. package/common/tokenize.js +1 -1
  67. package/common/ui.js +9 -9
  68. package/common/weight.js +2 -2
  69. package/common/yesno.js +1 -1
  70. package/package.json +2 -2
@@ -61,7 +61,7 @@ let configStruct = {
61
61
  notes: 'what type is pikachu',
62
62
  where: where(),
63
63
  match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'is') && context.query && !['what'].includes(context.one.marker) && !['what'].includes(context.two.marker) && (context.one.query || context.two.query),
64
- apply: ({context, hierarchy, km, log, e, s}) => {
64
+ apply: async ({context, hierarchy, km, log, e}) => {
65
65
  const one = context.one;
66
66
  const two = context.two;
67
67
  let concept, value;
@@ -72,7 +72,7 @@ let configStruct = {
72
72
  concept = two;
73
73
  value = one;
74
74
  }
75
- let instance = e(value)
75
+ let instance = await e(value)
76
76
  if (instance.verbatim) {
77
77
  context.evalue = { verbatim: instance.verbatim }
78
78
  context.isResponse = true
@@ -80,9 +80,6 @@ let configStruct = {
80
80
  }
81
81
  instance = getTypes(km, concept, instance)
82
82
 
83
- // instance.focusable = ['one', 'two']
84
- // concept = JSON.parse(JSON.stringify(value))
85
- // greg
86
83
  concept = _.cloneDeep(value)
87
84
  concept.isQuery = undefined
88
85
 
@@ -106,10 +103,10 @@ let configStruct = {
106
103
  notes: 'type of pikachu', // the types of type is the next one
107
104
  where: where(),
108
105
  match: ({context}) => context.marker == 'type' && context.evaluate && context.object && context.objects[context.objects.length-1].number == 'one' && pluralize.isSingular(context.objects[0].word),
109
- apply: ({context, objects, e, gs, km, log, s}) => {
106
+ apply: async ({context, objects, e, gs, km, log}) => {
110
107
  const concept = context.objects[0];
111
108
  const value = context.objects[1];
112
- let instance = e(value)
109
+ let instance = await e(value)
113
110
  if (instance.verbatim) {
114
111
  context.evalue = { verbatim: instance.verbatim }
115
112
  return
@@ -135,14 +132,14 @@ let configStruct = {
135
132
  }
136
133
  return hierarchy.isA(context.marker, 'is') && context.query && args( { types: ['hierarchyAble', 'hierarchyAble'], properties: ['one', 'two'] } )
137
134
  },
138
- apply: ({context, km, objects, g}) => {
135
+ apply: async ({context, km, objects, g}) => {
139
136
  const api = km('properties').api
140
137
  const one = context.one
141
138
  const two = context.two
142
139
  const oneId = pluralize.singular(one.value);
143
140
  if (!api.conceptExists(oneId)) {
144
141
  context.evalue = {
145
- verbatim: `I don't know about ${g({ ...one, paraphrase: true})}`
142
+ verbatim: `I don't know about ${await g({ ...one, paraphrase: true})}`
146
143
  }
147
144
  context.isResponse = true
148
145
  return
@@ -150,7 +147,7 @@ let configStruct = {
150
147
  const twoId = pluralize.singular(two.value);
151
148
  if (!api.conceptExists(twoId)) {
152
149
  context.evalue = {
153
- verbatim: `I don't know about ${g({ ...two, paraphrase: true})}`
150
+ verbatim: `I don't know about ${await g({ ...two, paraphrase: true})}`
154
151
  }
155
152
  context.isResponse = true
156
153
  return
@@ -201,7 +198,6 @@ let configStruct = {
201
198
  },
202
199
  {
203
200
  notes: 'humans are mammels',
204
- // match: ({context, listable}) => listable(context, 'unknown') && context.same,
205
201
  where: where(),
206
202
  match: ({context, listable, hierarchy, isA, callId}) => {
207
203
  if (!context.same) {
@@ -270,7 +266,7 @@ let configStruct = {
270
266
  notes: 'types of type', // what are the types of animals
271
267
  where: where(),
272
268
  match: ({context}) => context.marker == 'type' && context.evaluate && context.object,
273
- apply: ({context, objects, gs, km, isA}) => {
269
+ apply: ({context, objects, km, isA}) => {
274
270
  const api = km('properties').api
275
271
  const conceptApi = km('concept').api
276
272
  const type = pluralize.singular(context.object.value);
@@ -288,16 +284,16 @@ let configStruct = {
288
284
  ]
289
285
  };
290
286
 
291
- const createConfig = () => {
287
+ const createConfig = async () => {
292
288
  const config = new Config(configStruct, module)
293
289
  config.stop_auto_rebuild()
294
- config.add(properties())
295
- config.initializer( ({apis, hierarchy}) => {
290
+ await config.add(properties)
291
+ await config.initializer( ({apis, hierarchy}) => {
296
292
  apis('stm').addIsA( (child, parent) => {
297
293
  return hierarchy.isA(child, parent)
298
294
  })
299
295
  })
300
- config.restart_auto_rebuild()
296
+ await config.restart_auto_rebuild()
301
297
  return config
302
298
  }
303
299
 
@@ -36,14 +36,14 @@ let configStruct = {
36
36
  {
37
37
  where: where(),
38
38
  match: ({context}) => context.marker == 'assignment' && context.paraphrase,
39
- apply: ({context, g}) => `let ${g(context.variable)} = ${g(context.value)}`
39
+ apply: async ({context, g}) => `let ${await g(context.variable)} = ${await g(context.value)}`
40
40
  },
41
41
  {
42
42
  where: where(),
43
43
  match: ({context}) => context.marker == 'assignment' && context.isResponse,
44
- apply: ({context, g}) => {
45
- const value = g(context.variable)
46
- return `${g(context.variable)} == ${g(context.value)}`
44
+ apply: async ({context, g}) => {
45
+ // const value = await g(context.variable)
46
+ return `${await g(context.variable)} == ${await g(context.value)}`
47
47
  }
48
48
  },
49
49
  ],
@@ -60,15 +60,15 @@ let configStruct = {
60
60
  ],
61
61
  };
62
62
 
63
- const createConfig = () => {
63
+ const createConfig = async () => {
64
64
  const config = new Config(configStruct, module)
65
65
  config.stop_auto_rebuild()
66
- config.add(dialogues())
66
+ await config.add(dialogues)
67
67
 
68
- config.initializer( ({objects, uuid}) => {
68
+ await config.initializer( ({objects, uuid}) => {
69
69
  objects.variables = {}
70
70
  })
71
- config.restart_auto_rebuild()
71
+ await config.restart_auto_rebuild()
72
72
  return config
73
73
  }
74
74
 
package/common/kirk.js CHANGED
@@ -14,9 +14,9 @@ const template = {
14
14
  // TODO what is the name of you
15
15
  // TODO crew members -> who are the crew members
16
16
 
17
- const createConfig = () => {
17
+ const createConfig = async () => {
18
18
  const config = new Config({ name: 'kirk', }, module)
19
- config.add(crew())
19
+ await config.add(crew)
20
20
  return config
21
21
  }
22
22
 
@@ -2265,36 +2265,6 @@
2265
2265
  1
2266
2266
  ]
2267
2267
  ],
2268
- [
2269
- [
2270
- "is",
2271
- 0
2272
- ],
2273
- [
2274
- "length",
2275
- 0
2276
- ],
2277
- [
2278
- "list",
2279
- 0
2280
- ],
2281
- [
2282
- "propertyOf",
2283
- 0
2284
- ],
2285
- [
2286
- "unit",
2287
- 0
2288
- ],
2289
- [
2290
- "unknown",
2291
- 0
2292
- ],
2293
- [
2294
- "unknown",
2295
- 1
2296
- ]
2297
- ],
2298
2268
  [
2299
2269
  [
2300
2270
  "is",
@@ -18711,36 +18681,6 @@
18711
18681
  1
18712
18682
  ]
18713
18683
  ],
18714
- [
18715
- [
18716
- "is",
18717
- 0
18718
- ],
18719
- [
18720
- "length",
18721
- 0
18722
- ],
18723
- [
18724
- "list",
18725
- 0
18726
- ],
18727
- [
18728
- "propertyOf",
18729
- 0
18730
- ],
18731
- [
18732
- "unit",
18733
- 0
18734
- ],
18735
- [
18736
- "unknown",
18737
- 0
18738
- ],
18739
- [
18740
- "unknown",
18741
- 1
18742
- ]
18743
- ],
18744
18684
  [
18745
18685
  [
18746
18686
  "is",
package/common/length.js CHANGED
@@ -36,9 +36,9 @@ const template = {
36
36
  ],
37
37
  }
38
38
 
39
- const createConfig = () => {
39
+ const createConfig = async () => {
40
40
  const config = new Config({ name: 'length' }, module)
41
- config.add(dimension())
41
+ await config.add(dimension)
42
42
  return config
43
43
  }
44
44
 
@@ -77,7 +77,7 @@
77
77
  "plus",
78
78
  "+"
79
79
  ],
80
- "generatorp": "({gp, context}) => context.word"
80
+ "generatorp": "({context}) => context.word"
81
81
  },
82
82
  {
83
83
  "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44",
@@ -87,8 +87,8 @@
87
87
  "isA": [
88
88
  "mathematicalExpression"
89
89
  ],
90
- "generatorp": "({gp, context}) => `${gp(context.x)} ${context.word} ${gp(context.y)}`",
91
- "evaluator": "({e, context}) => {\n const x = toValue(e(context.x)) \n const y = toValue(e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
90
+ "generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`",
91
+ "evaluator": "async ({e, context}) => {\n const x = toValue(await e(context.x)) \n const y = toValue(await e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
92
92
  },
93
93
  {
94
94
  "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32",
@@ -109,7 +109,7 @@
109
109
  "minus",
110
110
  "-"
111
111
  ],
112
- "generatorp": "({gp, context}) => context.word"
112
+ "generatorp": "({context}) => context.word"
113
113
  },
114
114
  {
115
115
  "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44",
@@ -119,8 +119,8 @@
119
119
  "isA": [
120
120
  "mathematicalExpression"
121
121
  ],
122
- "generatorp": "({gp, context}) => `${gp(context.x)} ${context.word} ${gp(context.y)}`",
123
- "evaluator": "({e, context}) => {\n const x = toValue(e(context.x)) \n const y = toValue(e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
122
+ "generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`",
123
+ "evaluator": "async ({e, context}) => {\n const x = toValue(await e(context.x)) \n const y = toValue(await e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
124
124
  },
125
125
  {
126
126
  "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32",
@@ -150,7 +150,7 @@
150
150
  "times",
151
151
  "*"
152
152
  ],
153
- "generatorp": "({gp, context}) => context.word"
153
+ "generatorp": "({context}) => context.word"
154
154
  },
155
155
  {
156
156
  "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44",
@@ -160,8 +160,8 @@
160
160
  "isA": [
161
161
  "mathematicalExpression"
162
162
  ],
163
- "generatorp": "({gp, context}) => `${gp(context.x)} ${context.word} ${gp(context.y)}`",
164
- "evaluator": "({e, context}) => {\n const x = toValue(e(context.x)) \n const y = toValue(e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
163
+ "generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`",
164
+ "evaluator": "async ({e, context}) => {\n const x = toValue(await e(context.x)) \n const y = toValue(await e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
165
165
  },
166
166
  {
167
167
  "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32",
@@ -190,7 +190,7 @@
190
190
  "words": [
191
191
  "/"
192
192
  ],
193
- "generatorp": "({gp, context}) => context.word"
193
+ "generatorp": "({context}) => context.word"
194
194
  },
195
195
  {
196
196
  "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44",
@@ -200,8 +200,8 @@
200
200
  "isA": [
201
201
  "mathematicalExpression"
202
202
  ],
203
- "generatorp": "({gp, context}) => `${gp(context.x)} ${context.word} ${gp(context.y)}`",
204
- "evaluator": "({e, context}) => {\n const x = toValue(e(context.x)) \n const y = toValue(e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
203
+ "generatorp": "async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`",
204
+ "evaluator": "async ({e, context}) => {\n const x = toValue(await e(context.x)) \n const y = toValue(await e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
205
205
  }
206
206
  ]
207
207
  }
package/common/math.js CHANGED
@@ -38,17 +38,17 @@ const mathematicalOperator = (name, words, apply, before = []) => [
38
38
  localHierarchy: [ ['unknown', 'number'] ],
39
39
  // levelSpecificHierarchy: [[1, 'mathematicalExpression']],
40
40
  words,
41
- generatorp: ({gp, context}) => context.word,
41
+ generatorp: ({context}) => context.word,
42
42
  },
43
43
  {
44
44
  where: where(),
45
45
  id: `${name}Expression`, level: 0,
46
46
  bridge: "{ ...next(operator) }" ,
47
47
  isA: ['mathematicalExpression'],
48
- generatorp: ({gp, context}) => `${gp(context.x)} ${context.word} ${gp(context.y)}`,
49
- evaluator: ({e, context}) => {
50
- const x = toValue(e(context.x))
51
- const y = toValue(e(context.y))
48
+ generatorp: async ({gp, context}) => `${await gp(context.x)} ${context.word} ${await gp(context.y)}`,
49
+ evaluator: async ({e, context}) => {
50
+ const x = toValue(await e(context.x))
51
+ const y = toValue(await e(context.y))
52
52
  if (!x || !y) {
53
53
  // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }
54
54
  context.isResponse = false
@@ -113,9 +113,9 @@ const template = {
113
113
  ]
114
114
  }
115
115
 
116
- const createConfig = () => {
116
+ const createConfig = async () => {
117
117
  const config = new Config({ name: 'math' }, module)
118
- config.add(numbers(), dialogues(), punctuation(), countable(), comparable())
118
+ await config.add(numbers, dialogues, punctuation, countable, comparable)
119
119
  return config
120
120
  }
121
121
 
package/common/meta.js CHANGED
@@ -130,8 +130,8 @@ let configStruct = {
130
130
  {
131
131
  where: where(),
132
132
  match: ({context}) => context.marker == 'orList' && context.paraphrase,
133
- apply: ({context, gs}) => {
134
- return gs(context.value, ', ', ' or ')
133
+ apply: async ({context, gs}) => {
134
+ return await gs(context.value, ', ', ' or ')
135
135
  },
136
136
  priority: -1,
137
137
  },
@@ -139,10 +139,8 @@ let configStruct = {
139
139
  priority: -1,
140
140
  where: where(),
141
141
  match: ({context}) => context.marker == 'means' && context.paraphrase,
142
- apply: ({context, g}) => {
143
- // const before = g({ ...context.from, paraphrase: true, debug: true})
144
- const before = g({ ...context.from, paraphrase: true})
145
- return `${g({ ...context.from, paraphrase: true})} means ${g(context.to)}`
142
+ apply: async ({context, g}) => {
143
+ return `${await g({ ...context.from, paraphrase: true})} means ${await g(context.to)}`
146
144
  }
147
145
  },
148
146
  {
@@ -160,8 +158,8 @@ let configStruct = {
160
158
  {
161
159
  where: where(),
162
160
  match: ({context}) => context.marker === 'if',
163
- apply: ({context, g}) => {
164
- return `if ${g(context.antecedant)} then ${g(context.consequence)}`
161
+ apply: async ({context, g}) => {
162
+ return `if ${await g(context.antecedant)} then ${await g(context.consequence)}`
165
163
  },
166
164
  priority: -1,
167
165
  },
@@ -182,10 +180,10 @@ let configStruct = {
182
180
  {
183
181
  where: where(),
184
182
  match: ({context}) => context.marker == 'orList',
185
- apply: ({context, s}) => {
183
+ apply: async ({context, s}) => {
186
184
  const response = []
187
185
  for (const value of context.value) {
188
- response.push(s(value))
186
+ response.push(await s(value))
189
187
  }
190
188
  context.evalue = {
191
189
  marker: 'orList',
@@ -205,7 +203,7 @@ let configStruct = {
205
203
  const apply = (DEFINITIONs, DERIVED) => {
206
204
  const mappingss = translationMappings(DEFINITIONs, DERIVED)
207
205
  const invertMappings = (mappings) => mappings.map( ({ from, to }) => { return { to: from, from: to } } )
208
- return ({context, s, g, config}) => {
206
+ return async ({context, s, config}) => {
209
207
  DEFINITIONs = _.cloneDeep(DEFINITIONs)
210
208
  //const mappings = mappingss[0]
211
209
  let toPrimes = []
@@ -215,8 +213,7 @@ let configStruct = {
215
213
  }
216
214
  // next move add debug arg to s and g
217
215
  TO.query = true
218
- toPrimes.push([s(TO), mappings])
219
- // toPrime = s(TO, { debug: { apply: true } })
216
+ toPrimes.push([await s(TO), mappings])
220
217
  }
221
218
 
222
219
  let hasResponse = false
@@ -271,7 +268,7 @@ let configStruct = {
271
268
  // match: match(context),
272
269
  where: where(),
273
270
  match: match(context),
274
- apply: apply(antecedants, _.cloneDeep(context.consequence)) ,
271
+ apply: apply(antecedants, _.cloneDeep(context.consequence)),
275
272
  }
276
273
  config.addSemantic(semantic)
277
274
  }
@@ -280,17 +277,14 @@ let configStruct = {
280
277
  notes: 'from means to where from is unknown',
281
278
  where: where(),
282
279
  match: ({context}) => context.marker == 'means' && context.from.marker == 'unknown',
283
- apply: ({config, context, kms, e, isTest}) => {
280
+ apply: async ({config, context, kms, e, isTest}) => {
284
281
  if (false && isTest) {
285
282
  return
286
283
  } else if (kms.dialogues) {
287
284
  if (context.to.value) {
288
285
  kms.stm.api.setVariable(context.from.value, context.to.value)
289
286
  } else {
290
- // config.addWord(context.from.word,
291
287
  kms.dialogues.api.makeObject({ context: context.from, types: context.to.types || [], config });
292
- // kms.dialogues.api.makeObject({ context: context.from, types: [], config });
293
- // const r = e(context.to)
294
288
  kms.stm.api.setVariable(context.from.value, context.to)
295
289
  }
296
290
  }
@@ -300,17 +294,17 @@ let configStruct = {
300
294
  notes: 'x means y where x and y have known markers',
301
295
  where: where(),
302
296
  match: ({context}) => context.marker == 'means',
303
- apply: ({config, context, g}) => {
297
+ apply: async ({config, context, g}) => {
304
298
  // setup the write semantic
305
299
  {
306
300
  const matchByMarker = (defContext) => ({context}) => context.marker == defContext.from.marker && !context.query && !context.objects
307
301
  const matchByValue = (defContext) => ({context}) => context.evalue == defContext.from.value && !context.query && !context.objects
308
- const apply = (mappings, TO) => ({context, s}) => {
302
+ const apply = (mappings, TO) => async ({context, s}) => {
309
303
  TO = _.cloneDeep(TO)
310
304
  for (let { from, to } of mappings) {
311
305
  hashIndexesSet(TO, to, hashIndexesGet(context, from))
312
306
  }
313
- toPrime = s(TO)
307
+ toPrime = await s(TO)
314
308
  context.result = toPrime.result
315
309
  }
316
310
  const mappings = translationMapping(context.from, context.to)
@@ -332,7 +326,7 @@ let configStruct = {
332
326
  {
333
327
  const matchByMarker = (defContext) => ({context, uuid}) => context.marker == defContext.from.marker && (context.query || context.evaluate) && !context[`disable${uuid}`]
334
328
  const matchByValue = (defContext) => ({context, uuid}) => context.value == defContext.from.value && (context.query || context.evaluate) && !context[`disable${uuid}`]
335
- const apply = (mappings, TO) => ({uuid, context, s, g, config}) => {
329
+ const apply = (mappings, TO) => async ({uuid, context, s, g, config}) => {
336
330
  TO = _.cloneDeep(TO)
337
331
  for (let { from, to } of mappings) {
338
332
  hashIndexesSet(TO, to, hashIndexesGet(context, from))
@@ -345,8 +339,7 @@ let configStruct = {
345
339
  TO.evaluate = context.evaluate
346
340
  }
347
341
  TO[`disable${uuid}`] = true
348
- // toPrime = s(TO, { debug: { apply: true } })
349
- toPrime = s(TO)
342
+ toPrime = await s(TO)
350
343
  if (context.query) {
351
344
  if (toPrime.evalue) {
352
345
  context.evalue = toPrime.evalue
@@ -359,7 +352,7 @@ let configStruct = {
359
352
  }
360
353
  const mappings = translationMapping(context.from, context.to)
361
354
  let match = matchByMarker(context)
362
- context.metaInfo = `The mapping from from the expression being defined "${g({...context.from, paraphrase: true})}" to the definition phrase "${g({...context.to, paraphrase: true})}" is ${JSON.stringify(mappings)}`
355
+ context.metaInfo = `The mapping from from the expression being defined "${await g({...context.from, paraphrase: true})}" to the definition phrase "${await g({...context.to, paraphrase: true})}" is ${JSON.stringify(mappings)}`
363
356
  if (context.from.value) {
364
357
  match = matchByValue(context)
365
358
  }
@@ -378,12 +371,12 @@ let configStruct = {
378
371
  ],
379
372
  };
380
373
 
381
- const createConfig = () => {
374
+ const createConfig = async () => {
382
375
  const config = new Config(configStruct, module)
383
376
  config.stop_auto_rebuild()
384
- config.add(gdefaults())
377
+ await config.add(gdefaults)
385
378
 
386
- config.initializer( ({config, addGenerator, isModule}) => {
379
+ await config.initializer( ({config, addGenerator, isModule}) => {
387
380
  if (!isModule) {
388
381
  addGenerator({
389
382
  where: where(),
@@ -393,7 +386,7 @@ const createConfig = () => {
393
386
  }
394
387
  })
395
388
 
396
- config.restart_auto_rebuild()
389
+ await config.restart_auto_rebuild()
397
390
  return config
398
391
  }
399
392
 
@@ -21,7 +21,7 @@ let configStruct = {
21
21
  ],
22
22
  };
23
23
 
24
- const createConfig = () => new Config(configStruct, module).add(gdefaults(), pos())
24
+ const createConfig = async () => new Config(configStruct, module).add(gdefaults, pos)
25
25
 
26
26
  knowledgeModule( {
27
27
  module,
package/common/numbers.js CHANGED
@@ -83,9 +83,9 @@ let configStruct = {
83
83
  ],
84
84
  };
85
85
 
86
- const createConfig = () => {
86
+ const createConfig = async () => {
87
87
  const config = new Config(configStruct, module)
88
- config.add(gdefaults(), sdefaults())
88
+ await config.add(gdefaults, sdefaults)
89
89
  return config
90
90
  }
91
91
 
@@ -32,14 +32,14 @@ const api = new API();
32
32
 
33
33
  if a likes b then a wants b
34
34
  */
35
- const createConfig = () => {
35
+ const createConfig = async () => {
36
36
  const config = new Config({ name: 'ordering' }, module)
37
37
  config.stop_auto_rebuild()
38
- config.api = api
39
- config.add(hierarchy())
38
+ await config.setApi(api)
39
+ await config.add(hierarchy)
40
40
  // config.load(template, ordering_instance)
41
41
 
42
- config.initializer(({config, km}) => {
42
+ await config.initializer(({config, km}) => {
43
43
  const oapi = km('ordering').api
44
44
  oapi.createOrdering({ name: 'preference', categories: [ ['love', 'like'], ['hate', 'dislike'] ], ordering: [ ['love', 'like'], ['like', 'dislike'], ['dislike', 'hate'] ] })
45
45
  const papi = km('properties').api
@@ -114,7 +114,7 @@ const createConfig = () => {
114
114
  })
115
115
  */
116
116
  })
117
- config.restart_auto_rebuild()
117
+ await config.restart_auto_rebuild()
118
118
  return config
119
119
  }
120
120
 
package/common/people.js CHANGED
@@ -45,11 +45,11 @@ let configStruct = {
45
45
  ],
46
46
  };
47
47
 
48
- const createConfig = () => {
48
+ const createConfig = async () => {
49
49
  const config = new Config(configStruct, module)
50
50
  config.stop_auto_rebuild()
51
- config.add(hierarchy())
52
- config.initializer( ({baseConfig, context, apis, isModule}) => {
51
+ await config.add(hierarchy)
52
+ await config.initializer( ({baseConfig, context, apis, isModule}) => {
53
53
  // const api = km('properties').api
54
54
  const api = apis('properties')
55
55
  // setup paraphrase
@@ -65,9 +65,8 @@ const createConfig = () => {
65
65
  edAble: { operator: 'owned', word: 'owned' },
66
66
  config: baseConfig
67
67
  })
68
-
69
68
  })
70
- config.restart_auto_rebuild()
69
+ await config.restart_auto_rebuild()
71
70
  return config
72
71
  }
73
72
 
@@ -20,9 +20,9 @@ let configStruct = {
20
20
  id: "percentageOf",
21
21
  words: ['percent', '%'],
22
22
  bridge: "{ ...next(operator), percentage: before[0], isResponse: true, semanticIsEvaluate: true, value: after[0] }",
23
- evaluator: ({context, e}) => {
23
+ evaluator: async ({context, e}) => {
24
24
  const scale = context.percentage.scale
25
- const number = e(context.value)
25
+ const number = await e(context.value)
26
26
  const percentage = number.value * scale.value / 100
27
27
  const result = { ...number, value: percentage, word: null, text: null }
28
28
  context.evalue = result
@@ -36,9 +36,9 @@ let configStruct = {
36
36
  version: '3',
37
37
  };
38
38
 
39
- const createConfig = () => {
39
+ const createConfig = async () => {
40
40
  const config = new Config(configStruct, module)
41
- config.add(numbers())
41
+ await config.add(numbers)
42
42
  return config
43
43
  }
44
44