tpmkms_4wp 8.0.0-beta.5 → 8.0.0-beta.51

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. package/common/animals.instance.json +2855 -1363
  2. package/common/animals.js +17 -20
  3. package/common/articles.js +103 -0
  4. package/common/articles.test.json +310 -0
  5. package/common/avatar.js +5 -9
  6. package/common/characters.js +22 -28
  7. package/common/colors.instance.json +6978 -3493
  8. package/common/colors.js +4 -8
  9. package/common/colors.test.json +345 -780
  10. package/common/comparable.js +5 -22
  11. package/common/concept.js +120 -118
  12. package/common/countable.js +18 -12
  13. package/common/countable.test.json +1050 -0
  14. package/common/crew.instance.json +13032 -6570
  15. package/common/crew.js +36 -41
  16. package/common/crew.test.json +714 -452
  17. package/common/currency.js +27 -45
  18. package/common/dialogues.js +158 -282
  19. package/common/dimension.instance.json +273 -272
  20. package/common/dimension.js +16 -22
  21. package/common/dimension.test.json +446 -1640
  22. package/common/edible.instance.json +19911 -9877
  23. package/common/edible.js +3 -8
  24. package/common/emotions.instance.json +146 -128
  25. package/common/emotions.js +35 -38
  26. package/common/evaluate.instance.json +2 -0
  27. package/common/evaluate.js +49 -0
  28. package/common/evaluate.test.json +574 -0
  29. package/common/events.js +9 -13
  30. package/common/fastfood.instance.json +221141 -111240
  31. package/common/fastfood.js +70 -80
  32. package/common/formulas.instance.json +251 -265
  33. package/common/formulas.js +17 -24
  34. package/common/gdefaults.js +24 -26
  35. package/common/help.js +7 -12
  36. package/common/help.test.json +22 -22
  37. package/common/helpers/concept.js +9 -6
  38. package/common/helpers/dialogues.js +2 -3
  39. package/common/helpers/properties.js +54 -62
  40. package/common/helpers.js +1 -1
  41. package/common/hierarchy.js +16 -24
  42. package/common/javascript.js +11 -18
  43. package/common/kirk.instance.json +583 -289
  44. package/common/kirk.js +5 -8
  45. package/common/length.instance.json +5530 -4754
  46. package/common/length.js +4 -8
  47. package/common/listener.js +48 -0
  48. package/common/listener.test.json +104 -0
  49. package/common/math.instance.json +192 -1184
  50. package/common/math.js +15 -19
  51. package/common/meta.js +23 -47
  52. package/common/nameable.instance.json +2 -0
  53. package/common/nameable.js +135 -0
  54. package/common/nameable.test.json +2121 -0
  55. package/common/negation.instance.json +2 -0
  56. package/common/negation.js +38 -0
  57. package/common/negation.test.json +308 -0
  58. package/common/numbers.js +6 -10
  59. package/common/ordering.instance.json +340 -160
  60. package/common/ordering.js +80 -86
  61. package/common/people.instance.json +2066 -1014
  62. package/common/people.js +8 -13
  63. package/common/percentages.instance.json +2 -0
  64. package/common/percentages.js +53 -0
  65. package/common/percentages.test.json +751 -0
  66. package/common/pipboy.instance.json +7999 -6269
  67. package/common/pipboy.js +32 -43
  68. package/common/pokemon.instance.json +4207 -2069
  69. package/common/pokemon.js +7 -20
  70. package/common/pos.js +4 -5
  71. package/common/pressure.instance.json +1341 -1189
  72. package/common/pressure.js +4 -8
  73. package/common/properties.instance.json +130 -60
  74. package/common/properties.js +57 -134
  75. package/common/punctuation.js +6 -6
  76. package/common/reports.instance.json +595 -557
  77. package/common/reports.js +64 -89
  78. package/common/scorekeeper.js +18 -30
  79. package/common/sdefaults.js +16 -7
  80. package/common/sizeable.js +5 -9
  81. package/common/spock.instance.json +583 -289
  82. package/common/spock.js +5 -8
  83. package/common/stgame.js +19 -19
  84. package/common/stm.js +163 -26
  85. package/common/stm.test.json +1734 -1
  86. package/common/tell.js +14 -18
  87. package/common/temperature.instance.json +1461 -1293
  88. package/common/temperature.js +4 -8
  89. package/common/tester.js +3 -3
  90. package/common/testing.js +8 -12
  91. package/common/time.js +20 -25
  92. package/common/tokenize.js +4 -5
  93. package/common/ui.instance.json +257 -258
  94. package/common/ui.js +11 -17
  95. package/common/weight.instance.json +5212 -4233
  96. package/common/weight.js +4 -8
  97. package/common/yesno.js +5 -5
  98. package/main.js +59 -46
  99. package/package.json +27 -5
