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
package/common/drone.js CHANGED
@@ -228,7 +228,7 @@ https://www.amazon.ca/Freenove-Raspberry-Tracking-Avoidance-Ultrasonic/dp/B0BNDQ
228
228
 
229
229
  function expectDirection(args) {
230
230
  args.config.addSemantic({
231
- match: ({context, isA}) => isA(context.marker, 'direction') && !context.evaluate,
231
+ match: ({context, isA}) => isA(context.marker, 'direction'),
232
232
  apply: ({objects, context}) => {
233
233
  objects.runCommand = true
234
234
  objects.current.direction = context.marker
@@ -261,7 +261,7 @@ async function handleDistance(args, distance) {
261
261
  }
262
262
  const instantiation = await fragments("quantity in meters", { quantity: distance })
263
263
  try {
264
- const result = await e(instantiation)
264
+ const result = await e(instantiation, where())
265
265
  objects.runCommand = true
266
266
  objects.current.distance = result.evalue.amount.evalue.evalue
267
267
  } catch (e) {
@@ -444,7 +444,7 @@ class API {
444
444
  // const valueInUsersUnits = await fragments("quantity in meters", { quantity: minimumValueInDroneUnits, meter: unitsOfUser })
445
445
  if (unitsOfUser) {
446
446
  const valueInUsersUnits = await quantityInMeters(minimumValueInDroneUnits, unitsOfUser )
447
- const evaluated = await e(valueInUsersUnits)
447
+ const evaluated = await e(valueInUsersUnits, where())
448
448
  say(`The drone cannot go that slow. The minimum speed is ${await gr(evaluated.evalue)}`)
449
449
  } else {
450
450
  say(`The drone cannot go that fast. The minimum speed is ${await gr(minimumValueInDroneUnits)}`)
@@ -462,7 +462,7 @@ class API {
462
462
  // const valueInUsersUnits = await fragments("quantity in meters", { quantity: maximumValueInDroneUnits, meter: unitsOfUser })
463
463
  if (unitsOfUser) {
464
464
  const valueInUsersUnits = await quantityInMeters(maximumValueInDroneUnits, unitsOfUser)
465
- const evaluated = await e(valueInUsersUnits)
465
+ const evaluated = await e(valueInUsersUnits, where())
466
466
  say(`The drone cannot go that fast. The maximum speed is ${await gr(evaluated.evalue)}`)
467
467
  } else {
468
468
  say(`The drone cannot go that fast. The maximum speed is ${await gr(maximumValueInDroneUnits)}`)
@@ -796,7 +796,7 @@ function expectDistanceForMove(args) {
796
796
  match: ({context, isA}) => isA(context.marker, 'quantity') && !isA(context.unit.marker, 'unitPerUnit'),
797
797
  apply: async ({context, objects, fragments, e}) => {
798
798
  const instantiation = await fragments("quantity in meters", { quantity: context })
799
- const result = await e(instantiation)
799
+ const result = await e(instantiation, where())
800
800
  objects.runCommand = true
801
801
  objects.current.distance = result.evalue.amount.evalue.evalue
802
802
  }
@@ -861,7 +861,7 @@ const template = {
861
861
  apply: async ({context, objects, api, gr, fragments, e, say}) => {
862
862
  // send a command to the drone
863
863
  const instantiation = await fragments("quantity in meters per second", { quantity: context })
864
- const result = await e(instantiation)
864
+ const result = await e(instantiation, where())
865
865
  const desired_speed = result.evalue.amount.evalue.evalue
866
866
  objects.runCommand = true
867
867
  objects.current.speed = desired_speed
@@ -939,6 +939,7 @@ const template = {
939
939
  },
940
940
  {
941
941
  id: 'startPath',
942
+ where: where(),
942
943
  isA: ['verb'],
943
944
  bridge: "{ ...next(operator), path: after[0], operator: operator, interpolate: [{ property: 'operator' }, { property: 'path' }] }",
944
945
  check: defaultContextCheckProperties(['path']),
@@ -979,6 +980,7 @@ const template = {
979
980
  },
980
981
  {
981
982
  id: 'patrol',
983
+ where: where(),
982
984
  isA: ['verb', 'repeatable', 'action'],
983
985
  bridge: `{
984
986
  ...next(operator),
@@ -992,7 +994,7 @@ const template = {
992
994
  for (const context_path of paths) {
993
995
  const evaluated = await(e(context_path))
994
996
  const path = toEValue(evaluated)
995
- if (path.marker == 'answerNotKnown') {
997
+ if (path.marker === 'undefined') {
996
998
  verbatim(`${await g(context_path)} is not a known path`)
997
999
  continue
998
1000
  }
@@ -1007,7 +1009,7 @@ const template = {
1007
1009
  const timeAtPoints = toArray(context.pause.timeAtPoint)
1008
1010
  for (const timeAtPoint of timeAtPoints) {
1009
1011
  const instantiation = await fragments("quantity in seconds", { quantity: timeAtPoint.time })
1010
- const result = await e(instantiation)
1012
+ const result = await e(instantiation, where())
1011
1013
  const seconds = toFinalValue(toFinalValue(result).amount)
1012
1014
 
1013
1015
  const points = await recall({ context: timeAtPoint.point.point, frameOfReference: path })
@@ -1061,25 +1063,9 @@ const template = {
1061
1063
  objects.runCommand = true
1062
1064
  }
1063
1065
  },
1064
- /*
1065
- {
1066
- id: 'do',
1067
- isA: ['verb'],
1068
- bridge: `{
1069
- ...next(operator), operator: operator, path: after[0], interpolate: [{ property: 'operator'}, { property: 'path' }]
1070
- }`,
1071
- semantic: async ({context, e, toEValue, objects}) => {
1072
- const evaluated = await(e(context.path))
1073
- const path = toEValue(evaluated)
1074
- for (const point of path.points) {
1075
- objects.current.path.push(point)
1076
- }
1077
- objects.runCommand = true
1078
- }
1079
- },
1080
- */
1081
1066
  {
1082
1067
  id: 'lift',
1068
+ where: where(),
1083
1069
  isA: ['verb'],
1084
1070
  bridge: `{
1085
1071
  ...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]
@@ -1091,6 +1077,7 @@ const template = {
1091
1077
  },
1092
1078
  {
1093
1079
  id: 'lower',
1080
+ where: where(),
1094
1081
  isA: ['verb'],
1095
1082
  bridge: `{
1096
1083
  ...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]
@@ -1102,6 +1089,7 @@ const template = {
1102
1089
  },
1103
1090
  {
1104
1091
  id: 'openDrone',
1092
+ where: where(),
1105
1093
  isA: ['verb'],
1106
1094
  bridge: `{
1107
1095
  ...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]
@@ -1113,6 +1101,7 @@ const template = {
1113
1101
  },
1114
1102
  {
1115
1103
  id: 'close',
1104
+ where: where(),
1116
1105
  isA: ['verb'],
1117
1106
  bridge: `{
1118
1107
  ...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]
@@ -1124,6 +1113,7 @@ const template = {
1124
1113
  },
1125
1114
  {
1126
1115
  id: 'back',
1116
+ where: where(),
1127
1117
  isA: ['noun'],
1128
1118
  semantic: async ({objects, api, e, context, say}) => {
1129
1119
  await api.back()
@@ -1135,18 +1125,20 @@ const template = {
1135
1125
  },
1136
1126
  {
1137
1127
  id: "toPoint",
1128
+ where: where(),
1138
1129
  isA: ['preposition'],
1139
1130
  after: [['propertyOf', 1]],
1140
1131
  bridge: "{ ...next(operator), operator: operator, point: after[0], interpolate: [{ property: 'operator' }, { property: 'point' }] }",
1141
1132
  check: defaultContextCheckProperties(['point']),
1142
1133
  semantic: async ({objects, api, e, context}) => {
1143
1134
  objects.runCommand = true
1144
- const point = await e(context.point)
1135
+ const point = await e(context.point, where())
1145
1136
  objects.current.path.push(point.evalue)
1146
1137
  }
1147
1138
  },
1148
1139
  {
1149
1140
  id: "go",
1141
+ where: where(),
1150
1142
  level: 0,
1151
1143
  // convolution: true,
1152
1144
  isA: ['verb', 'repeatable', 'doAction'],
@@ -1190,7 +1182,7 @@ const template = {
1190
1182
  objects.current.timeRepeats = toFinalValue(context.repeats.repeats)
1191
1183
  }
1192
1184
  if (context.to) {
1193
- const evaluation = await e(context.to.point)
1185
+ const evaluation = await e(context.to.point, where())
1194
1186
  const point = toEValue(evaluation)
1195
1187
  objects.current.path.push(point)
1196
1188
  }
@@ -1200,6 +1192,7 @@ const template = {
1200
1192
  },
1201
1193
  {
1202
1194
  id: 'turn',
1195
+ where: where(),
1203
1196
  isA: ['verb', 'action', 'repeatable'],
1204
1197
  before: ['thenAction'],
1205
1198
  words: ['turn'],
@@ -1239,7 +1232,7 @@ const template = {
1239
1232
  if (context.angle) {
1240
1233
  const instantiation = await toRadians(context.angle)
1241
1234
  try {
1242
- const result = await e(instantiation)
1235
+ const result = await e(instantiation, where())
1243
1236
  current.turnAngle = toFinalValue(result.evalue.amount)
1244
1237
  objects.runCommand = true
1245
1238
  } catch (e) {
@@ -1258,6 +1251,7 @@ const template = {
1258
1251
  },
1259
1252
  {
1260
1253
  id: 'pause',
1254
+ where: where(),
1261
1255
  isA: ['verb'],
1262
1256
  words: [
1263
1257
  ...conjugateVerb('pause'),
@@ -1281,7 +1275,7 @@ const template = {
1281
1275
  time = time.quantity
1282
1276
  }
1283
1277
  const instantiation = await fragments("quantity in seconds", { quantity: time})
1284
- const result = await e(instantiation)
1278
+ const result = await e(instantiation, where())
1285
1279
  const seconds = toFinalValue(toFinalValue(result).amount)
1286
1280
  context.pauseSeconds = seconds
1287
1281
  remember(context)
@@ -1302,6 +1296,7 @@ const template = {
1302
1296
  },
1303
1297
  {
1304
1298
  id: 'stop',
1299
+ where: where(),
1305
1300
  isA: ['verb'],
1306
1301
  optional: {
1307
1302
  1: "{ marker: 'drone' }",
@@ -1327,17 +1322,16 @@ const template = {
1327
1322
  {
1328
1323
  where: where(),
1329
1324
  match: ({context}) => context.marker == 'doAction',
1330
- apply: async ({context, fragments, e, s, toEValue, toFinalValue, namespaced, objects}) => {
1325
+ apply: async ({context, fragments, e, toEValue, toFinalValue, namespaced, objects}) => {
1331
1326
  const updated = { ...context, marker: 'patrol', path: context.action }
1332
1327
  namespaced.set('actions', updated, 'logged', true)
1333
- await s(updated)
1334
- // await s({ ...context, marker: 'patrol', path: context.action })
1328
+ await e(updated, where())
1335
1329
  }
1336
1330
  },
1337
1331
  {
1338
1332
  where: where(),
1339
1333
  match: ({context, contextHierarchy}) => {
1340
- if (!context.pullFromContext || !context.evaluate || contextHierarchy.under(['doAction', 'evaluate', 'patrol']) || context.instance) {
1334
+ if (!context.pullFromContext || contextHierarchy.under(['doAction', 'evaluate', 'patrol']) || context.isInstance) {
1341
1335
  return false
1342
1336
  }
1343
1337
 
@@ -1353,7 +1347,7 @@ const template = {
1353
1347
  }))
1354
1348
  const path = (await fragments('path')).contexts()[0]
1355
1349
  delete path.value
1356
- path.instance = true
1350
+ path.isInstance = true
1357
1351
  path.points = pathComponents.reverse()
1358
1352
  frameOfReference(path, { mentioned: 'points', reversed: true })
1359
1353
  await remember(path)
@@ -1364,7 +1358,7 @@ const template = {
1364
1358
  {
1365
1359
  where: where(),
1366
1360
  match: ({context, contextHierarchy}) => {
1367
- if (!context.pullFromContext || !context.evaluate || !contextHierarchy.under('call') || context.notUnderCall) {
1361
+ if (!context.pullFromContext || !contextHierarchy.under('call') || context.notUnderCall) {
1368
1362
  return false
1369
1363
  }
1370
1364
 
@@ -1373,13 +1367,13 @@ const template = {
1373
1367
  }
1374
1368
  },
1375
1369
  apply: async ({frameOfReference, context, e, fragments, stm, toEValue, toArray, objects, remember, recall, resolveEvaluate, _continue, contextHierarchy}) => {
1376
- const evaluated = await e({...context, notUnderCall: true})
1370
+ const evaluated = await e({...context, notUnderCall: true}, where())
1377
1371
  const pointsContext = toEValue(evaluated)
1378
1372
  const pathComponents = toArray(pointsContext)
1379
1373
 
1380
1374
  const path = (await fragments('path')).contexts()[0]
1381
1375
  delete path.value
1382
- path.instance = true
1376
+ path.isInstance = true
1383
1377
  path.points = [...pathComponents]
1384
1378
  frameOfReference(path, { mentioned: 'points', reversed: true })
1385
1379
  await remember(path)
@@ -1398,7 +1392,7 @@ const template = {
1398
1392
  */
1399
1393
  {
1400
1394
  where: where(),
1401
- match: ({context}) => context.evaluate && ['start', 'end'].includes(context.marker) && context.objects && context.objects[1].marker == 'path',
1395
+ match: ({context}) => ['start', 'end'].includes(context.marker) && context.objects && context.objects[1].marker == 'path',
1402
1396
  apply: async ({gp, s, context, objects, fragments, resolveEvaluate, api, recall}) => {
1403
1397
  const path = await recall({ context: context.objects[1] })
1404
1398
  if (!path?.points) {
@@ -1413,7 +1407,6 @@ const template = {
1413
1407
  },
1414
1408
  {
1415
1409
  match: ({context, contextHierarchy}) =>
1416
- context.evaluate &&
1417
1410
  ['start', 'end', 'point'].includes(context.marker) &&
1418
1411
  !context.propertyOf &&
1419
1412
  contextHierarchy.under('go') &&
@@ -1438,15 +1431,15 @@ const template = {
1438
1431
  where: where(),
1439
1432
  match: ({context}) => {
1440
1433
  // from stm lookup
1441
- if (context.marker == 'mentions' && context.evaluate && context.args.context.marker == 'speed') {
1434
+ if (context.marker == 'mentions' && context.args.context.marker == 'speed') {
1442
1435
  return true
1443
1436
  }
1444
1437
  // from property directly
1445
- if (context.marker == 'speed' && context.evaluate) {
1438
+ if (context.marker == 'speed') {
1446
1439
  return true
1447
1440
  }
1448
1441
  },
1449
- apply: async ({gp, s, context, objects, fragments, resolveEvaluate, api}) => {
1442
+ apply: async ({gp, e, context, objects, fragments, resolveEvaluate, api}) => {
1450
1443
  let return_context = context
1451
1444
  if (context.marker == 'speed') {
1452
1445
  // okay
@@ -1464,22 +1457,22 @@ const template = {
1464
1457
  }
1465
1458
  }
1466
1459
  const speed = await fragments("number meters per second", { number: { marker: 'integer', value, word: undefined} })
1467
- const preferred = await s({ marker: 'preferredUnits', quantity: speed })
1468
- resolveEvaluate(return_context, preferred.response || speed)
1460
+ const preferred = await e({ marker: 'preferredUnits', quantity: speed }, where())
1461
+ resolveEvaluate(return_context, preferred.evalue || speed)
1469
1462
  }
1470
1463
  },
1471
1464
  {
1472
1465
  where: where(),
1473
1466
  // recallOverride(context(), frameOfReference())
1474
1467
  match: ({context}) => {
1475
- if (context.marker == 'mentions' && context.evaluate && ['direction', 'drone_direction'].includes(context.args.context.marker)) {
1468
+ if (context.marker == 'mentions' && ['direction', 'drone_direction'].includes(context.args.context.marker)) {
1476
1469
  return true
1477
1470
  }
1478
- if (['direction', 'drone_direction'].includes(context.marker) && context.evaluate) {
1471
+ if (['direction', 'drone_direction'].includes(context.marker)) {
1479
1472
  return true
1480
1473
  }
1481
1474
  },
1482
- apply: async ({gp, s, context, objects, fragments, resolveEvaluate, api}) => {
1475
+ apply: async ({gp, e, context, objects, fragments, resolveEvaluate, api}) => {
1483
1476
  const value = objects.current.angleInRadians
1484
1477
  const fi = await fragments("number radians")
1485
1478
  const direction = await fi.instantiate([
@@ -1490,8 +1483,8 @@ const template = {
1490
1483
  }
1491
1484
  }
1492
1485
  ])
1493
- const preferred = await s({ marker: 'preferredUnits', quantity: direction })
1494
- resolveEvaluate(context, preferred.response || direction)
1486
+ const preferred = await e({ marker: 'preferredUnits', quantity: direction }, where())
1487
+ resolveEvaluate(context, preferred.evalue || direction)
1495
1488
  }
1496
1489
  },
1497
1490
  {
@@ -1537,7 +1530,7 @@ knowledgeModule( {
1537
1530
  defaultContextCheck({ marker: 'path', exported: true,
1538
1531
  extra: [
1539
1532
  'points',
1540
- 'instance',
1533
+ 'isInstance',
1541
1534
  {
1542
1535
  property: 'namespaced',
1543
1536
  check: [
@@ -6,7 +6,7 @@
6
6
  "point is a concept",
7
7
  "points are nameable orderable and memorable",
8
8
  {
9
- "apply": "(args) => {\n askForCalibrationDistance(args)\n askForEndTime(args)\n askForStartTime(args)\n\n expectDirection(args)\n expectDistanceForCalibration(args)\n expectCalibrationCompletion(args)\n\n args.config.addSemantic({\n match: ({context, isA}) => isA(context.marker, 'quantity') && isA(context.unit.marker, 'unitPerUnit'),\n apply: async ({context, objects, api, fragments, e}) => {\n // send a command to the drone\n const instantiation = await fragments(\"quantity in meters per second\", { quantity: context })\n const result = await e(instantiation)\n const desired_speed = result.evalue.amount.evalue.evalue\n const desired_power = objects.current.power * (desired_speed / objects.calibration.speed)\n objects.runCommand = true\n objects.current.power = desired_power \n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlStart',\n apply: ({context, objects, api}) => {\n objects.runCommand = false \n }\n })\n\n args.config.addSemantic({\n // match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && (context.marker == 'controlEnd' || context.marker == 'controlBetween'),\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlEnd',\n apply: async ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n // debugger\n await api.sendCommand()\n }\n }\n })\n }"
9
+ "apply": "(args) => {\n askForCalibrationDistance(args)\n askForEndTime(args)\n askForStartTime(args)\n\n expectDirection(args)\n expectDistanceForCalibration(args)\n expectCalibrationCompletion(args)\n\n args.config.addSemantic({\n match: ({context, isA}) => isA(context.marker, 'quantity') && isA(context.unit.marker, 'unitPerUnit'),\n apply: async ({context, objects, api, fragments, e}) => {\n // send a command to the drone\n const instantiation = await fragments(\"quantity in meters per second\", { quantity: context })\n const result = await e(instantiation, where())\n const desired_speed = result.evalue.amount.evalue.evalue\n const desired_power = objects.current.power * (desired_speed / objects.calibration.speed)\n objects.runCommand = true\n objects.current.power = desired_power \n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlStart',\n apply: ({context, objects, api}) => {\n objects.runCommand = false \n }\n })\n\n args.config.addSemantic({\n // match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && (context.marker == 'controlEnd' || context.marker == 'controlBetween'),\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlEnd',\n apply: async ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n // debugger\n await api.sendCommand()\n }\n }\n })\n }"
10
10
  },
11
11
  {
12
12
  "operators": [
@@ -20,17 +20,19 @@
20
20
  "bridges": [
21
21
  {
22
22
  "id": "toPoint",
23
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:480",
23
24
  "isA": [
24
25
  "preposition"
25
26
  ],
26
27
  "bridge": "{ ...next(operator), operator: operator, point: after[0], interpolate: [{ property: 'operator' }, { property: 'point' }] }",
27
- "semantic": "async ({objects, api, e, context}) => {\n if (api.isCalibrated()) {\n objects.runCommand = true\n const point = await e(context.point)\n objects.current.destination = point.evalue\n }\n }"
28
+ "semantic": "async ({objects, api, e, context}) => {\n if (api.isCalibrated()) {\n objects.runCommand = true\n const point = await e(context.point, where())\n objects.current.destination = point.evalue\n }\n }"
28
29
  },
29
30
  {
30
31
  "id": "go"
31
32
  },
32
33
  {
33
34
  "id": "turn",
35
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:494",
34
36
  "isA": [
35
37
  "verb"
36
38
  ],
@@ -39,6 +41,7 @@
39
41
  },
40
42
  {
41
43
  "id": "calibrate",
44
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:505",
42
45
  "isA": [
43
46
  "verb"
44
47
  ],
@@ -47,6 +50,7 @@
47
50
  },
48
51
  {
49
52
  "id": "pause",
53
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:520",
50
54
  "isA": [
51
55
  "verb"
52
56
  ],
@@ -55,6 +59,7 @@
55
59
  },
56
60
  {
57
61
  "id": "stop",
62
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:531",
58
63
  "isA": [
59
64
  "verb"
60
65
  ],
@@ -210,7 +215,6 @@
210
215
  "level": 2,
211
216
  "context_index": 1,
212
217
  "topLevel": true,
213
- "context_id": 2,
214
218
  "touchedBy": [
215
219
  "drone_v1#call2"
216
220
  ]
@@ -391,6 +395,9 @@
391
395
  }
392
396
  ],
393
397
  "learned_contextual_priorities": [],
398
+ "explain_associations_details": [
399
+ null
400
+ ],
394
401
  "query": "drone is a concept",
395
402
  "key": {
396
403
  "query": "drone is a concept"
@@ -1048,7 +1055,6 @@
1048
1055
  "level": 2,
1049
1056
  "context_index": 1,
1050
1057
  "topLevel": true,
1051
- "context_id": 2,
1052
1058
  "touchedBy": [
1053
1059
  "drone_v1#call2"
1054
1060
  ]
@@ -2579,6 +2585,9 @@
2579
2585
  }
2580
2586
  ],
2581
2587
  "learned_contextual_priorities": [],
2588
+ "explain_associations_details": [
2589
+ null
2590
+ ],
2582
2591
  "query": "around, forward, left, right, and backward are directions",
2583
2592
  "key": {
2584
2593
  "query": "around, forward, left, right, and backward are directions"
@@ -2802,7 +2811,6 @@
2802
2811
  "level": 2,
2803
2812
  "context_index": 1,
2804
2813
  "topLevel": true,
2805
- "context_id": 2,
2806
2814
  "touchedBy": [
2807
2815
  "drone_v1#call2"
2808
2816
  ]
@@ -3093,6 +3101,9 @@
3093
3101
  }
3094
3102
  ],
3095
3103
  "learned_contextual_priorities": [],
3104
+ "explain_associations_details": [
3105
+ null
3106
+ ],
3096
3107
  "query": "speed and power are properties",
3097
3108
  "key": {
3098
3109
  "query": "speed and power are properties"
@@ -3233,7 +3244,6 @@
3233
3244
  "level": 2,
3234
3245
  "context_index": 1,
3235
3246
  "topLevel": true,
3236
- "context_id": 2,
3237
3247
  "touchedBy": [
3238
3248
  "drone_v1#call2"
3239
3249
  ]
@@ -3414,6 +3424,9 @@
3414
3424
  }
3415
3425
  ],
3416
3426
  "learned_contextual_priorities": [],
3427
+ "explain_associations_details": [
3428
+ null
3429
+ ],
3417
3430
  "query": "point is a concept",
3418
3431
  "key": {
3419
3432
  "query": "point is a concept"
@@ -3664,7 +3677,6 @@
3664
3677
  "level": 2,
3665
3678
  "context_index": 1,
3666
3679
  "topLevel": true,
3667
- "context_id": 2,
3668
3680
  "touchedBy": [
3669
3681
  "drone_v1#call2"
3670
3682
  ]
@@ -4060,13 +4072,16 @@
4060
4072
  }
4061
4073
  ],
4062
4074
  "learned_contextual_priorities": [],
4075
+ "explain_associations_details": [
4076
+ null
4077
+ ],
4063
4078
  "query": "points are nameable orderable and memorable",
4064
4079
  "key": {
4065
4080
  "query": "points are nameable orderable and memorable"
4066
4081
  }
4067
4082
  },
4068
4083
  {
4069
- "apply": "(args) => {\n askForCalibrationDistance(args)\n askForEndTime(args)\n askForStartTime(args)\n\n expectDirection(args)\n expectDistanceForCalibration(args)\n expectCalibrationCompletion(args)\n\n args.config.addSemantic({\n match: ({context, isA}) => isA(context.marker, 'quantity') && isA(context.unit.marker, 'unitPerUnit'),\n apply: async ({context, objects, api, fragments, e}) => {\n // send a command to the drone\n const instantiation = await fragments(\"quantity in meters per second\", { quantity: context })\n const result = await e(instantiation)\n const desired_speed = result.evalue.amount.evalue.evalue\n const desired_power = objects.current.power * (desired_speed / objects.calibration.speed)\n objects.runCommand = true\n objects.current.power = desired_power \n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlStart',\n apply: ({context, objects, api}) => {\n objects.runCommand = false \n }\n })\n\n args.config.addSemantic({\n // match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && (context.marker == 'controlEnd' || context.marker == 'controlBetween'),\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlEnd',\n apply: async ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n // debugger\n await api.sendCommand()\n }\n }\n })\n }"
4084
+ "apply": "(args) => {\n askForCalibrationDistance(args)\n askForEndTime(args)\n askForStartTime(args)\n\n expectDirection(args)\n expectDistanceForCalibration(args)\n expectCalibrationCompletion(args)\n\n args.config.addSemantic({\n match: ({context, isA}) => isA(context.marker, 'quantity') && isA(context.unit.marker, 'unitPerUnit'),\n apply: async ({context, objects, api, fragments, e}) => {\n // send a command to the drone\n const instantiation = await fragments(\"quantity in meters per second\", { quantity: context })\n const result = await e(instantiation, where())\n const desired_speed = result.evalue.amount.evalue.evalue\n const desired_power = objects.current.power * (desired_speed / objects.calibration.speed)\n objects.runCommand = true\n objects.current.power = desired_power \n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlStart',\n apply: ({context, objects, api}) => {\n objects.runCommand = false \n }\n })\n\n args.config.addSemantic({\n // match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && (context.marker == 'controlEnd' || context.marker == 'controlBetween'),\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlEnd',\n apply: async ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n // debugger\n await api.sendCommand()\n }\n }\n })\n }"
4070
4085
  },
4071
4086
  {
4072
4087
  "extraConfig": true,
@@ -4081,6 +4096,7 @@
4081
4096
  "bridges": [
4082
4097
  {
4083
4098
  "id": "toPoint",
4099
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:480",
4084
4100
  "isA": [
4085
4101
  "preposition"
4086
4102
  ],
@@ -4091,6 +4107,7 @@
4091
4107
  },
4092
4108
  {
4093
4109
  "id": "turn",
4110
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:494",
4094
4111
  "isA": [
4095
4112
  "verb"
4096
4113
  ],
@@ -4098,6 +4115,7 @@
4098
4115
  },
4099
4116
  {
4100
4117
  "id": "calibrate",
4118
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:505",
4101
4119
  "isA": [
4102
4120
  "verb"
4103
4121
  ],
@@ -4105,6 +4123,7 @@
4105
4123
  },
4106
4124
  {
4107
4125
  "id": "pause",
4126
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:520",
4108
4127
  "isA": [
4109
4128
  "verb"
4110
4129
  ],
@@ -4112,6 +4131,7 @@
4112
4131
  },
4113
4132
  {
4114
4133
  "id": "stop",
4134
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:531",
4115
4135
  "isA": [
4116
4136
  "verb"
4117
4137
  ],
@@ -4210,8 +4230,7 @@
4210
4230
  },
4211
4231
  "level": 1,
4212
4232
  "context_index": 1,
4213
- "topLevel": true,
4214
- "context_id": 2
4233
+ "topLevel": true
4215
4234
  }
4216
4235
  ],
4217
4236
  "generated": [
@@ -4319,6 +4338,9 @@
4319
4338
  }
4320
4339
  ],
4321
4340
  "learned_contextual_priorities": [],
4341
+ "explain_associations_details": [
4342
+ null
4343
+ ],
4322
4344
  "query": "quantity in meters",
4323
4345
  "skipSemantics": true,
4324
4346
  "key": {
@@ -4510,8 +4532,7 @@
4510
4532
  },
4511
4533
  "level": 1,
4512
4534
  "context_index": 1,
4513
- "topLevel": true,
4514
- "context_id": 2
4535
+ "topLevel": true
4515
4536
  }
4516
4537
  ],
4517
4538
  "generated": [
@@ -4729,6 +4750,9 @@
4729
4750
  }
4730
4751
  ],
4731
4752
  "learned_contextual_priorities": [],
4753
+ "explain_associations_details": [
4754
+ null
4755
+ ],
4732
4756
  "query": "quantity in meters per second",
4733
4757
  "skipSemantics": true,
4734
4758
  "key": {
@@ -375,7 +375,7 @@ function expectDistanceForCalibration(args) {
375
375
  match: ({context, isA, objects}) => isA(context.marker, 'quantity') && !isA(context.unit.marker, 'unitPerUnit') && objects.calibration.startTime,
376
376
  apply: async ({context, objects, fragments, e}) => {
377
377
  const instantiation = await fragments("quantity in meters", { quantity: context })
378
- const result = await e(instantiation)
378
+ const result = await e(instantiation, where())
379
379
  objects.calibration.distance = result.evalue.amount.evalue.evalue
380
380
  }
381
381
  })
@@ -387,7 +387,7 @@ function expectDistanceForMove(args) {
387
387
  match: ({context, isA}) => isA(context.marker, 'quantity') && !isA(context.unit.marker, 'unitPerUnit'),
388
388
  apply: async ({context, objects, fragments, e}) => {
389
389
  const instantiation = await fragments("quantity in meters", { quantity: context })
390
- const result = await e(instantiation)
390
+ const result = await e(instantiation, where())
391
391
  objects.runCommand = true
392
392
  objects.current.distance = result.evalue.amount.evalue.evalue
393
393
  }
@@ -438,7 +438,7 @@ const template = {
438
438
  apply: async ({context, objects, api, fragments, e}) => {
439
439
  // send a command to the drone
440
440
  const instantiation = await fragments("quantity in meters per second", { quantity: context })
441
- const result = await e(instantiation)
441
+ const result = await e(instantiation, where())
442
442
  const desired_speed = result.evalue.amount.evalue.evalue
443
443
  const desired_power = objects.current.power * (desired_speed / objects.calibration.speed)
444
444
  objects.runCommand = true
@@ -477,12 +477,13 @@ const template = {
477
477
  bridges: [
478
478
  {
479
479
  id: "toPoint",
480
+ where: where(),
480
481
  isA: ['preposition'],
481
482
  bridge: "{ ...next(operator), operator: operator, point: after[0], interpolate: [{ property: 'operator' }, { property: 'point' }] }",
482
483
  semantic: async ({objects, api, e, context}) => {
483
484
  if (api.isCalibrated()) {
484
485
  objects.runCommand = true
485
- const point = await e(context.point)
486
+ const point = await e(context.point, where())
486
487
  objects.current.destination = point.evalue
487
488
  }
488
489
  }
@@ -490,6 +491,7 @@ const template = {
490
491
  { id: "go" },
491
492
  {
492
493
  id: 'turn',
494
+ where: where(),
493
495
  isA: ['verb'],
494
496
  bridge: "{ ...next(operator), direction: after[0], interpolate: [{ context: operator }, { property: 'direction' }] }",
495
497
  semantic: ({context, objects, api}) => {
@@ -500,6 +502,7 @@ const template = {
500
502
  },
501
503
  {
502
504
  id: 'calibrate',
505
+ where: where(),
503
506
  isA: ['verb'],
504
507
  bridge: "{ ...next(operator), interpolate: [{ context: operator }] }",
505
508
  semantic: ({context, objects, api, remember}) => {
@@ -514,6 +517,7 @@ const template = {
514
517
  },
515
518
  {
516
519
  id: 'pause',
520
+ where: where(),
517
521
  isA: ['verb'],
518
522
  bridge: "{ ...operator, time: after[0], interpolate: [{ context: operator }, { property: 'time' }] }",
519
523
  semantic: async ({context}) => {
@@ -524,6 +528,7 @@ const template = {
524
528
  },
525
529
  {
526
530
  id: 'stop',
531
+ where: where(),
527
532
  isA: ['verb'],
528
533
  optional: {
529
534
  1: "{ marker: 'drone' }",
@@ -588,11 +593,11 @@ knowledgeModule( {
588
593
  ],
589
594
  objects: [
590
595
  { km: 'stm' },
591
- { path: ['isCalibrated'] },
592
- { path: ['calibration'] },
593
- { path: ['history'] },
594
- { path: ['current'] },
595
- { path: ['runCommand'] },
596
+ 'isCalibrated',
597
+ { property: 'calibration', all: true },
598
+ { property: 'current', all: true },
599
+ { property: 'history', all: true },
600
+ 'runCommand',
596
601
  ],
597
602
  }
598
603
  },