tpmkms 9.6.1-beta.4 → 9.6.1-beta.6
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.
- package/common/dimension.instance.json +1 -1
- package/common/dimension.js +3 -3
- package/common/drone.instance.json +9 -4
- package/common/drone.js +15 -15
- package/common/drone.test.json +12364 -119
- package/common/drone_v1.instance.json +3 -3
- package/common/drone_v1.js +14 -14
- package/common/helpers/conjunction.js +9 -5
- package/common/nameable.js +20 -13
- package/common/nameable.test.json +21 -21
- package/common/ordinals.js +13 -0
- package/common/properties.js +15 -6
- package/common/stm.js +73 -18
- package/package.json +2 -2
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"verb"
|
|
93
93
|
],
|
|
94
94
|
"bridge": "{ ...next(operator), quantity: after[0], operator: operator, interpolate: [{ property: 'operator' }, { property: 'quantity' }] }",
|
|
95
|
-
"semantic": "async ({context, e, api, toArray, resolveResponse}) => {\n const preferredUnits = api.getPreferredUnits(context.quantity)\n if (!preferredUnits) {\n return\n }\n const from = context.quantity;\n const value = await e({ marker: 'convertToUnits', from, to: preferredUnits })\n resolveResponse(context, value.evalue)\n }"
|
|
95
|
+
"semantic": "async ({context, e, api, toArray, resolveResponse}) => {\n const preferredUnits = await api.getPreferredUnits(context.quantity)\n if (!preferredUnits) {\n return\n }\n const from = context.quantity;\n const value = await e({ marker: 'convertToUnits', from, to: preferredUnits })\n resolveResponse(context, value.evalue)\n }"
|
|
96
96
|
},
|
|
97
97
|
{
|
|
98
98
|
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:214",
|
package/common/dimension.js
CHANGED
|
@@ -37,8 +37,8 @@ class API {
|
|
|
37
37
|
this._objects = objects
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
getPreferredUnits(quantity) {
|
|
41
|
-
const preferredUnits = this.args.mentions({
|
|
40
|
+
async getPreferredUnits(quantity) {
|
|
41
|
+
const preferredUnits = await this.args.mentions({
|
|
42
42
|
context: { marker: 'unit' },
|
|
43
43
|
condition: (unit) => {
|
|
44
44
|
if (quantity.unit.marker == 'unitPerUnit') {
|
|
@@ -201,7 +201,7 @@ const config = {
|
|
|
201
201
|
isA: ['verb'],
|
|
202
202
|
bridge: "{ ...next(operator), quantity: after[0], operator: operator, interpolate: [{ property: 'operator' }, { property: 'quantity' }] }",
|
|
203
203
|
semantic: async ({context, e, api, toArray, resolveResponse}) => {
|
|
204
|
-
const preferredUnits = api.getPreferredUnits(context.quantity)
|
|
204
|
+
const preferredUnits = await api.getPreferredUnits(context.quantity)
|
|
205
205
|
if (!preferredUnits) {
|
|
206
206
|
return
|
|
207
207
|
}
|
|
@@ -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 api.markCurrentPoint()\n }"
|
|
336
|
+
"semantic": "async ({mentioned, context, objects, api, say}) => {\n await api.stop()\n await api.markCurrentPoint()\n }"
|
|
337
337
|
}
|
|
338
338
|
],
|
|
339
339
|
"generators": [
|
|
@@ -352,8 +352,12 @@
|
|
|
352
352
|
"apply": "async ({context, e, toEValue, objects}) => {\n const evaluated = await(e(context.action))\n const path = toEValue(evaluated)\n for (const point of path.points) {\n objects.current.path.push(point)\n }\n objects.runCommand = true\n }"
|
|
353
353
|
},
|
|
354
354
|
{
|
|
355
|
-
"match": "({context, contextHierarchy}) => {\n if (!context.pullFromContext || !context.evaluate || contextHierarchy.under('doAction')) {\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, fragments, stm, objects, mentioned, mentions, resolveEvaluate, _continue, contextHierarchy}) => {\n
|
|
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 }"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
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.reverse()\n await mentioned(path)\n resolveEvaluate(context, path)\n }"
|
|
357
361
|
},
|
|
358
362
|
{
|
|
359
363
|
"match": "({context}) => context.marker == 'thenTime'",
|
|
@@ -361,7 +365,7 @@
|
|
|
361
365
|
},
|
|
362
366
|
{
|
|
363
367
|
"match": "({context}) => context.evaluate && ['start', 'end'].includes(context.marker) && context.objects && context.objects[1].marker == 'path'",
|
|
364
|
-
"apply": "async ({gp, s, context, objects, fragments, resolveEvaluate, api, mentions}) => {\n const path = 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, 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 }"
|
|
365
369
|
},
|
|
366
370
|
{
|
|
367
371
|
"match": "({context}) => context.marker == 'speed' && context.evaluate",
|
|
@@ -50265,6 +50269,7 @@
|
|
|
50265
50269
|
{},
|
|
50266
50270
|
{},
|
|
50267
50271
|
{},
|
|
50272
|
+
{},
|
|
50268
50273
|
{}
|
|
50269
50274
|
]
|
|
50270
50275
|
}
|
package/common/drone.js
CHANGED
|
@@ -310,7 +310,7 @@ class API {
|
|
|
310
310
|
return this._objects.current.ordinal += 1
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
currentPoint() {
|
|
313
|
+
async currentPoint() {
|
|
314
314
|
const current = this._objects.current
|
|
315
315
|
if (current.durationInSeconds) {
|
|
316
316
|
// okay
|
|
@@ -318,7 +318,7 @@ class API {
|
|
|
318
318
|
return null // in motion
|
|
319
319
|
}
|
|
320
320
|
const ordinal = this.currentOrdinal()
|
|
321
|
-
const lastPoint = this.args.mentions({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal })
|
|
321
|
+
const lastPoint = await this.args.mentions({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal })
|
|
322
322
|
if (!current.startTime && !current.endTime && !current.durationInSeconds) {
|
|
323
323
|
return lastPoint // did not move
|
|
324
324
|
}
|
|
@@ -338,8 +338,8 @@ class API {
|
|
|
338
338
|
return { x: xPrime, y: yPrime }
|
|
339
339
|
}
|
|
340
340
|
|
|
341
|
-
markCurrentPoint() {
|
|
342
|
-
const point = this.currentPoint()
|
|
341
|
+
async markCurrentPoint() {
|
|
342
|
+
const point = await this.currentPoint()
|
|
343
343
|
if (!point) {
|
|
344
344
|
return
|
|
345
345
|
}
|
|
@@ -405,14 +405,14 @@ class API {
|
|
|
405
405
|
objects.current.durationInSeconds = distanceMeters / speed_meters_per_second
|
|
406
406
|
await this.pause(objects.current.durationInSeconds, { batched: true })
|
|
407
407
|
await this.stop({ batched: true })
|
|
408
|
-
this.markCurrentPoint()
|
|
408
|
+
await this.markCurrentPoint()
|
|
409
409
|
}
|
|
410
410
|
|
|
411
411
|
if (objects.current.path.length > 0) {
|
|
412
412
|
if (objects.current.timeRepeats) {
|
|
413
413
|
this.startRepeats(objects.current.timeRepeats)
|
|
414
414
|
}
|
|
415
|
-
let currentPoint = this.args.mentions({ context: { marker: 'point' } }).point
|
|
415
|
+
let currentPoint = (await this.args.mentions({ context: { marker: 'point' } })).point
|
|
416
416
|
this._objects.history.push({ marker: 'history', debug: 'doing path' })
|
|
417
417
|
for (const pathComponent of objects.current.path) {
|
|
418
418
|
if (pathComponent.marker == 'pause') {
|
|
@@ -544,7 +544,7 @@ class API {
|
|
|
544
544
|
} else {
|
|
545
545
|
ordinal = this.currentOrdinal() - 1
|
|
546
546
|
}
|
|
547
|
-
const lastPoint = this.args.mentions({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal })
|
|
547
|
+
const lastPoint = await this.args.mentions({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal })
|
|
548
548
|
if (!lastPoint) {
|
|
549
549
|
this.args.say(`There is no previous point to go back to`)
|
|
550
550
|
return
|
|
@@ -558,8 +558,8 @@ class API {
|
|
|
558
558
|
const current = objects.current
|
|
559
559
|
current.backAndForth = true
|
|
560
560
|
const ordinal = this.currentOrdinal()
|
|
561
|
-
const currentPoint = this.args.mentions({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal })
|
|
562
|
-
const lastPoint = this.args.mentions({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal-1 })
|
|
561
|
+
const currentPoint = await this.args.mentions({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal })
|
|
562
|
+
const lastPoint = await this.args.mentions({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal-1 })
|
|
563
563
|
current.path.push(lastPoint)
|
|
564
564
|
current.path.push(currentPoint)
|
|
565
565
|
objects.runCommand = true
|
|
@@ -1072,7 +1072,7 @@ const template = {
|
|
|
1072
1072
|
bridge: "{ ...next(operator), object: after[0], interpolate: [{ context: operator }, { property: 'object' }] }",
|
|
1073
1073
|
semantic: async ({mentioned, context, objects, api, say}) => {
|
|
1074
1074
|
await api.stop()
|
|
1075
|
-
api.markCurrentPoint()
|
|
1075
|
+
await api.markCurrentPoint()
|
|
1076
1076
|
}
|
|
1077
1077
|
},
|
|
1078
1078
|
],
|
|
@@ -1100,7 +1100,7 @@ const template = {
|
|
|
1100
1100
|
},
|
|
1101
1101
|
{
|
|
1102
1102
|
match: ({context, contextHierarchy}) => {
|
|
1103
|
-
if (!context.pullFromContext || !context.evaluate || contextHierarchy.under('doAction')) {
|
|
1103
|
+
if (!context.pullFromContext || !context.evaluate || contextHierarchy.under(['doAction', 'evaluate'])) {
|
|
1104
1104
|
return false
|
|
1105
1105
|
}
|
|
1106
1106
|
|
|
@@ -1108,12 +1108,12 @@ const template = {
|
|
|
1108
1108
|
return true
|
|
1109
1109
|
}
|
|
1110
1110
|
},
|
|
1111
|
-
apply: async ({context, fragments, stm, objects, mentioned, mentions, resolveEvaluate, _continue, contextHierarchy}) => {
|
|
1112
|
-
|
|
1113
|
-
const pathComponents = mentions({ context: { marker: 'pathComponent' }, all: true })
|
|
1111
|
+
apply: async ({context, frameOfReference, toArray, fragments, stm, objects, mentioned, mentions, resolveEvaluate, _continue, contextHierarchy}) => {
|
|
1112
|
+
const pathComponents = toArray(await mentions({ context: { marker: 'pathComponent' }, all: true }))
|
|
1114
1113
|
const path = (await fragments('path')).contexts()[0]
|
|
1115
1114
|
delete path.value
|
|
1116
1115
|
path.points = pathComponents.reverse()
|
|
1116
|
+
frameOfReference(path, { mentioned: 'points', reversed: true })
|
|
1117
1117
|
await mentioned(path)
|
|
1118
1118
|
|
|
1119
1119
|
_continue() // let the call pick the object out from the stm
|
|
@@ -1152,7 +1152,7 @@ const template = {
|
|
|
1152
1152
|
{
|
|
1153
1153
|
match: ({context}) => context.evaluate && ['start', 'end'].includes(context.marker) && context.objects && context.objects[1].marker == 'path',
|
|
1154
1154
|
apply: async ({gp, s, context, objects, fragments, resolveEvaluate, api, mentions}) => {
|
|
1155
|
-
const path = mentions({ context: context.objects[1] })
|
|
1155
|
+
const path = await mentions({ context: context.objects[1] })
|
|
1156
1156
|
if (!path?.points) {
|
|
1157
1157
|
return
|
|
1158
1158
|
}
|