ekms 9.8.0-beta.8 → 9.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/common/actions.instance.json +4 -4
  2. package/common/actions.js +9 -9
  3. package/common/askfor.instance.json +12 -184
  4. package/common/askfor.js +19 -11
  5. package/common/asking.js +13 -5
  6. package/common/can.instance.json +2 -18
  7. package/common/can.js +2 -2
  8. package/common/comparable.instance.json +6 -12
  9. package/common/concept.instance.json +8 -4
  10. package/common/concept.js +2 -0
  11. package/common/conjunction.js +6 -4
  12. package/common/control.js +5 -5
  13. package/common/countable.js +1 -0
  14. package/common/dateTimeSelectors.instance.json +1 -1
  15. package/common/dateTimeSelectors.js +1 -1
  16. package/common/dates.instance.json +11 -1
  17. package/common/dates.js +6 -1
  18. package/common/debug.instance.json +5 -1
  19. package/common/debug.js +2 -0
  20. package/common/dialogues.js +37 -35
  21. package/common/dimension.instance.json +144 -446
  22. package/common/dimension.js +14 -8
  23. package/common/drone.instance.json +43 -19
  24. package/common/drone.js +29 -35
  25. package/common/drone_v1.instance.json +13 -3
  26. package/common/drone_v1.js +14 -9
  27. package/common/evaluate.js +2 -2
  28. package/common/fastfood.instance.json +12 -4
  29. package/common/fastfood.js +27 -12
  30. package/common/formulas.instance.json +138 -12
  31. package/common/formulas.js +15 -6
  32. package/common/gdefaults.js +2 -71
  33. package/common/helpers/dialogues.js +1 -10
  34. package/common/helpers/properties.js +6 -10
  35. package/common/helpers.js +5 -2
  36. package/common/hierarchy.js +11 -7
  37. package/common/math.instance.json +141 -4
  38. package/common/math.js +18 -5
  39. package/common/menus.instance.json +6 -2
  40. package/common/menus.js +5 -2
  41. package/common/meta.js +12 -12
  42. package/common/nameable.js +6 -2
  43. package/common/ordering.instance.json +1 -2
  44. package/common/percentages.js +4 -2
  45. package/common/pipboy.instance.json +38 -27
  46. package/common/pipboy.js +21 -14
  47. package/common/properties.instance.json +2319 -560
  48. package/common/properties.js +146 -37
  49. package/common/punctuation.js +1 -0
  50. package/common/rates.instance.json +1 -1
  51. package/common/rates.js +2 -2
  52. package/common/reminders.instance.json +16 -0
  53. package/common/reminders.js +23 -19
  54. package/common/reports.instance.json +4 -6
  55. package/common/reports.js +12 -12
  56. package/common/sdefaults.js +11 -9
  57. package/common/stm.js +11 -14
  58. package/common/testing.js +2 -2
  59. package/common/time.instance.json +42 -15
  60. package/common/time.js +7 -6
  61. package/common/ui.js +5 -5
  62. package/common/words.js +106 -1
  63. package/common/wp.instance.json +10 -3
  64. package/common/wp.js +5 -1
  65. package/package.json +2 -2
@@ -84,9 +84,9 @@ function addPropertyMarker(args) {
84
84
  markerWords = [markerWords]
85
85
  }
86
86
 
87
- const { fragments, s, config } = args
87
+ const { fragments, e, config } = args
88
88
  const instance = await fragments("concept is a property", { concept: { marker: property, level: 0, value: property, word: property } })
89
- await s(instance)
89
+ await e(instance, where())
90
90
  const propertyMarker = `${property}Marker`
91
91
  config.addOperator(`((@<= 'quantity' && context.unit.dimension == ${dimension}) [${propertyMarker}|])`)
