tpmkms_4wp 9.5.1 → 9.6.0-beta.1

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 (135) hide show
  1. package/common/animals.instance.json +151 -61
  2. package/common/animals.js +3 -5
  3. package/common/asking.js +116 -106
  4. package/common/avatar.test.json +1001 -860
  5. package/common/can.instance.json +2194 -0
  6. package/common/can.js +251 -0
  7. package/common/can.test.json +51307 -0
  8. package/common/characters.js +5 -5
  9. package/common/colors.instance.json +152 -12
  10. package/common/colors.js +3 -6
  11. package/common/comparable.instance.json +33 -3
  12. package/common/comparable.js +3 -6
  13. package/common/concept.js +25 -27
  14. package/common/concept.test.json +180 -144
  15. package/common/conjunction.js +13 -5
  16. package/common/conjunction.test.json +32 -42
  17. package/common/crew.instance.json +433 -173
  18. package/common/crew.js +4 -7
  19. package/common/crew.test.json +4148 -3324
  20. package/common/currency.js +1 -1
  21. package/common/dateTimeSelectors.instance.json +2 -2
  22. package/common/dateTimeSelectors.js +6 -9
  23. package/common/dateTimeSelectors.test.json +76935 -35739
  24. package/common/dates.instance.json +53 -3
  25. package/common/dates.js +3 -6
  26. package/common/dates.test.json +284 -287
  27. package/common/dialogues.js +43 -122
  28. package/common/dialogues.test.json +1248 -1152
  29. package/common/dimension.instance.json +21493 -561
  30. package/common/dimension.js +150 -55
  31. package/common/dimension.test.json +10979 -4625
  32. package/common/drone.instance.json +24709 -0
  33. package/common/drone.js +662 -0
  34. package/common/drone.test.json +30522 -0
  35. package/common/drone_v1.instance.json +24703 -0
  36. package/common/drone_v1.js +596 -0
  37. package/common/drone_v1.test.json +115538 -0
  38. package/common/edible.instance.json +388 -32
  39. package/common/edible.js +3 -5
  40. package/common/emotions.instance.json +85 -76
  41. package/common/emotions.js +4 -7
  42. package/common/emotions.test.json +242 -174
  43. package/common/english_helpers.js +336 -0
  44. package/common/errors.js +6 -6
  45. package/common/evaluate.js +2 -2
  46. package/common/events.js +8 -8
  47. package/common/fastfood.instance.json +1071 -393
  48. package/common/fastfood.js +14 -16
  49. package/common/fastfood.test.json +6970 -6829
  50. package/common/formulas.instance.json +11 -1
  51. package/common/formulas.js +3 -2
  52. package/common/gdefaults.js +111 -17
  53. package/common/help.js +12 -12
  54. package/common/help.test.json +65 -11
  55. package/common/helpers/concept.js +1 -1
  56. package/common/helpers/conjunction.js +54 -44
  57. package/common/helpers/dateTimeSelectors.js +2 -2
  58. package/common/helpers/dialogues.js +10 -2
  59. package/common/helpers/formulas.js +13 -11
  60. package/common/helpers/menus.js +12 -12
  61. package/common/helpers/meta.js +9 -9
  62. package/common/helpers/properties.js +186 -64
  63. package/common/helpers.js +167 -48
  64. package/common/hierarchy.js +12 -10
  65. package/common/kirk.instance.json +11 -1
  66. package/common/kirk.js +4 -6
  67. package/common/kirk.test.json +600 -424
  68. package/common/latin.instance.json +12 -12
  69. package/common/latin.js +12 -14
  70. package/common/length.instance.json +34660 -3158
  71. package/common/length.js +11 -6
  72. package/common/length.test.json +54357 -2557
  73. package/common/math.instance.json +39 -29
  74. package/common/math.js +49 -47
  75. package/common/menus.instance.json +77 -10
  76. package/common/menus.js +4 -13
  77. package/common/meta.js +80 -65
  78. package/common/nameable.js +36 -22
  79. package/common/nameable.test.json +436 -0
  80. package/common/numbers.js +1 -1
  81. package/common/ordering.instance.json +107 -19
  82. package/common/ordering.js +4 -6
  83. package/common/ordering.test.json +835 -417
  84. package/common/people.instance.json +176 -348
  85. package/common/people.js +9 -9
  86. package/common/people.test.json +4135 -3606
  87. package/common/pipboy.instance.json +187 -17
  88. package/common/pipboy.js +4 -4
  89. package/common/pokemon.instance.json +143 -13
  90. package/common/pokemon.js +4 -6
  91. package/common/pressure.instance.json +3610 -1601
  92. package/common/pressure.js +3 -5
  93. package/common/pressure.test.json +433 -477
  94. package/common/properties.instance.json +16 -17
  95. package/common/properties.js +32 -13
  96. package/common/properties.test.json +9565 -6951
  97. package/common/rates.instance.json +59 -0
  98. package/common/rates.js +95 -0
  99. package/common/rates.test.json +27702 -0
  100. package/common/reminders.instance.json +4 -4
  101. package/common/reminders.js +8 -11
  102. package/common/reminders.test.json +64635 -25787
  103. package/common/reports.instance.json +23 -3
  104. package/common/reports.js +21 -21
  105. package/common/scorekeeper.js +9 -12
  106. package/common/sdefaults.js +22 -2
  107. package/common/spock.instance.json +11 -1
  108. package/common/spock.js +4 -7
  109. package/common/spock.test.json +606 -430
  110. package/common/stgame.js +1 -1
  111. package/common/stm.js +41 -24
  112. package/common/tell.js +1 -1
  113. package/common/temperature.instance.json +3163 -1154
  114. package/common/temperature.js +3 -5
  115. package/common/temperature.test.json +433 -477
  116. package/common/tester.js +3 -3
  117. package/common/time.instance.json +24852 -0
  118. package/common/time.js +138 -141
  119. package/common/time.test.json +31876 -3757
  120. package/common/tokenize.js +5 -2
  121. package/common/ui.instance.json +12 -5
  122. package/common/ui.js +4 -13
  123. package/common/weight.instance.json +10501 -4099
  124. package/common/weight.js +3 -5
  125. package/common/weight.test.json +2601 -2263
  126. package/common/words.instance.json +9 -0
  127. package/common/words.js +50 -0
  128. package/common/words.test.json +2 -0
  129. package/common/wp.instance.json +548 -8
  130. package/common/wp.js +10 -8
  131. package/common/wp.test.json +7385 -6906
  132. package/main.js +6 -2
  133. package/package.json +25 -6
  134. package/common/listener.js +0 -50
  135. package/common/listener.test.json +0 -142
