tpmkms 9.6.3-beta.2 → 9.6.3-beta.21

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 (55) hide show
  1. package/common/actions.instance.json +130 -5
  2. package/common/actions.js +54 -4
  3. package/common/actions.test.json +31359 -322
  4. package/common/angle.instance.json +58 -834
  5. package/common/articles.js +1 -2
  6. package/common/compass.instance.json +3 -18
  7. package/common/concept.js +2 -1
  8. package/common/conjunction.js +11 -17
  9. package/common/dialogues.js +3 -3
  10. package/common/dimension.instance.json +4 -69
  11. package/common/dimension.js +5 -5
  12. package/common/drone.instance.json +14985 -2538
  13. package/common/drone.js +276 -61
  14. package/common/drone.test.json +412474 -28440
  15. package/common/drone_v1.instance.json +324 -44
  16. package/common/drone_v1.js +9 -9
  17. package/common/edible.instance.json +72 -0
  18. package/common/fastfood.instance.json +5 -72
  19. package/common/fastfood.js +1 -1
  20. package/common/formulas.instance.json +0 -5
  21. package/common/formulas.js +1 -1
  22. package/common/gdefaults.js +16 -5
  23. package/common/helpers/conjunction.js +2 -0
  24. package/common/helpers/formulas.js +6 -0
  25. package/common/helpers/properties.js +9 -7
  26. package/common/helpers.js +9 -5
  27. package/common/hierarchy.js +2 -0
  28. package/common/length.instance.json +555 -5686
  29. package/common/math.instance.json +10 -12
  30. package/common/math.js +6 -5
  31. package/common/menus.instance.json +0 -35
  32. package/common/meta.js +1 -1
  33. package/common/nameable.js +7 -9
  34. package/common/ordinals.js +51 -5
  35. package/common/pipboy.instance.json +0 -85
  36. package/common/pipboy.js +1 -1
  37. package/common/pressure.instance.json +28 -370
  38. package/common/properties.js +4 -3
  39. package/common/rates.instance.json +1 -1
  40. package/common/rates.js +3 -3
  41. package/common/reminders.js +1 -1
  42. package/common/reports.instance.json +9 -176
  43. package/common/reports.js +2 -2
  44. package/common/scorekeeper.js +1 -1
  45. package/common/sdefaults.js +40 -5
  46. package/common/stm.js +50 -42
  47. package/common/temperature.instance.json +648 -2303
  48. package/common/time.instance.json +7376 -1965
  49. package/common/time.js +22 -1
  50. package/common/time.test.json +13239 -0
  51. package/common/ui.instance.json +0 -5
  52. package/common/ui.js +1 -1
  53. package/common/weight.instance.json +329 -1834
  54. package/common/wp.instance.json +88 -70
  55. package/package.json +3 -3
@@ -93420,6 +93420,11 @@
93420
93420
  "context_index": 1,
93421
93421
  "topLevel": true,
93422
93422
  "context_id": 2,
93423
+ "control": {
93424
+ "seen": [],
93425
+ "nextId": 2
93426
+ },
93427
+ "control_id": 1,
93423
93428
  "touchedBy": [
93424
93429
  "fastfood#call2"
93425
93430
  ]
@@ -114677,24 +114682,6 @@
114677
114682
  0
114678
114683
  ]
114679
114684
  ],
114680
- [
114681
- [
114682
- "ingredient",
114683
- 0
114684
- ],
114685
- [
114686
- "is",
114687
- 0
114688
- ],
114689
- [
114690
- "list",
114691
- 1
114692
- ],
114693
- [
114694
- "smoothie",
114695
- 0
114696
- ]
114697
- ],
114698
114685
  [
114699
114686
  [
114700
114687
  "ingredient",
@@ -340122,24 +340109,6 @@
340122
340109
  0
340123
340110
  ]
340124
340111
  ],
340125
- [
340126
- [
340127
- "a",
340128
- 0
340129
- ],
340130
- [
340131
- "go_wrap",
340132
- 0
340133
- ],
340134
- [
340135
- "is",
340136
- 0
340137
- ],
340138
- [
340139
- "sandwich",
340140
- 0
340141
- ]
340142
- ],
340143
340112
  [
340144
340113
  [
340145
340114
  "go_wrap",
@@ -627587,24 +627556,6 @@
627587
627556
  0
627588
627557
  ]
627589
627558
  ],
627590
- [
627591
- [
627592
- "a",
627593
- 0
627594
- ],
627595
- [
627596
- "go_wrap",
627597
- 0
627598
- ],
627599
- [
627600
- "is",
627601
- 0
627602
- ],
627603
- [
627604
- "sandwich",
627605
- 0
627606
- ]
627607
- ],
627608
627559
  [
627609
627560
  [
627610
627561
  "a",
@@ -632645,24 +632596,6 @@
632645
632596
  0
632646
632597
  ]
632647
632598
  ],
