tpmkms_4wp 9.5.1 → 9.6.0

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 (122) hide show
  1. package/common/animals.instance.json +21 -61
  2. package/common/asking.js +116 -106
  3. package/common/avatar.test.json +1001 -860
  4. package/common/can.instance.json +2174 -0
  5. package/common/can.js +254 -0
  6. package/common/can.test.json +51307 -0
  7. package/common/characters.js +5 -5
  8. package/common/colors.instance.json +12 -12
  9. package/common/comparable.instance.json +3 -3
  10. package/common/concept.js +25 -27
  11. package/common/concept.test.json +180 -144
  12. package/common/conjunction.js +13 -5
  13. package/common/conjunction.test.json +32 -42
  14. package/common/crew.instance.json +196 -160
  15. package/common/crew.js +1 -1
  16. package/common/crew.test.json +4148 -3324
  17. package/common/currency.js +1 -1
  18. package/common/dateTimeSelectors.instance.json +2 -2
  19. package/common/dateTimeSelectors.js +3 -3
  20. package/common/dateTimeSelectors.test.json +76935 -35739
  21. package/common/dates.instance.json +3 -3
  22. package/common/dates.test.json +284 -287
  23. package/common/dialogues.js +41 -119
  24. package/common/dialogues.test.json +1171 -996
  25. package/common/dimension.instance.json +21369 -557
  26. package/common/dimension.js +148 -54
  27. package/common/dimension.test.json +8753 -3495
  28. package/common/drone.instance.json +23712 -0
  29. package/common/drone.js +448 -0
  30. package/common/drone.test.json +66665 -0
  31. package/common/edible.instance.json +32 -32
  32. package/common/emotions.instance.json +75 -76
  33. package/common/emotions.js +1 -1
  34. package/common/emotions.test.json +242 -174
  35. package/common/english_helpers.js +336 -0
  36. package/common/errors.js +6 -6
  37. package/common/evaluate.js +2 -2
  38. package/common/events.js +8 -8
  39. package/common/fastfood.instance.json +389 -245
  40. package/common/fastfood.js +11 -11
  41. package/common/fastfood.test.json +6970 -6829
  42. package/common/formulas.instance.json +1 -1
  43. package/common/formulas.js +1 -1
  44. package/common/gdefaults.js +111 -17
  45. package/common/help.js +12 -12
  46. package/common/help.test.json +65 -11
  47. package/common/helpers/concept.js +1 -1
  48. package/common/helpers/conjunction.js +54 -44
  49. package/common/helpers/dateTimeSelectors.js +2 -2
  50. package/common/helpers/dialogues.js +7 -2
  51. package/common/helpers/formulas.js +13 -11
  52. package/common/helpers/menus.js +12 -12
  53. package/common/helpers/meta.js +9 -9
  54. package/common/helpers/properties.js +185 -62
  55. package/common/helpers.js +167 -48
  56. package/common/hierarchy.js +6 -4
  57. package/common/kirk.instance.json +1 -1
  58. package/common/kirk.test.json +600 -424
  59. package/common/latin.instance.json +12 -12
  60. package/common/latin.js +9 -9
  61. package/common/length.instance.json +27612 -2890
  62. package/common/length.js +6 -1
  63. package/common/length.test.json +45315 -3925
  64. package/common/math.instance.json +29 -29
  65. package/common/math.js +47 -46
  66. package/common/menus.instance.json +7 -10
  67. package/common/menus.js +2 -9
  68. package/common/meta.js +77 -60
  69. package/common/nameable.js +20 -13
  70. package/common/nameable.test.json +436 -0
  71. package/common/numbers.js +1 -1
  72. package/common/ordering.instance.json +87 -19
  73. package/common/ordering.js +1 -1
  74. package/common/ordering.test.json +835 -417
  75. package/common/people.instance.json +96 -348
  76. package/common/people.js +6 -4
  77. package/common/people.test.json +4135 -3606
  78. package/common/pipboy.instance.json +17 -17
  79. package/common/pipboy.js +2 -3
  80. package/common/pokemon.instance.json +13 -13
  81. package/common/pokemon.js +1 -1
  82. package/common/pressure.instance.json +3579 -1610
  83. package/common/pressure.test.json +433 -477
  84. package/common/properties.instance.json +6 -17
  85. package/common/properties.js +25 -7
  86. package/common/properties.test.json +9565 -6951
  87. package/common/rates.instance.json +59 -0
  88. package/common/rates.js +97 -0
  89. package/common/rates.test.json +27702 -0
  90. package/common/reminders.instance.json +4 -4
  91. package/common/reminders.js +5 -5
  92. package/common/reminders.test.json +64635 -25787
  93. package/common/reports.instance.json +3 -3
  94. package/common/reports.js +18 -16
  95. package/common/scorekeeper.js +6 -6
  96. package/common/sdefaults.js +22 -2
  97. package/common/spock.instance.json +1 -1
  98. package/common/spock.test.json +606 -430
  99. package/common/stgame.js +1 -1
  100. package/common/stm.js +17 -6
  101. package/common/tell.js +1 -1
  102. package/common/temperature.instance.json +3659 -1690
  103. package/common/temperature.test.json +433 -477
  104. package/common/tester.js +3 -3
  105. package/common/time.instance.json +24762 -0
  106. package/common/time.js +137 -141
  107. package/common/time.test.json +31876 -3757
  108. package/common/tokenize.js +5 -2
  109. package/common/ui.instance.json +2 -5
  110. package/common/ui.js +1 -8
  111. package/common/weight.instance.json +10360 -4078
  112. package/common/weight.test.json +2601 -2263
  113. package/common/words.instance.json +9 -0
  114. package/common/words.js +53 -0
  115. package/common/words.test.json +2 -0
  116. package/common/wp.instance.json +408 -8
  117. package/common/wp.js +8 -4
  118. package/common/wp.test.json +7385 -6906
  119. package/main.js +4 -2
  120. package/package.json +20 -5
  121. package/common/listener.js +0 -50
  122. package/common/listener.test.json +0 -142
