tpmkms 9.8.0 → 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 (95) hide show
  1. package/common/actions.instance.json +10 -8
  2. package/common/actions.js +13 -11
  3. package/common/angle.instance.json +25 -17
  4. package/common/animals.instance.json +54 -28
  5. package/common/askfor.instance.json +89 -192
  6. package/common/askfor.js +49 -12
  7. package/common/asking.js +13 -5
  8. package/common/avatar.js +3 -3
  9. package/common/can.instance.json +32 -20
  10. package/common/can.js +2 -2
  11. package/common/colors.instance.json +44 -16
  12. package/common/colors.js +1 -1
  13. package/common/comparable.instance.json +25 -22
  14. package/common/compass.instance.json +9 -3
  15. package/common/concept.instance.json +14 -6
  16. package/common/concept.js +2 -0
  17. package/common/conjunction.js +17 -9
  18. package/common/control.js +10 -18
  19. package/common/countable.js +4 -3
  20. package/common/crew.instance.json +95 -27
  21. package/common/dateTimeSelectors.instance.json +4 -4
  22. package/common/dateTimeSelectors.js +4 -7
  23. package/common/dates.instance.json +52 -28
  24. package/common/dates.js +16 -11
  25. package/common/debug.instance.json +48 -0
  26. package/common/debug.js +50 -0
  27. package/common/debug.test.json +1 -0
  28. package/common/dialogues.js +126 -70
  29. package/common/dimension.instance.json +239 -495
  30. package/common/dimension.js +51 -9
  31. package/common/drone.instance.json +395 -84
  32. package/common/drone.js +43 -50
  33. package/common/drone_v1.instance.json +36 -12
  34. package/common/drone_v1.js +14 -9
  35. package/common/edible.instance.json +96 -32
  36. package/common/emotions.instance.json +15 -1
  37. package/common/evaluate.js +10 -13
  38. package/common/fastfood.instance.json +282 -100
  39. package/common/fastfood.js +30 -15
  40. package/common/formulas.instance.json +162 -24
  41. package/common/formulas.js +18 -9
  42. package/common/gdefaults.js +20 -96
  43. package/common/helpers/concept.js +2 -9
  44. package/common/helpers/conjunction.js +11 -1
  45. package/common/helpers/dialogues.js +48 -24
  46. package/common/helpers/gdefaults.js +15 -5
  47. package/common/helpers/properties.js +125 -326
  48. package/common/helpers.js +28 -58
  49. package/common/hierarchy.js +71 -41
  50. package/common/kirk.instance.json +3 -1
  51. package/common/latin.instance.json +10 -10
  52. package/common/latin.js +5 -5
  53. package/common/length.instance.json +247 -61
  54. package/common/math.instance.json +144 -5
  55. package/common/math.js +18 -5
  56. package/common/menus.instance.json +29 -11
  57. package/common/menus.js +8 -5
  58. package/common/meta.js +14 -13
  59. package/common/nameable.js +9 -5
  60. package/common/numbers.instance.json +5 -3
  61. package/common/numbers.js +28 -28
  62. package/common/ordering.instance.json +53 -4
  63. package/common/ordinals.js +25 -25
  64. package/common/people.instance.json +66 -12
  65. package/common/percentages.js +4 -2
  66. package/common/pipboy.instance.json +89 -44
  67. package/common/pipboy.js +21 -14
  68. package/common/pokemon.instance.json +39 -13
  69. package/common/pressure.instance.json +14 -6
  70. package/common/properties.instance.json +2370 -511
  71. package/common/properties.js +496 -78
  72. package/common/punctuation.js +1 -0
  73. package/common/rates.instance.json +2 -2
  74. package/common/rates.js +3 -3
  75. package/common/reminders.instance.json +16 -0
  76. package/common/reminders.js +24 -20
  77. package/common/reports.instance.json +11 -12
  78. package/common/reports.js +12 -12
  79. package/common/scorekeeper.js +20 -10
  80. package/common/sdefaults.js +30 -9
  81. package/common/spock.instance.json +3 -1
  82. package/common/stm.js +16 -21
  83. package/common/temperature.instance.json +19 -11
  84. package/common/testing.js +2 -2
  85. package/common/time.instance.json +104 -47
  86. package/common/time.js +9 -8
  87. package/common/ui.instance.json +4 -2
  88. package/common/ui.js +5 -5
  89. package/common/weight.instance.json +86 -21
  90. package/common/weight.js +5 -1
  91. package/common/words.js +113 -2
  92. package/common/wp.instance.json +125 -18
  93. package/common/wp.js +6 -2
  94. package/main.js +2 -0
  95. package/package.json +7 -3
@@ -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,
@@ -19,8 +19,8 @@
19
19
  ],
20
20
  "semantics": [
21
21
  {
22
- "match": "({context}) => context.marker == 'convertToUnits' && context.evaluate && (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 }"
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, 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
@@ -36,7 +36,7 @@ const template = {
36
36
  semantics: [
37
37
  {
38
38
  where: where(),
39
- match: ({context}) => context.marker == 'convertToUnits' && context.evaluate && (context.from?.unit?.marker == 'unitPerUnit' || context.to.marker == 'unitPerUnit'),
39
+ match: ({context}) => context.marker == 'convertToUnits' && (context.from?.unit?.marker == 'unitPerUnit' || context.to.marker == 'unitPerUnit'),
40
40
  apply: async ({remember, context, kms, e, callId, resolveEvaluate, toEValue, error}) => {
41
41
 
42
42
  async function convert(fromUnits, fromAmount, toUnits) {
@@ -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
  }
@@ -64,7 +59,7 @@ function query(missing, reminder_id) {
64
59
  },
65
60
 
66
61
  matchr: async ({ isA, api, context }) => {
67
- if (context.evaluate || context.isControl || context.isResponse) {
62
+ if (context.isControl || context.isResponse) {
68
63
  return false
69
64
  }
70
65
  const gotADate = ((isA(context.marker, 'onDateValue_dates') || isA(context.marker, 'dateTimeSelector')) && api.missing(missing, reminder_id))
@@ -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
  },