ekms 7.12.8 → 8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/common/animals.instance.json +89 -293
- package/common/animals.js +1 -1
- package/common/avatar.js +7 -5
- package/common/characters.js +12 -5
- package/common/crew.instance.json +289 -577
- package/common/crew.js +1 -1
- package/common/currency.js +0 -2
- package/common/dialogues.js +122 -17
- package/common/dimension.instance.json +747 -73
- package/common/dimension.js +15 -7
- package/common/edible.instance.json +243 -435
- package/common/edible.js +1 -1
- package/common/emotions.instance.json +29 -65
- package/common/emotions.js +1 -1
- package/common/fastfood.instance.json +1080 -2072
- package/common/fastfood.js +1 -1
- package/common/formulas.instance.json +992 -0
- package/common/formulas.js +19 -6
- package/common/formulas.test.json +1187 -3651
- package/common/gdefaults.js +2 -0
- package/common/help.js +7 -2
- package/common/help.test.json +9 -5
- package/common/helpers.js +5 -0
- package/common/javascript.js +8 -6
- package/common/kirk.instance.json +1 -1
- package/common/kirk.js +1 -1
- package/common/length.instance.json +316 -740
- package/common/length.js +1 -1
- package/common/math.instance.json +1959 -1
- package/common/math.js +17 -5
- package/common/meta.instance.json +1 -1
- package/common/meta.js +35 -10
- package/common/numbers.js +28 -24
- package/common/ordering.instance.json +37 -153
- package/common/ordering.js +1 -1
- package/common/people.instance.json +50 -78
- package/common/people.js +1 -1
- package/common/pipboy.instance.json +23431 -1082
- package/common/pipboy.js +31 -4
- package/common/pipboy.test.json +13 -9
- package/common/pokemon.instance.json +41 -141
- package/common/pokemon.js +1 -1
- package/common/pressure.instance.json +93 -33
- package/common/pressure.js +1 -1
- package/common/properties.instance.json +21 -49
- package/common/properties.js +13 -8
- package/common/reports.instance.json +23 -63
- package/common/reports.js +9 -7
- package/common/scorekeeper.instance.json +1 -1
- package/common/scorekeeper.js +9 -7
- package/common/spock.instance.json +1 -1
- package/common/spock.js +1 -1
- package/common/tell.js +4 -2
- package/common/temperature.instance.json +97 -193
- package/common/temperature.js +1 -1
- package/common/time.js +36 -20
- package/common/time.test.json +66 -44
- package/common/tokenize.js +46 -0
- package/common/ui.instance.json +9 -1
- package/common/weight.instance.json +273 -217
- package/common/weight.js +1 -1
- package/main.js +2 -8
- package/package.json +6 -18
- package/common/dimensionTemplate.instance.json +0 -582
- package/common/dimensionTemplate.js +0 -35
- package/common/formulasTemplate.instance.json +0 -483
- package/common/formulasTemplate.js +0 -30
- package/common/formulasTemplate.test.json +0 -2
- package/common/mathTemplate.instance.json +0 -1635
- package/common/mathTemplate.js +0 -32
- package/common/mathTemplate.test.json +0 -1422
- package/common/pipboyTemplate.instance.json +0 -17420
- package/common/pipboyTemplate.js +0 -48
- package/common/pipboyTemplate.test.json +0 -2
- /package/common/{dimensionTemplate.test.json → tokenize.test.json} +0 -0
package/common/crew.js
CHANGED
package/common/currency.js
CHANGED
package/common/dialogues.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
const { Config, knowledgeModule, where } = require('./runtime').theprogrammablemind
|
1
|
+
const { Config, knowledgeModule, where, stableId } = require('./runtime').theprogrammablemind
|
2
2
|
const meta = require('./meta.js')
|
3
3
|
const gdefaults = require('./gdefaults.js')
|
4
4
|
const sdefaults = require('./sdefaults.js')
|
@@ -54,7 +54,7 @@ let configStruct = {
|
|
54
54
|
"([what:optional])",
|
55
55
|
"(<the|> ([theAble|]))",
|
56
56
|
"(<a|a,an> ([theAble|]))",
|
57
|
-
"([unknown])",
|
57
|
+
// "([unknown])",
|
58
58
|
"([not] ([notAble|]))",
|
59
59
|
|
60
60
|
"([be] ([briefOrWordy|]))",
|
@@ -150,8 +150,8 @@ let configStruct = {
|
|
150
150
|
{ id: "yesno", level: 0, bridge: "{ ...next(operator) }" },
|
151
151
|
{ id: "canBeQuestion", level: 0, bridge: "{ ...next(operator) }" },
|
152
152
|
{ id: "canBeQuestion", level: 1, bridge: "{ ...next(operator) }" },
|
153
|
-
{ id: "unknown", level: 0, bridge: "{ ...next(operator), unknown: true, dead: true }" },
|
154
|
-
{ id: "unknown", level: 1, bridge: "{ ...next(operator) }" },
|
153
|
+
// { id: "unknown", level: 0, bridge: "{ ...next(operator), unknown: true, dead: true }" },
|
154
|
+
// { id: "unknown", level: 1, bridge: "{ ...next(operator) }" },
|
155
155
|
{ id: "queryable", level: 0, bridge: "{ ...next(operator) }" },
|
156
156
|
{ id: "questionMark", level: 0, bridge: "{ ...before[0], query: [before.marker] }" },
|
157
157
|
// { id: "isEd", level: 0, bridge: "{ ...context, query: true }" },
|
@@ -275,17 +275,19 @@ let configStruct = {
|
|
275
275
|
},
|
276
276
|
],
|
277
277
|
words: {
|
278
|
-
"
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
278
|
+
"literals": {
|
279
|
+
"?": [{"id": "questionMark", "initial": "{}" }],
|
280
|
+
"the": [{"id": "the", "initial": "{ modifiers: [] }" }],
|
281
|
+
"who": [{"id": "what", "initial": "{ modifiers: [], query: true }" }],
|
282
|
+
"yes": [{"id": "yesno", "initial": "{ value: true }" }],
|
283
|
+
"no": [{"id": "yesno", "initial": "{ value: false }" }],
|
284
|
+
"brief": [{"id": "briefOrWordy", "initial": "{ value: 'brief' }" }],
|
285
|
+
"wordy": [{"id": "briefOrWordy", "initial": "{ value: 'wordy' }" }],
|
286
|
+
"does": [{"id": "does", "initial": "{ number: 'one' }" }],
|
287
|
+
"do": [{"id": "does", "initial": "{ number: 'many' }" }],
|
288
|
+
"is": [{"id": "is", "initial": "{ number: 'one' }" }, {"id": "isEd", "initial": "{ number: 'one' }" }],
|
289
|
+
"are": [{"id": "is", "initial": "{ number: 'many' }" }, {"id": "isEd", "initial": "{ number: 'many' }" }],
|
290
|
+
}
|
289
291
|
},
|
290
292
|
|
291
293
|
floaters: ['query'],
|
@@ -893,6 +895,105 @@ let configStruct = {
|
|
893
895
|
],
|
894
896
|
};
|
895
897
|
|
898
|
+
// move ask to the KM's since verbatim is called probably in dialogues?
|
899
|
+
const getAsk = (config) => (uuid) => {
|
900
|
+
// if (!uuid) {
|
901
|
+
// debugger
|
902
|
+
//}
|
903
|
+
return (asks) => {
|
904
|
+
const ask = (ask) => {
|
905
|
+
let oneShot = true // default
|
906
|
+
if (ask.oneShot === false) {
|
907
|
+
oneShot = false
|
908
|
+
}
|
909
|
+
|
910
|
+
const id_q = stableId('semantic')
|
911
|
+
const id_rs = []
|
912
|
+
let wasAsked = false
|
913
|
+
let wasApplied = false
|
914
|
+
const getWasAsked = () => {
|
915
|
+
return wasAsked
|
916
|
+
}
|
917
|
+
const setWasAsked = (value) => {
|
918
|
+
wasAsked = value
|
919
|
+
}
|
920
|
+
const getWasApplied = () => {
|
921
|
+
return wasApplied
|
922
|
+
}
|
923
|
+
const setWasApplied = (value) => {
|
924
|
+
wasApplied = value
|
925
|
+
}
|
926
|
+
|
927
|
+
const semanticsr = ask.semanticsr || []
|
928
|
+
if (semanticsr.length == 0) {
|
929
|
+
semanticsr.push({ match: ask.matchr, apply: ask.applyr })
|
930
|
+
}
|
931
|
+
for (const semantic of semanticsr) {
|
932
|
+
const id_r = stableId('semantic')
|
933
|
+
id_rs.push(id_r)
|
934
|
+
config.addSemantic({
|
935
|
+
uuid,
|
936
|
+
id: id_r,
|
937
|
+
tied_ids: [id_q],
|
938
|
+
oneShot,
|
939
|
+
where: semantic.where || ask.where || where(2),
|
940
|
+
source: 'response',
|
941
|
+
match: (args) => semantic.match(args),
|
942
|
+
apply: (args) => {
|
943
|
+
setWasApplied(true)
|
944
|
+
semantic.apply(args)
|
945
|
+
},
|
946
|
+
})
|
947
|
+
}
|
948
|
+
|
949
|
+
config.addSemantic({
|
950
|
+
uuid,
|
951
|
+
oneShot,
|
952
|
+
id: id_q,
|
953
|
+
tied_ids: id_rs,
|
954
|
+
where: ask.where,
|
955
|
+
isQuestion: true, // do one question at a time
|
956
|
+
getWasAsked,
|
957
|
+
getWasApplied,
|
958
|
+
onNevermind: ask.onNevermind,
|
959
|
+
source: 'question',
|
960
|
+
match: ({ context }) => context.marker == 'controlEnd' || context.marker == 'controlBetween',
|
961
|
+
apply: (args) => {
|
962
|
+
let matchq = ask.matchq
|
963
|
+
let applyq = ask.applyq
|
964
|
+
if (!matchq) {
|
965
|
+
let wasAsked = false
|
966
|
+
matchq = () => !wasAsked,
|
967
|
+
applyq = (args) => {
|
968
|
+
wasAsked = true
|
969
|
+
return ask.applyq(args)
|
970
|
+
}
|
971
|
+
}
|
972
|
+
if (matchq(args)) {
|
973
|
+
setWasAsked(true)
|
974
|
+
setWasApplied(false)
|
975
|
+
// args.context.motivationKeep = true
|
976
|
+
args.verbatim(applyq(args))
|
977
|
+
/*
|
978
|
+
args.context.verbatim = applyq(args)
|
979
|
+
args.context.isResponse = true;
|
980
|
+
delete args.context.controlRemove;
|
981
|
+
*/
|
982
|
+
args.context.controlKeepMotivation = true
|
983
|
+
}
|
984
|
+
args.context.cascade = true
|
985
|
+
}
|
986
|
+
})
|
987
|
+
}
|
988
|
+
if (!Array.isArray(asks)) {
|
989
|
+
asks = [asks]
|
990
|
+
}
|
991
|
+
|
992
|
+
[...asks].reverse().forEach( (a) => ask(a) )
|
993
|
+
}
|
994
|
+
}
|
995
|
+
|
996
|
+
|
896
997
|
const createConfig = () => {
|
897
998
|
const config = new Config(configStruct, module)
|
898
999
|
config.stop_auto_rebuild()
|
@@ -904,7 +1005,7 @@ const createConfig = () => {
|
|
904
1005
|
e: (context) => config.api.getEvaluator(args.s, args.log, context),
|
905
1006
|
}))
|
906
1007
|
*/
|
907
|
-
config.addArgs(({isA}) => ({
|
1008
|
+
config.addArgs(({config, isA}) => ({
|
908
1009
|
isAListable: (context, type) => {
|
909
1010
|
if (context.marker == 'list' || context.listable) {
|
910
1011
|
return context.value.every( (element) => isA(element.marker, type) )
|
@@ -912,7 +1013,7 @@ const createConfig = () => {
|
|
912
1013
|
return isA(context.marker, type)
|
913
1014
|
}
|
914
1015
|
},
|
915
|
-
toContext(v) {
|
1016
|
+
toContext: (v) => {
|
916
1017
|
if (Array.isArray(v)) {
|
917
1018
|
return { marker: 'list', level: 1, value: v }
|
918
1019
|
}
|
@@ -921,6 +1022,10 @@ const createConfig = () => {
|
|
921
1022
|
}
|
922
1023
|
return v
|
923
1024
|
},
|
1025
|
+
getUUIDScoped: (uuid) => { return {
|
1026
|
+
ask: getAsk(config)(uuid),
|
1027
|
+
}
|
1028
|
+
},
|
924
1029
|
}))
|
925
1030
|
objects.mentioned = []
|
926
1031
|
objects.variables = {
|