632648
- [
632649
- [
632650
- "ingredient",
632651
- 0
632652
- ],
632653
- [
632654
- "is",
632655
- 0
632656
- ],
632657
- [
632658
- "list",
632659
- 1
632660
- ],
632661
- [
632662
- "smoothie",
632663
- 0
632664
- ]
632665
- ],
632666
632599
  [
632667
632600
  [
632668
632601
  "ingredient",
@@ -893,7 +893,7 @@ class State {
893
893
  }
894
894
 
895
895
  this.api.add(item)
896
- this.api.args.mentioned({ context: food })
896
+ this.api.args.remember({ context: food })
897
897
 
898
898
  for (const addIt of addsInsteadOfModifications) {
899
899
  this.add(addIt)
@@ -547,11 +547,6 @@
547
547
  "concept",
548
548
  false
549
549
  ],
550
- [
551
- "mathematicalExpression",
552
- "number",
553
- false
554
- ],
555
550
  [
556
551
  "mathematical_operator",
557
552
  "adjective",
@@ -1,4 +1,4 @@
1
- const { knowledgeModule, where, Digraph } = require('./runtime').theprogrammablemind
1
+ const { knowledgeModule, where, Digraph, debug } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const dialogues = require('./dialogues.js')
4
4
  const pos = require('./pos.js')
@@ -319,6 +319,7 @@ function initializer({config}) {
319
319
  if (Array.isArray(interpolate)) {
320
320
  const strings = []
321
321
  let separator = ''
322
+ const byPosition = []
322
323
  for (const element of interpolate) {
323
324
  // { "word": { "marker": "canPassive" } ie { word: <selectionCriteria> }
324
325
  if (element.word) {
@@ -363,13 +364,20 @@ function initializer({config}) {
363
364
  if (element.context) {
364
365
  value = { ...value, ...element.context }
365
366
  }
366
- strings.push(separator)
367
- if (Array.isArray(value)) {
368
- strings.push(await args.gsp(value))
367
+ async function handleProperty(value) {
368
+ strings.push(separator)
369
+ if (Array.isArray(value)) {
370
+ strings.push(await args.gsp(value))
371
+ } else {
372
+ strings.push(await args.gp(value))
373
+ }
374
+ separator = ' '
375
+ }
376
+ if (element.byPosition) {
377
+ byPosition.push(((value) => () => handleProperty(value))(value))
369
378
  } else {
370
- strings.push(await args.gp(value))
379
+ await handleProperty(value)
371
380
  }
372
- separator = ' '
373
381
  }
374
382
  } else if (element.context) {
375
383
  let value = element.context
@@ -390,6 +398,9 @@ function initializer({config}) {
390
398
  }
391
399
  }
392
400
  }
401
+ for (const bp of byPosition) {
402
+ await bp()
403
+ }
393
404
  return strings.join('')
394
405
  } else {
395
406
  return await helpers.processTemplateString(interpolate, evaluator)
@@ -5,6 +5,7 @@ function asList(context, maybe=false) {
5
5
  return {
6
6
  marker: 'list',
7
7
  // types: [context.marker],
8
+ listable: true,
8
9
  value: context
9
10
  }
10
11
  } else if (context.marker === 'list') {
@@ -15,6 +16,7 @@ function asList(context, maybe=false) {
15
16
  } else {
16
17
  return {
17
18
  marker: 'list',
19
+ listable: true,
18
20
  types: [context.marker],
19
21
  value: [context]
20
22
  }
@@ -97,6 +97,7 @@ class API {
97
97
  }
98
98
 
99
99
  gets(name) {
100
+ // debugger
100
101
  if (!this._objects.formulas[name.value]) {
101
102
  return []
102
103
  }
@@ -131,6 +132,11 @@ class API {
131
132
 
132
133
  // currently only supportings x = f(x) type formulas
133
134
  add(name, formula, equality) {
135
+ /*
136
+ if (name.value == 'minute' || name.value == 'minutes') {
137
+ debugger
138
+ }
139
+ */ // greg66
134
140
  if (!this._objects.formulas[name.value]) {
135
141
  this._objects.formulas[name.value] = []
136
142
  }
@@ -170,7 +170,7 @@ class API {
170
170
  }
171
171
  const selected = instance.evalue.value.map( (r) => r[property] )
172
172
  context.constraints = undefined;
173
- context.evalue = { marker: 'list', value: selected }
173
+ context.evalue = { marker: 'list', listable: true, value: selected }
174
174
  },
175
175
  })
176
176
  config.addGenerator({
@@ -575,9 +575,9 @@ class API {
575
575
  const response = _.clone(context)
576
576
  response.isResponse = true
577
577
  response.query = undefined
578
- context.evalue = { marker: 'list', value: [response] }
578
+ context.evalue = { marker: 'list', listable: true, value: [response] }
579
579
  } else {
580
- context.evalue = { marker: 'list', value: unflatten(matches) }
580
+ context.evalue = { marker: 'list', listable: true, value: unflatten(matches) }
581
581
  context.evalue.isResponse = true
582
582
  }
583
583
  context.evalue.truthValue = matches.length > 0
@@ -588,8 +588,8 @@ class API {
588
588
  }
589
589
 
590
590
  // ADD this line back and remove it to check
591
- // context.response = { marker: 'list', value: [response], isResponse: true }
592
- // Object.assign(context, { marker: 'list', value: responses, focusable: ['value'], paraphrase: true, truthValue: matches.length > 0 })
591
+ // context.response = { marker: 'list', listable: true, value: [response], isResponse: true }
592
+ // Object.assign(context, { marker: 'list', listable: true, value: responses, focusable: ['value'], paraphrase: true, truthValue: matches.length > 0 })
593
593
  } else {
594
594
  // see if anything is preferred greg
595
595
  // what does greg like
@@ -598,7 +598,7 @@ class API {
598
598
  // Object.assign(context, { marker: 'idontknow', query: _.clone(context) })
599
599
  context.evalue = { marker: 'idontknow', query: _.clone(context), isResponse: true }
600
600
  } else {
601
- context.evalue = { marker: 'list', value: matches, isResponse: true }
601
+ context.evalue = { marker: 'list', listable: true, value: matches, isResponse: true }
602
602
  }
603
603
  context.isResponse = true
604
604
  context.evalue.truthValue = matches.length > 0 && matches[0].marker == ordering.marker
@@ -641,12 +641,14 @@ class API {
641
641
  const api = km('properties').api
642
642
  context.evalue = {
643
643
  marker: 'list',
644
+ listable: true,
644
645
  value: unflatten(api.relation_get(context, before.concat(after).map( (arg) => arg.tag ) ))
645
646
  }
646
647
  context.evalue.isResponse = true
647
648
  context.isResponse = true
648
649
  if (context.evalue.value.length == 0) {
649
650
  context.evalue.marker = 'answerNotKnown';
651
+ context.evalue.listable = true
650
652
  context.evalue.value = [];
651
653
  } else {
652
654
  // context.evalue.truthValue = true
@@ -815,7 +817,7 @@ class API {
815
817
  values.push(`${await g(key)}: ${await g({ ...objectProps[key].value, paraphrase: true })}`)
816
818
  }
817
819
  }
818
- return { marker: 'list', value: values }
820
+ return { marker: 'list', listable: true, value: values }
819
821
  } else {
820
822
  return (await this.propertiesFH.getValue([object, property])).value
821
823
  }
package/common/helpers.js CHANGED
@@ -161,12 +161,15 @@ function focus(context) {
161
161
  // fromList
162
162
  function propertyToArray(value) {
163
163
  if (Array.isArray(value)) {
164
- return value
165
- } else if (value.marker == 'list') {
166
- return value.value
167
- } else {
168
- return [value]
164
+ return value;
165
+ }
166
+
167
+ if (value?.listable || value?.marker == 'list') {
168
+ return value.value.flatMap(item => propertyToArray(item));
169
169
  }
170
+
171
+ // Single value → wrap in array
172
+ return [value];
170
173
  }
171
174
 
172
175
  // values is marker: 'list' or some context
@@ -181,6 +184,7 @@ function concats(values) {
181
184
  }
182
185
  return {
183
186
  marker: 'list',
187
+ listable: true,
184
188
  value: combined
185
189
  }
186
190
  }
@@ -24,6 +24,7 @@ function getTypes( km, digraph, concept, instance ) {
24
24
  instance = {
25
25
  marker: 'list',
26
26
  value: words,
27
+ listable: true,
27
28
  paraphrase: true,
28
29
  }
29
30
  instance.focus = true
@@ -278,6 +279,7 @@ const config = {
278
279
  const values = children.map( (t) => conceptApi.getWordForValue(t, { number: isA(type, 'concept') ? 'one' : 'many'}))
279
280
  context.evalue = {
280
281
  marker: 'list',
282
+ listable: true,
281
283
  value: values,
282
284
  }
283
285
  if (children.length > 1) {