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.
- package/common/actions.instance.json +6 -6
- package/common/actions.js +10 -10
- package/common/angle.instance.json +12 -0
- 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/compass.js +1 -1
- package/common/concept.instance.json +8 -4
- package/common/concept.js +2 -0
- package/common/conjunction.js +9 -7
- 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 +9 -1
- package/common/debug.js +4 -0
- package/common/dialogues.js +37 -35
- package/common/dimension.instance.json +198 -477
- package/common/dimension.js +48 -24
- package/common/drone.instance.json +89 -19
- package/common/drone.js +43 -41
- package/common/drone_v1.instance.json +13 -3
- package/common/drone_v1.js +20 -15
- package/common/evaluate.js +3 -3
- 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 +10 -7
- package/common/helpers.js +5 -2
- package/common/hierarchy.js +11 -7
- package/common/latin.instance.json +4 -4
- package/common/latin.js +2 -2
- package/common/length.instance.json +84 -0
- package/common/linear_orderings.instance.json +1 -0
- package/common/linear_orderings.js +90 -0
- package/common/linear_orderings.test.json +1 -0
- package/common/math.instance.json +141 -4
- package/common/math.js +18 -7
- 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/numbers.instance.json +3 -0
- package/common/numbers.js +56 -32
- 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/pressure.instance.json +6 -0
- package/common/properties.instance.json +2575 -528
- package/common/properties.js +211 -41
- 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/temperature.instance.json +21 -0
- package/common/testing.js +2 -2
- package/common/time.instance.json +87 -15
- package/common/time.js +7 -6
- package/common/ui.js +5 -5
- package/common/weight.instance.json +27 -0
- package/common/words.js +106 -1
- package/common/wp.instance.json +10 -3
- package/common/wp.js +5 -1
- package/package.json +5 -2
package/common/drone.js
CHANGED
|
@@ -255,15 +255,15 @@ function roundTo(num, decimals = 2) {
|
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
async function handleDistance(args, distance) {
|
|
258
|
-
const {objects, fragments, e, say, gp} = args
|
|
258
|
+
const {objects, fragments, e, say, gp, toEValue} = args
|
|
259
259
|
if (!distance) {
|
|
260
260
|
distance = args.context
|
|
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
|
-
objects.current.distance = result.evalue.amount
|
|
266
|
+
objects.current.distance = toEValue(result.evalue.amount)
|
|
267
267
|
} catch (e) {
|
|
268
268
|
say(`Don't know how to interpret ${await gp(distance)} in meters`)
|
|
269
269
|
}
|
|
@@ -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)}`)
|
|
@@ -794,11 +794,11 @@ function expectDistanceForMove(args) {
|
|
|
794
794
|
// TODO save id for recalibration
|
|
795
795
|
args.config.addSemantic({
|
|
796
796
|
match: ({context, isA}) => isA(context.marker, 'quantity') && !isA(context.unit.marker, 'unitPerUnit'),
|
|
797
|
-
apply: async ({context, objects, fragments, e}) => {
|
|
797
|
+
apply: async ({context, objects, fragments, e, toEValue}) => {
|
|
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
|
-
objects.current.distance = result.evalue.amount
|
|
801
|
+
objects.current.distance = toEValue(result.evalue.amount)
|
|
802
802
|
}
|
|
803
803
|
})
|
|
804
804
|
}
|
|
@@ -858,11 +858,11 @@ const template = {
|
|
|
858
858
|
|
|
859
859
|
args.config.addSemantic({
|
|
860
860
|
match: ({context, isA}) => isA(context.marker, 'quantity') && isA(context.unit?.marker, 'unitPerUnit'),
|
|
861
|
-
apply: async ({context, objects, api, gr, fragments, e, say}) => {
|
|
861
|
+
apply: async ({context, objects, api, gr, toEValue, 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)
|
|
865
|
-
const desired_speed = result.evalue.amount
|
|
864
|
+
const result = await e(instantiation, where())
|
|
865
|
+
const desired_speed = toEValue(result.evalue.amount)
|
|
866
866
|
objects.runCommand = true
|
|
867
867
|
objects.current.speed = desired_speed
|
|
868
868
|
objects.current.speedUnitsOfUser = context.unit
|
|
@@ -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'],
|
|
@@ -1154,6 +1146,7 @@ const template = {
|
|
|
1154
1146
|
...conjugateVerb('go'),
|
|
1155
1147
|
],
|
|
1156
1148
|
check: defaultContextCheckProperties(['direction', 'distance', 'to', 'points']),
|
|
1149
|
+
|
|
1157
1150
|
bridge: `{
|
|
1158
1151
|
...next(operator),
|
|
1159
1152
|
distance: distance?,
|
|
@@ -1190,7 +1183,7 @@ const template = {
|
|
|
1190
1183
|
objects.current.timeRepeats = toFinalValue(context.repeats.repeats)
|
|
1191
1184
|
}
|
|
1192
1185
|
if (context.to) {
|
|
1193
|
-
const evaluation = await e(context.to.point)
|
|
1186
|
+
const evaluation = await e(context.to.point, where())
|
|
1194
1187
|
const point = toEValue(evaluation)
|
|
1195
1188
|
objects.current.path.push(point)
|
|
1196
1189
|
}
|
|
@@ -1200,6 +1193,7 @@ const template = {
|
|
|
1200
1193
|
},
|
|
1201
1194
|
{
|
|
1202
1195
|
id: 'turn',
|
|
1196
|
+
where: where(),
|
|
1203
1197
|
isA: ['verb', 'action', 'repeatable'],
|
|
1204
1198
|
before: ['thenAction'],
|
|
1205
1199
|
words: ['turn'],
|
|
@@ -1239,7 +1233,7 @@ const template = {
|
|
|
1239
1233
|
if (context.angle) {
|
|
1240
1234
|
const instantiation = await toRadians(context.angle)
|
|
1241
1235
|
try {
|
|
1242
|
-
const result = await e(instantiation)
|
|
1236
|
+
const result = await e(instantiation, where())
|
|
1243
1237
|
current.turnAngle = toFinalValue(result.evalue.amount)
|
|
1244
1238
|
objects.runCommand = true
|
|
1245
1239
|
} catch (e) {
|
|
@@ -1258,6 +1252,7 @@ const template = {
|
|
|
1258
1252
|
},
|
|
1259
1253
|
{
|
|
1260
1254
|
id: 'pause',
|
|
1255
|
+
where: where(),
|
|
1261
1256
|
isA: ['verb'],
|
|
1262
1257
|
words: [
|
|
1263
1258
|
...conjugateVerb('pause'),
|
|
@@ -1281,7 +1276,7 @@ const template = {
|
|
|
1281
1276
|
time = time.quantity
|
|
1282
1277
|
}
|
|
1283
1278
|
const instantiation = await fragments("quantity in seconds", { quantity: time})
|
|
1284
|
-
const result = await e(instantiation)
|
|
1279
|
+
const result = await e(instantiation, where())
|
|
1285
1280
|
const seconds = toFinalValue(toFinalValue(result).amount)
|
|
1286
1281
|
context.pauseSeconds = seconds
|
|
1287
1282
|
remember(context)
|
|
@@ -1302,6 +1297,7 @@ const template = {
|
|
|
1302
1297
|
},
|
|
1303
1298
|
{
|
|
1304
1299
|
id: 'stop',
|
|
1300
|
+
where: where(),
|
|
1305
1301
|
isA: ['verb'],
|
|
1306
1302
|
optional: {
|
|
1307
1303
|
1: "{ marker: 'drone' }",
|
|
@@ -1313,6 +1309,13 @@ const template = {
|
|
|
1313
1309
|
}
|
|
1314
1310
|
},
|
|
1315
1311
|
],
|
|
1312
|
+
|
|
1313
|
+
associations: {
|
|
1314
|
+
positive: [
|
|
1315
|
+
{ context: [['go', 0], ['toPoint', 0]], choose: 0 },
|
|
1316
|
+
]
|
|
1317
|
+
},
|
|
1318
|
+
|
|
1316
1319
|
generators: [
|
|
1317
1320
|
{
|
|
1318
1321
|
match: ({context}) => context.marker == 'help' && !context.paraphrase && context.isResponse,
|
|
@@ -1327,11 +1330,10 @@ const template = {
|
|
|
1327
1330
|
{
|
|
1328
1331
|
where: where(),
|
|
1329
1332
|
match: ({context}) => context.marker == 'doAction',
|
|
1330
|
-
apply: async ({context, fragments, e,
|
|
1333
|
+
apply: async ({context, fragments, e, toEValue, toFinalValue, namespaced, objects}) => {
|
|
1331
1334
|
const updated = { ...context, marker: 'patrol', path: context.action }
|
|
1332
1335
|
namespaced.set('actions', updated, 'logged', true)
|
|
1333
|
-
await
|
|
1334
|
-
// await s({ ...context, marker: 'patrol', path: context.action })
|
|
1336
|
+
await e(updated, where())
|
|
1335
1337
|
}
|
|
1336
1338
|
},
|
|
1337
1339
|
{
|
|
@@ -1373,7 +1375,7 @@ const template = {
|
|
|
1373
1375
|
}
|
|
1374
1376
|
},
|
|
1375
1377
|
apply: async ({frameOfReference, context, e, fragments, stm, toEValue, toArray, objects, remember, recall, resolveEvaluate, _continue, contextHierarchy}) => {
|
|
1376
|
-
const evaluated = await e({...context, notUnderCall: true})
|
|
1378
|
+
const evaluated = await e({...context, notUnderCall: true}, where())
|
|
1377
1379
|
const pointsContext = toEValue(evaluated)
|
|
1378
1380
|
const pathComponents = toArray(pointsContext)
|
|
1379
1381
|
|
|
@@ -1445,7 +1447,7 @@ const template = {
|
|
|
1445
1447
|
return true
|
|
1446
1448
|
}
|
|
1447
1449
|
},
|
|
1448
|
-
apply: async ({gp,
|
|
1450
|
+
apply: async ({gp, e, context, objects, fragments, resolveEvaluate, api}) => {
|
|
1449
1451
|
let return_context = context
|
|
1450
1452
|
if (context.marker == 'speed') {
|
|
1451
1453
|
// okay
|
|
@@ -1463,7 +1465,7 @@ const template = {
|
|
|
1463
1465
|
}
|
|
1464
1466
|
}
|
|
1465
1467
|
const speed = await fragments("number meters per second", { number: { marker: 'integer', value, word: undefined} })
|
|
1466
|
-
const preferred = await
|
|
1468
|
+
const preferred = await e({ marker: 'preferredUnits', quantity: speed }, where())
|
|
1467
1469
|
resolveEvaluate(return_context, preferred.evalue || speed)
|
|
1468
1470
|
}
|
|
1469
1471
|
},
|
|
@@ -1478,7 +1480,7 @@ const template = {
|
|
|
1478
1480
|
return true
|
|
1479
1481
|
}
|
|
1480
1482
|
},
|
|
1481
|
-
apply: async ({gp,
|
|
1483
|
+
apply: async ({gp, e, context, objects, fragments, resolveEvaluate, api}) => {
|
|
1482
1484
|
const value = objects.current.angleInRadians
|
|
1483
1485
|
const fi = await fragments("number radians")
|
|
1484
1486
|
const direction = await fi.instantiate([
|
|
@@ -1489,7 +1491,7 @@ const template = {
|
|
|
1489
1491
|
}
|
|
1490
1492
|
}
|
|
1491
1493
|
])
|
|
1492
|
-
const preferred = await
|
|
1494
|
+
const preferred = await e({ marker: 'preferredUnits', quantity: direction }, where())
|
|
1493
1495
|
resolveEvaluate(context, preferred.evalue || direction)
|
|
1494
1496
|
}
|
|
1495
1497
|
},
|
|
@@ -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
|
|
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, toEValue, 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 = toEValue(result.evalue.amount)\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
|
|
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, toEValue, 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 = toEValue(result.evalue.amount)\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
|
@@ -373,10 +373,10 @@ function expectDistanceForCalibration(args) {
|
|
|
373
373
|
args.config.addSemantic({
|
|
374
374
|
oneShot: true,
|
|
375
375
|
match: ({context, isA, objects}) => isA(context.marker, 'quantity') && !isA(context.unit.marker, 'unitPerUnit') && objects.calibration.startTime,
|
|
376
|
-
apply: async ({context, objects, fragments, e}) => {
|
|
376
|
+
apply: async ({context, objects, fragments, toEValue, e}) => {
|
|
377
377
|
const instantiation = await fragments("quantity in meters", { quantity: context })
|
|
378
|
-
const result = await e(instantiation)
|
|
379
|
-
objects.calibration.distance = result.evalue.amount
|
|
378
|
+
const result = await e(instantiation, where())
|
|
379
|
+
objects.calibration.distance = toEValue(result.evalue.amount)
|
|
380
380
|
}
|
|
381
381
|
})
|
|
382
382
|
}
|
|
@@ -385,11 +385,11 @@ function expectDistanceForMove(args) {
|
|
|
385
385
|
// TODO save id for recalibration
|
|
386
386
|
args.config.addSemantic({
|
|
387
387
|
match: ({context, isA}) => isA(context.marker, 'quantity') && !isA(context.unit.marker, 'unitPerUnit'),
|
|
388
|
-
apply: async ({context, objects, fragments, e}) => {
|
|
388
|
+
apply: async ({context, objects, toEValue, 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
|
-
objects.current.distance = result.evalue.amount
|
|
392
|
+
objects.current.distance = toEValue(result.evalue.amount)
|
|
393
393
|
}
|
|
394
394
|
})
|
|
395
395
|
}
|
|
@@ -435,11 +435,11 @@ const template = {
|
|
|
435
435
|
|
|
436
436
|
args.config.addSemantic({
|
|
437
437
|
match: ({context, isA}) => isA(context.marker, 'quantity') && isA(context.unit.marker, 'unitPerUnit'),
|
|
438
|
-
apply: async ({context, objects, api, fragments, e}) => {
|
|
438
|
+
apply: async ({context, objects, toEValue, 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)
|
|
442
|
-
const desired_speed = result.evalue.amount
|
|
441
|
+
const result = await e(instantiation, where())
|
|
442
|
+
const desired_speed = toEValue(result.evalue.amount)
|
|
443
443
|
const desired_power = objects.current.power * (desired_speed / objects.calibration.speed)
|
|
444
444
|
objects.runCommand = true
|
|
445
445
|
objects.current.power = desired_power
|
|
@@ -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
|
],
|
|
@@ -38,7 +38,7 @@ function initializer({objects, config, isModule}) {
|
|
|
38
38
|
if (Array.isArray(value)) {
|
|
39
39
|
value = toList(value)
|
|
40
40
|
}
|
|
41
|
-
context.evalue = value
|
|
41
|
+
context.evalue = value ?? { marker: 'undefined' }
|
|
42
42
|
if (context.evalue) {
|
|
43
43
|
context.isResponse = true
|
|
44
44
|
}
|
|
@@ -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
|
],
|