tpmkms 9.8.0-beta.8 → 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 (65) hide show
  1. package/common/actions.instance.json +4 -4
  2. package/common/actions.js +9 -9
  3. package/common/askfor.instance.json +12 -184
  4. package/common/askfor.js +19 -11
  5. package/common/asking.js +13 -5
  6. package/common/can.instance.json +2 -18
  7. package/common/can.js +2 -2
  8. package/common/comparable.instance.json +6 -12
  9. package/common/concept.instance.json +8 -4
  10. package/common/concept.js +2 -0
  11. package/common/conjunction.js +6 -4
  12. package/common/control.js +5 -5
  13. package/common/countable.js +1 -0
  14. package/common/dateTimeSelectors.instance.json +1 -1
  15. package/common/dateTimeSelectors.js +1 -1
  16. package/common/dates.instance.json +11 -1
  17. package/common/dates.js +6 -1
  18. package/common/debug.instance.json +5 -1
  19. package/common/debug.js +2 -0
  20. package/common/dialogues.js +37 -35
  21. package/common/dimension.instance.json +144 -446
  22. package/common/dimension.js +14 -8
  23. package/common/drone.instance.json +43 -19
  24. package/common/drone.js +29 -35
  25. package/common/drone_v1.instance.json +13 -3
  26. package/common/drone_v1.js +14 -9
  27. package/common/evaluate.js +2 -2
  28. package/common/fastfood.instance.json +12 -4
  29. package/common/fastfood.js +27 -12
  30. package/common/formulas.instance.json +138 -12
  31. package/common/formulas.js +15 -6
  32. package/common/gdefaults.js +2 -71
  33. package/common/helpers/dialogues.js +1 -10
  34. package/common/helpers/properties.js +6 -10
  35. package/common/helpers.js +5 -2
  36. package/common/hierarchy.js +11 -7
  37. package/common/math.instance.json +141 -4
  38. package/common/math.js +18 -5
  39. package/common/menus.instance.json +6 -2
  40. package/common/menus.js +5 -2
  41. package/common/meta.js +12 -12
  42. package/common/nameable.js +6 -2
  43. package/common/ordering.instance.json +1 -2
  44. package/common/percentages.js +4 -2
  45. package/common/pipboy.instance.json +38 -27
  46. package/common/pipboy.js +21 -14
  47. package/common/properties.instance.json +2319 -560
  48. package/common/properties.js +146 -37
  49. package/common/punctuation.js +1 -0
  50. package/common/rates.instance.json +1 -1
  51. package/common/rates.js +2 -2
  52. package/common/reminders.instance.json +16 -0
  53. package/common/reminders.js +23 -19
  54. package/common/reports.instance.json +4 -6
  55. package/common/reports.js +12 -12
  56. package/common/sdefaults.js +11 -9
  57. package/common/stm.js +11 -14
  58. package/common/testing.js +2 -2
  59. package/common/time.instance.json +42 -15
  60. package/common/time.js +7 -6
  61. package/common/ui.js +5 -5
  62. package/common/words.js +106 -1
  63. package/common/wp.instance.json +10 -3
  64. package/common/wp.js +5 -1
  65. package/package.json +2 -2
@@ -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,13 +202,14 @@ 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' }] }",
205
+ check: defaultContextCheckProperties(['quantity']),
204
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 })
212
+ const value = await e({ marker: 'convertToUnits', from, to: preferredUnits }, where())
211
213
  resolveEvaluate(context, value.evalue)
212
214
  }
213
215
  },
@@ -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
  }
@@ -260,18 +263,19 @@ const config = {
260
263
  unit: after[0],
261
264
  amount: before[0],
262
265
  interpolate: [ { property: 'amount' }, { property: 'unit' } ]
263
- }`
266
+ }`,
267
+ check: defaultContextCheckProperties(['unit', 'amount']),
264
268
  },
