tpmkms 9.6.3-beta.3 → 9.6.3-beta.5

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.
@@ -40,7 +40,7 @@
40
40
  "semantics": [
41
41
  {
42
42
  "match": "({context, isA}) => isA(context.marker, 'action')",
43
- "apply": "({context, _continue, mentioned}) => {\n mentioned(context)\n _continue()\n }"
43
+ "apply": "({context, _continue, remember}) => {\n remember(context)\n _continue()\n }"
44
44
  }
45
45
  ]
46
46
  }
package/common/actions.js CHANGED
@@ -39,8 +39,8 @@ const config = {
39
39
  {
40
40
  priority: -1,
41
41
  match: ({context, isA}) => isA(context.marker, 'action'),
42
- apply: ({context, _continue, mentioned}) => {
43
- mentioned(context)
42
+ apply: ({context, _continue, remember}) => {
43
+ remember(context)
44
44
  _continue()
45
45
  }
46
46
  },
@@ -544,12 +544,12 @@ const config = {
544
544
  concept = two;
545
545
  value = one;
546
546
  }
547
- // km('dialogues').api.mentioned(concept)
547
+ // km('dialogues').api.remember(concept)
548
548
  // TODO wtf is the next line?
549
549
  value = JSON.parse(JSON.stringify(value))
550
550
  const instance = await e(value)
551
551
  if (false && instance.evalue) {
552
- km('stm').api.mentioned({ context: value })
552
+ km('stm').api.remember({ context: value })
553
553
  }
554
554
  if (instance.verbatim) {
555
555
  context.evalue = { verbatim: instance.verbatim }
@@ -647,7 +647,7 @@ const config = {
647
647
  for (const child of propertyToArray(one)) {
648
648
  await api.makeObject({ context: child, config, types: context.two.types || [] })
649
649
  kms.stm.api.setVariable(child.value, two)
650
- kms.stm.api.mentioned({ context: child, value: two })
650
+ kms.stm.api.remember({ context: child, value: two })
651
651
  }
652
652
  }
653
653
  }
@@ -38,7 +38,7 @@ class API {
38
38
  }
39
39
 
40
40
  async getPreferredUnits(quantity) {
41
- const preferredUnits = await this.args.mentions({
41
+ const preferredUnits = await this.args.recall({
42
42
  context: { marker: 'unit' },
43
43
  condition: (unit) => {
44
44
  if (quantity.unit.marker == 'unitPerUnit') {
@@ -57,7 +57,7 @@ class API {
57
57
  }
58
58
 
59
59
  setPreferredUnits(units) {
60
- this.args.mentioned(units)
60
+ this.args.remember(units)
61
61
  }
62
62
 
63
63
  setMeasurementSystem(measurementSystem) {
@@ -108,7 +108,7 @@ class API {
108
108
  const formula = kms.formulas.api.get(to, [efrom.unit])
109
109
  if (!formula) {
110
110
  const reason = { marker: 'reason', focusableForPhrase: true, evalue: { marker: 'noconversion', from: efrom.unit, to } }
111
- kms.stm.api.mentioned({ context: reason })
111
+ kms.stm.api.remember({ context: reason })
112
112
  error(reason)
113
113
  }
114
114
  kms.stm.api.setVariable(efrom.unit.value, efrom.amount)
@@ -95,7 +95,7 @@
95
95
  "isA": [
96
96
  "noun"
97
97
  ],
98
- "semantic": "async ({objects, mentions, api, e, context, say}) => {\n await api.back()\n }"
98
+ "semantic": "async ({objects, api, e, context, say}) => {\n await api.back()\n }"
99
99
  },
100
100
  {
101
101
  "id": "forth",
@@ -322,7 +322,7 @@
322
322
  "time": "(@<= 'quantity' && context.unit.dimension == 'time')"
323
323
  }
324
324
  },
325
- "semantic": "async ({context, mentioned, api, e, fragments, toFinalValue}) => {\n let time = context.time \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 mentioned(context)\n api.pause(seconds)\n }"
325
+ "semantic": "async ({context, remember, api, e, fragments, toFinalValue}) => {\n let time = context.time \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 }"
326
326
  },
327
327
  {
328
328
  "id": "stop",
@@ -333,7 +333,7 @@
333
333
  "1": "{ marker: 'drone' }"
334
334
  },
335
335
  "bridge": "{ ...next(operator), object: after[0], interpolate: [{ context: operator }, { property: 'object' }] }",
336
- "semantic": "async ({mentioned, context, objects, api, say}) => {\n await api.stop()\n await api.markCurrentPoint()\n }"
336
+ "semantic": "async ({context, objects, api, say}) => {\n await api.stop()\n await api.markCurrentPoint()\n }"
337
337
  }
338
338
  ],
339
339
  "generators": [
@@ -353,11 +353,11 @@
353
353
  },
354
354
  {
355
355
  "match": "({context, contextHierarchy}) => {\n if (!context.pullFromContext || !context.evaluate || contextHierarchy.under(['doAction', 'evaluate'])) {\n return false\n }\n \n if (context.marker == 'path' || context.marker == 'this' || context.marker == 'that') {\n return true\n }\n }",
356
- "apply": "async ({context, frameOfReference, toArray, fragments, stm, objects, mentioned, mentions, resolveEvaluate, _continue, contextHierarchy}) => {\n const pathComponents = toArray(await mentions({ context: { marker: 'pathComponent' }, all: true }))\n const path = (await fragments('path')).contexts()[0]\n delete path.value\n path.points = pathComponents.reverse()\n frameOfReference(path, { mentioned: 'points', reversed: true })\n await mentioned(path)\n\n _continue() // let the call pick the object out from the stm\n }"
356
+ "apply": "async ({context, frameOfReference, toArray, fragments, stm, objects, remember, recall, resolveEvaluate, _continue, contextHierarchy}) => {\n const pathComponents = toArray(await recall({ context: { marker: 'pathComponent' }, all: true }))\n const path = (await fragments('path')).contexts()[0]\n delete path.value\n path.instance = true\n path.points = pathComponents.reverse()\n frameOfReference(path, { mentioned: 'points', reversed: true })\n await remember(path)\n\n _continue() // let the call pick the object out from the stm\n }"
357
357
  },
358
358
  {
359
359
  "match": "({context, contextHierarchy}) => {\n if (!context.pullFromContext || !context.evaluate || !contextHierarchy.under('call') || context.notUnderCall) {\n return false\n }\n \n if (context.marker == 'point' || context.marker == 'ordinal') {\n return true\n }\n }",
360
- "apply": "async ({context, e, fragments, stm, toEValue, toArray, objects, mentioned, mentions, 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.points = [...pathComponents]\n await mentioned(path)\n resolveEvaluate(context, path)\n }"
360
+ "apply": "async ({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.points = [...pathComponents]\n await remember(path)\n resolveEvaluate(context, path)\n }"
361
361
  },
362
362
  {
363
363
  "match": "({context}) => context.marker == 'thenTime'",
@@ -365,7 +365,7 @@
365
365
  },
366
366
  {
367
367
  "match": "({context}) => context.evaluate && ['start', 'end'].includes(context.marker) && context.objects && context.objects[1].marker == 'path'",
368
- "apply": "async ({gp, s, context, objects, fragments, resolveEvaluate, api, mentions}) => {\n const path = await mentions({ context: context.objects[1] })\n if (!path?.points) {\n return\n }\n if (context.marker == 'start') {\n resolveEvaluate(context, path?.points[0])\n } else if (context.marker == 'end') {\n resolveEvaluate(context, path?.points[path?.points.length-1])\n }\n }"
368
+ "apply": "async ({gp, s, context, objects, fragments, resolveEvaluate, api, recall}) => {\n const path = await recall({ context: context.objects[1] })\n if (!path?.points) {\n return\n }\n if (context.marker == 'start') {\n resolveEvaluate(context, path?.points[0])\n } else if (context.marker == 'end') {\n resolveEvaluate(context, path?.points[path?.points.length-1])\n }\n }"
369
369
  },
370
370
  {
371
371
  "match": "({context}) => context.marker == 'speed' && context.evaluate",
package/common/drone.js CHANGED
@@ -14,6 +14,10 @@ const help = require('./help')
14
14
  const { rotateDelta, degreesToRadians, radiansToDegrees, cartesianToPolar, smallestRotate } = require('./helpers/drone')
15
15
 
16
16
  /*
17
+ NEED TO CHECK ON ACTUAL DRONE
18
+
19
+ go to the second point of route 1
20
+
17
21
  DONE go back
18
22
  go back another point
19
23
  go back again
@@ -27,6 +31,9 @@ do route 1 pausing 10 seconds at each point
27
31
 
28
32
  forward 1 foot\nwest 1 foot\ngo back to the start <<<<<<<< turn the longer way not he shorter way
29
33
  forward 1 foot\nwest 1 foot\ncall the path route 1\ngo to the start of route 1\npatrol route 1\npatrol route 1 <<<<< does the patrol more than once
34
+ call that route 1
35
+ what are the paths
36
+ list the paths
30
37
 
31
38
  ?? elipses of the verb go or some kind of conjunction?!?!?
32
39
  go forward 1 meter turn right forward 2 meters stop
@@ -299,7 +306,7 @@ class API {
299
306
  objects.history = []
300
307
  objects.sonicTest = 5
301
308
 
302
- this.args.mentioned({ marker: 'point', ordinal: this.nextOrdinal(), point: { x: 0, y: 0 }, description: "start" })
309
+ this.args.remember({ marker: 'point', ordinal: this.nextOrdinal(), point: { x: 0, y: 0 }, description: "start" })
303
310
  }
304
311
 
305
312
  currentOrdinal() {
@@ -318,7 +325,7 @@ class API {
318
325
  return null // in motion
319
326
  }
320
327
  const ordinal = this.currentOrdinal()
321
- const lastPoint = await this.args.mentions({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal })
328
+ const lastPoint = await this.args.recall({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal })
322
329
  if (!current.startTime && !current.endTime && !current.durationInSeconds) {
323
330
  return lastPoint // did not move
324
331
  }
@@ -344,7 +351,7 @@ class API {
344
351
  return
345
352
  }
346
353
  const ordinal = this.nextOrdinal()
347
- this.args.mentioned({ marker: 'point', ordinal, point })
354
+ this.args.remember({ marker: 'point', ordinal, point })
348
355
  this._objects.current.endTime = null
349
356
  this._objects.current.startTime = null
350
357
  }
@@ -412,7 +419,7 @@ class API {
412
419
  if (objects.current.timeRepeats) {
413
420
  this.startRepeats(objects.current.timeRepeats)
414
421
  }
415
- let currentPoint = (await this.args.mentions({ context: { marker: 'point' } })).point
422
+ let currentPoint = (await this.args.recall({ context: { marker: 'point' } })).point
416
423
  this._objects.history.push({ marker: 'history', debug: 'doing path' })
417
424
  for (const pathComponent of objects.current.path) {
418
425
  if (pathComponent.marker == 'pause') {
@@ -421,7 +428,6 @@ class API {
421
428
  const points = this.args.toArray(pathComponent)
422
429
  // const destinationPoint = pathComponent.point
423
430
  const destinationPoint = points[0].point || points[0]
424
- debugger
425
431
  if (currentPoint.x == destinationPoint.x && currentPoint.y == destinationPoint.y) {
426
432
  // already there
427
433
  } else {
@@ -547,7 +553,7 @@ class API {
547
553
  } else {
548
554
  ordinal = this.currentOrdinal() - 1
549
555
  }
550
- const lastPoint = await this.args.mentions({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal })
556
+ const lastPoint = await this.args.recall({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal })
551
557
  if (!lastPoint) {
552
558
  this.args.say(`There is no previous point to go back to`)
553
559
  return
@@ -561,8 +567,8 @@ class API {
561
567
  const current = objects.current
562
568
  current.backAndForth = true
563
569
  const ordinal = this.currentOrdinal()
564
- const currentPoint = await this.args.mentions({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal })
565
- const lastPoint = await this.args.mentions({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal-1 })
570
+ const currentPoint = await this.args.recall({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal })
571
+ const lastPoint = await this.args.recall({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal-1 })
566
572
  current.path.push(lastPoint)
567
573
  current.path.push(currentPoint)
568
574
  objects.runCommand = true
@@ -921,7 +927,7 @@ const template = {
921
927
  {
922
928
  id: 'back',
923
929
  isA: ['noun'],
924
- semantic: async ({objects, mentions, api, e, context, say}) => {
930
+ semantic: async ({objects, api, e, context, say}) => {
925
931
  await api.back()
926
932
  }
927
933
  },
@@ -1053,7 +1059,7 @@ const template = {
1053
1059
  time: "(@<= 'quantity' && context.unit.dimension == 'time')",
1054
1060
  },
1055
1061
  },
1056
- semantic: async ({context, mentioned, api, e, fragments, toFinalValue}) => {
1062
+ semantic: async ({context, remember, api, e, fragments, toFinalValue}) => {
1057
1063
  let time = context.time
1058
1064
  if (time.marker == 'forQuantity') {
1059
1065
  time = time.quantity
@@ -1062,7 +1068,7 @@ const template = {
1062
1068
  const result = await e(instantiation)
1063
1069
  const seconds = toFinalValue(toFinalValue(result).amount)
1064
1070
  context.pauseSeconds = seconds
1065
- mentioned(context)
1071
+ remember(context)
1066
1072
  api.pause(seconds)
1067
1073
  }
1068
1074
  },
@@ -1073,7 +1079,7 @@ const template = {
1073
1079
  1: "{ marker: 'drone' }",
1074
1080
  },
1075
1081
  bridge: "{ ...next(operator), object: after[0], interpolate: [{ context: operator }, { property: 'object' }] }",
1076
- semantic: async ({mentioned, context, objects, api, say}) => {
1082
+ semantic: async ({context, objects, api, say}) => {
1077
1083
  await api.stop()
1078
1084
  await api.markCurrentPoint()
1079
1085
  }
@@ -1111,13 +1117,14 @@ const template = {
1111
1117
  return true
1112
1118
  }
1113
1119
  },
1114
- apply: async ({context, frameOfReference, toArray, fragments, stm, objects, mentioned, mentions, resolveEvaluate, _continue, contextHierarchy}) => {
1115
- const pathComponents = toArray(await mentions({ context: { marker: 'pathComponent' }, all: true }))
1120
+ apply: async ({context, frameOfReference, toArray, fragments, stm, objects, remember, recall, resolveEvaluate, _continue, contextHierarchy}) => {
1121
+ const pathComponents = toArray(await recall({ context: { marker: 'pathComponent' }, all: true }))
1116
1122
  const path = (await fragments('path')).contexts()[0]
1117
1123
  delete path.value
1124
+ path.instance = true
1118
1125
  path.points = pathComponents.reverse()
1119
1126
  frameOfReference(path, { mentioned: 'points', reversed: true })
1120
- await mentioned(path)
1127
+ await remember(path)
1121
1128
 
1122
1129
  _continue() // let the call pick the object out from the stm
1123
1130
  },
@@ -1132,15 +1139,17 @@ const template = {
1132
1139
  return true
1133
1140
  }
1134
1141
  },
1135
- apply: async ({context, e, fragments, stm, toEValue, toArray, objects, mentioned, mentions, resolveEvaluate, _continue, contextHierarchy}) => {
1142
+ apply: async ({frameOfReference, context, e, fragments, stm, toEValue, toArray, objects, remember, recall, resolveEvaluate, _continue, contextHierarchy}) => {
1136
1143
  const evaluated = await e({...context, notUnderCall: true})
1137
1144
  const pointsContext = toEValue(evaluated)
1138
1145
  const pathComponents = toArray(pointsContext)
1139
1146
 
1140
1147
  const path = (await fragments('path')).contexts()[0]
1141
1148
  delete path.value
1149
+ path.instance = true
1142
1150
  path.points = [...pathComponents]
1143
- await mentioned(path)
1151
+ frameOfReference(path, { mentioned: 'points', reversed: true })
1152
+ await remember(path)
1144
1153
  resolveEvaluate(context, path)
1145
1154
  },
1146
1155
  },
@@ -1154,8 +1163,8 @@ const template = {
1154
1163
  },
1155
1164
  {
1156
1165
  match: ({context}) => context.evaluate && ['start', 'end'].includes(context.marker) && context.objects && context.objects[1].marker == 'path',
1157
- apply: async ({gp, s, context, objects, fragments, resolveEvaluate, api, mentions}) => {
1158
- const path = await mentions({ context: context.objects[1] })
1166
+ apply: async ({gp, s, context, objects, fragments, resolveEvaluate, api, recall}) => {
1167
+ const path = await recall({ context: context.objects[1] })
1159
1168
  if (!path?.points) {
1160
1169
  return
1161
1170
  }
@@ -1241,6 +1250,7 @@ knowledgeModule( {
1241
1250
  defaultContextCheck({ marker: 'path', exported: true,
1242
1251
  extra: [
1243
1252
  'points',
1253
+ 'instance',
1244
1254
  {
1245
1255
  property: 'namespaced',
1246
1256
  check: [