@@ -0,0 +1,336 @@
1
+ function conjugateVerb(infinitive) {
2
+ if (typeof infinitive !== 'string' || infinitive.trim() === '') {
3
+ throw new Error('Input must be a non-empty string');
4
+ }
5
+
6
+ const baseVerb = infinitive.replace(/^to\s+/i, '').trim().toLowerCase();
7
+ if (!baseVerb) throw new Error('Input must be a non-empty string');
8
+
9
+ const conjugations = [];
10
+
11
+ // Add infinitive (bare form, no "to")
12
+ conjugations.push({
13
+ form: 'infinitive',
14
+ word: baseVerb,
15
+ tense: 'infinitive',
16
+ aspect: null,
17
+ number: 'none',
18
+ person: 'none'
19
+ });
20
+
21
+ // === Irregular verb database ===
22
+ const irregulars = {
23
+ be: {
24
+ present: {
25
+ singular: { first: 'am', second: 'are', third: 'is' },
26
+ plural: { first: 'are', second: 'are', third: 'are' }
27
+ },
28
+ past: {
29
+ singular: { first: 'was', second: 'were', third: 'was' },
30
+ plural: { first: 'were', second: 'were', third: 'were' }
31
+ },
32
+ pastParticiple: 'been',
33
+ presentParticiple: 'being'
34
+ },
35
+ have: {
36
+ present: {
37
+ singular: { first: 'have', second: 'have', third: 'has' },
38
+ plural: { first: 'have', second: 'have', third: 'have' }
39
+ },
40
+ past: { singular: { first: 'had', second: 'had', third: 'had' }, plural: { first: 'had', second: 'had', third: 'had' } },
41
+ pastParticiple: 'had',
42
+ presentParticiple: 'having'
43
+ },
44
+ do: {
45
+ present: {
46
+ singular: { first: 'do', second: 'do', third: 'does' },
47
+ plural: { first: 'do', second: 'do', third: 'do' }
48
+ },
49
+ past: { singular: { first: 'did', second: 'did', third: 'did' }, plural: { first: 'did', second: 'did', third: 'did' } },
50
+ pastParticiple: 'done',
51
+ presentParticiple: 'doing'
52
+ },
53
+ go: {
54
+ present: {
55
+ singular: { first: 'go', second: 'go', third: 'goes' },
56
+ plural: { first: 'go', second: 'go', third: 'go' }
57
+ },
58
+ past: { singular: { first: 'went', second: 'went', third: 'went' }, plural: { first: 'went', second: 'went', third: 'went' } },
59
+ pastParticiple: 'gone',
60
+ presentParticiple: 'going'
61
+ },
62
+ say: {
63
+ present: {
64
+ singular: { first: 'say', second: 'say', third: 'says' },
65
+ plural: { first: 'say', second: 'say', third: 'say' }
66
+ },
67
+ past: {
68
+ singular: { first: 'said', second: 'said', third: 'said' },
69
+ plural: { first: 'said', second: 'said', third: 'said' }
70
+ },
71
+ pastParticiple: 'said',
72
+ presentParticiple: 'saying'
73
+ },
74
+ make: {
75
+ present: {
76
+ singular: { first: 'make', second: 'make', third: 'makes' },
77
+ plural: { first: 'make', second: 'make', third: 'make' }
78
+ },
79
+ past: {
80
+ singular: { first: 'made', second: 'made', third: 'made' },
81
+ plural: { first: 'made', second: 'made', third: 'made' }
82
+ },
83
+ pastParticiple: 'made',
84
+ presentParticiple: 'making'
85
+ },
86
+ // Add more irregulars as needed...
87
+ };
88
+
89
+ const irreg = irregulars[baseVerb];
90
+
91
+ const numbers = ['singular', 'plural'];
92
+ const persons = ['first', 'second', 'third'];
93
+
94
+ // === Present tense ===
95
+ if (irreg) {
96
+ for (const num of numbers) {
97
+ for (const pers of persons) {
98
+ conjugations.push({
99
+ form: 'finite',
100
+ word: irreg.present[num][pers],
101
+ tense: 'present',
102
+ aspect: 'simple',
103
+ number: num,
104
+ person: pers
105
+ });
106
+ }
107
+ }
108
+ } else {
109
+ // Regular present tense
110
+ for (const num of numbers) {
111
+ for (const pers of persons) {
112
+ const word = conjugateRegularPresent(baseVerb, num, pers);
113
+ conjugations.push({
114
+ form: 'finite',
115
+ word,
116
+ tense: 'present',
117
+ aspect: 'simple',
118
+ number: num,
119
+ person: pers
120
+ });
121
+ }
122
+ }
123
+ }
124
+
125
+ // === Past tense (simple past) ===
126
+ let pastForm;
127
+ if (irreg && irreg.past) {
128
+ const pastMap = irreg.past;
129
+ for (const num of numbers) {
130
+ for (const pers of persons) {
131
+ conjugations.push({
132
+ form: 'finite',
133
+ word: pastMap[num][pers],
134
+ tense: 'past',
135
+ aspect: 'simple',
136
+ number: num,
137
+ person: pers
138
+ });
139
+ }
140
+ }
141
+ pastForm = pastMap.singular.first; // representative
142
+ } else {
143
+ pastForm = conjugateRegularPast(baseVerb);
144
+ for (const num of numbers) {
145
+ for (const pers of persons) {
146
+ conjugations.push({
147
+ form: 'finite',
148
+ word: pastForm,
149
+ tense: 'past',
150
+ aspect: 'simple',
151
+ number: num,
152
+ person: pers
153
+ });
154
+ }
155
+ }
156
+ }
157
+
158
+ // === Past Participle ===
159
+ const pastParticiple = irreg?.pastParticiple ?? conjugateRegularPast(baseVerb); // same as past for regular verbs
160
+ conjugations.push({
161
+ form: 'pastParticiple',
162
+ word: pastParticiple,
163
+ tense: 'perfect',
164
+ aspect: 'perfect',
165
+ number: 'none',
166
+ person: 'none'
167
+ });
168
+
169
+ // Optional: Present Participle (-ing form)
170
+ const presentParticiple = irreg?.presentParticiple ?? conjugatePresentParticiple(baseVerb);
171
+ conjugations.push({
172
+ form: 'presentParticiple',
173
+ word: presentParticiple,
174
+ tense: 'progressive',
175
+ aspect: 'continuous',
176
+ number: 'none',
177
+ person: 'none'
178
+ });
179
+
180
+ return conjugations;
181
+ }
182
+
183
+ // Helper: regular present 3rd person singular
184
+ function conjugateRegularPresent(verb, number, person) {
185
+ if (number === 'singular' && person === 'third') {
186
+ if (/[sxz]$/.test(verb) || /[cs]h$/.test(verb) || /o$/.test(verb)) {
187
+ return verb + 'es';
188
+ }
189
+ if (/[^aeiou]y$/.test(verb)) {
190
+ return verb.slice(0, -1) + 'ies';
191
+ }
192
+ return verb + 's';
193
+ }
194
+ 1
195
+ return verb;
196
+ }
197
+
198
+ // Helper: regular past & past participle (same for regular verbs)
199
+ function conjugateRegularPast(verb) {
200
+ if (verb.endsWith('e')) {
201
+ return verb + 'd';
202
+ }
203
+ if (/[aeiou][^aeiouyw]$/.test(verb.slice(-2)) && /[bcdfghjklmnpqrstvwxz]$/.test(verb)) {
204
+ // doubled consonant: stop → stopped
205
+ return verb + verb.slice(-1) + 'ed';
206
+ }
207
+ if (/[^aeiou]y$/.test(verb)) {
208
+ return verb.slice(0, -1) + 'ied';
209
+ }
210
+ return verb + 'ed';
211
+ }
212
+
213
+ // Helper: present participle (-ing)
214
+ function conjugatePresentParticiple(verb) {
215
+ if (verb.endsWith('e') && !verb.endsWith('ee') && !verb.endsWith('ie') && !verb.endsWith('ye')) {
216
+ return verb.slice(0, -1) + 'ing';
217
+ }
218
+ if (/[aeiou][^aeiouyw]$/.test(verb.slice(-2)) && /[bcdfghjklmnpqrstvwxz]$/.test(verb.slice(-1))) {
219
+ return verb + verb.slice(-1) + 'ing'; // stop → stopping
220
+ }
221
+ if (verb.endsWith('ie')) {
222
+ return verb.slice(0, -2) + 'ying'; // lie → lying
223
+ }
224
+ return verb + 'ing';
225
+ }
226
+
227
+ // === Bonus: Improved getInfinitive with past participle support ===
228
+ function getInfinitive(form) {
229
+ const word = form.trim().toLowerCase();
230
+ if (!word) throw new Error('Input must be a non-empty string');
231
+
232
+ // ------------------------------------------------------------
233
+ // 1. Irregular forms (present, past, past participle, -ing)
234
+ // ------------------------------------------------------------
235
+ const irregularMap = {
236
+ am: 'be', is: 'be', are: 'be',
237
+ was: 'be', were: 'be', been: 'be', being: 'be',
238
+ have: 'have', has: 'have', had: 'have',
239
+ do: 'do', does: 'do', did: 'do', done: 'do',
240
+ go: 'go', goes: 'go', went: 'go', gone: 'go',
241
+ say: 'say', says: 'say', said: 'say',
242
+ made: 'make',
243
+ };
244
+
245
+ if (irregularMap[word]) return irregularMap[word];
246
+
247
+ // ------------------------------------------------------------
248
+ // 2. Past tense / Past participle (regular verbs)
249
+ // ------------------------------------------------------------
250
+ if (word.endsWith('ed')) {
251
+ // 2a – cried → cry
252
+ if (word.endsWith('ied')) {
253
+ return word.slice(0, -3) + 'y';
254
+ }
255
+
256
+ // 2. liked, moved, danced → like, move, dance
257
+ // These are verbs that end in 'e' → add only 'd' → ends with "ed", but third char from end is 'e'
258
+ if (word.length >= 3 && word[word.length - 3] === 'e') {
259
+ return word.slice(0, -1); // remove only the final 'd'
260
+ }
261
+
262
+ // 2c – stopped, rubbed (consonant doubling)
263
+ let stem = word.slice(0, -2); // remove "ed"
264
+ if (
265
+ stem.length >= 2 &&
266
+ stem[stem.length - 1] === stem[stem.length - 2] && // doubled consonant
267
+ !/[aeiou]/.test(stem[stem.length - 1]) // not a vowel
268
+ ) {
269
+ stem = stem.slice(0, -1); // remove one of the doubled letters
270
+ }
271
+
272
+ const restoreECases = ['liked'];
273
+ if (restoreECases.includes(word)) {
274
+ stem += 'e';
275
+ }
276
+ return stem;
277
+ }
278
+
279
+ // ------------------------------------------------------------
280
+ // 3. Present participle (-ing)
281
+ // ------------------------------------------------------------
282
+ if (word.endsWith('ing')) {
283
+ let stem = word.slice(0, -3);
284
+
285
+ // lying → lie
286
+ if (word.endsWith('ying')) {
287
+ stem = word.slice(0, -4);
288
+ return stem + 'ie';
289
+ }
290
+
291
+ // Undo consonant doubling: stopping → stop, running → run
292
+ if (
293
+ stem.length >= 2 &&
294
+ stem[stem.length - 1] === stem[stem.length - 2] &&
295
+ !/[aeiou]/.test(stem[stem.length - 1])
296
+ ) {
297
+ stem = stem.slice(0, -1);
298
+ }
299
+
300
+ // DO NOT blindly add 'e' — this is the source of "walke", "runne", etc.
301
+ // Only add 'e' in known safe cases — or just don't do it.
302
+ // Here: we add 'e' only if the word is in a small whitelist of common cases
303
+ const restoreECases = ['dancing', 'making', 'taking', 'giving', 'living'];
304
+ if (restoreECases.includes(word)) {
305
+ stem += 'e';
306
+ }
307
+
308
+ return stem;
309
+ }
310
+ // ------------------------------------------------------------
311
+ // 4. Present 3rd-person singular
312
+ // ------------------------------------------------------------
313
+ if (word.endsWith('ies') && word.length > 3) {
314
+ return word.slice(0, -3) + 'y'; // flies → fly
315
+ }
316
+ if (word.endsWith('es') && word.length > 3) {
317
+ const stem = word.slice(0, -2);
318
+ if (/[sxz]$/.test(stem) || /[cs]h$/.test(stem) || stem.endsWith('o')) {
319
+ return stem; // watches → watch
320
+ }
321
+ }
322
+ if (word.endsWith('s') && !word.endsWith('ss') && word.length > 2) {
323
+ return word.slice(0, -1); // walks → walk
324
+ }
325
+
326
+ // ------------------------------------------------------------
327
+ // 5. Nothing matched → return as-is
328
+ // ------------------------------------------------------------
329
+ return word;
330
+ }
331
+
332
+ module.exports = {
333
+ conjugateVerb,
334
+ getInfinitive,
335
+ }
336
+
package/common/errors.js CHANGED
@@ -6,15 +6,15 @@ const tests = require('./errors.test.json')
6
6
  const config = {
7
7
  name: 'errors',
8
8
  operators: [
9
- { pattern: "([drop] ([dropable]))", development: true },
9
+ { pattern: "([drop] ([dropable]))", scope: "testing" },
10
10
  ],
11
11
  bridges: [
12
12
  {
13
13
  id: "drop",
14
14
  bridge: "{ ...next(operator), arg: after[0] }",
15
- development: true
15
+ scope: "testing"
16
16
  },
17
- { id: "dropable", development: true },
17
+ { id: "dropable", scope: "testing" },
18
18
  ],
19
19
  semantics: [
20
20
  {
@@ -53,13 +53,13 @@ knowledgeModule({
53
53
  ...defaultContextCheck(),
54
54
  {
55
55
  property: 'quantity',
56
- filter: ['marker', 'value'],
56
+ check: ['marker', 'value'],
57
57
  },
58
58
  {
59
59
  property: 'pieces',
60
- filter: [
60
+ check: [
61
61
  'marker', 'text',
62
- { property: 'count', filter: ['marker', 'value'] },
62
+ { property: 'count', check: ['marker', 'value'] },
63
63
  ]
64
64
  }]
65
65
  },
@@ -8,7 +8,7 @@ const config = {
8
8
  name: 'evaluate',
9
9
  operators: [
10
10
  "([evaluate] (value))",
11
- { pattern: "([value1])", development: true },
11
+ { pattern: "([value1])", scope: "testing" },
12
12
  ],
13
13
  bridges: [
14
14
  {
@@ -17,7 +17,7 @@ const config = {
17
17
  evaluator: ({context}) => {
18
18
  context.evalue = 'value1 after evaluation'
19
19
  },
20
- development: true,
20
+ scope: "testing",
21
21
  },
22
22
  {
23
23
  where: where(),
package/common/events.js CHANGED
@@ -24,8 +24,8 @@ const config = {
24
24
  operators: [
25
25
  "([after] ([event]) ([action]))",
26
26
  "(([changeable]) [changes])",
27
- { pattern: "([event1])", development: true },
28
- { pattern: "([action1])", development: true },
27
+ { pattern: "([event1])", scope: "testing" },
28
+ { pattern: "([action1])", scope: "testing" },
29
29
  ],
30
30
  bridges: [
31
31
  {
@@ -62,12 +62,12 @@ const config = {
62
62
  }
63
63
  ]
64
64
  },
65
- { id: "event1", level: 0, bridge: "{ ...next(operator) }", development: true },
66
- { id: "action1", level: 0, bridge: "{ ...next(operator) }", development: true },
65
+ { id: "event1", level: 0, bridge: "{ ...next(operator) }", scope: "testing" },
66
+ { id: "action1", level: 0, bridge: "{ ...next(operator) }", scope: "testing" },
67
67
  ],
68
68
  hierarchy: [
69
- { child: 'event1', parent: 'event', development: true },
70
- { child: 'action1', parent: 'action', development: true },
69
+ { child: 'event1', parent: 'event', scope: "testing" },
70
+ { child: 'action1', parent: 'action', scope: "testing" },
71
71
  ['changes', 'event'],
72
72
  ],
73
73
  generators: [
@@ -81,7 +81,7 @@ const config = {
81
81
  semantics: [
82
82
  {
83
83
  notes: 'event1',
84
- development: true,
84
+ scope: "testing",
85
85
  where: where(),
86
86
  match: ({context}) => context.marker == 'event1' && !context.event,
87
87
  apply: ({context, kms, insert}) => {
@@ -90,7 +90,7 @@ const config = {
90
90
  },
91
91
  {
92
92
  notes: 'action1',
93
- development: true,
93
+ scope: "testing",
94
94
  where: where(),
95
95
  match: ({context, isA}) => context.marker == 'action1',
96
96
  apply: ({context, kms}) => {