tpmkms 8.0.0-beta.5 → 8.0.0-beta.50

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 (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 +52 -58
  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 +56 -133
  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,7 +254,7 @@ 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, g, gs, callId}) => {
254
258
  const isToFromM = [{"from":["one"],"to":["two"]},{"from":["two"],"to":["one"]}]
255
259
  const fromF = config.fragment(whoIsWhatVerbedBy).contexts()[0]
256
260
  // const fromF = config.fragment[before[0].tag]"ownerVar is owneeVar owned by").contexts()[0]
@@ -269,11 +273,11 @@ class API {
269
273
  // const from = context.one.constraints[0].constraint
270
274
  const from = context
271
275
  const im = translationMappingToInstantiatorMappings(tmPrime, from, to)
272
- const translation = toF.instantiate(im)
276
+ const translation = await toF.instantiate(im)
273
277
  if (Array.isArray(translation)) {
274
- return gs(translation)
278
+ return await gs(translation)
275
279
  } else {
276
- return g(translation)
280
+ return await g(translation)
277
281
  }
278
282
  }
279
283
  }
@@ -383,11 +387,16 @@ class API {
383
387
  config.addGenerator({
384
388
  notes: 'ordering generator for paraphrase',
385
389
  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]) )
390
+ apply: async ({context, gp, g}) => {
391
+ const beforeGenerator = []
392
+ for (const arg of before) {
393
+ beforeGenerator.push(await g(context[arg.tag]))
394
+ }
395
+ const afterGenerator = []
396
+ for (const arg of after) {
397
+ afterGenerator.push(await gp(context[arg.tag]))
398
+ }
389
399
  const word = context.word
390
- // return beforeGenerator.concat([`${context.word}`]).concat(afterGenerator).join(' ')
391
400
  const sub = []
392
401
  if (context.subphrase) {
393
402
  sub.push(['that'])
@@ -399,7 +408,7 @@ class API {
399
408
  config.addGenerator({
400
409
  notes: 'ordering generator for response',
401
410
  match: ({context}) => context.marker == operator && context.evalue && context.isResponse,
402
- apply: ({context, g, km}) => {
411
+ apply: async ({context, g, km}) => {
403
412
  const brief = km("dialogues").api.getBrief()
404
413
 
405
414
  const { evalue } = context
@@ -414,7 +423,7 @@ class API {
414
423
  if (evalue.truthValueOnly || brief) {
415
424
  return `${yesno}`
416
425
  } else {
417
- return `${yesno} ${g(Object.assign({}, evalue, { paraphrase: true }))}`
426
+ return `${yesno} ${await g(Object.assign({}, evalue, { paraphrase: true }))}`
418
427
  }
419
428
  }
420
429
  })
@@ -628,8 +637,8 @@ class API {
628
637
  setValue: ([object, property], value, has) => {
629
638
  return this.setProperty(object, property, value, has, true)
630
639
  },
631
- getValue: ([object, property]) => {
632
- return this.getPropertyDirectly(object, property)
640
+ getValue: async ([object, property]) => {
641
+ return await this.getPropertyDirectly(object, property)
633
642
  },
634
643
  })
635
644
  }
@@ -645,16 +654,18 @@ class API {
645
654
  error.code = 'ReadOnly'
646
655
  throw error
647
656
  },
648
- getValue: ([object, property]) => {
649
- return this.getPropertyDirectly(object, property)
657
+ getValue: async ([object, property]) => {
658
+ return await this.getPropertyDirectly(object, property)
650
659
  },
651
660
  })
652
661
  this.propertiesFH.setHandler(path, handler)
653
662
  }
654
663
 
655
- getObject(object) {
664
+ /*
665
+ async getObject(object) {
656
666
  return this.propertiesFH.getValue([object])
657
667
  }
668
+ */
658
669
 
659
670
  getHandler(object, property) {
660
671
  return this.propertiesFH.getHandler([object, property])
@@ -671,34 +682,33 @@ class API {
671
682
  // return context.value
672
683
  }
673
684
 
674
- getProperty(object, property, g) {
685
+ async getProperty(object, property, g) {
675
686
  object = this.toValue(object)
676
687
  property = this.toValue(property)
677
688
  const handler = this.propertiesFH.getHandler([object, property])
678
689
  if (handler) {
679
- return handler.getValue([object, property])
690
+ return await handler.getValue([object, property])
680
691
  }
681
- return this.getPropertyDirectly(object, property, g)
692
+ return await this.getPropertyDirectly(object, property, g)
682
693
  }
683
694
 
684
- getPropertyDirectly(object, property, g) {
695
+ async getPropertyDirectly(object, property, g) {
685
696
  if (property == 'property') {
686
- const objectProps = this.propertiesFH.getValue([object])
697
+ const objectProps = await this.propertiesFH.getValue([object])
687
698
  const values = []
688
699
  for (let key of Object.keys(objectProps)) {
689
700
  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 })}`)
701
+ values.push(`${await g(key)}: ${await g({ ...objectProps[key].value, paraphrase: true })}`)
692
702
  }
693
703
  }
694
704
  return { marker: 'list', value: values }
695
705
  } else {
696
- return this.propertiesFH.getValue([object, property]).value
706
+ return (await this.propertiesFH.getValue([object, property])).value
697
707
  }
698
708
  }
699
709
 
700
- hasProperty(object, property, has) {
701
- return this.propertiesFH.getValue([object, property]).has
710
+ async hasProperty(object, property, has) {
711
+ return (await this.propertiesFH.getValue([object, property])).has
702
712
  }
703
713
 
704
714
  setProperty(object, property, value, has, skipHandler) {
@@ -726,7 +736,7 @@ class API {
726
736
  }
727
737
  }
728
738
 
729
- knownObject(object) {
739
+ async knownObject(object) {
730
740
  if (object == 'property') {
731
741
  return object
732
742
  }
@@ -735,10 +745,10 @@ class API {
735
745
  }
736
746
  const path = [object]
737
747
  // return this.knownPropertyNew(path)
738
- return this.propertiesFH.knownProperty(path)
748
+ return await this.propertiesFH.knownProperty(path)
739
749
  }
740
750
 
741
- hasProperty(object, property) {
751
+ async hasProperty(object, property) {
742
752
  if (property == 'property') {
743
753
  return true;
744
754
  }
@@ -748,7 +758,7 @@ class API {
748
758
  const seen = [object];
749
759
  while (todo.length > 0) {
750
760
  const next = todo.pop();
751
- if ((this.propertiesFH.getValue([next, property], false) || {}).has) {
761
+ if ((await this.propertiesFH.getValue([next, property], false) || {}).has) {
752
762
  return true
753
763
  }
754
764
  const parents = this._objects.parents[next] || [];
@@ -763,11 +773,11 @@ class API {
763
773
  }
764
774
 
765
775
  // NOT DONE
766
- knownProperty(object, property) {
776
+ async knownProperty(object, property) {
767
777
  object = this.toValue(object)
768
778
  property = this.toValue(property)
769
779
  if (property == 'property') {
770
- const objectProps = this.propertiesFH.getValue([object])
780
+ const objectProps = await this.propertiesFH.getValue([object])
771
781
  return !_.isEmpty(objectProps)
772
782
  }
773
783
 
@@ -776,7 +786,7 @@ class API {
776
786
  const seen = [object];
777
787
  while (todo.length > 0) {
778
788
  const next = todo.pop();
779
- if ((this.propertiesFH.getValue([next, property], false) || {}).has) {
789
+ if ((await this.propertiesFH.getValue([next, property], false) || {}).has) {
780
790
  return true
781
791
  }
782
792
  const parents = this._objects.parents[next] || [];
@@ -911,22 +921,6 @@ class API {
911
921
 
912
922
  set config(config) {
913
923
  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
924
  }
931
925
 
932
926
  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,