package/common/asking.js CHANGED
@@ -12,8 +12,8 @@ const config = {
12
12
  name: 'asking',
13
13
  operators: [
14
14
  "([nevermind])",
15
- { pattern: "([nevermindTestSetup] (allowed))", development: true },
16
- { pattern: "([whichOnesTestSetup] (choices)*)", development: true },
15
+ { pattern: "([nevermindTestSetup] (allowed))", scope: "testing" },
16
+ { pattern: "([whichOnesTestSetup] (choices)*)", scope: "testing" },
17
17
  ],
18
18
  bridges: [
19
19
  {
@@ -22,32 +22,37 @@ const config = {
22
22
  semantic: (args) => {
23
23
  const {config, context} = args
24
24
  // stop asking all questions
25
- for (const semantic of config.semantics) {
25
+ const remove = []
26
+ for (const semantic of config.semantics()) {
26
27
  if (semantic.isQuestion) {
27
28
  let doRemove = true
28
29
  if (semantic.onNevermind && semantic.getWasAsked() && !semantic.getWasApplied()) {
29
30
  doRemove = semantic.onNevermind(args)
30
31
  }
31
32
  if (doRemove) {
32
- config.removeSemantic(semantic)
33
+ remove.push(semantic)
34
+ // config.removeSemantic(semantic)
33
35
  }
34
36
  }
35
37
  }
38
+ for (const semantic of remove) {
39
+ config.removeSemantic(semantic)
40
+ }
36
41
  }
37
42
  },
38
43
 
39
44
  {
40
45
  id: "whichOnesTestSetup",
41
- development: true,
46
+ scope: "testing",
42
47
  generatorp: async ({context, gs}) => `${context.marker} ${await gs(context.choices)}`,
43
48
  bridge: "{ ...next(operator), choices: after[0] }",
44
49
  semantic: ({askWhich, context}) => {
45
50
  const choices = context.choices
46
- const chosen = ({ choice, objects }) => {
51
+ function chosen({ choice, objects }) {
47
52
  objects.choice = choice
48
53
  }
49
54
 
50
- const question = async ({choices, g, gs, wasAsked, state}) => {
55
+ async function question({choices, g, gs, wasAsked, state}) {
51
56
  if (wasAsked) {
52
57
  return `${await g(state.lastChoice)} is not a choice. The choices are: ${await gs(choices, ' ', ' or ')}`
53
58
  } else {
@@ -55,7 +60,7 @@ const config = {
55
60
  }
56
61
  }
57
62
 
58
- const isChoice = ({context, choices, state}) => {
63
+ function isChoice({context, choices, state}) {
59
64
  state.lastChoice = context
60
65
  for (const choice of choices) {
61
66
  if (choice.value == context.value) {
@@ -64,7 +69,7 @@ const config = {
64
69
  }
65
70
  }
66
71
 
67
- const onNevermind = ({objects, context}) => {
72
+ function onNevermind({objects, context}) {
68
73
  objects.onNevermindWasCalled = true
69
74
  return true
70
75
  }
@@ -75,7 +80,7 @@ const config = {
75
80
 
76
81
  {
77
82
  id: "nevermindTestSetup",
78
- development: true,
83
+ scope: "testing",
79
84
  bridge: "{ ...next(operator), type: after[0], postModifiers: ['type'] }",
80
85
  semantic: ({ask, context}) => {
81
86
  const nevermindType = context.type.value
@@ -94,115 +99,120 @@ const config = {
94
99
  ],
95
100
  };
96
101
 
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
- }
102
+ function getAsk(config) {
103
+ return (uuid) => {
104
+ return (asks) => {
105
+ function ask(ask, s_ids) {
106
+ let oneShot = true // default
107
+ if (ask.oneShot === false) {
108
+ oneShot = false
109
+ }
104
110
 
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
- }
111
+ const id_q = stableId('semantic')
112
+ s_ids.push(id_q)
113
+ const id_rs = []
114
+ let wasAsked = false
115
+ let wasApplied = false
116
+ function getWasAsked() {
117
+ return wasAsked
118
+ }
119
+ function setWasAsked(value) {
120
+ wasAsked = value
121
+ }
122
+ function getWasApplied() {
123
+ return wasApplied
124
+ }
125
+ function setWasApplied(value) {
126
+ wasApplied = value
127
+ }
128
+
129
+ const semanticsr = ask.semanticsr || []
130
+ if (semanticsr.length == 0) {
131
+ semanticsr.push({ match: ask.matchr, apply: ask.applyr })
132
+ }
133
+ for (const semantic of semanticsr) {
134
+ const id_r = stableId('semantic')
135
+ id_rs.push(id_r)
136
+ s_ids.push(id_r)
137
+ config.addSemantic({
138
+ uuid,
139
+ id: id_r,
140
+ tied_ids: [id_q],
141
+ // tied_ids: s_ids,
142
+ onDelete: ask.onDelete,
143
+ oneShot,
144
+ where: semantic.where || ask.where || where(2),
145
+ source: 'response',
146
+ match: (args) => semantic.match(args),
147
+ apply: async (args) => {
148
+ setWasApplied(true)
149
+ await semantic.apply(args)
150
+ },
151
+ })
152
+ }
122
153
 
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
154
  config.addSemantic({
133
155
  uuid,
134
- id: id_r,
135
- tied_ids: [id_q],
156
+ oneShot,
157
+ id: id_q,
158
+ tied_ids: id_rs,
136
159
  // tied_ids: s_ids,
160
+ where: ask.where,
161
+ isQuestion: true, // do one question at a time
162
+ getWasAsked,
163
+ getWasApplied,
137
164
  onDelete: ask.onDelete,
138
- oneShot,
139
- where: semantic.where || ask.where || where(2),
140
- source: 'response',
141
- match: (args) => semantic.match(args),
165
+ onNevermind: ask.onNevermind,
166
+ source: 'question',
167
+ match: ({ context }) => context.marker == 'controlEnd' || context.marker == 'controlBetween',
142
168
  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)
169
+ let matchq = ask.matchq
170
+ let applyq = ask.applyq
171
+ if (!matchq) {
172
+ let wasAsked = false
173
+ matchq = () => !wasAsked,
174
+ applyq = (args) => {
175
+ wasAsked = true
176
+ return ask.applyq(args)
177
+ }
172
178
  }
179
+ if (await matchq(args)) {
180
+ setWasApplied(false)
181
+ // args.context.motivationKeep = true
182
+ const query = await applyq({ ...args, wasAsked: getWasAsked() })
183
+ if (typeof query != 'string') {
184
+ throw new Error(`ask expects the value return from applyq to be a string. ${ask.where}`)
185
+ }
186
+ args.verbatim(query)
187
+ setWasAsked(true)
188
+ args.context.controlKeepMotivation = true
189
+ } else {
190
+ args._continue()
191
+ }
192
+ args.context.cascade = true
173
193
  }
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
- }
194
+ })
195
+ }
196
+ if (!Array.isArray(asks)) {
197
+ asks = [asks]
198
+ }
190
199
 
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)
200
+ const s_ids = []
201
+ for (const a of [...asks].reverse()) {
202
+ // debugger
203
+ ask(a, s_ids)
204
+ }
205
+
206
+ function cleanUp() {
207
+ config.removeSemantic(s_ids)
208
+ }
209
+ return cleanUp
199
210
  }
200
- return cleanUp
201
211
  }
202
212
  }
203
213
 
204
214
 
205
- const initializer = ({objects, config, isModule}) => {
215
+ function initializer({objects, config, isModule}) {
206
216
  config.addArgs(({config, api, isA}) => ({
207
217
  getUUIDScoped: (uuid) => {
208
218
  const ask = getAsk(config)(uuid)
@@ -221,7 +231,7 @@ const initializer = ({objects, config, isModule}) => {
221
231
  }
222
232
 
223
233
  if (!question) {
224
- const question = async ({choices, g, gs, wasAsked, state}) => {
234
+ async function question({choices, g, gs, wasAsked, state}) {
225
235
  if (wasAsked) {
226
236
  return `${await g(state.lastChoice)} is not a choice. The choices are: ${await gs(choices, ' ', ' or ')}`
227
237
  } else {
@@ -231,7 +241,7 @@ const initializer = ({objects, config, isModule}) => {
231
241
  }
232
242
 
233
243
  if (!isChoice) {
234
- const isChoice = ({context, choices, state}) => {
244
+ function isChoice({context, choices, state}) {
235
245
  state.lastChoice = context
236
246
  for (const choice of choices) {
237
247
  if (choice.value == context.value) {