ekms 9.5.1-beta.5 → 9.5.1-beta.6

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.
Files changed (70) hide show
  1. package/common/animals.instance.json +21 -61
  2. package/common/asking.js +102 -100
  3. package/common/can.instance.json +17 -0
  4. package/common/can.js +188 -0
  5. package/common/characters.js +3 -3
  6. package/common/colors.instance.json +38 -10
  7. package/common/comparable.instance.json +2 -2
  8. package/common/concept.test.json +54 -40
  9. package/common/conjunction.js +13 -5
  10. package/common/crew.instance.json +26 -26
  11. package/common/crew.js +1 -1
  12. package/common/currency.js +1 -1
  13. package/common/dates.instance.json +87 -3
  14. package/common/dialogues.js +11 -8
  15. package/common/dimension.instance.json +1 -1
  16. package/common/edible.instance.json +79 -95
  17. package/common/emotions.instance.json +6 -10
  18. package/common/emotions.js +1 -1
  19. package/common/english_helpers.js +277 -67
  20. package/common/fastfood.instance.json +235 -807
  21. package/common/fastfood.js +4 -4
  22. package/common/formulas.instance.json +1 -1
  23. package/common/gdefaults.js +41 -9
  24. package/common/help.js +2 -2
  25. package/common/helpers/concept.js +1 -1
  26. package/common/helpers/conjunction.js +54 -44
  27. package/common/helpers/dateTimeSelectors.js +2 -2
  28. package/common/helpers/dialogues.js +1 -1
  29. package/common/helpers/formulas.js +13 -11
  30. package/common/helpers/menus.js +12 -12
  31. package/common/helpers/meta.js +8 -8
  32. package/common/helpers/properties.js +76 -15
  33. package/common/helpers.js +82 -46
  34. package/common/hierarchy.js +3 -3
  35. package/common/kirk.instance.json +1 -1
  36. package/common/length.instance.json +2 -2
  37. package/common/math.instance.json +20 -20
  38. package/common/math.js +45 -44
  39. package/common/menus.instance.json +3 -3
  40. package/common/menus.js +1 -1
  41. package/common/meta.js +49 -33
  42. package/common/ordering.instance.json +16 -28
  43. package/common/ordering.js +1 -1
  44. package/common/ordering.test.json +354 -296
  45. package/common/people.instance.json +36 -47
  46. package/common/people.js +1 -1
  47. package/common/people.test.json +952 -681
  48. package/common/pipboy.instance.json +72 -16
  49. package/common/pokemon.instance.json +8 -8
  50. package/common/pokemon.js +1 -1
  51. package/common/pressure.instance.json +2 -2
  52. package/common/properties.instance.json +1 -1
  53. package/common/properties.js +16 -3
  54. package/common/reminders.js +1 -1
  55. package/common/reports.instance.json +3 -3
  56. package/common/reports.js +18 -16
  57. package/common/scorekeeper.js +4 -4
  58. package/common/sdefaults.js +22 -2
  59. package/common/spock.instance.json +1 -1
  60. package/common/stgame.js +1 -1
  61. package/common/stm.js +2 -2
  62. package/common/tell.js +1 -1
  63. package/common/temperature.instance.json +2 -2
  64. package/common/tester.js +3 -3
  65. package/common/time.js +3 -3
  66. package/common/tokenize.js +1 -1
  67. package/common/weight.instance.json +2 -2
  68. package/common/wp.instance.json +62 -6
  69. package/common/wp.js +4 -4
  70. package/package.json +4 -2
@@ -474,7 +474,7 @@
474
474
  "text": "birds and mammals",
475
475
  "range": {
476
476
  "start": 0,
477
- "end": 28
477
+ "end": 16
478
478
  },
