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.
- package/common/actions.instance.json +4 -4
- package/common/actions.js +9 -9
- package/common/askfor.instance.json +12 -184
- package/common/askfor.js +19 -11
- package/common/asking.js +13 -5
- package/common/can.instance.json +2 -18
- package/common/can.js +2 -2
- package/common/comparable.instance.json +6 -12
- package/common/concept.instance.json +8 -4
- package/common/concept.js +2 -0
- package/common/conjunction.js +6 -4
- package/common/control.js +5 -5
- package/common/countable.js +1 -0
- package/common/dateTimeSelectors.instance.json +1 -1
- package/common/dateTimeSelectors.js +1 -1
- package/common/dates.instance.json +11 -1
- package/common/dates.js +6 -1
- package/common/debug.instance.json +5 -1
- package/common/debug.js +2 -0
- package/common/dialogues.js +37 -35
- package/common/dimension.instance.json +144 -446
- package/common/dimension.js +14 -8
- package/common/drone.instance.json +43 -19
- package/common/drone.js +29 -35
- package/common/drone_v1.instance.json +13 -3
- package/common/drone_v1.js +14 -9
- package/common/evaluate.js +2 -2
- package/common/fastfood.instance.json +12 -4
- package/common/fastfood.js +27 -12
- package/common/formulas.instance.json +138 -12
- package/common/formulas.js +15 -6
- package/common/gdefaults.js +2 -71
- package/common/helpers/dialogues.js +1 -10
- package/common/helpers/properties.js +6 -10
- package/common/helpers.js +5 -2
- package/common/hierarchy.js +11 -7
- package/common/math.instance.json +141 -4
- package/common/math.js +18 -5
- package/common/menus.instance.json +6 -2
- package/common/menus.js +5 -2
- package/common/meta.js +12 -12
- package/common/nameable.js +6 -2
- package/common/ordering.instance.json +1 -2
- package/common/percentages.js +4 -2
- package/common/pipboy.instance.json +38 -27
- package/common/pipboy.js +21 -14
- package/common/properties.instance.json +2319 -560
- package/common/properties.js +146 -37
- package/common/punctuation.js +1 -0
- package/common/rates.instance.json +1 -1
- package/common/rates.js +2 -2
- package/common/reminders.instance.json +16 -0
- package/common/reminders.js +23 -19
- package/common/reports.instance.json +4 -6
- package/common/reports.js +12 -12
- package/common/sdefaults.js +11 -9
- package/common/stm.js +11 -14
- package/common/testing.js +2 -2
- package/common/time.instance.json +42 -15
- package/common/time.js +7 -6
- package/common/ui.js +5 -5
- package/common/words.js +106 -1
- package/common/wp.instance.json +10 -3
- package/common/wp.js +5 -1
- package/package.json +2 -2
package/common/drone.js
CHANGED
|
@@ -261,7 +261,7 @@ async function handleDistance(args, distance) {
|
|
|
261
261
|
}
|
|
262
262
|
const instantiation = await fragments("quantity in meters", { quantity: distance })
|
|
263
263
|
try {
|
|
264
|
-
const result = await e(instantiation)
|
|
264
|
+
const result = await e(instantiation, where())
|
|
265
265
|
objects.runCommand = true
|
|
266
266
|
objects.current.distance = result.evalue.amount.evalue.evalue
|
|
267
267
|
} catch (e) {
|
|
@@ -444,7 +444,7 @@ class API {
|
|
|
444
444
|
// const valueInUsersUnits = await fragments("quantity in meters", { quantity: minimumValueInDroneUnits, meter: unitsOfUser })
|
|
445
445
|
if (unitsOfUser) {
|
|
446
446
|
const valueInUsersUnits = await quantityInMeters(minimumValueInDroneUnits, unitsOfUser )
|
|
447
|
-
const evaluated = await e(valueInUsersUnits)
|
|
447
|
+
const evaluated = await e(valueInUsersUnits, where())
|
|
448
448
|
say(`The drone cannot go that slow. The minimum speed is ${await gr(evaluated.evalue)}`)
|
|
449
449
|
} else {
|
|
450
450
|
say(`The drone cannot go that fast. The minimum speed is ${await gr(minimumValueInDroneUnits)}`)
|
|
@@ -462,7 +462,7 @@ class API {
|
|
|
462
462
|
// const valueInUsersUnits = await fragments("quantity in meters", { quantity: maximumValueInDroneUnits, meter: unitsOfUser })
|
|
463
463
|
if (unitsOfUser) {
|
|
464
464
|
const valueInUsersUnits = await quantityInMeters(maximumValueInDroneUnits, unitsOfUser)
|
|
465
|
-
const evaluated = await e(valueInUsersUnits)
|
|
465
|
+
const evaluated = await e(valueInUsersUnits, where())
|
|
466
466
|
say(`The drone cannot go that fast. The maximum speed is ${await gr(evaluated.evalue)}`)
|
|
467
467
|
} else {
|
|
468
468
|
say(`The drone cannot go that fast. The maximum speed is ${await gr(maximumValueInDroneUnits)}`)
|
|
@@ -796,7 +796,7 @@ function expectDistanceForMove(args) {
|
|
|
796
796
|
match: ({context, isA}) => isA(context.marker, 'quantity') && !isA(context.unit.marker, 'unitPerUnit'),
|
|
797
797
|
apply: async ({context, objects, fragments, e}) => {
|
|
798
798
|
const instantiation = await fragments("quantity in meters", { quantity: context })
|
|
799
|
-
const result = await e(instantiation)
|
|
799
|
+
const result = await e(instantiation, where())
|
|
800
800
|
objects.runCommand = true
|
|
801
801
|
objects.current.distance = result.evalue.amount.evalue.evalue
|
|
802
802
|
}
|
|
@@ -861,7 +861,7 @@ const template = {
|
|
|
861
861
|
apply: async ({context, objects, api, gr, fragments, e, say}) => {
|
|
862
862
|
// send a command to the drone
|
|
863
863
|
const instantiation = await fragments("quantity in meters per second", { quantity: context })
|
|
864
|
-
const result = await e(instantiation)
|
|
864
|
+
const result = await e(instantiation, where())
|
|
865
865
|
const desired_speed = result.evalue.amount.evalue.evalue
|
|
866
866
|
objects.runCommand = true
|
|
867
867
|
objects.current.speed = desired_speed
|
|
@@ -939,6 +939,7 @@ const template = {
|
|
|
939
939
|
},
|
|
940
940
|
{
|
|
941
941
|
id: 'startPath',
|
|
942
|
+
where: where(),
|
|
942
943
|
isA: ['verb'],
|
|
943
944
|
bridge: "{ ...next(operator), path: after[0], operator: operator, interpolate: [{ property: 'operator' }, { property: 'path' }] }",
|
|
944
945
|
check: defaultContextCheckProperties(['path']),
|
|
@@ -979,6 +980,7 @@ const template = {
|
|
|
979
980
|
},
|
|
980
981
|
{
|
|
981
982
|
id: 'patrol',
|
|
983
|
+
where: where(),
|
|
982
984
|
isA: ['verb', 'repeatable', 'action'],
|
|
983
985
|
bridge: `{
|
|
984
986
|
...next(operator),
|
|
@@ -1007,7 +1009,7 @@ const template = {
|
|
|
1007
1009
|
const timeAtPoints = toArray(context.pause.timeAtPoint)
|
|
1008
1010
|
for (const timeAtPoint of timeAtPoints) {
|
|
1009
1011
|
const instantiation = await fragments("quantity in seconds", { quantity: timeAtPoint.time })
|
|
1010
|
-
const result = await e(instantiation)
|
|
1012
|
+
const result = await e(instantiation, where())
|
|
1011
1013
|
const seconds = toFinalValue(toFinalValue(result).amount)
|
|
1012
1014
|
|
|
1013
1015
|
const points = await recall({ context: timeAtPoint.point.point, frameOfReference: path })
|
|
@@ -1061,25 +1063,9 @@ const template = {
|
|
|
1061
1063
|
objects.runCommand = true
|
|
1062
1064
|
}
|
|
1063
1065
|
},
|
|
1064
|
-
/*
|
|
1065
|
-
{
|
|
1066
|
-
id: 'do',
|
|
1067
|
-
isA: ['verb'],
|
|
1068
|
-
bridge: `{
|
|
1069
|
-
...next(operator), operator: operator, path: after[0], interpolate: [{ property: 'operator'}, { property: 'path' }]
|
|
1070
|
-
}`,
|
|
1071
|
-
semantic: async ({context, e, toEValue, objects}) => {
|
|
1072
|
-
const evaluated = await(e(context.path))
|
|
1073
|
-
const path = toEValue(evaluated)
|
|
1074
|
-
for (const point of path.points) {
|
|
1075
|
-
objects.current.path.push(point)
|
|
1076
|
-
}
|
|
1077
|
-
objects.runCommand = true
|
|
1078
|
-
}
|
|
1079
|
-
},
|
|
1080
|
-
*/
|
|
1081
1066
|
{
|
|
1082
1067
|
id: 'lift',
|
|
1068
|
+
where: where(),
|
|
1083
1069
|
isA: ['verb'],
|
|
1084
1070
|
bridge: `{
|
|
1085
1071
|
...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]
|
|
@@ -1091,6 +1077,7 @@ const template = {
|
|
|
1091
1077
|
},
|
|
1092
1078
|
{
|
|
1093
1079
|
id: 'lower',
|
|
1080
|
+
where: where(),
|
|
1094
1081
|
isA: ['verb'],
|
|
1095
1082
|
bridge: `{
|
|
1096
1083
|
...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]
|
|
@@ -1102,6 +1089,7 @@ const template = {
|
|
|
1102
1089
|
},
|
|
1103
1090
|
{
|
|
1104
1091
|
id: 'openDrone',
|
|
1092
|
+
where: where(),
|
|
1105
1093
|
isA: ['verb'],
|
|
1106
1094
|
bridge: `{
|
|
1107
1095
|
...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]
|
|
@@ -1113,6 +1101,7 @@ const template = {
|
|
|
1113
1101
|
},
|
|
1114
1102
|
{
|
|
1115
1103
|
id: 'close',
|
|
1104
|
+
where: where(),
|
|
1116
1105
|
isA: ['verb'],
|
|
1117
1106
|
bridge: `{
|
|
1118
1107
|
...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]
|
|
@@ -1124,6 +1113,7 @@ const template = {
|
|
|
1124
1113
|
},
|
|
1125
1114
|
{
|
|
1126
1115
|
id: 'back',
|
|
1116
|
+
where: where(),
|
|
1127
1117
|
isA: ['noun'],
|
|
1128
1118
|
semantic: async ({objects, api, e, context, say}) => {
|
|
1129
1119
|
await api.back()
|
|
@@ -1135,18 +1125,20 @@ const template = {
|
|
|
1135
1125
|
},
|
|
1136
1126
|
{
|
|
1137
1127
|
id: "toPoint",
|
|
1128
|
+
where: where(),
|
|
1138
1129
|
isA: ['preposition'],
|
|
1139
1130
|
after: [['propertyOf', 1]],
|
|
1140
1131
|
bridge: "{ ...next(operator), operator: operator, point: after[0], interpolate: [{ property: 'operator' }, { property: 'point' }] }",
|
|
1141
1132
|
check: defaultContextCheckProperties(['point']),
|
|
1142
1133
|
semantic: async ({objects, api, e, context}) => {
|
|
1143
1134
|
objects.runCommand = true
|
|
1144
|
-
const point = await e(context.point)
|
|
1135
|
+
const point = await e(context.point, where())
|
|
1145
1136
|
objects.current.path.push(point.evalue)
|
|
1146
1137
|
}
|
|
1147
1138
|
},
|
|
1148
1139
|
{
|
|
1149
1140
|
id: "go",
|
|
1141
|
+
where: where(),
|
|
1150
1142
|
level: 0,
|
|
1151
1143
|
// convolution: true,
|
|
1152
1144
|
isA: ['verb', 'repeatable', 'doAction'],
|
|
@@ -1190,7 +1182,7 @@ const template = {
|
|
|
1190
1182
|
objects.current.timeRepeats = toFinalValue(context.repeats.repeats)
|
|
1191
1183
|
}
|
|
1192
1184
|
if (context.to) {
|
|
1193
|
-
const evaluation = await e(context.to.point)
|
|
1185
|
+
const evaluation = await e(context.to.point, where())
|
|
1194
1186
|
const point = toEValue(evaluation)
|
|
1195
1187
|
objects.current.path.push(point)
|
|
1196
1188
|
}
|
|
@@ -1200,6 +1192,7 @@ const template = {
|
|
|
1200
1192
|
},
|
|
1201
1193
|
{
|
|
1202
1194
|
id: 'turn',
|
|
1195
|
+
where: where(),
|
|
1203
1196
|
isA: ['verb', 'action', 'repeatable'],
|
|
1204
1197
|
before: ['thenAction'],
|
|
1205
1198
|
words: ['turn'],
|
|
@@ -1239,7 +1232,7 @@ const template = {
|
|
|
1239
1232
|
if (context.angle) {
|
|
1240
1233
|
const instantiation = await toRadians(context.angle)
|
|
1241
1234
|
try {
|
|
1242
|
-
const result = await e(instantiation)
|
|
1235
|
+
const result = await e(instantiation, where())
|
|
1243
1236
|
current.turnAngle = toFinalValue(result.evalue.amount)
|
|
1244
1237
|
objects.runCommand = true
|
|
1245
1238
|
} catch (e) {
|
|
@@ -1258,6 +1251,7 @@ const template = {
|
|
|
1258
1251
|
},
|
|
1259
1252
|
{
|
|
1260
1253
|
id: 'pause',
|
|
1254
|
+
where: where(),
|
|
1261
1255
|
isA: ['verb'],
|
|
1262
1256
|
words: [
|
|
1263
1257
|
...conjugateVerb('pause'),
|
|
@@ -1281,7 +1275,7 @@ const template = {
|
|
|
1281
1275
|
time = time.quantity
|
|
1282
1276
|
}
|
|
1283
1277
|
const instantiation = await fragments("quantity in seconds", { quantity: time})
|
|
1284
|
-
const result = await e(instantiation)
|
|
1278
|
+
const result = await e(instantiation, where())
|
|
1285
1279
|
const seconds = toFinalValue(toFinalValue(result).amount)
|
|
1286
1280
|
context.pauseSeconds = seconds
|
|
1287
1281
|
remember(context)
|
|
@@ -1302,6 +1296,7 @@ const template = {
|
|
|
1302
1296
|
},
|
|
1303
1297
|
{
|
|
1304
1298
|
id: 'stop',
|
|
1299
|
+
where: where(),
|
|
1305
1300
|
isA: ['verb'],
|
|
1306
1301
|
optional: {
|
|
1307
1302
|
1: "{ marker: 'drone' }",
|
|
@@ -1327,11 +1322,10 @@ const template = {
|
|
|
1327
1322
|
{
|
|
1328
1323
|
where: where(),
|
|
1329
1324
|
match: ({context}) => context.marker == 'doAction',
|
|
1330
|
-
apply: async ({context, fragments, e,
|
|
1325
|
+
apply: async ({context, fragments, e, toEValue, toFinalValue, namespaced, objects}) => {
|
|
1331
1326
|
const updated = { ...context, marker: 'patrol', path: context.action }
|
|
1332
1327
|
namespaced.set('actions', updated, 'logged', true)
|
|
1333
|
-
await
|
|
1334
|
-
// await s({ ...context, marker: 'patrol', path: context.action })
|
|
1328
|
+
await e(updated, where())
|
|
1335
1329
|
}
|
|
1336
1330
|
},
|
|
1337
1331
|
{
|
|
@@ -1373,7 +1367,7 @@ const template = {
|
|
|
1373
1367
|
}
|
|
1374
1368
|
},
|
|
1375
1369
|
apply: async ({frameOfReference, context, e, fragments, stm, toEValue, toArray, objects, remember, recall, resolveEvaluate, _continue, contextHierarchy}) => {
|
|
1376
|
-
const evaluated = await e({...context, notUnderCall: true})
|
|
1370
|
+
const evaluated = await e({...context, notUnderCall: true}, where())
|
|
1377
1371
|
const pointsContext = toEValue(evaluated)
|
|
1378
1372
|
const pathComponents = toArray(pointsContext)
|
|
1379
1373
|
|
|
@@ -1445,7 +1439,7 @@ const template = {
|
|
|
1445
1439
|
return true
|
|
1446
1440
|
}
|
|
1447
1441
|
},
|
|
1448
|
-
apply: async ({gp,
|
|
1442
|
+
apply: async ({gp, e, context, objects, fragments, resolveEvaluate, api}) => {
|
|
1449
1443
|
let return_context = context
|
|
1450
1444
|
if (context.marker == 'speed') {
|
|
1451
1445
|
// okay
|
|
@@ -1463,7 +1457,7 @@ const template = {
|
|
|
1463
1457
|
}
|
|
1464
1458
|
}
|
|
1465
1459
|
const speed = await fragments("number meters per second", { number: { marker: 'integer', value, word: undefined} })
|
|
1466
|
-
const preferred = await
|
|
1460
|
+
const preferred = await e({ marker: 'preferredUnits', quantity: speed }, where())
|
|
1467
1461
|
resolveEvaluate(return_context, preferred.evalue || speed)
|
|
1468
1462
|
}
|
|
1469
1463
|
},
|
|
@@ -1478,7 +1472,7 @@ const template = {
|
|
|
1478
1472
|
return true
|
|
1479
1473
|
}
|
|
1480
1474
|
},
|
|
1481
|
-
apply: async ({gp,
|
|
1475
|
+
apply: async ({gp, e, context, objects, fragments, resolveEvaluate, api}) => {
|
|
1482
1476
|
const value = objects.current.angleInRadians
|
|
1483
1477
|
const fi = await fragments("number radians")
|
|
1484
1478
|
const direction = await fi.instantiate([
|
|
@@ -1489,7 +1483,7 @@ const template = {
|
|
|
1489
1483
|
}
|
|
1490
1484
|
}
|
|
1491
1485
|
])
|
|
1492
|
-
const preferred = await
|
|
1486
|
+
const preferred = await e({ marker: 'preferredUnits', quantity: direction }, where())
|
|
1493
1487
|
resolveEvaluate(context, preferred.evalue || direction)
|
|
1494
1488
|
}
|
|
1495
1489
|
},
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"point is a concept",
|
|
7
7
|
"points are nameable orderable and memorable",
|
|
8
8
|
{
|
|
9
|
-
"apply": "(args) => {\n askForCalibrationDistance(args)\n askForEndTime(args)\n askForStartTime(args)\n\n expectDirection(args)\n expectDistanceForCalibration(args)\n expectCalibrationCompletion(args)\n\n args.config.addSemantic({\n match: ({context, isA}) => isA(context.marker, 'quantity') && isA(context.unit.marker, 'unitPerUnit'),\n apply: async ({context, objects, api, fragments, e}) => {\n // send a command to the drone\n const instantiation = await fragments(\"quantity in meters per second\", { quantity: context })\n const result = await e(instantiation)\n const desired_speed = result.evalue.amount.evalue.evalue\n const desired_power = objects.current.power * (desired_speed / objects.calibration.speed)\n objects.runCommand = true\n objects.current.power = desired_power \n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlStart',\n apply: ({context, objects, api}) => {\n objects.runCommand = false \n }\n })\n\n args.config.addSemantic({\n // match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && (context.marker == 'controlEnd' || context.marker == 'controlBetween'),\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlEnd',\n apply: async ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n // debugger\n await api.sendCommand()\n }\n }\n })\n }"
|
|
9
|
+
"apply": "(args) => {\n askForCalibrationDistance(args)\n askForEndTime(args)\n askForStartTime(args)\n\n expectDirection(args)\n expectDistanceForCalibration(args)\n expectCalibrationCompletion(args)\n\n args.config.addSemantic({\n match: ({context, isA}) => isA(context.marker, 'quantity') && isA(context.unit.marker, 'unitPerUnit'),\n apply: async ({context, objects, api, fragments, e}) => {\n // send a command to the drone\n const instantiation = await fragments(\"quantity in meters per second\", { quantity: context })\n const result = await e(instantiation, where())\n const desired_speed = result.evalue.amount.evalue.evalue\n const desired_power = objects.current.power * (desired_speed / objects.calibration.speed)\n objects.runCommand = true\n objects.current.power = desired_power \n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlStart',\n apply: ({context, objects, api}) => {\n objects.runCommand = false \n }\n })\n\n args.config.addSemantic({\n // match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && (context.marker == 'controlEnd' || context.marker == 'controlBetween'),\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlEnd',\n apply: async ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n // debugger\n await api.sendCommand()\n }\n }\n })\n }"
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
"operators": [
|
|
@@ -20,17 +20,19 @@
|
|
|
20
20
|
"bridges": [
|
|
21
21
|
{
|
|
22
22
|
"id": "toPoint",
|
|
23
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:480",
|
|
23
24
|
"isA": [
|
|
24
25
|
"preposition"
|
|
25
26
|
],
|
|
26
27
|
"bridge": "{ ...next(operator), operator: operator, point: after[0], interpolate: [{ property: 'operator' }, { property: 'point' }] }",
|
|
27
|
-
"semantic": "async ({objects, api, e, context}) => {\n if (api.isCalibrated()) {\n objects.runCommand = true\n const point = await e(context.point)\n objects.current.destination = point.evalue\n }\n }"
|
|
28
|
+
"semantic": "async ({objects, api, e, context}) => {\n if (api.isCalibrated()) {\n objects.runCommand = true\n const point = await e(context.point, where())\n objects.current.destination = point.evalue\n }\n }"
|
|
28
29
|
},
|
|
29
30
|
{
|
|
30
31
|
"id": "go"
|
|
31
32
|
},
|
|
32
33
|
{
|
|
33
34
|
"id": "turn",
|
|
35
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:494",
|
|
34
36
|
"isA": [
|
|
35
37
|
"verb"
|
|
36
38
|
],
|
|
@@ -39,6 +41,7 @@
|
|
|
39
41
|
},
|
|
40
42
|
{
|
|
41
43
|
"id": "calibrate",
|
|
44
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:505",
|
|
42
45
|
"isA": [
|
|
43
46
|
"verb"
|
|
44
47
|
],
|
|
@@ -47,6 +50,7 @@
|
|
|
47
50
|
},
|
|
48
51
|
{
|
|
49
52
|
"id": "pause",
|
|
53
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:520",
|
|
50
54
|
"isA": [
|
|
51
55
|
"verb"
|
|
52
56
|
],
|
|
@@ -55,6 +59,7 @@
|
|
|
55
59
|
},
|
|
56
60
|
{
|
|
57
61
|
"id": "stop",
|
|
62
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:531",
|
|
58
63
|
"isA": [
|
|
59
64
|
"verb"
|
|
60
65
|
],
|
|
@@ -4076,7 +4081,7 @@
|
|
|
4076
4081
|
}
|
|
4077
4082
|
},
|
|
4078
4083
|
{
|
|
4079
|
-
"apply": "(args) => {\n askForCalibrationDistance(args)\n askForEndTime(args)\n askForStartTime(args)\n\n expectDirection(args)\n expectDistanceForCalibration(args)\n expectCalibrationCompletion(args)\n\n args.config.addSemantic({\n match: ({context, isA}) => isA(context.marker, 'quantity') && isA(context.unit.marker, 'unitPerUnit'),\n apply: async ({context, objects, api, fragments, e}) => {\n // send a command to the drone\n const instantiation = await fragments(\"quantity in meters per second\", { quantity: context })\n const result = await e(instantiation)\n const desired_speed = result.evalue.amount.evalue.evalue\n const desired_power = objects.current.power * (desired_speed / objects.calibration.speed)\n objects.runCommand = true\n objects.current.power = desired_power \n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlStart',\n apply: ({context, objects, api}) => {\n objects.runCommand = false \n }\n })\n\n args.config.addSemantic({\n // match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && (context.marker == 'controlEnd' || context.marker == 'controlBetween'),\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlEnd',\n apply: async ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n // debugger\n await api.sendCommand()\n }\n }\n })\n }"
|
|
4084
|
+
"apply": "(args) => {\n askForCalibrationDistance(args)\n askForEndTime(args)\n askForStartTime(args)\n\n expectDirection(args)\n expectDistanceForCalibration(args)\n expectCalibrationCompletion(args)\n\n args.config.addSemantic({\n match: ({context, isA}) => isA(context.marker, 'quantity') && isA(context.unit.marker, 'unitPerUnit'),\n apply: async ({context, objects, api, fragments, e}) => {\n // send a command to the drone\n const instantiation = await fragments(\"quantity in meters per second\", { quantity: context })\n const result = await e(instantiation, where())\n const desired_speed = result.evalue.amount.evalue.evalue\n const desired_power = objects.current.power * (desired_speed / objects.calibration.speed)\n objects.runCommand = true\n objects.current.power = desired_power \n }\n })\n\n args.config.addSemantic({\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlStart',\n apply: ({context, objects, api}) => {\n objects.runCommand = false \n }\n })\n\n args.config.addSemantic({\n // match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && (context.marker == 'controlEnd' || context.marker == 'controlBetween'),\n match: ({context, objects, isA}) => objects.current.direction && objects.isCalibrated && context.marker == 'controlEnd',\n apply: async ({context, objects, api}) => {\n // send a command to the drone\n if (objects.runCommand) {\n // debugger\n await api.sendCommand()\n }\n }\n })\n }"
|
|
4080
4085
|
},
|
|
4081
4086
|
{
|
|
4082
4087
|
"extraConfig": true,
|
|
@@ -4091,6 +4096,7 @@
|
|
|
4091
4096
|
"bridges": [
|
|
4092
4097
|
{
|
|
4093
4098
|
"id": "toPoint",
|
|
4099
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:480",
|
|
4094
4100
|
"isA": [
|
|
4095
4101
|
"preposition"
|
|
4096
4102
|
],
|
|
@@ -4101,6 +4107,7 @@
|
|
|
4101
4107
|
},
|
|
4102
4108
|
{
|
|
4103
4109
|
"id": "turn",
|
|
4110
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:494",
|
|
4104
4111
|
"isA": [
|
|
4105
4112
|
"verb"
|
|
4106
4113
|
],
|
|
@@ -4108,6 +4115,7 @@
|
|
|
4108
4115
|
},
|
|
4109
4116
|
{
|
|
4110
4117
|
"id": "calibrate",
|
|
4118
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:505",
|
|
4111
4119
|
"isA": [
|
|
4112
4120
|
"verb"
|
|
4113
4121
|
],
|
|
@@ -4115,6 +4123,7 @@
|
|
|
4115
4123
|
},
|
|
4116
4124
|
{
|
|
4117
4125
|
"id": "pause",
|
|
4126
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:520",
|
|
4118
4127
|
"isA": [
|
|
4119
4128
|
"verb"
|
|
4120
4129
|
],
|
|
@@ -4122,6 +4131,7 @@
|
|
|
4122
4131
|
},
|
|
4123
4132
|
{
|
|
4124
4133
|
"id": "stop",
|
|
4134
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone_v1.js:531",
|
|
4125
4135
|
"isA": [
|
|
4126
4136
|
"verb"
|
|
4127
4137
|
],
|
package/common/drone_v1.js
CHANGED
|
@@ -375,7 +375,7 @@ function expectDistanceForCalibration(args) {
|
|
|
375
375
|
match: ({context, isA, objects}) => isA(context.marker, 'quantity') && !isA(context.unit.marker, 'unitPerUnit') && objects.calibration.startTime,
|
|
376
376
|
apply: async ({context, objects, fragments, e}) => {
|
|
377
377
|
const instantiation = await fragments("quantity in meters", { quantity: context })
|
|
378
|
-
const result = await e(instantiation)
|
|
378
|
+
const result = await e(instantiation, where())
|
|
379
379
|
objects.calibration.distance = result.evalue.amount.evalue.evalue
|
|
380
380
|
}
|
|
381
381
|
})
|
|
@@ -387,7 +387,7 @@ function expectDistanceForMove(args) {
|
|
|
387
387
|
match: ({context, isA}) => isA(context.marker, 'quantity') && !isA(context.unit.marker, 'unitPerUnit'),
|
|
388
388
|
apply: async ({context, objects, fragments, e}) => {
|
|
389
389
|
const instantiation = await fragments("quantity in meters", { quantity: context })
|
|
390
|
-
const result = await e(instantiation)
|
|
390
|
+
const result = await e(instantiation, where())
|
|
391
391
|
objects.runCommand = true
|
|
392
392
|
objects.current.distance = result.evalue.amount.evalue.evalue
|
|
393
393
|
}
|
|
@@ -438,7 +438,7 @@ const template = {
|
|
|
438
438
|
apply: async ({context, objects, api, fragments, e}) => {
|
|
439
439
|
// send a command to the drone
|
|
440
440
|
const instantiation = await fragments("quantity in meters per second", { quantity: context })
|
|
441
|
-
const result = await e(instantiation)
|
|
441
|
+
const result = await e(instantiation, where())
|
|
442
442
|
const desired_speed = result.evalue.amount.evalue.evalue
|
|
443
443
|
const desired_power = objects.current.power * (desired_speed / objects.calibration.speed)
|
|
444
444
|
objects.runCommand = true
|
|
@@ -477,12 +477,13 @@ const template = {
|
|
|
477
477
|
bridges: [
|
|
478
478
|
{
|
|
479
479
|
id: "toPoint",
|
|
480
|
+
where: where(),
|
|
480
481
|
isA: ['preposition'],
|
|
481
482
|
bridge: "{ ...next(operator), operator: operator, point: after[0], interpolate: [{ property: 'operator' }, { property: 'point' }] }",
|
|
482
483
|
semantic: async ({objects, api, e, context}) => {
|
|
483
484
|
if (api.isCalibrated()) {
|
|
484
485
|
objects.runCommand = true
|
|
485
|
-
const point = await e(context.point)
|
|
486
|
+
const point = await e(context.point, where())
|
|
486
487
|
objects.current.destination = point.evalue
|
|
487
488
|
}
|
|
488
489
|
}
|
|
@@ -490,6 +491,7 @@ const template = {
|
|
|
490
491
|
{ id: "go" },
|
|
491
492
|
{
|
|
492
493
|
id: 'turn',
|
|
494
|
+
where: where(),
|
|
493
495
|
isA: ['verb'],
|
|
494
496
|
bridge: "{ ...next(operator), direction: after[0], interpolate: [{ context: operator }, { property: 'direction' }] }",
|
|
495
497
|
semantic: ({context, objects, api}) => {
|
|
@@ -500,6 +502,7 @@ const template = {
|
|
|
500
502
|
},
|
|
501
503
|
{
|
|
502
504
|
id: 'calibrate',
|
|
505
|
+
where: where(),
|
|
503
506
|
isA: ['verb'],
|
|
504
507
|
bridge: "{ ...next(operator), interpolate: [{ context: operator }] }",
|
|
505
508
|
semantic: ({context, objects, api, remember}) => {
|
|
@@ -514,6 +517,7 @@ const template = {
|
|
|
514
517
|
},
|
|
515
518
|
{
|
|
516
519
|
id: 'pause',
|
|
520
|
+
where: where(),
|
|
517
521
|
isA: ['verb'],
|
|
518
522
|
bridge: "{ ...operator, time: after[0], interpolate: [{ context: operator }, { property: 'time' }] }",
|
|
519
523
|
semantic: async ({context}) => {
|
|
@@ -524,6 +528,7 @@ const template = {
|
|
|
524
528
|
},
|
|
525
529
|
{
|
|
526
530
|
id: 'stop',
|
|
531
|
+
where: where(),
|
|
527
532
|
isA: ['verb'],
|
|
528
533
|
optional: {
|
|
529
534
|
1: "{ marker: 'drone' }",
|
|
@@ -588,11 +593,11 @@ knowledgeModule( {
|
|
|
588
593
|
],
|
|
589
594
|
objects: [
|
|
590
595
|
{ km: 'stm' },
|
|
591
|
-
|
|
592
|
-
{
|
|
593
|
-
{
|
|
594
|
-
{
|
|
595
|
-
|
|
596
|
+
'isCalibrated',
|
|
597
|
+
{ property: 'calibration', all: true },
|
|
598
|
+
{ property: 'current', all: true },
|
|
599
|
+
{ property: 'history', all: true },
|
|
600
|
+
'runCommand',
|
|
596
601
|
],
|
|
597
602
|
}
|
|
598
603
|
},
|
package/common/evaluate.js
CHANGED
|
@@ -14,7 +14,7 @@ const config = {
|
|
|
14
14
|
{
|
|
15
15
|
where: where(),
|
|
16
16
|
id: 'value1',
|
|
17
|
-
|
|
17
|
+
semantic: ({context}) => {
|
|
18
18
|
context.evalue = 'value1 after evaluation'
|
|
19
19
|
},
|
|
20
20
|
scope: "testing",
|
|
@@ -26,7 +26,7 @@ const config = {
|
|
|
26
26
|
enhanced_associations: false,
|
|
27
27
|
bridge: "{ ...next(operator), postModifiers: ['value'], value: after[0] }",
|
|
28
28
|
semantic: async ({context, e, resolveEvaluate}) => {
|
|
29
|
-
resolveEvaluate(context, (await e(context.value)).evalue)
|
|
29
|
+
resolveEvaluate(context, (await e(context.value, where())).evalue)
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
],
|
|
@@ -689,6 +689,7 @@
|
|
|
689
689
|
},
|
|
690
690
|
{
|
|
691
691
|
"id": "withModification",
|
|
692
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/fastfood.js:199",
|
|
692
693
|
"level": 0,
|
|
693
694
|
"before": [
|
|
694
695
|
"preposition"
|
|
@@ -906,7 +907,7 @@
|
|
|
906
907
|
"semantics": [
|
|
907
908
|
{
|
|
908
909
|
"match": "({context}) => context.marker == 'list' && context.topLevel && !context.flatten",
|
|
909
|
-
"apply": "async ({context,
|
|
910
|
+
"apply": "async ({context, e}) => await e({...context, flatten: true}, where())"
|
|
910
911
|
},
|
|
911
912
|
{
|
|
912
913
|
"match": "({context, api}) => context.marker == 'controlEnd' && api.hasAskedForButNotAvailable()",
|
|
@@ -946,6 +947,7 @@
|
|
|
946
947
|
"bridges": [
|
|
947
948
|
{
|
|
948
949
|
"id": "change",
|
|
950
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/fastfood.js:390",
|
|
949
951
|
"isA": [
|
|
950
952
|
"verb"
|
|
951
953
|
],
|
|
@@ -961,7 +963,7 @@
|
|
|
961
963
|
],
|
|
962
964
|
"generatorp": "async ({context, gp}) => `change ${await gp(context.from)} to ${await gp(context.to)}`",
|
|
963
965
|
"bridge": "{ ...next(operator), from: after[0], to: after[1].toObject }",
|
|
964
|
-
"semantic": "async ({context, api, e}) => {\n const state = api.state\n const eFrom = (await e(context.from))
|
|
966
|
+
"semantic": "async ({callId, context, api, e, toEValue}) => {\n const state = api.state\n const eFrom = toEValue(await e(context.from, where()))\n const from = state.getIdCombo(eFrom.fromSTM ? eFrom : context.from)\n const to = state.getIdCombo(context.to)\n for (const item of api.items()) {\n if (item.id == from.id) {\n api.modify(item, { id: to.id, food: context.to })\n }\n }\n }"
|
|
965
967
|
}
|
|
966
968
|
],
|
|
967
969
|
"priorities": [
|
|
@@ -1232,6 +1234,7 @@
|
|
|
1232
1234
|
"bridges": [
|
|
1233
1235
|
{
|
|
1234
1236
|
"id": "remove",
|
|
1237
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/fastfood.js:431",
|
|
1235
1238
|
"isA": [
|
|
1236
1239
|
"verb"
|
|
1237
1240
|
],
|
|
@@ -1240,6 +1243,7 @@
|
|
|
1240
1243
|
},
|
|
1241
1244
|
{
|
|
1242
1245
|
"id": "reset",
|
|
1246
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/fastfood.js:445",
|
|
1243
1247
|
"isA": [
|
|
1244
1248
|
"verb"
|
|
1245
1249
|
],
|
|
@@ -54223,6 +54227,7 @@
|
|
|
54223
54227
|
},
|
|
54224
54228
|
{
|
|
54225
54229
|
"id": "withModification",
|
|
54230
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/fastfood.js:199",
|
|
54226
54231
|
"level": 0,
|
|
54227
54232
|
"before": [
|
|
54228
54233
|
"preposition"
|
|
@@ -59235,10 +59240,10 @@
|
|
|
59235
59240
|
"semantics": [
|
|
59236
59241
|
{},
|
|
59237
59242
|
{
|
|
59238
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/fastfood.js:
|
|
59243
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/fastfood.js:267"
|
|
59239
59244
|
},
|
|
59240
59245
|
{
|
|
59241
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/fastfood.js:
|
|
59246
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/fastfood.js:279"
|
|
59242
59247
|
}
|
|
59243
59248
|
]
|
|
59244
59249
|
},
|
|
@@ -59271,6 +59276,7 @@
|
|
|
59271
59276
|
"bridges": [
|
|
59272
59277
|
{
|
|
59273
59278
|
"id": "change",
|
|
59279
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/fastfood.js:390",
|
|
59274
59280
|
"isA": [
|
|
59275
59281
|
"verb"
|
|
59276
59282
|
],
|
|
@@ -59556,6 +59562,7 @@
|
|
|
59556
59562
|
"bridges": [
|
|
59557
59563
|
{
|
|
59558
59564
|
"id": "remove",
|
|
59565
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/fastfood.js:431",
|
|
59559
59566
|
"isA": [
|
|
59560
59567
|
"verb"
|
|
59561
59568
|
],
|
|
@@ -59563,6 +59570,7 @@
|
|
|
59563
59570
|
},
|
|
59564
59571
|
{
|
|
59565
59572
|
"id": "reset",
|
|
59573
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/fastfood.js:445",
|
|
59566
59574
|
"isA": [
|
|
59567
59575
|
"verb"
|
|
59568
59576
|
],
|