ekms 9.8.0-beta.8 → 9.9.0-beta.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 (78) hide show
  1. package/common/actions.instance.json +6 -6
  2. package/common/actions.js +10 -10
  3. package/common/angle.instance.json +12 -0
  4. package/common/askfor.instance.json +12 -184
  5. package/common/askfor.js +19 -11
  6. package/common/asking.js +13 -5
  7. package/common/can.instance.json +2 -18
  8. package/common/can.js +2 -2
  9. package/common/comparable.instance.json +6 -12
  10. package/common/compass.js +1 -1
  11. package/common/concept.instance.json +8 -4
  12. package/common/concept.js +2 -0
  13. package/common/conjunction.js +9 -7
  14. package/common/control.js +5 -5
  15. package/common/countable.js +1 -0
  16. package/common/dateTimeSelectors.instance.json +1 -1
  17. package/common/dateTimeSelectors.js +1 -1
  18. package/common/dates.instance.json +11 -1
  19. package/common/dates.js +6 -1
  20. package/common/debug.instance.json +9 -1
  21. package/common/debug.js +4 -0
  22. package/common/dialogues.js +37 -35
  23. package/common/dimension.instance.json +198 -477
  24. package/common/dimension.js +48 -24
  25. package/common/drone.instance.json +89 -19
  26. package/common/drone.js +43 -41
  27. package/common/drone_v1.instance.json +13 -3
  28. package/common/drone_v1.js +20 -15
  29. package/common/evaluate.js +3 -3
  30. package/common/fastfood.instance.json +12 -4
  31. package/common/fastfood.js +27 -12
  32. package/common/formulas.instance.json +138 -12
  33. package/common/formulas.js +15 -6
  34. package/common/gdefaults.js +2 -71
  35. package/common/helpers/dialogues.js +1 -10
  36. package/common/helpers/properties.js +10 -7
  37. package/common/helpers.js +5 -2
  38. package/common/hierarchy.js +11 -7
  39. package/common/latin.instance.json +4 -4
  40. package/common/latin.js +2 -2
  41. package/common/length.instance.json +84 -0
  42. package/common/linear_orderings.instance.json +1 -0
  43. package/common/linear_orderings.js +90 -0
  44. package/common/linear_orderings.test.json +1 -0
  45. package/common/math.instance.json +141 -4
  46. package/common/math.js +18 -7
  47. package/common/menus.instance.json +6 -2
  48. package/common/menus.js +5 -2
  49. package/common/meta.js +12 -12
  50. package/common/nameable.js +6 -2
  51. package/common/numbers.instance.json +3 -0
  52. package/common/numbers.js +56 -32
  53. package/common/ordering.instance.json +1 -2
  54. package/common/percentages.js +4 -2
  55. package/common/pipboy.instance.json +38 -27
  56. package/common/pipboy.js +21 -14
  57. package/common/pressure.instance.json +6 -0
  58. package/common/properties.instance.json +2575 -528
  59. package/common/properties.js +211 -41
  60. package/common/punctuation.js +1 -0
  61. package/common/rates.instance.json +1 -1
  62. package/common/rates.js +2 -2
  63. package/common/reminders.instance.json +16 -0
  64. package/common/reminders.js +23 -19
  65. package/common/reports.instance.json +4 -6
  66. package/common/reports.js +12 -12
  67. package/common/sdefaults.js +11 -9
  68. package/common/stm.js +11 -14
  69. package/common/temperature.instance.json +21 -0
  70. package/common/testing.js +2 -2
  71. package/common/time.instance.json +87 -15
  72. package/common/time.js +7 -6
  73. package/common/ui.js +5 -5
  74. package/common/weight.instance.json +27 -0
  75. package/common/words.js +106 -1
  76. package/common/wp.instance.json +10 -3
  77. package/common/wp.js +5 -1
  78. package/package.json +5 -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
  }
@@ -147,7 +148,7 @@ class API {
147
148
  marker: 'quantity',
148
149
  level: 1,
149
150
  unit: evalue.to,
150
- amount: { evalue: evalue.value, paraphrase: undefined }
151
+ amount: evalue.value,
151
152
  }
152
153
  })
153
154
  if (evalues.length > 1) {
@@ -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
  }
