ekms 8.0.0-beta.3 → 8.0.0-beta.30
Sign up to get free protection for your applications and to get access to all the features.
- package/common/animals.instance.json +2542 -1375
- package/common/animals.js +2 -2
- package/common/avatar.js +2 -2
- package/common/characters.js +9 -11
- package/common/colors.instance.json +6646 -3529
- package/common/colors.js +2 -2
- package/common/colors.test.json +345 -780
- package/common/comparable.js +2 -15
- package/common/concept.js +17 -11
- package/common/countable.js +5 -5
- package/common/crew.instance.json +12534 -6597
- package/common/crew.js +4 -4
- package/common/crew.test.json +714 -452
- package/common/currency.js +7 -7
- package/common/dialogues.js +53 -138
- package/common/dimension.instance.json +246 -265
- package/common/dimension.js +12 -12
- package/common/dimension.test.json +446 -1640
- package/common/edible.instance.json +19308 -10008
- package/common/edible.js +2 -2
- package/common/emotions.instance.json +122 -129
- package/common/emotions.js +4 -4
- package/common/events.js +6 -6
- package/common/fastfood.instance.json +219409 -111252
- package/common/fastfood.js +24 -24
- package/common/formulas.instance.json +222 -256
- package/common/formulas.js +14 -14
- package/common/gdefaults.js +13 -13
- package/common/help.js +4 -4
- package/common/help.test.json +10 -22
- package/common/helpers/concept.js +9 -6
- package/common/helpers/dialogues.js +2 -3
- package/common/helpers/properties.js +48 -58
- package/common/hierarchy.js +12 -16
- package/common/javascript.js +8 -8
- package/common/kirk.instance.json +564 -290
- package/common/kirk.js +2 -2
- package/common/length.instance.json +5153 -4677
- package/common/length.js +2 -2
- package/common/math.instance.json +152 -1169
- package/common/math.js +11 -11
- package/common/meta.js +22 -29
- package/common/negation.instance.json +2 -0
- package/common/negation.js +38 -0
- package/common/negation.test.json +308 -0
- package/common/numbers.js +3 -3
- package/common/ordering.instance.json +292 -230
- package/common/ordering.js +5 -5
- package/common/people.instance.json +1902 -1015
- package/common/people.js +4 -5
- package/common/percentages.instance.json +2 -0
- package/common/percentages.js +57 -0
- package/common/percentages.test.json +751 -0
- package/common/pipboy.instance.json +7720 -6386
- package/common/pipboy.js +29 -32
- package/common/pokemon.instance.json +3954 -2081
- package/common/pokemon.js +4 -4
- package/common/pos.js +1 -1
- package/common/pressure.instance.json +1265 -1193
- package/common/pressure.js +2 -2
- package/common/properties.instance.json +106 -61
- package/common/properties.js +54 -125
- package/common/punctuation.js +2 -2
- package/common/reports.instance.json +557 -559
- package/common/reports.js +54 -74
- package/common/scorekeeper.js +13 -21
- package/common/sdefaults.js +13 -3
- package/common/sizeable.js +2 -2
- package/common/spock.instance.json +564 -290
- package/common/spock.js +2 -2
- package/common/stgame.js +13 -9
- package/common/stm.js +4 -4
- package/common/tell.js +10 -10
- package/common/temperature.instance.json +1297 -1209
- package/common/temperature.js +2 -2
- package/common/tester.js +2 -2
- package/common/testing.js +5 -5
- package/common/time.js +7 -7
- package/common/tokenize.js +1 -1
- package/common/ui.instance.json +238 -259
- package/common/ui.js +9 -9
- package/common/weight.instance.json +4905 -4166
- package/common/weight.js +2 -2
- package/common/yesno.js +1 -1
- package/main.js +51 -46
- package/package.json +13 -6
package/common/currency.js
CHANGED
@@ -60,14 +60,14 @@ let configStruct = {
|
|
60
60
|
{
|
61
61
|
where: where(),
|
62
62
|
match: ({context}) => context.marker == 'currency' && !context.isAbstract,
|
63
|
-
apply: ({context, g}) => {
|
63
|
+
apply: async ({context, g}) => {
|
64
64
|
word = Object.assign({}, context.amount)
|
65
65
|
word.isAbstract = true
|
66
66
|
word.marker = 'currency'
|
67
67
|
word.units = context.units
|
68
68
|
word.value = context.amount.value
|
69
69
|
// generator = [({context}) => context.marker == 'currency' && context.units == words.units && context.value > 1 && context.isAbstract, ({context, g}) => words.many ]
|
70
|
-
return `${g(context.amount.value)} ${g(word)}`
|
70
|
+
return `${await g(context.amount.value)} ${await g(word)}`
|
71
71
|
}
|
72
72
|
},
|
73
73
|
],
|
@@ -90,12 +90,12 @@ let configStruct = {
|
|
90
90
|
],
|
91
91
|
};
|
92
92
|
|
93
|
-
const createConfig = () => {
|
93
|
+
const createConfig = async () => {
|
94
94
|
const config = new Config(configStruct, module)
|
95
95
|
config.stop_auto_rebuild()
|
96
|
-
config.add(numbersKM
|
97
|
-
config.api
|
98
|
-
config.initializer( ({config, objects, apis, addWord, addGenerator, baseConfig, uuid}) => {
|
96
|
+
await config.add(numbersKM)
|
97
|
+
await config.setApi(api)
|
98
|
+
await config.initializer( ({config, objects, apis, addWord, addGenerator, baseConfig, uuid}) => {
|
99
99
|
// const api = config.km('currency').api
|
100
100
|
// const api = kms.currency.api
|
101
101
|
const api = apis('currency')
|
@@ -128,7 +128,7 @@ const createConfig = () => {
|
|
128
128
|
})
|
129
129
|
}
|
130
130
|
})
|
131
|
-
config.restart_auto_rebuild()
|
131
|
+
await config.restart_auto_rebuild()
|
132
132
|
return config
|
133
133
|
}
|
134
134
|
|
package/common/dialogues.js
CHANGED
@@ -3,6 +3,7 @@ const meta = require('./meta.js')
|
|
3
3
|
const gdefaults = require('./gdefaults.js')
|
4
4
|
const sdefaults = require('./sdefaults.js')
|
5
5
|
const pos = require('./pos.js')
|
6
|
+
const negation = require('./negation.js')
|
6
7
|
const punctuation = require('./punctuation.js')
|
7
8
|
const stm = require('./stm.js')
|
8
9
|
const _ = require('lodash')
|
@@ -59,7 +60,6 @@ let configStruct = {
|
|
59
60
|
"(<the|> ([theAble|]))",
|
60
61
|
"(<a|a,an> ([theAble|]))",
|
61
62
|
// "([unknown])",
|
62
|
-
"([not] ([notAble|]))",
|
63
63
|
|
64
64
|
"([be] ([briefOrWordy|]))",
|
65
65
|
|
@@ -105,7 +105,7 @@ let configStruct = {
|
|
105
105
|
{
|
106
106
|
id: 'makeObject',
|
107
107
|
bridge: "{ ...next(operator), object: after[0] }",
|
108
|
-
generatorp: ({context, gp}) => `${context.word} ${gp(context.object)}`,
|
108
|
+
generatorp: async ({context, gp}) => `${context.word} ${await gp(context.object)}`,
|
109
109
|
semantic: ({config, context, api}) => {
|
110
110
|
api.makeObject({ context: context.object, config, types: [] })
|
111
111
|
}
|
@@ -113,7 +113,7 @@ let configStruct = {
|
|
113
113
|
{
|
114
114
|
id: 'setIdSuffix',
|
115
115
|
bridge: "{ ...next(operator), suffix: after[0] }",
|
116
|
-
generatorp: ({context, gp}) => `${context.word} ${gp(context.suffix)}`,
|
116
|
+
generatorp: async ({context, gp}) => `${context.word} ${await gp(context.suffix)}`,
|
117
117
|
semantic: ({context, api}) => {
|
118
118
|
api.setIdSuffix(context.suffix.text)
|
119
119
|
}
|
@@ -163,8 +163,8 @@ let configStruct = {
|
|
163
163
|
level: 0,
|
164
164
|
isA: ['preposition'],
|
165
165
|
bridge: "{ ...next(operator), toObject: after[0] }",
|
166
|
-
generatorp: ({context, gp}) => {
|
167
|
-
return `to ${gp(context.toObject)}`
|
166
|
+
generatorp: async ({context, gp}) => {
|
167
|
+
return `to ${await gp(context.toObject)}`
|
168
168
|
},
|
169
169
|
},
|
170
170
|
{ id: "toAble", level: 0, bridge: "{ ...next(operator) }" },
|
@@ -172,9 +172,6 @@ let configStruct = {
|
|
172
172
|
{ id: "be", level: 0, bridge: "{ ...next(operator), type: after[0] }" },
|
173
173
|
{ id: "briefOrWordy", level: 0, bridge: "{ ...next(operator) }" },
|
174
174
|
|
175
|
-
{ id: "notAble", level: 0, bridge: "{ ...next(operator) }" },
|
176
|
-
{ id: "not", level: 0, bridge: "{ ...after, negated: true }" },
|
177
|
-
|
178
175
|
{ id: "yesno", level: 0, bridge: "{ ...next(operator) }" },
|
179
176
|
{ id: "canBeQuestion", level: 0, bridge: "{ ...next(operator) }" },
|
180
177
|
{ id: "canBeQuestion", level: 1, bridge: "{ ...next(operator) }" },
|
@@ -337,7 +334,6 @@ let configStruct = {
|
|
337
334
|
// ['questionMark', 'isEd'],
|
338
335
|
['a', 'articlePOS'],
|
339
336
|
['the', 'articlePOS'],
|
340
|
-
['unknown', 'notAble'],
|
341
337
|
['unknown', 'theAble'],
|
342
338
|
['unknown', 'queryable'],
|
343
339
|
['it', 'queryable'],
|
@@ -354,10 +350,10 @@ let configStruct = {
|
|
354
350
|
where: where(),
|
355
351
|
notes: "handle making responses brief",
|
356
352
|
match: ({context, objects}) => (context.topLevel || context.isResponse) && objects.brief && !context.briefWasRun,
|
357
|
-
apply: ({context, g}) => {
|
353
|
+
apply: async ({context, g}) => {
|
358
354
|
const focussed = focus(context)
|
359
355
|
context.briefWasRun = true
|
360
|
-
return g(focussed)
|
356
|
+
return await g(focussed)
|
361
357
|
},
|
362
358
|
priority: -2,
|
363
359
|
},
|
@@ -418,8 +414,8 @@ let configStruct = {
|
|
418
414
|
// ({context, hierarchy}) => context.marker == 'list' && context.paraphrase && context.value,
|
419
415
|
// ({context, hierarchy}) => context.marker == 'list' && context.value,
|
420
416
|
match: ({context, hierarchy}) => context.marker == 'list' && context.paraphrase && context.value && context.value.length > 0 && context.value[0].marker == 'yesno',
|
421
|
-
apply: ({context, g, gs}) => {
|
422
|
-
return `${g(context.value[0])} ${gs(context.value.slice(1), ', ', ' and ')}`
|
417
|
+
apply: async ({context, g, gs}) => {
|
418
|
+
return `${await g(context.value[0])} ${await gs(context.value.slice(1), ', ', ' and ')}`
|
423
419
|
}
|
424
420
|
},
|
425
421
|
|
@@ -429,49 +425,24 @@ let configStruct = {
|
|
429
425
|
// ({context, hierarchy}) => context.marker == 'list' && context.paraphrase && context.value,
|
430
426
|
// ({context, hierarchy}) => context.marker == 'list' && context.value,
|
431
427
|
match: ({context, hierarchy}) => context.marker == 'list' && context.value,
|
432
|
-
apply: ({context, gs}) => {
|
428
|
+
apply: async ({context, gs}) => {
|
433
429
|
if (context.newLinesOnly) {
|
434
|
-
return gs(context.value, '\n')
|
430
|
+
return await gs(context.value, '\n')
|
435
431
|
} else {
|
436
|
-
return gs(context.value, ', ', ' and ')
|
432
|
+
return await gs(context.value, ', ', ' and ')
|
437
433
|
}
|
438
434
|
}
|
439
435
|
},
|
440
436
|
|
441
|
-
{
|
442
|
-
where: where(),
|
443
|
-
notes: 'paraphrase a negation',
|
444
|
-
match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'notAble') && context.negated, // && !context.isQuery && !context.paraphrase && context.value,
|
445
|
-
apply: ({context, g}) => {
|
446
|
-
context.negated = false
|
447
|
-
const result = g(context.value)
|
448
|
-
context.negated = true
|
449
|
-
return `not ${result}`
|
450
|
-
}
|
451
|
-
},
|
452
|
-
|
453
437
|
{
|
454
438
|
where: where(),
|
455
439
|
notes: 'paraphrase a queryable response',
|
456
440
|
// || context.evalue.paraphrase -> when the evalue acts as a paraphrase value
|
457
441
|
match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'queryable') && !context.isQuery && context.evalue && (!context.paraphrase || context.evalue.paraphrase),
|
458
|
-
apply: ({context, g}) => {
|
459
|
-
return g(context.evalue)
|
460
|
-
}
|
461
|
-
},
|
462
|
-
/* dup of one above
|
463
|
-
{
|
464
|
-
where: where(),
|
465
|
-
notes: 'paraphrase a queryable',
|
466
|
-
match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'queryable') && !context.isQuery && !context.paraphrase && context.evalue,
|
467
|
-
apply: ({context, g}) => {
|
468
|
-
const oldValue = context.evalue.paraphrase
|
469
|
-
const result = g(context.evalue)
|
470
|
-
context.evalue.paraphrase = oldValue
|
471
|
-
return result
|
442
|
+
apply: async ({context, g}) => {
|
443
|
+
return await g(context.evalue)
|
472
444
|
}
|
473
445
|
},
|
474
|
-
*/
|
475
446
|
{
|
476
447
|
where: where(),
|
477
448
|
match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'queryable') && !context.isQuery && context.isSelf && context.subject == 'my',
|
@@ -480,7 +451,7 @@ let configStruct = {
|
|
480
451
|
{
|
481
452
|
where: where(),
|
482
453
|
match: ({context, hierarchy}) => ['it', 'what'].includes(context.marker) && context.paraphrase,
|
483
|
-
apply: ({
|
454
|
+
apply: ({context}) => `${context.word}`
|
484
455
|
},
|
485
456
|
{
|
486
457
|
where: where(),
|
@@ -490,15 +461,8 @@ let configStruct = {
|
|
490
461
|
{
|
491
462
|
where: where(),
|
492
463
|
match: ({context, hierarchy}) => ['my', 'your'].includes(context.subject) && hierarchy.isA(context.marker, 'queryable') && context.paraphrase,
|
493
|
-
apply: ({
|
494
|
-
},
|
495
|
-
/*
|
496
|
-
{
|
497
|
-
where: where(),
|
498
|
-
match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'theAble') && context.paraphrase && context.wantsValue && !context.pullFromContext,
|
499
|
-
apply: ({g, context}) => `a ${context.word}`
|
464
|
+
apply: ({context}) => `${context.subject} ${context.marker}`
|
500
465
|
},
|
501
|
-
*/
|
502
466
|
{
|
503
467
|
where: where(),
|
504
468
|
match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'queryable') && !context.isQuery && context.subject,
|
@@ -523,8 +487,8 @@ let configStruct = {
|
|
523
487
|
{
|
524
488
|
where: where(),
|
525
489
|
match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'canBeQuestion') && context.paraphrase && context.topLevel && context.query,
|
526
|
-
apply: ({context, gp}) => {
|
527
|
-
return `${gp({...context, topLevel: undefined})}?`
|
490
|
+
apply: async ({context, gp}) => {
|
491
|
+
return `${await gp({...context, topLevel: undefined})}?`
|
528
492
|
},
|
529
493
|
priority: -1,
|
530
494
|
},
|
@@ -532,27 +496,27 @@ let configStruct = {
|
|
532
496
|
where: where(),
|
533
497
|
notes: "x is y",
|
534
498
|
match: ({context, hierarchy}) => { return hierarchy.isA(context.marker, 'is') && context.paraphrase },
|
535
|
-
apply: ({context, g, gp}) => {
|
536
|
-
return `${g({ ...context.one, paraphrase: true })} ${context.word} ${gp(context.two)}`
|
499
|
+
apply: async ({context, g, gp}) => {
|
500
|
+
return `${await g({ ...context.one, paraphrase: true })} ${context.word} ${await gp(context.two)}`
|
537
501
|
}
|
538
502
|
},
|
539
503
|
{
|
540
504
|
where: where(),
|
541
505
|
notes: 'is with a response defined',
|
542
506
|
match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'is') && context.evalue,
|
543
|
-
apply: ({context, g, gs}) => {
|
507
|
+
apply: async ({context, g, gs}) => {
|
544
508
|
const response = context.evalue;
|
545
509
|
const concept = response.concept;
|
546
510
|
if (concept) {
|
547
511
|
concept.paraphrase = true
|
548
512
|
concept.isSelf = true
|
549
|
-
const instance = g(response.instance)
|
550
|
-
return `${g(concept)} ${context.word} ${instance}`
|
513
|
+
const instance = await g(response.instance)
|
514
|
+
return `${await g(concept)} ${context.word} ${instance}`
|
551
515
|
} else {
|
552
516
|
if (Array.isArray(response)) {
|
553
|
-
return `${gs(response)}`
|
517
|
+
return `${await gs(response)}`
|
554
518
|
} else {
|
555
|
-
return `${g(response)}`
|
519
|
+
return `${await g(response)}`
|
556
520
|
}
|
557
521
|
}
|
558
522
|
}
|
@@ -561,13 +525,13 @@ let configStruct = {
|
|
561
525
|
where: where(),
|
562
526
|
notes: 'x is y (not a response)',
|
563
527
|
match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'is') && !context.evalue,
|
564
|
-
apply: ({context, g, gp, gr, callId}) => {
|
528
|
+
apply: async ({context, g, gp, gr, callId}) => {
|
565
529
|
if ((context.two.evalue || {}).marker == 'answerNotKnown') {
|
566
|
-
return g(context.two.evalue)
|
530
|
+
return await g(context.two.evalue)
|
567
531
|
}
|
568
532
|
|
569
533
|
if (!context.isResponse) {
|
570
|
-
return `${gp(context.one)} ${isMany(context.one) || isMany(context.two) || isMany(context) ? "are" : "is"} ${g(context.two)}`
|
534
|
+
return `${await gp(context.one)} ${isMany(context.one) || isMany(context.two) || isMany(context) ? "are" : "is"} ${await g(context.two)}`
|
571
535
|
}
|
572
536
|
|
573
537
|
const hasFocus = (property) => {
|
@@ -592,17 +556,15 @@ let configStruct = {
|
|
592
556
|
}
|
593
557
|
// greg101
|
594
558
|
if (focus == 'one') {
|
595
|
-
return `${g(context.two)} ${isMany(context.one) || isMany(context.two) || isMany(context) ? "are" : "is"} ${gp(context.one)}`
|
559
|
+
return `${await g(context.two)} ${isMany(context.one) || isMany(context.two) || isMany(context) ? "are" : "is"} ${await gp(context.one)}`
|
596
560
|
} else {
|
597
561
|
// TODO fix this using the assumed and that whole mess. change isResponse to useValue
|
598
562
|
if (context.isResponse) {
|
599
|
-
return `${gp(context.one, { responding: true })} ${isMany(context.one) || isMany(context.two) || isMany(context) ? "are" : "is"} ${g(context.two)}`
|
563
|
+
return `${await gp(context.one, { responding: true })} ${isMany(context.one) || isMany(context.two) || isMany(context) ? "are" : "is"} ${await g(context.two)}`
|
600
564
|
} else {
|
601
|
-
return `${gp(context.one)} ${isMany(context.one) || isMany(context.two) || isMany(context) ? "are" : "is"} ${gr(context.two)}`
|
565
|
+
return `${await gp(context.one)} ${isMany(context.one) || isMany(context.two) || isMany(context) ? "are" : "is"} ${await gr(context.two)}`
|
602
566
|
}
|
603
|
-
// return `${gp(context.one)} ${isMany(context.one) || isMany(context.two) || isMany(context) ? "are" : "is"} ${g(context.two)}`
|
604
567
|
}
|
605
|
-
// return `${g({...context.one})} ${isMany(context.one) || isMany(context.two) || isMany(context) ? "are" : "is"} ${g(context.two)}`
|
606
568
|
},
|
607
569
|
},
|
608
570
|
],
|
@@ -628,10 +590,10 @@ let configStruct = {
|
|
628
590
|
{
|
629
591
|
where: where(),
|
630
592
|
match: ({context}) => context.marker === 'error',
|
631
|
-
apply: ({context, gp}) => {
|
593
|
+
apply: async ({context, gp}) => {
|
632
594
|
context.evalue = "That is not known"
|
633
595
|
if (context.reason) {
|
634
|
-
context.evalue += ` because ${gp(context.reason)}`
|
596
|
+
context.evalue += ` because ${await gp(context.reason)}`
|
635
597
|
}
|
636
598
|
context.isResponse = true
|
637
599
|
}
|
@@ -641,7 +603,7 @@ let configStruct = {
|
|
641
603
|
notes: 'pull from context',
|
642
604
|
// match: ({context}) => context.marker == 'it' && context.pullFromContext, // && context.value,
|
643
605
|
match: ({context, callId}) => context.pullFromContext && !context.same, // && context.value,
|
644
|
-
apply: ({callId, context,
|
606
|
+
apply: async ({callId, context, kms, e, log, retry}) => {
|
645
607
|
if (true) {
|
646
608
|
/*
|
647
609
|
{
|
@@ -675,7 +637,7 @@ let configStruct = {
|
|
675
637
|
return
|
676
638
|
}
|
677
639
|
|
678
|
-
const instance = e(context.value)
|
640
|
+
const instance = await e(context.value)
|
679
641
|
if (instance.evalue && !instance.edefault) {
|
680
642
|
context.value = instance.evalue
|
681
643
|
}
|
@@ -717,7 +679,7 @@ let configStruct = {
|
|
717
679
|
// avoid loops
|
718
680
|
if (context.marker != 'unknown') {
|
719
681
|
if (context.value.marker != context.marker) {
|
720
|
-
const instance = e(context.value)
|
682
|
+
const instance = await e(context.value)
|
721
683
|
if (instance.evalue && !instance.edefault) {
|
722
684
|
context.value = instance.evalue
|
723
685
|
}
|
@@ -739,7 +701,7 @@ let configStruct = {
|
|
739
701
|
*/
|
740
702
|
|
741
703
|
match: ({context, hierarchy}) => hierarchy.isA(context.marker, 'is') && context.query,
|
742
|
-
apply: ({context, s, log, km, objects, e}) => {
|
704
|
+
apply: async ({context, s, log, km, objects, e}) => {
|
743
705
|
const one = context.one;
|
744
706
|
const two = context.two;
|
745
707
|
let concept, value;
|
@@ -753,7 +715,7 @@ let configStruct = {
|
|
753
715
|
// km('dialogues').api.mentioned(concept)
|
754
716
|
// TODO wtf is the next line?
|
755
717
|
value = JSON.parse(JSON.stringify(value))
|
756
|
-
let instance = e(value)
|
718
|
+
let instance = await e(value)
|
757
719
|
if (false && instance.evalue) {
|
758
720
|
km('stm').api.mentioned(value)
|
759
721
|
}
|
@@ -817,14 +779,14 @@ let configStruct = {
|
|
817
779
|
where: where(),
|
818
780
|
notes: 'x is y. handles x is a kind of y or x = y in the stm',
|
819
781
|
match: ({context}) => context.marker == 'is' && !context.query && context.one && context.two,
|
820
|
-
apply: ({context, s, log, api, kms, config}) => {
|
782
|
+
apply: async ({context, s, log, api, kms, config}) => {
|
821
783
|
// const oneZero = { ...context.one }
|
822
784
|
// const twoZero = { ...context.two }
|
823
785
|
|
824
786
|
const one = context.one;
|
825
787
|
const two = context.two;
|
826
788
|
one.same = two;
|
827
|
-
const onePrime = s(one)
|
789
|
+
const onePrime = await s(one)
|
828
790
|
if (!onePrime.sameWasProcessed) {
|
829
791
|
warningSameNotEvaluated(log, one)
|
830
792
|
} else {
|
@@ -837,7 +799,7 @@ let configStruct = {
|
|
837
799
|
let twoPrime;
|
838
800
|
if (!onePrime.sameWasProcessed) {
|
839
801
|
two.same = one
|
840
|
-
twoPrime = s(two)
|
802
|
+
twoPrime = await s(two)
|
841
803
|
if (!twoPrime.sameWasProcessed) {
|
842
804
|
warningSameNotEvaluated(log, two)
|
843
805
|
} else {
|
@@ -856,20 +818,6 @@ let configStruct = {
|
|
856
818
|
}
|
857
819
|
}
|
858
820
|
},
|
859
|
-
/*
|
860
|
-
{
|
861
|
-
where: where(),
|
862
|
-
notes: 'x = y in the stm',
|
863
|
-
match: ({context}) => context.marker == 'is' && !context.query && context.one && context.two,
|
864
|
-
apply: ({context, s, log, api, kms, config}) => {
|
865
|
-
const one = context.one;
|
866
|
-
const two = context.two;
|
867
|
-
api.makeObject({ context: one, config, types: context.two.types || [] })
|
868
|
-
kms.stm.api.setVariable(one.value, two)
|
869
|
-
kms.stm.api.mentioned(one, two)
|
870
|
-
}
|
871
|
-
},
|
872
|
-
*/
|
873
821
|
{
|
874
822
|
where: where(),
|
875
823
|
notes: 'get variable from stm',
|
@@ -877,48 +825,15 @@ let configStruct = {
|
|
877
825
|
match: ({context, kms}) => context.evaluate && kms.stm.api.getVariable(context.value) != context.value,
|
878
826
|
// match: ({context, kms}) => context.evaluate,
|
879
827
|
priority: -1,
|
880
|
-
apply: ({context, kms, e}) => {
|
828
|
+
apply: async ({context, kms, e}) => {
|
881
829
|
const api = kms.stm.api
|
882
830
|
context.value = api.getVariable(context.value)
|
883
|
-
/*
|
884
|
-
if (!context.value && context.marker !== 'unknown') {
|
885
|
-
context.value = api.getVariable(context.marker)
|
886
|
-
}
|
887
|
-
*/
|
888
831
|
if (context.value && context.value.marker) {
|
889
|
-
context.evalue = e(context.value)
|
832
|
+
context.evalue = await e(context.value)
|
890
833
|
}
|
891
834
|
context.focusableForPhrase = true
|
892
835
|
}
|
893
836
|
},
|
894
|
-
/*
|
895
|
-
{
|
896
|
-
where: where(),
|
897
|
-
notes: 'default handle evaluate',
|
898
|
-
match: ({context, kms}) => context.evaluate && context.value,
|
899
|
-
// match: ({context, kms}) => context.evaluate,
|
900
|
-
// priority: -1,
|
901
|
-
apply: ({context, kms, e}) => {
|
902
|
-
if (context.value && context.value.marker) {
|
903
|
-
context.evalue = e(context.value)
|
904
|
-
}
|
905
|
-
}
|
906
|
-
},
|
907
|
-
*/
|
908
|
-
/*
|
909
|
-
{
|
910
|
-
priority: 2,
|
911
|
-
notes: 'evaluate top level not already done',
|
912
|
-
match: ({context}) => false && context.topLevel && !context.evalue,
|
913
|
-
apply: ({context, e}) => {
|
914
|
-
const instance = e({ ...context, value: undefined, topLevel: undefined })
|
915
|
-
if (instance.evalue && !instance.edefault) {
|
916
|
-
context.evalue = instance
|
917
|
-
context.isResponse = true
|
918
|
-
}
|
919
|
-
}
|
920
|
-
},
|
921
|
-
*/
|
922
837
|
],
|
923
838
|
};
|
924
839
|
|
@@ -963,9 +878,9 @@ const getAsk = (config) => (uuid) => {
|
|
963
878
|
where: semantic.where || ask.where || where(2),
|
964
879
|
source: 'response',
|
965
880
|
match: (args) => semantic.match(args),
|
966
|
-
apply: (args) => {
|
881
|
+
apply: async (args) => {
|
967
882
|
setWasApplied(true)
|
968
|
-
semantic.apply(args)
|
883
|
+
await semantic.apply(args)
|
969
884
|
},
|
970
885
|
})
|
971
886
|
}
|
@@ -982,7 +897,7 @@ const getAsk = (config) => (uuid) => {
|
|
982
897
|
onNevermind: ask.onNevermind,
|
983
898
|
source: 'question',
|
984
899
|
match: ({ context }) => context.marker == 'controlEnd' || context.marker == 'controlBetween',
|
985
|
-
apply: (args) => {
|
900
|
+
apply: async (args) => {
|
986
901
|
let matchq = ask.matchq
|
987
902
|
let applyq = ask.applyq
|
988
903
|
if (!matchq) {
|
@@ -993,11 +908,11 @@ const getAsk = (config) => (uuid) => {
|
|
993
908
|
return ask.applyq(args)
|
994
909
|
}
|
995
910
|
}
|
996
|
-
if (matchq(args)) {
|
911
|
+
if (await matchq(args)) {
|
997
912
|
setWasAsked(true)
|
998
913
|
setWasApplied(false)
|
999
914
|
// args.context.motivationKeep = true
|
1000
|
-
args.verbatim(applyq(args))
|
915
|
+
args.verbatim(await applyq(args))
|
1001
916
|
/*
|
1002
917
|
args.context.verbatim = applyq(args)
|
1003
918
|
args.context.isResponse = true;
|
@@ -1018,12 +933,12 @@ const getAsk = (config) => (uuid) => {
|
|
1018
933
|
}
|
1019
934
|
|
1020
935
|
|
1021
|
-
const createConfig = () => {
|
936
|
+
const createConfig = async () => {
|
1022
937
|
const config = new Config(configStruct, module)
|
1023
938
|
config.stop_auto_rebuild()
|
1024
|
-
config.api
|
1025
|
-
config.add(gdefaults
|
1026
|
-
config.initializer( ({objects, config, isModule}) => {
|
939
|
+
await config.setApi(api)
|
940
|
+
await config.add(gdefaults, sdefaults, pos, negation, stm, meta, punctuation)
|
941
|
+
await config.initializer( ({objects, config, isModule}) => {
|
1027
942
|
/* TODO add this beck in. some stuff from config needs to be here
|
1028
943
|
config.addArgs((args) => ({
|
1029
944
|
e: (context) => config.api.getEvaluator(args.s, args.log, context),
|
@@ -1063,7 +978,7 @@ const createConfig = () => {
|
|
1063
978
|
config.addWord("doesable", { id: "doesAble", "initial": "{}" })
|
1064
979
|
}
|
1065
980
|
})
|
1066
|
-
config.restart_auto_rebuild()
|
981
|
+
await config.restart_auto_rebuild()
|
1067
982
|
return config
|
1068
983
|
}
|
1069
984
|
|