ekms 9.8.0-beta.0 → 9.8.0-beta.10
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 +3 -1
- package/common/askfor.instance.json +7 -1
- package/common/askfor.js +5 -2
- package/common/asking.js +9 -4
- package/common/avatar.js +1 -1
- package/common/concept.instance.json +8 -4
- package/common/concept.js +2 -0
- package/common/conjunction.js +2 -0
- package/common/control.js +2 -2
- package/common/countable.js +1 -0
- package/common/dateTimeSelectors.instance.json +3 -3
- package/common/dateTimeSelectors.js +3 -6
- package/common/dates.instance.json +10 -0
- package/common/dates.js +5 -0
- package/common/debug.instance.json +5 -1
- package/common/debug.js +2 -0
- package/common/dialogues.js +11 -7
- package/common/dimension.instance.json +16 -14
- package/common/dimension.js +6 -5
- package/common/drone.instance.json +41 -17
- package/common/drone.js +24 -12
- package/common/drone_v1.instance.json +10 -0
- package/common/drone_v1.js +5 -0
- package/common/evaluate.js +6 -12
- package/common/fastfood.instance.json +10 -2
- package/common/fastfood.js +6 -0
- package/common/formulas.instance.json +2 -2
- package/common/formulas.js +3 -3
- package/common/gdefaults.js +3 -3
- package/common/hierarchy.js +2 -2
- package/common/menus.instance.json +5 -1
- package/common/menus.js +3 -0
- package/common/meta.js +2 -1
- package/common/nameable.js +4 -2
- package/common/ordinals.js +1 -1
- package/common/percentages.js +2 -0
- package/common/pipboy.instance.json +34 -22
- package/common/pipboy.js +18 -11
- package/common/properties.instance.json +26 -26
- package/common/properties.js +17 -23
- package/common/punctuation.js +1 -0
- package/common/rates.instance.json +1 -1
- package/common/rates.js +1 -1
- package/common/reminders.instance.json +16 -0
- package/common/reminders.js +10 -7
- package/common/reports.instance.json +2 -2
- package/common/scorekeeper.js +6 -6
- package/common/sdefaults.js +3 -2
- package/common/stm.js +9 -8
- package/common/time.instance.json +3 -3
- package/common/time.js +3 -3
- package/common/wp.instance.json +10 -4
- package/common/wp.js +5 -2
- package/package.json +2 -2
|
@@ -87,16 +87,16 @@
|
|
|
87
87
|
]
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:
|
|
90
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:201",
|
|
91
91
|
"id": "preferredUnits",
|
|
92
92
|
"isA": [
|
|
93
93
|
"verb"
|
|
94
94
|
],
|
|
95
95
|
"bridge": "{ ...next(operator), quantity: after[0], operator: operator, interpolate: [{ property: 'operator' }, { property: 'quantity' }] }",
|
|
96
|
-
"semantic": "async ({context, e, api, toArray,
|
|
96
|
+
"semantic": "async ({context, e, api, toArray, resolveEvaluate}) => {\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 resolveEvaluate(context, value.evalue)\n }"
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:
|
|
99
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:216",
|
|
100
100
|
"id": "useUnits",
|
|
101
101
|
"isA": [
|
|
102
102
|
"verb"
|
|
@@ -105,11 +105,11 @@
|
|
|
105
105
|
"semantic": "({context, api}) => {\n api.setPreferredUnits(context.units)\n }"
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:
|
|
108
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:225",
|
|
109
109
|
"id": "dimension"
|
|
110
110
|
},
|
|
111
111
|
{
|
|
112
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:
|
|
112
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:229",
|
|
113
113
|
"id": "quantity",
|
|
114
114
|
"isA": [
|
|
115
115
|
"noun"
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
"bridge": "{ \n marker: next(operator('quantity')), \n dead: true, \n instance: true,\n unit: after[0], \n amount: before[0], \n interpolate: [ { property: 'amount' }, { property: 'unit' } ] \n }"
|
|
155
155
|
},
|
|
156
156
|
{
|
|
157
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:
|
|
157
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:267",
|
|
158
158
|
"id": "convertToUnits",
|
|
159
159
|
"bridge": "{ ...next(operator), from: before[0], to: after[0] }",
|
|
160
160
|
"isA": [
|
|
@@ -198,6 +198,7 @@
|
|
|
198
198
|
"bridges": [
|
|
199
199
|
{
|
|
200
200
|
"id": "useMeasurementSystem",
|
|
201
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:325",
|
|
201
202
|
"isA": [
|
|
202
203
|
"verb"
|
|
203
204
|
],
|
|
@@ -224,8 +225,8 @@
|
|
|
224
225
|
{
|
|
225
226
|
"semantics": [
|
|
226
227
|
{
|
|
227
|
-
"match": "({context, isA, debug}) => {\n return context.
|
|
228
|
-
"apply": "async ({context, e, unify, toEValue}) => {\n const t1 = context.terms[0]\n const t2 = context.terms[1]\n if (t1.propertyType !== t2.propertyType) {\n return\n }\n if (t1[t1.propertyType].marker !== t2[t2.propertyType].marker) {\n return\n }\n const convert = await e({ marker: 'convertToUnits', from: t2, to: t1.unit })\n const t2InT1Units = await toEValue(await toEValue(convert))\n debug.
|
|
228
|
+
"match": "({context, isA, debug}) => {\n return context.marker == 'unify' && \n context.terms.every((term) => isA(term, 'quantity')) &&\n context.terms.every((term) => term.instance)\n }",
|
|
229
|
+
"apply": "async ({context, e, unify, toEValue}) => {\n const t1 = context.terms[0]\n const t2 = context.terms[1]\n if (t1.propertyType !== t2.propertyType) {\n return\n }\n if (t1[t1.propertyType].marker !== t2[t2.propertyType].marker) {\n return\n }\n const convert = await e({ marker: 'convertToUnits', from: t2, to: t1.unit })\n const t2InT1Units = await toEValue(await toEValue(convert))\n // debug.coxunter('greg29')\n if (!await unify(t1.amount, await t2InT1Units.amount)) {\n // debugger\n }\n // debugger\n }"
|
|
229
230
|
}
|
|
230
231
|
]
|
|
231
232
|
}
|
|
@@ -5191,7 +5192,7 @@
|
|
|
5191
5192
|
],
|
|
5192
5193
|
"generators": [
|
|
5193
5194
|
{
|
|
5194
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:
|
|
5195
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:187"
|
|
5195
5196
|
}
|
|
5196
5197
|
],
|
|
5197
5198
|
"bridges": [
|
|
@@ -5219,7 +5220,7 @@
|
|
|
5219
5220
|
]
|
|
5220
5221
|
},
|
|
5221
5222
|
{
|
|
5222
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:
|
|
5223
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:201",
|
|
5223
5224
|
"id": "preferredUnits",
|
|
5224
5225
|
"isA": [
|
|
5225
5226
|
"verb"
|
|
@@ -5227,7 +5228,7 @@
|
|
|
5227
5228
|
"bridge": "{ ...next(operator), quantity: after[0], operator: operator, interpolate: [{ property: 'operator' }, { property: 'quantity' }] }"
|
|
5228
5229
|
},
|
|
5229
5230
|
{
|
|
5230
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:
|
|
5231
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:216",
|
|
5231
5232
|
"id": "useUnits",
|
|
5232
5233
|
"isA": [
|
|
5233
5234
|
"verb"
|
|
@@ -5235,11 +5236,11 @@
|
|
|
5235
5236
|
"bridge": "{ ...next(operator), units: after[0], operator: operator, interpolate: [{ property: 'operator' }, { property: 'units' }] }"
|
|
5236
5237
|
},
|
|
5237
5238
|
{
|
|
5238
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:
|
|
5239
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:225",
|
|
5239
5240
|
"id": "dimension"
|
|
5240
5241
|
},
|
|
5241
5242
|
{
|
|
5242
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:
|
|
5243
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:229",
|
|
5243
5244
|
"id": "quantity",
|
|
5244
5245
|
"isA": [
|
|
5245
5246
|
"noun"
|
|
@@ -5288,7 +5289,7 @@
|
|
|
5288
5289
|
"bridge": "{ \n marker: next(operator('quantity')), \n dead: true, \n instance: true,\n unit: after[0], \n amount: before[0], \n interpolate: [ { property: 'amount' }, { property: 'unit' } ] \n }"
|
|
5289
5290
|
},
|
|
5290
5291
|
{
|
|
5291
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:
|
|
5292
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:267",
|
|
5292
5293
|
"id": "convertToUnits",
|
|
5293
5294
|
"bridge": "{ ...next(operator), from: before[0], to: after[0] }",
|
|
5294
5295
|
"isA": [
|
|
@@ -5331,6 +5332,7 @@
|
|
|
5331
5332
|
"bridges": [
|
|
5332
5333
|
{
|
|
5333
5334
|
"id": "useMeasurementSystem",
|
|
5335
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/dimension.js:325",
|
|
5334
5336
|
"isA": [
|
|
5335
5337
|
"verb"
|
|
5336
5338
|
],
|
package/common/dimension.js
CHANGED
|
@@ -79,6 +79,7 @@ class API {
|
|
|
79
79
|
config.addOperator(`([${dimension}])`)
|
|
80
80
|
config.addBridge({
|
|
81
81
|
id: dimension,
|
|
82
|
+
where: where(),
|
|
82
83
|
isA: ['dimension'],
|
|
83
84
|
generatorp: async ({context, g}) => context.amount ? `${await g(context.amount)} ${await g(context.unit)}` : context.word,
|
|
84
85
|
})
|
|
@@ -201,14 +202,14 @@ const config = {
|
|
|
201
202
|
id: "preferredUnits",
|
|
202
203
|
isA: ['verb'],
|
|
203
204
|
bridge: "{ ...next(operator), quantity: after[0], operator: operator, interpolate: [{ property: 'operator' }, { property: 'quantity' }] }",
|
|
204
|
-
semantic: async ({context, e, api, toArray,
|
|
205
|
+
semantic: async ({context, e, api, toArray, resolveEvaluate}) => {
|
|
205
206
|
const preferredUnits = await api.getPreferredUnits(context.quantity)
|
|
206
207
|
if (!preferredUnits) {
|
|
207
208
|
return
|
|
208
209
|
}
|
|
209
210
|
const from = context.quantity;
|
|
210
211
|
const value = await e({ marker: 'convertToUnits', from, to: preferredUnits })
|
|
211
|
-
|
|
212
|
+
resolveEvaluate(context, value.evalue)
|
|
212
213
|
}
|
|
213
214
|
},
|
|
214
215
|
{
|
|
@@ -321,6 +322,7 @@ const template = {
|
|
|
321
322
|
bridges: [
|
|
322
323
|
{
|
|
323
324
|
id: 'useMeasurementSystem',
|
|
325
|
+
where: where(),
|
|
324
326
|
isA: ['verb'],
|
|
325
327
|
bridge: "{ ...next(operator), system: after[0], interpolate: [ { context: operator }, { property: 'system' } ] }",
|
|
326
328
|
semantic: ({context, api}) => {
|
|
@@ -334,8 +336,7 @@ const template = {
|
|
|
334
336
|
semantics: [
|
|
335
337
|
{
|
|
336
338
|
match: ({context, isA, debug}) => {
|
|
337
|
-
return context.
|
|
338
|
-
context.marker == 'unify' &&
|
|
339
|
+
return context.marker == 'unify' &&
|
|
339
340
|
context.terms.every((term) => isA(term, 'quantity')) &&
|
|
340
341
|
context.terms.every((term) => term.instance)
|
|
341
342
|
},
|
|
@@ -350,7 +351,7 @@ const template = {
|
|
|
350
351
|
}
|
|
351
352
|
const convert = await e({ marker: 'convertToUnits', from: t2, to: t1.unit })
|
|
352
353
|
const t2InT1Units = await toEValue(await toEValue(convert))
|
|
353
|
-
debug.
|
|
354
|
+
// debug.coxunter('greg29')
|
|
354
355
|
if (!await unify(t1.amount, await t2InT1Units.amount)) {
|
|
355
356
|
// debugger
|
|
356
357
|
}
|
|
@@ -164,6 +164,7 @@
|
|
|
164
164
|
},
|
|
165
165
|
{
|
|
166
166
|
"id": "startPath",
|
|
167
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:942",
|
|
167
168
|
"isA": [
|
|
168
169
|
"verb"
|
|
169
170
|
],
|
|
@@ -263,6 +264,7 @@
|
|
|
263
264
|
},
|
|
264
265
|
{
|
|
265
266
|
"id": "patrol",
|
|
267
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:983",
|
|
266
268
|
"isA": [
|
|
267
269
|
"verb",
|
|
268
270
|
"repeatable",
|
|
@@ -284,10 +286,11 @@
|
|
|
284
286
|
},
|
|
285
287
|
"path"
|
|
286
288
|
],
|
|
287
|
-
"semantic": "async ({context, g, e, toArray, fragments, toEValue, toFinalValue, recall, objects, verbatim}) => {\n const paths = toArray(context.path)\n for (const context_path of paths) {\n const evaluated = await(e(context_path))\n const path = toEValue(evaluated)\n if (path.marker
|
|
289
|
+
"semantic": "async ({context, g, e, toArray, fragments, toEValue, toFinalValue, recall, objects, verbatim}) => {\n const paths = toArray(context.path)\n for (const context_path of paths) {\n const evaluated = await(e(context_path))\n const path = toEValue(evaluated)\n if (path.marker === 'undefined') {\n verbatim(`${await g(context_path)} is not a known path`)\n continue\n }\n \n objects.current.path.push({ message: await g(context) })\n\n // TODO put this in a common place for use by do+patrol \n\n // ordinal to pause time in seconds \n const pauseTimeInSeconds = {}\n if (context.pause) {\n const timeAtPoints = toArray(context.pause.timeAtPoint)\n for (const timeAtPoint of timeAtPoints) {\n const instantiation = await fragments(\"quantity in seconds\", { quantity: timeAtPoint.time })\n const result = await e(instantiation)\n const seconds = toFinalValue(toFinalValue(result).amount)\n\n const points = await recall({ context: timeAtPoint.point.point, frameOfReference: path })\n for (const point of toArray(points)) {\n pauseTimeInSeconds[point.ordinal] = seconds\n }\n }\n }\n\n let skipPoints = []\n if (context.skip) {\n skipPoints = toArray(await recall({ context: context.skip.points, frameOfReference: path }))\n }\n\n // get to the start of the patrol \n objects.current.path.push(path.points[0])\n objects.current.path.push({ aimOnly: true, ...path.points[1] })\n objects.current.path.push({ repeatStart: true })\n for (const point of path.points) {\n if (skipPoints.find((skipPoint) => skipPoint.ordinal == point.ordinal)) {\n continue\n }\n objects.current.path.push(point)\n if (pauseTimeInSeconds[point.ordinal]) {\n objects.current.path.push({ marker: 'pause', pauseSeconds: pauseTimeInSeconds[point.ordinal] })\n }\n }\n if (context.repeats) {\n objects.current.timeRepeats = toFinalValue(context.repeats.repeats)\n }\n // if the patrol does not start and end at the same spot then \n // go back to the start along the same path\n\n\n // if the start is not the end of the patrol then go backwards along the patrol\n if (JSON.stringify(path.points[0].point) !== JSON.stringify(path.points[path.points.length-1].point)) {\n for (const point of [...path.points].reverse().slice(1)) {\n if (skipPoints.find((skipPoint) => skipPoint.ordinal == point.ordinal)) {\n continue\n }\n objects.current.path.push(point)\n if (pauseTimeInSeconds[point.ordinal]) {\n objects.current.path.push({ marker: 'pause', pauseSeconds: pauseTimeInSeconds[point.ordinal] })\n }\n }\n\n const secondPoint = path.points[1]\n objects.current.path.push({ ...secondPoint, aimOnly: true })\n }\n }\n objects.runCommand = true\n }"
|
|
288
290
|
},
|
|
289
291
|
{
|
|
290
292
|
"id": "lift",
|
|
293
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1086",
|
|
291
294
|
"isA": [
|
|
292
295
|
"verb"
|
|
293
296
|
],
|
|
@@ -311,6 +314,7 @@
|
|
|
311
314
|
},
|
|
312
315
|
{
|
|
313
316
|
"id": "lower",
|
|
317
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1098",
|
|
314
318
|
"isA": [
|
|
315
319
|
"verb"
|
|
316
320
|
],
|
|
@@ -334,6 +338,7 @@
|
|
|
334
338
|
},
|
|
335
339
|
{
|
|
336
340
|
"id": "openDrone",
|
|
341
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1110",
|
|
337
342
|
"isA": [
|
|
338
343
|
"verb"
|
|
339
344
|
],
|
|
@@ -357,6 +362,7 @@
|
|
|
357
362
|
},
|
|
358
363
|
{
|
|
359
364
|
"id": "close",
|
|
365
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1122",
|
|
360
366
|
"isA": [
|
|
361
367
|
"verb"
|
|
362
368
|
],
|
|
@@ -380,6 +386,7 @@
|
|
|
380
386
|
},
|
|
381
387
|
{
|
|
382
388
|
"id": "back",
|
|
389
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1134",
|
|
383
390
|
"isA": [
|
|
384
391
|
"noun"
|
|
385
392
|
],
|
|
@@ -393,6 +400,7 @@
|
|
|
393
400
|
},
|
|
394
401
|
{
|
|
395
402
|
"id": "toPoint",
|
|
403
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1146",
|
|
396
404
|
"isA": [
|
|
397
405
|
"preposition"
|
|
398
406
|
],
|
|
@@ -422,6 +430,7 @@
|
|
|
422
430
|
},
|
|
423
431
|
{
|
|
424
432
|
"id": "go",
|
|
433
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1159",
|
|
425
434
|
"level": 0,
|
|
426
435
|
"isA": [
|
|
427
436
|
"verb",
|
|
@@ -581,6 +590,7 @@
|
|
|
581
590
|
},
|
|
582
591
|
{
|
|
583
592
|
"id": "turn",
|
|
593
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1213",
|
|
584
594
|
"isA": [
|
|
585
595
|
"verb",
|
|
586
596
|
"action",
|
|
@@ -620,6 +630,7 @@
|
|
|
620
630
|
},
|
|
621
631
|
{
|
|
622
632
|
"id": "pause",
|
|
633
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1272",
|
|
623
634
|
"isA": [
|
|
624
635
|
"verb"
|
|
625
636
|
],
|
|
@@ -800,6 +811,7 @@
|
|
|
800
811
|
},
|
|
801
812
|
{
|
|
802
813
|
"id": "stop",
|
|
814
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1317",
|
|
803
815
|
"isA": [
|
|
804
816
|
"verb"
|
|
805
817
|
],
|
|
@@ -826,28 +838,28 @@
|
|
|
826
838
|
"apply": "async ({context, fragments, e, s, toEValue, toFinalValue, namespaced, objects}) => {\n const updated = { ...context, marker: 'patrol', path: context.action }\n namespaced.set('actions', updated, 'logged', true)\n await s(updated)\n // await s({ ...context, marker: 'patrol', path: context.action })\n }"
|
|
827
839
|
},
|
|
828
840
|
{
|
|
829
|
-
"match": "({context, contextHierarchy}) => {\n if (!context.pullFromContext ||
|
|
841
|
+
"match": "({context, contextHierarchy}) => {\n if (!context.pullFromContext || contextHierarchy.under(['doAction', 'evaluate', 'patrol']) || context.isInstance) {\n return false\n }\n \n if (context.marker == 'path' || context.marker == 'this' || context.marker == 'that') {\n return true\n }\n }",
|
|
830
842
|
"apply": "async ({context, frameOfReference, toArray, fragments, objects, remember, recall, resolveEvaluate, _continue, contextHierarchy}) => {\n const pathComponents = toArray(await recall({ \n context: { marker: 'pathComponent' }, \n all: true,\n stopCondition: (context) => context.marker == 'startPath',\n }))\n const path = (await fragments('path')).contexts()[0]\n delete path.value\n path.isInstance = 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 }"
|
|
831
843
|
},
|
|
832
844
|
{
|
|
833
|
-
"match": "({context, contextHierarchy}) => {\n if (!context.pullFromContext || !
|
|
845
|
+
"match": "({context, contextHierarchy}) => {\n if (!context.pullFromContext || !contextHierarchy.under('call') || context.notUnderCall) {\n return false\n }\n \n if (context.marker == 'point' || context.marker == 'ordinal') {\n return true\n }\n }",
|
|
834
846
|
"apply": "async ({frameOfReference, 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.isInstance = true\n path.points = [...pathComponents]\n frameOfReference(path, { mentioned: 'points', reversed: true })\n await remember(path)\n resolveEvaluate(context, path)\n }"
|
|
835
847
|
},
|
|
836
848
|
{
|
|
837
|
-
"match": "({context}) =>
|
|
849
|
+
"match": "({context}) => ['start', 'end'].includes(context.marker) && context.objects && context.objects[1].marker == 'path'",
|
|
838
850
|
"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 }"
|
|
839
851
|
},
|
|
840
852
|
{
|
|
841
|
-
"match": "({context, contextHierarchy}) => \n
|
|
853
|
+
"match": "({context, contextHierarchy}) => \n ['start', 'end', 'point'].includes(context.marker) && \n !context.propertyOf && \n contextHierarchy.under('go') &&\n !contextHierarchy.under('call')",
|
|
842
854
|
"apply": "async ({gp, s, toArray, context, objects, fragments, resolveEvaluate, api, recall}) => {\n const path = await recall({ context: { marker: 'path' } })\n if (!path?.points) {\n return\n }\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 } else {\n const points = await recall({ context, frameOfReference: path })\n resolveEvaluate(context, toArray(points)[0])\n }\n }"
|
|
843
855
|
},
|
|
844
856
|
{
|
|
845
|
-
"match": "({context}) => {\n // from stm lookup\n if (context.marker == 'mentions' && context.
|
|
846
|
-
"apply": "async ({gp, s, context, objects, fragments, resolveEvaluate, api}) => {\n let return_context = context\n if (context.marker == 'speed') {\n // okay\n } else {\n // stm lookup\n return_context = context\n context = context.args.context\n }\n let value = objects.current.speed\n if (context.condition) {\n if (['highest', 'maximum'].includes(context.condition.marker)) {\n value = api.maximumSpeedDrone()\n } else if (['lowest', 'minimum'].includes(context.condition.marker)) {\n value = api.minimumSpeedDrone()\n }\n }\n const speed = await fragments(\"number meters per second\", { number: { marker: 'integer', value, word: undefined} })\n const preferred = await s({ marker: 'preferredUnits', quantity: speed }) \n resolveEvaluate(return_context, preferred.
|
|
857
|
+
"match": "({context}) => {\n // from stm lookup\n if (context.marker == 'mentions' && context.args.context.marker == 'speed') {\n return true\n }\n // from property directly\n if (context.marker == 'speed') {\n return true\n }\n }",
|
|
858
|
+
"apply": "async ({gp, s, context, objects, fragments, resolveEvaluate, api}) => {\n let return_context = context\n if (context.marker == 'speed') {\n // okay\n } else {\n // stm lookup\n return_context = context\n context = context.args.context\n }\n let value = objects.current.speed\n if (context.condition) {\n if (['highest', 'maximum'].includes(context.condition.marker)) {\n value = api.maximumSpeedDrone()\n } else if (['lowest', 'minimum'].includes(context.condition.marker)) {\n value = api.minimumSpeedDrone()\n }\n }\n const speed = await fragments(\"number meters per second\", { number: { marker: 'integer', value, word: undefined} })\n const preferred = await s({ marker: 'preferredUnits', quantity: speed }) \n resolveEvaluate(return_context, preferred.evalue || speed)\n }"
|
|
847
859
|
},
|
|
848
860
|
{
|
|
849
|
-
"match": "({context}) => {\n if (context.marker == 'mentions' &&
|
|
850
|
-
"apply": "async ({gp, s, context, objects, fragments, resolveEvaluate, api}) => {\n const value = objects.current.angleInRadians\n const fi = await fragments(\"number radians\")\n const direction = await fi.instantiate([\n { \n match: ({path, pathEquals}) => pathEquals(path, ['0', 'amount']),\n apply: ({context}) => {\n Object.assign(context, { marker: 'number', value: value, word: undefined })\n }\n }\n ])\n const preferred = await s({ marker: 'preferredUnits', quantity: direction }) \n resolveEvaluate(context, preferred.
|
|
861
|
+
"match": "({context}) => {\n if (context.marker == 'mentions' && ['direction', 'drone_direction'].includes(context.args.context.marker)) {\n return true\n }\n if (['direction', 'drone_direction'].includes(context.marker)) {\n return true\n }\n }",
|
|
862
|
+
"apply": "async ({gp, s, context, objects, fragments, resolveEvaluate, api}) => {\n const value = objects.current.angleInRadians\n const fi = await fragments(\"number radians\")\n const direction = await fi.instantiate([\n { \n match: ({path, pathEquals}) => pathEquals(path, ['0', 'amount']),\n apply: ({context}) => {\n Object.assign(context, { marker: 'number', value: value, word: undefined })\n }\n }\n ])\n const preferred = await s({ marker: 'preferredUnits', quantity: direction }) \n resolveEvaluate(context, preferred.evalue || direction)\n }"
|
|
851
863
|
},
|
|
852
864
|
{
|
|
853
865
|
"match": "({context}) => context.marker == 'timeRepeats'",
|
|
@@ -10129,6 +10141,7 @@
|
|
|
10129
10141
|
},
|
|
10130
10142
|
{
|
|
10131
10143
|
"id": "startPath",
|
|
10144
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:942",
|
|
10132
10145
|
"isA": [
|
|
10133
10146
|
"verb"
|
|
10134
10147
|
],
|
|
@@ -10227,6 +10240,7 @@
|
|
|
10227
10240
|
},
|
|
10228
10241
|
{
|
|
10229
10242
|
"id": "patrol",
|
|
10243
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:983",
|
|
10230
10244
|
"isA": [
|
|
10231
10245
|
"verb",
|
|
10232
10246
|
"repeatable",
|
|
@@ -10251,6 +10265,7 @@
|
|
|
10251
10265
|
},
|
|
10252
10266
|
{
|
|
10253
10267
|
"id": "lift",
|
|
10268
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1086",
|
|
10254
10269
|
"isA": [
|
|
10255
10270
|
"verb"
|
|
10256
10271
|
],
|
|
@@ -10273,6 +10288,7 @@
|
|
|
10273
10288
|
},
|
|
10274
10289
|
{
|
|
10275
10290
|
"id": "lower",
|
|
10291
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1098",
|
|
10276
10292
|
"isA": [
|
|
10277
10293
|
"verb"
|
|
10278
10294
|
],
|
|
@@ -10295,6 +10311,7 @@
|
|
|
10295
10311
|
},
|
|
10296
10312
|
{
|
|
10297
10313
|
"id": "openDrone",
|
|
10314
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1110",
|
|
10298
10315
|
"isA": [
|
|
10299
10316
|
"verb"
|
|
10300
10317
|
],
|
|
@@ -10317,6 +10334,7 @@
|
|
|
10317
10334
|
},
|
|
10318
10335
|
{
|
|
10319
10336
|
"id": "close",
|
|
10337
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1122",
|
|
10320
10338
|
"isA": [
|
|
10321
10339
|
"verb"
|
|
10322
10340
|
],
|
|
@@ -10339,6 +10357,7 @@
|
|
|
10339
10357
|
},
|
|
10340
10358
|
{
|
|
10341
10359
|
"id": "back",
|
|
10360
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1134",
|
|
10342
10361
|
"isA": [
|
|
10343
10362
|
"noun"
|
|
10344
10363
|
]
|
|
@@ -10351,6 +10370,7 @@
|
|
|
10351
10370
|
},
|
|
10352
10371
|
{
|
|
10353
10372
|
"id": "toPoint",
|
|
10373
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1146",
|
|
10354
10374
|
"isA": [
|
|
10355
10375
|
"preposition"
|
|
10356
10376
|
],
|
|
@@ -10379,6 +10399,7 @@
|
|
|
10379
10399
|
},
|
|
10380
10400
|
{
|
|
10381
10401
|
"id": "go",
|
|
10402
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1159",
|
|
10382
10403
|
"level": 0,
|
|
10383
10404
|
"isA": [
|
|
10384
10405
|
"verb",
|
|
@@ -10537,6 +10558,7 @@
|
|
|
10537
10558
|
},
|
|
10538
10559
|
{
|
|
10539
10560
|
"id": "turn",
|
|
10561
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1213",
|
|
10540
10562
|
"isA": [
|
|
10541
10563
|
"verb",
|
|
10542
10564
|
"action",
|
|
@@ -10575,6 +10597,7 @@
|
|
|
10575
10597
|
},
|
|
10576
10598
|
{
|
|
10577
10599
|
"id": "pause",
|
|
10600
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1272",
|
|
10578
10601
|
"isA": [
|
|
10579
10602
|
"verb"
|
|
10580
10603
|
],
|
|
@@ -10754,6 +10777,7 @@
|
|
|
10754
10777
|
},
|
|
10755
10778
|
{
|
|
10756
10779
|
"id": "stop",
|
|
10780
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1317",
|
|
10757
10781
|
"isA": [
|
|
10758
10782
|
"verb"
|
|
10759
10783
|
],
|
|
@@ -10769,29 +10793,29 @@
|
|
|
10769
10793
|
],
|
|
10770
10794
|
"semantics": [
|
|
10771
10795
|
{
|
|
10772
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:
|
|
10796
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1341"
|
|
10773
10797
|
},
|
|
10774
10798
|
{
|
|
10775
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:
|
|
10799
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1351"
|
|
10776
10800
|
},
|
|
10777
10801
|
{
|
|
10778
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:
|
|
10802
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1378"
|
|
10779
10803
|
},
|
|
10780
10804
|
{
|
|
10781
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:
|
|
10805
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1413"
|
|
10782
10806
|
},
|
|
10783
10807
|
{},
|
|
10784
10808
|
{
|
|
10785
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:
|
|
10809
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1450"
|
|
10786
10810
|
},
|
|
10787
10811
|
{
|
|
10788
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:
|
|
10812
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1484"
|
|
10789
10813
|
},
|
|
10790
10814
|
{
|
|
10791
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:
|
|
10815
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1510"
|
|
10792
10816
|
},
|
|
10793
10817
|
{
|
|
10794
|
-
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:
|
|
10818
|
+
"where": "/home/dev/code/theprogrammablemind/kms/common/drone.js:1517"
|
|
10795
10819
|
}
|
|
10796
10820
|
]
|
|
10797
10821
|
}
|
package/common/drone.js
CHANGED
|
@@ -228,7 +228,7 @@ https://www.amazon.ca/Freenove-Raspberry-Tracking-Avoidance-Ultrasonic/dp/B0BNDQ
|
|
|
228
228
|
|
|
229
229
|
function expectDirection(args) {
|
|
230
230
|
args.config.addSemantic({
|
|
231
|
-
match: ({context, isA}) => isA(context.marker, 'direction')
|
|
231
|
+
match: ({context, isA}) => isA(context.marker, 'direction'),
|
|
232
232
|
apply: ({objects, context}) => {
|
|
233
233
|
objects.runCommand = true
|
|
234
234
|
objects.current.direction = context.marker
|
|
@@ -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),
|
|
@@ -992,7 +994,7 @@ const template = {
|
|
|
992
994
|
for (const context_path of paths) {
|
|
993
995
|
const evaluated = await(e(context_path))
|
|
994
996
|
const path = toEValue(evaluated)
|
|
995
|
-
if (path.marker
|
|
997
|
+
if (path.marker === 'undefined') {
|
|
996
998
|
verbatim(`${await g(context_path)} is not a known path`)
|
|
997
999
|
continue
|
|
998
1000
|
}
|
|
@@ -1064,6 +1066,7 @@ const template = {
|
|
|
1064
1066
|
/*
|
|
1065
1067
|
{
|
|
1066
1068
|
id: 'do',
|
|
1069
|
+
where: where(),
|
|
1067
1070
|
isA: ['verb'],
|
|
1068
1071
|
bridge: `{
|
|
1069
1072
|
...next(operator), operator: operator, path: after[0], interpolate: [{ property: 'operator'}, { property: 'path' }]
|
|
@@ -1080,6 +1083,7 @@ const template = {
|
|
|
1080
1083
|
*/
|
|
1081
1084
|
{
|
|
1082
1085
|
id: 'lift',
|
|
1086
|
+
where: where(),
|
|
1083
1087
|
isA: ['verb'],
|
|
1084
1088
|
bridge: `{
|
|
1085
1089
|
...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]
|
|
@@ -1091,6 +1095,7 @@ const template = {
|
|
|
1091
1095
|
},
|
|
1092
1096
|
{
|
|
1093
1097
|
id: 'lower',
|
|
1098
|
+
where: where(),
|
|
1094
1099
|
isA: ['verb'],
|
|
1095
1100
|
bridge: `{
|
|
1096
1101
|
...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]
|
|
@@ -1102,6 +1107,7 @@ const template = {
|
|
|
1102
1107
|
},
|
|
1103
1108
|
{
|
|
1104
1109
|
id: 'openDrone',
|
|
1110
|
+
where: where(),
|
|
1105
1111
|
isA: ['verb'],
|
|
1106
1112
|
bridge: `{
|
|
1107
1113
|
...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]
|
|
@@ -1113,6 +1119,7 @@ const template = {
|
|
|
1113
1119
|
},
|
|
1114
1120
|
{
|
|
1115
1121
|
id: 'close',
|
|
1122
|
+
where: where(),
|
|
1116
1123
|
isA: ['verb'],
|
|
1117
1124
|
bridge: `{
|
|
1118
1125
|
...next(operator), operator: operator, object: after[0], interpolate: [{ property: 'operator'}, { property: 'object' }]
|
|
@@ -1124,6 +1131,7 @@ const template = {
|
|
|
1124
1131
|
},
|
|
1125
1132
|
{
|
|
1126
1133
|
id: 'back',
|
|
1134
|
+
where: where(),
|
|
1127
1135
|
isA: ['noun'],
|
|
1128
1136
|
semantic: async ({objects, api, e, context, say}) => {
|
|
1129
1137
|
await api.back()
|
|
@@ -1135,6 +1143,7 @@ const template = {
|
|
|
1135
1143
|
},
|
|
1136
1144
|
{
|
|
1137
1145
|
id: "toPoint",
|
|
1146
|
+
where: where(),
|
|
1138
1147
|
isA: ['preposition'],
|
|
1139
1148
|
after: [['propertyOf', 1]],
|
|
1140
1149
|
bridge: "{ ...next(operator), operator: operator, point: after[0], interpolate: [{ property: 'operator' }, { property: 'point' }] }",
|
|
@@ -1147,6 +1156,7 @@ const template = {
|
|
|
1147
1156
|
},
|
|
1148
1157
|
{
|
|
1149
1158
|
id: "go",
|
|
1159
|
+
where: where(),
|
|
1150
1160
|
level: 0,
|
|
1151
1161
|
// convolution: true,
|
|
1152
1162
|
isA: ['verb', 'repeatable', 'doAction'],
|
|
@@ -1200,6 +1210,7 @@ const template = {
|
|
|
1200
1210
|
},
|
|
1201
1211
|
{
|
|
1202
1212
|
id: 'turn',
|
|
1213
|
+
where: where(),
|
|
1203
1214
|
isA: ['verb', 'action', 'repeatable'],
|
|
1204
1215
|
before: ['thenAction'],
|
|
1205
1216
|
words: ['turn'],
|
|
@@ -1258,6 +1269,7 @@ const template = {
|
|
|
1258
1269
|
},
|
|
1259
1270
|
{
|
|
1260
1271
|
id: 'pause',
|
|
1272
|
+
where: where(),
|
|
1261
1273
|
isA: ['verb'],
|
|
1262
1274
|
words: [
|
|
1263
1275
|
...conjugateVerb('pause'),
|
|
@@ -1302,6 +1314,7 @@ const template = {
|
|
|
1302
1314
|
},
|
|
1303
1315
|
{
|
|
1304
1316
|
id: 'stop',
|
|
1317
|
+
where: where(),
|
|
1305
1318
|
isA: ['verb'],
|
|
1306
1319
|
optional: {
|
|
1307
1320
|
1: "{ marker: 'drone' }",
|
|
@@ -1337,7 +1350,7 @@ const template = {
|
|
|
1337
1350
|
{
|
|
1338
1351
|
where: where(),
|
|
1339
1352
|
match: ({context, contextHierarchy}) => {
|
|
1340
|
-
if (!context.pullFromContext ||
|
|
1353
|
+
if (!context.pullFromContext || contextHierarchy.under(['doAction', 'evaluate', 'patrol']) || context.isInstance) {
|
|
1341
1354
|
return false
|
|
1342
1355
|
}
|
|
1343
1356
|
|
|
@@ -1364,7 +1377,7 @@ const template = {
|
|
|
1364
1377
|
{
|
|
1365
1378
|
where: where(),
|
|
1366
1379
|
match: ({context, contextHierarchy}) => {
|
|
1367
|
-
if (!context.pullFromContext || !
|
|
1380
|
+
if (!context.pullFromContext || !contextHierarchy.under('call') || context.notUnderCall) {
|
|
1368
1381
|
return false
|
|
1369
1382
|
}
|
|
1370
1383
|
|
|
@@ -1398,7 +1411,7 @@ const template = {
|
|
|
1398
1411
|
*/
|
|
1399
1412
|
{
|
|
1400
1413
|
where: where(),
|
|
1401
|
-
match: ({context}) =>
|
|
1414
|
+
match: ({context}) => ['start', 'end'].includes(context.marker) && context.objects && context.objects[1].marker == 'path',
|
|
1402
1415
|
apply: async ({gp, s, context, objects, fragments, resolveEvaluate, api, recall}) => {
|
|
1403
1416
|
const path = await recall({ context: context.objects[1] })
|
|
1404
1417
|
if (!path?.points) {
|
|
@@ -1413,7 +1426,6 @@ const template = {
|
|
|
1413
1426
|
},
|
|
1414
1427
|
{
|
|
1415
1428
|
match: ({context, contextHierarchy}) =>
|
|
1416
|
-
context.evaluate &&
|
|
1417
1429
|
['start', 'end', 'point'].includes(context.marker) &&
|
|
1418
1430
|
!context.propertyOf &&
|
|
1419
1431
|
contextHierarchy.under('go') &&
|
|
@@ -1438,11 +1450,11 @@ const template = {
|
|
|
1438
1450
|
where: where(),
|
|
1439
1451
|
match: ({context}) => {
|
|
1440
1452
|
// from stm lookup
|
|
1441
|
-
if (context.marker == 'mentions' && context.
|
|
1453
|
+
if (context.marker == 'mentions' && context.args.context.marker == 'speed') {
|
|
1442
1454
|
return true
|
|
1443
1455
|
}
|
|
1444
1456
|
// from property directly
|
|
1445
|
-
if (context.marker == 'speed'
|
|
1457
|
+
if (context.marker == 'speed') {
|
|
1446
1458
|
return true
|
|
1447
1459
|
}
|
|
1448
1460
|
},
|
|
@@ -1465,17 +1477,17 @@ const template = {
|
|
|
1465
1477
|
}
|
|
1466
1478
|
const speed = await fragments("number meters per second", { number: { marker: 'integer', value, word: undefined} })
|
|
1467
1479
|
const preferred = await s({ marker: 'preferredUnits', quantity: speed })
|
|
1468
|
-
resolveEvaluate(return_context, preferred.
|
|
1480
|
+
resolveEvaluate(return_context, preferred.evalue || speed)
|
|
1469
1481
|
}
|
|
1470
1482
|
},
|
|
1471
1483
|
{
|
|
1472
1484
|
where: where(),
|
|
1473
1485
|
// recallOverride(context(), frameOfReference())
|
|
1474
1486
|
match: ({context}) => {
|
|
1475
|
-
if (context.marker == 'mentions' &&
|
|
1487
|
+
if (context.marker == 'mentions' && ['direction', 'drone_direction'].includes(context.args.context.marker)) {
|
|
1476
1488
|
return true
|
|
1477
1489
|
}
|
|
1478
|
-
if (['direction', 'drone_direction'].includes(context.marker)
|
|
1490
|
+
if (['direction', 'drone_direction'].includes(context.marker)) {
|
|
1479
1491
|
return true
|
|
1480
1492
|
}
|
|
1481
1493
|
},
|
|
@@ -1491,7 +1503,7 @@ const template = {
|
|
|
1491
1503
|
}
|
|
1492
1504
|
])
|
|
1493
1505
|
const preferred = await s({ marker: 'preferredUnits', quantity: direction })
|
|
1494
|
-
resolveEvaluate(context, preferred.
|
|
1506
|
+
resolveEvaluate(context, preferred.evalue || direction)
|
|
1495
1507
|
}
|
|
1496
1508
|
},
|
|
1497
1509
|
{
|