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
@@ -79,6 +79,7 @@ class API {
79
79
  config.addOperator(`([${dimension}])`)
80
80
  config.addBridge({
81
81
  id: dimension,
82
+ where: where(),
82
83
  isA: ['dimension'],
83
84
  generatorp: async ({context, g}) => context.amount ? `${await g(context.amount)} ${await g(context.unit)}` : context.word,
84
85
  })
@@ -98,7 +99,7 @@ class API {
98
99
  let evalue;
99
100
  let efrom = from
100
101
  if (!from.unit) {
101
- efrom = (await e(from)).evalue
102
+ efrom = (await e(from, where())).evalue
102
103
  }
103
104
  async function convert(to) {
104
105
  if (to.value == efrom.unit.value) {
@@ -112,7 +113,7 @@ class API {
112
113
  error(reason)
113
114
  }
114
115
  kms.stm.api.setVariable(efrom.unit.value, efrom.amount)
115
- evalue = await e(formula)
116
+ evalue = await e(formula, where())
116
117
  }
117
118
  return evalue
118
119
  }
@@ -201,14 +202,15 @@ const config = {
201
202
  id: "preferredUnits",
202
203
  isA: ['verb'],
203
204
  bridge: "{ ...next(operator), quantity: after[0], operator: operator, interpolate: [{ property: 'operator' }, { property: 'quantity' }] }",
204
- semantic: async ({context, e, api, toArray, resolveResponse}) => {
205
+ check: defaultContextCheckProperties(['quantity']),
206
+ semantic: async ({context, e, api, toArray, resolveEvaluate}) => {
205
207
  const preferredUnits = await api.getPreferredUnits(context.quantity)
206
208
  if (!preferredUnits) {
207
209
  return
208
210
  }
209
211
  const from = context.quantity;
210
- const value = await e({ marker: 'convertToUnits', from, to: preferredUnits })
211
- resolveResponse(context, value.evalue)
212
+ const value = await e({ marker: 'convertToUnits', from, to: preferredUnits }, where())
213
+ resolveEvaluate(context, value.evalue)
212
214
  }
213
215
  },
214
216
  {
@@ -216,6 +218,7 @@ const config = {
216
218
  id: "useUnits",
217
219
  isA: ['verb'],
218
220
  bridge: "{ ...next(operator), units: after[0], operator: operator, interpolate: [{ property: 'operator' }, { property: 'units' }] }",
221
+ check: defaultContextCheckProperties(['units']),
219
222
  semantic: ({context, api}) => {
220
223
  api.setPreferredUnits(context.units)
221
224
  }
@@ -253,18 +256,26 @@ const config = {
253
256
  before: ['preposition', 'propertyMarker'],
254
257
  after: ['mathematical_operator'],
255
258
  // bridge: "{ marker: next(operator('quantity')), dead: true, unit: after[0], value: before[0].value, amount: before[0] }"
256
- bridge: "{ marker: next(operator('quantity')), dead: true, unit: after[0], amount: before[0], interpolate: [ { property: 'amount' }, { property: 'unit' } ] }"
259
+ bridge: `{
260
+ marker: next(operator('quantity')),
261
+ dead: true,
262
+ instance: true,
263
+ unit: after[0],
264
+ amount: before[0],
265
+ interpolate: [ { property: 'amount' }, { property: 'unit' } ]
266
+ }`,
267
+ check: defaultContextCheckProperties(['unit', 'amount']),
257
268
  },
258
269
  {
259
270
  where: where(),
260
271
  id: "convertToUnits",
261
272
  bridge: "{ ...next(operator), from: before[0], to: after[0] }",
273
+ check: defaultContextCheckProperties(['from', 'to']),
262
274
  isA: ['expression', 'queryable'],
263
275
  localHierarchy: [['unknown', 'dimension']],
264
276
  after: [['possession', 0], ['possession', 1]],
265
277
  generatorp: async ({context, g}) => `${await g(context.from)} ${context.word} ${await g(context.to)}`,
266
- // evaluator: ({context, kms, error}) => {
267
- evaluator: async ({context, api, toArray, resolveEvaluate}) => {
278
+ semantic: async ({context, api, toArray, callId, resolveEvaluate}) => {
268
279
  const from = context.from;
269
280
  const tos = toArray(context.to);
270
281
  resolveEvaluate(context, await api.convertToUnits(context, from, tos))
@@ -273,6 +284,7 @@ const config = {
273
284
  {
274
285
  id: "unit",
275
286
  isA: ['mathematicalExpression'],
287
+ before: ['mathematical_operator'],
276
288
  },
277
289
  ],
278
290
  };
@@ -282,7 +294,7 @@ const template = {
282
294
  "amount is a concept",
283
295
  "measurement modifies unit",
284
296
  "dimension and measurement unit are concepts",
285
- "unit means measurement unit",
297
+ // "unit means measurement unit",
286
298
  ({apis}) => {
287
299
  apis('properties').addHierarchyWatcher({
288
300
  match: ({parentId, isA}) => isA(parentId, 'unit') && parentId.startsWith('unit_'),
@@ -313,6 +325,7 @@ const template = {
313
325
  bridges: [
314
326
  {
315
327
  id: 'useMeasurementSystem',
328
+ where: where(),
316
329
  isA: ['verb'],
317
330
  bridge: "{ ...next(operator), system: after[0], interpolate: [ { context: operator }, { property: 'system' } ] }",
318
331
  semantic: ({context, api}) => {
@@ -322,6 +335,34 @@ const template = {
322
335
  },
323
336
  ],
324
337
  },
338
+ {
339
+ semantics: [
340
+ {
341
+ match: ({context, isA, debug}) => {
342
+ return context.marker == 'unify' &&
343
+ context.terms.every((term) => isA(term, 'quantity')) &&
344
+ context.terms.every((term) => term.instance)
345
+ },
346
+ apply: async ({context, e, unify, toEValue}) => {
347
+ const t1 = context.terms[0]
348
+ const t2 = context.terms[1]
349
+ if (t1.propertyType !== t2.propertyType) {
350
+ return
351
+ }
352
+ if (t1[t1.propertyType].marker !== t2[t2.propertyType].marker) {
353
+ return
354
+ }
355
+ const convert = await e({ marker: 'convertToUnits', from: t2, to: t1.unit }, where())
356
+ const t2InT1Units = await toEValue(await toEValue(convert))
357
+ // debug.coxunter('greg29')
358
+ if (!await unify(t1.amount, await t2InT1Units.amount)) {
359
+ // debugger
360
+ }
361
+ // debugger
362
+ }
363
+ },
364
+ ],
365
+ },
325
366
  ],
326
367
  }
327
368
 
@@ -346,6 +387,7 @@ knowledgeModule({
346
387
  context: [
347
388
  defaultContextCheck({ marker: 'metric_system', exported: true }),
348
389
  defaultContextCheck({ marker: 'convertToUnits', exported: true, extra: ['from', 'to'] }),
390
+ defaultContextCheck({ marker: 'noconversion', exported: true, extra: ['from', 'to'] }),
349
391
  defaultContextCheck({
350
392
  match: ({context, isA}) => isA(context.marker, 'unit'),
351
393
  exported: true,