@@ -227,7 +230,7 @@ const config = {
227
230
  {
228
231
  where: where(),
229
232
  id: "quantity",
230
- isA: ['noun'],
233
+ isA: ['noun', 'linearlyOrdered'],
231
234
  check: defaultContextCheckProperties(['amount', 'unit']),
232
235
  // bridge: "{ ...next(operator) }",
233
236
  generatorp: {
@@ -252,26 +255,28 @@ const config = {
252
255
  convolution: true,
253
256
  before: ['preposition', 'propertyMarker'],
254
257
  after: ['mathematical_operator'],
255
- // bridge: "{ marker: next(operator('quantity')), dead: true, unit: after[0], value: before[0].value, amount: before[0] }"
258
+ localHierarchy: [['linearOrderedRange', 'number']],
256
259
  bridge: `{
257
260
  marker: next(operator('quantity')),
258
261
  dead: true,
259
262
  instance: true,
263
+ rangeableWith: ['quantity'],
260
264
  unit: after[0],
261
265
  amount: before[0],
262
266
  interpolate: [ { property: 'amount' }, { property: 'unit' } ]
263
- }`
267
+ }`,
268
+ check: defaultContextCheckProperties(['unit', 'amount']),
264
269
  },
265
270
  {
266
271
  where: where(),
267
272
  id: "convertToUnits",
268
273
  bridge: "{ ...next(operator), from: before[0], to: after[0] }",
274
+ check: defaultContextCheckProperties(['from', 'to']),
269
275
  isA: ['expression', 'queryable'],
270
276
  localHierarchy: [['unknown', 'dimension']],
271
277
  after: [['possession', 0], ['possession', 1]],
272
278
  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}) => {
279
+ semantic: async ({context, api, toArray, callId, resolveEvaluate}) => {
275
280
  const from = context.from;
276
281
  const tos = toArray(context.to);
277
282
  resolveEvaluate(context, await api.convertToUnits(context, from, tos))
@@ -290,7 +295,7 @@ const template = {
290
295
  "amount is a concept",
291
296
  "measurement modifies unit",
292
297
  "dimension and measurement unit are concepts",
293
- "unit means measurement unit",
298
+ // "unit means measurement unit",
294
299
  ({apis}) => {
295
300
  apis('properties').addHierarchyWatcher({
296
301
  match: ({parentId, isA}) => isA(parentId, 'unit') && parentId.startsWith('unit_'),
@@ -321,6 +326,7 @@ const template = {
321
326
  bridges: [
322
327
  {
323
328
  id: 'useMeasurementSystem',
329
+ where: where(),
324
330
  isA: ['verb'],
325
331
  bridge: "{ ...next(operator), system: after[0], interpolate: [ { context: operator }, { property: 'system' } ] }",
326
332
  semantic: ({context, api}) => {
@@ -333,27 +339,44 @@ const template = {
333
339
  {
334
340
  semantics: [
335
341
  {
342
+ where: where(),
343
+ match: ({context, isA}) => {
344
+ if (context.marker == 'linearlyOrderedCompare') {
345
+ const terms = [context.left, context.right]
346
+ return terms.every((term) => isA(term, 'quantity')) && terms.every((term) => term.instance)
347
+ }
348
+ },
349
+ apply: async ({context, toFinalValue, toEValue, compare, resolveEvaluate, e}) => {
350
+ const { left, right } = context
351
+ if (left.propertyType !== right.propertyType) {
352
+ return
353
+ }
354
+ const convert = await e({ marker: 'convertToUnits', from: right, to: left.unit }, where())
355
+ const rightInLeftUnits = await toEValue(convert)
356
+ resolveEvaluate(context, await compare(left.amount, await rightInLeftUnits.amount))
357
+ }
358
+ },
359
+
360
+ {
361
+ where: where(),
336
362
  match: ({context, isA, debug}) => {
337
- return context.marker == 'unify' &&
338
- context.terms.every((term) => isA(term, 'quantity')) &&
339
- context.terms.every((term) => term.instance)
363
+ if (context.marker !== 'unify') {
364
+ return
365
+ }
366
+ if (context.terms[0].marker == 'linearOrderedRange') {
367
+ } else {
368
+ return context.terms.every((term) => isA(term, 'quantity')) && context.terms.every((term) => term.instance)
369
+ }
340
370
  },
341
- apply: async ({context, e, unify, toEValue}) => {
371
+ apply: async ({context, e, debug, unify, resolveEvaluate, toEValue}) => {
342
372
  const t1 = context.terms[0]
343
373
  const t2 = context.terms[1]
344
374
  if (t1.propertyType !== t2.propertyType) {
345
375
  return
346
376
  }
347
- if (t1[t1.propertyType].marker !== t2[t2.propertyType].marker) {
348
- return
349
- }
350
- const convert = await e({ marker: 'convertToUnits', from: t2, to: t1.unit })
351
- const t2InT1Units = await toEValue(await toEValue(convert))
352
- // debug.coxunter('greg29')
353
- if (!await unify(t1.amount, await t2InT1Units.amount)) {
354
- // debugger
355
- }
356
- // debugger
377
+ const convert = await e({ marker: 'convertToUnits', from: t2, to: t1.unit }, where())
378
+ const t2InT1Units = await toEValue(convert)
379
+ resolveEvaluate(context, await unify(t1.amount, await t2InT1Units.amount))
357
380
  }
358
381
  },
359
382
  ],
@@ -382,6 +405,7 @@ knowledgeModule({
382
405
  context: [
383
406
  defaultContextCheck({ marker: 'metric_system', exported: true }),
384
407
  defaultContextCheck({ marker: 'convertToUnits', exported: true, extra: ['from', 'to'] }),
408
+ defaultContextCheck({ marker: 'noconversion', exported: true, extra: ['from', 'to'] }),
385
409
  defaultContextCheck({
386
410
  match: ({context, isA}) => isA(context.marker, 'unit'),
387
411
  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, toEValue, 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 = toEValue(result.evalue.amount)\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:1196",
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:1255",
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:1300",
803
815
  "isA": [
804
816
  "verb"
805
817
  ],
@@ -810,6 +822,23 @@
810
822
  "semantic": "async ({context, objects, api, say}) => {\n await api.stop()\n await api.markCurrentPoint()\n }"
811
823
  }
812
824
  ],
825
+ "associations": {
826
+ "positive": [
827
+ {
828
+ "context": [
829
+ [
830
+ "go",
831
+ 0
832
+ ],
833
+ [
834
+ "toPoint",
835
+ 0
836
+ ]
837
+ ],
838
+ "choose": 0
839
+ }
840
+ ]
841
+ },
813
842
  "generators": [
814
843
  {
815
844
  "match": "({context}) => context.marker == 'help' && !context.paraphrase && context.isResponse",
@@ -823,7 +852,7 @@
823
852
  "semantics": [
824
853
  {
825
854
  "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 }"
855
+ "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
856
  },
828
857
  {
829
858
  "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 +860,7 @@
831
860
  },
832
861
  {
833
862
  "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 }"
863
+ "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
864
  },
836
865
  {
837
866
  "match": "({context}) => ['start', 'end'].includes(context.marker) && context.objects && context.objects[1].marker == 'path'",
@@ -843,11 +872,11 @@
843
872
  },
844
873
  {
845
874
  "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 }"
875
+ "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
876
  },
848
877
  {
849
878
  "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 }"
879
+ "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
880
  },
852
881
  {
853
882
  "match": "({context}) => context.marker == 'timeRepeats'",
@@ -9996,7 +10025,7 @@
9996
10025
  }
9997
10026
  },
9998
10027
  {
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 }"
10028
+ "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, toEValue, 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 = toEValue(result.evalue.amount)\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
10029
  },
10001
10030
  {
10002
10031
  "extraConfig": true,
@@ -10129,6 +10158,7 @@
10129
10158
  },
10130
10159
  {
10131
10160
  "id": "startPath",
10161
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:942",
10132
10162
  "isA": [
10133
10163
  "verb"
10134
10164
  ],
@@ -10227,6 +10257,7 @@
10227
10257
  },
10228
10258
  {
10229
10259
  "id": "patrol",
10260
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:983",
10230
10261
  "isA": [
10231
10262
  "verb",
10232
10263
  "repeatable",
@@ -10251,6 +10282,7 @@
10251
10282
  },
10252
10283
  {
10253
10284
  "id": "lift",
10285
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1068",
10254
10286
  "isA": [
10255
10287
  "verb"
10256
10288
  ],
@@ -10273,6 +10305,7 @@
10273
10305
  },
10274
10306
  {
10275
10307
  "id": "lower",
10308
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1080",
10276
10309
  "isA": [
10277
10310
  "verb"
10278
10311
  ],
@@ -10295,6 +10328,7 @@
10295
10328
  },
10296
10329
  {
10297
10330
  "id": "openDrone",
10331
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1092",
10298
10332
  "isA": [
10299
10333
  "verb"
10300
10334
  ],
@@ -10317,6 +10351,7 @@
10317
10351
  },
10318
10352
  {
10319
10353
  "id": "close",
10354
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1104",
10320
10355
  "isA": [
10321
10356
  "verb"
10322
10357
  ],
@@ -10339,6 +10374,7 @@
10339
10374
  },
10340
10375
  {
10341
10376
  "id": "back",
10377
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1116",
10342
10378
  "isA": [
10343
10379
  "noun"
10344
10380
  ]
@@ -10351,6 +10387,7 @@
10351
10387
  },
10352
10388
  {
10353
10389
  "id": "toPoint",
10390
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1128",
10354
10391
  "isA": [
10355
10392
  "preposition"
10356
10393
  ],
@@ -10379,6 +10416,7 @@
10379
10416
  },
10380
10417
  {
10381
10418
  "id": "go",
10419
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1141",
10382
10420
  "level": 0,
10383
10421
  "isA": [
10384
10422
  "verb",
@@ -10537,6 +10575,7 @@
10537
10575
  },
10538
10576
  {
10539
10577
  "id": "turn",
10578
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1196",
10540
10579
  "isA": [
10541
10580
  "verb",
10542
10581
  "action",
@@ -10575,6 +10614,7 @@
10575
10614
  },
10576
10615
  {
10577
10616
  "id": "pause",
10617
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1255",
10578
10618
  "isA": [
10579
10619
  "verb"
10580
10620
  ],
@@ -10754,6 +10794,7 @@
10754
10794
  },
10755
10795
  {
10756
10796
  "id": "stop",
10797
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1300",
10757
10798
  "isA": [
10758
10799
  "verb"
10759
10800
  ],
@@ -10763,35 +10804,52 @@
10763
10804
  "bridge": "{ ...next(operator), object: after[0], interpolate: [{ context: operator }, { property: 'object' }] }"
10764
10805
  }
10765
10806
  ],
10807
+ "associations": {
10808
+ "positive": [
10809
+ {
10810
+ "context": [
10811
+ [
10812
+ "go",
10813
+ 0
10814
+ ],
10815
+ [
10816
+ "toPoint",
10817
+ 0
10818
+ ]
10819
+ ],
10820
+ "choose": 0
10821
+ }
10822
+ ]
10823
+ },
10766
10824
  "generators": [
10767
10825
  {},
10768
10826
  {}
10769
10827
  ],
10770
10828
  "semantics": [
10771
10829
  {
10772
- "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1328"
10830
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1331"
10773
10831
  },
10774
10832
  {
10775
- "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1338"
10833
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1340"
10776
10834
  },
10777
10835
  {
10778
- "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1365"
10836
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1367"
10779
10837
  },
10780
10838
  {
10781
- "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1400"
10839
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1402"
10782
10840
  },
10783
10841
  {},
10784
10842
  {
10785
- "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1437"
10843
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1439"
10786
10844
  },
10787
10845
  {
10788
- "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1471"
10846
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1473"
10789
10847
  },
10790
10848
  {
10791
- "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1497"
10849
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1499"
10792
10850
  },
10793
10851
  {
10794
- "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1504"
10852
+ "where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1506"
10795
10853
  }
10796
10854
  ]
10797
10855
  }
@@ -11723,6 +11781,9 @@
11723
11781
  "marker": "quantity",
11724
11782
  "dead": true,
11725
11783
  "instance": true,
11784
+ "rangeableWith": [
11785
+ "quantity"
11786
+ ],
11726
11787
  "unit": {
11727
11788
  "marker": "unitPerUnit",
11728
11789
  "default": true,
@@ -12293,6 +12354,9 @@
12293
12354
  "marker": "quantity",
12294
12355
  "dead": true,
12295
12356
  "instance": true,
12357
+ "rangeableWith": [
12358
+ "quantity"
12359
+ ],
12296
12360
  "unit": {
12297
12361
  "value": "radian",
12298
12362
  "number": "many",
@@ -12590,6 +12654,9 @@
12590
12654
  "marker": "quantity",
12591
12655
  "dead": true,
12592
12656
  "instance": true,
12657
+ "rangeableWith": [
12658
+ "quantity"
12659
+ ],
12593
12660
  "unit": {
12594
12661
  "value": "degree",
12595
12662
  "number": "many",
@@ -12610,6 +12677,9 @@
12610
12677
  "amount": {
12611
12678
  "isInstance": true,
12612
12679
  "value": 40,
12680
+ "rangeableWith": [
12681
+ "number"
12682
+ ],
12613
12683
  "text": "40",
12614
12684
  "marker": "integer",
12615
12685
  "word": "40",