ekms 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
package/common/fastfood.js
CHANGED
package/common/nameable.js
CHANGED
|
@@ -19,12 +19,12 @@ class API {
|
|
|
19
19
|
context.namespaced.nameable ??= {}
|
|
20
20
|
context.namespaced.nameable.names ??= []
|
|
21
21
|
context.namespaced.nameable.names.push(name)
|
|
22
|
-
this.args.config.addWord(name, { id: context.marker, initial: `{ value: "${name}", pullFromContext: true, nameable_named: true }` })
|
|
22
|
+
this.args.config.addWord(name, { id: context.marker, initial: `{ value: "${name}", pullFromContext: true, nameable_named: true, instance: ${context.instance ? 'true' : 'false'} }` })
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
// used by mongo km
|
|
26
26
|
get(type, name) {
|
|
27
|
-
return this.args.kms.stm.api.
|
|
27
|
+
return this.args.kms.stm.api.recall({
|
|
28
28
|
context: type,
|
|
29
29
|
condition: (context) => {
|
|
30
30
|
if (context.namespaced?.nameable && context.namespaced.nameable.names) {
|
|
@@ -54,16 +54,16 @@ class API {
|
|
|
54
54
|
setCurrent(name) {
|
|
55
55
|
const context = this.objects.named[name]
|
|
56
56
|
if (context) {
|
|
57
|
-
this.args.km('stm').api.
|
|
57
|
+
this.args.km('stm').api.remember({ context })
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
function initializer({config}) {
|
|
63
|
-
config.addArgs(({kms,
|
|
63
|
+
config.addArgs(({kms, remember}) => {
|
|
64
64
|
return {
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
remember: (args) => {
|
|
66
|
+
remember(args)
|
|
67
67
|
if (args.name) {
|
|
68
68
|
kms.nameable.api.setName(args.context, args.name)
|
|
69
69
|
}
|
package/common/ordinals.js
CHANGED
|
@@ -34,11 +34,45 @@ const config = {
|
|
|
34
34
|
semantics: [
|
|
35
35
|
{
|
|
36
36
|
where: where(),
|
|
37
|
-
match: ({context}) => context.marker == 'mentions' && context.evaluate,
|
|
38
|
-
apply: async ({callId, _continue, toList, context, kms, e, log, retry}) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
match: ({context}) => context.marker == 'mentions' && context.evaluate && context.args?.context?.ordinal,
|
|
38
|
+
apply: async ({callId, _continue, toList, context, kms, e, log, toArray, retry}) => {
|
|
39
|
+
// const ordinals = toArray(context.args?.context?.ordinal)
|
|
40
|
+
const lastNotFirst = context.args?.context?.ordinal.value < 0
|
|
41
|
+
const quantity = context.args.context.quantity?.value || 1
|
|
42
|
+
context.args.filter ??= (r) => r
|
|
43
|
+
context.args.all = true
|
|
44
|
+
const oldFilter = context.args.filter
|
|
45
|
+
context.args.filter = (result) => {
|
|
46
|
+
const reversed = context.args.frameOfReference?.namespaced?.stm?.reversed
|
|
47
|
+
let selected = []
|
|
48
|
+
for (const ordinal of toArray(context.args?.context?.ordinal)) {
|
|
49
|
+
if (context.args.context.quantity) {
|
|
50
|
+
if (lastNotFirst) {
|
|
51
|
+
if (reversed) {
|
|
52
|
+
selected = selected.concat(result.slice(-quantity))
|
|
53
|
+
} else {
|
|
54
|
+
selected = selected.concat(result.slice(0, quantity).reverse())
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
if (!reversed) {
|
|
58
|
+
selected = selected.concat(result.slice(-quantity).reverse())
|
|
59
|
+
} else {
|
|
60
|
+
selected = selected.concat(result.slice(0, quantity))
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
let point
|
|
65
|
+
if (ordinal.value > 0) {
|
|
66
|
+
point = result[ordinal.value-1]
|
|
67
|
+
} else {
|
|
68
|
+
point = result[result.length + ordinal.value]
|
|
69
|
+
}
|
|
70
|
+
if (point) {
|
|
71
|
+
selected.push(point)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return oldFilter(selected)
|
|
42
76
|
}
|
|
43
77
|
_continue()
|
|
44
78
|
}
|
|
@@ -53,6 +87,18 @@ const config = {
|
|
|
53
87
|
"2nd": [{"id": "ordinal", "initial": "{ value: 2, ordinal: true, instance: true }" }],
|
|
54
88
|
"third": [{"id": "ordinal", "initial": "{ value: 3, ordinal: true, instance: true }" }],
|
|
55
89
|
"3rd": [{"id": "ordinal", "initial": "{ value: 3, ordinal: true, instance: true }" }],
|
|
90
|
+
"fourth": [{"id": "ordinal", "initial": "{ value: 4, ordinal: true, instance: true }" }],
|
|
91
|
+
"4rd": [{"id": "ordinal", "initial": "{ value: 4, ordinal: true, instance: true }" }],
|
|
92
|
+
"fifth": [{"id": "ordinal", "initial": "{ value: 5, ordinal: true, instance: true }" }],
|
|
93
|
+
"5th": [{"id": "ordinal", "initial": "{ value: 5, ordinal: true, instance: true }" }],
|
|
94
|
+
"sixth": [{"id": "ordinal", "initial": "{ value: 6, ordinal: true, instance: true }" }],
|
|
95
|
+
"6th": [{"id": "ordinal", "initial": "{ value: 6, ordinal: true, instance: true }" }],
|
|
96
|
+
"seventh": [{"id": "ordinal", "initial": "{ value: 7, ordinal: true, instance: true }" }],
|
|
97
|
+
"7th": [{"id": "ordinal", "initial": "{ value: 7, ordinal: true, instance: true }" }],
|
|
98
|
+
"eigth": [{"id": "ordinal", "initial": "{ value: 8, ordinal: true, instance: true }" }],
|
|
99
|
+
"8th": [{"id": "ordinal", "initial": "{ value: 8, ordinal: true, instance: true }" }],
|
|
100
|
+
"ninth": [{"id": "ordinal", "initial": "{ value: 9, ordinal: true, instance: true }" }],
|
|
101
|
+
"9th": [{"id": "ordinal", "initial": "{ value: 9, ordinal: true, instance: true }" }],
|
|
56
102
|
},
|
|
57
103
|
patterns: [
|
|
58
104
|
{ "pattern": [{ type: 'digit' }, { repeat: true }, 'th'], defs: [{id: "ordinal", uuid: '1', initial: "{ value: int(substr(text, -2)), ordinal: true, instance: true }" }]},
|
package/common/pipboy.js
CHANGED
|
@@ -417,7 +417,7 @@ const config = {
|
|
|
417
417
|
generatorp: ({context, g}) => `${context.marker} ${g(context.type)}`,
|
|
418
418
|
isA: ['verby'],
|
|
419
419
|
semantic: ({context, kms}) => {
|
|
420
|
-
kms.dialogues.api.
|
|
420
|
+
kms.dialogues.api.remember({
|
|
421
421
|
marker: context.type.marker,
|
|
422
422
|
value: context.type.marker
|
|
423
423
|
})
|
package/common/properties.js
CHANGED
|
@@ -485,6 +485,7 @@ const config = {
|
|
|
485
485
|
!(context.types || []).includes('property') &&
|
|
486
486
|
// !context.value && // greghere
|
|
487
487
|
!context.ordinal &&
|
|
488
|
+
(!context.objects || context.objects.length !== 2 || !context.objects[1].instance) &&
|
|
488
489
|
(api.objects && api.objects.children && api.objects.children[context.marker]) &&
|
|
489
490
|
!context.evaluate.toConcept,
|
|
490
491
|
apply: ({context, objects, api, km}) => {
|
|
@@ -625,7 +626,7 @@ const config = {
|
|
|
625
626
|
!context.evaluate.toConcept, // && !context.value,
|
|
626
627
|
// greghere
|
|
627
628
|
// match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'property') && context.evaluate,
|
|
628
|
-
apply: async ({callId, context, api, kms, objects, g, s, log,
|
|
629
|
+
apply: async ({callId, context, api, kms, objects, g, s, log, recall}) => {
|
|
629
630
|
const toDo = [ ...context.objects ]
|
|
630
631
|
|
|
631
632
|
async function toValue(objectContext) {
|
|
@@ -666,7 +667,7 @@ const config = {
|
|
|
666
667
|
|
|
667
668
|
let fromMentions
|
|
668
669
|
if (!await api.knownProperty(currentContext, nextContext)) {
|
|
669
|
-
fromMentions = await
|
|
670
|
+
fromMentions = await recall({ context: nextContext, all: nextContext.number == 'many', frameOfReference: currentContext })
|
|
670
671
|
if (!fromMentions) {
|
|
671
672
|
context.verbatim = `There is no property ${await g({...nextContext, paraphrase: true})} of ${await g({...currentContext, paraphrase: true})}`
|
|
672
673
|
return
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"semantics": [
|
|
21
21
|
{
|
|
22
22
|
"match": "({context}) => context.marker == 'convertToUnits' && context.evaluate && (context.from?.unit?.marker == 'unitPerUnit' || context.to.marker == 'unitPerUnit')",
|
|
23
|
-
"apply": "async ({
|
|
23
|
+
"apply": "async ({remember, context, kms, e, callId, resolveEvaluate, toEValue, error}) => {\n\n async function convert(fromUnits, fromAmount, toUnits) {\n let evalue;\n if (toUnits.value == fromUnits.value) {\n evalue = fromAmount\n // if (!fromAmount.value) {\n // debugger\n //}\n evalue.evalue = fromAmount.evalue || fromAmount.value\n } else {\n const formula = kms.formulas.api.get(toUnits, [fromUnits])\n if (!formula) {\n const reason = { marker: 'reason', focusableForPhrase: true, evalue: { marker: 'noconversion', from: fromUnits, to: toUnits } }\n kms.stm.api.remember({ context: reason })\n error(reason)\n }\n kms.stm.api.setVariable(fromUnits.value, fromAmount)\n evalue = await e(formula)\n }\n return evalue\n }\n\n if (!context.from.unit) {\n resolveEvaluate(context.from, await e(context.from))\n }\n\n\n const from = toEValue(context.from)\n remember(context.to)\n const evalueNumerator = await convert(from.unit.numerator, from.amount, context.to.numerator)\n const evalueDenominator = await convert(from.unit.denominator, 1, context.to.denominator)\n const evalue = { evalue: (toFinalValue(evalueNumerator) || evalueNumerator.value) / (toFinalValue(evalueDenominator) || evalueDenominator.evalue) }\n context.evalue = {\n paraphrase: true,\n marker: 'quantity',\n level: 1,\n unit: context.to,\n amount: { evalue, paraphrase: undefined }\n }\n }"
|
|
24
24
|
}
|
|
25
25
|
]
|
|
26
26
|
}
|
package/common/rates.js
CHANGED
|
@@ -37,7 +37,7 @@ const template = {
|
|
|
37
37
|
{
|
|
38
38
|
where: where(),
|
|
39
39
|
match: ({context}) => context.marker == 'convertToUnits' && context.evaluate && (context.from?.unit?.marker == 'unitPerUnit' || context.to.marker == 'unitPerUnit'),
|
|
40
|
-
apply: async ({
|
|
40
|
+
apply: async ({remember, context, kms, e, callId, resolveEvaluate, toEValue, error}) => {
|
|
41
41
|
|
|
42
42
|
async function convert(fromUnits, fromAmount, toUnits) {
|
|
43
43
|
let evalue;
|
|
@@ -51,7 +51,7 @@ const template = {
|
|
|
51
51
|
const formula = kms.formulas.api.get(toUnits, [fromUnits])
|
|
52
52
|
if (!formula) {
|
|
53
53
|
const reason = { marker: 'reason', focusableForPhrase: true, evalue: { marker: 'noconversion', from: fromUnits, to: toUnits } }
|
|
54
|
-
kms.stm.api.
|
|
54
|
+
kms.stm.api.remember({ context: reason })
|
|
55
55
|
error(reason)
|
|
56
56
|
}
|
|
57
57
|
kms.stm.api.setVariable(fromUnits.value, fromAmount)
|
|
@@ -66,7 +66,7 @@ const template = {
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
const from = toEValue(context.from)
|
|
69
|
-
|
|
69
|
+
remember(context.to)
|
|
70
70
|
const evalueNumerator = await convert(from.unit.numerator, from.amount, context.to.numerator)
|
|
71
71
|
const evalueDenominator = await convert(from.unit.denominator, 1, context.to.denominator)
|
|
72
72
|
const evalue = { evalue: (toFinalValue(evalueNumerator) || evalueNumerator.value) / (toFinalValue(evalueDenominator) || evalueDenominator.evalue) }
|
package/common/reminders.js
CHANGED