479
479
  "types": [
480
480
  "list",
@@ -1416,7 +1416,7 @@
1416
1416
  "word": "mammals",
1417
1417
  "range": {
1418
1418
  "start": 0,
1419
- "end": 16
1419
+ "end": 6
1420
1420
  },
1421
1421
  "dead": true,
1422
1422
  "types": [
@@ -1442,12 +1442,7 @@
1442
1442
  },
1443
1443
  "do": {
1444
1444
  "left": "object",
1445
- "right": "property",
1446
- "range": {
1447
- "start": 0,
1448
- "end": 16
1449
- },
1450
- "text": "mammals have ears"
1445
+ "right": "property"
1451
1446
  },
1452
1447
  "dead": true,
1453
1448
  "level": 2,
@@ -2167,7 +2162,7 @@
2167
2162
  "word": "mammals",
2168
2163
  "range": {
2169
2164
  "start": 0,
2170
- "end": 16
2165
+ "end": 6
2171
2166
  },
2172
2167
  "dead": true,
2173
2168
  "types": [
@@ -2193,12 +2188,7 @@
2193
2188
  },
2194
2189
  "do": {
2195
2190
  "left": "object",
2196
- "right": "property",
2197
- "range": {
2198
- "start": 0,
2199
- "end": 16
2200
- },
2201
- "text": "mammals have hair"
2191
+ "right": "property"
2202
2192
  },
2203
2193
  "dead": true,
2204
2194
  "level": 2,
@@ -2948,7 +2938,7 @@
2948
2938
  "word": "mammals",
2949
2939
  "range": {
2950
2940
  "start": 0,
2951
- "end": 22
2941
+ "end": 6
2952
2942
  },
2953
2943
  "dead": true,
2954
2944
  "types": [
@@ -2974,12 +2964,7 @@
2974
2964
  },
2975
2965
  "do": {
2976
2966
  "left": "object",
2977
- "right": "property",
2978
- "range": {
2979
- "start": 0,
2980
- "end": 22
2981
- },
2982
- "text": "mammals dont have wings"
2967
+ "right": "property"
2983
2968
  },
2984
2969
  "negation": true,
2985
2970
  "level": 2,
@@ -3782,7 +3767,7 @@
3782
3767
  "word": "animals",
3783
3768
  "range": {
3784
3769
  "start": 0,
3785
- "end": 16
3770
+ "end": 6
3786
3771
  },
3787
3772
  "dead": true,
3788
3773
  "types": [
@@ -3808,12 +3793,7 @@
3808
3793
  },
3809
3794
  "do": {
3810
3795
  "left": "object",
3811
- "right": "property",
3812
- "range": {
3813
- "start": 0,
3814
- "end": 16
3815
- },
3816
- "text": "animals have skin"
3796
+ "right": "property"
3817
3797
  },
3818
3798
  "dead": true,
3819
3799
  "level": 2,
@@ -4533,7 +4513,7 @@
4533
4513
  "word": "animals",
4534
4514
  "range": {
4535
4515
  "start": 0,
4536
- "end": 16
4516
+ "end": 6
4537
4517
  },
4538
4518
  "dead": true,
4539
4519
  "types": [
@@ -4559,12 +4539,7 @@
4559
4539
  },
4560
4540
  "do": {
4561
4541
  "left": "object",
4562
- "right": "property",
4563
- "range": {
4564
- "start": 0,
4565
- "end": 16
4566
- },
4567
- "text": "animals have eyes"
4542
+ "right": "property"
4568
4543
  },
4569
4544
  "dead": true,
4570
4545
  "level": 2,
@@ -5284,7 +5259,7 @@
5284
5259
  "word": "birds",
5285
5260
  "range": {
5286
5261
  "start": 0,
5287
- "end": 15
5262
+ "end": 4
5288
5263
  },
5289
5264
  "dead": true,
5290
5265
  "types": [
@@ -5310,12 +5285,7 @@
5310
5285
  },
5311
5286
  "do": {
5312
5287
  "left": "object",
5313
- "right": "property",
5314
- "range": {
5315
- "start": 0,
5316
- "end": 15
5317
- },
5318
- "text": "birds have wings"
5288
+ "right": "property"
5319
5289
  },
5320
5290
  "dead": true,
5321
5291
  "level": 2,
@@ -6035,7 +6005,7 @@
6035
6005
  "word": "birds",
6036
6006
  "range": {
6037
6007
  "start": 0,
6038
- "end": 15
6008
+ "end": 4
6039
6009
  },
6040
6010
  "dead": true,
6041
6011
  "types": [
@@ -6061,12 +6031,7 @@
6061
6031
  },
6062
6032
  "do": {
6063
6033
  "left": "object",
6064
- "right": "property",
6065
- "range": {
6066
- "start": 0,
6067
- "end": 15
6068
- },
6069
- "text": "birds have beaks"
6034
+ "right": "property"
6070
6035
  },
6071
6036
  "dead": true,
6072
6037
  "level": 2,
@@ -6951,7 +6916,7 @@
6951
6916
  "text": "humans bats felines and canines",
6952
6917
  "range": {
6953
6918
  "start": 0,
6954
- "end": 42
6919
+ "end": 30
6955
6920
  },
6956
6921
  "types": [
6957
6922
  "list",
@@ -8562,7 +8527,7 @@
8562
8527
  "text": "owls eagles pidgeons and parrots",
8563
8528
  "range": {
8564
8529
  "start": 0,
8565
- "end": 41
8530
+ "end": 31
8566
8531
  },
8567
8532
  "types": [
8568
8533
  "list",
@@ -10168,7 +10133,7 @@
10168
10133
  "word": "cats",
10169
10134
  "range": {
10170
10135
  "start": 0,
10171
- "end": 15
10136
+ "end": 3
10172
10137
  },
10173
10138
  "dead": true,
10174
10139
  "types": [
@@ -11323,7 +11288,7 @@
11323
11288
  "text": "dogs and wolves",
11324
11289
  "range": {
11325
11290
  "start": 0,
11326
- "end": 26
11291
+ "end": 14
11327
11292
  },
11328
11293
  "types": [
11329
11294
  "list",
@@ -12689,7 +12654,7 @@
12689
12654
  "word": "bats",
12690
12655
  "range": {
12691
12656
  "start": 0,
12692
- "end": 14
12657
+ "end": 3
12693
12658
  },
12694
12659
  "dead": true,
12695
12660
  "types": [
@@ -12715,12 +12680,7 @@
12715
12680
  },
12716
12681
  "do": {
12717
12682
  "left": "object",
12718
- "right": "property",
12719
- "range": {
12720
- "start": 0,
12721
- "end": 14
12722
- },
12723
- "text": "bats have wings"
12683
+ "right": "property"
12724
12684
  },
12725
12685
  "dead": true,
12726
12686
  "level": 2,
package/common/asking.js CHANGED
@@ -43,11 +43,11 @@ const config = {
43
43
  bridge: "{ ...next(operator), choices: after[0] }",
44
44
  semantic: ({askWhich, context}) => {
45
45
  const choices = context.choices
46
- const chosen = ({ choice, objects }) => {
46
+ function chosen({ choice, objects }) {
47
47
  objects.choice = choice
48
48
  }
49
49
 
50
- const question = async ({choices, g, gs, wasAsked, state}) => {
50
+ async function question({choices, g, gs, wasAsked, state}) {
51
51
  if (wasAsked) {
52
52
  return `${await g(state.lastChoice)} is not a choice. The choices are: ${await gs(choices, ' ', ' or ')}`
53
53
  } else {
@@ -55,7 +55,7 @@ const config = {
55
55
  }
56
56
  }
57
57
 
58
- const isChoice = ({context, choices, state}) => {
58
+ function isChoice({context, choices, state}) {
59
59
  state.lastChoice = context
60
60
  for (const choice of choices) {
61
61
  if (choice.value == context.value) {
@@ -64,7 +64,7 @@ const config = {
64
64
  }
65
65
  }
66
66
 
67
- const onNevermind = ({objects, context}) => {
67
+ function onNevermind({objects, context}) {
68
68
  objects.onNevermindWasCalled = true
69
69
  return true
70
70
  }
@@ -94,115 +94,117 @@ const config = {
94
94
  ],
95
95
  };
96
96
 
97
- const getAsk = (config) => (uuid) => {
98
- return (asks) => {
99
- const ask = (ask, s_ids) => {
100
- let oneShot = true // default
101
- if (ask.oneShot === false) {
102
- oneShot = false
103
- }
97
+ function getAsk(config) {
98
+ return (uuid) => {
99
+ return (asks) => {
100
+ function ask(ask, s_ids) {
101
+ let oneShot = true // default
102
+ if (ask.oneShot === false) {
103
+ oneShot = false
104
+ }
104
105
 
105
- const id_q = stableId('semantic')
106
- s_ids.push(id_q)
107
- const id_rs = []
108
- let wasAsked = false
109
- let wasApplied = false
110
- const getWasAsked = () => {
111
- return wasAsked
112
- }
113
- const setWasAsked = (value) => {
114
- wasAsked = value
115
- }
116
- const getWasApplied = () => {
117
- return wasApplied
118
- }
119
- const setWasApplied = (value) => {
120
- wasApplied = value
121
- }
106
+ const id_q = stableId('semantic')
107
+ s_ids.push(id_q)
108
+ const id_rs = []
109
+ let wasAsked = false
110
+ let wasApplied = false
111
+ function getWasAsked() {
112
+ return wasAsked
113
+ }
114
+ function setWasAsked(value) {
115
+ wasAsked = value
116
+ }
117
+ function getWasApplied() {
118
+ return wasApplied
119
+ }
120
+ function setWasApplied(value) {
121
+ wasApplied = value
122
+ }
123
+
124
+ const semanticsr = ask.semanticsr || []
125
+ if (semanticsr.length == 0) {
126
+ semanticsr.push({ match: ask.matchr, apply: ask.applyr })
127
+ }
128
+ for (const semantic of semanticsr) {
129
+ const id_r = stableId('semantic')
130
+ id_rs.push(id_r)
131
+ s_ids.push(id_r)
132
+ // debugger
133
+ config.addSemantic({
134
+ uuid,
135
+ id: id_r,
136
+ tied_ids: [id_q],
137
+ // tied_ids: s_ids,
138
+ onDelete: ask.onDelete,
139
+ oneShot,
140
+ where: semantic.where || ask.where || where(2),
141
+ source: 'response',
142
+ match: (args) => semantic.match(args),
143
+ apply: async (args) => {
144
+ setWasApplied(true)
145
+ await semantic.apply(args)
146
+ },
147
+ })
148
+ }
122
149
 
123
- const semanticsr = ask.semanticsr || []
124
- if (semanticsr.length == 0) {
125
- semanticsr.push({ match: ask.matchr, apply: ask.applyr })
126
- }
127
- for (const semantic of semanticsr) {
128
- const id_r = stableId('semantic')
129
- id_rs.push(id_r)
130
- s_ids.push(id_r)
131
- // debugger
132
150
  config.addSemantic({
133
151
  uuid,
134
- id: id_r,
135
- tied_ids: [id_q],
152
+ oneShot,
153
+ id: id_q,
154
+ tied_ids: id_rs,
136
155
  // tied_ids: s_ids,
156
+ where: ask.where,
157
+ isQuestion: true, // do one question at a time
158
+ getWasAsked,
159
+ getWasApplied,
137
160
  onDelete: ask.onDelete,
138
- oneShot,
139
- where: semantic.where || ask.where || where(2),
140
- source: 'response',
141
- match: (args) => semantic.match(args),
161
+ onNevermind: ask.onNevermind,
162
+ source: 'question',
163
+ match: ({ context }) => context.marker == 'controlEnd' || context.marker == 'controlBetween',
142
164
  apply: async (args) => {
143
- setWasApplied(true)
144
- await semantic.apply(args)
145
- },
146
- })
147
- }
148
-
149
- config.addSemantic({
150
- uuid,
151
- oneShot,
152
- id: id_q,
153
- tied_ids: id_rs,
154
- // tied_ids: s_ids,
155
- where: ask.where,
156
- isQuestion: true, // do one question at a time
157
- getWasAsked,
158
- getWasApplied,
159
- onDelete: ask.onDelete,
160
- onNevermind: ask.onNevermind,
161
- source: 'question',
162
- match: ({ context }) => context.marker == 'controlEnd' || context.marker == 'controlBetween',
163
- apply: async (args) => {
164
- let matchq = ask.matchq
165
- let applyq = ask.applyq
166
- if (!matchq) {
167
- let wasAsked = false
168
- matchq = () => !wasAsked,
169
- applyq = (args) => {
170
- wasAsked = true
171
- return ask.applyq(args)
165
+ let matchq = ask.matchq
166
+ let applyq = ask.applyq
167
+ if (!matchq) {
168
+ let wasAsked = false
169
+ matchq = () => !wasAsked,
170
+ applyq = (args) => {
171
+ wasAsked = true
172
+ return ask.applyq(args)
173
+ }
172
174
  }
175
+ if (await matchq(args)) {
176
+ setWasApplied(false)
177
+ // args.context.motivationKeep = true
178
+ args.verbatim(await applyq({ ...args, wasAsked: getWasAsked() }))
179
+ setWasAsked(true)
180
+ args.context.controlKeepMotivation = true
181
+ } else {
182
+ args._continue()
183
+ }
184
+ args.context.cascade = true
173
185
  }
174
- if (await matchq(args)) {
175
- setWasApplied(false)
176
- // args.context.motivationKeep = true
177
- args.verbatim(await applyq({ ...args, wasAsked: getWasAsked() }))
178
- setWasAsked(true)
179
- args.context.controlKeepMotivation = true
180
- } else {
181
- args._continue()
182
- }
183
- args.context.cascade = true
184
- }
185
- })
186
- }
187
- if (!Array.isArray(asks)) {
188
- asks = [asks]
189
- }
186
+ })
187
+ }
188
+ if (!Array.isArray(asks)) {
189
+ asks = [asks]
190
+ }
190
191
 
191
- const s_ids = []
192
- for (const a of [...asks].reverse()) {
193
- // debugger
194
- ask(a, s_ids)
195
- }
196
-
197
- const cleanUp = () => {
198
- config.removeSemantic(s_ids)
192
+ const s_ids = []
193
+ for (const a of [...asks].reverse()) {
194
+ // debugger
195
+ ask(a, s_ids)
196
+ }
197
+
198
+ function cleanUp() {
199
+ config.removeSemantic(s_ids)
200
+ }
201
+ return cleanUp
199
202
  }
200
- return cleanUp
201
203
  }
202
204
  }
203
205
 
204
206
 
205
- const initializer = ({objects, config, isModule}) => {
207
+ function initializer({objects, config, isModule}) {
206
208
  config.addArgs(({config, api, isA}) => ({
207
209
  getUUIDScoped: (uuid) => {
208
210
  const ask = getAsk(config)(uuid)
@@ -221,7 +223,7 @@ const initializer = ({objects, config, isModule}) => {
221
223
  }
222
224
 
223
225
  if (!question) {
224
- const question = async ({choices, g, gs, wasAsked, state}) => {
226
+ async function question({choices, g, gs, wasAsked, state}) {
225
227
  if (wasAsked) {
226
228
  return `${await g(state.lastChoice)} is not a choice. The choices are: ${await gs(choices, ' ', ' or ')}`
227
229
  } else {
@@ -231,7 +233,7 @@ const initializer = ({objects, config, isModule}) => {
231
233
  }
232
234
 
233
235
  if (!isChoice) {
234
- const isChoice = ({context, choices, state}) => {
236
+ function isChoice({context, choices, state}) {
235
237
  state.lastChoice = context
236
238
  for (const choice of choices) {
237
239
  if (choice.value == context.value) {
@@ -0,0 +1,17 @@
1
+ {
2
+ "configs": [
3
+ {
4
+ "apply": "({isProcess, isTesting, testModuleName, apis, config, addHierarchy}) => {\n if (isProcess || isTesting) {\n const api = apis('properties')\n api.createActionPrefix({\n before: [{tag: 'maker', id: 'maker'}],\n operator: 'make',\n after: [{tag: 'makeable', id: 'makeable'}],\n relation: true,\n flatten: true,\n can: true,\n create: [\n {\n id: 'make',\n infinitive: 'make',\n },\n 'makeable', \n 'maker'\n ],\n localHierarchy: [\n ['unknown', 'maker'],\n ['unknown', 'makeable'],\n ],\n config,\n })\n }\n }"
5
+ }
6
+ ],
7
+ "resultss": [
8
+ {
9
+ "apply": "({isProcess, isTesting, testModuleName, apis, config, addHierarchy}) => {\n if (isProcess || isTesting) {\n const api = apis('properties')\n api.createActionPrefix({\n before: [{tag: 'maker', id: 'maker'}],\n operator: 'make',\n after: [{tag: 'makeable', id: 'makeable'}],\n relation: true,\n flatten: true,\n can: true,\n create: [\n {\n id: 'make',\n infinitive: 'make',\n },\n 'makeable', \n 'maker'\n ],\n localHierarchy: [\n ['unknown', 'maker'],\n ['unknown', 'makeable'],\n ],\n config,\n })\n }\n }"
10
+ }
11
+ ],
12
+ "fragments": [],
13
+ "semantics": [],
14
+ "associations": [],
15
+ "summaries": [],
16
+ "learned_contextual_priorities": []
17
+ }