tpmkms 9.6.3-beta.2 → 9.6.3-beta.4
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 +1 -1
- package/common/actions.js +2 -2
- package/common/dialogues.js +3 -3
- package/common/dimension.js +3 -3
- package/common/drone.instance.json +42 -6
- package/common/drone.js +31 -20
- package/common/drone.test.json +117417 -1760
- package/common/drone_v1.instance.json +2 -2
- package/common/drone_v1.js +9 -9
- package/common/edible.instance.json +36 -0
- package/common/fastfood.instance.json +531 -263
- package/common/fastfood.js +1 -1
- package/common/nameable.js +6 -6
- package/common/ordinals.js +51 -5
- package/common/pipboy.js +1 -1
- package/common/properties.js +3 -2
- package/common/rates.instance.json +1 -1
- package/common/rates.js +3 -3
- package/common/reminders.js +1 -1
- package/common/reports.instance.json +2 -2
- package/common/reports.js +2 -2
- package/common/scorekeeper.js +1 -1
- package/common/stm.js +25 -46
- package/package.json +2 -2
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"semantics": [
|
|
41
41
|
{
|
|
42
42
|
"match": "({context, isA}) => isA(context.marker, 'action')",
|
|
43
|
-
"apply": "({context, _continue,
|
|
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,
|
|
43
|
-
|
|
42
|
+
apply: ({context, _continue, remember}) => {
|
|
43
|
+
remember(context)
|
|
44
44
|
_continue()
|
|
45
45
|
}
|
|
46
46
|
},
|
package/common/dialogues.js
CHANGED
|
@@ -544,12 +544,12 @@ const config = {
|
|
|
544
544
|
concept = two;
|
|
545
545
|
value = one;
|
|
546
546
|
}
|
|
547
|
-
// km('dialogues').api.
|
|
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.
|
|
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.
|
|
650
|
+
kms.stm.api.remember({ context: child, value: two })
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
653
|
}
|
package/common/dimension.js
CHANGED
|
@@ -38,7 +38,7 @@ class API {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
async getPreferredUnits(quantity) {
|
|
41
|
-
const preferredUnits = await this.args.
|
|
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.
|
|
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.
|
|
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,
|
|
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,
|
|
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 ({
|
|
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,
|
|
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,
|
|
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,
|
|
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",
|
|
@@ -45297,6 +45297,24 @@
|
|
|
45297
45297
|
0
|
|
45298
45298
|
]
|
|
45299
45299
|
],
|
|
45300
|
+
[
|
|
45301
|
+
[
|
|
45302
|
+
"is",
|
|
45303
|
+
0
|
|
45304
|
+
],
|
|
45305
|
+
[
|
|
45306
|
+
"list",
|
|
45307
|
+
1
|
|
45308
|
+
],
|
|
45309
|
+
[
|
|
45310
|
+
"point",
|
|
45311
|
+
0
|
|
45312
|
+
],
|
|
45313
|
+
[
|
|
45314
|
+
"unknown",
|
|
45315
|
+
0
|
|
45316
|
+
]
|
|
45317
|
+
],
|
|
45300
45318
|
[
|
|
45301
45319
|
[
|
|
45302
45320
|
"is",
|
|
@@ -85640,6 +85658,24 @@
|
|
|
85640
85658
|
0
|
|
85641
85659
|
]
|
|
85642
85660
|
],
|
|
85661
|
+
[
|
|
85662
|
+
[
|
|
85663
|
+
"is",
|
|
85664
|
+
0
|
|
85665
|
+
],
|
|
85666
|
+
[
|
|
85667
|
+
"list",
|
|
85668
|
+
1
|
|
85669
|
+
],
|
|
85670
|
+
[
|
|
85671
|
+
"point",
|
|
85672
|
+
0
|
|
85673
|
+
],
|
|
85674
|
+
[
|
|
85675
|
+
"unknown",
|
|
85676
|
+
0
|
|
85677
|
+
]
|
|
85678
|
+
],
|
|
85643
85679
|
[
|
|
85644
85680
|
[
|
|
85645
85681
|
"is",
|
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.
|
|
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.
|
|
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.
|
|
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,13 +419,15 @@ class API {
|
|
|
412
419
|
if (objects.current.timeRepeats) {
|
|
413
420
|
this.startRepeats(objects.current.timeRepeats)
|
|
414
421
|
}
|
|
415
|
-
let currentPoint = (await this.args.
|
|
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') {
|
|
419
426
|
this.pause(pathComponent.pauseSeconds, { batched: true })
|
|
420
427
|
} else {
|
|
421
|
-
const
|
|
428
|
+
const points = this.args.toArray(pathComponent)
|
|
429
|
+
// const destinationPoint = pathComponent.point
|
|
430
|
+
const destinationPoint = points[0].point || points[0]
|
|
422
431
|
if (currentPoint.x == destinationPoint.x && currentPoint.y == destinationPoint.y) {
|
|
423
432
|
// already there
|
|
424
433
|
} else {
|
|
@@ -544,7 +553,7 @@ class API {
|
|
|
544
553
|
} else {
|
|
545
554
|
ordinal = this.currentOrdinal() - 1
|
|
546
555
|
}
|
|
547
|
-
const lastPoint = await this.args.
|
|
556
|
+
const lastPoint = await this.args.recall({ context: { marker: 'point' }, condition: (context) => context.ordinal == ordinal })
|
|
548
557
|
if (!lastPoint) {
|
|
549
558
|
this.args.say(`There is no previous point to go back to`)
|
|
550
559
|
return
|
|
@@ -558,8 +567,8 @@ class API {
|
|
|
558
567
|
const current = objects.current
|
|
559
568
|
current.backAndForth = true
|
|
560
569
|
const ordinal = this.currentOrdinal()
|
|
561
|
-
const currentPoint = await this.args.
|
|
562
|
-
const lastPoint = await this.args.
|
|
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 })
|
|
563
572
|
current.path.push(lastPoint)
|
|
564
573
|
current.path.push(currentPoint)
|
|
565
574
|
objects.runCommand = true
|
|
@@ -918,7 +927,7 @@ const template = {
|
|
|
918
927
|
{
|
|
919
928
|
id: 'back',
|
|
920
929
|
isA: ['noun'],
|
|
921
|
-
semantic: async ({objects,
|
|
930
|
+
semantic: async ({objects, api, e, context, say}) => {
|
|
922
931
|
await api.back()
|
|
923
932
|
}
|
|
924
933
|
},
|
|
@@ -1050,7 +1059,7 @@ const template = {
|
|
|
1050
1059
|
time: "(@<= 'quantity' && context.unit.dimension == 'time')",
|
|
1051
1060
|
},
|
|
1052
1061
|
},
|
|
1053
|
-
semantic: async ({context,
|
|
1062
|
+
semantic: async ({context, remember, api, e, fragments, toFinalValue}) => {
|
|
1054
1063
|
let time = context.time
|
|
1055
1064
|
if (time.marker == 'forQuantity') {
|
|
1056
1065
|
time = time.quantity
|
|
@@ -1059,7 +1068,7 @@ const template = {
|
|
|
1059
1068
|
const result = await e(instantiation)
|
|
1060
1069
|
const seconds = toFinalValue(toFinalValue(result).amount)
|
|
1061
1070
|
context.pauseSeconds = seconds
|
|
1062
|
-
|
|
1071
|
+
remember(context)
|
|
1063
1072
|
api.pause(seconds)
|
|
1064
1073
|
}
|
|
1065
1074
|
},
|
|
@@ -1070,7 +1079,7 @@ const template = {
|
|
|
1070
1079
|
1: "{ marker: 'drone' }",
|
|
1071
1080
|
},
|
|
1072
1081
|
bridge: "{ ...next(operator), object: after[0], interpolate: [{ context: operator }, { property: 'object' }] }",
|
|
1073
|
-
semantic: async ({
|
|
1082
|
+
semantic: async ({context, objects, api, say}) => {
|
|
1074
1083
|
await api.stop()
|
|
1075
1084
|
await api.markCurrentPoint()
|
|
1076
1085
|
}
|
|
@@ -1108,13 +1117,14 @@ const template = {
|
|
|
1108
1117
|
return true
|
|
1109
1118
|
}
|
|
1110
1119
|
},
|
|
1111
|
-
apply: async ({context, frameOfReference, toArray, fragments, stm, objects,
|
|
1112
|
-
const pathComponents = toArray(await
|
|
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 }))
|
|
1113
1122
|
const path = (await fragments('path')).contexts()[0]
|
|
1114
1123
|
delete path.value
|
|
1124
|
+
path.instance = true
|
|
1115
1125
|
path.points = pathComponents.reverse()
|
|
1116
1126
|
frameOfReference(path, { mentioned: 'points', reversed: true })
|
|
1117
|
-
await
|
|
1127
|
+
await remember(path)
|
|
1118
1128
|
|
|
1119
1129
|
_continue() // let the call pick the object out from the stm
|
|
1120
1130
|
},
|
|
@@ -1129,15 +1139,15 @@ const template = {
|
|
|
1129
1139
|
return true
|
|
1130
1140
|
}
|
|
1131
1141
|
},
|
|
1132
|
-
apply: async ({context, e, fragments, stm, toEValue, toArray, objects,
|
|
1142
|
+
apply: async ({context, e, fragments, stm, toEValue, toArray, objects, remember, recall, resolveEvaluate, _continue, contextHierarchy}) => {
|
|
1133
1143
|
const evaluated = await e({...context, notUnderCall: true})
|
|
1134
1144
|
const pointsContext = toEValue(evaluated)
|
|
1135
1145
|
const pathComponents = toArray(pointsContext)
|
|
1136
1146
|
|
|
1137
1147
|
const path = (await fragments('path')).contexts()[0]
|
|
1138
1148
|
delete path.value
|
|
1139
|
-
path.points = pathComponents
|
|
1140
|
-
await
|
|
1149
|
+
path.points = [...pathComponents]
|
|
1150
|
+
await remember(path)
|
|
1141
1151
|
resolveEvaluate(context, path)
|
|
1142
1152
|
},
|
|
1143
1153
|
},
|
|
@@ -1151,8 +1161,8 @@ const template = {
|
|
|
1151
1161
|
},
|
|
1152
1162
|
{
|
|
1153
1163
|
match: ({context}) => context.evaluate && ['start', 'end'].includes(context.marker) && context.objects && context.objects[1].marker == 'path',
|
|
1154
|
-
apply: async ({gp, s, context, objects, fragments, resolveEvaluate, api,
|
|
1155
|
-
const path = await
|
|
1164
|
+
apply: async ({gp, s, context, objects, fragments, resolveEvaluate, api, recall}) => {
|
|
1165
|
+
const path = await recall({ context: context.objects[1] })
|
|
1156
1166
|
if (!path?.points) {
|
|
1157
1167
|
return
|
|
1158
1168
|
}
|
|
@@ -1238,6 +1248,7 @@ knowledgeModule( {
|
|
|
1238
1248
|
defaultContextCheck({ marker: 'path', exported: true,
|
|
1239
1249
|
extra: [
|
|
1240
1250
|
'points',
|
|
1251
|
+
'instance',
|
|
1241
1252
|
{
|
|
1242
1253
|
property: 'namespaced',
|
|
1243
1254
|
check: [
|