265
269
  {
266
270
  where: where(),
267
271
  id: "convertToUnits",
268
272
  bridge: "{ ...next(operator), from: before[0], to: after[0] }",
273
+ check: defaultContextCheckProperties(['from', 'to']),
269
274
  isA: ['expression', 'queryable'],
270
275
  localHierarchy: [['unknown', 'dimension']],
271
276
  after: [['possession', 0], ['possession', 1]],
272
277
  generatorp: async ({context, g}) => `${await g(context.from)} ${context.word} ${await g(context.to)}`,
273
- // evaluator: ({context, kms, error}) => {
274
- evaluator: async ({context, api, toArray, resolveEvaluate}) => {
278
+ semantic: async ({context, api, toArray, callId, resolveEvaluate}) => {
275
279
  const from = context.from;
276
280
  const tos = toArray(context.to);
277
281
  resolveEvaluate(context, await api.convertToUnits(context, from, tos))
@@ -290,7 +294,7 @@ const template = {
290
294
  "amount is a concept",
291
295
  "measurement modifies unit",
292
296
  "dimension and measurement unit are concepts",
293
- "unit means measurement unit",
297
+ // "unit means measurement unit",
294
298
  ({apis}) => {
295
299
  apis('properties').addHierarchyWatcher({
296
300
  match: ({parentId, isA}) => isA(parentId, 'unit') && parentId.startsWith('unit_'),
@@ -321,6 +325,7 @@ const template = {
321
325
  bridges: [
322
326
  {
323
327
  id: 'useMeasurementSystem',
328
+ where: where(),
324
329
  isA: ['verb'],
325
330
  bridge: "{ ...next(operator), system: after[0], interpolate: [ { context: operator }, { property: 'system' } ] }",
326
331
  semantic: ({context, api}) => {
@@ -347,7 +352,7 @@ const template = {
347
352
  if (t1[t1.propertyType].marker !== t2[t2.propertyType].marker) {
348
353
  return
349
354
  }
350
- const convert = await e({ marker: 'convertToUnits', from: t2, to: t1.unit })
355
+ const convert = await e({ marker: 'convertToUnits', from: t2, to: t1.unit }, where())
351
356
  const t2InT1Units = await toEValue(await toEValue(convert))
352
357
  // debug.coxunter('greg29')
353
358
  if (!await unify(t1.amount, await t2InT1Units.amount)) {
@@ -382,6 +387,7 @@ knowledgeModule({
382
387
  context: [
383
388
  defaultContextCheck({ marker: 'metric_system', exported: true }),
384
389
  defaultContextCheck({ marker: 'convertToUnits', exported: true, extra: ['from', 'to'] }),
390
+ defaultContextCheck({ marker: 'noconversion', exported: true, extra: ['from', 'to'] }),
385
391
  defaultContextCheck({
386
392
  match: ({context, isA}) => isA(context.marker, 'unit'),
387
393
  exported: true,
@@ -32,7 +32,7 @@
32
32
  "points are nameable orderable countable and memorable",
33
33
  "drone modifies direction",
34
34
  {
35
- "apply": "(args) => {\n expectDirection(args)\n expectDistanceForMove(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, gr, fragments, e, say}) => {\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 objects.runCommand = true\n objects.current.speed = desired_speed\n objects.current.speedUnitsOfUser = context.unit\n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && 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 && context.marker == 'controlEnd',\n apply: async ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n await api.sendCommand()\n }\n }\n })\n }"
35
+ "apply": "(args) => {\n expectDirection(args)\n expectDistanceForMove(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, gr, fragments, e, say}) => {\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 objects.runCommand = true\n objects.current.speed = desired_speed\n objects.current.speedUnitsOfUser = context.unit\n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && 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 && context.marker == 'controlEnd',\n apply: async ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n await api.sendCommand()\n }\n }\n })\n }"
36
36
  },
37
37
  {
38
38
  "priorities": [
@@ -164,6 +164,7 @@
164
164
  },
165
165
  {
166
166
  "id": "startPath",
167
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:942",
167
168
  "isA": [
168
169
  "verb"
169
170
  ],
@@ -263,6 +264,7 @@
263
264
  },
264
265
  {
265
266
  "id": "patrol",
267
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:983",
266
268
  "isA": [
267
269
  "verb",
268
270
  "repeatable",
@@ -284,10 +286,11 @@
284
286
  },
285
287
  "path"
286
288
  ],
287
- "semantic": "async ({context, g, e, toArray, fragments, toEValue, toFinalValue, recall, objects, verbatim}) => {\n const paths = toArray(context.path)\n for (const context_path of paths) {\n const evaluated = await(e(context_path))\n const path = toEValue(evaluated)\n if (path.marker === 'undefined') {\n verbatim(`${await g(context_path)} is not a known path`)\n continue\n }\n \n objects.current.path.push({ message: await g(context) })\n\n // TODO put this in a common place for use by do+patrol \n\n // ordinal to pause time in seconds \n const pauseTimeInSeconds = {}\n if (context.pause) {\n const timeAtPoints = toArray(context.pause.timeAtPoint)\n for (const timeAtPoint of timeAtPoints) {\n const instantiation = await fragments(\"quantity in seconds\", { quantity: timeAtPoint.time })\n const result = await e(instantiation)\n const seconds = toFinalValue(toFinalValue(result).amount)\n\n const points = await recall({ context: timeAtPoint.point.point, frameOfReference: path })\n for (const point of toArray(points)) {\n pauseTimeInSeconds[point.ordinal] = seconds\n }\n }\n }\n\n let skipPoints = []\n if (context.skip) {\n skipPoints = toArray(await recall({ context: context.skip.points, frameOfReference: path }))\n }\n\n // get to the start of the patrol \n objects.current.path.push(path.points[0])\n objects.current.path.push({ aimOnly: true, ...path.points[1] })\n objects.current.path.push({ repeatStart: true })\n for (const point of path.points) {\n if (skipPoints.find((skipPoint) => skipPoint.ordinal == point.ordinal)) {\n continue\n }\n objects.current.path.push(point)\n if (pauseTimeInSeconds[point.ordinal]) {\n objects.current.path.push({ marker: 'pause', pauseSeconds: pauseTimeInSeconds[point.ordinal] })\n }\n }\n if (context.repeats) {\n objects.current.timeRepeats = toFinalValue(context.repeats.repeats)\n }\n // if the patrol does not start and end at the same spot then \n // go back to the start along the same path\n\n\n // if the start is not the end of the patrol then go backwards along the patrol\n if (JSON.stringify(path.points[0].point) !== JSON.stringify(path.points[path.points.length-1].point)) {\n for (const point of [...path.points].reverse().slice(1)) {\n if (skipPoints.find((skipPoint) => skipPoint.ordinal == point.ordinal)) {\n continue\n }\n objects.current.path.push(point)\n if (pauseTimeInSeconds[point.ordinal]) {\n objects.current.path.push({ marker: 'pause', pauseSeconds: pauseTimeInSeconds[point.ordinal] })\n }\n }\n\n const secondPoint = path.points[1]\n objects.current.path.push({ ...secondPoint, aimOnly: true })\n }\n }\n objects.runCommand = true\n }"
289
+ "semantic": "async ({context, g, e, toArray, fragments, toEValue, toFinalValue, recall, objects, verbatim}) => {\n const paths = toArray(context.path)\n for (const context_path of paths) {\n const evaluated = await(e(context_path))\n const path = toEValue(evaluated)\n if (path.marker === 'undefined') {\n verbatim(`${await g(context_path)} is not a known path`)\n continue\n }\n \n objects.current.path.push({ message: await g(context) })\n\n // TODO put this in a common place for use by do+patrol \n\n // ordinal to pause time in seconds \n const pauseTimeInSeconds = {}\n if (context.pause) {\n const timeAtPoints = toArray(context.pause.timeAtPoint)\n for (const timeAtPoint of timeAtPoints) {\n const instantiation = await fragments(\"quantity in seconds\", { quantity: timeAtPoint.time })\n const result = await e(instantiation, where())\n const seconds = toFinalValue(toFinalValue(result).amount)\n\n const points = await recall({ context: timeAtPoint.point.point, frameOfReference: path })\n for (const point of toArray(points)) {\n pauseTimeInSeconds[point.ordinal] = seconds\n }\n }\n }\n\n let skipPoints = []\n if (context.skip) {\n skipPoints = toArray(await recall({ context: context.skip.points, frameOfReference: path }))\n }\n\n // get to the start of the patrol \n objects.current.path.push(path.points[0])\n objects.current.path.push({ aimOnly: true, ...path.points[1] })\n objects.current.path.push({ repeatStart: true })\n for (const point of path.points) {\n if (skipPoints.find((skipPoint) => skipPoint.ordinal == point.ordinal)) {\n continue\n }\n objects.current.path.push(point)\n if (pauseTimeInSeconds[point.ordinal]) {\n objects.current.path.push({ marker: 'pause', pauseSeconds: pauseTimeInSeconds[point.ordinal] })\n }\n }\n if (context.repeats) {\n objects.current.timeRepeats = toFinalValue(context.repeats.repeats)\n }\n // if the patrol does not start and end at the same spot then \n // go back to the start along the same path\n\n\n // if the start is not the end of the patrol then go backwards along the patrol\n if (JSON.stringify(path.points[0].point) !== JSON.stringify(path.points[path.points.length-1].point)) {\n for (const point of [...path.points].reverse().slice(1)) {\n if (skipPoints.find((skipPoint) => skipPoint.ordinal == point.ordinal)) {\n continue\n }\n objects.current.path.push(point)\n if (pauseTimeInSeconds[point.ordinal]) {\n objects.current.path.push({ marker: 'pause', pauseSeconds: pauseTimeInSeconds[point.ordinal] })\n }\n }\n\n const secondPoint = path.points[1]\n objects.current.path.push({ ...secondPoint, aimOnly: true })\n }\n }\n objects.runCommand = true\n }"
288
290
  },
289
291
  {
290
292
  "id": "lift",
293
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1068",
291
294
  "isA": [
292
295
  "verb"
293
296
  ],
@@ -311,6 +314,7 @@
311
314
  },
312
315
  {
313
316
  "id": "lower",
317
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1080",
314
318
  "isA": [
315
319
  "verb"
316
320
  ],
@@ -334,6 +338,7 @@
334
338
  },
335
339
  {
336
340
  "id": "openDrone",
341
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1092",
337
342
  "isA": [
338
343
  "verb"
339
344
  ],
@@ -357,6 +362,7 @@
357
362
  },
358
363
  {
359
364
  "id": "close",
365
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1104",
360
366
  "isA": [
361
367
  "verb"
362
368
  ],
@@ -380,6 +386,7 @@
380
386
  },
381
387
  {
382
388
  "id": "back",
389
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1116",
383
390
  "isA": [
384
391
  "noun"
385
392
  ],
@@ -393,6 +400,7 @@
393
400
  },
394
401
  {
395
402
  "id": "toPoint",
403
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1128",
396
404
  "isA": [
397
405
  "preposition"
398
406
  ],
@@ -418,10 +426,11 @@
418
426
  },
419
427
  "point"
420
428
  ],
421
- "semantic": "async ({objects, api, e, context}) => {\n objects.runCommand = true\n const point = await e(context.point)\n objects.current.path.push(point.evalue)\n }"
429
+ "semantic": "async ({objects, api, e, context}) => {\n objects.runCommand = true\n const point = await e(context.point, where())\n objects.current.path.push(point.evalue)\n }"
422
430
  },
423
431
  {
424
432
  "id": "go",
433
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1141",
425
434
  "level": 0,
426
435
  "isA": [
427
436
  "verb",
@@ -577,10 +586,11 @@
577
586
  "points": "(@<= 'point')"
578
587
  }
579
588
  },
580
- "semantic": "async (args) => {\n const {api, toFinalValue, context, objects, e, toArray, toEValue} = args\n if (context.distance) {\n await handleDistance(args, context.distance)\n }\n if (context.direction) {\n const array = toArray(context.direction)\n if (array.length == 2 && array[0].marker == 'back' && array[1].marker == 'forth') {\n await args.api.backAndForth()\n } else if (context.direction.marker == 'back') {\n await args.api.back(context.points)\n } else {\n objects.current.direction = context.direction.marker\n }\n }\n if (context.repeats) {\n objects.current.timeRepeats = toFinalValue(context.repeats.repeats)\n }\n if (context.to) {\n const evaluation = await e(context.to.point)\n const point = toEValue(evaluation)\n objects.current.path.push(point)\n }\n objects.runCommand = true\n await api.sendCommand()\n }"
589
+ "semantic": "async (args) => {\n const {api, toFinalValue, context, objects, e, toArray, toEValue} = args\n if (context.distance) {\n await handleDistance(args, context.distance)\n }\n if (context.direction) {\n const array = toArray(context.direction)\n if (array.length == 2 && array[0].marker == 'back' && array[1].marker == 'forth') {\n await args.api.backAndForth()\n } else if (context.direction.marker == 'back') {\n await args.api.back(context.points)\n } else {\n objects.current.direction = context.direction.marker\n }\n }\n if (context.repeats) {\n objects.current.timeRepeats = toFinalValue(context.repeats.repeats)\n }\n if (context.to) {\n const evaluation = await e(context.to.point, where())\n const point = toEValue(evaluation)\n objects.current.path.push(point)\n }\n objects.runCommand = true\n await api.sendCommand()\n }"
581
590
  },
582
591
  {
583
592
  "id": "turn",
593
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1195",
584
594
  "isA": [
585
595
  "verb",
586
596
  "action",
@@ -616,10 +626,11 @@
616
626
  "angle": "(@<= 'quantity' && context.unit.dimension == 'angle')"
617
627
  }
618
628
  },
619
- "semantic": "async ({context, fragments, objects, e, s, api, say, toFinalValue}) => {\n const current = objects.current\n current.direction = context.direction.marker\n if (context.repeats) {\n current.timeRepeats = toFinalValue(context.repeats.repeats)\n }\n async function toRadians(angle) {\n const fi = await fragments(\"40 degrees in radians\")\n return await fi.instantiate([\n { \n match: ({path, pathEquals}) => pathEquals(path, ['0', 'from']),\n apply: ({context}) => {\n Object.assign(context, angle)\n }\n }\n ])\n }\n if (context.angle) {\n const instantiation = await toRadians(context.angle)\n try {\n const result = await e(instantiation)\n current.turnAngle = toFinalValue(result.evalue.amount)\n objects.runCommand = true\n } catch (e) {\n say(`Don't know how to interpret ${await gp(context.angle)} in radians`)\n return\n }\n }\n if (context.repeats) {\n objects.current.timeRepeats = toFinalValue(context.repeats.repeats)\n }\n current.justTurn = true\n objects.runCommand = true\n await api.sendCommand()\n }"
629
+ "semantic": "async ({context, fragments, objects, e, s, api, say, toFinalValue}) => {\n const current = objects.current\n current.direction = context.direction.marker\n if (context.repeats) {\n current.timeRepeats = toFinalValue(context.repeats.repeats)\n }\n async function toRadians(angle) {\n const fi = await fragments(\"40 degrees in radians\")\n return await fi.instantiate([\n { \n match: ({path, pathEquals}) => pathEquals(path, ['0', 'from']),\n apply: ({context}) => {\n Object.assign(context, angle)\n }\n }\n ])\n }\n if (context.angle) {\n const instantiation = await toRadians(context.angle)\n try {\n const result = await e(instantiation, where())\n current.turnAngle = toFinalValue(result.evalue.amount)\n objects.runCommand = true\n } catch (e) {\n say(`Don't know how to interpret ${await gp(context.angle)} in radians`)\n return\n }\n }\n if (context.repeats) {\n objects.current.timeRepeats = toFinalValue(context.repeats.repeats)\n }\n current.justTurn = true\n objects.runCommand = true\n await api.sendCommand()\n }"
620
630
  },
621
631
  {
622
632
  "id": "pause",
633
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1254",
623
634
  "isA": [
624
635
  "verb"
625
636
  ],
@@ -769,7 +780,7 @@
769
780
  "timeAtPoint": "(@<= 'timeAtPoint')"
770
781
  }
771
782
  },
772
- "semantic": "async ({context, remember, api, e, fragments, toFinalValue}) => {\n let time = context.time \n if (!time) {\n return\n }\n if (time.marker == 'forQuantity') {\n time = time.quantity\n }\n const instantiation = await fragments(\"quantity in seconds\", { quantity: time})\n const result = await e(instantiation)\n const seconds = toFinalValue(toFinalValue(result).amount)\n context.pauseSeconds = seconds\n remember(context)\n api.pause(seconds)\n }"
783
+ "semantic": "async ({context, remember, api, e, fragments, toFinalValue}) => {\n let time = context.time \n if (!time) {\n return\n }\n if (time.marker == 'forQuantity') {\n time = time.quantity\n }\n const instantiation = await fragments(\"quantity in seconds\", { quantity: time})\n const result = await e(instantiation, where())\n const seconds = toFinalValue(toFinalValue(result).amount)\n context.pauseSeconds = seconds\n remember(context)\n api.pause(seconds)\n }"
773
784
  },
774
785
  {
775
786
  "id": "pause",
@@ -800,6 +811,7 @@
800
811
  },
801
812
  {
802
813
  "id": "stop",
814
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1299",
803
815
  "isA": [
804
816
  "verb"
805
817
  ],
@@ -823,7 +835,7 @@
823
835
  "semantics": [
824
836
  {
825
837
  "match": "({context}) => context.marker == 'doAction'",
826
- "apply": "async ({context, fragments, e, s, toEValue, toFinalValue, namespaced, objects}) => {\n const updated = { ...context, marker: 'patrol', path: context.action }\n namespaced.set('actions', updated, 'logged', true)\n await s(updated)\n // await s({ ...context, marker: 'patrol', path: context.action })\n }"
838
+ "apply": "async ({context, fragments, e, toEValue, toFinalValue, namespaced, objects}) => {\n const updated = { ...context, marker: 'patrol', path: context.action }\n namespaced.set('actions', updated, 'logged', true)\n await e(updated, where())\n }"
827
839
  },
828
840
  {
829
841
  "match": "({context, contextHierarchy}) => {\n if (!context.pullFromContext || contextHierarchy.under(['doAction', 'evaluate', 'patrol']) || context.isInstance) {\n return false\n }\n \n if (context.marker == 'path' || context.marker == 'this' || context.marker == 'that') {\n return true\n }\n }",
@@ -831,7 +843,7 @@
831
843
  },
832
844
  {
833
845
  "match": "({context, contextHierarchy}) => {\n if (!context.pullFromContext || !contextHierarchy.under('call') || context.notUnderCall) {\n return false\n }\n \n if (context.marker == 'point' || context.marker == 'ordinal') {\n return true\n }\n }",
834
- "apply": "async ({frameOfReference, context, e, fragments, stm, toEValue, toArray, objects, remember, recall, resolveEvaluate, _continue, contextHierarchy}) => {\n const evaluated = await e({...context, notUnderCall: true})\n const pointsContext = toEValue(evaluated)\n const pathComponents = toArray(pointsContext)\n\n const path = (await fragments('path')).contexts()[0]\n delete path.value\n path.isInstance = true\n path.points = [...pathComponents]\n frameOfReference(path, { mentioned: 'points', reversed: true })\n await remember(path)\n resolveEvaluate(context, path)\n }"
846
+ "apply": "async ({frameOfReference, context, e, fragments, stm, toEValue, toArray, objects, remember, recall, resolveEvaluate, _continue, contextHierarchy}) => {\n const evaluated = await e({...context, notUnderCall: true}, where())\n const pointsContext = toEValue(evaluated)\n const pathComponents = toArray(pointsContext)\n\n const path = (await fragments('path')).contexts()[0]\n delete path.value\n path.isInstance = true\n path.points = [...pathComponents]\n frameOfReference(path, { mentioned: 'points', reversed: true })\n await remember(path)\n resolveEvaluate(context, path)\n }"
835
847
  },
836
848
  {
837
849
  "match": "({context}) => ['start', 'end'].includes(context.marker) && context.objects && context.objects[1].marker == 'path'",
@@ -843,11 +855,11 @@
843
855
  },
844
856
  {
845
857
  "match": "({context}) => {\n // from stm lookup\n if (context.marker == 'mentions' && context.args.context.marker == 'speed') {\n return true\n }\n // from property directly\n if (context.marker == 'speed') {\n return true\n }\n }",
846
- "apply": "async ({gp, s, context, objects, fragments, resolveEvaluate, api}) => {\n let return_context = context\n if (context.marker == 'speed') {\n // okay\n } else {\n // stm lookup\n return_context = context\n context = context.args.context\n }\n let value = objects.current.speed\n if (context.condition) {\n if (['highest', 'maximum'].includes(context.condition.marker)) {\n value = api.maximumSpeedDrone()\n } else if (['lowest', 'minimum'].includes(context.condition.marker)) {\n value = api.minimumSpeedDrone()\n }\n }\n const speed = await fragments(\"number meters per second\", { number: { marker: 'integer', value, word: undefined} })\n const preferred = await s({ marker: 'preferredUnits', quantity: speed }) \n resolveEvaluate(return_context, preferred.evalue || speed)\n }"
858
+ "apply": "async ({gp, e, context, objects, fragments, resolveEvaluate, api}) => {\n let return_context = context\n if (context.marker == 'speed') {\n // okay\n } else {\n // stm lookup\n return_context = context\n context = context.args.context\n }\n let value = objects.current.speed\n if (context.condition) {\n if (['highest', 'maximum'].includes(context.condition.marker)) {\n value = api.maximumSpeedDrone()\n } else if (['lowest', 'minimum'].includes(context.condition.marker)) {\n value = api.minimumSpeedDrone()\n }\n }\n const speed = await fragments(\"number meters per second\", { number: { marker: 'integer', value, word: undefined} })\n const preferred = await e({ marker: 'preferredUnits', quantity: speed }, where()) \n resolveEvaluate(return_context, preferred.evalue || speed)\n }"
847
859
  },
848
860
  {
849
861
  "match": "({context}) => {\n if (context.marker == 'mentions' && ['direction', 'drone_direction'].includes(context.args.context.marker)) {\n return true\n }\n if (['direction', 'drone_direction'].includes(context.marker)) {\n return true\n }\n }",
850
- "apply": "async ({gp, s, context, objects, fragments, resolveEvaluate, api}) => {\n const value = objects.current.angleInRadians\n const fi = await fragments(\"number radians\")\n const direction = await fi.instantiate([\n { \n match: ({path, pathEquals}) => pathEquals(path, ['0', 'amount']),\n apply: ({context}) => {\n Object.assign(context, { marker: 'number', value: value, word: undefined })\n }\n }\n ])\n const preferred = await s({ marker: 'preferredUnits', quantity: direction }) \n resolveEvaluate(context, preferred.evalue || direction)\n }"
862
+ "apply": "async ({gp, e, context, objects, fragments, resolveEvaluate, api}) => {\n const value = objects.current.angleInRadians\n const fi = await fragments(\"number radians\")\n const direction = await fi.instantiate([\n { \n match: ({path, pathEquals}) => pathEquals(path, ['0', 'amount']),\n apply: ({context}) => {\n Object.assign(context, { marker: 'number', value: value, word: undefined })\n }\n }\n ])\n const preferred = await e({ marker: 'preferredUnits', quantity: direction }, where()) \n resolveEvaluate(context, preferred.evalue || direction)\n }"
851
863
  },
852
864
  {
853
865
  "match": "({context}) => context.marker == 'timeRepeats'",
@@ -9996,7 +10008,7 @@
9996
10008
  }
9997
10009
  },
9998
10010
  {
9999
- "apply": "(args) => {\n expectDirection(args)\n expectDistanceForMove(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, gr, fragments, e, say}) => {\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 objects.runCommand = true\n objects.current.speed = desired_speed\n objects.current.speedUnitsOfUser = context.unit\n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && 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 && context.marker == 'controlEnd',\n apply: async ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n await api.sendCommand()\n }\n }\n })\n }"
10011
+ "apply": "(args) => {\n expectDirection(args)\n expectDistanceForMove(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, gr, fragments, e, say}) => {\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 objects.runCommand = true\n objects.current.speed = desired_speed\n objects.current.speedUnitsOfUser = context.unit\n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && 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 && context.marker == 'controlEnd',\n apply: async ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n await api.sendCommand()\n }\n }\n })\n }"
10000
10012
  },
10001
10013
  {
10002
10014
  "extraConfig": true,
@@ -10129,6 +10141,7 @@
10129
10141
  },
10130
10142
  {
10131
10143
  "id": "startPath",
10144
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:942",
10132
10145
  "isA": [
10133
10146
  "verb"
10134
10147
  ],
@@ -10227,6 +10240,7 @@
10227
10240
  },
10228
10241
  {
10229
10242
  "id": "patrol",
10243
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:983",
10230
10244
  "isA": [
10231
10245
  "verb",
10232
10246
  "repeatable",
@@ -10251,6 +10265,7 @@
10251
10265
  },
10252
10266
  {
10253
10267
  "id": "lift",
10268
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1068",
10254
10269
  "isA": [
10255
10270
  "verb"
10256
10271
  ],
@@ -10273,6 +10288,7 @@
10273
10288
  },
10274
10289
  {
10275
10290
  "id": "lower",
10291
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1080",
10276
10292
  "isA": [
10277
10293
  "verb"
10278
10294
  ],
@@ -10295,6 +10311,7 @@
10295
10311
  },
10296
10312
  {
10297
10313
  "id": "openDrone",
10314
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1092",
10298
10315
  "isA": [
10299
10316
  "verb"
10300
10317
  ],
@@ -10317,6 +10334,7 @@
10317
10334
  },
10318
10335
  {
10319
10336
  "id": "close",
10337
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1104",
10320
10338
  "isA": [
10321
10339
  "verb"
10322
10340
  ],
@@ -10339,6 +10357,7 @@
10339
10357
  },
10340
10358
  {
10341
10359
  "id": "back",
10360
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1116",
10342
10361
  "isA": [
10343
10362
  "noun"
10344
10363
  ]
@@ -10351,6 +10370,7 @@
10351
10370
  },
10352
10371
  {
10353
10372
  "id": "toPoint",
10373
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1128",
10354
10374
  "isA": [
10355
10375
  "preposition"
10356
10376
  ],
@@ -10379,6 +10399,7 @@
10379
10399
  },
10380
10400
  {
10381
10401
  "id": "go",
10402
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1141",
10382
10403
  "level": 0,
10383
10404
  "isA": [
10384
10405
  "verb",
@@ -10537,6 +10558,7 @@
10537
10558
  },
10538
10559
  {
10539
10560
  "id": "turn",
10561
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1195",
10540
10562
  "isA": [
10541
10563
  "verb",
10542
10564
  "action",
@@ -10575,6 +10597,7 @@
10575
10597
  },
10576
10598
  {
10577
10599
  "id": "pause",
10600
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1254",
10578
10601
  "isA": [
10579
10602
  "verb"
10580
10603
  ],
@@ -10754,6 +10777,7 @@
10754
10777
  },
10755
10778
  {
10756
10779
  "id": "stop",
10780
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1299",
10757
10781
  "isA": [
10758
10782
  "verb"
10759
10783
  ],
@@ -10769,29 +10793,29 @@
10769
10793
  ],
10770
10794
  "semantics": [
10771
10795
  {
10772
- "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1328"
10796
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1323"
10773
10797
  },
10774
10798
  {
10775
- "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1338"
10799
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1332"
10776
10800
  },
10777
10801
  {
10778
- "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1365"
10802
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1359"
10779
10803
  },
10780
10804
  {
10781
- "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1400"
10805
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1394"
10782
10806
  },
10783
10807
  {},
10784
10808
  {
10785
- "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1437"
10809
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1431"
10786
10810
  },
10787
10811
  {
10788
- "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1471"
10812
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1465"
10789
10813
  },
10790
10814
  {
10791
- "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1497"
10815
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1491"
10792
10816
  },
10793
10817
  {
10794
- "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1504"
10818
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1498"
10795
10819
  }
10796
10820
  ]
10797
10821
  }