92
92
  config.addBridge({
@@ -137,12 +137,14 @@ const config = {
137
137
  // the plural of cat is cats what is the plural of cat?
138
138
  // does greg have ears (yes) greg does not have ears does greg have ears (no)
139
139
  // TODO fix @=unknown does not work?!??
140
+ "([isPropertyValue])",
140
141
  "((@<= object || @<=unknown) [hasPropertyValue|is,are] (context.isPropertyValue == true))",
141
142
  ],
142
143
  // TODO remove these and use localHierarchy if needed
143
144
  hierarchy: [
144
145
  ['unknown', 'hierarchyAble'],
145
146
  ['what', 'object'],
147
+ ['who', 'object'],
146
148
  ],
147
149
  bridges: [
148
150
  {
@@ -150,6 +152,11 @@ const config = {
150
152
  id: 'howPropertyMarker',
151
153
  bridge: "{ ...after[0], query: ['what'], how: operator, operator: after[0], interpolate: [ { property: 'how' }, { property: 'operator' } ] }",
152
154
  },
155
+ {
156
+ where: where(),
157
+ id: 'isPropertyValue',
158
+ initial: { isPropertyValue: true },
159
+ },
153
160
  {
154
161
  where: where(),
155
162
  id: 'hasPropertyValue',
@@ -157,16 +164,45 @@ const config = {
157
164
  preferOver: ['is'],
158
165
  enhanced_associations: true,
159
166
  bridge: "{ ...operator, object: before[0], flatten: true, operator: operator, propertyValue: after[0], interpolate: [{ property: 'object' }, { property: 'operator' }, { property: 'propertyValue' }] }",
160
- semantic: async ({context, s, toArray, fragments, getWordFromDictionary}) => {
161
- const propertyType = {
162
- marker: context.propertyValue.propertyType,
163
- level: 0,
164
- word: context.propertyValue.propertyType,
165
- value: context.propertyValue.propertyType,
166
- }
167
- for (const object of toArray(context.object)) {
168
- const instance = await fragments("the property of object is value", { property: propertyType, object, value: context.propertyValue })
169
- await s(instance)
167
+ semantic: async ({gp, context, api, callId, e, debug, toArray, fragments, resolveEvaluate, getWordFromDictionary}) => {
168
+ // TODO is there some way to make lookup up and setting the value into the same operation?
169
+ if (context.query) {
170
+ const propertyId = context.propertyValue.markedProperty
171
+ const object = context.object
172
+ const value = context.propertyValue
173
+ const pattern = {
174
+ marker: 'propertyRelation',
175
+ object,
176
+ property: { marker: propertyId, value: propertyId },
177
+ value,
178
+ }
179
+
180
+ const relations = await api.relation_unify(pattern, ['object', 'property', 'value'])
181
+
182
+ relations.forEach((r) => {
183
+ r.objectPropertyValueStyle = {
184
+ template: "object is isPropertyValue",
185
+ mapping: {
186
+ object: 'object',
187
+ isPropertyValue: 'value',
188
+ }
189
+ }
190
+ })
191
+
192
+ resolveEvaluate(context, relations)
193
+ } else {
194
+ const propertyType = {
195
+ marker: context.propertyValue.propertyType,
196
+ level: 0,
197
+ word: context.propertyValue.propertyType,
198
+ value: context.propertyValue.propertyType,
199
+ }
200
+ for (const object of toArray(context.object)) {
201
+ const instance = await fragments("the property of object is value", { property: propertyType, object, value: context.propertyValue })
202
+ const text = await gp(instance)
203
+ instance.query = context.query
204
+ await e(instance, where())
205
+ }
170
206
  }
171
207
  }
172
208
  },
@@ -176,7 +212,7 @@ const config = {
176
212
  id: 'propertyRelation',
177
213
  // scope: 'development',
178
214
  words: words('propertyRelation'),
179
- evaluator: ({context, api, objects, toList}) => {
215
+ semantic: ({context, api, objects, toList}) => {
180
216
  context.evalue = toList(objects.relations)
181
217
  context.evalue.isResponse = true
182
218
  context.evalue.paraphrase = false
@@ -329,6 +365,18 @@ const config = {
329
365
  { "context": [['what', 0], ['is', 0], ['objectPrefix', 0], ], "choose": [0] },
330
366
  ],
331
367
  generators: [
368
+ {
369
+ where: where(),
370
+ match: ({context, hierarchy}) => context.objectPropertyValueStyle,
371
+ apply: async ({context, fragments, gp}) => {
372
+ const mapping = {}
373
+ for (const key of Object.keys(context.objectPropertyValueStyle.mapping)) {
374
+ mapping[key] = context[context.objectPropertyValueStyle.mapping[key]]
375
+ }
376
+ const fragment = await fragments(context.objectPropertyValueStyle.template, mapping)
377
+ return await gp(fragment)
378
+ }
379
+ },
332
380
  {
333
381
  where: where(),
334
382
  // match: ({context}) => context.marker == 'propertyRelation' && !context.paraphrase,
@@ -340,16 +388,17 @@ const config = {
340
388
  match: ({context}) => context.marker == 'propertyRelation' && context.isResponse,
341
389
  apply: async ({context, gp, fragments}) => {
342
390
  const instance = await fragments("the property of object", {
343
- property: { ...context.property, interpolate: undefined },
391
+ // property: { ...context.property, interpolate: undefined },
392
+ property: context.property,
344
393
  object: context.object
345
- })
394
+ }, ['interpolate'])
346
395
  return await gp(instance)
347
396
  }
348
397
  },
349
398
  {
350
399
  notes: 'ordering generator for response',
351
400
  match: ({context}) => (context.orderingArgs && Object.keys(context.orderingArgs).length !== 0) && context.evalue && context.isResponse,
352
- apply: async ({context, s, g, km, flatten}) => {
401
+ apply: async ({context, e, g, km, flatten}) => {
353
402
  const brief = km("dialogues").api.getBrief()
354
403
 
355
404
  let { evalue } = context
@@ -386,7 +435,7 @@ const config = {
386
435
  return `${yesno}`
387
436
  } else {
388
437
  if (context.voice) {
389
- evalue = await s({ ...evalue, toVoice: context.voice, flatten: false})
438
+ evalue = await e({ ...evalue, toVoice: context.voice, flatten: false}, where())
390
439
  }
391
440
 
392
441
  const details = await g(Object.assign({}, evalue, { paraphrase: true }))
@@ -603,7 +652,7 @@ const config = {
603
652
  ],
604
653
  semantics: [
605
654
  {
606
- notes: 'unify for properties',
655
+ notes: 'unify for properties -> the age of who',
607
656
  where: where(),
608
657
  match: ({context, isA}) =>
609
658
  context.marker == 'unify' &&
@@ -629,6 +678,61 @@ const config = {
629
678
  value,
630
679
  }
631
680
  const relations = await api.relation_unify(pattern, ['object', 'property', 'value'])
681
+
682
+ relations.forEach((r) => {
683
+ r.objectPropertyValueStyle = {
684
+ template: "the property of object",
685
+ mapping: {
686
+ object: 'object',
687
+ property: 'property',
688
+ }
689
+ }
690
+ })
691
+
692
+ resolveEvaluate(context, relations)
693
+ }
694
+ },
695
+ {
696
+ notes: 'unify for properties -> whose age',
697
+ where: where(),
698
+ match: ({context, isA}) => {
699
+ return context.marker == 'unify' && context.terms[0].whose && context.terms[1].markedProperty == context.terms[0].value
700
+ },
701
+ apply: async (args) => {
702
+ const {context, km, callId, api, fragments, resolveEvaluate} = args
703
+ let value, property, object
704
+ if (context.terms[0].query) {
705
+ property = { ...context.terms[0] },
706
+ object = { marker: 'who', value: 'who' }
707
+ value = context.terms[1]
708
+ } else {
709
+ property = { ...context.terms[1] }
710
+ object = { marker: 'who', value: 'who' }
711
+ value = context.terms[0]
712
+ }
713
+ property = await fragments("the property", { property }, ['interpolate'])
714
+
715
+ const pattern = {
716
+ marker: 'propertyRelation',
717
+ object,
718
+ property,
719
+ value,
720
+ }
721
+
722
+ const relations = await api.relation_unify(pattern, ['object', 'property', 'value'])
723
+ relations.forEach((r) => {
724
+ r.objectPropertyValueStyle = {
725
+ template: "object's property",
726
+ mapping: {
727
+ object: 'object',
728
+ property: 'property',
729
+ value: 'value',
730
+ }
731
+ }
732
+ r.property = { ...r.property, determiner: null }
733
+ })
734
+
735
+ const text = await args.gp(relations[0]) // 'the age is 23 years old'
632
736
  resolveEvaluate(context, relations)
633
737
  }
634
738
  },
@@ -640,7 +744,6 @@ const config = {
640
744
  context.evalue = {
641
745
  marker: 'list',
642
746
  listable: true,
643
- // value: unflatten(api.relation_get(context, before.concat(after).map( (arg) => arg.tag ) ))
644
747
  value: unflatten(api.relation_get(context, context.relationArgs.map( (arg) => arg.tag ) ))
645
748
  }
646
749
  context.evalue.isResponse = true
@@ -658,7 +761,7 @@ const config = {
658
761
  {
659
762
  notes: `setter for relation based verbs`,
660
763
  match: ({context}) => context.relationBacked && !context.toVoice && context.isVerb,
661
- apply: ({context, km, hierarchy, config, stack}) => {
764
+ apply: ({context, km, hierarchy, config}) => {
662
765
  const api = km('properties').api
663
766
  // add types for arguments
664
767
  for (const argument of context.focusable || []) {
@@ -725,7 +828,7 @@ const config = {
725
828
  // TODO use hierarchy for operator
726
829
  // match: ({context}) => context.marker == operator,
727
830
  match: ({context}) => (context.orderingArgs && Object.keys(context.orderingArgs).length !== 0),
728
- apply: ({context, km, stack}) => {
831
+ apply: ({context, km}) => {
729
832
  const propertiesAPI = km('properties').api
730
833
  context.ordering = context.orderingArgs.name
731
834
  const fcontexts = flattens(['list'], [context])
@@ -759,7 +862,7 @@ const config = {
759
862
  // value.ownee.query = true
760
863
  value.query = true
761
864
  value.greg99 = 23
762
- const instance = await e(value)
865
+ const instance = await e(value, where())
763
866
  if (instance.verbatim) {
764
867
  context.evalue = { verbatim: instance.verbatim }
765
868
  return
@@ -792,7 +895,7 @@ const config = {
792
895
  properties.push({ marker: property, value: property, word: property })
793
896
  }
794
897
  const propertyOfObject = await fragments("the property of object", { property: toList(properties, true), object })
795
- const value = toEValue(await e(propertyOfObject))
898
+ const value = toEValue(await e(propertyOfObject, where()))
796
899
  value.focusableForPhrase = true
797
900
  propertyOfObject.focusableForPhrase = false
798
901
  const response = await fragments("the property is value", { property: propertyOfObject, value })
@@ -861,7 +964,7 @@ const config = {
861
964
  !context.ordinal &&
862
965
  (!context.objects || context.objects.length !== 2 || !context.objects[1].isInstance) &&
863
966
  (api.objects && api.objects.children && api.objects.children[context.marker]),
864
- apply: ({context, stack, isA, contextHierarchy, hierarchy, objects, api, km}) => {
967
+ apply: ({context, isA, contextHierarchy, hierarchy, objects, api, km}) => {
865
968
  const values = api.objects.children[context.marker]
866
969
  const phrases = values.map( (value) => km('concept').api.getWordForValue(value) )
867
970
  // context.focusableForPhrase = true
@@ -898,12 +1001,13 @@ const config = {
898
1001
  notes: 'greg has eyes?',
899
1002
  where: where(),
900
1003
  match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'have') && context.query,
901
- apply: async ({context, g, api, objects}) => {
1004
+ apply: async ({error, context, g, api, objects}) => {
902
1005
  const object = pluralize.singular(context.object.value);
903
1006
  const property = pluralize.singular(context.property.value);
904
1007
  context.isResponse = true
905
1008
  if (!await api.knownObject(object)) {
906
- context.verbatim = `There is no object named ${await g({...context.object, paraphrase: true})}`
1009
+ // context.verbatim = `There is no object named ${await g({...context.object, paraphrase: true})}`
1010
+ error(`there is no object named ${await g({...context.object, paraphrase: true})}`)
907
1011
  return
908
1012
  }
909
1013
  if (!await api.hasProperty(object, property)) {
@@ -923,8 +1027,7 @@ const config = {
923
1027
  {
924
1028
  notes: 'set the property of an object',
925
1029
  where: where(),
926
- // TODO change disable${uuid} to callOnce
927
- match: (args) => args.callOnce(args, 'properties.1', ({context, hierarchy, uuid}) =>
1030
+ match: async (args) => await args.callOnce(args, 'properties.1', ({context, hierarchy, uuid}) =>
928
1031
  context.marker == 'same' &&
929
1032
  hierarchy.isA(context.one.marker, 'property') &&
930
1033
  context.one.objects),
@@ -978,7 +1081,7 @@ const config = {
978
1081
  match: ({context, hierarchy, toArray}) => {
979
1082
  return (toArray(context).every((value) => hierarchy.isA(value.marker, 'property')) || (hierarchy.isA(context.marker, 'list') && context.possession)) && context.objects
980
1083
  },
981
- apply: async ({debug, isA, hierarchy, getWordFromDictionary, flatten, asList, context, api, kms, objects, g, gp, s, log, recall}) => {
1084
+ apply: async ({stack, error, debug, isA, hierarchy, getWordFromDictionary, flatten, asList, context, api, kms, objects, g, gp, s, log, recall}) => {
982
1085
  async function toValue(objectContext) {
983
1086
  if (!objectContext.value) {
984
1087
  return objectContext;
@@ -1012,7 +1115,9 @@ const config = {
1012
1115
 
1013
1116
  const propertyPhrase = await g({...nextContext, paraphrase: true})
1014
1117
  const objectPhrase = await g({...currentContext, paraphrase: true})
1015
- context.verbatim = `There is no interpretation for "${propertyPhrase} of ${objectPhrase}"`
1118
+ // context.verbatim = `There is no interpretation for "${propertyPhrase} of ${objectPhrase}"`
1119
+ error(`There is no interpretation for "${propertyPhrase} of ${objectPhrase}"`)
1120
+
1016
1121
  return
1017
1122
  }
1018
1123
 
@@ -1031,9 +1136,11 @@ const config = {
1031
1136
  }
1032
1137
  if (!fromMentions) {
1033
1138
  if (!currentValue && currentContext.unknown) {
1139
+ // context.verbatim = `What "${await gp(currentContext)}" means is unknown`
1034
1140
  context.verbatim = `What "${await gp(currentContext)}" means is unknown`
1035
1141
  } else {
1036
- context.verbatim = `There is no property ${await g({...nextContext, paraphrase: true})} of ${await g({...currentContext, paraphrase: true})}`
1142
+ // context.verbatim = `There is no property ${await g({...nextContext, paraphrase: true})} of ${await g({...currentContext, paraphrase: true})}`
1143
+ error(`There is no property ${await g({...nextContext, paraphrase: true})} of ${await g({...currentContext, paraphrase: true})}`)
1037
1144
  }
1038
1145
  return
1039
1146
  }
@@ -1081,12 +1188,6 @@ function initializer({objects, config, isModule}) {
1081
1188
  }
1082
1189
 
1083
1190
  const template = {
1084
- fragments: [
1085
- "the property1 of object1 is value1",
1086
- "the property of object is value",
1087
- "the property of object",
1088
- "the property is value",
1089
- ],
1090
1191
  configs: [
1091
1192
  "property is a concept",
1092
1193
  { query: "concept is a property", isFragment: true },
@@ -1104,6 +1205,14 @@ const template = {
1104
1205
  },
1105
1206
  ],
1106
1207
  },
1208
+ { query: "the property1 of object1 is value1", isFragment: true },
1209
+ { query: "the property of object is value", isFragment: true },
1210
+ { query: "the property of object", isFragment: true, preserve: ['interpolate'] },
1211
+ { query: "the property is value", isFragment: true },
1212
+ { query: "object's property", isFragment: true, preserve: ['interpolate'] },
1213
+ { query: "object's property is value", isFragment: true, preserve: ['one.interpolate'] },
1214
+ { query: "object is isPropertyValue", isFragment: true }, // bob is 23 years old
1215
+ { query: "the property", isFragment: true },
1107
1216
  ],
1108
1217
  }
1109
1218
 
@@ -53,6 +53,7 @@ const config = {
53
53
  },
54
54
  {
55
55
  id: "doubleQuote",
56
+ where: where(),
56
57
  level: 0,
57
58
  bridge: "{ ...next(operator), quote: 'double' }",
58
59
  enhanced_associations: false,
@@ -20,7 +20,7 @@
20
20
  "semantics": [
21
21
  {
22
22
  "match": "({context}) => context.marker == 'convertToUnits' && (context.from?.unit?.marker == 'unitPerUnit' || context.to.marker == 'unitPerUnit')",
23
- "apply": "async ({remember, context, kms, e, callId, resolveEvaluate, toEValue, error}) => {\n\n async function convert(fromUnits, fromAmount, toUnits) {\n let evalue;\n if (toUnits.value == fromUnits.value) {\n evalue = fromAmount\n // if (!fromAmount.value) {\n // debugger\n //}\n evalue.evalue = fromAmount.evalue || fromAmount.value\n } else {\n const formula = kms.formulas.api.get(toUnits, [fromUnits])\n if (!formula) {\n const reason = { marker: 'reason', focusableForPhrase: true, evalue: { marker: 'noconversion', from: fromUnits, to: toUnits } }\n kms.stm.api.remember({ context: reason })\n error(reason)\n }\n kms.stm.api.setVariable(fromUnits.value, fromAmount)\n evalue = await e(formula)\n }\n return evalue\n }\n\n if (!context.from.unit) {\n resolveEvaluate(context.from, await e(context.from))\n }\n\n\n const from = toEValue(context.from)\n remember(context.to)\n const evalueNumerator = await convert(from.unit.numerator, from.amount, context.to.numerator)\n const evalueDenominator = await convert(from.unit.denominator, 1, context.to.denominator)\n const evalue = { evalue: (toFinalValue(evalueNumerator) || evalueNumerator.value) / (toFinalValue(evalueDenominator) || evalueDenominator.evalue) }\n context.evalue = {\n paraphrase: true,\n marker: 'quantity',\n level: 1,\n unit: context.to,\n amount: { evalue, paraphrase: undefined }\n }\n }"
23
+ "apply": "async ({remember, context, kms, e, callId, resolveEvaluate, toEValue, error}) => {\n\n async function convert(fromUnits, fromAmount, toUnits) {\n let evalue;\n if (toUnits.value == fromUnits.value) {\n evalue = fromAmount\n // if (!fromAmount.value) {\n // debugger\n //}\n evalue.evalue = fromAmount.evalue || fromAmount.value\n } else {\n const formula = kms.formulas.api.get(toUnits, [fromUnits])\n if (!formula) {\n const reason = { marker: 'reason', focusableForPhrase: true, evalue: { marker: 'noconversion', from: fromUnits, to: toUnits } }\n kms.stm.api.remember({ context: reason })\n error(reason)\n }\n kms.stm.api.setVariable(fromUnits.value, fromAmount)\n evalue = await e(formula, where())\n }\n return evalue\n }\n\n if (!context.from.unit) {\n resolveEvaluate(context.from, await e(context.from, where()))\n }\n\n\n const from = toEValue(context.from)\n remember(context.to)\n const evalueNumerator = await convert(from.unit.numerator, from.amount, context.to.numerator)\n const evalueDenominator = await convert(from.unit.denominator, 1, context.to.denominator)\n const evalue = { evalue: (toFinalValue(evalueNumerator) || evalueNumerator.value) / (toFinalValue(evalueDenominator) || evalueDenominator.evalue) }\n context.evalue = {\n paraphrase: true,\n marker: 'quantity',\n level: 1,\n unit: context.to,\n amount: { evalue, paraphrase: undefined }\n }\n }"
24
24
  }
25
25
  ]
26
26
  }
package/common/rates.js CHANGED
@@ -55,13 +55,13 @@ const template = {
55
55
  error(reason)
56
56
  }
57
57
  kms.stm.api.setVariable(fromUnits.value, fromAmount)
58
- evalue = await e(formula)
58
+ evalue = await e(formula, where())
59
59
  }
60
60
  return evalue
61
61
  }
62
62
 
63
63
  if (!context.from.unit) {
64
- resolveEvaluate(context.from, await e(context.from))
64
+ resolveEvaluate(context.from, await e(context.from, where()))
65
65
  }
66
66
 
67
67
 
@@ -30,6 +30,7 @@
30
30
  },
31
31
  {
32
32
  "id": "add",
33
+ "where": "/home/dev/code/theprogrammablemind/kms/common/reminders.js:263",
33
34
  "isA": [
34
35
  "verb"
35
36
  ],
@@ -38,6 +39,7 @@
38
39
  },
39
40
  {
40
41
  "id": "remove",
42
+ "where": "/home/dev/code/theprogrammablemind/kms/common/reminders.js:272",
41
43
  "words": [
42
44
  "delete",
43
45
  "remove"
@@ -50,6 +52,7 @@
50
52
  },
51
53
  {
52
54
  "id": "addRemindable",
55
+ "where": "/home/dev/code/theprogrammablemind/kms/common/reminders.js:282",
53
56
  "isA": [
54
57
  "verb"
55
58
  ],
@@ -65,6 +68,7 @@
65
68
  },
66
69
  {
67
70
  "id": "remindResponseOnly",
71
+ "where": "/home/dev/code/theprogrammablemind/kms/common/reminders.js:297",
68
72
  "isA": [
69
73
  "verb"
70
74
  ],
@@ -75,6 +79,7 @@
75
79
  },
76
80
  {
77
81
  "id": "remindResponse",
82
+ "where": "/home/dev/code/theprogrammablemind/kms/common/reminders.js:314",
78
83
  "before": [
79
84
  "remindResponseOnly"
80
85
  ],
@@ -91,6 +96,7 @@
91
96
  },
92
97
  {
93
98
  "id": "remind",
99
+ "where": "/home/dev/code/theprogrammablemind/kms/common/reminders.js:335",
94
100
  "isA": [
95
101
  "verb"
96
102
  ],
@@ -116,6 +122,7 @@
116
122
  },
117
123
  {
118
124
  "id": "show",
125
+ "where": "/home/dev/code/theprogrammablemind/kms/common/reminders.js:376",
119
126
  "isA": [
120
127
  "verb"
121
128
  ],
@@ -124,6 +131,7 @@
124
131
  },
125
132
  {
126
133
  "id": "delete_reminders",
134
+ "where": "/home/dev/code/theprogrammablemind/kms/common/reminders.js:385",
127
135
  "isA": [
128
136
  "verb"
129
137
  ],
@@ -165,6 +173,7 @@
165
173
  },
166
174
  {
167
175
  "id": "add",
176
+ "where": "/home/dev/code/theprogrammablemind/kms/common/reminders.js:263",
168
177
  "isA": [
169
178
  "verb"
170
179
  ],
@@ -172,6 +181,7 @@
172
181
  },
173
182
  {
174
183
  "id": "remove",
184
+ "where": "/home/dev/code/theprogrammablemind/kms/common/reminders.js:272",
175
185
  "words": [
176
186
  "delete",
177
187
  "remove"
@@ -183,6 +193,7 @@
183
193
  },
184
194
  {
185
195
  "id": "addRemindable",
196
+ "where": "/home/dev/code/theprogrammablemind/kms/common/reminders.js:282",
186
197
  "isA": [
187
198
  "verb"
188
199
  ],
@@ -197,6 +208,7 @@
197
208
  },
198
209
  {
199
210
  "id": "remindResponseOnly",
211
+ "where": "/home/dev/code/theprogrammablemind/kms/common/reminders.js:297",
200
212
  "isA": [
201
213
  "verb"
202
214
  ],
@@ -206,6 +218,7 @@
206
218
  },
207
219
  {
208
220
  "id": "remindResponse",
221
+ "where": "/home/dev/code/theprogrammablemind/kms/common/reminders.js:314",
209
222
  "before": [
210
223
  "remindResponseOnly"
211
224
  ],
@@ -221,6 +234,7 @@
221
234
  },
222
235
  {
223
236
  "id": "remind",
237
+ "where": "/home/dev/code/theprogrammablemind/kms/common/reminders.js:335",
224
238
  "isA": [
225
239
  "verb"
226
240
  ],
@@ -247,6 +261,7 @@
247
261
  },
248
262
  {
249
263
  "id": "show",
264
+ "where": "/home/dev/code/theprogrammablemind/kms/common/reminders.js:376",
250
265
  "isA": [
251
266
  "verb"
252
267
  ],
@@ -254,6 +269,7 @@
254
269
  },
255
270
  {
256
271
  "id": "delete_reminders",
272
+ "where": "/home/dev/code/theprogrammablemind/kms/common/reminders.js:385",
257
273
  "isA": [
258
274
  "verb"
259
275
  ],
@@ -1,4 +1,4 @@
1
- const { knowledgeModule, where } = require('./runtime').theprogrammablemind
1
+ const { knowledgeModule, where, debug } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const reminders_tests = require('./reminders.test.json')
4
4
  const instance = require('./reminders.instance.json')
@@ -49,11 +49,6 @@ function query(missing, reminder_id) {
49
49
  enable(['remindResponseOnly', 0])
50
50
  }
51
51
 
52
- /*
53
- if (item.missingDate && item.missingReminder) {
54
- enable(['remindResponse', 0])
55
- }
56
- */
57
52
  if (item.missingDate && missing == 'missingDate') {
58
53
  return `When should I remind ${who} to ${item.text}`
59
54
  }
@@ -85,6 +80,7 @@ function query(missing, reminder_id) {
85
80
  await api.update({ id: item.id, text })
86
81
  } else {
87
82
  const item = api.missing(missing, reminder_id)
83
+ context.topLevel = false
88
84
  await api.update({ id: item.id, dateTimeSelector: context, dateTimeSelectorText: await gp(context) })
89
85
  }
90
86
  }
@@ -264,6 +260,7 @@ const template = {
264
260
  },
265
261
  {
266
262
  id: 'add',
263
+ where: where(),
267
264
  isA: ['verb'],
268
265
  bridge: "{ ...next(operator), complete: true, arg: after[0], operator: operator, interpolate: '${operator} ${arg}' }",
269
266
  semantic: ({api, context}) => {
@@ -272,6 +269,7 @@ const template = {
272
269
  },
273
270
  {
274
271
  id: 'remove',
272
+ where: where(),
275
273
  words: ['delete', 'remove'],
276
274
  isA: ['verb'],
277
275
  bridge: "{ ...next(operator), complete: true, arg: after[0], operator: operator, interpolate: '${operator} ${arg}' }",
@@ -281,6 +279,7 @@ const template = {
281
279
  },
282
280
  {
283
281
  id: 'addRemindable',
282
+ where: where(),
284
283
  isA: ['verb'],
285
284
  scope: "testing",
286
285
  bridge: "{ ...next(operator), complete: true, flatten: true, arg: after[0], operator: operator, interpolate: '${operator} ${arg}' }",
@@ -295,6 +294,7 @@ const template = {
295
294
  },
296
295
  {
297
296
  id: 'remindResponseOnly',
297
+ where: where(),
298
298
  isA: ['verb'],
299
299
  convolution: true,
300
300
  disabled: true,
@@ -311,6 +311,7 @@ const template = {
311
311
  },
312
312
  {
313
313
  id: 'remindResponse',
314
+ where: where(),
314
315
  before: ['remindResponseOnly'],
315
316
  isA: ['verb'],
316
317
  convolution: true,
@@ -331,6 +332,7 @@ const template = {
331
332
  },
332
333
  {
333
334
  id: 'remind',
335
+ where: where(),
334
336
  isA: ['verb'],
335
337
  localHierarchy: [['self', 'remindable']],
336
338
  bridge: "{ ...next(operator), complete: true, operator: operator, who: after[0], reminder: after[1], interpolate: '${operator} ${who} ${reminder}' }",
@@ -371,6 +373,7 @@ const template = {
371
373
  },
372
374
  {
373
375
  id: 'show',
376
+ where: where(),
374
377
  isA: ['verb'],
375
378
  bridge: "{ ...next(operator), operator: operator, complete: true, reminders: after[0], interpolate: '${operator} ${reminders}' }",
376
379
  semantic: ({context, api, verbatim}) => {
@@ -379,6 +382,7 @@ const template = {
379
382
  },
380
383
  {
381
384
  id: 'delete_reminders',
385
+ where: where(),
382
386
  isA: ['verb'],
383
387
  bridge: "{ ...next(operator), operator: operator, complete: true, reminders: after[0], interpolate: '${operator} ${reminders}' }",
384
388
  semantic: ({context, api, verbatim}) => {
@@ -412,22 +416,22 @@ knowledgeModule( {
412
416
  name: './reminders.test.json',
413
417
  contents: reminders_tests,
414
418
  checks: {
415
- context: [defaultContextCheck({ extra: ['who', 'reminder'] })],
419
+ context: [
420
+ {
421
+ match: ({ path, pathEquals }) => pathEquals(path, ['reminders', '*']),
422
+ apply: () => ['dateTimeSelector', 'text', 'nextISODate', 'who', 'reminder'],
423
+ },
424
+ ],
416
425
  objects: [
417
426
  {
418
427
  property: 'reminders',
419
- check: [
420
- 'text',
421
- 'dateTimeSelectorText',
422
- 'nextISODate',
423
- 'who',
424
- 'stm',
425
- {
426
- property: 'dateTimeSelector',
427
- check: ['marker', 'text', 'value'],
428
- },
429
- ],
430
- }
428
+ check: [
429
+ {
430
+ property: (key) => typeof key == 'number',
431
+ check: ['text', 'who', 'dateTimeSelector', 'dateTimeSelectorText', 'nextISODate', 'id'],
432
+ }
433
+ ]
434
+ },
431
435
  ],
432
436
  },
433
437
  },