tpmkms_4wp 9.5.1-beta.9 → 9.6.0-beta.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 (114) hide show
  1. package/common/animals.instance.json +130 -0
  2. package/common/animals.js +3 -5
  3. package/common/asking.js +12 -4
  4. package/common/avatar.test.json +1001 -860
  5. package/common/can.instance.json +2182 -5
  6. package/common/can.js +102 -39
  7. package/common/can.test.json +51307 -0
  8. package/common/colors.instance.json +142 -30
  9. package/common/colors.js +3 -6
  10. package/common/comparable.instance.json +31 -1
  11. package/common/comparable.js +3 -6
  12. package/common/concept.js +25 -27
  13. package/common/concept.test.json +142 -120
  14. package/common/conjunction.test.json +32 -42
  15. package/common/crew.instance.json +400 -126
  16. package/common/crew.js +3 -6
  17. package/common/dateTimeSelectors.instance.json +2 -2
  18. package/common/dateTimeSelectors.js +6 -9
  19. package/common/dateTimeSelectors.test.json +76935 -35739
  20. package/common/dates.instance.json +50 -84
  21. package/common/dates.js +3 -6
  22. package/common/dates.test.json +284 -287
  23. package/common/dialogues.js +33 -115
  24. package/common/dialogues.test.json +1248 -1152
  25. package/common/dimension.instance.json +21498 -566
  26. package/common/dimension.js +147 -52
  27. package/common/dimension.test.json +10979 -4625
  28. package/common/drone.instance.json +24709 -0
  29. package/common/drone.js +662 -0
  30. package/common/drone.test.json +30522 -0
  31. package/common/drone_v1.instance.json +24703 -0
  32. package/common/drone_v1.js +596 -0
  33. package/common/drone_v1.test.json +115538 -0
  34. package/common/edible.instance.json +365 -65
  35. package/common/edible.js +3 -5
  36. package/common/emotions.instance.json +57 -70
  37. package/common/emotions.js +3 -6
  38. package/common/errors.js +3 -3
  39. package/common/fastfood.instance.json +1270 -244
  40. package/common/fastfood.js +10 -12
  41. package/common/fastfood.test.json +6970 -6829
  42. package/common/formulas.instance.json +10 -0
  43. package/common/formulas.js +2 -1
  44. package/common/gdefaults.js +58 -13
  45. package/common/help.js +9 -9
  46. package/common/help.test.json +65 -11
  47. package/common/helpers/dialogues.js +9 -1
  48. package/common/helpers/properties.js +37 -18
  49. package/common/helpers.js +32 -2
  50. package/common/hierarchy.js +10 -8
  51. package/common/kirk.instance.json +10 -0
  52. package/common/kirk.js +4 -6
  53. package/common/kirk.test.json +600 -424
  54. package/common/latin.instance.json +10 -10
  55. package/common/latin.js +8 -10
  56. package/common/length.instance.json +34659 -3157
  57. package/common/length.js +11 -6
  58. package/common/length.test.json +54357 -2557
  59. package/common/math.instance.json +11 -1
  60. package/common/math.js +2 -1
  61. package/common/menus.instance.json +74 -7
  62. package/common/menus.js +3 -12
  63. package/common/meta.js +4 -5
  64. package/common/nameable.js +29 -15
  65. package/common/nameable.test.json +436 -0
  66. package/common/numbers.js +1 -1
  67. package/common/ordering.instance.json +24 -2
  68. package/common/ordering.js +3 -5
  69. package/common/ordering.test.json +104 -174
  70. package/common/people.instance.json +140 -315
  71. package/common/people.js +3 -5
  72. package/common/pipboy.instance.json +171 -57
  73. package/common/pipboy.js +2 -1
  74. package/common/pokemon.instance.json +135 -5
  75. package/common/pokemon.js +3 -5
  76. package/common/pressure.instance.json +3990 -1981
  77. package/common/pressure.js +3 -5
  78. package/common/pressure.test.json +433 -477
  79. package/common/properties.instance.json +15 -16
  80. package/common/properties.js +10 -9
  81. package/common/properties.test.json +9565 -6951
  82. package/common/rates.instance.json +59 -0
  83. package/common/rates.js +95 -0
  84. package/common/rates.test.json +27702 -0
  85. package/common/reminders.js +5 -8
  86. package/common/reminders.test.json +64635 -25787
  87. package/common/reports.instance.json +22 -2
  88. package/common/reports.js +3 -5
  89. package/common/scorekeeper.js +3 -6
  90. package/common/spock.instance.json +10 -0
  91. package/common/spock.js +4 -7
  92. package/common/spock.test.json +606 -430
  93. package/common/stm.js +37 -20
  94. package/common/temperature.instance.json +3162 -1153
  95. package/common/temperature.js +3 -5
  96. package/common/temperature.test.json +433 -477
  97. package/common/time.instance.json +24852 -0
  98. package/common/time.js +136 -139
  99. package/common/time.test.json +31876 -3757
  100. package/common/ui.instance.json +12 -5
  101. package/common/ui.js +4 -13
  102. package/common/weight.instance.json +10500 -4098
  103. package/common/weight.js +3 -5
  104. package/common/weight.test.json +2601 -2263
  105. package/common/words.instance.json +9 -0
  106. package/common/words.js +50 -0
  107. package/common/words.test.json +2 -0
  108. package/common/wp.instance.json +470 -58
  109. package/common/wp.js +6 -4
  110. package/common/wp.test.json +7385 -6906
  111. package/main.js +6 -2
  112. package/package.json +21 -6
  113. package/common/listener.js +0 -50
  114. package/common/listener.test.json +0 -142