@@ -45,6 +45,10 @@ class API {
45
45
  }
46
46
 
47
47
  if (km('concept')) {
48
+ if (!km('concept').api) {
49
+ debugger
50
+ debugger
51
+ }
48
52
  km('concept').api.addDefaultTypesForObjectHierarchy([
49
53
  'theAble',
50
54
  'queryable',
@@ -136,7 +140,7 @@ class API {
136
140
  notes: 'semantic for setting value with constraint',
137
141
  match: ({context, isA}) => isA(context.marker, after[0].tag) && context.evaluate && context.constraints,
138
142
  // match: ({context, isA}) => context.marker == after[0].tag && context.evaluate,
139
- apply: ({km, context, e, log, isA, s}) => {
143
+ apply: async ({km, context, e, log, isA}) => {
140
144
  const constraint = context.constraints[0];
141
145
  const value = constraint.constraint;
142
146
  let property = constraint.property;
@@ -151,7 +155,7 @@ class API {
151
155
  // value.greg = true
152
156
  // value.ownee.query = true
153
157
  value.query = true
154
- let instance = e(value)
158
+ let instance = await e(value)
155
159
  if (instance.verbatim) {
156
160
  context.evalue = { verbatim: instance.verbatim }
157
161
  return
@@ -168,13 +172,13 @@ class API {
168
172
  config.addGenerator({
169
173
  notes: 'generator for constraint',
170
174
  match: ({context}) => context.marker == edAble.operator && context.paraphrase && context.constrained,
171
- apply: ({context, g}) => {
175
+ apply: async ({context, g}) => {
172
176
  if (context[before[0].tag].marker == 'by') {
173
177
  // the cat wendy owned
174
- return `${g({...context[after[0].tag], paraphrase: true})} ${edAble.word} ${g({...context[before[0].tag], paraphrase: true})}`
178
+ return `${await g({...context[after[0].tag], paraphrase: true})} ${edAble.word} ${await g({...context[before[0].tag], paraphrase: true})}`
175
179
  } else {
176
180
  // the cat owned by wendy
177
- return `${g({...context[after[0].tag], paraphrase: true})} ${edAble.word} ${['by', g({...context[before[0].tag], paraphrase: true})].filter((t) => t).join(' ')}`
181
+ return `${await g({...context[after[0].tag], paraphrase: true})} ${edAble.word} ${['by', await g({...context[before[0].tag], paraphrase: true})].filter((t) => t).join(' ')}`
178
182
  }
179
183
  },
180
184
  })
@@ -194,19 +198,19 @@ class API {
194
198
 
195
199
  return false;
196
200
  },
197
- apply: ({context, g}) => {
201
+ apply: async ({context, g}) => {
198
202
  const chosen = chooseNumber(context, word.singular, word.plural)
199
- return `${g(context[before[0].tag])} ${chosen} ${g(context[after[0].tag])}`
203
+ return `${await g(context[before[0].tag])} ${chosen} ${await g(context[after[0].tag])}`
200
204
  }
201
205
  })
202
206
  config.addGenerator({
203
207
  match: ({context}) => context.marker == edAble.operator && context.isEd,
204
- apply: ({context, g}) => {
208
+ apply: async ({context, g}) => {
205
209
  const chosen = chooseNumber(context[after[0].tag], 'is', 'are')
206
210
  if (context[before[0].tag].evalue && context[before[0].tag].evalue.marker == 'answerNotKnown') {
207
- return g(context[before[0].tag])
211
+ return await g(context[before[0].tag])
208
212
  }
209
- return `${g(context[after[0].tag])} ${chosen} ${edAble.word} by ${g(context[before[0].tag])}`
213
+ return `${await g(context[after[0].tag])} ${chosen} ${edAble.word} by ${await g(context[before[0].tag])}`
210
214
  }
211
215
  })
212
216
  /*
@@ -250,12 +254,10 @@ class API {
250
254
  notes: `generator for who/what is X owned by`,
251
255
  // match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'is') && context.one && context.one.marker == 'ownee' && context.one.constraints && context.one.constraints[0] && context.one.constraints[0].constraint.marker == 'owned' && context.one.constraints[0].constraint.owner.implicit,
252
256
  match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'is') && context.one && context.one.marker == after[0].tag && context.one.constraints && context.one.constraints[0] && context.one.constraints[0].constraint.marker == edAble.operator && context.one.constraints[0].constraint[before[0].tag].implicit,
253
- apply: ({context, g, gs, callId}) => {
257
+ apply: async ({context, fragments, g, gs, callId}) => {
254
258
  const isToFromM = [{"from":["one"],"to":["two"]},{"from":["two"],"to":["one"]}]
255
- const fromF = config.fragment(whoIsWhatVerbedBy).contexts()[0]
256
- // const fromF = config.fragment[before[0].tag]"ownerVar is owneeVar owned by").contexts()[0]
257
- // const toF = config.fragment("owneeVar is owned by ownerVar")
258
- const toF = config.fragment(thisIsVerbedByThat)
259
+ const fromF = fragments(whoIsWhatVerbedBy).contexts()[0]
260
+ const toF = fragments(thisIsVerbedByThat)
259
261
  const to = toF.contexts()[0]
260
262
  const tm = translationMapping(fromF, to)
261
263
  /*
@@ -269,11 +271,11 @@ class API {
269
271
  // const from = context.one.constraints[0].constraint
270
272
  const from = context
271
273
  const im = translationMappingToInstantiatorMappings(tmPrime, from, to)
272
- const translation = toF.instantiate(im)
274
+ const translation = await toF.instantiate(im)
273
275
  if (Array.isArray(translation)) {
274
- return gs(translation)
276
+ return await gs(translation)
275
277
  } else {
276
- return g(translation)
278
+ return await g(translation)
277
279
  }
278
280
  }
279
281
  }
@@ -383,11 +385,16 @@ class API {
383
385
  config.addGenerator({
384
386
  notes: 'ordering generator for paraphrase',
385
387
  match: ({context}) => context.marker == operator && context.paraphrase && !context.query,
386
- apply: ({context, gp, g}) => {
387
- const beforeGenerator = before.map( (arg) => g(context[arg.tag]) )
388
- const afterGenerator = after.map( (arg) => gp(context[arg.tag]) )
388
+ apply: async ({context, gp, g}) => {
389
+ const beforeGenerator = []
390
+ for (const arg of before) {
391
+ beforeGenerator.push(await g(context[arg.tag]))
392
+ }
393
+ const afterGenerator = []
394
+ for (const arg of after) {
395
+ afterGenerator.push(await gp(context[arg.tag]))
396
+ }
389
397
  const word = context.word
390
- // return beforeGenerator.concat([`${context.word}`]).concat(afterGenerator).join(' ')
391
398
  const sub = []
392
399
  if (context.subphrase) {
393
400
  sub.push(['that'])
@@ -399,7 +406,7 @@ class API {
399
406
  config.addGenerator({
400
407
  notes: 'ordering generator for response',
401
408
  match: ({context}) => context.marker == operator && context.evalue && context.isResponse,
402
- apply: ({context, g, km}) => {
409
+ apply: async ({context, g, km}) => {
403
410
  const brief = km("dialogues").api.getBrief()
404
411
 
405
412
  const { evalue } = context
@@ -414,7 +421,7 @@ class API {
414
421
  if (evalue.truthValueOnly || brief) {
415
422
  return `${yesno}`
416
423
  } else {
417
- return `${yesno} ${g(Object.assign({}, evalue, { paraphrase: true }))}`
424
+ return `${yesno} ${await g(Object.assign({}, evalue, { paraphrase: true }))}`
418
425
  }
419
426
  }
420
427
  })
@@ -628,8 +635,8 @@ class API {
628
635
  setValue: ([object, property], value, has) => {
629
636
  return this.setProperty(object, property, value, has, true)
630
637
  },
631
- getValue: ([object, property]) => {
632
- return this.getPropertyDirectly(object, property)
638
+ getValue: async ([object, property]) => {
639
+ return await this.getPropertyDirectly(object, property)
633
640
  },
634
641
  })
635
642
  }
@@ -645,16 +652,18 @@ class API {
645
652
  error.code = 'ReadOnly'
646
653
  throw error
647
654
  },
648
- getValue: ([object, property]) => {
649
- return this.getPropertyDirectly(object, property)
655
+ getValue: async ([object, property]) => {
656
+ return await this.getPropertyDirectly(object, property)
650
657
  },
651
658
  })
652
659
  this.propertiesFH.setHandler(path, handler)
653
660
  }
654
661
 
655
- getObject(object) {
662
+ /*
663
+ async getObject(object) {
656
664
  return this.propertiesFH.getValue([object])
657
665
  }
666
+ */
658
667
 
659
668
  getHandler(object, property) {
660
669
  return this.propertiesFH.getHandler([object, property])
@@ -671,34 +680,33 @@ class API {
671
680
  // return context.value
672
681
  }
673
682
 
674
- getProperty(object, property, g) {
683
+ async getProperty(object, property, g) {
675
684
  object = this.toValue(object)
676
685
  property = this.toValue(property)
677
686
  const handler = this.propertiesFH.getHandler([object, property])
678
687
  if (handler) {
679
- return handler.getValue([object, property])
688
+ return await handler.getValue([object, property])
680
689
  }
681
- return this.getPropertyDirectly(object, property, g)
690
+ return await this.getPropertyDirectly(object, property, g)
682
691
  }
683
692
 
684
- getPropertyDirectly(object, property, g) {
693
+ async getPropertyDirectly(object, property, g) {
685
694
  if (property == 'property') {
686
- const objectProps = this.propertiesFH.getValue([object])
695
+ const objectProps = await this.propertiesFH.getValue([object])
687
696
  const values = []
688
697
  for (let key of Object.keys(objectProps)) {
689
698
  if (objectProps[key].has) {
690
- // values.push(`${g(key)}: ${g({ ...objectProps[key].value, evaluate: true })}`)
691
- values.push(`${g(key)}: ${g({ ...objectProps[key].value, paraphrase: true })}`)
699
+ values.push(`${await g(key)}: ${await g({ ...objectProps[key].value, paraphrase: true })}`)
692
700
  }
693
701
  }
694
702
  return { marker: 'list', value: values }
695
703
  } else {
696
- return this.propertiesFH.getValue([object, property]).value
704
+ return (await this.propertiesFH.getValue([object, property])).value
697
705
  }
698
706
  }
699
707
 
700
- hasProperty(object, property, has) {
701
- return this.propertiesFH.getValue([object, property]).has
708
+ async hasProperty(object, property, has) {
709
+ return (await this.propertiesFH.getValue([object, property])).has
702
710
  }
703
711
 
704
712
  setProperty(object, property, value, has, skipHandler) {
@@ -726,7 +734,7 @@ class API {
726
734
  }
727
735
  }
728
736
 
729
- knownObject(object) {
737
+ async knownObject(object) {
730
738
  if (object == 'property') {
731
739
  return object
732
740
  }
@@ -735,10 +743,10 @@ class API {
735
743
  }
736
744
  const path = [object]
737
745
  // return this.knownPropertyNew(path)
738
- return this.propertiesFH.knownProperty(path)
746
+ return await this.propertiesFH.knownProperty(path)
739
747
  }
740
748
 
741
- hasProperty(object, property) {
749
+ async hasProperty(object, property) {
742
750
  if (property == 'property') {
743
751
  return true;
744
752
  }
@@ -748,7 +756,7 @@ class API {
748
756
  const seen = [object];
749
757
  while (todo.length > 0) {
750
758
  const next = todo.pop();
751
- if ((this.propertiesFH.getValue([next, property], false) || {}).has) {
759
+ if ((await this.propertiesFH.getValue([next, property], false) || {}).has) {
752
760
  return true
753
761
  }
754
762
  const parents = this._objects.parents[next] || [];
@@ -763,11 +771,11 @@ class API {
763
771
  }
764
772
 
765
773
  // NOT DONE
766
- knownProperty(object, property) {
774
+ async knownProperty(object, property) {
767
775
  object = this.toValue(object)
768
776
  property = this.toValue(property)
769
777
  if (property == 'property') {
770
- const objectProps = this.propertiesFH.getValue([object])
778
+ const objectProps = await this.propertiesFH.getValue([object])
771
779
  return !_.isEmpty(objectProps)
772
780
  }
773
781
 
@@ -776,7 +784,7 @@ class API {
776
784
  const seen = [object];
777
785
  while (todo.length > 0) {
778
786
  const next = todo.pop();
779
- if ((this.propertiesFH.getValue([next, property], false) || {}).has) {
787
+ if ((await this.propertiesFH.getValue([next, property], false) || {}).has) {
780
788
  return true
781
789
  }
782
790
  const parents = this._objects.parents[next] || [];
@@ -911,22 +919,6 @@ class API {
911
919
 
912
920
  set config(config) {
913
921
  this._config = config
914
- /*
915
- const toJSON = (h) => {
916
- if (h.child && h.parent) {
917
- return h
918
- } else {
919
- return { child: h[0], parent: h[1] }
920
- }
921
- }
922
- for (const tuple of [...config().config.hierarchy]) {
923
- const h = toJSON(tuple);
924
- // TODO should this notice development flag?
925
- if (this.isOperator(h.child) && this.isOperator(h.parent)) {
926
- this.rememberIsA(h.child, h.parent)
927
- }
928
- }
929
- */
930
922
  }
931
923
 
932
924
  get config() {
package/common/helpers.js CHANGED
@@ -131,7 +131,7 @@ const toEValue = (context) => {
131
131
  return context;
132
132
  }
133
133
 
134
- const defaultContextProperties = ['marker', 'text', 'verbatim', 'isResponse']
134
+ const defaultContextProperties = ['marker', 'text', 'verbatim', 'isResponse', { property: 'response', filter: ['marker', 'text', 'verbatim'] }]
135
135
  const defaultContextCheck = [
136
136
  ...defaultContextProperties,
137
137
  (object) => {
@@ -1,4 +1,4 @@
1
- const { Config, knowledgeModule, where } = require('./runtime').theprogrammablemind
1
+ const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const properties = require('./properties')
4
4
  const hierarchy_tests = require('./hierarchy.test.json')
@@ -32,7 +32,7 @@ const getTypes = ( km, concept, instance ) => {
32
32
 
33
33
  // TODO the types of rank are x y z ....
34
34
  // TODO x is a kind of y
35
- let configStruct = {
35
+ let config = {
36
36
  name: 'hierarchy',
37
37
  operators: [
38
38
  // "([hierarchyAble|])",
@@ -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,23 +284,19 @@ let configStruct = {
288
284
  ]
289
285
  };
290
286
 
291
- const createConfig = () => {
292
- const config = new Config(configStruct, module)
293
- config.stop_auto_rebuild()
294
- config.add(properties())
295
- config.initializer( ({apis, hierarchy}) => {
287
+ const initializer = ({apis, hierarchy}) => {
296
288
  apis('stm').addIsA( (child, parent) => {
297
289
  return hierarchy.isA(child, parent)
298
290
  })
299
- })
300
- config.restart_auto_rebuild()
301
- return config
302
- }
291
+ }
303
292
 
304
293
  knowledgeModule( {
294
+ config,
295
+ includes: [properties],
296
+ initializer,
297
+
305
298
  module,
306
299
  description: 'hierarchy of objects',
307
- createConfig,
308
300
  test: {
309
301
  name: './hierarchy.test.json',
310
302
  contents: hierarchy_tests,
@@ -1,9 +1,9 @@
1
- const { Config, knowledgeModule, where } = require('./runtime').theprogrammablemind
1
+ const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const dialogues = require('./dialogues')
4
4
  const javascript_tests = require('./javascript.test.json')
5
5
 
6
- let configStruct = {
6
+ let config = {
7
7
  name: 'javascript',
8
8
  operators: [
9
9
  "((<let> ([variable|])) [assignment|] (value))",
@@ -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,22 +60,15 @@ let configStruct = {
60
60
  ],
61
61
  };
62
62
 
63
- const createConfig = () => {
64
- const config = new Config(configStruct, module)
65
- config.stop_auto_rebuild()
66
- config.add(dialogues())
67
-
68
- config.initializer( ({objects, uuid}) => {
63
+ knowledgeModule( {
64
+ config,
65
+ includes: [dialogues],
66
+ initializer: ({objects, uuid}) => {
69
67
  objects.variables = {}
70
- })
71
- config.restart_auto_rebuild()
72
- return config
73
- }
68
+ },
74
69
 
75
- knowledgeModule( {
76
70
  module,
77
71
  description: 'javascript interpreter',
78
- createConfig,
79
72
  test: {
80
73
  name: './javascript.test.json',
81
74
  contents: javascript_tests,