package/common/helpers.js CHANGED
@@ -188,6 +188,7 @@ function defaultObjectCheck(extra = []) {
188
188
  return {
189
189
  objects: [
190
190
  {
191
+ extra,
191
192
  match: ({objects}) => true,
192
193
  apply: () => extra
193
194
  },
@@ -204,9 +205,9 @@ function defaultContextCheck({marker, extra = [], exported = false} = {}) {
204
205
  if (marker) {
205
206
  match = ({context}) => context.marker == marker
206
207
  } else {
207
- match = ({context}) => !Array.isArray(context)
208
208
  }
209
209
  return {
210
+ marker,
210
211
  match,
211
212
  exported,
212
213
  apply: () => ['marker', 'text', 'verbatim', 'value', 'evalue', 'isResponse', { properties: 'modifiers' }, { properties: 'postModifiers' }, ...extra],
@@ -247,7 +248,10 @@ function getValue(propertyPath, object) {
247
248
  if (!propertyPath) {
248
249
  return
249
250
  }
250
- const path = propertyPath.split('.')
251
+ let path = propertyPath
252
+ if (typeof path == 'string') {
253
+ path = propertyPath.split('.')
254
+ }
251
255
  let value = object
252
256
  for (const name of path) {
253
257
  if (!value) {
@@ -258,6 +262,29 @@ function getValue(propertyPath, object) {
258
262
  return value
259
263
  }
260
264
 
265
+ function setValue(propertyPath, object, newValue) {
266
+ if (!propertyPath) {
267
+ return;
268
+ }
269
+ let path = propertyPath;
270
+ if (typeof path === 'string') {
271
+ path = propertyPath.split('.');
272
+ }
273
+ let current = object;
274
+ for (let i = 0; i < path.length; i++) {
275
+ const name = path[i];
276
+ if (i === path.length - 1) {
277
+ // Set the value at the final step
278
+ current[name] = newValue;
279
+ break;
280
+ }
281
+ if (current[name] === undefined || current[name] === null) {
282
+ current[name] = {}; // Create a plain object for nesting
283
+ }
284
+ current = current[name];
285
+ }
286
+ }
287
+
261
288
  async function processTemplateString(template, evaluate) {
262
289
  async function resolveWithCallback(strings, ...keys) {
263
290
  // const resolvedValues = await Promise.all(keys.map(key => lookupVariable(key)));
@@ -354,7 +381,10 @@ module.exports = {
354
381
  processTemplateString,
355
382
  unshiftL,
356
383
  pushL,
384
+
357
385
  getValue,
386
+ setValue,
387
+
358
388
  defaultContextCheck,
359
389
  defaultContextCheckProperties,
360
390
  defaultObjectCheck,
@@ -1,4 +1,4 @@
1
- const { knowledgeModule, where } = require('./runtime').theprogrammablemind
1
+ const { debug, 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')
@@ -6,14 +6,14 @@ const pluralize = require('pluralize')
6
6
  const _ = require('lodash')
7
7
  const { isMany } = require('./helpers')
8
8
 
9
- function getTypes( km, concept, instance ) {
10
- const propertiesAPI = km('properties').api;
9
+ function getTypes( km, digraph, concept, instance ) {
10
+ // const propertiesAPI = km('properties').api;
11
11
  const conceptAPI = km('concept').api;
12
- const digraph = propertiesAPI.digraph;
12
+ // const digraph = propertiesAPI.digraph;
13
13
  function intersect(set1, set2) {
14
14
  return new Set([...set1].filter(x => set2.has(x)))
15
15
  }
16
- const descendants = digraph.descendants(concept.value)
16
+ const descendants = digraph.descendants(concept.value || concept.marker)
17
17
  const ancestors = digraph.ancestors(instance.evalue)
18
18
  const common = intersect(ancestors, descendants)
19
19
  const answer = Array.from(digraph.minima(common))
@@ -79,7 +79,7 @@ const config = {
79
79
  context.isResponse = true
80
80
  return
81
81
  }
82
- instance = getTypes(km, concept, instance)
82
+ instance = getTypes(km, hierarchy, concept, instance)
83
83
 
84
84
  concept = _.cloneDeep(value)
85
85
  concept.isQuery = undefined
@@ -104,7 +104,7 @@ const config = {
104
104
  notes: 'type of pikachu', // the types of type is the next one
105
105
  where: where(),
106
106
  match: ({context}) => context.marker == 'type' && context.evaluate && context.object && context.objects[context.objects.length-1].number == 'one' && pluralize.isSingular(context.objects[0].word),
107
- apply: async ({context, objects, e, gs, km, log}) => {
107
+ apply: async ({context, hierarchy, objects, e, gs, km, log}) => {
108
108
  const concept = context.objects[0];
109
109
  const value = context.objects[1];
110
110
  let instance = await e(value)
@@ -112,7 +112,7 @@ const config = {
112
112
  context.evalue = { verbatim: instance.verbatim }
113
113
  return
114
114
  }
115
- instance = getTypes(km, concept, instance)
115
+ instance = getTypes(km, hierarchy, concept, instance)
116
116
  context.evalue = instance
117
117
  if (context.evalue.value.length > 1) {
118
118
  context.number = 'many'
@@ -253,9 +253,11 @@ const config = {
253
253
  const twoConcepts = asList(context.same);
254
254
  for (const oneConcept of oneConcepts.value) {
255
255
  for (const twoConcept of twoConcepts.value) {
256
+ // debug.counter('greg23', { breakAt: 39 })
256
257
  oneConceptId = await api.makeObject({...args, context: oneConcept})
257
258
  twoConceptId = await api.makeObject({...args, context: twoConcept})
258
259
  api.rememberIsA(oneConceptId, twoConceptId)
260
+ api.seenHierarchyWatcher({ childId: oneConceptId, child: oneConcept, parentId: twoConceptId, parent: twoConcept })
259
261
  context.sameWasProcessed = true
260
262
  }
261
263
  }
@@ -1405,6 +1405,16 @@
1405
1405
  "adjective",
1406
1406
  false
1407
1407
  ],
1408
+ [
1409
+ "stm_current",
1410
+ "adjective",
1411
+ false
1412
+ ],
1413
+ [
1414
+ "stm_previous",
1415
+ "adjective",
1416
+ false
1417
+ ],
1408
1418
  [
1409
1419
  "that",
1410
1420
  "thisitthat",
package/common/kirk.js CHANGED
@@ -2,7 +2,7 @@ const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const crew = require('./crew')
4
4
  const kirk_tests = require('./kirk.test.json')
5
- const kirk_instance = require('./kirk.instance.json')
5
+ const instance = require('./kirk.instance.json')
6
6
 
7
7
  const template = {
8
8
  configs: [
@@ -14,7 +14,7 @@ const template = {
14
14
  // TODO what is the name of you
15
15
  // TODO crew members -> who are the crew members
16
16
 
17
- kirk_instance.base = 'crew'
17
+ instance.base = 'crew'
18
18
 
19
19
  // config.load(template, kirk_instance)
20
20
  knowledgeModule( {
@@ -30,8 +30,6 @@ knowledgeModule( {
30
30
  context: [defaultContextCheck()],
31
31
  }
32
32
  },
33
- template: {
34
- template,
35
- instance: kirk_instance,
36
- },
33
+ instance,
34
+ template,
37
35
  })